@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.
- package/esm2020/lib/api/utils/medius-rest.util.mjs +8 -3
- package/esm2020/lib/components/action/action.component.mjs +22 -9
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +6 -6
- package/esm2020/lib/components/action/models/action-execution.model.mjs +6 -1
- package/esm2020/lib/components/action/models/index.mjs +2 -1
- package/esm2020/lib/components/action/models/tableview-action-default-categories.model.mjs +11 -0
- package/esm2020/lib/components/button/button.component.mjs +46 -0
- package/esm2020/lib/components/button/index.mjs +2 -0
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +3 -2
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +11 -14
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +41 -18
- package/esm2020/lib/components/tableview/route/tableview-route.component.mjs +5 -13
- package/esm2020/lib/components/tableview/table/column-filter/column-filter.component.mjs +5 -2
- package/esm2020/lib/components/tableview/table/column-value/column-value.component.mjs +5 -3
- package/esm2020/lib/components/tableview/table/table.component.mjs +48 -20
- package/esm2020/lib/components/tableview/tableview.component.mjs +9 -3
- package/esm2020/lib/data-providers/table.data-provider.mjs +9 -2
- package/esm2020/lib/data-providers/tableview.data-provider.mjs +30 -2
- package/esm2020/lib/descriptors/action/action-confirmation.descriptor.mjs +106 -0
- package/esm2020/lib/descriptors/action.descriptor.mjs +63 -154
- package/esm2020/lib/descriptors/button.descriptor.mjs +111 -0
- package/esm2020/lib/descriptors/column.descriptor.mjs +120 -27
- package/esm2020/lib/descriptors/editor.descriptor.mjs +109 -7
- package/esm2020/lib/descriptors/field.descriptor.mjs +38 -4
- package/esm2020/lib/descriptors/filter.descriptor.mjs +13 -6
- package/esm2020/lib/descriptors/index.mjs +3 -1
- package/esm2020/lib/descriptors/table.descriptor.mjs +282 -16
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +175 -3
- package/esm2020/lib/descriptors/types/table.type.mjs +10 -1
- package/esm2020/lib/mng-commons.module.mjs +24 -5
- package/esm2020/lib/models/index.mjs +2 -1
- package/esm2020/lib/models/tableview-attr.model.mjs +2 -0
- package/esm2020/lib/pipes/class-map.pipe.mjs +22 -0
- package/esm2020/lib/pipes/getter.pipe.mjs +20 -0
- package/esm2020/lib/pipes/index.mjs +4 -1
- package/esm2020/lib/pipes/template.pipe.mjs +24 -0
- package/esm2020/lib/router/models/router.model.mjs +1 -1
- package/esm2020/lib/router/tableview-route-builder.mjs +41 -17
- package/esm2020/lib/services/action-executor.service.mjs +30 -19
- package/esm2020/lib/styles/button-style.builder.mjs +59 -8
- package/esm2020/lib/styles/styles.util.mjs +2 -2
- package/esm2020/lib/utils/tableview.util.mjs +144 -0
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/mediusinc-mng-commons.mjs +1610 -345
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +1590 -335
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/api/utils/medius-rest.util.d.ts +1 -0
- package/lib/components/action/action.component.d.ts +2 -1
- package/lib/components/action/models/action-execution.model.d.ts +2 -0
- package/lib/components/action/models/index.d.ts +1 -0
- package/lib/components/action/models/tableview-action-default-categories.model.d.ts +10 -0
- package/lib/components/button/button.component.d.ts +16 -0
- package/lib/components/button/index.d.ts +1 -0
- package/lib/components/tableview/route/tableview-route.abstract.component.d.ts +10 -4
- package/lib/components/tableview/route/tableview-route.component.d.ts +0 -5
- package/lib/components/tableview/table/table.component.d.ts +4 -2
- package/lib/components/tableview/tableview.component.d.ts +3 -0
- package/lib/data-providers/table.data-provider.d.ts +6 -1
- package/lib/data-providers/tableview.data-provider.d.ts +16 -2
- package/lib/descriptors/action/action-confirmation.descriptor.d.ts +48 -0
- package/lib/descriptors/action.descriptor.d.ts +30 -83
- package/lib/descriptors/button.descriptor.d.ts +40 -0
- package/lib/descriptors/column.descriptor.d.ts +45 -5
- package/lib/descriptors/editor.descriptor.d.ts +69 -11
- package/lib/descriptors/field.descriptor.d.ts +16 -11
- package/lib/descriptors/filter.descriptor.d.ts +7 -6
- package/lib/descriptors/index.d.ts +2 -0
- package/lib/descriptors/table.descriptor.d.ts +124 -8
- package/lib/descriptors/tableview.descriptor.d.ts +81 -7
- package/lib/descriptors/types/table.type.d.ts +8 -0
- package/lib/mng-commons.module.d.ts +74 -70
- package/lib/models/index.d.ts +1 -0
- package/lib/models/tableview-attr.model.d.ts +9 -0
- package/lib/pipes/class-map.pipe.d.ts +7 -0
- package/lib/pipes/getter.pipe.d.ts +7 -0
- package/lib/pipes/index.d.ts +3 -0
- package/lib/pipes/template.pipe.d.ts +10 -0
- package/lib/router/models/router.model.d.ts +6 -0
- package/lib/router/tableview-route-builder.d.ts +3 -0
- package/lib/styles/button-style.builder.d.ts +43 -2
- package/lib/utils/tableview.util.d.ts +39 -0
- package/package.json +2 -2
- package/public-api.d.ts +1 -0
- package/scss/mng-overrides/_theme_tableview.scss +17 -0
- package/version-info.json +5 -5
|
@@ -3,11 +3,11 @@ import { CommonModule } from '@angular/common';
|
|
|
3
3
|
import * as i1$3 from '@angular/common/http';
|
|
4
4
|
import { HttpErrorResponse, HttpClient, HttpClientModule } from '@angular/common/http';
|
|
5
5
|
import * as i0 from '@angular/core';
|
|
6
|
-
import { InjectionToken, Injectable, Pipe, Inject, EventEmitter, Component, ChangeDetectionStrategy, Optional, HostBinding, Input, Output, Directive, ContentChildren, ViewChild, forwardRef, LOCALE_ID, ViewChildren, HostListener, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
6
|
+
import { InjectionToken, Injectable, Pipe, Inject, EventEmitter, Component, ChangeDetectionStrategy, Optional, HostBinding, Input, Output, Directive, ContentChildren, ViewChild, forwardRef, LOCALE_ID, ViewChildren, inject, HostListener, APP_INITIALIZER, NgModule } from '@angular/core';
|
|
7
7
|
import * as i2$1 from '@angular/forms';
|
|
8
8
|
import { Validators, FormGroup, FormArray, NG_VALUE_ACCESSOR, FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
9
9
|
import * as i1 from '@angular/router';
|
|
10
|
-
import { NavigationEnd, GuardsCheckEnd, RouterModule } from '@angular/router';
|
|
10
|
+
import { NavigationEnd, ActivatedRoute, GuardsCheckEnd, RouterModule } from '@angular/router';
|
|
11
11
|
import * as i2$2 from '@ngx-formly/core';
|
|
12
12
|
import { FieldWrapper, FieldType, FORMLY_CONFIG, FormlyModule } from '@ngx-formly/core';
|
|
13
13
|
import * as i1$2 from '@ngx-translate/core';
|
|
@@ -523,28 +523,63 @@ class TableDataProvider extends DataProvider {
|
|
|
523
523
|
constructor(modelType, serviceType) {
|
|
524
524
|
super(modelType, serviceType);
|
|
525
525
|
this._getAll = () => of(new MediusQueryResult());
|
|
526
|
+
this._getAllReloadSubject = new Subject();
|
|
526
527
|
}
|
|
527
528
|
get getAll() {
|
|
528
529
|
return this._getAll;
|
|
529
530
|
}
|
|
531
|
+
get getAllReload$() {
|
|
532
|
+
return this._getAllReloadSubject.asObservable();
|
|
533
|
+
}
|
|
530
534
|
withGetAll(getAll) {
|
|
531
535
|
this._getAll = getAll;
|
|
532
536
|
return this;
|
|
533
537
|
}
|
|
538
|
+
getAllReload(queryParam) {
|
|
539
|
+
this._getAllReloadSubject.next(queryParam);
|
|
540
|
+
}
|
|
534
541
|
}
|
|
535
542
|
|
|
536
543
|
class TableviewDataProvider extends EditorDataProvider {
|
|
537
544
|
constructor(modelType, serviceType) {
|
|
538
545
|
super(modelType, serviceType);
|
|
539
546
|
this._getAll = () => of(new MediusQueryResult());
|
|
547
|
+
this._getAllReloadSubject = new Subject();
|
|
540
548
|
}
|
|
541
549
|
get getAll() {
|
|
542
550
|
return this._getAll;
|
|
543
551
|
}
|
|
552
|
+
get getAllReload$() {
|
|
553
|
+
return this._getAllReloadSubject.asObservable();
|
|
554
|
+
}
|
|
544
555
|
withGetAll(getAll) {
|
|
545
556
|
this._getAll = getAll;
|
|
546
557
|
return this;
|
|
547
558
|
}
|
|
559
|
+
getAllReload(queryParam) {
|
|
560
|
+
this._getAllReloadSubject.next(queryParam);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
class DynamicTableviewDataProvider extends TableviewDataProvider {
|
|
564
|
+
constructor() {
|
|
565
|
+
super({});
|
|
566
|
+
this._getAll = () => of(new MediusQueryResult());
|
|
567
|
+
this._fetch = () => of({});
|
|
568
|
+
}
|
|
569
|
+
withGetAll(getAll) {
|
|
570
|
+
this._getAll = getAll;
|
|
571
|
+
return this;
|
|
572
|
+
}
|
|
573
|
+
withFetch(fetch) {
|
|
574
|
+
this._fetch = fetch;
|
|
575
|
+
return this;
|
|
576
|
+
}
|
|
577
|
+
get getAll() {
|
|
578
|
+
return this._getAll;
|
|
579
|
+
}
|
|
580
|
+
get fetch() {
|
|
581
|
+
return this._fetch;
|
|
582
|
+
}
|
|
548
583
|
}
|
|
549
584
|
|
|
550
585
|
class TableviewCrudDataProvider extends TableviewDataProvider {
|
|
@@ -841,6 +876,15 @@ var TableSizeEnum;
|
|
|
841
876
|
TableSizeEnum[TableSizeEnum["Normal"] = 1] = "Normal";
|
|
842
877
|
TableSizeEnum[TableSizeEnum["Large"] = 2] = "Large";
|
|
843
878
|
})(TableSizeEnum || (TableSizeEnum = {}));
|
|
879
|
+
/**
|
|
880
|
+
* EXCLUDE default, all columns has sort and filter on by default, developer EXCLUDES properties from sort/filter
|
|
881
|
+
* INCLUDE_ONLY only selected columns have sort/filter, developers INCLUDES properties
|
|
882
|
+
*/
|
|
883
|
+
var TableDynamicColumnsModeEnum;
|
|
884
|
+
(function (TableDynamicColumnsModeEnum) {
|
|
885
|
+
TableDynamicColumnsModeEnum[TableDynamicColumnsModeEnum["EXCLUDE"] = 0] = "EXCLUDE";
|
|
886
|
+
TableDynamicColumnsModeEnum[TableDynamicColumnsModeEnum["INCLUDE_ONLY"] = 1] = "INCLUDE_ONLY";
|
|
887
|
+
})(TableDynamicColumnsModeEnum || (TableDynamicColumnsModeEnum = {}));
|
|
844
888
|
|
|
845
889
|
class StylesUtil {
|
|
846
890
|
static calculateTableColumnActionWidth(table, actions) {
|
|
@@ -859,7 +903,7 @@ class StylesUtil {
|
|
|
859
903
|
}
|
|
860
904
|
}
|
|
861
905
|
static getActionButtonRoundedWidth(action) {
|
|
862
|
-
switch (action.size) {
|
|
906
|
+
switch (action.buttonDescriptor.styleClass.size) {
|
|
863
907
|
case ActionSizeEnum.ExtraSmall:
|
|
864
908
|
return StylesUtil.BUTTON_ROUNDED_WIDTH_XS;
|
|
865
909
|
case ActionSizeEnum.Small:
|
|
@@ -883,17 +927,18 @@ StylesUtil.TABLE_CELL_PADDING_X_SM = 4;
|
|
|
883
927
|
StylesUtil.TABLE_CELL_PADDING_X_LG = 12;
|
|
884
928
|
|
|
885
929
|
class ButtonStyleBuilder {
|
|
886
|
-
constructor(level, customClass) {
|
|
930
|
+
constructor(level = ActionLevelEnum.Default, customClass) {
|
|
887
931
|
this._size = ActionSizeEnum.Normal;
|
|
888
932
|
this._textButton = false;
|
|
889
933
|
this._outlineButton = false;
|
|
890
934
|
this._raisedButton = false;
|
|
935
|
+
this._roundedStyle = ButtonStyleRoundedEnum.DEFAULT;
|
|
891
936
|
this._actionLevel = level;
|
|
892
937
|
this._customClass = customClass;
|
|
893
938
|
}
|
|
894
939
|
getButtonClass(hasNoTitle = false) {
|
|
895
940
|
const styles = [this.convertActionLevelToStyleClass(), this.convertSizeToStyleClass(), this._customClass];
|
|
896
|
-
if (hasNoTitle) {
|
|
941
|
+
if (hasNoTitle && this._roundedStyle === ButtonStyleRoundedEnum.DEFAULT) {
|
|
897
942
|
styles.push(`p-button-rounded mng-action-button-icon`);
|
|
898
943
|
}
|
|
899
944
|
if (this._textButton) {
|
|
@@ -905,37 +950,78 @@ class ButtonStyleBuilder {
|
|
|
905
950
|
if (this._raisedButton) {
|
|
906
951
|
styles.push(`p-button-raised`);
|
|
907
952
|
}
|
|
953
|
+
if (this._roundedStyle === ButtonStyleRoundedEnum.ROUNDED) {
|
|
954
|
+
styles.push('p-button-rounded');
|
|
955
|
+
}
|
|
908
956
|
return styles.join(' ');
|
|
909
957
|
}
|
|
910
|
-
|
|
958
|
+
/**
|
|
959
|
+
* creates instance of style builder with custom properties
|
|
960
|
+
* @param actionLevel ActionLevelEnum
|
|
961
|
+
* @param size ActionSizeEnum
|
|
962
|
+
* @param textButton if true, text button will be applied
|
|
963
|
+
* @param outlineButton if true, outlined button will be applied
|
|
964
|
+
* @param raisedButton if true, raised button will be applied
|
|
965
|
+
* @param customClass additional custom classes (will be added at generating)
|
|
966
|
+
*/
|
|
967
|
+
create(actionLevel, size, textButton, outlineButton, raisedButton, roundedButton, customClass) {
|
|
911
968
|
this._actionLevel = actionLevel ?? this._actionLevel;
|
|
912
969
|
this._size = size ?? this._size;
|
|
913
970
|
this._textButton = textButton ?? this._textButton;
|
|
914
971
|
this._outlineButton = outlineButton ?? this._outlineButton;
|
|
915
972
|
this._raisedButton = raisedButton ?? this._raisedButton;
|
|
973
|
+
this._roundedStyle = roundedButton ?? this._roundedStyle;
|
|
916
974
|
this._customClass = customClass;
|
|
917
975
|
return this;
|
|
918
976
|
}
|
|
977
|
+
/**
|
|
978
|
+
* sets custom action level and returns this object
|
|
979
|
+
* @param actionLevel
|
|
980
|
+
*/
|
|
919
981
|
withActionLevel(actionLevel) {
|
|
920
982
|
this._actionLevel = actionLevel;
|
|
921
983
|
return this;
|
|
922
984
|
}
|
|
985
|
+
/**
|
|
986
|
+
* sets custom size and return this object
|
|
987
|
+
* @param size
|
|
988
|
+
*/
|
|
923
989
|
withSize(size) {
|
|
924
990
|
this._size = size;
|
|
925
991
|
return this;
|
|
926
992
|
}
|
|
993
|
+
/**
|
|
994
|
+
* sets text button property
|
|
995
|
+
* @param withText default true
|
|
996
|
+
*/
|
|
927
997
|
withTextButton(withText = true) {
|
|
928
998
|
this._textButton = withText;
|
|
929
999
|
return this;
|
|
930
1000
|
}
|
|
1001
|
+
/**
|
|
1002
|
+
* sets outline button property
|
|
1003
|
+
* @param withOutline default true
|
|
1004
|
+
*/
|
|
931
1005
|
withOutlineButton(withOutline = true) {
|
|
932
1006
|
this._outlineButton = withOutline;
|
|
933
1007
|
return this;
|
|
934
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* sets raised button property
|
|
1011
|
+
* @param withRaised default true
|
|
1012
|
+
*/
|
|
935
1013
|
withRaisedButton(withRaised = true) {
|
|
936
1014
|
this._raisedButton = withRaised;
|
|
937
1015
|
return this;
|
|
938
1016
|
}
|
|
1017
|
+
withRoundedButton(roundedStyle = ButtonStyleRoundedEnum.ROUNDED) {
|
|
1018
|
+
this._roundedStyle = roundedStyle;
|
|
1019
|
+
return this;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* sets custom style class
|
|
1023
|
+
* @param customClass
|
|
1024
|
+
*/
|
|
939
1025
|
withCustomClass(customClass) {
|
|
940
1026
|
this._customClass = customClass;
|
|
941
1027
|
return this;
|
|
@@ -962,15 +1048,15 @@ class ButtonStyleBuilder {
|
|
|
962
1048
|
convertSizeToStyleClass() {
|
|
963
1049
|
switch (this._size) {
|
|
964
1050
|
case ActionSizeEnum.ExtraSmall:
|
|
965
|
-
return 'mng-button-xs';
|
|
1051
|
+
return 'p-button-sm mng-button-xs';
|
|
966
1052
|
case ActionSizeEnum.Small:
|
|
967
|
-
return 'mng-button-sm';
|
|
1053
|
+
return 'p-button-sm mng-button-sm';
|
|
968
1054
|
case ActionSizeEnum.Normal:
|
|
969
1055
|
return '';
|
|
970
1056
|
case ActionSizeEnum.Large:
|
|
971
|
-
return 'mng-button-lg';
|
|
1057
|
+
return 'p-button-lg mng-button-lg';
|
|
972
1058
|
case ActionSizeEnum.ExtraLarge:
|
|
973
|
-
return 'mng-button-xl';
|
|
1059
|
+
return 'p-button-lg mng-button-xl';
|
|
974
1060
|
}
|
|
975
1061
|
}
|
|
976
1062
|
get actionLevel() {
|
|
@@ -988,10 +1074,123 @@ class ButtonStyleBuilder {
|
|
|
988
1074
|
get raisedButton() {
|
|
989
1075
|
return this._raisedButton;
|
|
990
1076
|
}
|
|
1077
|
+
get roundedStyle() {
|
|
1078
|
+
return this._roundedStyle;
|
|
1079
|
+
}
|
|
991
1080
|
get customClass() {
|
|
992
1081
|
return this._customClass;
|
|
993
1082
|
}
|
|
994
1083
|
}
|
|
1084
|
+
var ButtonStyleRoundedEnum;
|
|
1085
|
+
(function (ButtonStyleRoundedEnum) {
|
|
1086
|
+
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["DEFAULT"] = 0] = "DEFAULT";
|
|
1087
|
+
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["ROUNDED"] = 1] = "ROUNDED";
|
|
1088
|
+
ButtonStyleRoundedEnum[ButtonStyleRoundedEnum["SQUARE"] = 2] = "SQUARE";
|
|
1089
|
+
})(ButtonStyleRoundedEnum || (ButtonStyleRoundedEnum = {}));
|
|
1090
|
+
|
|
1091
|
+
class ActionConfirmationDialogDescriptor {
|
|
1092
|
+
constructor() {
|
|
1093
|
+
this._closeOnEscape = true; // Defines if dialog closes when esc key is pressed.
|
|
1094
|
+
this._closable = true; // Defines if dialog is closable.
|
|
1095
|
+
this._acceptButtonStyle = new ButtonStyleBuilder(ActionLevelEnum.Default);
|
|
1096
|
+
this._rejectButtonStyle = new ButtonStyleBuilder(ActionLevelEnum.Default).withTextButton();
|
|
1097
|
+
this._icon = 'pi pi-exclamation-triangle';
|
|
1098
|
+
this._acceptIcon = 'pi pi-check';
|
|
1099
|
+
this._rejectIcon = 'pi pi-times';
|
|
1100
|
+
}
|
|
1101
|
+
withIcon(icon) {
|
|
1102
|
+
this._icon = icon;
|
|
1103
|
+
return this;
|
|
1104
|
+
}
|
|
1105
|
+
withTitle(title) {
|
|
1106
|
+
this._title = title;
|
|
1107
|
+
return this;
|
|
1108
|
+
}
|
|
1109
|
+
withMessage(message) {
|
|
1110
|
+
this._message = message;
|
|
1111
|
+
return this;
|
|
1112
|
+
}
|
|
1113
|
+
withAcceptLabel(acceptLabel) {
|
|
1114
|
+
this._acceptLabel = acceptLabel;
|
|
1115
|
+
return this;
|
|
1116
|
+
}
|
|
1117
|
+
withAcceptIcon(acceptIcon) {
|
|
1118
|
+
this._acceptIcon = acceptIcon;
|
|
1119
|
+
return this;
|
|
1120
|
+
}
|
|
1121
|
+
withAcceptButtonStyle(buttonStyle) {
|
|
1122
|
+
this._acceptButtonStyle = buttonStyle;
|
|
1123
|
+
return this;
|
|
1124
|
+
}
|
|
1125
|
+
withRejectLabel(rejectLabel) {
|
|
1126
|
+
this._rejectLabel = rejectLabel;
|
|
1127
|
+
return this;
|
|
1128
|
+
}
|
|
1129
|
+
withRejectIcon(rejectIcon) {
|
|
1130
|
+
this._rejectIcon = rejectIcon;
|
|
1131
|
+
return this;
|
|
1132
|
+
}
|
|
1133
|
+
withRejectButtonStyle(buttonStyle) {
|
|
1134
|
+
this._rejectButtonStyle = buttonStyle;
|
|
1135
|
+
return this;
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* set if dialog can be closed on escaped pressed
|
|
1139
|
+
* if true, then closable is also set to true
|
|
1140
|
+
* @param closeOnEscape
|
|
1141
|
+
*/
|
|
1142
|
+
withCloseOnEscape(closeOnEscape) {
|
|
1143
|
+
if (closeOnEscape) {
|
|
1144
|
+
this._closable = true;
|
|
1145
|
+
}
|
|
1146
|
+
this._closeOnEscape = closeOnEscape;
|
|
1147
|
+
return this;
|
|
1148
|
+
}
|
|
1149
|
+
withClosable(closable) {
|
|
1150
|
+
this._closable = closable;
|
|
1151
|
+
return this;
|
|
1152
|
+
}
|
|
1153
|
+
withRunConfirmationConfigMapFn(runConfirmationConfigMapFn) {
|
|
1154
|
+
this._runConfirmationConfigMapFn = runConfirmationConfigMapFn;
|
|
1155
|
+
return this;
|
|
1156
|
+
}
|
|
1157
|
+
get icon() {
|
|
1158
|
+
return this._icon;
|
|
1159
|
+
}
|
|
1160
|
+
get title() {
|
|
1161
|
+
return this._title;
|
|
1162
|
+
}
|
|
1163
|
+
get message() {
|
|
1164
|
+
return this._message;
|
|
1165
|
+
}
|
|
1166
|
+
get acceptLabel() {
|
|
1167
|
+
return this._acceptLabel;
|
|
1168
|
+
}
|
|
1169
|
+
get acceptIcon() {
|
|
1170
|
+
return this._acceptIcon;
|
|
1171
|
+
}
|
|
1172
|
+
get acceptButtonStyle() {
|
|
1173
|
+
return this._acceptButtonStyle;
|
|
1174
|
+
}
|
|
1175
|
+
get rejectLabel() {
|
|
1176
|
+
return this._rejectLabel;
|
|
1177
|
+
}
|
|
1178
|
+
get rejectIcon() {
|
|
1179
|
+
return this._rejectIcon;
|
|
1180
|
+
}
|
|
1181
|
+
get rejectButtonStyle() {
|
|
1182
|
+
return this._rejectButtonStyle;
|
|
1183
|
+
}
|
|
1184
|
+
get closeOnEscape() {
|
|
1185
|
+
return this._closeOnEscape;
|
|
1186
|
+
}
|
|
1187
|
+
get closable() {
|
|
1188
|
+
return this._closable;
|
|
1189
|
+
}
|
|
1190
|
+
get runConfirmationConfigMapFn() {
|
|
1191
|
+
return this._runConfirmationConfigMapFn;
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
995
1194
|
|
|
996
1195
|
class ActionDescriptor {
|
|
997
1196
|
constructor(model, actionName, parentType, parentProperty) {
|
|
@@ -1000,10 +1199,12 @@ class ActionDescriptor {
|
|
|
1000
1199
|
this._position = ActionPositionEnum.ToolbarRight;
|
|
1001
1200
|
this._level = ActionLevelEnum.Default;
|
|
1002
1201
|
this._routeUrl = null;
|
|
1003
|
-
this._buttonStyle = new ButtonStyleBuilder(this._level);
|
|
1004
|
-
this._hasRunConfirmation = false;
|
|
1005
1202
|
this._hasRunNotificationSuccess = true;
|
|
1006
1203
|
this._hasRunNotificationError = true;
|
|
1204
|
+
//button
|
|
1205
|
+
this._buttonDescriptor = new ButtonDescriptor();
|
|
1206
|
+
// multiple row selection
|
|
1207
|
+
this._hasItemsSelection = false;
|
|
1007
1208
|
this._model = model;
|
|
1008
1209
|
this._actionName = actionName;
|
|
1009
1210
|
if ((parentType && !parentProperty) || (!parentProperty && parentProperty)) {
|
|
@@ -1052,15 +1253,6 @@ class ActionDescriptor {
|
|
|
1052
1253
|
get routeUrl() {
|
|
1053
1254
|
return this._routeUrl;
|
|
1054
1255
|
}
|
|
1055
|
-
get title() {
|
|
1056
|
-
return this._title;
|
|
1057
|
-
}
|
|
1058
|
-
get icon() {
|
|
1059
|
-
return this._icon;
|
|
1060
|
-
}
|
|
1061
|
-
get tooltip() {
|
|
1062
|
-
return this._tooltip;
|
|
1063
|
-
}
|
|
1064
1256
|
get dataProvider() {
|
|
1065
1257
|
return this._dataProvider;
|
|
1066
1258
|
}
|
|
@@ -1085,83 +1277,14 @@ class ActionDescriptor {
|
|
|
1085
1277
|
get actionNameLong() {
|
|
1086
1278
|
return this._actionNameLong;
|
|
1087
1279
|
}
|
|
1088
|
-
get buttonStyle() {
|
|
1089
|
-
return this._buttonStyle;
|
|
1090
|
-
}
|
|
1091
|
-
/**
|
|
1092
|
-
* @deprecated use _buttonStyle instead
|
|
1093
|
-
*/
|
|
1094
1280
|
get className() {
|
|
1095
|
-
return this.
|
|
1096
|
-
}
|
|
1097
|
-
/**
|
|
1098
|
-
* @deprecated use _buttonStyle instead
|
|
1099
|
-
*/
|
|
1100
|
-
get isStyleText() {
|
|
1101
|
-
return this._buttonStyle.textButton;
|
|
1281
|
+
return this.buttonDescriptor.styleClass.customClass;
|
|
1102
1282
|
}
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
*/
|
|
1106
|
-
get isStyleOutlined() {
|
|
1107
|
-
return this._buttonStyle.outlineButton;
|
|
1108
|
-
}
|
|
1109
|
-
/**
|
|
1110
|
-
* @deprecated use _buttonStyle instead
|
|
1111
|
-
*/
|
|
1112
|
-
get isStyleRaised() {
|
|
1113
|
-
return this._buttonStyle.raisedButton;
|
|
1114
|
-
}
|
|
1115
|
-
/**
|
|
1116
|
-
* @deprecated use _buttonStyle instead
|
|
1117
|
-
*/
|
|
1118
|
-
get size() {
|
|
1119
|
-
return this._buttonStyle.size;
|
|
1120
|
-
}
|
|
1121
|
-
/**
|
|
1122
|
-
* @deprecated use _buttonStyle instead
|
|
1123
|
-
*/
|
|
1124
|
-
get isSizeExtraSmall() {
|
|
1125
|
-
return this._buttonStyle.size === ActionSizeEnum.ExtraSmall;
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* @deprecated use _buttonStyle instead
|
|
1129
|
-
*/
|
|
1130
|
-
get isSizeSmall() {
|
|
1131
|
-
return this._buttonStyle.size === ActionSizeEnum.Small;
|
|
1132
|
-
}
|
|
1133
|
-
/**
|
|
1134
|
-
* @deprecated use _buttonStyle instead
|
|
1135
|
-
*/
|
|
1136
|
-
get isSizeLarge() {
|
|
1137
|
-
return this._buttonStyle.size === ActionSizeEnum.Large;
|
|
1138
|
-
}
|
|
1139
|
-
/**
|
|
1140
|
-
* @deprecated use _buttonStyle instead
|
|
1141
|
-
*/
|
|
1142
|
-
get isSizeExtraLarge() {
|
|
1143
|
-
return this._buttonStyle.size === ActionSizeEnum.ExtraLarge;
|
|
1283
|
+
get runConfirmationDialogDescriptor() {
|
|
1284
|
+
return this._runConfirmationDialogDescriptor;
|
|
1144
1285
|
}
|
|
1145
1286
|
get hasRunConfirmation() {
|
|
1146
|
-
return this.
|
|
1147
|
-
}
|
|
1148
|
-
get runConfirmationIcon() {
|
|
1149
|
-
return this._runConfirmationIcon;
|
|
1150
|
-
}
|
|
1151
|
-
get runConfirmationTitle() {
|
|
1152
|
-
return this._runConfirmationTitle;
|
|
1153
|
-
}
|
|
1154
|
-
get runConfirmationMessage() {
|
|
1155
|
-
return this._runConfirmationMessage;
|
|
1156
|
-
}
|
|
1157
|
-
get runConfirmationAcceptTitle() {
|
|
1158
|
-
return this._runConfirmationAcceptTitle;
|
|
1159
|
-
}
|
|
1160
|
-
get runConfirmationRejectTitle() {
|
|
1161
|
-
return this._runConfirmationRejectTitle;
|
|
1162
|
-
}
|
|
1163
|
-
get runConfirmationConfigMapFn() {
|
|
1164
|
-
return this._runConfirmationConfigMapFn;
|
|
1287
|
+
return this._runConfirmationDialogDescriptor !== null && this._runConfirmationDialogDescriptor !== undefined;
|
|
1165
1288
|
}
|
|
1166
1289
|
get hasRunNotificationSuccess() {
|
|
1167
1290
|
return this._hasRunNotificationSuccess;
|
|
@@ -1193,6 +1316,12 @@ class ActionDescriptor {
|
|
|
1193
1316
|
get permissionsRouteType() {
|
|
1194
1317
|
return this._permissionsRouteType;
|
|
1195
1318
|
}
|
|
1319
|
+
get hasItemsSelection() {
|
|
1320
|
+
return this._hasItemsSelection;
|
|
1321
|
+
}
|
|
1322
|
+
get buttonDescriptor() {
|
|
1323
|
+
return this._buttonDescriptor;
|
|
1324
|
+
}
|
|
1196
1325
|
withDataProvider(dataProvider) {
|
|
1197
1326
|
this._dataProvider = dataProvider;
|
|
1198
1327
|
return this;
|
|
@@ -1221,70 +1350,25 @@ class ActionDescriptor {
|
|
|
1221
1350
|
this._routeUrl = routeUrl;
|
|
1222
1351
|
return this;
|
|
1223
1352
|
}
|
|
1224
|
-
|
|
1225
|
-
this.
|
|
1226
|
-
this._buttonStyle = this._buttonStyle.withActionLevel(level);
|
|
1353
|
+
withPosition(position) {
|
|
1354
|
+
this._position = position;
|
|
1227
1355
|
return this;
|
|
1228
1356
|
}
|
|
1229
1357
|
/**
|
|
1230
|
-
*
|
|
1358
|
+
* creates confirmation action with default style based on action descriptor
|
|
1231
1359
|
*/
|
|
1232
|
-
|
|
1233
|
-
this.
|
|
1234
|
-
|
|
1360
|
+
withRunConfirmation() {
|
|
1361
|
+
this._runConfirmationDialogDescriptor = new ActionConfirmationDialogDescriptor();
|
|
1362
|
+
this._runConfirmationDialogDescriptor.acceptButtonStyle.withActionLevel(this._level);
|
|
1363
|
+
this._runConfirmationDialogDescriptor.rejectButtonStyle.withActionLevel(this._level);
|
|
1364
|
+
return this._runConfirmationDialogDescriptor;
|
|
1235
1365
|
}
|
|
1236
1366
|
/**
|
|
1237
|
-
*
|
|
1238
|
-
* @param
|
|
1367
|
+
* Add a configuration dialogue to action using ActionConfigurationDescriptor
|
|
1368
|
+
* @param confirmationDescriptor descriptor with customizable information for dialog
|
|
1239
1369
|
*/
|
|
1240
|
-
|
|
1241
|
-
this.
|
|
1242
|
-
return this;
|
|
1243
|
-
}
|
|
1244
|
-
withIcon(icon) {
|
|
1245
|
-
this._icon = icon;
|
|
1246
|
-
return this;
|
|
1247
|
-
}
|
|
1248
|
-
withTooltip(tooltip) {
|
|
1249
|
-
this._tooltip = tooltip;
|
|
1250
|
-
return this;
|
|
1251
|
-
}
|
|
1252
|
-
withClassName(className) {
|
|
1253
|
-
this._buttonStyle = this._buttonStyle.withCustomClass(className);
|
|
1254
|
-
return this;
|
|
1255
|
-
}
|
|
1256
|
-
withSize(size = ActionSizeEnum.Normal) {
|
|
1257
|
-
this._buttonStyle = this._buttonStyle.withSize(size);
|
|
1258
|
-
return this;
|
|
1259
|
-
}
|
|
1260
|
-
withStyle(styleText = false, styleOutlined = false, styleRaised = false) {
|
|
1261
|
-
this._buttonStyle = this._buttonStyle.withOutlineButton(styleOutlined);
|
|
1262
|
-
this._buttonStyle = this._buttonStyle.withRaisedButton(styleRaised);
|
|
1263
|
-
this._buttonStyle = this._buttonStyle.withTextButton(styleText);
|
|
1264
|
-
return this;
|
|
1265
|
-
}
|
|
1266
|
-
withPosition(position) {
|
|
1267
|
-
this._position = position;
|
|
1268
|
-
return this;
|
|
1269
|
-
}
|
|
1270
|
-
/**
|
|
1271
|
-
* Add a confirmation dialogue to the action
|
|
1272
|
-
* @param icon the icon to display on the confirmation dialogue
|
|
1273
|
-
* @param title the title of the confirmation dialogue
|
|
1274
|
-
* @param message the message on the confirmation dialogue
|
|
1275
|
-
* @param acceptTitle the title of the accepting button
|
|
1276
|
-
* @param rejectTitle the title of the rejecting button
|
|
1277
|
-
* @param runConfirmationConfigMapFn function used to generate the confirmation dialogue. **WARNING** changing the *accept* and *reject* methods of the *confirmConfig* parameter
|
|
1278
|
-
* may lead to unexpected behaviour
|
|
1279
|
-
*/
|
|
1280
|
-
withRunConfirmation(icon = 'pi pi-exclamation-triangle', title, message, acceptTitle, rejectTitle, runConfirmationConfigMapFn) {
|
|
1281
|
-
this._hasRunConfirmation = true;
|
|
1282
|
-
this._runConfirmationIcon = icon;
|
|
1283
|
-
this._runConfirmationTitle = title;
|
|
1284
|
-
this._runConfirmationMessage = message;
|
|
1285
|
-
this._runConfirmationAcceptTitle = acceptTitle;
|
|
1286
|
-
this._runConfirmationRejectTitle = rejectTitle;
|
|
1287
|
-
this._runConfirmationConfigMapFn = runConfirmationConfigMapFn;
|
|
1370
|
+
withRunConfirmationDescriptor(runConfirmationDialogDescriptor) {
|
|
1371
|
+
this._runConfirmationDialogDescriptor = runConfirmationDialogDescriptor;
|
|
1288
1372
|
return this;
|
|
1289
1373
|
}
|
|
1290
1374
|
withRunNotificationSuccess(title, message, hasNotification = true) {
|
|
@@ -1318,6 +1402,15 @@ class ActionDescriptor {
|
|
|
1318
1402
|
this._permissionsRouteType = permissionsRouteType;
|
|
1319
1403
|
return this;
|
|
1320
1404
|
}
|
|
1405
|
+
withButtonDescriptor(buttonDescriptor) {
|
|
1406
|
+
this._buttonDescriptor = buttonDescriptor;
|
|
1407
|
+
return this;
|
|
1408
|
+
}
|
|
1409
|
+
withItemsSelection(hasSelection = true) {
|
|
1410
|
+
this._hasItemsSelection = hasSelection;
|
|
1411
|
+
this._isEnabledFunction = this._isEnabledFunction ?? (ctx => of((ctx.parameters.selectedItems?.length ?? 0) > 0));
|
|
1412
|
+
return this;
|
|
1413
|
+
}
|
|
1321
1414
|
}
|
|
1322
1415
|
class ActionSimpleDescriptor extends ActionDescriptor {
|
|
1323
1416
|
constructor(actionName, modelType, idProperty, titleProperty) {
|
|
@@ -1334,7 +1427,7 @@ class ActionEditorDescriptor extends ActionDescriptor {
|
|
|
1334
1427
|
this._dialogSize = ActionEditorDialogSizeEnum.Normal;
|
|
1335
1428
|
this._type = ActionTypeEnum.Editor;
|
|
1336
1429
|
this._editorDescriptor = editorDescriptor;
|
|
1337
|
-
this._editorActions.push(
|
|
1430
|
+
this._editorActions.push(ActionEditorSubmitDescriptor.forPrimary(this), ActionEditorSubmitDescriptor.forSecondary(this));
|
|
1338
1431
|
}
|
|
1339
1432
|
get editorTitle() {
|
|
1340
1433
|
return this._editorTitle;
|
|
@@ -1440,7 +1533,23 @@ class ActionEditorSubmitDescriptor extends ActionDescriptor {
|
|
|
1440
1533
|
this._editorAction = editorAction;
|
|
1441
1534
|
this._submitType = submitType;
|
|
1442
1535
|
this._position = ActionPositionEnum.FooterRight;
|
|
1443
|
-
this.
|
|
1536
|
+
this.buttonDescriptor.styleClass.withActionLevel(editorAction.level).withTextButton();
|
|
1537
|
+
}
|
|
1538
|
+
/**
|
|
1539
|
+
* creates primary action with primary button style
|
|
1540
|
+
* @param editorAction
|
|
1541
|
+
* @param submitType
|
|
1542
|
+
*/
|
|
1543
|
+
static forPrimary(editorAction, submitType = ActionEditorSubmitTypeEnum.Submit) {
|
|
1544
|
+
return new ActionEditorSubmitDescriptor(editorAction, submitType).withButtonDescriptor(new ButtonDescriptor().withStyleClass(new ButtonStyleBuilder()));
|
|
1545
|
+
}
|
|
1546
|
+
/**
|
|
1547
|
+
* creates secondary button with text button style
|
|
1548
|
+
* @param editorAction
|
|
1549
|
+
* @param submitType
|
|
1550
|
+
*/
|
|
1551
|
+
static forSecondary(editorAction, submitType = ActionEditorSubmitTypeEnum.Cancel) {
|
|
1552
|
+
return new ActionEditorSubmitDescriptor(editorAction, submitType).withButtonDescriptor(new ButtonDescriptor().withStyleClass(new ButtonStyleBuilder().withTextButton()));
|
|
1444
1553
|
}
|
|
1445
1554
|
get submitType() {
|
|
1446
1555
|
return this._submitType;
|
|
@@ -1474,8 +1583,8 @@ class ActionEditorAddDescriptor extends ActionEditorDescriptor {
|
|
|
1474
1583
|
this.withPosition(ActionPositionEnum.ToolbarLeft);
|
|
1475
1584
|
this.withRouteTrigger('add');
|
|
1476
1585
|
this.withSubmitFunction(ActionDataProviderUtil.runCreateOrFail);
|
|
1477
|
-
this.
|
|
1478
|
-
this.withIcon('pi pi-plus');
|
|
1586
|
+
this.buttonDescriptor.styleClass.withActionLevel(ActionLevelEnum.Success);
|
|
1587
|
+
this.buttonDescriptor.withIcon('pi pi-plus');
|
|
1479
1588
|
this.withPermissionsRouteType(Permissions.ActionTypes.ADD);
|
|
1480
1589
|
}
|
|
1481
1590
|
withServiceType(serviceType) {
|
|
@@ -1498,12 +1607,11 @@ class ActionEditorEditDescriptor extends ActionEditorDescriptor {
|
|
|
1498
1607
|
constructor(editorDescriptor) {
|
|
1499
1608
|
super(editorDescriptor, ActionEditorEditDescriptor.ACTION_NAME);
|
|
1500
1609
|
this.withPosition(ActionPositionEnum.RowInline);
|
|
1501
|
-
this.withTitle(null);
|
|
1502
1610
|
this.withRouteTrigger(':itemId/edit');
|
|
1503
1611
|
this.withFetchFunction(ActionDataProviderUtil.runFetchOrFail);
|
|
1504
1612
|
this.withSubmitFunction(ActionDataProviderUtil.runUpdateOrFail);
|
|
1505
|
-
this.withIcon('pi pi-pencil');
|
|
1506
1613
|
this.withPermissionsRouteType(Permissions.ActionTypes.EDIT);
|
|
1614
|
+
this.buttonDescriptor.withLabel(null).withIcon('pi pi-pencil');
|
|
1507
1615
|
}
|
|
1508
1616
|
withServiceType(serviceType) {
|
|
1509
1617
|
return this.withServiceSubmitFunction(serviceType);
|
|
@@ -1525,12 +1633,11 @@ class ActionDeleteDescriptor extends ActionDescriptor {
|
|
|
1525
1633
|
constructor(model) {
|
|
1526
1634
|
super(model, ActionDeleteDescriptor.ACTION_NAME);
|
|
1527
1635
|
this.withPosition(ActionPositionEnum.RowInline);
|
|
1528
|
-
this.withTitle(null);
|
|
1529
1636
|
this.withRunFunction(ActionDataProviderUtil.runDeleteOrFail);
|
|
1530
|
-
this.
|
|
1531
|
-
this.
|
|
1532
|
-
this.withRunConfirmation(undefined);
|
|
1637
|
+
this.buttonDescriptor.styleClass.withActionLevel(ActionLevelEnum.Danger);
|
|
1638
|
+
this.withRunConfirmation();
|
|
1533
1639
|
this.withPermissionsRouteType(Permissions.ActionTypes.DELETE);
|
|
1640
|
+
this.buttonDescriptor.withLabel(null).withIcon('pi pi-trash');
|
|
1534
1641
|
}
|
|
1535
1642
|
withServiceType(serviceType) {
|
|
1536
1643
|
return this.withServiceDeleteFunction(serviceType);
|
|
@@ -1602,11 +1709,152 @@ class ActionLinkDescriptor extends ActionDescriptor {
|
|
|
1602
1709
|
}
|
|
1603
1710
|
}
|
|
1604
1711
|
|
|
1712
|
+
class TableviewUtil {
|
|
1713
|
+
/**
|
|
1714
|
+
* returns attributes from class type and extends to typed def with column and field enum type
|
|
1715
|
+
* @param modelType class type
|
|
1716
|
+
*/
|
|
1717
|
+
static getAttributeDefMap(modelType) {
|
|
1718
|
+
return TableviewUtil.expandAttributeDefWithTableviewTypes(ObjectSerializer.get().findAttributesDefinitionByClassType(modelType));
|
|
1719
|
+
}
|
|
1720
|
+
/**
|
|
1721
|
+
* expands AttributeDef to TableviewAttributeDef with defined input and column enum type
|
|
1722
|
+
* @param attributes open api specification model
|
|
1723
|
+
*/
|
|
1724
|
+
static expandAttributeDefWithTableviewTypes(attributes) {
|
|
1725
|
+
if (attributes == null) {
|
|
1726
|
+
throw new Error('AttributeDef is null, problem with ObjectSerializer::findAttributesDefinitionByClassType?');
|
|
1727
|
+
}
|
|
1728
|
+
const objectSerializer = ObjectSerializer.get();
|
|
1729
|
+
const tableviewAttributeDef = [];
|
|
1730
|
+
for (const attribute of attributes) {
|
|
1731
|
+
const enumType = objectSerializer.findEnum(attribute.type);
|
|
1732
|
+
tableviewAttributeDef.push({
|
|
1733
|
+
name: attribute.name,
|
|
1734
|
+
baseName: attribute.baseName,
|
|
1735
|
+
type: attribute.type,
|
|
1736
|
+
columnType: enumType ? ColumnTypeEnum.Enum : TableviewUtil.toColumnType(attribute.type),
|
|
1737
|
+
fieldType: TableviewUtil.toFieldInputType(attribute.type),
|
|
1738
|
+
enumType: objectSerializer.findEnum(attribute.type),
|
|
1739
|
+
classType: objectSerializer.findType(attribute.type)
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
return tableviewAttributeDef;
|
|
1743
|
+
}
|
|
1744
|
+
/**
|
|
1745
|
+
* converts column to number or date on value based
|
|
1746
|
+
* @param column column to be transformed
|
|
1747
|
+
* @param value value to check if applicable
|
|
1748
|
+
*/
|
|
1749
|
+
static stringColumnConverter(column, value) {
|
|
1750
|
+
if (typeof value === 'boolean') {
|
|
1751
|
+
return column.asBoolean();
|
|
1752
|
+
}
|
|
1753
|
+
else if (!isNaN(value) && typeof value === 'number') {
|
|
1754
|
+
return column.asNumber();
|
|
1755
|
+
}
|
|
1756
|
+
else if (this._dateRegex.test(value)) {
|
|
1757
|
+
return column.asDate();
|
|
1758
|
+
}
|
|
1759
|
+
else {
|
|
1760
|
+
return column;
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
/**
|
|
1764
|
+
* converts string type to column type enum, default is string
|
|
1765
|
+
* @param property
|
|
1766
|
+
*/
|
|
1767
|
+
static toColumnType(property) {
|
|
1768
|
+
const os = ObjectSerializer.get();
|
|
1769
|
+
if (os.findEnum(property)) {
|
|
1770
|
+
property = 'enum';
|
|
1771
|
+
}
|
|
1772
|
+
else if (os.findType(property)) {
|
|
1773
|
+
property = 'class';
|
|
1774
|
+
}
|
|
1775
|
+
switch (property) {
|
|
1776
|
+
case 'number':
|
|
1777
|
+
return ColumnTypeEnum.Number;
|
|
1778
|
+
case 'currency':
|
|
1779
|
+
return ColumnTypeEnum.Currency;
|
|
1780
|
+
case 'boolean':
|
|
1781
|
+
return ColumnTypeEnum.Boolean;
|
|
1782
|
+
case 'date':
|
|
1783
|
+
return ColumnTypeEnum.Date;
|
|
1784
|
+
case 'enum':
|
|
1785
|
+
return ColumnTypeEnum.Enum;
|
|
1786
|
+
case 'custom':
|
|
1787
|
+
return ColumnTypeEnum.Custom;
|
|
1788
|
+
case 'class':
|
|
1789
|
+
return ColumnTypeEnum.String;
|
|
1790
|
+
case 'string':
|
|
1791
|
+
default:
|
|
1792
|
+
return ColumnTypeEnum.String;
|
|
1793
|
+
}
|
|
1794
|
+
}
|
|
1795
|
+
/**
|
|
1796
|
+
* converts string type to type enum, default is text
|
|
1797
|
+
* @param property
|
|
1798
|
+
*/
|
|
1799
|
+
static toFieldInputType(property) {
|
|
1800
|
+
switch (property) {
|
|
1801
|
+
case 'hidden':
|
|
1802
|
+
return FieldInputTypeEnum.Hidden;
|
|
1803
|
+
case 'label':
|
|
1804
|
+
return FieldInputTypeEnum.Label;
|
|
1805
|
+
case 'textarea':
|
|
1806
|
+
return FieldInputTypeEnum.Textarea;
|
|
1807
|
+
case 'number':
|
|
1808
|
+
return FieldInputTypeEnum.Number;
|
|
1809
|
+
case 'currency':
|
|
1810
|
+
return FieldInputTypeEnum.Currency;
|
|
1811
|
+
case 'switch':
|
|
1812
|
+
case 'boolean':
|
|
1813
|
+
return FieldInputTypeEnum.Switch;
|
|
1814
|
+
case 'radio':
|
|
1815
|
+
return FieldInputTypeEnum.Radio;
|
|
1816
|
+
case 'datepicker':
|
|
1817
|
+
return FieldInputTypeEnum.Datepicker;
|
|
1818
|
+
case 'mask':
|
|
1819
|
+
return FieldInputTypeEnum.Mask;
|
|
1820
|
+
case 'file':
|
|
1821
|
+
return FieldInputTypeEnum.File;
|
|
1822
|
+
case 'custom':
|
|
1823
|
+
return FieldInputTypeEnum.Custom;
|
|
1824
|
+
case 'text':
|
|
1825
|
+
default:
|
|
1826
|
+
return FieldInputTypeEnum.Text;
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
/**
|
|
1830
|
+
* convert column type to equivalent field input type
|
|
1831
|
+
* @param type column type
|
|
1832
|
+
*/
|
|
1833
|
+
static toFieldInputTypeFromColumnType(type) {
|
|
1834
|
+
switch (type) {
|
|
1835
|
+
case ColumnTypeEnum.Number:
|
|
1836
|
+
return FieldInputTypeEnum.Number;
|
|
1837
|
+
case ColumnTypeEnum.Currency:
|
|
1838
|
+
return FieldInputTypeEnum.Currency;
|
|
1839
|
+
case ColumnTypeEnum.Boolean:
|
|
1840
|
+
return FieldInputTypeEnum.Switch;
|
|
1841
|
+
case ColumnTypeEnum.Date:
|
|
1842
|
+
return FieldInputTypeEnum.Datepicker;
|
|
1843
|
+
case ColumnTypeEnum.Custom:
|
|
1844
|
+
return FieldInputTypeEnum.Custom;
|
|
1845
|
+
case ColumnTypeEnum.String:
|
|
1846
|
+
case ColumnTypeEnum.Enum:
|
|
1847
|
+
default:
|
|
1848
|
+
return FieldInputTypeEnum.Text;
|
|
1849
|
+
}
|
|
1850
|
+
}
|
|
1851
|
+
}
|
|
1852
|
+
TableviewUtil._dateRegex = /\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/;
|
|
1853
|
+
|
|
1605
1854
|
class FilterDescriptor {
|
|
1606
1855
|
constructor(property) {
|
|
1607
1856
|
this._filterType = FilterTypeEnum.String;
|
|
1608
1857
|
this._hasDefaultValue = false;
|
|
1609
|
-
this._defaultFilterMatchMode = FilterMatchModeEnum.Equals;
|
|
1610
1858
|
this._matchModes = null;
|
|
1611
1859
|
this._numberUseGrouping = true;
|
|
1612
1860
|
this._datePickerShowTime = false;
|
|
@@ -1682,13 +1930,11 @@ class FilterDescriptor {
|
|
|
1682
1930
|
this._filterProperty = filterProperty;
|
|
1683
1931
|
return this;
|
|
1684
1932
|
}
|
|
1685
|
-
withDefaultFilter(filterValue, filterValueTo, filterMatchMode
|
|
1933
|
+
withDefaultFilter(filterValue, filterValueTo, filterMatchMode) {
|
|
1686
1934
|
this._hasDefaultValue = true;
|
|
1687
1935
|
this._defaultValue = filterValue;
|
|
1688
1936
|
this._defaultValueTo = filterValueTo;
|
|
1689
|
-
|
|
1690
|
-
this._defaultFilterMatchMode = filterMatchMode;
|
|
1691
|
-
}
|
|
1937
|
+
this._defaultFilterMatchMode = filterMatchMode;
|
|
1692
1938
|
return this;
|
|
1693
1939
|
}
|
|
1694
1940
|
withNumberFractions(min, max) {
|
|
@@ -1835,6 +2081,16 @@ class FilterLookupDescriptor extends FilterDescriptor {
|
|
|
1835
2081
|
this._dropdownClassName = dropdownClassName;
|
|
1836
2082
|
return this;
|
|
1837
2083
|
}
|
|
2084
|
+
withDefaultFilter(filterValue, filterValueTo, filterMatchMode) {
|
|
2085
|
+
this._hasDefaultValue = true;
|
|
2086
|
+
this._defaultValue = filterValue;
|
|
2087
|
+
this._defaultValueTo = filterValueTo;
|
|
2088
|
+
this._defaultFilterMatchMode = filterMatchMode;
|
|
2089
|
+
if (Array.isArray(filterValue) && !this.multiselect) {
|
|
2090
|
+
throw new Error('Array default filter can only be used with a multiselect filter.');
|
|
2091
|
+
}
|
|
2092
|
+
return this;
|
|
2093
|
+
}
|
|
1838
2094
|
asAutocomplete(openOnFocus = false, inlineSearch = false) {
|
|
1839
2095
|
this._lookupType = FilterLookupTypeEnum.Autocomplete;
|
|
1840
2096
|
this._autocompleteOpenOnFocus = openOnFocus;
|
|
@@ -1988,9 +2244,35 @@ class ColumnDescriptor {
|
|
|
1988
2244
|
get hasCopyToClipboard() {
|
|
1989
2245
|
return this._hasCopyToClipboard;
|
|
1990
2246
|
}
|
|
1991
|
-
|
|
1992
|
-
this.
|
|
1993
|
-
|
|
2247
|
+
get template() {
|
|
2248
|
+
return this._template;
|
|
2249
|
+
}
|
|
2250
|
+
get getter() {
|
|
2251
|
+
return this._getter;
|
|
2252
|
+
}
|
|
2253
|
+
/**
|
|
2254
|
+
* converts column to given type with additional arguments
|
|
2255
|
+
* @param type column type enum
|
|
2256
|
+
* @param args any additional arguments for column (optional)
|
|
2257
|
+
*/
|
|
2258
|
+
asType(type, ...args) {
|
|
2259
|
+
switch (type) {
|
|
2260
|
+
case ColumnTypeEnum.Number:
|
|
2261
|
+
return this.asNumber(...args);
|
|
2262
|
+
case ColumnTypeEnum.Currency:
|
|
2263
|
+
return this.asCurrency(...args);
|
|
2264
|
+
case ColumnTypeEnum.Boolean:
|
|
2265
|
+
return this.asBoolean(...args);
|
|
2266
|
+
case ColumnTypeEnum.Date:
|
|
2267
|
+
return this.asDate(...args);
|
|
2268
|
+
case ColumnTypeEnum.Enum:
|
|
2269
|
+
return this.asEnum(args[0], args[1], args[2]);
|
|
2270
|
+
case ColumnTypeEnum.Custom:
|
|
2271
|
+
return this.asCustomComponent(args[0]);
|
|
2272
|
+
case ColumnTypeEnum.String:
|
|
2273
|
+
default:
|
|
2274
|
+
return this;
|
|
2275
|
+
}
|
|
1994
2276
|
}
|
|
1995
2277
|
asNumber(displayFormat = '1.0-0', locale) {
|
|
1996
2278
|
this._columnType = ColumnTypeEnum.Number;
|
|
@@ -2121,32 +2403,98 @@ class ColumnDescriptor {
|
|
|
2121
2403
|
this._hasCopyToClipboard = hasCopyToCliboard;
|
|
2122
2404
|
return this;
|
|
2123
2405
|
}
|
|
2406
|
+
withTemplate(template) {
|
|
2407
|
+
this._template = template;
|
|
2408
|
+
return this;
|
|
2409
|
+
}
|
|
2410
|
+
withGetter(getter) {
|
|
2411
|
+
this._getter = getter;
|
|
2412
|
+
return this;
|
|
2413
|
+
}
|
|
2124
2414
|
copy() {
|
|
2125
2415
|
const descriptor = new ColumnDescriptor(this._table, this._property);
|
|
2126
|
-
|
|
2416
|
+
this.copyFieldsTo(descriptor);
|
|
2417
|
+
return descriptor;
|
|
2418
|
+
}
|
|
2419
|
+
copyFieldsTo(obj) {
|
|
2420
|
+
obj._jsonPath = this._jsonPath;
|
|
2421
|
+
obj._title = this._title;
|
|
2422
|
+
obj._isSortEnabled = this._isSortEnabled;
|
|
2423
|
+
obj._columnType = this._columnType;
|
|
2424
|
+
obj._filterDescriptor = this._filterDescriptor?.copy();
|
|
2425
|
+
obj._enumType = this._enumType;
|
|
2426
|
+
obj._enumTitlePath = this._enumTitlePath;
|
|
2427
|
+
obj._enumNameAsValue = this._enumNameAsValue;
|
|
2428
|
+
obj._booleanAsIcon = this._booleanAsIcon;
|
|
2429
|
+
obj._booleanYes = this._booleanYes;
|
|
2430
|
+
obj._booleanNo = this._booleanNo;
|
|
2431
|
+
obj._objectModelType = this._objectModelType;
|
|
2432
|
+
obj._objectTitleProperty = this._objectTitleProperty;
|
|
2433
|
+
obj._locale = this._locale;
|
|
2434
|
+
obj._currencyCode = this._currencyCode;
|
|
2435
|
+
obj._currencyDisplay = this._currencyDisplay;
|
|
2436
|
+
obj._currencyFromProperty = this._currencyFromProperty;
|
|
2437
|
+
obj._displayFormat = this._displayFormat;
|
|
2438
|
+
obj._headerClassName = this._headerClassName;
|
|
2439
|
+
obj._className = this._className;
|
|
2440
|
+
obj._width = this._width;
|
|
2441
|
+
obj._minWidth = this._minWidth;
|
|
2442
|
+
obj._maxWidth = this._maxWidth;
|
|
2443
|
+
obj._hasCopyToClipboard = this._hasCopyToClipboard;
|
|
2444
|
+
obj._template = this._template;
|
|
2445
|
+
obj._getter = this._getter;
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
class ColumnDynamicDescriptor extends ColumnDescriptor {
|
|
2449
|
+
// private _filterStatus;
|
|
2450
|
+
constructor(table, property) {
|
|
2451
|
+
super(table, property);
|
|
2452
|
+
this._visibility = true;
|
|
2453
|
+
this._table = table;
|
|
2454
|
+
}
|
|
2455
|
+
get visibility() {
|
|
2456
|
+
return this._visibility;
|
|
2457
|
+
}
|
|
2458
|
+
/**
|
|
2459
|
+
* sets column's title and returns this column
|
|
2460
|
+
* @param title title to be set
|
|
2461
|
+
* @param override should column title if all ready set?
|
|
2462
|
+
*/
|
|
2463
|
+
withTitle(title, override = false) {
|
|
2464
|
+
if (this._title == null || override) {
|
|
2465
|
+
this._title = title;
|
|
2466
|
+
}
|
|
2467
|
+
return this;
|
|
2468
|
+
}
|
|
2469
|
+
/**
|
|
2470
|
+
* defines automatic type and returns this column
|
|
2471
|
+
* @param value
|
|
2472
|
+
*/
|
|
2473
|
+
withAutomaticType(value) {
|
|
2474
|
+
TableviewUtil.stringColumnConverter(this, value);
|
|
2475
|
+
return this;
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* sets visibility state for column and returns this column
|
|
2479
|
+
* @param visibility
|
|
2480
|
+
*/
|
|
2481
|
+
withVisibility(visibility) {
|
|
2482
|
+
this._visibility = visibility;
|
|
2483
|
+
return this;
|
|
2484
|
+
}
|
|
2485
|
+
/**
|
|
2486
|
+
* creates deep copy of column dynamic descriptor
|
|
2487
|
+
*/
|
|
2488
|
+
copy() {
|
|
2489
|
+
const descriptor = new ColumnDynamicDescriptor(this._table, this._property);
|
|
2490
|
+
this.copyFieldsTo(descriptor);
|
|
2127
2491
|
descriptor._title = this._title;
|
|
2128
|
-
descriptor.
|
|
2129
|
-
descriptor
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
descriptor
|
|
2133
|
-
|
|
2134
|
-
descriptor._booleanAsIcon = this._booleanAsIcon;
|
|
2135
|
-
descriptor._booleanYes = this._booleanYes;
|
|
2136
|
-
descriptor._booleanNo = this._booleanNo;
|
|
2137
|
-
descriptor._objectModelType = this._objectModelType;
|
|
2138
|
-
descriptor._objectTitleProperty = this._objectTitleProperty;
|
|
2139
|
-
descriptor._locale = this._locale;
|
|
2140
|
-
descriptor._currencyCode = this._currencyCode;
|
|
2141
|
-
descriptor._currencyDisplay = this._currencyDisplay;
|
|
2142
|
-
descriptor._currencyFromProperty = this._currencyFromProperty;
|
|
2143
|
-
descriptor._displayFormat = this._displayFormat;
|
|
2144
|
-
descriptor._headerClassName = this._headerClassName;
|
|
2145
|
-
descriptor._className = this._className;
|
|
2146
|
-
descriptor._width = this._width;
|
|
2147
|
-
descriptor._minWidth = this._minWidth;
|
|
2148
|
-
descriptor._maxWidth = this._maxWidth;
|
|
2149
|
-
descriptor._hasCopyToClipboard = this._hasCopyToClipboard;
|
|
2492
|
+
descriptor._visibility = this._visibility;
|
|
2493
|
+
return descriptor;
|
|
2494
|
+
}
|
|
2495
|
+
toColumnDescriptor(tableDescriptor) {
|
|
2496
|
+
const descriptor = new ColumnDescriptor(tableDescriptor, this._property);
|
|
2497
|
+
this.copyFieldsTo(descriptor);
|
|
2150
2498
|
return descriptor;
|
|
2151
2499
|
}
|
|
2152
2500
|
}
|
|
@@ -2157,9 +2505,37 @@ class EditorDescriptor {
|
|
|
2157
2505
|
this._groups = [];
|
|
2158
2506
|
this._fields = [];
|
|
2159
2507
|
this._disabled = false;
|
|
2508
|
+
this._modelType = modelType;
|
|
2160
2509
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
2161
2510
|
this._tableviewEditorType = tableviewEditorType;
|
|
2162
2511
|
}
|
|
2512
|
+
/**
|
|
2513
|
+
* auto generated editor descriptor based on openapi definition
|
|
2514
|
+
* generates all fields from definition
|
|
2515
|
+
* @param modelType class type
|
|
2516
|
+
* @param idProperty
|
|
2517
|
+
* @param titleProperty
|
|
2518
|
+
* @param tableEditorType
|
|
2519
|
+
*/
|
|
2520
|
+
static from(modelType, idProperty, titleProperty, tableEditorType = TableviewTypeEnum.None) {
|
|
2521
|
+
return EditorDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), titleProperty, idProperty, tableEditorType);
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* auto generated editor descriptor based on openapi definition
|
|
2525
|
+
* generates only selected fields
|
|
2526
|
+
* @param modelType class type
|
|
2527
|
+
* @param attributes list of selected properties to generate fields based on
|
|
2528
|
+
* @param idProperty
|
|
2529
|
+
* @param titleProperty
|
|
2530
|
+
* @param tableEditorType
|
|
2531
|
+
*/
|
|
2532
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty, tableEditorType = TableviewTypeEnum.None) {
|
|
2533
|
+
const descriptor = new EditorDescriptor(modelType, idProperty, titleProperty, tableEditorType);
|
|
2534
|
+
attributes
|
|
2535
|
+
.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array'))
|
|
2536
|
+
.forEach(attr => descriptor.upsertFieldFromAttributeDef(attr, descriptor.fields.find(col => col.property === attr.name)));
|
|
2537
|
+
return descriptor;
|
|
2538
|
+
}
|
|
2163
2539
|
get model() {
|
|
2164
2540
|
return this._model;
|
|
2165
2541
|
}
|
|
@@ -2206,20 +2582,23 @@ class EditorDescriptor {
|
|
|
2206
2582
|
this.addFieldDescriptor(field);
|
|
2207
2583
|
return field;
|
|
2208
2584
|
}
|
|
2585
|
+
/**
|
|
2586
|
+
* removes filed if exists in descriptor
|
|
2587
|
+
* @param property field name
|
|
2588
|
+
*/
|
|
2209
2589
|
removeField(property) {
|
|
2210
2590
|
const fieldIdx = this._fields.findIndex(f => f.property === property);
|
|
2211
2591
|
if (fieldIdx < 0) {
|
|
2212
2592
|
throw new Error(`Field ${property} does not exist.`);
|
|
2213
2593
|
}
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2216
|
-
const groupFieldIdx = field.group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
2594
|
+
for (const group of this._groups) {
|
|
2595
|
+
const groupFieldIdx = group.fields.findIndex(f => f instanceof AFieldDescriptor && f.property === property);
|
|
2217
2596
|
if (groupFieldIdx >= 0) {
|
|
2218
|
-
|
|
2597
|
+
group.fields.splice(groupFieldIdx, 1);
|
|
2598
|
+
break;
|
|
2219
2599
|
}
|
|
2220
2600
|
}
|
|
2221
2601
|
this._fields.splice(fieldIdx, 1);
|
|
2222
|
-
return this;
|
|
2223
2602
|
}
|
|
2224
2603
|
getField(property) {
|
|
2225
2604
|
return this._fields.find(f => f.property === property) ?? null;
|
|
@@ -2292,6 +2671,75 @@ class EditorDescriptor {
|
|
|
2292
2671
|
this.createTabGroup(EditorDescriptor.defaultGroupName, 'general.general');
|
|
2293
2672
|
}
|
|
2294
2673
|
}
|
|
2674
|
+
/**
|
|
2675
|
+
* modifies selected field
|
|
2676
|
+
* do not use it for enums! (use withFieldModifiedEnum instead)
|
|
2677
|
+
* @param property field name
|
|
2678
|
+
* @param fieldType new field type for selected field
|
|
2679
|
+
* @param args additional parameters for field
|
|
2680
|
+
*/
|
|
2681
|
+
withFieldModifiedType(property, fieldType, ...args) {
|
|
2682
|
+
const attribute = TableviewUtil.getAttributeDefMap(this._modelType).find(attribute => attribute.name === property);
|
|
2683
|
+
if (attribute) {
|
|
2684
|
+
attribute.fieldType = fieldType;
|
|
2685
|
+
this.upsertFieldFromAttributeDef(attribute, this.fields.find(fi => fi.property === property), ...args);
|
|
2686
|
+
}
|
|
2687
|
+
return this;
|
|
2688
|
+
}
|
|
2689
|
+
/**
|
|
2690
|
+
* modifies selected field with enum type
|
|
2691
|
+
* @param property field property name
|
|
2692
|
+
* @param enumType type of enum for new field
|
|
2693
|
+
* @param optionsTitlePath
|
|
2694
|
+
* @param values
|
|
2695
|
+
* @param nameAsValue
|
|
2696
|
+
*/
|
|
2697
|
+
withFieldModifiedEnum(property, enumType, optionsTitlePath, values, nameAsValue = false) {
|
|
2698
|
+
const attribute = TableviewUtil.getAttributeDefMap(this._modelType).find(a => a.name === property);
|
|
2699
|
+
if (attribute) {
|
|
2700
|
+
attribute.fieldType = FieldInputTypeEnum.Radio;
|
|
2701
|
+
const field = this.fields.find(f => f.property === property);
|
|
2702
|
+
if (field && field instanceof FieldInputDescriptor) {
|
|
2703
|
+
field.asRadioFromEnum(enumType ?? ObjectSerializer.get().findEnum(attribute.type), optionsTitlePath, values, nameAsValue);
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return this;
|
|
2707
|
+
}
|
|
2708
|
+
/**
|
|
2709
|
+
* adds lookup to given field
|
|
2710
|
+
* @param property field property name
|
|
2711
|
+
* @param modelType model type of field
|
|
2712
|
+
* @param lookupProvider provider to be added to field
|
|
2713
|
+
* @param titleProperty
|
|
2714
|
+
*/
|
|
2715
|
+
withFieldModifiedLookup(property, modelType, lookupProvider, titleProperty) {
|
|
2716
|
+
this.removeField(property);
|
|
2717
|
+
const field = this.addFieldLookup(property, modelType).asAutocomplete().withLookupDataProvider(lookupProvider);
|
|
2718
|
+
if (titleProperty) {
|
|
2719
|
+
field.withItemsLabelProperty(titleProperty);
|
|
2720
|
+
}
|
|
2721
|
+
return this;
|
|
2722
|
+
}
|
|
2723
|
+
/**
|
|
2724
|
+
* generates field based on attribute definition, used for auto model
|
|
2725
|
+
* @param attribute definition
|
|
2726
|
+
* @param field optional, if defined will be replaced, otherwise new will be generated
|
|
2727
|
+
* @param args additional arguments
|
|
2728
|
+
*/
|
|
2729
|
+
upsertFieldFromAttributeDef(attribute, field, ...args) {
|
|
2730
|
+
if (field == null) {
|
|
2731
|
+
field = this.addField(attribute.name);
|
|
2732
|
+
}
|
|
2733
|
+
if (field instanceof FieldInputDescriptor) {
|
|
2734
|
+
if (attribute.enumType) {
|
|
2735
|
+
return field.asRadioFromEnum(attribute.enumType);
|
|
2736
|
+
}
|
|
2737
|
+
else {
|
|
2738
|
+
return field.asType(attribute.fieldType ?? TableviewUtil.toFieldInputTypeFromColumnType(attribute.columnType), ...args);
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
return field;
|
|
2742
|
+
}
|
|
2295
2743
|
}
|
|
2296
2744
|
EditorDescriptor.defaultGroupName = '_default';
|
|
2297
2745
|
|
|
@@ -2364,9 +2812,6 @@ class AFieldDescriptor extends AGenericFieldDescriptor {
|
|
|
2364
2812
|
get property() {
|
|
2365
2813
|
return this._property;
|
|
2366
2814
|
}
|
|
2367
|
-
get group() {
|
|
2368
|
-
return this._group;
|
|
2369
|
-
}
|
|
2370
2815
|
get label() {
|
|
2371
2816
|
return this._label;
|
|
2372
2817
|
}
|
|
@@ -2530,6 +2975,39 @@ class FieldInputDescriptor extends AFieldDescriptor {
|
|
|
2530
2975
|
this._fileMultiple = false;
|
|
2531
2976
|
this._fileMaxFileSize = 500000;
|
|
2532
2977
|
}
|
|
2978
|
+
/**
|
|
2979
|
+
* converts field to given type with additional arguments
|
|
2980
|
+
* @param fieldType field type enum
|
|
2981
|
+
* @param args any additional arguments for field (optional)
|
|
2982
|
+
*/
|
|
2983
|
+
asType(fieldType, ...args) {
|
|
2984
|
+
switch (fieldType) {
|
|
2985
|
+
case FieldInputTypeEnum.Hidden:
|
|
2986
|
+
return this.asHidden();
|
|
2987
|
+
case FieldInputTypeEnum.Label:
|
|
2988
|
+
return this.asLabel();
|
|
2989
|
+
case FieldInputTypeEnum.Textarea:
|
|
2990
|
+
return this.asTextarea(...args);
|
|
2991
|
+
case FieldInputTypeEnum.Number:
|
|
2992
|
+
return this.asNumber();
|
|
2993
|
+
case FieldInputTypeEnum.Currency:
|
|
2994
|
+
return this.asCurrency(...args);
|
|
2995
|
+
case FieldInputTypeEnum.Switch:
|
|
2996
|
+
return this.asSwitch();
|
|
2997
|
+
case FieldInputTypeEnum.Radio:
|
|
2998
|
+
return this.asRadio(args[0], args[1]);
|
|
2999
|
+
case FieldInputTypeEnum.Datepicker:
|
|
3000
|
+
return this.asDatePicker(...args);
|
|
3001
|
+
case FieldInputTypeEnum.Mask:
|
|
3002
|
+
return this.asMask(args[0], args[1]);
|
|
3003
|
+
case FieldInputTypeEnum.File:
|
|
3004
|
+
return this.asFile(...args);
|
|
3005
|
+
case FieldInputTypeEnum.Custom:
|
|
3006
|
+
return this.asCustomComponent(args[0]);
|
|
3007
|
+
case FieldInputTypeEnum.Text:
|
|
3008
|
+
return this.asText();
|
|
3009
|
+
}
|
|
3010
|
+
}
|
|
2533
3011
|
get fieldType() {
|
|
2534
3012
|
return this._fieldType;
|
|
2535
3013
|
}
|
|
@@ -3063,6 +3541,10 @@ class AFieldGroupDescriptor extends AGenericFieldDescriptor {
|
|
|
3063
3541
|
this._name = `${this.baseName}${name}`;
|
|
3064
3542
|
this._default = name === EditorDescriptor.defaultGroupName;
|
|
3065
3543
|
}
|
|
3544
|
+
removeField(property, filterFunction) {
|
|
3545
|
+
this._fields = filterFunction(this._fields);
|
|
3546
|
+
return this._fields;
|
|
3547
|
+
}
|
|
3066
3548
|
get title() {
|
|
3067
3549
|
return this._title;
|
|
3068
3550
|
}
|
|
@@ -3212,9 +3694,33 @@ class TableDescriptor {
|
|
|
3212
3694
|
this._size = TableSizeEnum.Large;
|
|
3213
3695
|
this._hasHover = true;
|
|
3214
3696
|
this._hasGridlines = false;
|
|
3697
|
+
this._autoGenerated = false;
|
|
3698
|
+
this._modelType = modelType;
|
|
3215
3699
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
3216
3700
|
this._dataKeyProperty = idProperty ?? ModelUtil.findIdAttribute(modelType) ?? undefined;
|
|
3217
3701
|
}
|
|
3702
|
+
/**
|
|
3703
|
+
* generates descriptor based on modelType attribute definition
|
|
3704
|
+
* @param modelType class type
|
|
3705
|
+
* @param idProperty
|
|
3706
|
+
* @param titleProperty
|
|
3707
|
+
*/
|
|
3708
|
+
static from(modelType, idProperty, titleProperty) {
|
|
3709
|
+
return TableDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), idProperty, titleProperty);
|
|
3710
|
+
}
|
|
3711
|
+
/**
|
|
3712
|
+
* generates descriptor base on given attribute definition
|
|
3713
|
+
* @param modelType class type
|
|
3714
|
+
* @param attributes attributes from which descriptor is generated
|
|
3715
|
+
* @param idProperty
|
|
3716
|
+
* @param titleProperty
|
|
3717
|
+
*/
|
|
3718
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty) {
|
|
3719
|
+
const descriptor = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
3720
|
+
descriptor._autoGenerated = true;
|
|
3721
|
+
attributes.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array')).forEach(attr => descriptor.upsertColumnFromAttributeDef(attr));
|
|
3722
|
+
return descriptor;
|
|
3723
|
+
}
|
|
3218
3724
|
get filterDisplay() {
|
|
3219
3725
|
return this._filterDisplay;
|
|
3220
3726
|
}
|
|
@@ -3269,6 +3775,18 @@ class TableDescriptor {
|
|
|
3269
3775
|
get hasGridlines() {
|
|
3270
3776
|
return this._hasGridlines;
|
|
3271
3777
|
}
|
|
3778
|
+
get rowClassName() {
|
|
3779
|
+
return this._rowClassName;
|
|
3780
|
+
}
|
|
3781
|
+
get rowClassNameMapFn() {
|
|
3782
|
+
return this._rowClassNameMapFn;
|
|
3783
|
+
}
|
|
3784
|
+
get headerClassName() {
|
|
3785
|
+
return this._headerClassName;
|
|
3786
|
+
}
|
|
3787
|
+
getColumn(property) {
|
|
3788
|
+
return this._columns.find(col => col.property === property);
|
|
3789
|
+
}
|
|
3272
3790
|
addColumnDescriptor(column) {
|
|
3273
3791
|
this._columns.push(column);
|
|
3274
3792
|
return this;
|
|
@@ -3308,6 +3826,10 @@ class TableDescriptor {
|
|
|
3308
3826
|
this._columns.push(column);
|
|
3309
3827
|
return column;
|
|
3310
3828
|
}
|
|
3829
|
+
removeColumn(property) {
|
|
3830
|
+
const columndIdx = this._columns.findIndex(c => c.property === property);
|
|
3831
|
+
this._columns.splice(columndIdx, 1);
|
|
3832
|
+
}
|
|
3311
3833
|
withFilterDisplay(filterDisplayType) {
|
|
3312
3834
|
this._filterDisplay = filterDisplayType;
|
|
3313
3835
|
return this;
|
|
@@ -3354,44 +3876,268 @@ class TableDescriptor {
|
|
|
3354
3876
|
this._size = size;
|
|
3355
3877
|
return this;
|
|
3356
3878
|
}
|
|
3357
|
-
withTableFullHeightOffset(tableFullHeightOffset) {
|
|
3358
|
-
this._tableFullHeightOffset = tableFullHeightOffset;
|
|
3879
|
+
withTableFullHeightOffset(tableFullHeightOffset) {
|
|
3880
|
+
this._tableFullHeightOffset = tableFullHeightOffset;
|
|
3881
|
+
return this;
|
|
3882
|
+
}
|
|
3883
|
+
withRowHeight(rowHeight) {
|
|
3884
|
+
this._rowHeight = rowHeight;
|
|
3885
|
+
return this;
|
|
3886
|
+
}
|
|
3887
|
+
withHover(hover) {
|
|
3888
|
+
this._hasHover = hover;
|
|
3889
|
+
return this;
|
|
3890
|
+
}
|
|
3891
|
+
withGridlines(gridlines) {
|
|
3892
|
+
this._hasGridlines = gridlines;
|
|
3893
|
+
return this;
|
|
3894
|
+
}
|
|
3895
|
+
withRowClassName(rowClassName, classNameMapFn) {
|
|
3896
|
+
this._rowClassName = rowClassName;
|
|
3897
|
+
this._rowClassNameMapFn = classNameMapFn;
|
|
3898
|
+
return this;
|
|
3899
|
+
}
|
|
3900
|
+
withHeaderClassName(headerClassName) {
|
|
3901
|
+
this._headerClassName = headerClassName;
|
|
3902
|
+
return this;
|
|
3903
|
+
}
|
|
3904
|
+
copyFieldsTo(obj) {
|
|
3905
|
+
obj._title = this._title;
|
|
3906
|
+
obj._hideHeader = this._hideHeader;
|
|
3907
|
+
obj._dataKeyProperty = this._dataKeyProperty;
|
|
3908
|
+
obj._hasDefaultSort = this._hasDefaultSort;
|
|
3909
|
+
obj._defaultSortProperty = this._defaultSortProperty.map(p => p);
|
|
3910
|
+
obj._defaultSortAsc = this._defaultSortAsc.map(p => p);
|
|
3911
|
+
obj._filterDisplay = this._filterDisplay;
|
|
3912
|
+
obj._className = this._className;
|
|
3913
|
+
obj._size = this._size;
|
|
3914
|
+
obj._tableFullHeightOffset = this._tableFullHeightOffset;
|
|
3915
|
+
obj._rowHeight = this._rowHeight;
|
|
3916
|
+
obj._hasHover = this._hasHover;
|
|
3917
|
+
obj._hasGridlines = this._hasGridlines;
|
|
3918
|
+
}
|
|
3919
|
+
copy() {
|
|
3920
|
+
const descriptor = new TableDescriptor(this.model.type, this.model.idPropertyName, this.model.titlePropertyName);
|
|
3921
|
+
this.copyFieldsTo(descriptor);
|
|
3922
|
+
descriptor._columns = this.columns.map(c => c.copy());
|
|
3923
|
+
return descriptor;
|
|
3924
|
+
}
|
|
3925
|
+
/**
|
|
3926
|
+
* generates column based on attributes
|
|
3927
|
+
* @param attribute attribute map
|
|
3928
|
+
* @param column if provided, replaced by new, otherwise new is created
|
|
3929
|
+
* @param args additional parameters
|
|
3930
|
+
*/
|
|
3931
|
+
upsertColumnFromAttributeDef(attribute, column, ...args) {
|
|
3932
|
+
if (column == null) {
|
|
3933
|
+
column = this.addColumn(attribute.name);
|
|
3934
|
+
}
|
|
3935
|
+
if (attribute.columnType === ColumnTypeEnum.Enum && args.length === 0) {
|
|
3936
|
+
args = [attribute.enumType];
|
|
3937
|
+
}
|
|
3938
|
+
column = column.asType(attribute.columnType, ...args);
|
|
3939
|
+
if (attribute.classType) {
|
|
3940
|
+
column.withObjectProperty(attribute.classType).withSort();
|
|
3941
|
+
}
|
|
3942
|
+
else {
|
|
3943
|
+
column.withSort().withFilter();
|
|
3944
|
+
}
|
|
3945
|
+
return column;
|
|
3946
|
+
}
|
|
3947
|
+
/**
|
|
3948
|
+
* defines modified type of column
|
|
3949
|
+
* DO NOT USE with enum (use withCustomEnumType)
|
|
3950
|
+
* @param property column name
|
|
3951
|
+
* @param columnType modified type
|
|
3952
|
+
* @param args additional attributes
|
|
3953
|
+
*/
|
|
3954
|
+
withColumnModifiedType(property, columnType, ...args) {
|
|
3955
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
3956
|
+
if (attributeDef != null) {
|
|
3957
|
+
attributeDef.columnType = columnType ?? attributeDef.columnType;
|
|
3958
|
+
this.upsertColumnFromAttributeDef(attributeDef, this.columns.find(col => col.property === attributeDef.name), ...args);
|
|
3959
|
+
}
|
|
3960
|
+
return this;
|
|
3961
|
+
}
|
|
3962
|
+
/**
|
|
3963
|
+
* defines custom enum type for column
|
|
3964
|
+
* @param property column name
|
|
3965
|
+
* @param enumType
|
|
3966
|
+
*/
|
|
3967
|
+
withColumnModifiedEnum(property, enumType) {
|
|
3968
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
3969
|
+
if (attributeDef != null) {
|
|
3970
|
+
attributeDef.columnType = ColumnTypeEnum.Enum;
|
|
3971
|
+
this.upsertColumnFromAttributeDef(attributeDef, this.columns.find(col => col.property === property), enumType ?? ObjectSerializer.get().findEnum(attributeDef.type));
|
|
3972
|
+
}
|
|
3973
|
+
return this;
|
|
3974
|
+
}
|
|
3975
|
+
/**
|
|
3976
|
+
* modifies column with class and lookup provider
|
|
3977
|
+
* @param property column name
|
|
3978
|
+
* @param lookupProvider lookupProvider for class
|
|
3979
|
+
* @param itemsLabelProperty
|
|
3980
|
+
* @param filterProperty
|
|
3981
|
+
*/
|
|
3982
|
+
withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty) {
|
|
3983
|
+
const column = this.columns.find(col => col.property === property);
|
|
3984
|
+
if (column) {
|
|
3985
|
+
column.withFilterLookup().withLookupDataProvider(lookupProvider);
|
|
3986
|
+
if (column instanceof FilterLookupDescriptor) {
|
|
3987
|
+
if (itemsLabelProperty) {
|
|
3988
|
+
column.withItemsLabelProperty(itemsLabelProperty);
|
|
3989
|
+
}
|
|
3990
|
+
if (filterProperty) {
|
|
3991
|
+
column.withFilterProperty(filterProperty);
|
|
3992
|
+
}
|
|
3993
|
+
}
|
|
3994
|
+
}
|
|
3995
|
+
return this;
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
class TableDynamicDescriptor extends TableDescriptor {
|
|
3999
|
+
constructor(idProperty, titleProperty) {
|
|
4000
|
+
super({}, idProperty, titleProperty);
|
|
4001
|
+
this._excludedColumns = [];
|
|
4002
|
+
this._filterColumns = [];
|
|
4003
|
+
this._sortColumns = [];
|
|
4004
|
+
this._sortColumnMode = TableDynamicColumnsModeEnum.EXCLUDE;
|
|
4005
|
+
this._filterColumnMode = TableDynamicColumnsModeEnum.EXCLUDE;
|
|
4006
|
+
this._columns = [];
|
|
4007
|
+
this.withTitle('Dynamic table');
|
|
4008
|
+
}
|
|
4009
|
+
get columns() {
|
|
4010
|
+
return this._columns;
|
|
4011
|
+
}
|
|
4012
|
+
/**
|
|
4013
|
+
* defines excluded columns when generating descriptor
|
|
4014
|
+
* @param excludedColumn names of excluded columns
|
|
4015
|
+
*/
|
|
4016
|
+
withColumnsExcluded(excludedColumn) {
|
|
4017
|
+
this._excludedColumns = excludedColumn;
|
|
4018
|
+
return this;
|
|
4019
|
+
}
|
|
4020
|
+
/**
|
|
4021
|
+
* defines column properties on which sort is defined or not depending on sortColumnMode
|
|
4022
|
+
* @param sortOnColumns column names
|
|
4023
|
+
* @param sortColumnMode INCLUDE_ONLY (default) only given columns will have sort, EXCLUDE given columns will NOT have sort
|
|
4024
|
+
*/
|
|
4025
|
+
withColumnsSort(sortOnColumns, sortColumnMode = TableDynamicColumnsModeEnum.INCLUDE_ONLY) {
|
|
4026
|
+
this._sortColumnMode = sortColumnMode;
|
|
4027
|
+
this._sortColumns = sortOnColumns;
|
|
4028
|
+
return this;
|
|
4029
|
+
}
|
|
4030
|
+
/**
|
|
4031
|
+
* defines column properties on which filter is defined or not depending on filterColumnMode
|
|
4032
|
+
* @param filterOnColumn column names
|
|
4033
|
+
* @param filterColumnMode INCLUDE_ONLY (default) only given columns will have filter, EXCLUDE given columns will NOT have filter
|
|
4034
|
+
*/
|
|
4035
|
+
withColumnsFilter(filterOnColumn, filterColumnMode = TableDynamicColumnsModeEnum.INCLUDE_ONLY) {
|
|
4036
|
+
this._filterColumnMode = filterColumnMode;
|
|
4037
|
+
this._filterColumns = filterOnColumn;
|
|
4038
|
+
return this;
|
|
4039
|
+
}
|
|
4040
|
+
/**
|
|
4041
|
+
* sets given type to column with given property and returns this table
|
|
4042
|
+
* @param property column's property
|
|
4043
|
+
* @param type custom type for column
|
|
4044
|
+
* @param args addition arguments for column
|
|
4045
|
+
*/
|
|
4046
|
+
withColumnModifiedType(property, type, ...args) {
|
|
4047
|
+
const column = this._columns.find(col => property === col.property) ?? this.addColumn(property).withTitle(property);
|
|
4048
|
+
if (column) {
|
|
4049
|
+
column.asType(type, ...args);
|
|
4050
|
+
}
|
|
3359
4051
|
return this;
|
|
3360
4052
|
}
|
|
3361
|
-
|
|
3362
|
-
|
|
4053
|
+
/**
|
|
4054
|
+
* sets title to column with given property and returns this table
|
|
4055
|
+
* @param property column's property
|
|
4056
|
+
* @param title column's title
|
|
4057
|
+
*/
|
|
4058
|
+
withColumnTitle(property, title) {
|
|
4059
|
+
const column = this._columns.find(col => property === col.property) ?? this.addColumn(property);
|
|
4060
|
+
column.withTitle(title, true);
|
|
3363
4061
|
return this;
|
|
3364
4062
|
}
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
4063
|
+
/**
|
|
4064
|
+
* generates columns defined on table based on data fetched from api
|
|
4065
|
+
* @param data data from api
|
|
4066
|
+
*/
|
|
4067
|
+
toTableDescriptorFromData(data) {
|
|
4068
|
+
const tableDescriptor = this.toTableDescriptor();
|
|
4069
|
+
if (data.pageData == null || data.pageData.length == 0) {
|
|
4070
|
+
return tableDescriptor;
|
|
4071
|
+
}
|
|
4072
|
+
const objectModel = data.pageData[0];
|
|
4073
|
+
const entries = Object.entries(objectModel)
|
|
4074
|
+
.filter(([key]) => !this._excludedColumns.includes(key))
|
|
4075
|
+
.filter(([, value]) => !Array.isArray(value)); //exclude arrays and sets
|
|
4076
|
+
for (const [key, value] of entries) {
|
|
4077
|
+
const metaColumn = this._columns.find(col => col.property === key);
|
|
4078
|
+
let column;
|
|
4079
|
+
if (metaColumn) {
|
|
4080
|
+
if (!metaColumn.visibility) {
|
|
4081
|
+
continue;
|
|
4082
|
+
}
|
|
4083
|
+
column = metaColumn.toColumnDescriptor(tableDescriptor);
|
|
4084
|
+
tableDescriptor.addColumnDescriptor(column);
|
|
4085
|
+
}
|
|
4086
|
+
else {
|
|
4087
|
+
column = tableDescriptor.addColumn(key).withTitle(key);
|
|
4088
|
+
TableviewUtil.stringColumnConverter(column, value);
|
|
4089
|
+
}
|
|
4090
|
+
const elementOfSortColumns = this._sortColumns.includes(column.property);
|
|
4091
|
+
if ((this._sortColumnMode === TableDynamicColumnsModeEnum.EXCLUDE && !elementOfSortColumns) ||
|
|
4092
|
+
(this._sortColumnMode === TableDynamicColumnsModeEnum.INCLUDE_ONLY && elementOfSortColumns)) {
|
|
4093
|
+
column.withSort();
|
|
4094
|
+
}
|
|
4095
|
+
const elementOfFilterColumns = this._filterColumns.includes(column.property);
|
|
4096
|
+
if ((this._filterColumnMode === TableDynamicColumnsModeEnum.EXCLUDE && !elementOfFilterColumns) ||
|
|
4097
|
+
(this._filterColumnMode === TableDynamicColumnsModeEnum.INCLUDE_ONLY && elementOfFilterColumns)) {
|
|
4098
|
+
column.withFilter();
|
|
4099
|
+
}
|
|
4100
|
+
}
|
|
4101
|
+
return tableDescriptor;
|
|
3368
4102
|
}
|
|
3369
|
-
|
|
3370
|
-
|
|
4103
|
+
/**
|
|
4104
|
+
* adds ColumnDynamicDescriptor to this table
|
|
4105
|
+
* @param property column's property
|
|
4106
|
+
*/
|
|
4107
|
+
addColumn(property) {
|
|
4108
|
+
const column = new ColumnDynamicDescriptor(this, property);
|
|
4109
|
+
this._columns.push(column);
|
|
4110
|
+
return column;
|
|
4111
|
+
}
|
|
4112
|
+
removeColumn(property) {
|
|
4113
|
+
const column = this.columns.find(col => col.property === property) ?? this.addColumn(property);
|
|
4114
|
+
column.withVisibility(false);
|
|
3371
4115
|
return this;
|
|
3372
4116
|
}
|
|
4117
|
+
/**
|
|
4118
|
+
* creates deep copy of table dynamic descriptor
|
|
4119
|
+
*/
|
|
3373
4120
|
copy() {
|
|
3374
|
-
const descriptor = new
|
|
4121
|
+
const descriptor = new TableDynamicDescriptor(this.model.idPropertyName, this.model.titlePropertyName);
|
|
4122
|
+
this.copyFieldsTo(descriptor);
|
|
3375
4123
|
descriptor._columns = this.columns.map(c => c.copy());
|
|
3376
|
-
descriptor.
|
|
3377
|
-
descriptor.
|
|
3378
|
-
descriptor.
|
|
3379
|
-
descriptor.
|
|
3380
|
-
descriptor.
|
|
3381
|
-
descriptor
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
descriptor
|
|
3385
|
-
|
|
3386
|
-
descriptor._rowHeight = this._rowHeight;
|
|
3387
|
-
descriptor._hasHover = this._hasHover;
|
|
3388
|
-
descriptor._hasGridlines = this._hasGridlines;
|
|
4124
|
+
descriptor._excludedColumns = [...this._excludedColumns];
|
|
4125
|
+
descriptor._filterColumns = [...this._filterColumns];
|
|
4126
|
+
descriptor._sortColumns = [...this._sortColumns];
|
|
4127
|
+
descriptor._filterColumnMode = this._filterColumnMode;
|
|
4128
|
+
descriptor._sortColumnMode = this._sortColumnMode;
|
|
4129
|
+
return descriptor;
|
|
4130
|
+
}
|
|
4131
|
+
toTableDescriptor() {
|
|
4132
|
+
const descriptor = new TableDescriptor({}, this.model.idPropertyName, this.model.titlePropertyName);
|
|
4133
|
+
this.copyFieldsTo(descriptor);
|
|
3389
4134
|
return descriptor;
|
|
3390
4135
|
}
|
|
3391
4136
|
}
|
|
3392
4137
|
|
|
3393
4138
|
class TableviewDescriptor {
|
|
3394
4139
|
constructor(modelType, idProperty, titleProperty) {
|
|
4140
|
+
this._modelType = modelType;
|
|
3395
4141
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
3396
4142
|
this._table = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
3397
4143
|
this._viewEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewTypeEnum.View);
|
|
@@ -3400,6 +4146,38 @@ class TableviewDescriptor {
|
|
|
3400
4146
|
this._editEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewTypeEnum.Edit);
|
|
3401
4147
|
this._tableTitle = `${this._model.typeName}.name`;
|
|
3402
4148
|
}
|
|
4149
|
+
/**
|
|
4150
|
+
* generates descriptor from attribute definition of openaapi model
|
|
4151
|
+
* @param modelType class type
|
|
4152
|
+
* @param idProperty
|
|
4153
|
+
* @param titleProperty
|
|
4154
|
+
*/
|
|
4155
|
+
static from(modelType, idProperty, titleProperty) {
|
|
4156
|
+
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4157
|
+
descriptor._table = TableDescriptor.from(modelType, idProperty, titleProperty);
|
|
4158
|
+
descriptor._editEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4159
|
+
descriptor._viewEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4160
|
+
descriptor._addEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4161
|
+
return descriptor;
|
|
4162
|
+
}
|
|
4163
|
+
/**
|
|
4164
|
+
* generates descriptor from given attribute definition
|
|
4165
|
+
* @param modelType class type
|
|
4166
|
+
* @param columnAttributes attribute definition to generate columns
|
|
4167
|
+
* @param fieldAttributes attribute definition to generate fields, if undefined columnDefinition is used, if null editors are not generated
|
|
4168
|
+
* @param idProperty
|
|
4169
|
+
* @param titleProperty
|
|
4170
|
+
*/
|
|
4171
|
+
static fromModelWithDefinition(modelType, columnAttributes, fieldAttributes, idProperty, titleProperty) {
|
|
4172
|
+
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4173
|
+
descriptor._table = TableDescriptor.fromModelWithAttributes(modelType, columnAttributes, idProperty, titleProperty);
|
|
4174
|
+
if (fieldAttributes !== null) {
|
|
4175
|
+
descriptor._editEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4176
|
+
descriptor._viewEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4177
|
+
descriptor._addEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4178
|
+
}
|
|
4179
|
+
return descriptor;
|
|
4180
|
+
}
|
|
3403
4181
|
get table() {
|
|
3404
4182
|
return this._table;
|
|
3405
4183
|
}
|
|
@@ -3422,6 +4200,12 @@ class TableviewDescriptor {
|
|
|
3422
4200
|
this._table = descriptor;
|
|
3423
4201
|
return this;
|
|
3424
4202
|
}
|
|
4203
|
+
withEditorDescriptors(descriptor) {
|
|
4204
|
+
this._viewEditor = descriptor;
|
|
4205
|
+
this._editEditor = descriptor;
|
|
4206
|
+
this._addEditor = descriptor;
|
|
4207
|
+
return this;
|
|
4208
|
+
}
|
|
3425
4209
|
withViewDescriptor(descriptor) {
|
|
3426
4210
|
this._viewEditor = descriptor;
|
|
3427
4211
|
return this;
|
|
@@ -3450,6 +4234,26 @@ class TableviewDescriptor {
|
|
|
3450
4234
|
addColumn(property) {
|
|
3451
4235
|
return this._table.addColumn(property);
|
|
3452
4236
|
}
|
|
4237
|
+
removeColumn(property) {
|
|
4238
|
+
this._table.removeColumn(property);
|
|
4239
|
+
}
|
|
4240
|
+
getField(property, editorType) {
|
|
4241
|
+
switch (editorType) {
|
|
4242
|
+
case TableviewTypeEnum.Edit:
|
|
4243
|
+
return this._editEditor.getField(property);
|
|
4244
|
+
case TableviewTypeEnum.Add:
|
|
4245
|
+
return this._addEditor.getField(property);
|
|
4246
|
+
case TableviewTypeEnum.View:
|
|
4247
|
+
return this._viewEditor.getField(property);
|
|
4248
|
+
case TableviewTypeEnum.None:
|
|
4249
|
+
return null;
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
removeField(property) {
|
|
4253
|
+
this._editEditor.removeField(property);
|
|
4254
|
+
this._addEditor.removeField(property);
|
|
4255
|
+
this._viewEditor.removeField(property);
|
|
4256
|
+
}
|
|
3453
4257
|
addColumnNumber(property, displayFormat) {
|
|
3454
4258
|
return this._table.addColumnNumber(property, displayFormat);
|
|
3455
4259
|
}
|
|
@@ -3521,6 +4325,226 @@ class TableviewDescriptor {
|
|
|
3521
4325
|
tableview._editEditor = this._editEditor.copy();
|
|
3522
4326
|
return tableview;
|
|
3523
4327
|
}
|
|
4328
|
+
/**
|
|
4329
|
+
* creates column and field with custom type, for example currency
|
|
4330
|
+
* if field exists, it is replaced
|
|
4331
|
+
* DO NOT USE WITH TYPES WHERE ARGS ARE REQUIRED - ERROR WILL BE THROWN
|
|
4332
|
+
* for enum use withEnumType
|
|
4333
|
+
* for custom class use withClassType
|
|
4334
|
+
* @param property name of field
|
|
4335
|
+
* @param columnType required column type
|
|
4336
|
+
* @param fieldType optional, if not provided it is converted from column type
|
|
4337
|
+
*/
|
|
4338
|
+
withModifiedType(property, columnType, fieldType) {
|
|
4339
|
+
if (columnType === ColumnTypeEnum.Enum) {
|
|
4340
|
+
throw new Error('Do not use with types where args are required');
|
|
4341
|
+
}
|
|
4342
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4343
|
+
if (attributeDef != null) {
|
|
4344
|
+
fieldType ?? (fieldType = TableviewUtil.toFieldInputTypeFromColumnType(columnType));
|
|
4345
|
+
attributeDef.fieldType = fieldType;
|
|
4346
|
+
this._table.withColumnModifiedType(property, columnType);
|
|
4347
|
+
this._editEditor.withFieldModifiedType(property, fieldType);
|
|
4348
|
+
this._addEditor.withFieldModifiedType(property, fieldType);
|
|
4349
|
+
this._viewEditor.withFieldModifiedType(property, fieldType);
|
|
4350
|
+
}
|
|
4351
|
+
return this;
|
|
4352
|
+
}
|
|
4353
|
+
/**
|
|
4354
|
+
* creates column with enum type
|
|
4355
|
+
* if fields exists, it is replaced
|
|
4356
|
+
* @param property property name
|
|
4357
|
+
* @param enumType type of enum
|
|
4358
|
+
* @param fieldType type of field, optional, default is Text
|
|
4359
|
+
*/
|
|
4360
|
+
withModifiedEnum(property, enumType, fieldType) {
|
|
4361
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4362
|
+
if (attributeDef != null) {
|
|
4363
|
+
attributeDef.fieldType = fieldType ?? FieldInputTypeEnum.Text;
|
|
4364
|
+
this._table.withColumnModifiedEnum(property, enumType);
|
|
4365
|
+
this._editEditor.withFieldModifiedEnum(property, enumType);
|
|
4366
|
+
this._viewEditor.withFieldModifiedEnum(property, enumType);
|
|
4367
|
+
this._addEditor.withFieldModifiedEnum(property, enumType);
|
|
4368
|
+
}
|
|
4369
|
+
return this;
|
|
4370
|
+
}
|
|
4371
|
+
/**
|
|
4372
|
+
* generates column with custom class type
|
|
4373
|
+
* field is generated only if lookupProvider is provided
|
|
4374
|
+
* @param property property name
|
|
4375
|
+
* @param modelType class type of object
|
|
4376
|
+
* @param titleProperty
|
|
4377
|
+
* @param lookupProvider
|
|
4378
|
+
* @param itemsLabelProperty
|
|
4379
|
+
* @param filterProperty
|
|
4380
|
+
*/
|
|
4381
|
+
withModifiedLookup(property, modelType, lookupProvider, titleProperty, itemsLabelProperty, filterProperty) {
|
|
4382
|
+
const attributeDef = TableviewUtil.getAttributeDefMap(this._modelType).find(atribute => atribute.name === property);
|
|
4383
|
+
if (attributeDef != null) {
|
|
4384
|
+
modelType ?? (modelType = attributeDef.classType ?? ObjectSerializer.get().findType(attributeDef.type));
|
|
4385
|
+
titleProperty ?? (titleProperty = ModelUtil.findTitleAttribute(modelType) ?? undefined);
|
|
4386
|
+
itemsLabelProperty ?? (itemsLabelProperty = titleProperty);
|
|
4387
|
+
attributeDef.columnType = ColumnTypeEnum.String;
|
|
4388
|
+
attributeDef.fieldType = FieldInputTypeEnum.Text;
|
|
4389
|
+
if (lookupProvider != null) {
|
|
4390
|
+
this._table.withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty);
|
|
4391
|
+
this._addEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4392
|
+
this._viewEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4393
|
+
this._editEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4394
|
+
}
|
|
4395
|
+
else {
|
|
4396
|
+
const column = this._table.getColumn(property) ?? this.addColumn(property);
|
|
4397
|
+
column.withObjectProperty(modelType, titleProperty);
|
|
4398
|
+
}
|
|
4399
|
+
}
|
|
4400
|
+
return this;
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
class TableviewDynamicDescriptor extends TableviewDescriptor {
|
|
4404
|
+
constructor(idProperty, titleProperty) {
|
|
4405
|
+
super({}, idProperty, titleProperty);
|
|
4406
|
+
this._table = new TableDynamicDescriptor(idProperty, titleProperty);
|
|
4407
|
+
super._tableTitle = undefined;
|
|
4408
|
+
}
|
|
4409
|
+
get table() {
|
|
4410
|
+
return this._table;
|
|
4411
|
+
}
|
|
4412
|
+
/**
|
|
4413
|
+
* sets custom table descriptor
|
|
4414
|
+
* @param descriptor
|
|
4415
|
+
*/
|
|
4416
|
+
withTableDescriptor(descriptor) {
|
|
4417
|
+
this._table = descriptor;
|
|
4418
|
+
return this;
|
|
4419
|
+
}
|
|
4420
|
+
/**
|
|
4421
|
+
* sets visibility hidden state to column with given property
|
|
4422
|
+
* equals to be removing in auto and base tableview descriptor
|
|
4423
|
+
* * @param property column's property
|
|
4424
|
+
*/
|
|
4425
|
+
removeColumn(property) {
|
|
4426
|
+
this._table.removeColumn(property);
|
|
4427
|
+
return this;
|
|
4428
|
+
}
|
|
4429
|
+
/**
|
|
4430
|
+
* creates depp copy of tableview object and its children
|
|
4431
|
+
*/
|
|
4432
|
+
copy() {
|
|
4433
|
+
const descriptor = new TableviewDynamicDescriptor(this.model.idPropertyName, this.model.titlePropertyName);
|
|
4434
|
+
descriptor._table = this._table.copy();
|
|
4435
|
+
descriptor._tableTitle = this._tableTitle;
|
|
4436
|
+
return descriptor;
|
|
4437
|
+
}
|
|
4438
|
+
}
|
|
4439
|
+
|
|
4440
|
+
class ButtonDescriptor {
|
|
4441
|
+
constructor() {
|
|
4442
|
+
this._disabled = false;
|
|
4443
|
+
this._iconPosition = 'left';
|
|
4444
|
+
this._styleClass = new ButtonStyleBuilder();
|
|
4445
|
+
this._loading = false;
|
|
4446
|
+
this._loadingIcon = 'pi pi-spinner pi-spin';
|
|
4447
|
+
}
|
|
4448
|
+
withLabel(label) {
|
|
4449
|
+
this._label = label;
|
|
4450
|
+
return this;
|
|
4451
|
+
}
|
|
4452
|
+
withDisabled(disabled = true) {
|
|
4453
|
+
this._disabled = disabled;
|
|
4454
|
+
return this;
|
|
4455
|
+
}
|
|
4456
|
+
withIcon(icon) {
|
|
4457
|
+
this._icon = icon;
|
|
4458
|
+
return this;
|
|
4459
|
+
}
|
|
4460
|
+
withIconPosition(iconPosition) {
|
|
4461
|
+
this._iconPosition = iconPosition;
|
|
4462
|
+
return this;
|
|
4463
|
+
}
|
|
4464
|
+
withStyleClass(style) {
|
|
4465
|
+
this._styleClass = style;
|
|
4466
|
+
return this;
|
|
4467
|
+
}
|
|
4468
|
+
withOnClick(onClick) {
|
|
4469
|
+
this._onClick = onClick;
|
|
4470
|
+
return this;
|
|
4471
|
+
}
|
|
4472
|
+
withOnFocus(onFocus) {
|
|
4473
|
+
this._onFocus = onFocus;
|
|
4474
|
+
return this;
|
|
4475
|
+
}
|
|
4476
|
+
withOnBlur(onBlur) {
|
|
4477
|
+
this._onBlur = onBlur;
|
|
4478
|
+
return this;
|
|
4479
|
+
}
|
|
4480
|
+
withLoading(loading = true) {
|
|
4481
|
+
this._loading = loading;
|
|
4482
|
+
return this;
|
|
4483
|
+
}
|
|
4484
|
+
withLoadingIcon(loadingIcon) {
|
|
4485
|
+
this._loadingIcon = loadingIcon;
|
|
4486
|
+
return this;
|
|
4487
|
+
}
|
|
4488
|
+
withBadge(badge) {
|
|
4489
|
+
this._badge = badge;
|
|
4490
|
+
return this;
|
|
4491
|
+
}
|
|
4492
|
+
withTooltip(tooltip) {
|
|
4493
|
+
this._tooltip = tooltip;
|
|
4494
|
+
return this;
|
|
4495
|
+
}
|
|
4496
|
+
get label() {
|
|
4497
|
+
return this._label;
|
|
4498
|
+
}
|
|
4499
|
+
get disabled() {
|
|
4500
|
+
return this._disabled;
|
|
4501
|
+
}
|
|
4502
|
+
get icon() {
|
|
4503
|
+
return this._icon;
|
|
4504
|
+
}
|
|
4505
|
+
get iconPosition() {
|
|
4506
|
+
return this._iconPosition;
|
|
4507
|
+
}
|
|
4508
|
+
get styleClass() {
|
|
4509
|
+
return this._styleClass;
|
|
4510
|
+
}
|
|
4511
|
+
get onClick() {
|
|
4512
|
+
return this._onClick;
|
|
4513
|
+
}
|
|
4514
|
+
get onFocus() {
|
|
4515
|
+
return this._onFocus;
|
|
4516
|
+
}
|
|
4517
|
+
get onBlur() {
|
|
4518
|
+
return this._onBlur;
|
|
4519
|
+
}
|
|
4520
|
+
get loading() {
|
|
4521
|
+
return this._loading;
|
|
4522
|
+
}
|
|
4523
|
+
get loadingIcon() {
|
|
4524
|
+
return this._loadingIcon;
|
|
4525
|
+
}
|
|
4526
|
+
get badge() {
|
|
4527
|
+
return this._badge;
|
|
4528
|
+
}
|
|
4529
|
+
get tooltip() {
|
|
4530
|
+
return this._tooltip;
|
|
4531
|
+
}
|
|
4532
|
+
copy() {
|
|
4533
|
+
const descriptor = new ButtonDescriptor();
|
|
4534
|
+
descriptor._label = this._label;
|
|
4535
|
+
descriptor._disabled = this._disabled;
|
|
4536
|
+
descriptor._icon = this._icon;
|
|
4537
|
+
descriptor._iconPosition = this._iconPosition;
|
|
4538
|
+
descriptor._styleClass = this._styleClass;
|
|
4539
|
+
descriptor._onClick = this._onClick;
|
|
4540
|
+
descriptor._onFocus = this._onFocus;
|
|
4541
|
+
descriptor._onBlur = this._onBlur;
|
|
4542
|
+
descriptor._loading = this._loading;
|
|
4543
|
+
descriptor._loadingIcon = this._loadingIcon;
|
|
4544
|
+
descriptor._badge = this._badge;
|
|
4545
|
+
descriptor._tooltip = this._tooltip;
|
|
4546
|
+
return descriptor;
|
|
4547
|
+
}
|
|
3524
4548
|
}
|
|
3525
4549
|
|
|
3526
4550
|
class EditorFormlyUtil {
|
|
@@ -4578,8 +5602,7 @@ class MediusRestUtil {
|
|
|
4578
5602
|
const filterDescriptor = filterDescriptors.find(f => f.property === field);
|
|
4579
5603
|
const matchMode = MediusRestUtil.getMapping(operator, filterDescriptor?.filterType, 1);
|
|
4580
5604
|
if (matchMode && filterDescriptor) {
|
|
4581
|
-
|
|
4582
|
-
mediusParamsBuilder.withFilter(fieldFilterProperty, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
5605
|
+
mediusParamsBuilder.withFilter(filterDescriptor.property, value, valueTo, MediusRestUtil.getMediusFilterMatchTypeFromPrimeMatchMode(matchMode[0]));
|
|
4583
5606
|
}
|
|
4584
5607
|
}
|
|
4585
5608
|
}
|
|
@@ -4635,6 +5658,12 @@ class MediusRestUtil {
|
|
|
4635
5658
|
}
|
|
4636
5659
|
return params;
|
|
4637
5660
|
}
|
|
5661
|
+
static modifyFilterProperties(mediusQueryParams, filterDescriptors) {
|
|
5662
|
+
for (const filterParam of mediusQueryParams.filterParams ?? []) {
|
|
5663
|
+
const filterDescriptor = filterDescriptors.find(f => f.property === filterParam.property);
|
|
5664
|
+
filterParam.property = filterDescriptor?.filterProperty ?? filterParam.property;
|
|
5665
|
+
}
|
|
5666
|
+
}
|
|
4638
5667
|
static fromPrimeLazyLoadEventToMediusQueryParams(event) {
|
|
4639
5668
|
const queryParamBuilder = MediusQueryParamBuilder.create(event.rows, event.first);
|
|
4640
5669
|
// apply sorting
|
|
@@ -4884,6 +5913,7 @@ class ActionParameters {
|
|
|
4884
5913
|
constructor(itemId, item) {
|
|
4885
5914
|
this.itemId = itemId;
|
|
4886
5915
|
this.item = item;
|
|
5916
|
+
this.selectedItems = [];
|
|
4887
5917
|
}
|
|
4888
5918
|
withActionData(actionData) {
|
|
4889
5919
|
this.actionData = actionData;
|
|
@@ -4905,6 +5935,10 @@ class ActionParameters {
|
|
|
4905
5935
|
this.route = route;
|
|
4906
5936
|
return this;
|
|
4907
5937
|
}
|
|
5938
|
+
withSelectedItems(selectedItems) {
|
|
5939
|
+
this.selectedItems = selectedItems;
|
|
5940
|
+
return this;
|
|
5941
|
+
}
|
|
4908
5942
|
}
|
|
4909
5943
|
var ActionInstanceStateEnum;
|
|
4910
5944
|
(function (ActionInstanceStateEnum) {
|
|
@@ -4928,6 +5962,17 @@ var ActionInstanceStateEnum;
|
|
|
4928
5962
|
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishDismissed"] = 17] = "FinishDismissed"; // action was dismissed by user
|
|
4929
5963
|
})(ActionInstanceStateEnum || (ActionInstanceStateEnum = {}));
|
|
4930
5964
|
|
|
5965
|
+
/**
|
|
5966
|
+
* Default categories for tableview actions
|
|
5967
|
+
*/
|
|
5968
|
+
class TableviewActionDefaultCategories {
|
|
5969
|
+
}
|
|
5970
|
+
TableviewActionDefaultCategories.READ = 'read';
|
|
5971
|
+
TableviewActionDefaultCategories.ADD = 'add';
|
|
5972
|
+
TableviewActionDefaultCategories.EDIT = 'edit';
|
|
5973
|
+
TableviewActionDefaultCategories.DELETE = 'delete';
|
|
5974
|
+
TableviewActionDefaultCategories.DETAILS = 'details';
|
|
5975
|
+
|
|
4931
5976
|
class AuthorizationUtil {
|
|
4932
5977
|
static isPermitted(permissions, userRoles) {
|
|
4933
5978
|
switch (permissions.authorizationType) {
|
|
@@ -5349,6 +6394,65 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
5349
6394
|
}]
|
|
5350
6395
|
}] });
|
|
5351
6396
|
|
|
6397
|
+
class MngGetterPipe {
|
|
6398
|
+
transform(value, getterFunction) {
|
|
6399
|
+
if (typeof getterFunction === 'function') {
|
|
6400
|
+
return getterFunction(value);
|
|
6401
|
+
}
|
|
6402
|
+
return value;
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6405
|
+
MngGetterPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngGetterPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6406
|
+
MngGetterPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: MngGetterPipe, name: "getter" });
|
|
6407
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngGetterPipe, decorators: [{
|
|
6408
|
+
type: Pipe,
|
|
6409
|
+
args: [{
|
|
6410
|
+
name: 'getter',
|
|
6411
|
+
pure: true
|
|
6412
|
+
}]
|
|
6413
|
+
}] });
|
|
6414
|
+
|
|
6415
|
+
class MngTemplatePipe {
|
|
6416
|
+
constructor(parametrizePipe) {
|
|
6417
|
+
this.parametrizePipe = parametrizePipe;
|
|
6418
|
+
}
|
|
6419
|
+
transform(value, template) {
|
|
6420
|
+
if (typeof template === 'string') {
|
|
6421
|
+
return this.parametrizePipe.transform(template, undefined, value);
|
|
6422
|
+
}
|
|
6423
|
+
return value;
|
|
6424
|
+
}
|
|
6425
|
+
}
|
|
6426
|
+
MngTemplatePipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTemplatePipe, deps: [{ token: MngParametrizePipe }], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6427
|
+
MngTemplatePipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: MngTemplatePipe, name: "template" });
|
|
6428
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTemplatePipe, decorators: [{
|
|
6429
|
+
type: Pipe,
|
|
6430
|
+
args: [{
|
|
6431
|
+
name: 'template',
|
|
6432
|
+
pure: true
|
|
6433
|
+
}]
|
|
6434
|
+
}], ctorParameters: function () { return [{ type: MngParametrizePipe }]; } });
|
|
6435
|
+
|
|
6436
|
+
class MngClassMapPipe {
|
|
6437
|
+
transform(value, classNameMapFn, i) {
|
|
6438
|
+
if (classNameMapFn && typeof classNameMapFn === 'function') {
|
|
6439
|
+
return classNameMapFn(value, i);
|
|
6440
|
+
}
|
|
6441
|
+
else {
|
|
6442
|
+
return value ?? '';
|
|
6443
|
+
}
|
|
6444
|
+
}
|
|
6445
|
+
}
|
|
6446
|
+
MngClassMapPipe.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe });
|
|
6447
|
+
MngClassMapPipe.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, name: "mngClassMapPipe" });
|
|
6448
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngClassMapPipe, decorators: [{
|
|
6449
|
+
type: Pipe,
|
|
6450
|
+
args: [{
|
|
6451
|
+
name: 'mngClassMapPipe',
|
|
6452
|
+
pure: true
|
|
6453
|
+
}]
|
|
6454
|
+
}] });
|
|
6455
|
+
|
|
5352
6456
|
class MngActionExecutorService {
|
|
5353
6457
|
constructor(injector, router, dialogService, confirmationService, translate, configurationService, navigationService, errorMapper, parametrize, defaultEditorDialogComponent) {
|
|
5354
6458
|
this.injector = injector;
|
|
@@ -5606,34 +6710,45 @@ class MngActionExecutorService {
|
|
|
5606
6710
|
const context = this.prepareActionContext(instance, parameters, dataProvider, previousActionInstance);
|
|
5607
6711
|
if (action.hasRunConfirmation) {
|
|
5608
6712
|
const sourceComponent = parameters?.sourceComponent;
|
|
6713
|
+
const confirmationDescriptor = action.runConfirmationDialogDescriptor;
|
|
5609
6714
|
if (typeof sourceComponent?.getConfirmationService !== 'function' || typeof sourceComponent?.getConfirmationServiceInstanceKey !== 'function') {
|
|
5610
6715
|
throw new Error(`Source component ${sourceComponent} should be implementing IConfirmationService interface to be able to provide confirmation functionality.`);
|
|
5611
6716
|
}
|
|
6717
|
+
const item = parameters.item;
|
|
5612
6718
|
const srcConfirmComponent = sourceComponent;
|
|
5613
6719
|
let confirmParams = {
|
|
5614
6720
|
key: srcConfirmComponent.getConfirmationServiceInstanceKey(action),
|
|
5615
|
-
|
|
5616
|
-
|
|
6721
|
+
icon: confirmationDescriptor.icon,
|
|
6722
|
+
acceptVisible: true,
|
|
6723
|
+
acceptIcon: confirmationDescriptor.acceptIcon ?? undefined,
|
|
6724
|
+
acceptButtonStyleClass: confirmationDescriptor.acceptButtonStyle.getButtonClass(),
|
|
6725
|
+
rejectVisible: true,
|
|
6726
|
+
rejectIcon: confirmationDescriptor.rejectIcon ?? undefined,
|
|
6727
|
+
rejectButtonStyleClass: confirmationDescriptor.rejectButtonStyle.getButtonClass(),
|
|
6728
|
+
closeOnEscape: confirmationDescriptor.closeOnEscape
|
|
5617
6729
|
};
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
confirmParams.header = I18nUtils.Action.get(this.translate, action, 'confirm.title', action.runConfirmationTitle, item, 'general.confirmation') ?? undefined;
|
|
6730
|
+
if (confirmationDescriptor.title !== null) {
|
|
6731
|
+
confirmParams.header = I18nUtils.Action.get(this.translate, action, 'confirm.title', confirmationDescriptor.title, item, 'general.confirmation') ?? undefined;
|
|
5621
6732
|
}
|
|
5622
|
-
if (
|
|
6733
|
+
if (confirmationDescriptor.message !== null) {
|
|
5623
6734
|
confirmParams.message =
|
|
5624
|
-
I18nUtils.Action.get(this.translate, action, 'confirm.message',
|
|
6735
|
+
I18nUtils.Action.get(this.translate, action, 'confirm.message', confirmationDescriptor.message, StringUtil.escapeHtmlAny(item), 'general.confirmation') ??
|
|
5625
6736
|
undefined;
|
|
5626
6737
|
}
|
|
5627
|
-
if (
|
|
5628
|
-
confirmParams.
|
|
6738
|
+
if (confirmationDescriptor.acceptLabel !== null) {
|
|
6739
|
+
confirmParams.acceptLabel = I18nUtils.Action.get(this.translate, action, 'confirm.accept', confirmationDescriptor.acceptLabel, item, 'general.yes') ?? undefined;
|
|
6740
|
+
}
|
|
6741
|
+
if (confirmationDescriptor.acceptIcon !== null) {
|
|
6742
|
+
confirmParams.acceptIcon = confirmationDescriptor.acceptIcon;
|
|
5629
6743
|
}
|
|
5630
|
-
if (
|
|
5631
|
-
confirmParams.
|
|
5632
|
-
confirmParams.acceptVisible = true;
|
|
6744
|
+
if (confirmationDescriptor.rejectIcon !== null) {
|
|
6745
|
+
confirmParams.rejectIcon = confirmationDescriptor.rejectIcon;
|
|
5633
6746
|
}
|
|
5634
|
-
if (
|
|
5635
|
-
confirmParams.rejectLabel = I18nUtils.Action.get(this.translate, action, 'confirm.reject',
|
|
5636
|
-
|
|
6747
|
+
if (confirmationDescriptor.rejectLabel !== null) {
|
|
6748
|
+
confirmParams.rejectLabel = I18nUtils.Action.get(this.translate, action, 'confirm.reject', confirmationDescriptor.rejectLabel, item, 'general.no') ?? undefined;
|
|
6749
|
+
}
|
|
6750
|
+
if (confirmationDescriptor.rejectLabel === null && confirmationDescriptor.rejectIcon === null) {
|
|
6751
|
+
confirmParams.rejectVisible = false;
|
|
5637
6752
|
}
|
|
5638
6753
|
confirmParams.accept = () => {
|
|
5639
6754
|
instance.state = ActionInstanceStateEnum.RunConfirmationEndAccept;
|
|
@@ -5643,8 +6758,8 @@ class MngActionExecutorService {
|
|
|
5643
6758
|
instance.state = ActionInstanceStateEnum.RunConfirmationEndReject;
|
|
5644
6759
|
this.deactivateAction(instance);
|
|
5645
6760
|
};
|
|
5646
|
-
if (
|
|
5647
|
-
confirmParams =
|
|
6761
|
+
if (confirmationDescriptor.runConfirmationConfigMapFn) {
|
|
6762
|
+
confirmParams = confirmationDescriptor.runConfirmationConfigMapFn(context, confirmParams);
|
|
5648
6763
|
}
|
|
5649
6764
|
context.confirmation = confirmParams;
|
|
5650
6765
|
instance.state = ActionInstanceStateEnum.RunConfirmationStart;
|
|
@@ -5798,7 +6913,7 @@ class MngActionExecutorService {
|
|
|
5798
6913
|
if (actionUrl.startsWith('/')) {
|
|
5799
6914
|
actionUrl = actionUrl.substring(1);
|
|
5800
6915
|
}
|
|
5801
|
-
const actionUrlSegments = this.parametrize.transform(actionUrl, parameters.itemId, parameters.item, parameters.actionData);
|
|
6916
|
+
const actionUrlSegments = this.parametrize.transform(actionUrl, parameters.itemId, parameters.item, parameters.actionData).split('/');
|
|
5802
6917
|
instance.triggerRouteNavigation = from(this.router.navigate([baseUrl, ...actionUrlSegments], { relativeTo: parameters.route, queryParams: parsedUrl.queryParams }));
|
|
5803
6918
|
return instance;
|
|
5804
6919
|
}
|
|
@@ -6304,6 +7419,7 @@ class MngActionComponent {
|
|
|
6304
7419
|
this.isHostHidden = false;
|
|
6305
7420
|
this.inputDisabled = of(false);
|
|
6306
7421
|
this.inputLoading = of(false);
|
|
7422
|
+
this.selectedItems = [];
|
|
6307
7423
|
this.finishEventEmitter = new EventEmitter();
|
|
6308
7424
|
this.loadingSubject = new ReplaySubject(1);
|
|
6309
7425
|
this.$loading = this.loadingSubject.asObservable();
|
|
@@ -6325,7 +7441,7 @@ class MngActionComponent {
|
|
|
6325
7441
|
}
|
|
6326
7442
|
ngOnInit() {
|
|
6327
7443
|
this.viewContainer = this.viewContainerInit ?? this.viewContainerService ?? undefined;
|
|
6328
|
-
this.hasNoTitle = this.action.
|
|
7444
|
+
this.hasNoTitle = this.action.buttonDescriptor.label === null;
|
|
6329
7445
|
this.isEnabledSubject.next(true);
|
|
6330
7446
|
this.isVisibleSubject.next(true);
|
|
6331
7447
|
this.isPermittedSubject.next(true);
|
|
@@ -6348,10 +7464,13 @@ class MngActionComponent {
|
|
|
6348
7464
|
this.isHostHidden = !isVisible || !isPermitted;
|
|
6349
7465
|
});
|
|
6350
7466
|
this.subscriptions.push(hostVisibilitySubscription);
|
|
6351
|
-
this.buttonClass = this.action.
|
|
7467
|
+
this.buttonClass = this.action.buttonDescriptor.styleClass.getButtonClass(this.hasNoTitle);
|
|
6352
7468
|
}
|
|
6353
7469
|
ngOnChanges(changes) {
|
|
6354
|
-
if (!(changes['item']?.firstChange ?? true) ||
|
|
7470
|
+
if (!(changes['item']?.firstChange ?? true) ||
|
|
7471
|
+
!(changes['itemId']?.firstChange ?? true) ||
|
|
7472
|
+
!(changes['actionData']?.firstChange ?? true) ||
|
|
7473
|
+
(this.action.hasItemsSelection && !(changes['selectedItems']?.firstChange ?? true))) {
|
|
6355
7474
|
this.processSubscriptions();
|
|
6356
7475
|
}
|
|
6357
7476
|
}
|
|
@@ -6372,11 +7491,15 @@ class MngActionComponent {
|
|
|
6372
7491
|
.withQueryParam(this.queryParam)
|
|
6373
7492
|
.withRoute(this.route)
|
|
6374
7493
|
.withViewContainer(this.viewContainer)
|
|
6375
|
-
.withSourceComponent(this)
|
|
7494
|
+
.withSourceComponent(this)
|
|
7495
|
+
.withSelectedItems(this.selectedItems);
|
|
6376
7496
|
const instance = this.actionExecutor.triggerAction(this.action, parameters);
|
|
6377
7497
|
this.subscriptions.push(instance.result$.subscribe({
|
|
6378
7498
|
next: () => {
|
|
6379
7499
|
this.finishEventEmitter.next(instance);
|
|
7500
|
+
if (this.action.hasItemsSelection) {
|
|
7501
|
+
this.viewContainerService?.triggerTableReload({});
|
|
7502
|
+
}
|
|
6380
7503
|
}
|
|
6381
7504
|
}));
|
|
6382
7505
|
this.subscriptions.push(instance.error$.subscribe({
|
|
@@ -6401,6 +7524,9 @@ class MngActionComponent {
|
|
|
6401
7524
|
.withActionData(this.actionData)
|
|
6402
7525
|
.withViewContainer(this.viewContainer ?? undefined)
|
|
6403
7526
|
.withSourceComponent(this);
|
|
7527
|
+
if (this.action.hasItemsSelection) {
|
|
7528
|
+
parameters.withSelectedItems(this.selectedItems);
|
|
7529
|
+
}
|
|
6404
7530
|
const context = this.actionExecutor.prepareActionContextValidation(this.action, parameters, this.dataProvider);
|
|
6405
7531
|
if (typeof this.action.isVisibleFunction === 'function') {
|
|
6406
7532
|
this.isVisibleSubscription?.unsubscribe();
|
|
@@ -6425,21 +7551,21 @@ class MngActionComponent {
|
|
|
6425
7551
|
}
|
|
6426
7552
|
if (!this.hasNoTitle) {
|
|
6427
7553
|
this.labelSubscription?.unsubscribe();
|
|
6428
|
-
this.labelSubscription = I18nUtils.Action.getAsync(this.translate, this.action, 'title', this.action
|
|
7554
|
+
this.labelSubscription = I18nUtils.Action.getAsync(this.translate, this.action, 'title', this.action.buttonDescriptor.label ?? undefined, this.item).subscribe({
|
|
6429
7555
|
next: i18n => this.labelSubject.next(i18n)
|
|
6430
7556
|
});
|
|
6431
7557
|
}
|
|
6432
7558
|
this.tooltipSubscription?.unsubscribe();
|
|
6433
|
-
this.tooltipSubscription = I18nUtils.Action.getAsync(this.translate, this.action, 'tooltip', this.action
|
|
7559
|
+
this.tooltipSubscription = I18nUtils.Action.getAsync(this.translate, this.action, 'tooltip', this.action.buttonDescriptor.tooltip, this.item).subscribe({
|
|
6434
7560
|
next: i18n => this.tooltipSubject.next(i18n)
|
|
6435
7561
|
});
|
|
6436
7562
|
}
|
|
6437
7563
|
}
|
|
6438
7564
|
MngActionComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionComponent, deps: [{ token: i1.ActivatedRoute }, { token: i1$2.TranslateService }, { token: MngAuthorizationService }, { token: MngActionExecutorService }, { token: i2.ConfirmationService }, { token: MngViewContainerComponentService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
6439
|
-
MngActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionComponent, selector: "mng-action", inputs: { action: "action", item: "item", itemId: "itemId", actionData: "actionData", queryParam: "queryParam", dataProvider: "dataProvider", inputDisabled: ["disabled", "inputDisabled"], inputLoading: ["loading", "inputLoading"], viewContainerInit: ["viewContainer", "viewContainerInit"] }, outputs: { finishEventEmitter: "finish" }, host: { properties: { "class": "this.hostClass", "class.m-0": "this.isHostHidden" } }, providers: [ConfirmationService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog
|
|
7565
|
+
MngActionComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionComponent, selector: "mng-action", inputs: { action: "action", item: "item", itemId: "itemId", actionData: "actionData", queryParam: "queryParam", dataProvider: "dataProvider", inputDisabled: ["disabled", "inputDisabled"], inputLoading: ["loading", "inputLoading"], viewContainerInit: ["viewContainer", "viewContainerInit"], selectedItems: "selectedItems" }, outputs: { finishEventEmitter: "finish" }, host: { properties: { "class": "this.hostClass", "class.m-0": "this.isHostHidden" } }, providers: [ConfirmationService], usesOnChanges: true, ngImport: i0, template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog\n *ngIf=\"action.runConfirmationDialogDescriptor\"\n [key]=\"action.actionName + '_' + cmpId\"\n [baseZIndex]=\"50\"\n appendTo=\"body\"\n [closable]=\"action.runConfirmationDialogDescriptor.closable\"></p-confirmDialog>\n</ng-container>\n", styles: [":host{display:inline-block}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterLinkWithHref, selector: "a[routerLink],area[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "preserveFragment", "skipLocationChange", "replaceUrl", "state", "relativeTo", "routerLink"] }, { kind: "directive", type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "component", type: i9.ConfirmDialog, selector: "p-confirmDialog", inputs: ["header", "icon", "message", "style", "styleClass", "maskStyleClass", "acceptIcon", "acceptLabel", "acceptAriaLabel", "acceptVisible", "rejectIcon", "rejectLabel", "rejectAriaLabel", "rejectVisible", "acceptButtonStyleClass", "rejectButtonStyleClass", "closeOnEscape", "dismissableMask", "blockScroll", "rtl", "closable", "appendTo", "key", "autoZIndex", "baseZIndex", "transitionOptions", "focusTrap", "defaultFocus", "breakpoints", "visible", "position"], outputs: ["onHide"] }, { kind: "directive", type: i6.Ripple, selector: "[pRipple]" }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: MngParametrizePipe, name: "parametrize" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
6440
7566
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionComponent, decorators: [{
|
|
6441
7567
|
type: Component,
|
|
6442
|
-
args: [{ selector: 'mng-action', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ConfirmationService], template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog
|
|
7568
|
+
args: [{ selector: 'mng-action', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ConfirmationService], template: "<ng-container *ngIf=\"($isVisible | async) && ($isPermitted | async)\">\n <a\n *ngIf=\"actionLink && actionLink.url !== ''; else routerLink\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [href]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.url | parametrize: itemId:item:actionData)\"\n [target]=\"actionLink.target\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n <ng-template #routerLink>\n <a\n *ngIf=\"actionLink; else button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [target]=\"actionLink.target\"\n [replaceUrl]=\"actionLink.replaceUrl\"\n [routerLink]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false) ? null : (actionLink.pathSegments | parametrize: itemId:item:actionData)\"\n [queryParams]=\"actionLink.queryParams | parametrize: itemId:item:actionData\"\n [queryParamsHandling]=\"actionLink.queryParamsHandling\"\n [class.disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n [class]=\"buttonClass\"\n >{{ ($label | async) ?? '' }}</a\n >\n </ng-template>\n <ng-template #button>\n <button\n type=\"button\"\n pButton\n pRipple\n [icon]=\"$any(action.buttonDescriptor.icon)\"\n [label]=\"($label | async) ?? ''\"\n [pTooltip]=\"$any($tooltip | async)\"\n [loading]=\"(($loading | async) ?? false) || ((inputLoading | async) ?? false)\"\n [disabled]=\"($isEnabled | async) === false || ((inputDisabled | async) ?? false)\"\n (click)=\"triggerAction($event)\"\n [class]=\"buttonClass\"></button>\n </ng-template>\n <p-confirmDialog\n *ngIf=\"action.runConfirmationDialogDescriptor\"\n [key]=\"action.actionName + '_' + cmpId\"\n [baseZIndex]=\"50\"\n appendTo=\"body\"\n [closable]=\"action.runConfirmationDialogDescriptor.closable\"></p-confirmDialog>\n</ng-container>\n", styles: [":host{display:inline-block}\n"] }]
|
|
6443
7569
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i1$2.TranslateService }, { type: MngAuthorizationService }, { type: MngActionExecutorService }, { type: i2.ConfirmationService }, { type: MngViewContainerComponentService, decorators: [{
|
|
6444
7570
|
type: Optional
|
|
6445
7571
|
}] }]; }, propDecorators: { hostClass: [{
|
|
@@ -6469,6 +7595,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
6469
7595
|
}], viewContainerInit: [{
|
|
6470
7596
|
type: Input,
|
|
6471
7597
|
args: ['viewContainer']
|
|
7598
|
+
}], selectedItems: [{
|
|
7599
|
+
type: Input
|
|
6472
7600
|
}], finishEventEmitter: [{
|
|
6473
7601
|
type: Output,
|
|
6474
7602
|
args: ['finish']
|
|
@@ -6720,13 +7848,14 @@ class MngFormEditorComponent {
|
|
|
6720
7848
|
if (field && field.setter) {
|
|
6721
7849
|
const splitPath = field.property.split('.');
|
|
6722
7850
|
let fieldValue = formValue;
|
|
6723
|
-
for (let i = 0; i < splitPath.length; i++) {
|
|
7851
|
+
for (let i = 0; i < splitPath.length - 1; i++) {
|
|
6724
7852
|
const currentSubPath = splitPath[i];
|
|
6725
7853
|
if (typeof fieldValue[currentSubPath] !== 'object') {
|
|
6726
7854
|
fieldValue[currentSubPath] = {};
|
|
6727
7855
|
}
|
|
6728
7856
|
fieldValue = fieldValue[currentSubPath];
|
|
6729
7857
|
}
|
|
7858
|
+
fieldValue = fieldValue[splitPath[splitPath.length - 1]];
|
|
6730
7859
|
field.setter(formValue, fieldValue);
|
|
6731
7860
|
}
|
|
6732
7861
|
});
|
|
@@ -7384,11 +8513,11 @@ class MngActionEditorComponent {
|
|
|
7384
8513
|
this.setTitle();
|
|
7385
8514
|
for (const action of this.action.editorActions) {
|
|
7386
8515
|
if (action instanceof ActionEditorSubmitDescriptor) {
|
|
7387
|
-
if (typeof action.icon === 'undefined') {
|
|
7388
|
-
action.withIcon(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'pi pi-check' : 'pi pi-times');
|
|
8516
|
+
if (typeof action.buttonDescriptor.icon === 'undefined') {
|
|
8517
|
+
action.buttonDescriptor.withIcon(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'pi pi-check' : 'pi pi-times');
|
|
7389
8518
|
}
|
|
7390
|
-
if (typeof action.
|
|
7391
|
-
action.
|
|
8519
|
+
if (typeof action.buttonDescriptor.label === 'undefined') {
|
|
8520
|
+
action.buttonDescriptor.withLabel(action.submitType === ActionEditorSubmitTypeEnum.Submit ? 'general.save' : this.isDialog ? 'general.close' : 'general.cancel');
|
|
7392
8521
|
}
|
|
7393
8522
|
// assign run operations
|
|
7394
8523
|
action.withRunNotificationSuccess(undefined, undefined, false);
|
|
@@ -7515,7 +8644,7 @@ class MngActionEditorComponent {
|
|
|
7515
8644
|
}
|
|
7516
8645
|
}
|
|
7517
8646
|
MngActionEditorComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionEditorComponent, deps: [{ token: i0.Injector }, { token: i1$2.TranslateService }, { token: MngActionExecutorService }, { token: MngCommonsService }, { token: MngNavigationService }, { token: i3.DynamicDialogRef, optional: true }, { token: i3.DynamicDialogConfig, optional: true }, { token: MngViewContainerComponentService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
7518
|
-
MngActionEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionEditorComponent, selector: "mng-action-editor", inputs: { action: "action", itemId: "itemId", item: "item", actionData: "actionData", dataProvider: "dataProvider", viewContainerInit: ["viewContainer", "viewContainerInit"] }, outputs: { actionRunEventEmitter: "actionSubmit", actionCancelEventEmitter: "actionCancel" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true }, { propertyName: "editorComponent", first: true, predicate: MngFormEditorComponent, descendants: true }], ngImport: i0, template: "<h5 *ngIf=\"!isDialog && title\">{{ title }}</h5>\n<div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n </p-toolbar>\n </div>\n\n <div class=\"flex-grow-1\">\n <div class=\"text-center\" *ngIf=\"loading$ | async\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n <mng-form-editor *ngIf=\"action.editorDescriptor && (loading$ | async) === false\" [descriptor]=\"action.editorDescriptor\" [item]=\"item\" (formSubmit)=\"onSubmit($event)\">\n </mng-form-editor>\n </div>\n\n <div class=\"flex flex-row justify-content-between\">\n <div>\n <mng-action *ngFor=\"let action of footerLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n <div>\n <mng-action *ngFor=\"let action of footerRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { kind: "component", type: i7$1.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: MngFormEditorComponent, selector: "mng-form-editor", inputs: ["descriptor", "submitLoading", "item", "isSubmitButtonVisible", "isFormDisabled"], outputs: ["formSubmit"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8647
|
+
MngActionEditorComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngActionEditorComponent, selector: "mng-action-editor", inputs: { action: "action", itemId: "itemId", item: "item", actionData: "actionData", dataProvider: "dataProvider", viewContainerInit: ["viewContainer", "viewContainerInit"] }, outputs: { actionRunEventEmitter: "actionSubmit", actionCancelEventEmitter: "actionCancel" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "submitButtonElementRef", first: true, predicate: ["submitButton"], descendants: true }, { propertyName: "editorComponent", first: true, predicate: MngFormEditorComponent, descendants: true }], ngImport: i0, template: "<h5 *ngIf=\"!isDialog && title\">{{ title }}</h5>\n<div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n </p-toolbar>\n </div>\n\n <div class=\"flex-grow-1\">\n <div class=\"text-center\" *ngIf=\"loading$ | async\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n <mng-form-editor *ngIf=\"action.editorDescriptor && (loading$ | async) === false\" [descriptor]=\"action.editorDescriptor\" [item]=\"item\" (formSubmit)=\"onSubmit($event)\">\n </mng-form-editor>\n </div>\n\n <div class=\"flex flex-row justify-content-between\">\n <div>\n <mng-action *ngFor=\"let action of footerLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n <div>\n <mng-action *ngFor=\"let action of footerRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { kind: "component", type: i7$1.ProgressSpinner, selector: "p-progressSpinner", inputs: ["style", "styleClass", "strokeWidth", "fill", "animationDuration"] }, { kind: "component", type: MngFormEditorComponent, selector: "mng-form-editor", inputs: ["descriptor", "submitLoading", "item", "isSubmitButtonVisible", "isFormDisabled"], outputs: ["formSubmit"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7519
8648
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionEditorComponent, decorators: [{
|
|
7520
8649
|
type: Component,
|
|
7521
8650
|
args: [{ selector: 'mng-action-editor', changeDetection: ChangeDetectionStrategy.OnPush, template: "<h5 *ngIf=\"!isDialog && title\">{{ title }}</h5>\n<div class=\"h-full flex flex-column\">\n <div class=\"flex-grow-1\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <p-toolbar styleClass=\"mng-action-editor-toolbar\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </ng-template>\n </p-toolbar>\n </div>\n\n <div class=\"flex-grow-1\">\n <div class=\"text-center\" *ngIf=\"loading$ | async\">\n <p-progressSpinner [style]=\"{width: '3rem', height: '3rem'}\" strokeWidth=\"3\"></p-progressSpinner>\n </div>\n <mng-form-editor *ngIf=\"action.editorDescriptor && (loading$ | async) === false\" [descriptor]=\"action.editorDescriptor\" [item]=\"item\" (formSubmit)=\"onSubmit($event)\">\n </mng-form-editor>\n </div>\n\n <div class=\"flex flex-row justify-content-between\">\n <div>\n <mng-action *ngFor=\"let action of footerLeftActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n <div>\n <mng-action *ngFor=\"let action of footerRightActions\" [action]=\"action\" [disabled]=\"submitLoading$\" [viewContainer]=\"viewContainer\"></mng-action>\n </div>\n </div>\n</div>\n" }]
|
|
@@ -7555,6 +8684,47 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
7555
8684
|
args: [MngFormEditorComponent]
|
|
7556
8685
|
}] } });
|
|
7557
8686
|
|
|
8687
|
+
class MngButtonComponent {
|
|
8688
|
+
constructor() {
|
|
8689
|
+
this.clickEmitter = new EventEmitter();
|
|
8690
|
+
this.focusEmitter = new EventEmitter();
|
|
8691
|
+
this.blurEmitter = new EventEmitter();
|
|
8692
|
+
this.buttonClass = 'p-button';
|
|
8693
|
+
}
|
|
8694
|
+
ngOnInit() {
|
|
8695
|
+
this.buttonClass = `${this.descriptor.styleClass.getButtonClass(this.descriptor.label == null)}`;
|
|
8696
|
+
}
|
|
8697
|
+
onClick(event) {
|
|
8698
|
+
this.clickEmitter.next(event);
|
|
8699
|
+
this.descriptor.onClick?.(event);
|
|
8700
|
+
}
|
|
8701
|
+
onFocus(event) {
|
|
8702
|
+
this.focusEmitter.next(event);
|
|
8703
|
+
this.descriptor.onFocus?.(event);
|
|
8704
|
+
}
|
|
8705
|
+
onBlur(event) {
|
|
8706
|
+
this.blurEmitter.next(event);
|
|
8707
|
+
this.descriptor.onBlur?.(event);
|
|
8708
|
+
}
|
|
8709
|
+
}
|
|
8710
|
+
MngButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
8711
|
+
MngButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngButtonComponent, selector: "mng-button", inputs: { descriptor: "descriptor" }, outputs: { clickEmitter: "buttonClick", focusEmitter: "buttonFocus", blurEmitter: "buttonBlur" }, ngImport: i0, template: "<p-button\n #button\n type=\"button\"\n [label]=\"$any(descriptor.label) | translate\"\n [icon]=\"$any(descriptor.icon)\"\n [iconPos]=\"$any(descriptor.iconPosition)\"\n [loading]=\"$any(descriptor.loading)\"\n [loadingIcon]=\"$any(descriptor.loadingIcon)\"\n [disabled]=\"$any(descriptor.disabled)\"\n [styleClass]=\"buttonClass\"\n [pTooltip]=\"$any(descriptor.tooltip) | translate\"\n [badge]=\"$any(descriptor.badge)\"\n (onClick)=\"onClick($event)\"\n (onBlur)=\"onBlur($event)\"\n (onFocus)=\"onFocus($event)\"></p-button>\n", dependencies: [{ kind: "directive", type: i7.Tooltip, selector: "[pTooltip]", inputs: ["tooltipPosition", "tooltipEvent", "appendTo", "positionStyle", "tooltipStyleClass", "tooltipZIndex", "escape", "showDelay", "hideDelay", "life", "positionTop", "positionLeft", "fitContent", "pTooltip", "tooltipDisabled", "tooltipOptions"] }, { kind: "component", type: i4$1.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "style", "styleClass", "badgeClass", "ariaLabel"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8712
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngButtonComponent, decorators: [{
|
|
8713
|
+
type: Component,
|
|
8714
|
+
args: [{ selector: 'mng-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<p-button\n #button\n type=\"button\"\n [label]=\"$any(descriptor.label) | translate\"\n [icon]=\"$any(descriptor.icon)\"\n [iconPos]=\"$any(descriptor.iconPosition)\"\n [loading]=\"$any(descriptor.loading)\"\n [loadingIcon]=\"$any(descriptor.loadingIcon)\"\n [disabled]=\"$any(descriptor.disabled)\"\n [styleClass]=\"buttonClass\"\n [pTooltip]=\"$any(descriptor.tooltip) | translate\"\n [badge]=\"$any(descriptor.badge)\"\n (onClick)=\"onClick($event)\"\n (onBlur)=\"onBlur($event)\"\n (onFocus)=\"onFocus($event)\"></p-button>\n" }]
|
|
8715
|
+
}], propDecorators: { descriptor: [{
|
|
8716
|
+
type: Input
|
|
8717
|
+
}], clickEmitter: [{
|
|
8718
|
+
type: Output,
|
|
8719
|
+
args: ['buttonClick']
|
|
8720
|
+
}], focusEmitter: [{
|
|
8721
|
+
type: Output,
|
|
8722
|
+
args: ['buttonFocus']
|
|
8723
|
+
}], blurEmitter: [{
|
|
8724
|
+
type: Output,
|
|
8725
|
+
args: ['buttonBlur']
|
|
8726
|
+
}] } });
|
|
8727
|
+
|
|
7558
8728
|
class MngFormlyFieldAutocompleteComponent extends FieldType {
|
|
7559
8729
|
constructor() {
|
|
7560
8730
|
super(...arguments);
|
|
@@ -7792,10 +8962,10 @@ class MngTableColumnValueComponent {
|
|
|
7792
8962
|
}
|
|
7793
8963
|
}
|
|
7794
8964
|
MngTableColumnValueComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableColumnValueComponent, deps: [{ token: i0.ElementRef }, { token: i2.MessageService }, { token: i1$2.TranslateService }], target: i0.ɵɵFactoryTarget.Component });
|
|
7795
|
-
MngTableColumnValueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: { descriptor: "descriptor", item: "item" }, host: { properties: { "style.max-width.px": "this.styleMaxWidth", "class": "this.className" } }, ngImport: i0, template: "<ng-container [ngSwitch]=\"descriptor.columnType\">\n <ng-container *ngSwitchCase=\"columnTypeString\">\n {{ item | jsonPath: jsonPath }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeNumber\">\n {{ item | jsonPath: jsonPath | number: descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCurrency\">\n {{ item | jsonPath: jsonPath | currency: currency:descriptor.currencyDisplay:descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeDate\">\n {{ item | jsonPath: jsonPath | date: descriptor.displayFormat }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeBoolean\">\n <ng-container *ngIf=\"descriptor.booleanAsIcon; else booleanText\"></ng-container>\n <i [class]=\"item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo:true\"></i>\n <ng-template #booleanText>\n {{ item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo | translate }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeEnum\">\n {{ item | jsonPath: jsonPath | enum: descriptor.enumType:descriptor.enumTitlePath:descriptor.enumNameAsValue | translate }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCustom\">\n <ng-container\n [mngComponent]=\"descriptor.customComponentType!\"\n [inputs]=\"{\n value: item | jsonPath: jsonPath,\n item: item,\n descriptor: descriptor\n }\"></ng-container>\n </ng-container>\n</ng-container>\n<div class=\"help-buttons\" *ngIf=\"descriptor.hasCopyToClipboard\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n</div>\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host:hover .help-buttons{display:block}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "directive", type: i6.Ripple, selector: "[pRipple]" }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs"], outputs: ["instanceCreated"] }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: JsonPathPipe, name: "jsonPath" }, { kind: "pipe", type: MngEnumPipe, name: "enum" }, { kind: "pipe", type: MngBooleanPipe, name: "boolean" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8965
|
+
MngTableColumnValueComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: { descriptor: "descriptor", item: "item" }, host: { properties: { "style.max-width.px": "this.styleMaxWidth", "class": "this.className" } }, ngImport: i0, template: "<ng-container [ngSwitch]=\"descriptor.columnType\">\n <ng-container *ngSwitchCase=\"columnTypeString\">\n {{ item | jsonPath: jsonPath | getter: descriptor.getter | template: descriptor.template }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeNumber\">\n {{ item | jsonPath: jsonPath | number: descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCurrency\">\n {{ item | jsonPath: jsonPath | currency: currency:descriptor.currencyDisplay:descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeDate\">\n {{ item | jsonPath: jsonPath | date: descriptor.displayFormat }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeBoolean\">\n <ng-container *ngIf=\"descriptor.booleanAsIcon; else booleanText\"></ng-container>\n <i [class]=\"item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo:true\"></i>\n <ng-template #booleanText>\n {{ item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo | translate }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeEnum\">\n {{ item | jsonPath: jsonPath | enum: descriptor.enumType:descriptor.enumTitlePath:descriptor.enumNameAsValue | translate }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCustom\">\n <ng-container\n [mngComponent]=\"descriptor.customComponentType!\"\n [inputs]=\"{\n value: item | jsonPath: jsonPath,\n item: item,\n descriptor: descriptor\n }\"></ng-container>\n </ng-container>\n</ng-container>\n<div class=\"help-buttons\" *ngIf=\"descriptor.hasCopyToClipboard\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n</div>\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host:hover .help-buttons{display:block}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"], dependencies: [{ kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i1$1.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "directive", type: i4$1.ButtonDirective, selector: "[pButton]", inputs: ["iconPos", "loadingIcon", "label", "icon", "loading"] }, { kind: "directive", type: i6.Ripple, selector: "[pRipple]" }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs"], outputs: ["instanceCreated"] }, { kind: "pipe", type: i1$1.DecimalPipe, name: "number" }, { kind: "pipe", type: i1$1.CurrencyPipe, name: "currency" }, { kind: "pipe", type: i1$1.DatePipe, name: "date" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: JsonPathPipe, name: "jsonPath" }, { kind: "pipe", type: MngEnumPipe, name: "enum" }, { kind: "pipe", type: MngBooleanPipe, name: "boolean" }, { kind: "pipe", type: MngGetterPipe, name: "getter" }, { kind: "pipe", type: MngTemplatePipe, name: "template" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
7796
8966
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableColumnValueComponent, decorators: [{
|
|
7797
8967
|
type: Component,
|
|
7798
|
-
args: [{ selector: 'mng-table-column-value', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container [ngSwitch]=\"descriptor.columnType\">\n <ng-container *ngSwitchCase=\"columnTypeString\">\n {{ item | jsonPath: jsonPath }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeNumber\">\n {{ item | jsonPath: jsonPath | number: descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCurrency\">\n {{ item | jsonPath: jsonPath | currency: currency:descriptor.currencyDisplay:descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeDate\">\n {{ item | jsonPath: jsonPath | date: descriptor.displayFormat }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeBoolean\">\n <ng-container *ngIf=\"descriptor.booleanAsIcon; else booleanText\"></ng-container>\n <i [class]=\"item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo:true\"></i>\n <ng-template #booleanText>\n {{ item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo | translate }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeEnum\">\n {{ item | jsonPath: jsonPath | enum: descriptor.enumType:descriptor.enumTitlePath:descriptor.enumNameAsValue | translate }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCustom\">\n <ng-container\n [mngComponent]=\"descriptor.customComponentType!\"\n [inputs]=\"{\n value: item | jsonPath: jsonPath,\n item: item,\n descriptor: descriptor\n }\"></ng-container>\n </ng-container>\n</ng-container>\n<div class=\"help-buttons\" *ngIf=\"descriptor.hasCopyToClipboard\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n</div>\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host:hover .help-buttons{display:block}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"] }]
|
|
8968
|
+
args: [{ selector: 'mng-table-column-value', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container [ngSwitch]=\"descriptor.columnType\">\n <ng-container *ngSwitchCase=\"columnTypeString\">\n {{ item | jsonPath: jsonPath | getter: descriptor.getter | template: descriptor.template }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeNumber\">\n {{ item | jsonPath: jsonPath | number: descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCurrency\">\n {{ item | jsonPath: jsonPath | currency: currency:descriptor.currencyDisplay:descriptor.displayFormat:descriptor.locale }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeDate\">\n {{ item | jsonPath: jsonPath | date: descriptor.displayFormat }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeBoolean\">\n <ng-container *ngIf=\"descriptor.booleanAsIcon; else booleanText\"></ng-container>\n <i [class]=\"item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo:true\"></i>\n <ng-template #booleanText>\n {{ item | jsonPath: jsonPath | boolean: descriptor.booleanYes:descriptor.booleanNo | translate }}\n </ng-template>\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeEnum\">\n {{ item | jsonPath: jsonPath | enum: descriptor.enumType:descriptor.enumTitlePath:descriptor.enumNameAsValue | translate }}\n </ng-container>\n <ng-container *ngSwitchCase=\"columnTypeCustom\">\n <ng-container\n [mngComponent]=\"descriptor.customComponentType!\"\n [inputs]=\"{\n value: item | jsonPath: jsonPath,\n item: item,\n descriptor: descriptor\n }\"></ng-container>\n </ng-container>\n</ng-container>\n<div class=\"help-buttons\" *ngIf=\"descriptor.hasCopyToClipboard\">\n <button pButton pRipple type=\"button\" icon=\"pi pi-copy\" class=\"p-button-rounded p-button-info p-button-sm\" (click)=\"copyToClipboard($event)\"></button>\n</div>\n", styles: [":host{display:inline-block;overflow:hidden}:host.nowrap{white-space:nowrap;text-overflow:ellipsis}:host:hover .help-buttons{display:block}.help-buttons{display:none;position:absolute;right:0;top:50%;transform:translateY(-50%)}.help-buttons .p-button{height:1.9rem;width:1.9rem;padding:0}\n"] }]
|
|
7799
8969
|
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i2.MessageService }, { type: i1$2.TranslateService }]; }, propDecorators: { descriptor: [{
|
|
7800
8970
|
type: Input
|
|
7801
8971
|
}], item: [{
|
|
@@ -7823,7 +8993,7 @@ class MngTableColumnFilterComponent {
|
|
|
7823
8993
|
this.primeMatchModes = null;
|
|
7824
8994
|
}
|
|
7825
8995
|
ngOnInit() {
|
|
7826
|
-
this.primeDefaultMatchMode = this.descriptor.defaultFilterMatchMode;
|
|
8996
|
+
this.primeDefaultMatchMode = this.descriptor.defaultFilterMatchMode ?? FilterMatchModeEnum.Equals;
|
|
7827
8997
|
switch (this.descriptor.filterType) {
|
|
7828
8998
|
case FilterTypeEnum.Boolean:
|
|
7829
8999
|
this.primeType = 'boolean';
|
|
@@ -7842,6 +9012,9 @@ class MngTableColumnFilterComponent {
|
|
|
7842
9012
|
this.lookupDescriptor = this.descriptor;
|
|
7843
9013
|
this.primeField = `${this.descriptor.property}${this.lookupDescriptor.itemsValueProperty ? `.${this.lookupDescriptor.itemsValueProperty}` : ''}`;
|
|
7844
9014
|
this.primeMatchModes = [{ value: FilterMatchModeEnum.Equals, label: this.primeConfig.getTranslation(FilterMatchModeEnum.Equals) }];
|
|
9015
|
+
if (this.lookupDescriptor.multiselect) {
|
|
9016
|
+
this.primeDefaultMatchMode = FilterMatchModeEnum.In;
|
|
9017
|
+
}
|
|
7845
9018
|
break;
|
|
7846
9019
|
case FilterTypeEnum.String:
|
|
7847
9020
|
this.primeType = 'text';
|
|
@@ -7947,6 +9120,7 @@ class MngTableComponent {
|
|
|
7947
9120
|
this.dataProviderLatestLazyLoadEventVersion = 0;
|
|
7948
9121
|
this.dataProviderLatestQueryParamVersion = 0;
|
|
7949
9122
|
// filter, sort
|
|
9123
|
+
this.hasColumnFilters = false;
|
|
7950
9124
|
this.isFilterChanged = false;
|
|
7951
9125
|
this.isSortChanged = false;
|
|
7952
9126
|
this.filterDescriptors = [];
|
|
@@ -7958,10 +9132,14 @@ class MngTableComponent {
|
|
|
7958
9132
|
}
|
|
7959
9133
|
ngOnInit() {
|
|
7960
9134
|
this.viewContainer = this.viewContainerInit ?? this.viewContainerService ?? undefined;
|
|
7961
|
-
|
|
9135
|
+
if (!(this.initialDescriptor instanceof TableDynamicDescriptor)) {
|
|
9136
|
+
this.descriptor = this.initialDescriptor;
|
|
9137
|
+
}
|
|
7962
9138
|
// map row settings
|
|
7963
|
-
this.
|
|
7964
|
-
this.
|
|
9139
|
+
this.filterDescriptors = this.descriptor?.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor) ?? [];
|
|
9140
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
9141
|
+
this.rows = this.descriptor?.defaultNumRows ?? 25;
|
|
9142
|
+
this.rowsPerPageOptions = this.descriptor?.rowsPerPageOptions ?? [25, 50, 100];
|
|
7965
9143
|
// process actions
|
|
7966
9144
|
for (const action of this.actions) {
|
|
7967
9145
|
switch (action.position) {
|
|
@@ -7975,14 +9153,14 @@ class MngTableComponent {
|
|
|
7975
9153
|
}
|
|
7976
9154
|
this.showInlineActionsColumn = typeof this.columnActionComponent !== 'undefined' || this.rowInlineActions.length > 0;
|
|
7977
9155
|
// define all styles
|
|
7978
|
-
this.className = this.descriptor
|
|
7979
|
-
this.tableFullHeightOffset = this.descriptor
|
|
7980
|
-
this.rowHeight = this.descriptor
|
|
9156
|
+
this.className = this.descriptor?.className ?? '';
|
|
9157
|
+
this.tableFullHeightOffset = this.descriptor?.tableFullHeightOffset ?? null;
|
|
9158
|
+
this.rowHeight = this.descriptor?.rowHeight ?? null;
|
|
7981
9159
|
if (typeof this.isColumnClickable === 'undefined') {
|
|
7982
9160
|
// define if cell click is being observed via output
|
|
7983
9161
|
this.isColumnClickable = this.rowClickActions.length > 0 || this.cellClickEventEmitter.observed;
|
|
7984
9162
|
}
|
|
7985
|
-
switch (this.descriptor
|
|
9163
|
+
switch (this.descriptor?.size) {
|
|
7986
9164
|
case TableSizeEnum.Small:
|
|
7987
9165
|
this.className += ' p-datatable-sm';
|
|
7988
9166
|
break;
|
|
@@ -7990,14 +9168,14 @@ class MngTableComponent {
|
|
|
7990
9168
|
this.className += ' p-datatable-lg';
|
|
7991
9169
|
break;
|
|
7992
9170
|
}
|
|
7993
|
-
if (this.descriptor
|
|
9171
|
+
if (this.descriptor?.hasGridlines) {
|
|
7994
9172
|
this.className += ' p-datatable-gridlines';
|
|
7995
9173
|
}
|
|
7996
|
-
if (!this.columnActionMinWidth) {
|
|
9174
|
+
if (this.descriptor && !this.columnActionMinWidth) {
|
|
7997
9175
|
this.columnActionMinWidth = StylesUtil.calculateTableColumnActionWidth(this.descriptor, this.rowInlineActions);
|
|
7998
9176
|
}
|
|
7999
9177
|
// check if infinite scroll
|
|
8000
|
-
if (this.descriptor
|
|
9178
|
+
if (this.descriptor?.paginationMode === TablePaginationModeEnum.InfiniteScroll) {
|
|
8001
9179
|
this.infiniteScroll = true;
|
|
8002
9180
|
this.scrollHeight = 'flex';
|
|
8003
9181
|
this.tableFullHeightOffset = this.descriptor.tableFullHeightOffset ?? 315;
|
|
@@ -8019,6 +9197,12 @@ class MngTableComponent {
|
|
|
8019
9197
|
if (this.dataProvider.serviceType) {
|
|
8020
9198
|
this.dataProviderService = this.injector.get(this.dataProvider.serviceType);
|
|
8021
9199
|
}
|
|
9200
|
+
const reloadSubscription = this.dataProvider.getAllReload$.subscribe({
|
|
9201
|
+
next: () => {
|
|
9202
|
+
this.reload();
|
|
9203
|
+
}
|
|
9204
|
+
});
|
|
9205
|
+
this.subscriptions.push(reloadSubscription);
|
|
8022
9206
|
}
|
|
8023
9207
|
else {
|
|
8024
9208
|
// if query result is provided, use it as secondary source or else try to use items
|
|
@@ -8045,7 +9229,7 @@ class MngTableComponent {
|
|
|
8045
9229
|
}
|
|
8046
9230
|
const initialQueryParamMap = this.route.snapshot.queryParamMap;
|
|
8047
9231
|
if (this.useQueryParams &&
|
|
8048
|
-
((!initialQueryParamMap.has('sort') && this.descriptor
|
|
9232
|
+
((!initialQueryParamMap.has('sort') && this.descriptor?.hasDefaultSort) ||
|
|
8049
9233
|
(!initialQueryParamMap.has('filter') && this.filterDescriptors.some(fd => fd.hasDefaultValue)))) {
|
|
8050
9234
|
// default sort/filters are applied, no additional filtering/sorting is specified in query param
|
|
8051
9235
|
// redirect must be done at first step
|
|
@@ -8093,7 +9277,12 @@ class MngTableComponent {
|
|
|
8093
9277
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
8094
9278
|
}
|
|
8095
9279
|
reload(emitEvent = false, resetParams = false) {
|
|
8096
|
-
|
|
9280
|
+
const queryParamsBuilder = resetParams
|
|
9281
|
+
? MediusQueryParamBuilder.create(this.rowsPerPageOptions[0], 0)
|
|
9282
|
+
: MediusQueryParamBuilder.createFromExisting(this.dataProviderLatestQueryParam ?? new MediusQueryParam())
|
|
9283
|
+
.withItemsPerPage(this.rows)
|
|
9284
|
+
.withItemsOffset(this.offset);
|
|
9285
|
+
this.loadTableWithDataProvider(queryParamsBuilder.build(), emitEvent);
|
|
8097
9286
|
}
|
|
8098
9287
|
onTableLazyLoad(event) {
|
|
8099
9288
|
this.dataProviderLatestLazyLoadEvent = event;
|
|
@@ -8159,8 +9348,16 @@ class MngTableComponent {
|
|
|
8159
9348
|
}
|
|
8160
9349
|
this.dataProviderLatestQueryParam = queryParam;
|
|
8161
9350
|
this.dataProviderLatestQueryParamVersion++;
|
|
9351
|
+
MediusRestUtil.modifyFilterProperties(queryParam, this.filterDescriptors);
|
|
8162
9352
|
this.dataProviderSubscription = this.dataProvider?.getAll(queryParam, this.dataProviderService).subscribe({
|
|
8163
9353
|
next: res => {
|
|
9354
|
+
if (this.initialDescriptor instanceof TableDynamicDescriptor) {
|
|
9355
|
+
this.descriptor = this.initialDescriptor.toTableDescriptorFromData(res);
|
|
9356
|
+
this.filterDescriptors = this.descriptor.columns.filter(c => typeof c.filterDescriptor !== 'undefined').map(c => c.filterDescriptor);
|
|
9357
|
+
this.hasColumnFilters = this.filterDescriptors.length > 0;
|
|
9358
|
+
// } else {
|
|
9359
|
+
// this.descriptor = this.initialDescriptor.onDataReceivedTypeBuilding(res);
|
|
9360
|
+
}
|
|
8164
9361
|
if (this.infiniteScroll) {
|
|
8165
9362
|
if (this.isFilterChanged || this.isSortChanged) {
|
|
8166
9363
|
this.dataProviderInfiniteScrollItems = [];
|
|
@@ -8176,6 +9373,7 @@ class MngTableComponent {
|
|
|
8176
9373
|
this.dataProviderLoadingSubject.next(false);
|
|
8177
9374
|
},
|
|
8178
9375
|
error: err => {
|
|
9376
|
+
// TODO: check what happens on error with no model iniside descriptor
|
|
8179
9377
|
NotificationUtil.tableNotificationError(this.translate, this.descriptor, err, this.viewContainer);
|
|
8180
9378
|
const emptyQueryResult = new MediusQueryResult();
|
|
8181
9379
|
emptyQueryResult.pageData = [];
|
|
@@ -8219,7 +9417,7 @@ class MngTableComponent {
|
|
|
8219
9417
|
const applyDefaultFilters = (params.filterParams?.length ?? 0) === 0;
|
|
8220
9418
|
this.filterDescriptors.forEach(f => {
|
|
8221
9419
|
let matchMode;
|
|
8222
|
-
if (f.
|
|
9420
|
+
if (f.defaultFilterMatchMode) {
|
|
8223
9421
|
matchMode = f.defaultFilterMatchMode;
|
|
8224
9422
|
}
|
|
8225
9423
|
else {
|
|
@@ -8279,7 +9477,7 @@ class MngTableComponent {
|
|
|
8279
9477
|
}
|
|
8280
9478
|
let sortMeta;
|
|
8281
9479
|
const applyDefaultSorts = (params.sortProperty?.length ?? 0) === 0;
|
|
8282
|
-
if (applyDefaultSorts && this.descriptor
|
|
9480
|
+
if (applyDefaultSorts && this.descriptor?.hasDefaultSort) {
|
|
8283
9481
|
sortMeta = this.descriptor.defaultSortProperty.map((p, idx) => ({
|
|
8284
9482
|
field: p,
|
|
8285
9483
|
order: this.descriptor.defaultSortAsc[idx] ? 1 : -1
|
|
@@ -8324,14 +9522,15 @@ class MngTableComponent {
|
|
|
8324
9522
|
}
|
|
8325
9523
|
}
|
|
8326
9524
|
MngTableComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableComponent, deps: [{ token: i0.Injector }, { token: i1.Router }, { token: i1.ActivatedRoute }, { token: i1$2.TranslateService }, { token: MngActionExecutorService }, { token: MngViewContainerComponentService, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
|
8327
|
-
MngTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableComponent, selector: "mng-table", inputs: { descriptor: "descriptor", items: "items", queryResult: "queryResult", loading: "loading", dataProvider: "dataProvider", useQueryParams: "useQueryParams", selectionMode: "selectionMode", selectionEnabled: "selectionEnabled", actions: "actions", isColumnClickable: "isColumnClickable", viewContainerInit: ["viewContainer", "viewContainerInit"], captionComponent: "captionComponent", columnActionComponent: "columnActionComponent", columnActionMinWidth: "columnActionMinWidth" }, outputs: { loadEventEmitter: "tableLoad", cellClickEventEmitter: "cellClick", selectionChangeEventEmitter: "selectionChange", captionCmpInstEventEmitter: "captionComponentInstance", columnActionCmpInstEventEmitter: "columnActionComponentInstance" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "primeTable", first: true, predicate: Table, descendants: true }, { propertyName: "components", predicate: MngComponentDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.height]=\"scrollHeight === 'flex' ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"$any(descriptor.dataKeyProperty)\"\n [lazy]=\"useDataProvider\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"useDataProvider && !infiniteScroll\"\n [rows]=\"$any(infiniteScroll ? 20 : rows)\"\n [first]=\"$any(infiniteScroll ? 0 : offset)\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"$any(infiniteScroll ? null : rowsPerPageOptions)\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"$any(multiSortMeta)\"\n [filters]=\"filterMetadata\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [scrollable]=\"infiniteScroll\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualRowHeight]=\"$any(rowHeight)\"\n [scrollHeight]=\"$any(scrollHeight)\"\n [selectionMode]=\"$any(selectionEnabled ? selectionMode : null)\"\n [rowHover]=\"descriptor.hasHover\"\n [styleClass]=\"className\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\"\n sortMode=\"multiple\"\n responsiveLayout=\"scroll\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor.hideHeader\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <ng-container *ngFor=\"let col of descriptor.columns\">\n <th *ngIf=\"col.isSortEnabled\" [pSortableColumn]=\"col.property\" [class]=\"col.headerClassName\" [style.width.%]=\"col.width\" [style.min-width.px]=\"col.minWidth\">\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.title ?? (col.property | i18nProperty: descriptor.model) | translate }}\n <p-sortIcon [field]=\"col.property\"></p-sortIcon>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"!col.isSortEnabled\">\n {{ col.title ?? (col.property | i18nProperty: descriptor.model) | translate }}\n <ng-container>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </ng-container>\n </th>\n </ng-container>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n <tr *ngIf=\"descriptor.filterDisplay === filterDisplayRow\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <th\n *ngFor=\"let col of descriptor.columns\"\n [class]=\"(col.filterDescriptor ? 'mng-column-filter-' + col.filterDescriptor.filterType + ' ' : ' ') + col.filterDescriptor?.columnClassName\"\n [style.width.%]=\"col.filterDescriptor?.columnWidth ?? col.width\"\n [style.min-width.px]=\"col.filterDescriptor?.columnMinWidth ?? col.minWidth\">\n <div class=\"flex\" *ngIf=\"col.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor.filterDisplay\" [descriptor]=\"col.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr [style.height.px]=\"rowHeight\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"width: 3rem\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"width: 3rem\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <td\n *ngFor=\"let col of descriptor.columns\"\n (click)=\"onCellClick($event, col, item, idx)\"\n [class]=\"col.className\"\n [class.clickable]=\"isColumnClickable\"\n [style.width.%]=\"col.width\"\n [style.min-width.px]=\"col.minWidth\">\n <mng-table-column-value [descriptor]=\"col\" [item]=\"item\"></mng-table-column-value>\n </td>\n <td *ngIf=\"showInlineActionsColumn\" class=\"column-action text-right\" [style.min-width.px]=\"columnActionMinWidth\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [itemId]=\"descriptor.model.idPropertyName ? item[descriptor.model.idPropertyName] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"descriptor.columns.length + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"descriptor.columns.length + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$4.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i6$4.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i6$4.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i6$4.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i6$4.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i6$4.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i7$3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs"], outputs: ["instanceCreated"] }, { kind: "component", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "component", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor", "display"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: MngI18nPropertyPipe, name: "i18nProperty" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
9525
|
+
MngTableComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableComponent, selector: "mng-table", inputs: { initialDescriptor: ["descriptor", "initialDescriptor"], items: "items", queryResult: "queryResult", loading: "loading", dataProvider: "dataProvider", useQueryParams: "useQueryParams", selectionMode: "selectionMode", selectionEnabled: "selectionEnabled", actions: "actions", isColumnClickable: "isColumnClickable", viewContainerInit: ["viewContainer", "viewContainerInit"], captionComponent: "captionComponent", columnActionComponent: "columnActionComponent", columnActionMinWidth: "columnActionMinWidth" }, outputs: { loadEventEmitter: "tableLoad", cellClickEventEmitter: "cellClick", selectionChangeEventEmitter: "selectionChange", captionCmpInstEventEmitter: "captionComponentInstance", columnActionCmpInstEventEmitter: "columnActionComponentInstance" }, queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], viewQueries: [{ propertyName: "primeTable", first: true, predicate: Table, descendants: true }, { propertyName: "components", predicate: MngComponentDirective, descendants: true }], usesOnChanges: true, ngImport: i0, template: "<div [style.height]=\"scrollHeight === 'flex' ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"$any(descriptor?.dataKeyProperty ?? null)\"\n [lazy]=\"useDataProvider\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"useDataProvider && !infiniteScroll\"\n [rows]=\"$any(infiniteScroll ? 20 : rows)\"\n [first]=\"$any(infiniteScroll ? 0 : offset)\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"$any(infiniteScroll ? null : rowsPerPageOptions)\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"$any(multiSortMeta)\"\n [filters]=\"filterMetadata\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [scrollable]=\"infiniteScroll\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualRowHeight]=\"$any(rowHeight)\"\n [scrollHeight]=\"$any(scrollHeight)\"\n [selectionMode]=\"$any(selectionEnabled ? selectionMode : null)\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\"\n sortMode=\"multiple\"\n responsiveLayout=\"scroll\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor?.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor?.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor?.hideHeader\" class=\"mng-table-header\" [class]=\"descriptor?.headerClassName\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <ng-container *ngFor=\"let col of descriptor?.columns\">\n <th *ngIf=\"col.isSortEnabled\" [pSortableColumn]=\"col.property\" [style.width.%]=\"col.width\" [style.min-width.px]=\"col.minWidth\" [class]=\"col.headerClassName\">\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.property\"></p-sortIcon>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"!col.isSortEnabled\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <ng-container>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </ng-container>\n </th>\n </ng-container>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n <tr *ngIf=\"descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <th\n *ngFor=\"let col of descriptor?.columns\"\n [class]=\"(col.filterDescriptor ? 'mng-column-filter-' + col.filterDescriptor.filterType + ' ' : ' ') + col.filterDescriptor?.columnClassName\"\n [style.width.%]=\"col.filterDescriptor?.columnWidth ?? col.width\"\n [style.min-width.px]=\"col.filterDescriptor?.columnMinWidth ?? col.minWidth\">\n <div class=\"flex\" *ngIf=\"col.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr [style.height.px]=\"rowHeight\" [class]=\"descriptor?.rowClassName | mngClassMapPipe: descriptor?.rowClassNameMapFn:item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"width: 3rem\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"width: 3rem\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <td\n *ngFor=\"let col of descriptor?.columns\"\n (click)=\"onCellClick($event, col, item, idx)\"\n [class]=\"col.className\"\n [class.clickable]=\"isColumnClickable\"\n [style.width.%]=\"col.width\"\n [style.min-width.px]=\"col.minWidth\">\n <mng-table-column-value [descriptor]=\"col\" [item]=\"item\"></mng-table-column-value>\n </td>\n <td *ngIf=\"showInlineActionsColumn\" class=\"column-action text-right\" [style.min-width.px]=\"columnActionMinWidth\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [itemId]=\"descriptor?.model?.idPropertyName ? item[descriptor!.model!.idPropertyName!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i1$1.NgStyle, selector: "[ngStyle]", inputs: ["ngStyle"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i6$4.Table, selector: "p-table", inputs: ["frozenColumns", "frozenValue", "style", "styleClass", "tableStyle", "tableStyleClass", "paginator", "pageLinks", "rowsPerPageOptions", "alwaysShowPaginator", "paginatorPosition", "paginatorDropdownAppendTo", "paginatorDropdownScrollHeight", "currentPageReportTemplate", "showCurrentPageReport", "showJumpToPageDropdown", "showJumpToPageInput", "showFirstLastIcon", "showPageLinks", "defaultSortOrder", "sortMode", "resetPageOnSort", "selectionMode", "selectionPageOnly", "contextMenuSelection", "contextMenuSelectionMode", "dataKey", "metaKeySelection", "rowSelectable", "rowTrackBy", "lazy", "lazyLoadOnInit", "compareSelectionBy", "csvSeparator", "exportFilename", "filters", "globalFilterFields", "filterDelay", "filterLocale", "expandedRowKeys", "editingRowKeys", "rowExpandMode", "scrollable", "scrollDirection", "rowGroupMode", "scrollHeight", "virtualScroll", "virtualScrollItemSize", "virtualScrollOptions", "virtualScrollDelay", "frozenWidth", "responsive", "contextMenu", "resizableColumns", "columnResizeMode", "reorderableColumns", "loading", "loadingIcon", "showLoader", "rowHover", "customSort", "showInitialSortBadge", "autoLayout", "exportFunction", "exportHeader", "stateKey", "stateStorage", "editMode", "groupRowsBy", "groupRowsByOrder", "responsiveLayout", "breakpoint", "virtualRowHeight", "value", "columns", "first", "rows", "totalRecords", "sortField", "sortOrder", "multiSortMeta", "selection", "selectAll"], outputs: ["selectAllChange", "selectionChange", "contextMenuSelectionChange", "onRowSelect", "onRowUnselect", "onPage", "onSort", "onFilter", "onLazyLoad", "onRowExpand", "onRowCollapse", "onContextMenuSelect", "onColResize", "onColReorder", "onRowReorder", "onEditInit", "onEditComplete", "onEditCancel", "onHeaderCheckboxToggle", "sortFunction", "firstChange", "rowsChange", "onStateSave", "onStateRestore"] }, { kind: "directive", type: i6$4.SortableColumn, selector: "[pSortableColumn]", inputs: ["pSortableColumn", "pSortableColumnDisabled"] }, { kind: "component", type: i6$4.SortIcon, selector: "p-sortIcon", inputs: ["field"] }, { kind: "component", type: i6$4.TableRadioButton, selector: "p-tableRadioButton", inputs: ["disabled", "value", "index", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i6$4.TableCheckbox, selector: "p-tableCheckbox", inputs: ["disabled", "value", "index", "inputId", "name", "required", "ariaLabel"] }, { kind: "component", type: i6$4.TableHeaderCheckbox, selector: "p-tableHeaderCheckbox", inputs: ["disabled", "inputId", "name", "ariaLabel"] }, { kind: "component", type: i7$3.Skeleton, selector: "p-skeleton", inputs: ["styleClass", "style", "shape", "animation", "borderRadius", "size", "width", "height"] }, { kind: "directive", type: MngComponentDirective, selector: "[mngComponent]", inputs: ["mngComponent", "inputs"], outputs: ["instanceCreated"] }, { kind: "component", type: MngTableColumnValueComponent, selector: "mng-table-column-value", inputs: ["descriptor", "item"] }, { kind: "component", type: MngTableColumnFilterComponent, selector: "mng-table-column-filter", inputs: ["descriptor", "display"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$1.AsyncPipe, name: "async" }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }, { kind: "pipe", type: MngI18nPropertyPipe, name: "i18nProperty" }, { kind: "pipe", type: MngClassMapPipe, name: "mngClassMapPipe" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8328
9526
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableComponent, decorators: [{
|
|
8329
9527
|
type: Component,
|
|
8330
|
-
args: [{ selector: 'mng-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"scrollHeight === 'flex' ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"$any(descriptor
|
|
9528
|
+
args: [{ selector: 'mng-table', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [style.height]=\"scrollHeight === 'flex' ? 'calc(100vh - ' + tableFullHeightOffset + 'px)' : null\">\n <!-- MUST NOT use observable for value when using virtual scroll - does not work for some reason -->\n <p-table\n *ngIf=\"!useQueryParams || (useQueryParamsInitialized$ | async)\"\n [value]=\"infiniteScroll ? dataProviderInfiniteScrollItems : (queryResult$ | async)?.pageData ?? []\"\n [dataKey]=\"$any(descriptor?.dataKeyProperty ?? null)\"\n [lazy]=\"useDataProvider\"\n [loading]=\"(loading$ | async) ?? false\"\n [paginator]=\"useDataProvider && !infiniteScroll\"\n [rows]=\"$any(infiniteScroll ? 20 : rows)\"\n [first]=\"$any(infiniteScroll ? 0 : offset)\"\n [totalRecords]=\"$any(infiniteScroll ? null : (queryResult$ | async)?.allDataCount ?? 0)\"\n [rowsPerPageOptions]=\"$any(infiniteScroll ? null : rowsPerPageOptions)\"\n [showCurrentPageReport]=\"!infiniteScroll\"\n [currentPageReportTemplate]=\"'mngTable.paginationMsg' | translate\"\n [multiSortMeta]=\"$any(multiSortMeta)\"\n [filters]=\"filterMetadata\"\n [(selection)]=\"selection\"\n (selectionChange)=\"onSelectionChange($event)\"\n [scrollable]=\"infiniteScroll\"\n [virtualScroll]=\"infiniteScroll\"\n [virtualRowHeight]=\"$any(rowHeight)\"\n [scrollHeight]=\"$any(scrollHeight)\"\n [selectionMode]=\"$any(selectionEnabled ? selectionMode : null)\"\n [rowHover]=\"descriptor?.hasHover ?? true\"\n [styleClass]=\"className\"\n (onLazyLoad)=\"onTableLazyLoad($event)\"\n (onSort)=\"onTableSort($event)\"\n (onFilter)=\"onTableFilter($event)\"\n sortMode=\"multiple\"\n responsiveLayout=\"scroll\"\n [resizableColumns]=\"true\"\n [autoLayout]=\"true\">\n <ng-template *ngIf=\"captionTemplate || captionComponent || descriptor?.title\" pTemplate=\"caption\">\n <ng-container *ngIf=\"captionTemplate; else componentOrDefaultCaption\">\n <ng-container *ngTemplateOutlet=\"captionTemplate\"></ng-container>\n </ng-container>\n <ng-template #componentOrDefaultCaption>\n <div *ngIf=\"captionComponent; else defaultCaption\" [mngComponent]=\"captionComponent\" (instanceCreated)=\"onCaptionCmpInst($event)\"></div>\n <ng-template #defaultCaption>\n <h5 class=\"p-0 m-0\">{{ descriptor?.title }}</h5>\n </ng-template>\n </ng-template>\n </ng-template>\n\n <ng-template pTemplate=\"header\">\n <tr *ngIf=\"!descriptor?.hideHeader\" class=\"mng-table-header\" [class]=\"descriptor?.headerClassName\">\n <th *ngIf=\"selectionEnabled && selectionMode === 'multiple'\">\n <p-tableHeaderCheckbox></p-tableHeaderCheckbox>\n </th>\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <ng-container *ngFor=\"let col of descriptor?.columns\">\n <th *ngIf=\"col.isSortEnabled\" [pSortableColumn]=\"col.property\" [style.width.%]=\"col.width\" [style.min-width.px]=\"col.minWidth\" [class]=\"col.headerClassName\">\n <div class=\"flex justify-content-between align-items-center\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <p-sortIcon [field]=\"col.property\"></p-sortIcon>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"!col.isSortEnabled\">\n {{ col.title ?? (col.property | i18nProperty: descriptor!.model) | translate }}\n <ng-container>\n <mng-table-column-filter\n *ngIf=\"col.filterDescriptor && descriptor!.filterDisplay === filterDisplayMenu\"\n class=\"ml-auto\"\n [display]=\"descriptor!.filterDisplay\"\n [descriptor]=\"col.filterDescriptor\">\n </mng-table-column-filter>\n </ng-container>\n </th>\n </ng-container>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n <tr *ngIf=\"descriptor?.filterDisplay === filterDisplayRow && hasColumnFilters\" class=\"mng-column-filter-row\">\n <!-- We need the line below, because otherwise p-tableRadioButton shifts the rest of the columns in table -->\n <th *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"min-width: 36px\"></th>\n <th\n *ngFor=\"let col of descriptor?.columns\"\n [class]=\"(col.filterDescriptor ? 'mng-column-filter-' + col.filterDescriptor.filterType + ' ' : ' ') + col.filterDescriptor?.columnClassName\"\n [style.width.%]=\"col.filterDescriptor?.columnWidth ?? col.width\"\n [style.min-width.px]=\"col.filterDescriptor?.columnMinWidth ?? col.minWidth\">\n <div class=\"flex\" *ngIf=\"col.filterDescriptor\">\n <mng-table-column-filter [display]=\"descriptor!.filterDisplay\" [descriptor]=\"col.filterDescriptor\"></mng-table-column-filter>\n </div>\n </th>\n <th *ngIf=\"showInlineActionsColumn\"></th>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"body\" let-item let-idx=\"rowIndex\">\n <tr [style.height.px]=\"rowHeight\" [class]=\"descriptor?.rowClassName | mngClassMapPipe: descriptor?.rowClassNameMapFn:item\">\n <td *ngIf=\"selectionEnabled && selectionMode === 'multiple'\" style=\"width: 3rem\">\n <p-tableCheckbox [value]=\"item\"></p-tableCheckbox>\n </td>\n <td *ngIf=\"selectionEnabled && selectionMode === 'single'\" style=\"width: 3rem\">\n <p-tableRadioButton [value]=\"item\"></p-tableRadioButton>\n </td>\n <td\n *ngFor=\"let col of descriptor?.columns\"\n (click)=\"onCellClick($event, col, item, idx)\"\n [class]=\"col.className\"\n [class.clickable]=\"isColumnClickable\"\n [style.width.%]=\"col.width\"\n [style.min-width.px]=\"col.minWidth\">\n <mng-table-column-value [descriptor]=\"col\" [item]=\"item\"></mng-table-column-value>\n </td>\n <td *ngIf=\"showInlineActionsColumn\" class=\"column-action text-right\" [style.min-width.px]=\"columnActionMinWidth\">\n <ng-container *ngIf=\"columnActionTemplate; else showColumnActionComponentOrDefault\">\n <ng-container *ngTemplateOutlet=\"columnActionTemplate; context: {rowItem: item, rowIndex: idx}\"></ng-container>\n </ng-container>\n <ng-template #showColumnActionComponentOrDefault>\n <span\n *ngIf=\"columnActionComponent; else defaultColumnActions\"\n [mngComponent]=\"columnActionComponent!\"\n (instanceCreated)=\"onColumnActionCmpInst($event)\"></span>\n </ng-template>\n <ng-template #defaultColumnActions>\n <mng-action\n *ngFor=\"let action of rowInlineActions\"\n [action]=\"action\"\n [item]=\"item\"\n [itemId]=\"descriptor?.model?.idPropertyName ? item[descriptor!.model!.idPropertyName!] : null\"\n [actionData]=\"{itemIndex: idx}\"\n (finish)=\"onActionFinish($event)\">\n </mng-action>\n </ng-template>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"loadingbody\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n <div class=\"loading-text\"></div>\n <p-skeleton [ngStyle]=\"{width: '100%'}\"></p-skeleton>\n </td>\n </tr>\n </ng-template>\n\n <ng-template pTemplate=\"emptymessage\">\n <tr [style.height.px]=\"rowHeight\">\n <td [attr.colspan]=\"(descriptor?.columns?.length ?? 0) + (showInlineActionsColumn ? 1 : 0) + (selectionEnabled ? 1 : 0)\">\n {{ 'mngTable.noItems' | translate }}\n </td>\n </tr>\n </ng-template>\n </p-table>\n</div>\n" }]
|
|
8331
9529
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1.Router }, { type: i1.ActivatedRoute }, { type: i1$2.TranslateService }, { type: MngActionExecutorService }, { type: MngViewContainerComponentService, decorators: [{
|
|
8332
9530
|
type: Optional
|
|
8333
|
-
}] }]; }, propDecorators: {
|
|
8334
|
-
type: Input
|
|
9531
|
+
}] }]; }, propDecorators: { initialDescriptor: [{
|
|
9532
|
+
type: Input,
|
|
9533
|
+
args: ['descriptor']
|
|
8335
9534
|
}], items: [{
|
|
8336
9535
|
type: Input
|
|
8337
9536
|
}], queryResult: [{
|
|
@@ -8400,6 +9599,8 @@ class MngTableviewComponent {
|
|
|
8400
9599
|
this.toolbarLeftActions = [];
|
|
8401
9600
|
this.toolbarRightActions = [];
|
|
8402
9601
|
this.subscriptions = [];
|
|
9602
|
+
this.hasItemSelectionAction = false;
|
|
9603
|
+
this.selectedItems = [];
|
|
8403
9604
|
}
|
|
8404
9605
|
ngOnInit() {
|
|
8405
9606
|
this.viewContainerService.actions = this.actions;
|
|
@@ -8427,6 +9628,7 @@ class MngTableviewComponent {
|
|
|
8427
9628
|
}
|
|
8428
9629
|
}
|
|
8429
9630
|
this.toolbarRightActions = this.toolbarRightActions.reverse();
|
|
9631
|
+
this.hasItemSelectionAction = [...this.toolbarLeftActions, ...this.toolbarRightActions].some(e => e.hasItemsSelection);
|
|
8430
9632
|
}
|
|
8431
9633
|
ngOnDestroy() {
|
|
8432
9634
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
@@ -8443,12 +9645,15 @@ class MngTableviewComponent {
|
|
|
8443
9645
|
onTableLoad(event) {
|
|
8444
9646
|
this.tableQueryParam = event.queryParam;
|
|
8445
9647
|
}
|
|
9648
|
+
selectionChange(selectedItems) {
|
|
9649
|
+
this.selectedItems = selectedItems;
|
|
9650
|
+
}
|
|
8446
9651
|
}
|
|
8447
9652
|
MngTableviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewComponent, deps: [{ token: i1.ActivatedRoute }, { token: i2.MessageService }, { token: i1$2.TranslateService }, { token: i3.DialogService }, { token: i2.ConfirmationService }, { token: MngActionExecutorService }, { token: MngViewContainerComponentService }], target: i0.ɵɵFactoryTarget.Component });
|
|
8448
|
-
MngTableviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableviewComponent, selector: "mng-tableview", inputs: { descriptor: "descriptor", dataProvider: "dataProvider", actions: "actions" }, providers: [MessageService, ConfirmationService, MngViewContainerComponentService], viewQueries: [{ propertyName: "tableComponent", first: true, predicate: MngTableComponent, descendants: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\"
|
|
9653
|
+
MngTableviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableviewComponent, selector: "mng-tableview", inputs: { descriptor: "descriptor", dataProvider: "dataProvider", actions: "actions" }, providers: [MessageService, ConfirmationService, MngViewContainerComponentService], viewQueries: [{ propertyName: "tableComponent", first: true, predicate: MngTableComponent, descendants: true }], ngImport: i0, template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table\n [descriptor]=\"descriptor.table\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"true\"\n [actions]=\"actions\"\n [selectionEnabled]=\"hasItemSelectionAction\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor.tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n", dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.RouterOutlet, selector: "router-outlet", outputs: ["activate", "deactivate", "attach", "detach"], exportAs: ["outlet"] }, { kind: "directive", type: i2.PrimeTemplate, selector: "[pTemplate]", inputs: ["type", "pTemplate"] }, { kind: "component", type: i7$4.Toast, selector: "p-toast", inputs: ["key", "autoZIndex", "baseZIndex", "style", "styleClass", "position", "preventOpenDuplicates", "preventDuplicates", "showTransformOptions", "hideTransformOptions", "showTransitionOptions", "hideTransitionOptions", "breakpoints"], outputs: ["onClose"] }, { kind: "component", type: i6$2.Toolbar, selector: "p-toolbar", inputs: ["style", "styleClass"] }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }] });
|
|
8449
9654
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewComponent, decorators: [{
|
|
8450
9655
|
type: Component,
|
|
8451
|
-
args: [{ selector: 'mng-tableview', providers: [MessageService, ConfirmationService, MngViewContainerComponentService], template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\"
|
|
9656
|
+
args: [{ selector: 'mng-tableview', providers: [MessageService, ConfirmationService, MngViewContainerComponentService], template: "<div class=\"mng-tableview\">\n <p-toast></p-toast>\n\n <div class=\"card\">\n <p-toolbar styleClass=\"mb-4\" *ngIf=\"toolbarLeftActions.length > 0 || toolbarRightActions.length > 0\">\n <ng-template pTemplate=\"left\">\n <mng-action *ngFor=\"let action of toolbarLeftActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n\n <ng-template pTemplate=\"right\">\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\" [queryParam]=\"tableQueryParam\" [selectedItems]=\"selectedItems\"></mng-action>\n </ng-template>\n </p-toolbar>\n\n <mng-table\n [descriptor]=\"descriptor.table\"\n [dataProvider]=\"dataProvider\"\n [useQueryParams]=\"true\"\n [actions]=\"actions\"\n [selectionEnabled]=\"hasItemSelectionAction\"\n [selectionMode]=\"'multiple'\"\n (tableLoad)=\"onTableLoad($event)\"\n (selectionChange)=\"selectionChange($event)\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-between table-header\">\n <h5 class=\"p-0 m-0\">{{ descriptor.tableTitle ?? '' | translate }}</h5>\n </div>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n" }]
|
|
8452
9657
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i2.MessageService }, { type: i1$2.TranslateService }, { type: i3.DialogService }, { type: i2.ConfirmationService }, { type: MngActionExecutorService }, { type: MngViewContainerComponentService }]; }, propDecorators: { descriptor: [{
|
|
8453
9658
|
type: Input
|
|
8454
9659
|
}], dataProvider: [{
|
|
@@ -8461,37 +9666,44 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
8461
9666
|
}] } });
|
|
8462
9667
|
|
|
8463
9668
|
class AMngTableviewRouteComponent {
|
|
9669
|
+
constructor() {
|
|
9670
|
+
this.route = inject(ActivatedRoute);
|
|
9671
|
+
}
|
|
9672
|
+
get routeData() {
|
|
9673
|
+
return this.route.snapshot.data;
|
|
9674
|
+
}
|
|
8464
9675
|
ngOnInit() {
|
|
8465
9676
|
this.descriptor = this.createTableviewDescriptor();
|
|
8466
9677
|
this.dataProvider = this.createTableviewDataProvider();
|
|
8467
9678
|
this.actions = this.createActionDescriptors();
|
|
8468
9679
|
}
|
|
8469
9680
|
createActionDescriptors() {
|
|
8470
|
-
|
|
8471
|
-
|
|
8472
|
-
|
|
8473
|
-
|
|
8474
|
-
|
|
8475
|
-
|
|
8476
|
-
|
|
9681
|
+
return [
|
|
9682
|
+
this.createActionDescriptorForDetails(),
|
|
9683
|
+
this.createActionDescriptorForAdd(),
|
|
9684
|
+
this.createActionDescriptorForEdit(),
|
|
9685
|
+
this.createActionDescriptorForDelete(),
|
|
9686
|
+
this.createActionDescriptorForRefresh(),
|
|
9687
|
+
this.createActionDescriptorForExport()
|
|
9688
|
+
].filter(e => e != null);
|
|
8477
9689
|
}
|
|
8478
9690
|
createActionDescriptorForDetails(descriptor = this.descriptor.viewEditor) {
|
|
8479
|
-
return new ActionEditorDetailsDescriptor(descriptor);
|
|
9691
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDetails ? new ActionEditorDetailsDescriptor(descriptor) : null;
|
|
8480
9692
|
}
|
|
8481
9693
|
createActionDescriptorForAdd(descriptor = this.descriptor.addEditor) {
|
|
8482
|
-
return new ActionEditorAddDescriptor(descriptor);
|
|
9694
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasAdd ? new ActionEditorAddDescriptor(descriptor) : null;
|
|
8483
9695
|
}
|
|
8484
9696
|
createActionDescriptorForEdit(descriptor = this.descriptor.editEditor) {
|
|
8485
|
-
return new ActionEditorEditDescriptor(descriptor);
|
|
9697
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasEdit ? new ActionEditorEditDescriptor(descriptor) : null;
|
|
8486
9698
|
}
|
|
8487
9699
|
createActionDescriptorForDelete(descriptor = this.descriptor.model) {
|
|
8488
|
-
return new ActionDeleteDescriptor(descriptor);
|
|
9700
|
+
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDelete ? new ActionDeleteDescriptor(descriptor) : null;
|
|
8489
9701
|
}
|
|
8490
9702
|
createActionDescriptorForExport(descriptor = this.descriptor.model) {
|
|
8491
|
-
|
|
9703
|
+
const action = new ActionDescriptor(descriptor, 'export')
|
|
8492
9704
|
.withRunFunction(ctx => {
|
|
8493
9705
|
const queryParamBuilder = ctx.parameters.queryParam ? MediusQueryParamBuilder.createFromExisting(ctx.parameters.queryParam) : MediusQueryParamBuilder.create();
|
|
8494
|
-
queryParamBuilder.withItemsOffset(0).withItemsPerPage(
|
|
9706
|
+
queryParamBuilder.withItemsOffset(0).withItemsPerPage(500);
|
|
8495
9707
|
ctx.parameters.withQueryParam(queryParamBuilder.build());
|
|
8496
9708
|
return ActionDataProviderUtil.runGetAllOrFail(ctx).pipe(map(res => {
|
|
8497
9709
|
const blob = new Blob([JSON.stringify(res.pageData, undefined, 4)], { type: 'application/json;charset=utf-8' });
|
|
@@ -8500,24 +9712,30 @@ class AMngTableviewRouteComponent {
|
|
|
8500
9712
|
return undefined;
|
|
8501
9713
|
}));
|
|
8502
9714
|
})
|
|
9715
|
+
.withPosition(ActionPositionEnum.ToolbarRight);
|
|
9716
|
+
action.buttonDescriptor.withIcon('pi pi-upload');
|
|
9717
|
+
return action;
|
|
9718
|
+
}
|
|
9719
|
+
createActionDescriptorForRefresh(descriptor = this.descriptor.model) {
|
|
9720
|
+
const action = new ActionDescriptor(descriptor, 'refresh')
|
|
8503
9721
|
.withPosition(ActionPositionEnum.ToolbarRight)
|
|
8504
|
-
.
|
|
9722
|
+
.withPermissionsRouteType(Permissions.ActionTypes.READ)
|
|
9723
|
+
.withRunNotificationSuccess(undefined, undefined, false)
|
|
9724
|
+
.withRunFunction((ctx) => {
|
|
9725
|
+
ctx.parameters.viewContainer.triggerTableReload({});
|
|
9726
|
+
return of(null);
|
|
9727
|
+
});
|
|
9728
|
+
action.buttonDescriptor.withIcon('pi pi-refresh').styleClass.withActionLevel(ActionLevelEnum.Secondary);
|
|
9729
|
+
return action;
|
|
8505
9730
|
}
|
|
8506
9731
|
}
|
|
8507
9732
|
AMngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: AMngTableviewRouteComponent, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
8508
9733
|
AMngTableviewRouteComponent.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.1.0", type: AMngTableviewRouteComponent, ngImport: i0 });
|
|
8509
9734
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: AMngTableviewRouteComponent, decorators: [{
|
|
8510
9735
|
type: Directive
|
|
8511
|
-
}] });
|
|
9736
|
+
}], ctorParameters: function () { return []; } });
|
|
8512
9737
|
|
|
8513
9738
|
class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
8514
|
-
constructor(route) {
|
|
8515
|
-
super();
|
|
8516
|
-
this.route = route;
|
|
8517
|
-
}
|
|
8518
|
-
get routeData() {
|
|
8519
|
-
return this.route.snapshot.data;
|
|
8520
|
-
}
|
|
8521
9739
|
createTableviewDescriptor() {
|
|
8522
9740
|
if (this.descriptorInit) {
|
|
8523
9741
|
return this.descriptorInit;
|
|
@@ -8546,12 +9764,12 @@ class MngTableviewRouteComponent extends AMngTableviewRouteComponent {
|
|
|
8546
9764
|
this.tableviewComponent?.reloadTable();
|
|
8547
9765
|
}
|
|
8548
9766
|
}
|
|
8549
|
-
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, deps:
|
|
9767
|
+
MngTableviewRouteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
8550
9768
|
MngTableviewRouteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngTableviewRouteComponent, selector: "mng-tableview-route", inputs: { descriptorInit: ["descriptor", "descriptorInit"], dataProviderInit: ["dataProvider", "dataProviderInit"], actionsInit: ["actions", "actionsInit"] }, viewQueries: [{ propertyName: "tableviewComponent", first: true, predicate: MngTableviewComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"grid\">\n <div class=\"col-12\">\n <mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: MngTableviewComponent, selector: "mng-tableview", inputs: ["descriptor", "dataProvider", "actions"] }] });
|
|
8551
9769
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewRouteComponent, decorators: [{
|
|
8552
9770
|
type: Component,
|
|
8553
9771
|
args: [{ selector: 'mng-tableview-route', template: "<div class=\"grid\">\n <div class=\"col-12\">\n <mng-tableview [descriptor]=\"descriptor\" [dataProvider]=\"dataProvider\" [actions]=\"actions\"></mng-tableview>\n </div>\n</div>\n" }]
|
|
8554
|
-
}],
|
|
9772
|
+
}], propDecorators: { descriptorInit: [{
|
|
8555
9773
|
type: Input,
|
|
8556
9774
|
args: ['descriptor']
|
|
8557
9775
|
}], dataProviderInit: [{
|
|
@@ -8746,20 +9964,18 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
8746
9964
|
if (hasViewAction) {
|
|
8747
9965
|
const viewAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.viewEditor, 'details', this.descriptor.editor.model.type, this.descriptor.property)
|
|
8748
9966
|
.withPosition(ActionPositionEnum.RowClick)
|
|
8749
|
-
.withTitle(null)
|
|
8750
9967
|
.withDialogClassName('mng-field-dialog mng-action-editor-dialog')
|
|
8751
9968
|
.withDialogSize(ActionEditorDialogSizeEnum.Small);
|
|
8752
9969
|
viewAction.withEditorActions([new ActionEditorSubmitDescriptor(viewAction, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
9970
|
+
viewAction.buttonDescriptor.withLabel(null);
|
|
8753
9971
|
this.actions.push(viewAction);
|
|
8754
9972
|
}
|
|
8755
9973
|
if (hasAddAction) {
|
|
8756
9974
|
const addAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.addEditor, 'add', this.descriptor.editor.model.type, this.descriptor.property)
|
|
8757
9975
|
.withPosition(ActionPositionEnum.ToolbarRight)
|
|
8758
|
-
.withTitle(null)
|
|
8759
|
-
.withIcon('pi pi-plus')
|
|
8760
9976
|
.withDialogClassName('mng-field-dialog mng-action-editor-dialog')
|
|
8761
9977
|
.withDialogSize(ActionEditorDialogSizeEnum.Small)
|
|
8762
|
-
.withSize(ActionSizeEnum.ExtraSmall)
|
|
9978
|
+
.withButtonDescriptor(new ButtonDescriptor().withStyleClass(new ButtonStyleBuilder().withSize(ActionSizeEnum.ExtraSmall)))
|
|
8763
9979
|
.withSubmitFunction(ctx => {
|
|
8764
9980
|
if (!ctx.parameters.item) {
|
|
8765
9981
|
return throwError(() => new Error(`No item was provided in context, edit cannot be done.`));
|
|
@@ -8772,16 +9988,15 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
8772
9988
|
})
|
|
8773
9989
|
.withIsVisibleFunction(() => of(!this.options?.formState.disabled))
|
|
8774
9990
|
.withIsEnabledFunction(() => this.isEnabled$);
|
|
9991
|
+
addAction.buttonDescriptor.withLabel(null).withIcon('pi pi-plus');
|
|
8775
9992
|
this.actions.push(addAction);
|
|
8776
9993
|
}
|
|
8777
9994
|
if (hasEditAction) {
|
|
8778
9995
|
const editAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.editEditor, 'edit', this.descriptor.editor.model.type, this.descriptor.property)
|
|
8779
9996
|
.withPosition(ActionPositionEnum.RowInline)
|
|
8780
|
-
.withTitle(null)
|
|
8781
|
-
.withIcon('pi pi-pencil')
|
|
8782
9997
|
.withDialogClassName('mng-field-dialog mng-action-editor-dialog')
|
|
8783
9998
|
.withDialogSize(ActionEditorDialogSizeEnum.Small)
|
|
8784
|
-
.withSize(ActionSizeEnum.ExtraSmall)
|
|
9999
|
+
.withButtonDescriptor(new ButtonDescriptor().withStyleClass(new ButtonStyleBuilder().withSize(ActionSizeEnum.ExtraSmall)))
|
|
8785
10000
|
.withSubmitFunction(ctx => {
|
|
8786
10001
|
if (!ctx.parameters.item) {
|
|
8787
10002
|
return throwError(() => new Error(`No item was provided in context, edit cannot be done.`));
|
|
@@ -8794,15 +10009,13 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
8794
10009
|
})
|
|
8795
10010
|
.withIsVisibleFunction(() => of(!this.formControl?.disabled))
|
|
8796
10011
|
.withIsEnabledFunction(() => this.isEnabled$);
|
|
10012
|
+
editAction.buttonDescriptor.withLabel(null).withIcon('pi pi-pencil');
|
|
8797
10013
|
this.actions.push(editAction);
|
|
8798
10014
|
}
|
|
8799
10015
|
if (hasDeleteAction) {
|
|
8800
10016
|
const deleteAction = new ActionDescriptor(this.descriptor.tableviewDescriptor.model, 'delete', this.descriptor.editor.model.type, this.descriptor.property)
|
|
8801
10017
|
.withPosition(ActionPositionEnum.RowInline)
|
|
8802
|
-
.
|
|
8803
|
-
.withTitle(null)
|
|
8804
|
-
.withIcon('pi pi-trash')
|
|
8805
|
-
.withSize(ActionSizeEnum.ExtraSmall)
|
|
10018
|
+
.withButtonDescriptor(new ButtonDescriptor().withStyleClass(new ButtonStyleBuilder(ActionLevelEnum.Danger).withSize(ActionSizeEnum.ExtraSmall)))
|
|
8806
10019
|
.withRunFunction(ctx => {
|
|
8807
10020
|
if (!ctx.parameters.item) {
|
|
8808
10021
|
return throwError(() => new Error(`No item was provided in context, delete cannot be done.`));
|
|
@@ -8827,6 +10040,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
8827
10040
|
})
|
|
8828
10041
|
.withIsVisibleFunction(() => of(!this.options?.formState.disabled))
|
|
8829
10042
|
.withIsEnabledFunction(() => this.isEnabled$);
|
|
10043
|
+
deleteAction.buttonDescriptor.withLabel(null).withIcon('pi pi-trash');
|
|
8830
10044
|
this.actions.push(deleteAction);
|
|
8831
10045
|
}
|
|
8832
10046
|
this.actions.push(...this.descriptor.actions);
|
|
@@ -8879,7 +10093,7 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
8879
10093
|
}
|
|
8880
10094
|
}
|
|
8881
10095
|
MngFormlyFieldTableDialogFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, deps: [{ token: MngActionExecutorService }], target: i0.ɵɵFactoryTarget.Component });
|
|
8882
|
-
MngFormlyFieldTableDialogFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngFormlyFieldTableDialogFormComponent, selector: "mng-formly-table-dialog-form-field", usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"></mng-action>\n </div>\n </ng-template>\n</mng-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer"], outputs: ["finish"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
10096
|
+
MngFormlyFieldTableDialogFormComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.0", type: MngFormlyFieldTableDialogFormComponent, selector: "mng-formly-table-dialog-form-field", usesInheritance: true, ngImport: i0, template: "<mng-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"></mng-action>\n </div>\n </ng-template>\n</mng-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"], dependencies: [{ kind: "directive", type: i1$1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: MngTemplateDirective, selector: "[mngTemplate]", inputs: ["type", "mngTemplate"] }, { kind: "component", type: MngTableComponent, selector: "mng-table", inputs: ["descriptor", "items", "queryResult", "loading", "dataProvider", "useQueryParams", "selectionMode", "selectionEnabled", "actions", "isColumnClickable", "viewContainer", "captionComponent", "columnActionComponent", "columnActionMinWidth"], outputs: ["tableLoad", "cellClick", "selectionChange", "captionComponentInstance", "columnActionComponentInstance"] }, { kind: "component", type: MngActionComponent, selector: "mng-action", inputs: ["action", "item", "itemId", "actionData", "queryParam", "dataProvider", "disabled", "loading", "viewContainer", "selectedItems"], outputs: ["finish"] }, { kind: "pipe", type: i1$2.TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
8883
10097
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, decorators: [{
|
|
8884
10098
|
type: Component,
|
|
8885
10099
|
args: [{ selector: 'mng-formly-table-dialog-form-field', changeDetection: ChangeDetectionStrategy.OnPush, template: "<mng-table [descriptor]=\"descriptor.tableDescriptor\" [items]=\"items$\" [actions]=\"actions\">\n <ng-template mngTemplate=\"caption\">\n <div class=\"flex flex-column md:flex-row md:justify-content-end align-items-center table-header\">\n <label class=\"mng-datatable-form-label p-0 m-0\" [for]=\"key\">{{ to?.label! | translate }} <span *ngIf=\"to.required && to['hideRequiredMarker'] !== true\">*</span></label>\n <mng-action *ngFor=\"let action of toolbarRightActions\" [action]=\"action\"></mng-action>\n </div>\n </ng-template>\n</mng-table>\n", styles: [".submit-button{display:none!important;visibility:hidden}\n"] }]
|
|
@@ -9990,6 +11204,9 @@ const declarations = [
|
|
|
9990
11204
|
MngBooleanPipe,
|
|
9991
11205
|
MngI18nPropertyPipe,
|
|
9992
11206
|
MngParametrizePipe,
|
|
11207
|
+
MngGetterPipe,
|
|
11208
|
+
MngTemplatePipe,
|
|
11209
|
+
MngClassMapPipe,
|
|
9993
11210
|
// layout components
|
|
9994
11211
|
MngBreadcrumbComponent,
|
|
9995
11212
|
MngFooterComponent,
|
|
@@ -10024,7 +11241,9 @@ const declarations = [
|
|
|
10024
11241
|
MngFormEditorComponent,
|
|
10025
11242
|
MngActionComponent,
|
|
10026
11243
|
MngActionEditorComponent,
|
|
10027
|
-
MngActionRouteComponent
|
|
11244
|
+
MngActionRouteComponent,
|
|
11245
|
+
//button
|
|
11246
|
+
MngButtonComponent
|
|
10028
11247
|
];
|
|
10029
11248
|
class MngCommonsModule {
|
|
10030
11249
|
static forRoot(config) {
|
|
@@ -10050,6 +11269,8 @@ class MngCommonsModule {
|
|
|
10050
11269
|
MngBooleanPipe,
|
|
10051
11270
|
MngI18nPropertyPipe,
|
|
10052
11271
|
MngParametrizePipe,
|
|
11272
|
+
MngGetterPipe,
|
|
11273
|
+
MngTemplatePipe,
|
|
10053
11274
|
// component service
|
|
10054
11275
|
MngMainLayoutComponentService,
|
|
10055
11276
|
MngViewContainerComponentService,
|
|
@@ -10107,6 +11328,9 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10107
11328
|
MngBooleanPipe,
|
|
10108
11329
|
MngI18nPropertyPipe,
|
|
10109
11330
|
MngParametrizePipe,
|
|
11331
|
+
MngGetterPipe,
|
|
11332
|
+
MngTemplatePipe,
|
|
11333
|
+
MngClassMapPipe,
|
|
10110
11334
|
// layout components
|
|
10111
11335
|
MngBreadcrumbComponent,
|
|
10112
11336
|
MngFooterComponent,
|
|
@@ -10141,7 +11365,9 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10141
11365
|
MngFormEditorComponent,
|
|
10142
11366
|
MngActionComponent,
|
|
10143
11367
|
MngActionEditorComponent,
|
|
10144
|
-
MngActionRouteComponent
|
|
11368
|
+
MngActionRouteComponent,
|
|
11369
|
+
//button
|
|
11370
|
+
MngButtonComponent], imports: [
|
|
10145
11371
|
// angular modules
|
|
10146
11372
|
CommonModule,
|
|
10147
11373
|
RouterModule,
|
|
@@ -10222,6 +11448,9 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10222
11448
|
MngBooleanPipe,
|
|
10223
11449
|
MngI18nPropertyPipe,
|
|
10224
11450
|
MngParametrizePipe,
|
|
11451
|
+
MngGetterPipe,
|
|
11452
|
+
MngTemplatePipe,
|
|
11453
|
+
MngClassMapPipe,
|
|
10225
11454
|
// layout components
|
|
10226
11455
|
MngBreadcrumbComponent,
|
|
10227
11456
|
MngFooterComponent,
|
|
@@ -10256,7 +11485,9 @@ MngCommonsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", versio
|
|
|
10256
11485
|
MngFormEditorComponent,
|
|
10257
11486
|
MngActionComponent,
|
|
10258
11487
|
MngActionEditorComponent,
|
|
10259
|
-
MngActionRouteComponent
|
|
11488
|
+
MngActionRouteComponent,
|
|
11489
|
+
//button
|
|
11490
|
+
MngButtonComponent] });
|
|
10260
11491
|
MngCommonsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngCommonsModule, imports: [
|
|
10261
11492
|
// angular modules
|
|
10262
11493
|
CommonModule,
|
|
@@ -10918,6 +12149,7 @@ class TableviewRouteBuilder {
|
|
|
10918
12149
|
this.editPath = ':itemId/edit';
|
|
10919
12150
|
this.hasAdd = true;
|
|
10920
12151
|
this.addPath = 'add';
|
|
12152
|
+
this.hasDelete = true;
|
|
10921
12153
|
}
|
|
10922
12154
|
static fromComponent(path, component) {
|
|
10923
12155
|
const inst = new TableviewRouteBuilder(path);
|
|
@@ -10945,6 +12177,15 @@ class TableviewRouteBuilder {
|
|
|
10945
12177
|
}
|
|
10946
12178
|
return inst;
|
|
10947
12179
|
}
|
|
12180
|
+
withReadOnly(permissions) {
|
|
12181
|
+
if (permissions) {
|
|
12182
|
+
this.withPermissions(permissions);
|
|
12183
|
+
}
|
|
12184
|
+
this.withAdd(false);
|
|
12185
|
+
this.withEdit(false);
|
|
12186
|
+
this.withDelete(false);
|
|
12187
|
+
return this;
|
|
12188
|
+
}
|
|
10948
12189
|
withDetails(hasDetails = true, permissions, path) {
|
|
10949
12190
|
this.hasDetails = hasDetails;
|
|
10950
12191
|
if (permissions) {
|
|
@@ -10975,24 +12216,31 @@ class TableviewRouteBuilder {
|
|
|
10975
12216
|
}
|
|
10976
12217
|
return this;
|
|
10977
12218
|
}
|
|
12219
|
+
withDelete(hasDelete = true, permissions) {
|
|
12220
|
+
this.hasDelete = hasDelete;
|
|
12221
|
+
if (permissions) {
|
|
12222
|
+
this.withPermissions(undefined, undefined, undefined, permissions);
|
|
12223
|
+
}
|
|
12224
|
+
return this;
|
|
12225
|
+
}
|
|
10978
12226
|
withPermissions(read, add, edit, delet, details) {
|
|
10979
12227
|
if (!this.permissions) {
|
|
10980
12228
|
this.permissions = {};
|
|
10981
12229
|
}
|
|
10982
12230
|
if (read) {
|
|
10983
|
-
this.permissions[
|
|
12231
|
+
this.permissions[TableviewActionDefaultCategories.READ] = read;
|
|
10984
12232
|
}
|
|
10985
12233
|
if (add) {
|
|
10986
|
-
this.permissions[
|
|
12234
|
+
this.permissions[TableviewActionDefaultCategories.ADD] = add;
|
|
10987
12235
|
}
|
|
10988
12236
|
if (edit) {
|
|
10989
|
-
this.permissions[
|
|
12237
|
+
this.permissions[TableviewActionDefaultCategories.EDIT] = edit;
|
|
10990
12238
|
}
|
|
10991
12239
|
if (delet) {
|
|
10992
|
-
this.permissions[
|
|
12240
|
+
this.permissions[TableviewActionDefaultCategories.DELETE] = delet;
|
|
10993
12241
|
}
|
|
10994
12242
|
if (details) {
|
|
10995
|
-
this.permissions[
|
|
12243
|
+
this.permissions[TableviewActionDefaultCategories.DETAILS] = details;
|
|
10996
12244
|
}
|
|
10997
12245
|
return this;
|
|
10998
12246
|
}
|
|
@@ -11028,35 +12276,42 @@ class TableviewRouteBuilder {
|
|
|
11028
12276
|
if (this.permissions) {
|
|
11029
12277
|
routeData.tableviewPermissions = { ...this.permissions };
|
|
11030
12278
|
}
|
|
12279
|
+
routeData.tableviewActions = {
|
|
12280
|
+
hasAdd: this.hasAdd,
|
|
12281
|
+
hasEdit: this.hasEdit,
|
|
12282
|
+
hasDetails: this.hasDetails,
|
|
12283
|
+
hasDelete: this.hasDelete
|
|
12284
|
+
};
|
|
11031
12285
|
tableviewRouteBuilder.withData(routeData);
|
|
11032
|
-
if (this.permissions?.[
|
|
11033
|
-
tableviewRouteBuilder.withPermissions(this.permissions[
|
|
12286
|
+
if (this.permissions?.[TableviewActionDefaultCategories.READ]) {
|
|
12287
|
+
tableviewRouteBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.READ]);
|
|
11034
12288
|
}
|
|
11035
12289
|
// list route
|
|
11036
12290
|
const rootChildRouteBuilder = RouteBuilder.create('', MngActionRouteComponent);
|
|
11037
|
-
|
|
11038
|
-
|
|
12291
|
+
rootChildRouteBuilder.withData({ ...routeData });
|
|
12292
|
+
if (this.permissions?.[TableviewActionDefaultCategories.READ]) {
|
|
12293
|
+
rootChildRouteBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.READ]);
|
|
11039
12294
|
}
|
|
11040
12295
|
tableviewRouteBuilder.addChildBuilder(rootChildRouteBuilder);
|
|
11041
12296
|
// add route
|
|
11042
12297
|
if (this.hasAdd) {
|
|
11043
12298
|
const routeBuilder = RouteBuilder.create(this.addPath, MngActionRouteComponent);
|
|
11044
|
-
if (this.permissions?.[
|
|
11045
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12299
|
+
if (this.permissions?.[TableviewActionDefaultCategories.ADD]) {
|
|
12300
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.ADD]);
|
|
11046
12301
|
}
|
|
11047
12302
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11048
12303
|
}
|
|
11049
12304
|
if (this.hasDetails) {
|
|
11050
12305
|
const routeBuilder = RouteBuilder.create(this.detailsPath, MngActionRouteComponent);
|
|
11051
|
-
if (this.permissions?.[
|
|
11052
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12306
|
+
if (this.permissions?.[TableviewActionDefaultCategories.DETAILS]) {
|
|
12307
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.DETAILS]);
|
|
11053
12308
|
}
|
|
11054
12309
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11055
12310
|
}
|
|
11056
12311
|
if (this.hasEdit) {
|
|
11057
12312
|
const routeBuilder = RouteBuilder.create(this.editPath, MngActionRouteComponent);
|
|
11058
|
-
if (this.permissions?.[
|
|
11059
|
-
routeBuilder.withPermissions(this.permissions[
|
|
12313
|
+
if (this.permissions?.[TableviewActionDefaultCategories.EDIT]) {
|
|
12314
|
+
routeBuilder.withPermissions(this.permissions[TableviewActionDefaultCategories.EDIT]);
|
|
11060
12315
|
}
|
|
11061
12316
|
tableviewRouteBuilder.addChildBuilder(routeBuilder);
|
|
11062
12317
|
}
|
|
@@ -11072,5 +12327,5 @@ class TableviewRouteBuilder {
|
|
|
11072
12327
|
* Generated bundle index. Do not edit.
|
|
11073
12328
|
*/
|
|
11074
12329
|
|
|
11075
|
-
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorDialogSizeEnum, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLevelEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionSizeEnum, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ColumnDescriptor, ColumnTypeEnum, DataProvider, DefaultMngErrorMapperService, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, JsonPathPipe, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngEnumPipe, MngErrorMapperService, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngI18nPropertyPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngParametrizePipe, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTopbarComponent, MngVersionComponent, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StylesUtil, TableDataProvider, TableDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewRouteBuilder, TableviewTypeEnum, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
12330
|
+
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorDialogSizeEnum, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLevelEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionSizeEnum, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonDescriptor, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DefaultMngErrorMapperService, DynamicTableviewDataProvider, EditorDataProvider, EditorDescriptor, EditorFormlyUtil, EnumName, EnumUtil, FieldGroupDescriptor, FieldGroupTypeEnum, FieldInputDescriptor, FieldInputTypeEnum, FieldLookupDescriptor, FieldLookupEnumDescriptor, FieldLookupTypeEnum, FieldManyEditorActionEnum, FieldManyEditorDescriptor, FieldManyEditorTypeEnum, FieldManyToManyEditorActionEnum, FieldManyToManyEditorDescriptor, FieldManyToManyEditorTypeEnum, FieldSizeEnum, FieldTabGroupDescriptor, FieldValidationDescriptor, FilterDescriptor, FilterLookupDescriptor, FilterLookupEnumDescriptor, FilterLookupTypeEnum, FilterMatchModeEnum, FilterTypeEnum, I18nUtils, JsonPathPipe, LookupDataProvider, MNG_AUTOCOMPLETE_VALUE_ACCESSOR, MNG_BROWSER_STORAGE_IT, MNG_COMMONS_INITIALIZER_IT, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngButtonComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDropdownComponent, MngEnumPipe, MngErrorMapperService, MngFooterComponent, MngFormEditorComponent, MngFormEditorSubmitEvent, MngFormFieldEvent, MngFormFieldEventComponentSubtype, MngFormFieldEventDialogSubtype, MngFormFieldEventTypeEnum, MngFormlyFieldAutocompleteComponent, MngFormlyFieldDropdownComponent, MngFormlyFieldFieldsetComponent, MngFormlyFieldInputComponent, MngFormlyFieldLabelComponent, MngFormlyFieldLookupDialogComponent, MngFormlyFieldTableDialogFormComponent, MngFormlyFieldTableDialogMultiselectComponent, MngFormlyFieldTabsComponent, MngFormlyFieldWrapperComponent, MngFormlyTableWrapperComponent, MngGetterPipe, MngI18nPropertyPipe, MngMainLayoutComponent, MngMainLayoutComponentService, MngMenuComponent, MngMenuItemComponent, MngNavigationService, MngParametrizePipe, MngTableCellClickEvent, MngTableColumnFilterComponent, MngTableColumnValueComponent, MngTableComponent, MngTableLoadEvent, MngTableReloadEvent, MngTableviewComponent, MngTableviewRouteComponent, MngTemplateDirective, MngTemplatePipe, MngTopbarComponent, MngVersionComponent, MngViewContainerComponentService, ModelDescriptor, ModelUtil, NotificationUtil, ObjectSerializer, Permissions, RouteBuilder, RoutesBuilder, StringUtil, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewRouteBuilder, TableviewTypeEnum, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
11076
12331
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|