@mediusinc/mng-commons 0.15.1 → 0.16.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/components/action/action.component.mjs +7 -7
- package/esm2020/lib/components/action/editor/action-editor.component.mjs +41 -20
- package/esm2020/lib/components/action/route/action-route.component.mjs +3 -3
- package/esm2020/lib/components/form/editor/form-editor.component.mjs +29 -29
- package/esm2020/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.mjs +13 -15
- package/esm2020/lib/components/tableview/route/tableview-route.abstract.component.mjs +5 -5
- package/esm2020/lib/components/tableview/table/table.component.mjs +1 -1
- package/esm2020/lib/components/tableview/tableview.component.mjs +16 -14
- package/esm2020/lib/descriptors/action.descriptor.mjs +19 -12
- package/esm2020/lib/descriptors/editor.descriptor.mjs +5 -8
- package/esm2020/lib/descriptors/field.descriptor.mjs +2 -2
- package/esm2020/lib/descriptors/tableview.descriptor.mjs +32 -32
- package/esm2020/lib/descriptors/types/editor.type.mjs +8 -8
- package/esm2020/lib/models/view-container.model.mjs +1 -1
- package/esm2020/lib/router/tableview-route-builder.mjs +2 -2
- package/esm2020/lib/security/model/permissions.model.mjs +1 -9
- package/esm2020/lib/services/view-container.component.service.mjs +21 -8
- package/fesm2015/mediusinc-mng-commons.mjs +543 -511
- package/fesm2015/mediusinc-mng-commons.mjs.map +1 -1
- package/fesm2020/mediusinc-mng-commons.mjs +542 -512
- package/fesm2020/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/action/editor/action-editor.component.d.ts +1 -2
- package/lib/components/form/editor/form-editor.component.d.ts +1 -1
- package/lib/components/form/formly/fields/formly-field-table-dialog-form/formly-field-table-dialog-form.component.d.ts +0 -3
- package/lib/components/tableview/tableview.component.d.ts +2 -2
- package/lib/descriptors/action.descriptor.d.ts +6 -4
- package/lib/descriptors/editor.descriptor.d.ts +5 -6
- package/lib/descriptors/tableview.descriptor.d.ts +5 -5
- package/lib/descriptors/types/editor.type.d.ts +2 -2
- package/lib/models/view-container.model.d.ts +31 -0
- package/lib/router/tableview-route-builder.d.ts +1 -1
- package/lib/security/model/permissions.model.d.ts +0 -7
- package/lib/services/view-container.component.service.d.ts +12 -6
- package/package.json +1 -1
- package/scss/mng-overrides/_layout_dialog.scss +1 -0
- package/version-info.json +5 -5
|
@@ -74,7 +74,7 @@ import * as i6$2 from 'primeng/toolbar';
|
|
|
74
74
|
import { ToolbarModule } from 'primeng/toolbar';
|
|
75
75
|
import * as i7 from 'primeng/tooltip';
|
|
76
76
|
import { TooltipModule } from 'primeng/tooltip';
|
|
77
|
-
import { isObservable, throwError,
|
|
77
|
+
import { isObservable, throwError, BehaviorSubject, Subject, ReplaySubject, distinctUntilChanged, of, combineLatest, tap, switchMap, mergeMap as mergeMap$1, from, Observable, merge, debounceTime } from 'rxjs';
|
|
78
78
|
import { map, mergeMap, catchError, first, filter, finalize, startWith } from 'rxjs/operators';
|
|
79
79
|
import 'reflect-metadata';
|
|
80
80
|
import * as i4 from '@angular/platform-browser';
|
|
@@ -577,6 +577,257 @@ DateUtil.NG_PRIME_FORMAT_MAP = {
|
|
|
577
577
|
YYYY: 'yy'
|
|
578
578
|
};
|
|
579
579
|
|
|
580
|
+
class ActionError {
|
|
581
|
+
constructor(error, // error details
|
|
582
|
+
dismissed = false // by user
|
|
583
|
+
) {
|
|
584
|
+
this.error = error;
|
|
585
|
+
this.dismissed = dismissed;
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Action execution instance containing data about execution state of action
|
|
590
|
+
*/
|
|
591
|
+
class ActionInstance {
|
|
592
|
+
constructor(action, state = ActionInstanceStateEnum.TriggerStart, debug = false) {
|
|
593
|
+
this.debug = debug;
|
|
594
|
+
// function execution
|
|
595
|
+
this.isRunLoadingSubject = new BehaviorSubject(false);
|
|
596
|
+
this.contexts = [];
|
|
597
|
+
this.executionSubject = new Subject();
|
|
598
|
+
this.executionIsRunningSubject = new BehaviorSubject(false);
|
|
599
|
+
this.stateSubject = new BehaviorSubject(1);
|
|
600
|
+
this.resultSubject = new ReplaySubject(1);
|
|
601
|
+
this.errorSubject = new ReplaySubject(1);
|
|
602
|
+
this.contextExecutionSubscriptions = [];
|
|
603
|
+
this.instanceId = Math.random().toString(36).substring(2);
|
|
604
|
+
this.instanceLongName = `${action.actionNameLong}_${this.instanceId}`;
|
|
605
|
+
this.action = action;
|
|
606
|
+
this.state = state;
|
|
607
|
+
}
|
|
608
|
+
get isRunLoading$() {
|
|
609
|
+
return this.isRunLoadingSubject.asObservable();
|
|
610
|
+
}
|
|
611
|
+
get context() {
|
|
612
|
+
return this.contexts.length === 0 ? undefined : this.contexts[this.contexts.length - 1];
|
|
613
|
+
}
|
|
614
|
+
get execution$() {
|
|
615
|
+
return this.executionSubject.asObservable();
|
|
616
|
+
}
|
|
617
|
+
get executionIsRunning$() {
|
|
618
|
+
return this.executionIsRunningSubject.asObservable().pipe(distinctUntilChanged());
|
|
619
|
+
}
|
|
620
|
+
get state() {
|
|
621
|
+
return this.stateSubject.value;
|
|
622
|
+
}
|
|
623
|
+
set state(state) {
|
|
624
|
+
if (state > this.stateSubject.value) {
|
|
625
|
+
if (this.debug) {
|
|
626
|
+
console.debug(`ActionInstance ${this.instanceLongName} - state #${state}: ${ActionInstanceStateEnum[state]}`);
|
|
627
|
+
}
|
|
628
|
+
this.stateSubject.next(state);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
get state$() {
|
|
632
|
+
return this.stateSubject.asObservable().pipe(distinctUntilChanged());
|
|
633
|
+
}
|
|
634
|
+
get result() {
|
|
635
|
+
return this._result;
|
|
636
|
+
}
|
|
637
|
+
set result(result) {
|
|
638
|
+
if (typeof result === 'undefined') {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
if (this.debug) {
|
|
642
|
+
console.debug(`ActionInstance ${this.instanceLongName} - result`, result);
|
|
643
|
+
}
|
|
644
|
+
this._result = result;
|
|
645
|
+
this.resultSubject.next(result);
|
|
646
|
+
}
|
|
647
|
+
get result$() {
|
|
648
|
+
return this.resultSubject.asObservable();
|
|
649
|
+
}
|
|
650
|
+
get error() {
|
|
651
|
+
return this._error;
|
|
652
|
+
}
|
|
653
|
+
set error(error) {
|
|
654
|
+
if (typeof error === 'undefined') {
|
|
655
|
+
return;
|
|
656
|
+
}
|
|
657
|
+
if (this.debug) {
|
|
658
|
+
console.debug(`ActionInstance ${this.instanceLongName} - error`, error);
|
|
659
|
+
}
|
|
660
|
+
this._error = error;
|
|
661
|
+
this.errorSubject.next(error);
|
|
662
|
+
}
|
|
663
|
+
get error$() {
|
|
664
|
+
return this.errorSubject.asObservable();
|
|
665
|
+
}
|
|
666
|
+
contextAt(idx) {
|
|
667
|
+
return idx < this.contexts.length ? this.contexts[idx] : undefined;
|
|
668
|
+
}
|
|
669
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
670
|
+
newContext(context, finishPrevious = true) {
|
|
671
|
+
if (this.debug) {
|
|
672
|
+
console.debug(`ActionInstance ${this.instanceLongName} - new context ${context.contextLongName}`);
|
|
673
|
+
}
|
|
674
|
+
const currentContext = this.context;
|
|
675
|
+
if (currentContext) {
|
|
676
|
+
currentContext.executionComplete();
|
|
677
|
+
}
|
|
678
|
+
this.contextExecutionSubscriptions.forEach(s => s.unsubscribe());
|
|
679
|
+
this.contextExecutionSubscriptions = [];
|
|
680
|
+
this.contextExecutionSubscriptions.push(context.execution$.subscribe({
|
|
681
|
+
next: next => this.executionSubject.next(next),
|
|
682
|
+
error: error => this.executionSubject.error(error)
|
|
683
|
+
}));
|
|
684
|
+
this.contextExecutionSubscriptions.push(context.executionIsRunning$.subscribe({
|
|
685
|
+
next: next => this.executionIsRunningSubject.next(next)
|
|
686
|
+
}));
|
|
687
|
+
this.contexts.push(context);
|
|
688
|
+
}
|
|
689
|
+
finish() {
|
|
690
|
+
if (this.stateSubject.value < ActionInstanceStateEnum.FinishSuccess) {
|
|
691
|
+
this.state = ActionInstanceStateEnum.FinishSuccess;
|
|
692
|
+
}
|
|
693
|
+
// complete all subjects
|
|
694
|
+
this.contexts.forEach(c => c.finish());
|
|
695
|
+
this.executionSubject.complete();
|
|
696
|
+
this.executionIsRunningSubject.complete();
|
|
697
|
+
this.stateSubject.complete();
|
|
698
|
+
this.resultSubject.complete();
|
|
699
|
+
this.errorSubject.complete();
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* Class containing all main data for action to be executed in run/fetch/submit states.
|
|
704
|
+
*/
|
|
705
|
+
class ActionContext {
|
|
706
|
+
constructor(instance, parameters, functionName, dataProvider, serviceInstance, executionSubject = new ReplaySubject(1), executionIsRunningSubject = new BehaviorSubject(false)) {
|
|
707
|
+
this.instance = instance;
|
|
708
|
+
this.parameters = parameters;
|
|
709
|
+
this.functionName = functionName;
|
|
710
|
+
this.dataProvider = dataProvider;
|
|
711
|
+
this.serviceInstance = serviceInstance;
|
|
712
|
+
this.executionSubject = executionSubject;
|
|
713
|
+
this.executionIsRunningSubject = executionIsRunningSubject;
|
|
714
|
+
this.contextLongName = `${this.instance.instanceLongName}_${functionName}`;
|
|
715
|
+
}
|
|
716
|
+
get execution$() {
|
|
717
|
+
return this.executionSubject.asObservable();
|
|
718
|
+
}
|
|
719
|
+
get executionIsRunning$() {
|
|
720
|
+
return this.executionIsRunningSubject.asObservable().pipe(distinctUntilChanged());
|
|
721
|
+
}
|
|
722
|
+
executionStart() {
|
|
723
|
+
if (this.instance.debug) {
|
|
724
|
+
console.debug(`ActionContext ${this.contextLongName} - execution start`);
|
|
725
|
+
}
|
|
726
|
+
this.executionIsRunningSubject.next(true);
|
|
727
|
+
}
|
|
728
|
+
executionNext(next, finish = true) {
|
|
729
|
+
if (this.instance.debug) {
|
|
730
|
+
console.debug(`ActionContext ${this.contextLongName} - execution next event`, next, finish);
|
|
731
|
+
}
|
|
732
|
+
this.executionSubject.next(next);
|
|
733
|
+
if (finish) {
|
|
734
|
+
this.executionComplete();
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
executionComplete() {
|
|
738
|
+
if (this.instance.debug) {
|
|
739
|
+
console.debug(`ActionContext ${this.contextLongName} - execution complete`);
|
|
740
|
+
}
|
|
741
|
+
this.executionSubject.complete();
|
|
742
|
+
this.executionIsRunningSubject.next(false);
|
|
743
|
+
}
|
|
744
|
+
executionError(err) {
|
|
745
|
+
if (this.instance.debug) {
|
|
746
|
+
console.debug(`ActionContext ${this.contextLongName} - execution error`, err);
|
|
747
|
+
}
|
|
748
|
+
this.executionSubject.error(err);
|
|
749
|
+
this.executionIsRunningSubject.next(false);
|
|
750
|
+
}
|
|
751
|
+
finish() {
|
|
752
|
+
this.executionSubject.complete();
|
|
753
|
+
this.executionIsRunningSubject.complete();
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Class containing all main data for action validations (enabled/visible) to be executed in validation states.
|
|
758
|
+
*/
|
|
759
|
+
class ActionContextValidation {
|
|
760
|
+
constructor(descriptor, parameters, dataProvider, serviceInstance) {
|
|
761
|
+
this.descriptor = descriptor;
|
|
762
|
+
this.parameters = parameters;
|
|
763
|
+
this.dataProvider = dataProvider;
|
|
764
|
+
this.serviceInstance = serviceInstance;
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
class ActionParameters {
|
|
768
|
+
constructor(itemId, item) {
|
|
769
|
+
this.itemId = itemId;
|
|
770
|
+
this.item = item;
|
|
771
|
+
this.selectedItems = [];
|
|
772
|
+
}
|
|
773
|
+
withActionData(actionData) {
|
|
774
|
+
this.actionData = actionData;
|
|
775
|
+
return this;
|
|
776
|
+
}
|
|
777
|
+
withQueryParam(queryParam) {
|
|
778
|
+
this.queryParam = queryParam;
|
|
779
|
+
return this;
|
|
780
|
+
}
|
|
781
|
+
withViewContainer(viewContainer) {
|
|
782
|
+
this.viewContainer = viewContainer;
|
|
783
|
+
return this;
|
|
784
|
+
}
|
|
785
|
+
withSourceComponent(sourceComponent) {
|
|
786
|
+
this.sourceComponent = sourceComponent;
|
|
787
|
+
return this;
|
|
788
|
+
}
|
|
789
|
+
withRoute(route) {
|
|
790
|
+
this.route = route;
|
|
791
|
+
return this;
|
|
792
|
+
}
|
|
793
|
+
withSelectedItems(selectedItems) {
|
|
794
|
+
this.selectedItems = selectedItems;
|
|
795
|
+
return this;
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
var ActionInstanceStateEnum;
|
|
799
|
+
(function (ActionInstanceStateEnum) {
|
|
800
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["TriggerStart"] = 0] = "TriggerStart";
|
|
801
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["TriggerEnd"] = 1] = "TriggerEnd";
|
|
802
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["ActivationStart"] = 2] = "ActivationStart";
|
|
803
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["ActivationEnd"] = 3] = "ActivationEnd";
|
|
804
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["FetchStart"] = 4] = "FetchStart";
|
|
805
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["FetchEnd"] = 5] = "FetchEnd";
|
|
806
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["FetchError"] = 6] = "FetchError";
|
|
807
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["RunConfirmationStart"] = 7] = "RunConfirmationStart";
|
|
808
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["RunConfirmationEndAccept"] = 8] = "RunConfirmationEndAccept";
|
|
809
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["RunConfirmationEndReject"] = 9] = "RunConfirmationEndReject";
|
|
810
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["RunStart"] = 10] = "RunStart";
|
|
811
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["RunEnd"] = 11] = "RunEnd";
|
|
812
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["RunError"] = 12] = "RunError";
|
|
813
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["NextActionStart"] = 13] = "NextActionStart";
|
|
814
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["NextActionEnd"] = 14] = "NextActionEnd";
|
|
815
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishSuccess"] = 15] = "FinishSuccess";
|
|
816
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishError"] = 16] = "FinishError";
|
|
817
|
+
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishDismissed"] = 17] = "FinishDismissed"; // action was dismissed by user
|
|
818
|
+
})(ActionInstanceStateEnum || (ActionInstanceStateEnum = {}));
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* Default categories for tableview actions
|
|
822
|
+
*/
|
|
823
|
+
class TableviewActionDefaultCategories {
|
|
824
|
+
}
|
|
825
|
+
TableviewActionDefaultCategories.READ = 'read';
|
|
826
|
+
TableviewActionDefaultCategories.ADD = 'add';
|
|
827
|
+
TableviewActionDefaultCategories.EDIT = 'edit';
|
|
828
|
+
TableviewActionDefaultCategories.DELETE = 'delete';
|
|
829
|
+
TableviewActionDefaultCategories.DETAILS = 'details';
|
|
830
|
+
|
|
580
831
|
class DataProvider {
|
|
581
832
|
constructor(modelType, serviceType) {
|
|
582
833
|
this._modelType = modelType;
|
|
@@ -687,146 +938,44 @@ class TableviewDataProvider extends EditorDataProvider {
|
|
|
687
938
|
class DynamicTableviewDataProvider extends TableviewDataProvider {
|
|
688
939
|
constructor() {
|
|
689
940
|
super({});
|
|
690
|
-
this._getAll = () => of(new MediusQueryResult());
|
|
691
|
-
this._fetch = () => of({});
|
|
692
|
-
}
|
|
693
|
-
withGetAll(getAll) {
|
|
694
|
-
this._getAll = getAll;
|
|
695
|
-
return this;
|
|
696
|
-
}
|
|
697
|
-
withFetch(fetch) {
|
|
698
|
-
this._fetch = fetch;
|
|
699
|
-
return this;
|
|
700
|
-
}
|
|
701
|
-
get getAll() {
|
|
702
|
-
return this._getAll;
|
|
703
|
-
}
|
|
704
|
-
get fetch() {
|
|
705
|
-
return this._fetch;
|
|
706
|
-
}
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
class TableviewCrudDataProvider extends TableviewDataProvider {
|
|
710
|
-
constructor(modelType, serviceType, idPropertyName, useGetAllForFetch = false) {
|
|
711
|
-
super(modelType, serviceType);
|
|
712
|
-
this.withGetAll((queryParam, service) => service.getAllPost(queryParam));
|
|
713
|
-
if (useGetAllForFetch) {
|
|
714
|
-
const selectedIdPropertyName = idPropertyName ?? ModelUtil.findIdAttribute(modelType) ?? 'id';
|
|
715
|
-
this.withFetch((id, service) => {
|
|
716
|
-
const qp = MediusQueryParamBuilder.create(10, 0).withFilter(selectedIdPropertyName, id, id, MediusFilterMatchType.Equals, true).build();
|
|
717
|
-
return service.getAllPost(qp).pipe(map(res => res.pageData[0]));
|
|
718
|
-
});
|
|
719
|
-
}
|
|
720
|
-
else {
|
|
721
|
-
this.withFetch((id, service) => service.getByIdGet(id));
|
|
722
|
-
}
|
|
723
|
-
this.withCreate((item, service) => service.createPost(item));
|
|
724
|
-
this.withUpdate((id, item, service) => service.updatePut(id, item));
|
|
725
|
-
this.withDelete((id, item, service) => service.removeDelete(id, item));
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
|
|
729
|
-
var AuthorizationTypeEnum;
|
|
730
|
-
(function (AuthorizationTypeEnum) {
|
|
731
|
-
AuthorizationTypeEnum["All"] = "ALL";
|
|
732
|
-
AuthorizationTypeEnum["Any"] = "ANY";
|
|
733
|
-
AuthorizationTypeEnum["Rbac"] = "ROLE_BASED_ACCESS_CONTROL";
|
|
734
|
-
AuthorizationTypeEnum["Service"] = "SERVICE";
|
|
735
|
-
})(AuthorizationTypeEnum || (AuthorizationTypeEnum = {}));
|
|
736
|
-
|
|
737
|
-
class APermissions {
|
|
738
|
-
constructor(type) {
|
|
739
|
-
this._authorizationType = type;
|
|
740
|
-
}
|
|
741
|
-
get authorizationType() {
|
|
742
|
-
return this._authorizationType;
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
var Permissions;
|
|
746
|
-
(function (Permissions) {
|
|
747
|
-
class All extends APermissions {
|
|
748
|
-
constructor() {
|
|
749
|
-
super(AuthorizationTypeEnum.All);
|
|
750
|
-
this._permissions = [];
|
|
751
|
-
}
|
|
752
|
-
static of(...permissions) {
|
|
753
|
-
const inst = new All();
|
|
754
|
-
inst.and(...permissions);
|
|
755
|
-
return inst;
|
|
756
|
-
}
|
|
757
|
-
get permissions() {
|
|
758
|
-
return this._permissions;
|
|
759
|
-
}
|
|
760
|
-
and(...permissions) {
|
|
761
|
-
this._permissions.push(...permissions);
|
|
762
|
-
return this;
|
|
763
|
-
}
|
|
941
|
+
this._getAll = () => of(new MediusQueryResult());
|
|
942
|
+
this._fetch = () => of({});
|
|
764
943
|
}
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
super(AuthorizationTypeEnum.Any);
|
|
769
|
-
this._permissions = [];
|
|
770
|
-
}
|
|
771
|
-
static of(...permissions) {
|
|
772
|
-
const inst = new Any();
|
|
773
|
-
inst.or(...permissions);
|
|
774
|
-
return inst;
|
|
775
|
-
}
|
|
776
|
-
get permissions() {
|
|
777
|
-
return this._permissions;
|
|
778
|
-
}
|
|
779
|
-
or(...permissions) {
|
|
780
|
-
this._permissions.push(...permissions);
|
|
781
|
-
return this;
|
|
782
|
-
}
|
|
944
|
+
withGetAll(getAll) {
|
|
945
|
+
this._getAll = getAll;
|
|
946
|
+
return this;
|
|
783
947
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
super(AuthorizationTypeEnum.Rbac);
|
|
788
|
-
this._roles = [];
|
|
789
|
-
}
|
|
790
|
-
static of(...roles) {
|
|
791
|
-
const inst = new Roles();
|
|
792
|
-
inst.or(...roles);
|
|
793
|
-
return inst;
|
|
794
|
-
}
|
|
795
|
-
get roles() {
|
|
796
|
-
return this._roles;
|
|
797
|
-
}
|
|
798
|
-
and(...roles) {
|
|
799
|
-
if (this._roles.length === 0) {
|
|
800
|
-
this._roles.push([]);
|
|
801
|
-
}
|
|
802
|
-
this._roles[this._roles.length - 1].push(...roles);
|
|
803
|
-
return this;
|
|
804
|
-
}
|
|
805
|
-
or(...roles) {
|
|
806
|
-
this._roles.push(...roles.map(s => [s]));
|
|
807
|
-
return this;
|
|
808
|
-
}
|
|
948
|
+
withFetch(fetch) {
|
|
949
|
+
this._fetch = fetch;
|
|
950
|
+
return this;
|
|
809
951
|
}
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
952
|
+
get getAll() {
|
|
953
|
+
return this._getAll;
|
|
954
|
+
}
|
|
955
|
+
get fetch() {
|
|
956
|
+
return this._fetch;
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
class TableviewCrudDataProvider extends TableviewDataProvider {
|
|
961
|
+
constructor(modelType, serviceType, idPropertyName, useGetAllForFetch = false) {
|
|
962
|
+
super(modelType, serviceType);
|
|
963
|
+
this.withGetAll((queryParam, service) => service.getAllPost(queryParam));
|
|
964
|
+
if (useGetAllForFetch) {
|
|
965
|
+
const selectedIdPropertyName = idPropertyName ?? ModelUtil.findIdAttribute(modelType) ?? 'id';
|
|
966
|
+
this.withFetch((id, service) => {
|
|
967
|
+
const qp = MediusQueryParamBuilder.create(10, 0).withFilter(selectedIdPropertyName, id, id, MediusFilterMatchType.Equals, true).build();
|
|
968
|
+
return service.getAllPost(qp).pipe(map(res => res.pageData[0]));
|
|
969
|
+
});
|
|
815
970
|
}
|
|
816
|
-
|
|
817
|
-
|
|
971
|
+
else {
|
|
972
|
+
this.withFetch((id, service) => service.getByIdGet(id));
|
|
818
973
|
}
|
|
974
|
+
this.withCreate((item, service) => service.createPost(item));
|
|
975
|
+
this.withUpdate((id, item, service) => service.updatePut(id, item));
|
|
976
|
+
this.withDelete((id, item, service) => service.removeDelete(id, item));
|
|
819
977
|
}
|
|
820
|
-
|
|
821
|
-
class ActionTypes {
|
|
822
|
-
}
|
|
823
|
-
ActionTypes.READ = 'read';
|
|
824
|
-
ActionTypes.ADD = 'add';
|
|
825
|
-
ActionTypes.EDIT = 'edit';
|
|
826
|
-
ActionTypes.DELETE = 'delete';
|
|
827
|
-
ActionTypes.DETAILS = 'details';
|
|
828
|
-
Permissions.ActionTypes = ActionTypes;
|
|
829
|
-
})(Permissions || (Permissions = {}));
|
|
978
|
+
}
|
|
830
979
|
|
|
831
980
|
var ActionPositionEnum;
|
|
832
981
|
(function (ActionPositionEnum) {
|
|
@@ -865,13 +1014,13 @@ var ColumnTypeEnum;
|
|
|
865
1014
|
ColumnTypeEnum[ColumnTypeEnum["Custom"] = 6] = "Custom";
|
|
866
1015
|
})(ColumnTypeEnum || (ColumnTypeEnum = {}));
|
|
867
1016
|
|
|
868
|
-
var
|
|
869
|
-
(function (
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
})(
|
|
1017
|
+
var TableviewEditorTypeEnum;
|
|
1018
|
+
(function (TableviewEditorTypeEnum) {
|
|
1019
|
+
TableviewEditorTypeEnum[TableviewEditorTypeEnum["None"] = 0] = "None";
|
|
1020
|
+
TableviewEditorTypeEnum[TableviewEditorTypeEnum["Details"] = 1] = "Details";
|
|
1021
|
+
TableviewEditorTypeEnum[TableviewEditorTypeEnum["Edit"] = 2] = "Edit";
|
|
1022
|
+
TableviewEditorTypeEnum[TableviewEditorTypeEnum["Add"] = 3] = "Add";
|
|
1023
|
+
})(TableviewEditorTypeEnum || (TableviewEditorTypeEnum = {}));
|
|
875
1024
|
|
|
876
1025
|
var FieldSizeEnum;
|
|
877
1026
|
(function (FieldSizeEnum) {
|
|
@@ -1462,8 +1611,8 @@ class ActionDescriptor {
|
|
|
1462
1611
|
get permissions() {
|
|
1463
1612
|
return this._permissions;
|
|
1464
1613
|
}
|
|
1465
|
-
get
|
|
1466
|
-
return this.
|
|
1614
|
+
get tableviewCategory() {
|
|
1615
|
+
return this._tableviewCategory;
|
|
1467
1616
|
}
|
|
1468
1617
|
get hasItemsSelection() {
|
|
1469
1618
|
return this._hasItemsSelection;
|
|
@@ -1471,6 +1620,9 @@ class ActionDescriptor {
|
|
|
1471
1620
|
get button() {
|
|
1472
1621
|
return this._button;
|
|
1473
1622
|
}
|
|
1623
|
+
get positionTableviewCategories() {
|
|
1624
|
+
return this._positionTableviewCategories;
|
|
1625
|
+
}
|
|
1474
1626
|
withDataProvider(dataProvider) {
|
|
1475
1627
|
this._dataProvider = dataProvider;
|
|
1476
1628
|
return this;
|
|
@@ -1541,14 +1693,14 @@ class ActionDescriptor {
|
|
|
1541
1693
|
return this;
|
|
1542
1694
|
}
|
|
1543
1695
|
withPermissions(permissions) {
|
|
1544
|
-
if (this.
|
|
1545
|
-
console.warn(`Permissions set on action ${this._actionNameLong} with route type '${this.
|
|
1696
|
+
if (this._tableviewCategory) {
|
|
1697
|
+
console.warn(`Permissions set on action ${this._actionNameLong} with route type '${this._tableviewCategory}' will be omitted in route guard validation.`);
|
|
1546
1698
|
}
|
|
1547
1699
|
this._permissions = permissions;
|
|
1548
1700
|
return this;
|
|
1549
1701
|
}
|
|
1550
|
-
|
|
1551
|
-
this.
|
|
1702
|
+
withTableviewCategory(permissionsRouteType) {
|
|
1703
|
+
this._tableviewCategory = permissionsRouteType;
|
|
1552
1704
|
return this;
|
|
1553
1705
|
}
|
|
1554
1706
|
withButtonDescriptor(button) {
|
|
@@ -1564,6 +1716,10 @@ class ActionDescriptor {
|
|
|
1564
1716
|
this._isEnabledFunction = this._isEnabledFunction ?? (ctx => of((ctx.parameters.selectedItems?.length ?? 0) > 0));
|
|
1565
1717
|
return this;
|
|
1566
1718
|
}
|
|
1719
|
+
withPositionTableviewCategories(positionTableviewCategories) {
|
|
1720
|
+
this._positionTableviewCategories = positionTableviewCategories;
|
|
1721
|
+
return this;
|
|
1722
|
+
}
|
|
1567
1723
|
}
|
|
1568
1724
|
class ActionSimpleDescriptor extends ActionDescriptor {
|
|
1569
1725
|
constructor(actionName, modelType, idProperty, titleProperty) {
|
|
@@ -1715,7 +1871,7 @@ class ActionEditorDetailsDescriptor extends ActionEditorDescriptor {
|
|
|
1715
1871
|
this.withRouteTrigger(':itemId');
|
|
1716
1872
|
this.withFetchFunction(ActionDataProviderUtil.runFetchOrFail);
|
|
1717
1873
|
this.withEditorActions([new ActionEditorSubmitDescriptor(this, ActionEditorSubmitTypeEnum.Cancel)]);
|
|
1718
|
-
this.
|
|
1874
|
+
this.withTableviewCategory(TableviewActionDefaultCategories.DETAILS);
|
|
1719
1875
|
}
|
|
1720
1876
|
withServiceType(serviceType) {
|
|
1721
1877
|
return this.withServiceFetchFunction(serviceType);
|
|
@@ -1738,7 +1894,7 @@ class ActionEditorAddDescriptor extends ActionEditorDescriptor {
|
|
|
1738
1894
|
this.withSubmitFunction(ActionDataProviderUtil.runCreateOrFail);
|
|
1739
1895
|
this.button.styleClass.withActionLevel(StyleLevelEnum.Success);
|
|
1740
1896
|
this.button.withIcon('pi pi-plus');
|
|
1741
|
-
this.
|
|
1897
|
+
this.withTableviewCategory(TableviewActionDefaultCategories.ADD);
|
|
1742
1898
|
}
|
|
1743
1899
|
withServiceType(serviceType) {
|
|
1744
1900
|
return this.withServiceSubmitFunction(serviceType);
|
|
@@ -1763,7 +1919,7 @@ class ActionEditorEditDescriptor extends ActionEditorDescriptor {
|
|
|
1763
1919
|
this.withRouteTrigger(':itemId/edit');
|
|
1764
1920
|
this.withFetchFunction(ActionDataProviderUtil.runFetchOrFail);
|
|
1765
1921
|
this.withSubmitFunction(ActionDataProviderUtil.runUpdateOrFail);
|
|
1766
|
-
this.
|
|
1922
|
+
this.withTableviewCategory(TableviewActionDefaultCategories.EDIT);
|
|
1767
1923
|
this.button.withLabel(null).withIcon('pi pi-pencil');
|
|
1768
1924
|
}
|
|
1769
1925
|
withServiceType(serviceType) {
|
|
@@ -1789,7 +1945,7 @@ class ActionDeleteDescriptor extends ActionDescriptor {
|
|
|
1789
1945
|
this.withRunFunction(ActionDataProviderUtil.runDeleteOrFail);
|
|
1790
1946
|
this.button.styleClass.withActionLevel(StyleLevelEnum.Danger);
|
|
1791
1947
|
this.withRunConfirmation();
|
|
1792
|
-
this.
|
|
1948
|
+
this.withTableviewCategory(TableviewActionDefaultCategories.DELETE);
|
|
1793
1949
|
this.button.withLabel(null).withIcon('pi pi-trash');
|
|
1794
1950
|
}
|
|
1795
1951
|
withServiceType(serviceType) {
|
|
@@ -2690,7 +2846,7 @@ class ColumnDynamicDescriptor extends ColumnDescriptor {
|
|
|
2690
2846
|
}
|
|
2691
2847
|
|
|
2692
2848
|
class EditorDescriptor {
|
|
2693
|
-
constructor(modelType, idProperty, titleProperty, tableviewEditorType =
|
|
2849
|
+
constructor(modelType, idProperty, titleProperty, tableviewEditorType = TableviewEditorTypeEnum.None) {
|
|
2694
2850
|
this._tabs = [];
|
|
2695
2851
|
this._groups = [];
|
|
2696
2852
|
this._fields = [];
|
|
@@ -2707,7 +2863,7 @@ class EditorDescriptor {
|
|
|
2707
2863
|
* @param titleProperty
|
|
2708
2864
|
* @param tableEditorType
|
|
2709
2865
|
*/
|
|
2710
|
-
static from(modelType, idProperty, titleProperty, tableEditorType =
|
|
2866
|
+
static from(modelType, idProperty, titleProperty, tableEditorType = TableviewEditorTypeEnum.None) {
|
|
2711
2867
|
return EditorDescriptor.fromModelWithAttributes(modelType, TableviewUtil.getAttributeDefMap(modelType), titleProperty, idProperty, tableEditorType);
|
|
2712
2868
|
}
|
|
2713
2869
|
/**
|
|
@@ -2719,7 +2875,7 @@ class EditorDescriptor {
|
|
|
2719
2875
|
* @param titleProperty
|
|
2720
2876
|
* @param tableEditorType
|
|
2721
2877
|
*/
|
|
2722
|
-
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty, tableEditorType =
|
|
2878
|
+
static fromModelWithAttributes(modelType, attributes, idProperty, titleProperty, tableEditorType = TableviewEditorTypeEnum.None) {
|
|
2723
2879
|
const descriptor = new EditorDescriptor(modelType, idProperty, titleProperty, tableEditorType);
|
|
2724
2880
|
attributes
|
|
2725
2881
|
.filter(attr => !attr.type.includes('Set') && !attr.type.includes('Array'))
|
|
@@ -2735,9 +2891,6 @@ class EditorDescriptor {
|
|
|
2735
2891
|
get fields() {
|
|
2736
2892
|
return this._fields;
|
|
2737
2893
|
}
|
|
2738
|
-
get tableviewEditorType() {
|
|
2739
|
-
return this._disabled;
|
|
2740
|
-
}
|
|
2741
2894
|
get disabled() {
|
|
2742
2895
|
return this._disabled;
|
|
2743
2896
|
}
|
|
@@ -3708,7 +3861,7 @@ class FieldManyEditorDescriptor extends AFieldDescriptor {
|
|
|
3708
3861
|
return this._tableviewDescriptor.addEditor;
|
|
3709
3862
|
}
|
|
3710
3863
|
get editorForRead() {
|
|
3711
|
-
return this._tableviewDescriptor.
|
|
3864
|
+
return this._tableviewDescriptor.detailsEditor;
|
|
3712
3865
|
}
|
|
3713
3866
|
get editorForUpdate() {
|
|
3714
3867
|
return this._tableviewDescriptor.editEditor;
|
|
@@ -4340,10 +4493,10 @@ class TableviewDescriptor {
|
|
|
4340
4493
|
this._modelType = modelType;
|
|
4341
4494
|
this._model = new ModelDescriptor(modelType, idProperty, titleProperty);
|
|
4342
4495
|
this._table = new TableDescriptor(modelType, idProperty, titleProperty);
|
|
4343
|
-
this.
|
|
4344
|
-
this.
|
|
4345
|
-
this._addEditor = new EditorDescriptor(modelType, idProperty, titleProperty,
|
|
4346
|
-
this._editEditor = new EditorDescriptor(modelType, idProperty, titleProperty,
|
|
4496
|
+
this._detailsEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewEditorTypeEnum.Details);
|
|
4497
|
+
this._detailsEditor.withDisabled();
|
|
4498
|
+
this._addEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewEditorTypeEnum.Add);
|
|
4499
|
+
this._editEditor = new EditorDescriptor(modelType, idProperty, titleProperty, TableviewEditorTypeEnum.Edit);
|
|
4347
4500
|
this._tableTitle = `${this._model.typeName}.name`;
|
|
4348
4501
|
}
|
|
4349
4502
|
/**
|
|
@@ -4356,7 +4509,7 @@ class TableviewDescriptor {
|
|
|
4356
4509
|
const descriptor = new TableviewDescriptor(modelType, idProperty, titleProperty);
|
|
4357
4510
|
descriptor._table = TableDescriptor.from(modelType, idProperty, titleProperty);
|
|
4358
4511
|
descriptor._editEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4359
|
-
descriptor.
|
|
4512
|
+
descriptor._detailsEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4360
4513
|
descriptor._addEditor = EditorDescriptor.from(modelType, idProperty, titleProperty);
|
|
4361
4514
|
return descriptor;
|
|
4362
4515
|
}
|
|
@@ -4373,7 +4526,7 @@ class TableviewDescriptor {
|
|
|
4373
4526
|
descriptor._table = TableDescriptor.fromModelWithAttributes(modelType, columnAttributes, idProperty, titleProperty);
|
|
4374
4527
|
if (fieldAttributes !== null) {
|
|
4375
4528
|
descriptor._editEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4376
|
-
descriptor.
|
|
4529
|
+
descriptor._detailsEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4377
4530
|
descriptor._addEditor = EditorDescriptor.fromModelWithAttributes(modelType, fieldAttributes ?? columnAttributes, idProperty, titleProperty);
|
|
4378
4531
|
}
|
|
4379
4532
|
return descriptor;
|
|
@@ -4381,8 +4534,8 @@ class TableviewDescriptor {
|
|
|
4381
4534
|
get table() {
|
|
4382
4535
|
return this._table;
|
|
4383
4536
|
}
|
|
4384
|
-
get
|
|
4385
|
-
return this.
|
|
4537
|
+
get detailsEditor() {
|
|
4538
|
+
return this._detailsEditor;
|
|
4386
4539
|
}
|
|
4387
4540
|
get addEditor() {
|
|
4388
4541
|
return this._addEditor;
|
|
@@ -4401,13 +4554,13 @@ class TableviewDescriptor {
|
|
|
4401
4554
|
return this;
|
|
4402
4555
|
}
|
|
4403
4556
|
withEditorDescriptors(descriptor) {
|
|
4404
|
-
this.
|
|
4557
|
+
this._detailsEditor = descriptor;
|
|
4405
4558
|
this._editEditor = descriptor;
|
|
4406
4559
|
this._addEditor = descriptor;
|
|
4407
4560
|
return this;
|
|
4408
4561
|
}
|
|
4409
|
-
|
|
4410
|
-
this.
|
|
4562
|
+
withDetailsDescriptor(descriptor) {
|
|
4563
|
+
this._detailsEditor = descriptor;
|
|
4411
4564
|
return this;
|
|
4412
4565
|
}
|
|
4413
4566
|
withAddDescriptor(descriptor) {
|
|
@@ -4423,7 +4576,7 @@ class TableviewDescriptor {
|
|
|
4423
4576
|
return this;
|
|
4424
4577
|
}
|
|
4425
4578
|
withValidator(name, expression) {
|
|
4426
|
-
this.
|
|
4579
|
+
this._detailsEditor.addValidation(name, expression);
|
|
4427
4580
|
this._addEditor.addValidation(name, expression);
|
|
4428
4581
|
this._editEditor.addValidation(name, expression);
|
|
4429
4582
|
return this;
|
|
@@ -4439,20 +4592,20 @@ class TableviewDescriptor {
|
|
|
4439
4592
|
}
|
|
4440
4593
|
getField(property, editorType) {
|
|
4441
4594
|
switch (editorType) {
|
|
4442
|
-
case
|
|
4595
|
+
case TableviewEditorTypeEnum.Edit:
|
|
4443
4596
|
return this._editEditor.getField(property);
|
|
4444
|
-
case
|
|
4597
|
+
case TableviewEditorTypeEnum.Add:
|
|
4445
4598
|
return this._addEditor.getField(property);
|
|
4446
|
-
case
|
|
4447
|
-
return this.
|
|
4448
|
-
case
|
|
4599
|
+
case TableviewEditorTypeEnum.Details:
|
|
4600
|
+
return this._detailsEditor.getField(property);
|
|
4601
|
+
case TableviewEditorTypeEnum.None:
|
|
4449
4602
|
return null;
|
|
4450
4603
|
}
|
|
4451
4604
|
}
|
|
4452
4605
|
removeField(property) {
|
|
4453
4606
|
this._editEditor.removeField(property);
|
|
4454
4607
|
this._addEditor.removeField(property);
|
|
4455
|
-
this.
|
|
4608
|
+
this._detailsEditor.removeField(property);
|
|
4456
4609
|
}
|
|
4457
4610
|
addColumnNumber(property, displayFormat) {
|
|
4458
4611
|
return this._table.addColumnNumber(property, displayFormat);
|
|
@@ -4470,49 +4623,49 @@ class TableviewDescriptor {
|
|
|
4470
4623
|
return this._table.addColumnCustomComponent(property, customComponentType);
|
|
4471
4624
|
}
|
|
4472
4625
|
createTabGroup(name, title) {
|
|
4473
|
-
this.
|
|
4626
|
+
this._detailsEditor.createTabGroup(name, title);
|
|
4474
4627
|
this._addEditor.createTabGroup(name, title);
|
|
4475
4628
|
this._editEditor.createTabGroup(name, title);
|
|
4476
4629
|
return this;
|
|
4477
4630
|
}
|
|
4478
4631
|
createFieldGroup(name, title) {
|
|
4479
|
-
this.
|
|
4632
|
+
this._detailsEditor.createFieldGroup(name, title);
|
|
4480
4633
|
this._addEditor.createFieldGroup(name, title);
|
|
4481
4634
|
this._editEditor.createFieldGroup(name, title);
|
|
4482
4635
|
return this;
|
|
4483
4636
|
}
|
|
4484
4637
|
addFieldDescriptor(field) {
|
|
4485
|
-
this.
|
|
4638
|
+
this._detailsEditor.addFieldDescriptor(field);
|
|
4486
4639
|
this._addEditor.addFieldDescriptor(field);
|
|
4487
4640
|
this._editEditor.addFieldDescriptor(field);
|
|
4488
4641
|
return this;
|
|
4489
4642
|
}
|
|
4490
4643
|
addField(property) {
|
|
4491
|
-
const field = this.
|
|
4644
|
+
const field = this._detailsEditor.addField(property);
|
|
4492
4645
|
this._addEditor.addFieldDescriptor(field);
|
|
4493
4646
|
this._editEditor.addFieldDescriptor(field);
|
|
4494
4647
|
return field;
|
|
4495
4648
|
}
|
|
4496
4649
|
addFieldLookup(property, modelType) {
|
|
4497
|
-
const field = this.
|
|
4650
|
+
const field = this._detailsEditor.addFieldLookup(property, modelType);
|
|
4498
4651
|
this._addEditor.addFieldDescriptor(field);
|
|
4499
4652
|
this._editEditor.addFieldDescriptor(field);
|
|
4500
4653
|
return field;
|
|
4501
4654
|
}
|
|
4502
4655
|
addFieldLookupEnum(property, enumType, options, nameAsValue = false, optionsTitlePath) {
|
|
4503
|
-
const field = this.
|
|
4656
|
+
const field = this._detailsEditor.addFieldLookupEnum(property, enumType, options, nameAsValue, optionsTitlePath);
|
|
4504
4657
|
this._addEditor.addFieldDescriptor(field);
|
|
4505
4658
|
this._editEditor.addFieldDescriptor(field);
|
|
4506
4659
|
return field;
|
|
4507
4660
|
}
|
|
4508
4661
|
addFieldManyEditor(property, tableviewDescriptor) {
|
|
4509
|
-
const field = this.
|
|
4662
|
+
const field = this._detailsEditor.addFieldManyEditor(property, tableviewDescriptor);
|
|
4510
4663
|
this._addEditor.addFieldDescriptor(field);
|
|
4511
4664
|
this._editEditor.addFieldDescriptor(field);
|
|
4512
4665
|
return field;
|
|
4513
4666
|
}
|
|
4514
4667
|
addFieldManyToManyEditor(property, mainTableDescriptor, lookupTableDescriptor) {
|
|
4515
|
-
const field = this.
|
|
4668
|
+
const field = this._detailsEditor.addFieldManyToManyEditor(property, mainTableDescriptor, lookupTableDescriptor);
|
|
4516
4669
|
this._addEditor.addFieldDescriptor(field);
|
|
4517
4670
|
this._editEditor.addFieldDescriptor(field);
|
|
4518
4671
|
return field;
|
|
@@ -4520,7 +4673,7 @@ class TableviewDescriptor {
|
|
|
4520
4673
|
copy() {
|
|
4521
4674
|
const tableview = new TableviewDescriptor(this._model.type, this._model.idPropertyName, this._model.titlePropertyName);
|
|
4522
4675
|
tableview._table = this._table.copy();
|
|
4523
|
-
tableview.
|
|
4676
|
+
tableview._detailsEditor = this._detailsEditor.copy();
|
|
4524
4677
|
tableview._addEditor = this._addEditor.copy();
|
|
4525
4678
|
tableview._editEditor = this._editEditor.copy();
|
|
4526
4679
|
return tableview;
|
|
@@ -4546,7 +4699,7 @@ class TableviewDescriptor {
|
|
|
4546
4699
|
this._table.withColumnModifiedType(property, columnType);
|
|
4547
4700
|
this._editEditor.withFieldModifiedType(property, fieldType);
|
|
4548
4701
|
this._addEditor.withFieldModifiedType(property, fieldType);
|
|
4549
|
-
this.
|
|
4702
|
+
this._detailsEditor.withFieldModifiedType(property, fieldType);
|
|
4550
4703
|
}
|
|
4551
4704
|
return this;
|
|
4552
4705
|
}
|
|
@@ -4563,7 +4716,7 @@ class TableviewDescriptor {
|
|
|
4563
4716
|
attributeDef.fieldType = fieldType ?? FieldInputTypeEnum.Text;
|
|
4564
4717
|
this._table.withColumnModifiedEnum(property, enumType);
|
|
4565
4718
|
this._editEditor.withFieldModifiedEnum(property, enumType);
|
|
4566
|
-
this.
|
|
4719
|
+
this._detailsEditor.withFieldModifiedEnum(property, enumType);
|
|
4567
4720
|
this._addEditor.withFieldModifiedEnum(property, enumType);
|
|
4568
4721
|
}
|
|
4569
4722
|
return this;
|
|
@@ -4589,7 +4742,7 @@ class TableviewDescriptor {
|
|
|
4589
4742
|
if (lookupProvider != null) {
|
|
4590
4743
|
this._table.withColumnModifiedLookup(property, lookupProvider, itemsLabelProperty, filterProperty);
|
|
4591
4744
|
this._addEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4592
|
-
this.
|
|
4745
|
+
this._detailsEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4593
4746
|
this._editEditor.withFieldModifiedLookup(property, modelType, lookupProvider, itemsLabelProperty);
|
|
4594
4747
|
}
|
|
4595
4748
|
else {
|
|
@@ -5864,256 +6017,99 @@ MediusRestUtil.matchModeMapping = [
|
|
|
5864
6017
|
[FilterMatchMode.DATE_IS_NOT, 'neq', MediusFilterMatchType.NotEquals, FilterTypeEnum.Date]
|
|
5865
6018
|
];
|
|
5866
6019
|
|
|
5867
|
-
|
|
5868
|
-
|
|
5869
|
-
|
|
5870
|
-
|
|
5871
|
-
|
|
5872
|
-
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
class ActionInstance {
|
|
5879
|
-
constructor(action, state = ActionInstanceStateEnum.TriggerStart, debug = false) {
|
|
5880
|
-
this.debug = debug;
|
|
5881
|
-
// function execution
|
|
5882
|
-
this.isRunLoadingSubject = new BehaviorSubject(false);
|
|
5883
|
-
this.contexts = [];
|
|
5884
|
-
this.executionSubject = new Subject();
|
|
5885
|
-
this.executionIsRunningSubject = new BehaviorSubject(false);
|
|
5886
|
-
this.stateSubject = new BehaviorSubject(1);
|
|
5887
|
-
this.resultSubject = new ReplaySubject(1);
|
|
5888
|
-
this.errorSubject = new ReplaySubject(1);
|
|
5889
|
-
this.contextExecutionSubscriptions = [];
|
|
5890
|
-
this.instanceId = Math.random().toString(36).substring(2);
|
|
5891
|
-
this.instanceLongName = `${action.actionNameLong}_${this.instanceId}`;
|
|
5892
|
-
this.action = action;
|
|
5893
|
-
this.state = state;
|
|
5894
|
-
}
|
|
5895
|
-
get isRunLoading$() {
|
|
5896
|
-
return this.isRunLoadingSubject.asObservable();
|
|
5897
|
-
}
|
|
5898
|
-
get context() {
|
|
5899
|
-
return this.contexts.length === 0 ? undefined : this.contexts[this.contexts.length - 1];
|
|
5900
|
-
}
|
|
5901
|
-
get execution$() {
|
|
5902
|
-
return this.executionSubject.asObservable();
|
|
5903
|
-
}
|
|
5904
|
-
get executionIsRunning$() {
|
|
5905
|
-
return this.executionIsRunningSubject.asObservable().pipe(distinctUntilChanged());
|
|
5906
|
-
}
|
|
5907
|
-
get state() {
|
|
5908
|
-
return this.stateSubject.value;
|
|
5909
|
-
}
|
|
5910
|
-
set state(state) {
|
|
5911
|
-
if (state > this.stateSubject.value) {
|
|
5912
|
-
if (this.debug) {
|
|
5913
|
-
console.debug(`ActionInstance ${this.instanceLongName} - state #${state}: ${ActionInstanceStateEnum[state]}`);
|
|
5914
|
-
}
|
|
5915
|
-
this.stateSubject.next(state);
|
|
5916
|
-
}
|
|
5917
|
-
}
|
|
5918
|
-
get state$() {
|
|
5919
|
-
return this.stateSubject.asObservable().pipe(distinctUntilChanged());
|
|
5920
|
-
}
|
|
5921
|
-
get result() {
|
|
5922
|
-
return this._result;
|
|
5923
|
-
}
|
|
5924
|
-
set result(result) {
|
|
5925
|
-
if (typeof result === 'undefined') {
|
|
5926
|
-
return;
|
|
5927
|
-
}
|
|
5928
|
-
if (this.debug) {
|
|
5929
|
-
console.debug(`ActionInstance ${this.instanceLongName} - result`, result);
|
|
5930
|
-
}
|
|
5931
|
-
this._result = result;
|
|
5932
|
-
this.resultSubject.next(result);
|
|
5933
|
-
}
|
|
5934
|
-
get result$() {
|
|
5935
|
-
return this.resultSubject.asObservable();
|
|
5936
|
-
}
|
|
5937
|
-
get error() {
|
|
5938
|
-
return this._error;
|
|
5939
|
-
}
|
|
5940
|
-
set error(error) {
|
|
5941
|
-
if (typeof error === 'undefined') {
|
|
5942
|
-
return;
|
|
5943
|
-
}
|
|
5944
|
-
if (this.debug) {
|
|
5945
|
-
console.debug(`ActionInstance ${this.instanceLongName} - error`, error);
|
|
5946
|
-
}
|
|
5947
|
-
this._error = error;
|
|
5948
|
-
this.errorSubject.next(error);
|
|
5949
|
-
}
|
|
5950
|
-
get error$() {
|
|
5951
|
-
return this.errorSubject.asObservable();
|
|
6020
|
+
var AuthorizationTypeEnum;
|
|
6021
|
+
(function (AuthorizationTypeEnum) {
|
|
6022
|
+
AuthorizationTypeEnum["All"] = "ALL";
|
|
6023
|
+
AuthorizationTypeEnum["Any"] = "ANY";
|
|
6024
|
+
AuthorizationTypeEnum["Rbac"] = "ROLE_BASED_ACCESS_CONTROL";
|
|
6025
|
+
AuthorizationTypeEnum["Service"] = "SERVICE";
|
|
6026
|
+
})(AuthorizationTypeEnum || (AuthorizationTypeEnum = {}));
|
|
6027
|
+
|
|
6028
|
+
class APermissions {
|
|
6029
|
+
constructor(type) {
|
|
6030
|
+
this._authorizationType = type;
|
|
5952
6031
|
}
|
|
5953
|
-
|
|
5954
|
-
return
|
|
6032
|
+
get authorizationType() {
|
|
6033
|
+
return this._authorizationType;
|
|
5955
6034
|
}
|
|
5956
|
-
|
|
5957
|
-
|
|
5958
|
-
|
|
5959
|
-
|
|
6035
|
+
}
|
|
6036
|
+
var Permissions;
|
|
6037
|
+
(function (Permissions) {
|
|
6038
|
+
class All extends APermissions {
|
|
6039
|
+
constructor() {
|
|
6040
|
+
super(AuthorizationTypeEnum.All);
|
|
6041
|
+
this._permissions = [];
|
|
5960
6042
|
}
|
|
5961
|
-
|
|
5962
|
-
|
|
5963
|
-
|
|
6043
|
+
static of(...permissions) {
|
|
6044
|
+
const inst = new All();
|
|
6045
|
+
inst.and(...permissions);
|
|
6046
|
+
return inst;
|
|
5964
6047
|
}
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
this.contextExecutionSubscriptions.push(context.execution$.subscribe({
|
|
5968
|
-
next: next => this.executionSubject.next(next),
|
|
5969
|
-
error: error => this.executionSubject.error(error)
|
|
5970
|
-
}));
|
|
5971
|
-
this.contextExecutionSubscriptions.push(context.executionIsRunning$.subscribe({
|
|
5972
|
-
next: next => this.executionIsRunningSubject.next(next)
|
|
5973
|
-
}));
|
|
5974
|
-
this.contexts.push(context);
|
|
5975
|
-
}
|
|
5976
|
-
finish() {
|
|
5977
|
-
if (this.stateSubject.value < ActionInstanceStateEnum.FinishSuccess) {
|
|
5978
|
-
this.state = ActionInstanceStateEnum.FinishSuccess;
|
|
6048
|
+
get permissions() {
|
|
6049
|
+
return this._permissions;
|
|
5979
6050
|
}
|
|
5980
|
-
|
|
5981
|
-
|
|
5982
|
-
|
|
5983
|
-
this.executionIsRunningSubject.complete();
|
|
5984
|
-
this.stateSubject.complete();
|
|
5985
|
-
this.resultSubject.complete();
|
|
5986
|
-
this.errorSubject.complete();
|
|
5987
|
-
}
|
|
5988
|
-
}
|
|
5989
|
-
/**
|
|
5990
|
-
* Class containing all main data for action to be executed in run/fetch/submit states.
|
|
5991
|
-
*/
|
|
5992
|
-
class ActionContext {
|
|
5993
|
-
constructor(instance, parameters, functionName, dataProvider, serviceInstance, executionSubject = new ReplaySubject(1), executionIsRunningSubject = new BehaviorSubject(false)) {
|
|
5994
|
-
this.instance = instance;
|
|
5995
|
-
this.parameters = parameters;
|
|
5996
|
-
this.functionName = functionName;
|
|
5997
|
-
this.dataProvider = dataProvider;
|
|
5998
|
-
this.serviceInstance = serviceInstance;
|
|
5999
|
-
this.executionSubject = executionSubject;
|
|
6000
|
-
this.executionIsRunningSubject = executionIsRunningSubject;
|
|
6001
|
-
this.contextLongName = `${this.instance.instanceLongName}_${functionName}`;
|
|
6002
|
-
}
|
|
6003
|
-
get execution$() {
|
|
6004
|
-
return this.executionSubject.asObservable();
|
|
6005
|
-
}
|
|
6006
|
-
get executionIsRunning$() {
|
|
6007
|
-
return this.executionIsRunningSubject.asObservable().pipe(distinctUntilChanged());
|
|
6008
|
-
}
|
|
6009
|
-
executionStart() {
|
|
6010
|
-
if (this.instance.debug) {
|
|
6011
|
-
console.debug(`ActionContext ${this.contextLongName} - execution start`);
|
|
6051
|
+
and(...permissions) {
|
|
6052
|
+
this._permissions.push(...permissions);
|
|
6053
|
+
return this;
|
|
6012
6054
|
}
|
|
6013
|
-
this.executionIsRunningSubject.next(true);
|
|
6014
6055
|
}
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6056
|
+
Permissions.All = All;
|
|
6057
|
+
class Any extends APermissions {
|
|
6058
|
+
constructor() {
|
|
6059
|
+
super(AuthorizationTypeEnum.Any);
|
|
6060
|
+
this._permissions = [];
|
|
6018
6061
|
}
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6062
|
+
static of(...permissions) {
|
|
6063
|
+
const inst = new Any();
|
|
6064
|
+
inst.or(...permissions);
|
|
6065
|
+
return inst;
|
|
6022
6066
|
}
|
|
6023
|
-
|
|
6024
|
-
|
|
6025
|
-
if (this.instance.debug) {
|
|
6026
|
-
console.debug(`ActionContext ${this.contextLongName} - execution complete`);
|
|
6067
|
+
get permissions() {
|
|
6068
|
+
return this._permissions;
|
|
6027
6069
|
}
|
|
6028
|
-
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
executionError(err) {
|
|
6032
|
-
if (this.instance.debug) {
|
|
6033
|
-
console.debug(`ActionContext ${this.contextLongName} - execution error`, err);
|
|
6070
|
+
or(...permissions) {
|
|
6071
|
+
this._permissions.push(...permissions);
|
|
6072
|
+
return this;
|
|
6034
6073
|
}
|
|
6035
|
-
this.executionSubject.error(err);
|
|
6036
|
-
this.executionIsRunningSubject.next(false);
|
|
6037
|
-
}
|
|
6038
|
-
finish() {
|
|
6039
|
-
this.executionSubject.complete();
|
|
6040
|
-
this.executionIsRunningSubject.complete();
|
|
6041
|
-
}
|
|
6042
|
-
}
|
|
6043
|
-
/**
|
|
6044
|
-
* Class containing all main data for action validations (enabled/visible) to be executed in validation states.
|
|
6045
|
-
*/
|
|
6046
|
-
class ActionContextValidation {
|
|
6047
|
-
constructor(descriptor, parameters, dataProvider, serviceInstance) {
|
|
6048
|
-
this.descriptor = descriptor;
|
|
6049
|
-
this.parameters = parameters;
|
|
6050
|
-
this.dataProvider = dataProvider;
|
|
6051
|
-
this.serviceInstance = serviceInstance;
|
|
6052
|
-
}
|
|
6053
|
-
}
|
|
6054
|
-
class ActionParameters {
|
|
6055
|
-
constructor(itemId, item) {
|
|
6056
|
-
this.itemId = itemId;
|
|
6057
|
-
this.item = item;
|
|
6058
|
-
this.selectedItems = [];
|
|
6059
|
-
}
|
|
6060
|
-
withActionData(actionData) {
|
|
6061
|
-
this.actionData = actionData;
|
|
6062
|
-
return this;
|
|
6063
|
-
}
|
|
6064
|
-
withQueryParam(queryParam) {
|
|
6065
|
-
this.queryParam = queryParam;
|
|
6066
|
-
return this;
|
|
6067
|
-
}
|
|
6068
|
-
withViewContainer(viewContainer) {
|
|
6069
|
-
this.viewContainer = viewContainer;
|
|
6070
|
-
return this;
|
|
6071
|
-
}
|
|
6072
|
-
withSourceComponent(sourceComponent) {
|
|
6073
|
-
this.sourceComponent = sourceComponent;
|
|
6074
|
-
return this;
|
|
6075
6074
|
}
|
|
6076
|
-
|
|
6077
|
-
|
|
6078
|
-
|
|
6075
|
+
Permissions.Any = Any;
|
|
6076
|
+
class Roles extends APermissions {
|
|
6077
|
+
constructor() {
|
|
6078
|
+
super(AuthorizationTypeEnum.Rbac);
|
|
6079
|
+
this._roles = [];
|
|
6080
|
+
}
|
|
6081
|
+
static of(...roles) {
|
|
6082
|
+
const inst = new Roles();
|
|
6083
|
+
inst.or(...roles);
|
|
6084
|
+
return inst;
|
|
6085
|
+
}
|
|
6086
|
+
get roles() {
|
|
6087
|
+
return this._roles;
|
|
6088
|
+
}
|
|
6089
|
+
and(...roles) {
|
|
6090
|
+
if (this._roles.length === 0) {
|
|
6091
|
+
this._roles.push([]);
|
|
6092
|
+
}
|
|
6093
|
+
this._roles[this._roles.length - 1].push(...roles);
|
|
6094
|
+
return this;
|
|
6095
|
+
}
|
|
6096
|
+
or(...roles) {
|
|
6097
|
+
this._roles.push(...roles.map(s => [s]));
|
|
6098
|
+
return this;
|
|
6099
|
+
}
|
|
6079
6100
|
}
|
|
6080
|
-
|
|
6081
|
-
|
|
6082
|
-
|
|
6101
|
+
Permissions.Roles = Roles;
|
|
6102
|
+
class Service extends APermissions {
|
|
6103
|
+
constructor(service) {
|
|
6104
|
+
super(AuthorizationTypeEnum.Service);
|
|
6105
|
+
this.service = service;
|
|
6106
|
+
}
|
|
6107
|
+
static of(service) {
|
|
6108
|
+
return new Service(service);
|
|
6109
|
+
}
|
|
6083
6110
|
}
|
|
6084
|
-
|
|
6085
|
-
|
|
6086
|
-
(function (ActionInstanceStateEnum) {
|
|
6087
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["TriggerStart"] = 0] = "TriggerStart";
|
|
6088
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["TriggerEnd"] = 1] = "TriggerEnd";
|
|
6089
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["ActivationStart"] = 2] = "ActivationStart";
|
|
6090
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["ActivationEnd"] = 3] = "ActivationEnd";
|
|
6091
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["FetchStart"] = 4] = "FetchStart";
|
|
6092
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["FetchEnd"] = 5] = "FetchEnd";
|
|
6093
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["FetchError"] = 6] = "FetchError";
|
|
6094
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["RunConfirmationStart"] = 7] = "RunConfirmationStart";
|
|
6095
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["RunConfirmationEndAccept"] = 8] = "RunConfirmationEndAccept";
|
|
6096
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["RunConfirmationEndReject"] = 9] = "RunConfirmationEndReject";
|
|
6097
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["RunStart"] = 10] = "RunStart";
|
|
6098
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["RunEnd"] = 11] = "RunEnd";
|
|
6099
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["RunError"] = 12] = "RunError";
|
|
6100
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["NextActionStart"] = 13] = "NextActionStart";
|
|
6101
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["NextActionEnd"] = 14] = "NextActionEnd";
|
|
6102
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishSuccess"] = 15] = "FinishSuccess";
|
|
6103
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishError"] = 16] = "FinishError";
|
|
6104
|
-
ActionInstanceStateEnum[ActionInstanceStateEnum["FinishDismissed"] = 17] = "FinishDismissed"; // action was dismissed by user
|
|
6105
|
-
})(ActionInstanceStateEnum || (ActionInstanceStateEnum = {}));
|
|
6106
|
-
|
|
6107
|
-
/**
|
|
6108
|
-
* Default categories for tableview actions
|
|
6109
|
-
*/
|
|
6110
|
-
class TableviewActionDefaultCategories {
|
|
6111
|
-
}
|
|
6112
|
-
TableviewActionDefaultCategories.READ = 'read';
|
|
6113
|
-
TableviewActionDefaultCategories.ADD = 'add';
|
|
6114
|
-
TableviewActionDefaultCategories.EDIT = 'edit';
|
|
6115
|
-
TableviewActionDefaultCategories.DELETE = 'delete';
|
|
6116
|
-
TableviewActionDefaultCategories.DETAILS = 'details';
|
|
6111
|
+
Permissions.Service = Service;
|
|
6112
|
+
})(Permissions || (Permissions = {}));
|
|
6117
6113
|
|
|
6118
6114
|
class AuthorizationUtil {
|
|
6119
6115
|
static isPermitted(permissions, userRoles) {
|
|
@@ -7468,23 +7464,36 @@ class MngViewContainerComponentService {
|
|
|
7468
7464
|
constructor(messageService) {
|
|
7469
7465
|
this.messageService = messageService;
|
|
7470
7466
|
this.actions = [];
|
|
7471
|
-
this.
|
|
7467
|
+
this._tableReloadSubject = new Subject();
|
|
7468
|
+
this._editorResetSubject = new Subject();
|
|
7472
7469
|
}
|
|
7473
7470
|
set dataProvider(dataProvider) {
|
|
7474
7471
|
this._dataProvider = dataProvider;
|
|
7475
7472
|
}
|
|
7476
|
-
get reloadTable() {
|
|
7477
|
-
return this._reloadTableSubject.asObservable();
|
|
7478
|
-
}
|
|
7479
|
-
triggerTableReload(event) {
|
|
7480
|
-
this._reloadTableSubject.next(event);
|
|
7481
|
-
}
|
|
7482
7473
|
getMessageService() {
|
|
7483
7474
|
return this.messageService;
|
|
7484
7475
|
}
|
|
7485
7476
|
getDataProvider() {
|
|
7486
7477
|
return this._dataProvider;
|
|
7487
7478
|
}
|
|
7479
|
+
getActions() {
|
|
7480
|
+
return this.actions;
|
|
7481
|
+
}
|
|
7482
|
+
setActions(actions) {
|
|
7483
|
+
this.actions = actions;
|
|
7484
|
+
}
|
|
7485
|
+
getTableReload$() {
|
|
7486
|
+
return this._tableReloadSubject.asObservable();
|
|
7487
|
+
}
|
|
7488
|
+
reloadTable(event) {
|
|
7489
|
+
this._tableReloadSubject.next(event ?? {});
|
|
7490
|
+
}
|
|
7491
|
+
getEditorReset$() {
|
|
7492
|
+
return this._editorResetSubject.asObservable();
|
|
7493
|
+
}
|
|
7494
|
+
resetEditor(event) {
|
|
7495
|
+
this._editorResetSubject.next(event ?? {});
|
|
7496
|
+
}
|
|
7488
7497
|
}
|
|
7489
7498
|
MngViewContainerComponentService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngViewContainerComponentService, deps: [{ token: i2.MessageService }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
7490
7499
|
MngViewContainerComponentService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngViewContainerComponentService });
|
|
@@ -7596,9 +7605,9 @@ class MngActionComponent {
|
|
|
7596
7605
|
if (this.action instanceof ActionLinkDescriptor) {
|
|
7597
7606
|
this.actionLink = this.action;
|
|
7598
7607
|
}
|
|
7599
|
-
if (this.action.
|
|
7600
|
-
if (routeData.tableviewPermissions[this.action.
|
|
7601
|
-
this.routePermissions = routeData.tableviewPermissions[this.action.
|
|
7608
|
+
if (this.action.tableviewCategory && routeData.tableviewPermissions) {
|
|
7609
|
+
if (routeData.tableviewPermissions[this.action.tableviewCategory]) {
|
|
7610
|
+
this.routePermissions = routeData.tableviewPermissions[this.action.tableviewCategory];
|
|
7602
7611
|
}
|
|
7603
7612
|
}
|
|
7604
7613
|
this.processSubscriptions();
|
|
@@ -7643,7 +7652,7 @@ class MngActionComponent {
|
|
|
7643
7652
|
next: () => {
|
|
7644
7653
|
this.finishEventEmitter.next(instance);
|
|
7645
7654
|
if (this.action.hasItemsSelection) {
|
|
7646
|
-
this.
|
|
7655
|
+
this.viewContainer?.reloadTable?.({ data: { event: event } });
|
|
7647
7656
|
}
|
|
7648
7657
|
}
|
|
7649
7658
|
}));
|
|
@@ -7707,10 +7716,10 @@ class MngActionComponent {
|
|
|
7707
7716
|
}
|
|
7708
7717
|
}
|
|
7709
7718
|
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 });
|
|
7710
|
-
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.button.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.button.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.button.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 });
|
|
7719
|
+
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.button.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 [pTooltip]=\"$any($tooltip | async)\"\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.button.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 [pTooltip]=\"$any($tooltip | async)\"\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.button.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 });
|
|
7711
7720
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionComponent, decorators: [{
|
|
7712
7721
|
type: Component,
|
|
7713
|
-
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.button.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.button.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.button.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"] }]
|
|
7722
|
+
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.button.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 [pTooltip]=\"$any($tooltip | async)\"\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.button.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 [pTooltip]=\"$any($tooltip | async)\"\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.button.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"] }]
|
|
7714
7723
|
}], ctorParameters: function () { return [{ type: i1.ActivatedRoute }, { type: i1$2.TranslateService }, { type: MngAuthorizationService }, { type: MngActionExecutorService }, { type: i2.ConfirmationService }, { type: MngViewContainerComponentService, decorators: [{
|
|
7715
7724
|
type: Optional
|
|
7716
7725
|
}] }]; }, propDecorators: { hostClass: [{
|
|
@@ -7760,7 +7769,7 @@ class MngActionRouteComponent {
|
|
|
7760
7769
|
this.subscriptions = [];
|
|
7761
7770
|
}
|
|
7762
7771
|
ngOnInit() {
|
|
7763
|
-
this.actions = this.viewContainerService?.
|
|
7772
|
+
this.actions = this.viewContainerService?.getActions().filter(a => a.activationTrigger === ActionActivationTriggerEnum.OnRoute) ?? [];
|
|
7764
7773
|
const subscription = this.route.params.subscribe(p => {
|
|
7765
7774
|
const action = this.findActiveAction(p);
|
|
7766
7775
|
if (action) {
|
|
@@ -7806,7 +7815,7 @@ class MngActionRouteComponent {
|
|
|
7806
7815
|
if (!this.viewContainerService) {
|
|
7807
7816
|
console.warn(`View container service could not be found, table reload will not be triggered.`);
|
|
7808
7817
|
}
|
|
7809
|
-
this.viewContainerService?.
|
|
7818
|
+
this.viewContainerService?.reloadTable({ data: { event: actionEv } }); // reload only if no error in action and
|
|
7810
7819
|
}
|
|
7811
7820
|
this.untriggerAction();
|
|
7812
7821
|
});
|
|
@@ -8006,6 +8015,34 @@ class MngFormEditorComponent {
|
|
|
8006
8015
|
});
|
|
8007
8016
|
return formValue;
|
|
8008
8017
|
}
|
|
8018
|
+
resetFormModel(item) {
|
|
8019
|
+
this.formOrigItem = item;
|
|
8020
|
+
// TODO: to check if this is ok, could be problems with dates, if so, try lodash
|
|
8021
|
+
const formModel = JSON.parse(JSON.stringify(item ?? {}));
|
|
8022
|
+
this.descriptor.fields.forEach(field => {
|
|
8023
|
+
if (field.getter && item) {
|
|
8024
|
+
const splitPath = field.property.split('.');
|
|
8025
|
+
let currentObject = formModel;
|
|
8026
|
+
for (let i = 0; i < splitPath.length; i++) {
|
|
8027
|
+
const currentSubPath = splitPath[i];
|
|
8028
|
+
if (i === splitPath.length - 1) {
|
|
8029
|
+
currentObject[currentSubPath] = field.getter(item);
|
|
8030
|
+
}
|
|
8031
|
+
else {
|
|
8032
|
+
if (typeof currentObject[currentSubPath] !== 'object') {
|
|
8033
|
+
currentObject[currentSubPath] = {};
|
|
8034
|
+
}
|
|
8035
|
+
currentObject = currentObject[currentSubPath];
|
|
8036
|
+
}
|
|
8037
|
+
}
|
|
8038
|
+
}
|
|
8039
|
+
});
|
|
8040
|
+
if (typeof this.formOptions.resetModel === 'function') {
|
|
8041
|
+
// could not be initiated yet
|
|
8042
|
+
this.formOptions.resetModel(this.formModel);
|
|
8043
|
+
}
|
|
8044
|
+
this.formModel = formModel;
|
|
8045
|
+
}
|
|
8009
8046
|
getFormField(key) {
|
|
8010
8047
|
return this.findFormField(this.form, key.split('.'));
|
|
8011
8048
|
}
|
|
@@ -8073,34 +8110,6 @@ class MngFormEditorComponent {
|
|
|
8073
8110
|
}
|
|
8074
8111
|
return false;
|
|
8075
8112
|
}
|
|
8076
|
-
resetFormModel(item) {
|
|
8077
|
-
this.formOrigItem = item;
|
|
8078
|
-
// TODO: to check if this is ok, could be problems with dates, if so, try lodash
|
|
8079
|
-
const formModel = JSON.parse(JSON.stringify(item ?? {}));
|
|
8080
|
-
this.descriptor.fields.forEach(field => {
|
|
8081
|
-
if (field.getter && item) {
|
|
8082
|
-
const splitPath = field.property.split('.');
|
|
8083
|
-
let currentObject = formModel;
|
|
8084
|
-
for (let i = 0; i < splitPath.length; i++) {
|
|
8085
|
-
const currentSubPath = splitPath[i];
|
|
8086
|
-
if (i === splitPath.length - 1) {
|
|
8087
|
-
currentObject[currentSubPath] = field.getter(item);
|
|
8088
|
-
}
|
|
8089
|
-
else {
|
|
8090
|
-
if (typeof currentObject[currentSubPath] !== 'object') {
|
|
8091
|
-
currentObject[currentSubPath] = {};
|
|
8092
|
-
}
|
|
8093
|
-
currentObject = currentObject[currentSubPath];
|
|
8094
|
-
}
|
|
8095
|
-
}
|
|
8096
|
-
}
|
|
8097
|
-
});
|
|
8098
|
-
if (typeof this.formOptions.resetModel === 'function') {
|
|
8099
|
-
// could not be initiated yet
|
|
8100
|
-
this.formOptions.resetModel(this.formModel);
|
|
8101
|
-
}
|
|
8102
|
-
this.formModel = formModel;
|
|
8103
|
-
}
|
|
8104
8113
|
updateFormState() {
|
|
8105
8114
|
this.formOptions.formState.disabled = this.isFormDisabled !== null ? this.isFormDisabled === true : this.descriptor.disabled;
|
|
8106
8115
|
}
|
|
@@ -8732,9 +8741,7 @@ class MngActionEditorComponent {
|
|
|
8732
8741
|
this.viewContainerService = viewContainerService;
|
|
8733
8742
|
this.actionRunEventEmitter = new EventEmitter();
|
|
8734
8743
|
this.actionCancelEventEmitter = new EventEmitter();
|
|
8735
|
-
this.cmpId = Math.random().toString(36).substring(2);
|
|
8736
8744
|
this.isDialog = true;
|
|
8737
|
-
this.isSaveButton = true;
|
|
8738
8745
|
this.toolbarLeftActions = [];
|
|
8739
8746
|
this.toolbarRightActions = [];
|
|
8740
8747
|
this.footerLeftActions = [];
|
|
@@ -8774,7 +8781,6 @@ class MngActionEditorComponent {
|
|
|
8774
8781
|
this.isDialog = false;
|
|
8775
8782
|
this.viewContainer = this.viewContainerInit ?? this.viewContainerService ?? undefined;
|
|
8776
8783
|
}
|
|
8777
|
-
this.isSaveButton = typeof this.action.submitFunction === 'function';
|
|
8778
8784
|
this.setTitle();
|
|
8779
8785
|
for (const action of this.action.editorActions) {
|
|
8780
8786
|
if (action instanceof ActionEditorSubmitDescriptor) {
|
|
@@ -8799,24 +8805,32 @@ class MngActionEditorComponent {
|
|
|
8799
8805
|
});
|
|
8800
8806
|
}
|
|
8801
8807
|
}
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
case ActionPositionEnum.ToolbarRight:
|
|
8807
|
-
this.toolbarRightActions.push(action);
|
|
8808
|
-
break;
|
|
8809
|
-
case ActionPositionEnum.FooterLeft:
|
|
8810
|
-
this.footerLeftActions.push(action);
|
|
8811
|
-
break;
|
|
8812
|
-
case ActionPositionEnum.FooterRight:
|
|
8813
|
-
this.footerRightActions.push(action);
|
|
8814
|
-
break;
|
|
8815
|
-
}
|
|
8808
|
+
this.placeActionsOnPositions(action);
|
|
8809
|
+
}
|
|
8810
|
+
for (const action of this.viewContainer?.getActions().filter(value => value.positionTableviewCategories?.includes(this.action.tableviewCategory)) ?? []) {
|
|
8811
|
+
this.placeActionsOnPositions(action);
|
|
8816
8812
|
}
|
|
8817
8813
|
this.toolbarRightActions = this.toolbarRightActions.reverse();
|
|
8818
8814
|
this.footerRightActions = this.footerRightActions.reverse();
|
|
8819
8815
|
this.loadItemWithDataProvider();
|
|
8816
|
+
if (typeof this.viewContainer.getEditorReset$ === 'function') {
|
|
8817
|
+
const viewContainerEditor = this.viewContainer;
|
|
8818
|
+
viewContainerEditor.getEditorReset$().subscribe({
|
|
8819
|
+
next: e => {
|
|
8820
|
+
if (e.fetch) {
|
|
8821
|
+
this.loadItemWithDataProvider();
|
|
8822
|
+
}
|
|
8823
|
+
else if (e.item) {
|
|
8824
|
+
this.editorComponent?.resetFormModel(e.item);
|
|
8825
|
+
}
|
|
8826
|
+
else if (e.fields) {
|
|
8827
|
+
for (const key in e.fields) {
|
|
8828
|
+
this.editorComponent?.resetFormFieldValue(key, e.fields[key]);
|
|
8829
|
+
}
|
|
8830
|
+
}
|
|
8831
|
+
}
|
|
8832
|
+
});
|
|
8833
|
+
}
|
|
8820
8834
|
}
|
|
8821
8835
|
ngOnDestroy() {
|
|
8822
8836
|
this.subscriptions.forEach(s => s.unsubscribe());
|
|
@@ -8907,12 +8921,28 @@ class MngActionEditorComponent {
|
|
|
8907
8921
|
this.actionExecutor.deactivateAction(this.instance);
|
|
8908
8922
|
}
|
|
8909
8923
|
}
|
|
8924
|
+
placeActionsOnPositions(action) {
|
|
8925
|
+
switch (action.position) {
|
|
8926
|
+
case ActionPositionEnum.ToolbarLeft:
|
|
8927
|
+
this.toolbarLeftActions.push(action);
|
|
8928
|
+
break;
|
|
8929
|
+
case ActionPositionEnum.ToolbarRight:
|
|
8930
|
+
this.toolbarRightActions.push(action);
|
|
8931
|
+
break;
|
|
8932
|
+
case ActionPositionEnum.FooterLeft:
|
|
8933
|
+
this.footerLeftActions.push(action);
|
|
8934
|
+
break;
|
|
8935
|
+
case ActionPositionEnum.FooterRight:
|
|
8936
|
+
this.footerRightActions.push(action);
|
|
8937
|
+
break;
|
|
8938
|
+
}
|
|
8939
|
+
}
|
|
8910
8940
|
}
|
|
8911
8941
|
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 });
|
|
8912
|
-
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
|
|
8942
|
+
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\n *ngFor=\"let action of toolbarLeftActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action\n *ngFor=\"let action of toolbarRightActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></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\n *ngFor=\"let action of footerLeftActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></mng-action>\n </div>\n <div>\n <mng-action\n *ngFor=\"let action of footerRightActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></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 });
|
|
8913
8943
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngActionEditorComponent, decorators: [{
|
|
8914
8944
|
type: Component,
|
|
8915
|
-
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
|
|
8945
|
+
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\n *ngFor=\"let action of toolbarLeftActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></mng-action>\n </ng-template>\n <ng-template pTemplate=\"right\">\n <mng-action\n *ngFor=\"let action of toolbarRightActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></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\n *ngFor=\"let action of footerLeftActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></mng-action>\n </div>\n <div>\n <mng-action\n *ngFor=\"let action of footerRightActions\"\n [action]=\"action\"\n [disabled]=\"submitLoading$\"\n [viewContainer]=\"viewContainer\"\n [item]=\"item\"\n [itemId]=\"itemId\"></mng-action>\n </div>\n </div>\n</div>\n" }]
|
|
8916
8946
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i1$2.TranslateService }, { type: MngActionExecutorService }, { type: MngCommonsService }, { type: MngNavigationService }, { type: i3.DynamicDialogRef, decorators: [{
|
|
8917
8947
|
type: Optional
|
|
8918
8948
|
}] }, { type: i3.DynamicDialogConfig, decorators: [{
|
|
@@ -9847,8 +9877,7 @@ class MngTableviewComponent {
|
|
|
9847
9877
|
this.actionExecutor = actionExecutor;
|
|
9848
9878
|
this.viewContainerService = viewContainerService;
|
|
9849
9879
|
this.actions = [];
|
|
9850
|
-
this.
|
|
9851
|
-
this.rowInlineActions = [];
|
|
9880
|
+
this.tableActions = [];
|
|
9852
9881
|
this.toolbarLeftActions = [];
|
|
9853
9882
|
this.toolbarRightActions = [];
|
|
9854
9883
|
this.subscriptions = [];
|
|
@@ -9856,28 +9885,27 @@ class MngTableviewComponent {
|
|
|
9856
9885
|
this.selectedItems = [];
|
|
9857
9886
|
}
|
|
9858
9887
|
ngOnInit() {
|
|
9859
|
-
this.viewContainerService.
|
|
9888
|
+
this.viewContainerService.setActions(this.actions);
|
|
9860
9889
|
if (this.dataProvider) {
|
|
9861
9890
|
this.viewContainerService.dataProvider = this.dataProvider;
|
|
9862
9891
|
}
|
|
9863
|
-
const reloadTableSubscription = this.viewContainerService.
|
|
9892
|
+
const reloadTableSubscription = this.viewContainerService.getTableReload$().subscribe(() => {
|
|
9864
9893
|
this.reloadTable();
|
|
9865
9894
|
});
|
|
9866
9895
|
this.subscriptions.push(reloadTableSubscription);
|
|
9867
|
-
for (const action of this.actions) {
|
|
9896
|
+
for (const action of this.actions.filter(value => value.positionTableviewCategories?.includes(TableviewActionDefaultCategories.READ) ?? true)) {
|
|
9868
9897
|
switch (action.position) {
|
|
9869
|
-
case ActionPositionEnum.RowClick:
|
|
9870
|
-
this.rowClickActions.push(action);
|
|
9871
|
-
break;
|
|
9872
|
-
case ActionPositionEnum.RowInline:
|
|
9873
|
-
this.rowInlineActions.push(action);
|
|
9874
|
-
break;
|
|
9875
9898
|
case ActionPositionEnum.ToolbarLeft:
|
|
9876
9899
|
this.toolbarLeftActions.push(action);
|
|
9877
9900
|
break;
|
|
9878
9901
|
case ActionPositionEnum.ToolbarRight:
|
|
9879
9902
|
this.toolbarRightActions.push(action);
|
|
9880
9903
|
break;
|
|
9904
|
+
case ActionPositionEnum.TableHeader:
|
|
9905
|
+
case ActionPositionEnum.RowInline:
|
|
9906
|
+
case ActionPositionEnum.RowClick:
|
|
9907
|
+
this.tableActions.push(action);
|
|
9908
|
+
break;
|
|
9881
9909
|
}
|
|
9882
9910
|
}
|
|
9883
9911
|
this.toolbarRightActions = this.toolbarRightActions.reverse();
|
|
@@ -9901,6 +9929,9 @@ class MngTableviewComponent {
|
|
|
9901
9929
|
getDataProvider() {
|
|
9902
9930
|
return this.dataProvider;
|
|
9903
9931
|
}
|
|
9932
|
+
getActions() {
|
|
9933
|
+
return this.actions;
|
|
9934
|
+
}
|
|
9904
9935
|
reloadTable() {
|
|
9905
9936
|
this.tableComponent?.reload();
|
|
9906
9937
|
}
|
|
@@ -9912,10 +9943,10 @@ class MngTableviewComponent {
|
|
|
9912
9943
|
}
|
|
9913
9944
|
}
|
|
9914
9945
|
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 });
|
|
9915
|
-
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], queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], 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]=\"
|
|
9946
|
+
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], queries: [{ propertyName: "templates", predicate: MngTemplateDirective }], 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]=\"tableActions\"\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\n <ng-template let-queryResult=\"queryResult\" mngTemplate=\"footer\">\n <ng-container *ngIf=\"footerTemplate\" [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{queryResult: queryResult}\"></ng-container>\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$1.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { 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" }] });
|
|
9916
9947
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngTableviewComponent, decorators: [{
|
|
9917
9948
|
type: Component,
|
|
9918
|
-
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]=\"
|
|
9949
|
+
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]=\"tableActions\"\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\n <ng-template let-queryResult=\"queryResult\" mngTemplate=\"footer\">\n <ng-container *ngIf=\"footerTemplate\" [ngTemplateOutlet]=\"footerTemplate\" [ngTemplateOutletContext]=\"{queryResult: queryResult}\"></ng-container>\n </ng-template>\n </mng-table>\n </div>\n\n <router-outlet></router-outlet>\n</div>\n" }]
|
|
9919
9950
|
}], 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: [{
|
|
9920
9951
|
type: Input
|
|
9921
9952
|
}], dataProvider: [{
|
|
@@ -9952,7 +9983,7 @@ class AMngTableviewRouteComponent {
|
|
|
9952
9983
|
this.createActionDescriptorForExport()
|
|
9953
9984
|
].filter(e => e != null);
|
|
9954
9985
|
}
|
|
9955
|
-
createActionDescriptorForDetails(descriptor = this.descriptor.
|
|
9986
|
+
createActionDescriptorForDetails(descriptor = this.descriptor.detailsEditor) {
|
|
9956
9987
|
return !this.routeData.tableviewActions || this.routeData.tableviewActions.hasDetails ? new ActionEditorDetailsDescriptor(descriptor) : null;
|
|
9957
9988
|
}
|
|
9958
9989
|
createActionDescriptorForAdd(descriptor = this.descriptor.addEditor) {
|
|
@@ -9984,10 +10015,10 @@ class AMngTableviewRouteComponent {
|
|
|
9984
10015
|
createActionDescriptorForRefresh(descriptor = this.descriptor.model) {
|
|
9985
10016
|
const action = new ActionDescriptor(descriptor, 'refresh')
|
|
9986
10017
|
.withPosition(ActionPositionEnum.ToolbarRight)
|
|
9987
|
-
.
|
|
10018
|
+
.withTableviewCategory(TableviewActionDefaultCategories.READ)
|
|
9988
10019
|
.withRunNotificationSuccess(undefined, undefined, false)
|
|
9989
10020
|
.withRunFunction((ctx) => {
|
|
9990
|
-
ctx.parameters.viewContainer
|
|
10021
|
+
ctx.parameters.viewContainer?.reloadTable?.({});
|
|
9991
10022
|
return of(null);
|
|
9992
10023
|
});
|
|
9993
10024
|
action.button.withIcon('pi pi-refresh').styleClass.withActionLevel(StyleLevelEnum.Secondary);
|
|
@@ -10209,9 +10240,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImpor
|
|
|
10209
10240
|
}] } });
|
|
10210
10241
|
|
|
10211
10242
|
class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
10212
|
-
constructor(
|
|
10213
|
-
super();
|
|
10214
|
-
this.actionExecutor = actionExecutor;
|
|
10243
|
+
constructor() {
|
|
10244
|
+
super(...arguments);
|
|
10215
10245
|
this.itemsSubject = new ReplaySubject(1);
|
|
10216
10246
|
this.items$ = this.itemsSubject.asObservable();
|
|
10217
10247
|
this.actions = [];
|
|
@@ -10221,13 +10251,13 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
10221
10251
|
this.isEnabled$ = this.isDisabledSubject.asObservable().pipe(distinctUntilChanged(), map(e => !e));
|
|
10222
10252
|
}
|
|
10223
10253
|
ngOnInit() {
|
|
10224
|
-
this.descriptor = this.
|
|
10254
|
+
this.descriptor = this.props['descriptor'];
|
|
10225
10255
|
const hasViewAction = this.descriptor.fieldActions.some(a => a === FieldManyEditorActionEnum.View);
|
|
10226
10256
|
const hasAddAction = this.descriptor.fieldActions.some(a => a === FieldManyEditorActionEnum.Add);
|
|
10227
10257
|
const hasEditAction = this.descriptor.fieldActions.some(a => a === FieldManyEditorActionEnum.Edit);
|
|
10228
10258
|
const hasDeleteAction = this.descriptor.fieldActions.some(a => a === FieldManyEditorActionEnum.Delete);
|
|
10229
10259
|
if (hasViewAction) {
|
|
10230
|
-
const viewAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.
|
|
10260
|
+
const viewAction = new ActionEditorDescriptor(this.descriptor.tableviewDescriptor.detailsEditor, 'details', this.descriptor.editor.model.type, this.descriptor.property)
|
|
10231
10261
|
.withPosition(ActionPositionEnum.RowClick)
|
|
10232
10262
|
.withDialogClassName('mng-field-dialog mng-action-editor-dialog')
|
|
10233
10263
|
.withDialogSize(StyleSizeEnum.Small);
|
|
@@ -10357,12 +10387,12 @@ class MngFormlyFieldTableDialogFormComponent extends FieldType {
|
|
|
10357
10387
|
});
|
|
10358
10388
|
}
|
|
10359
10389
|
}
|
|
10360
|
-
MngFormlyFieldTableDialogFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, deps:
|
|
10390
|
+
MngFormlyFieldTableDialogFormComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
10361
10391
|
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 });
|
|
10362
10392
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.0", ngImport: i0, type: MngFormlyFieldTableDialogFormComponent, decorators: [{
|
|
10363
10393
|
type: Component,
|
|
10364
10394
|
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"] }]
|
|
10365
|
-
}]
|
|
10395
|
+
}] });
|
|
10366
10396
|
|
|
10367
10397
|
class MngFormlyFieldTableDialogMultiselectComponent extends FieldType {
|
|
10368
10398
|
constructor(injector) {
|
|
@@ -12506,7 +12536,7 @@ class TableviewRouteBuilder {
|
|
|
12506
12536
|
}
|
|
12507
12537
|
return this;
|
|
12508
12538
|
}
|
|
12509
|
-
|
|
12539
|
+
withPermissionByCategory(key, permissions) {
|
|
12510
12540
|
if (!this.permissions) {
|
|
12511
12541
|
this.permissions = {};
|
|
12512
12542
|
}
|
|
@@ -12589,5 +12619,5 @@ class TableviewRouteBuilder {
|
|
|
12589
12619
|
* Generated bundle index. Do not edit.
|
|
12590
12620
|
*/
|
|
12591
12621
|
|
|
12592
|
-
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionButtonDescriptor, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, 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_DATE_RANGE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDateRangeComponent, 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, StyleLevelEnum, StyleSizeEnum, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor,
|
|
12622
|
+
export { ACTION_EDITOR_DIALOG_COMPONENT_SETTING, AFieldDescriptor, AFieldGroupDescriptor, AGenericFieldDescriptor, AMngApiService, AMngBaseApiService, AMngCrudApiService, AMngGetAllApiService, AMngTableviewRouteComponent, APermissions, ActionActivationTriggerEnum, ActionButtonDescriptor, ActionConfirmationDialogDescriptor, ActionContext, ActionContextValidation, ActionDataProviderUtil, ActionDeleteDescriptor, ActionDescriptor, ActionEditorAddDescriptor, ActionEditorDescriptor, ActionEditorDetailsDescriptor, ActionEditorEditDescriptor, ActionEditorSubmitDescriptor, ActionEditorSubmitTypeEnum, ActionError, ActionInstance, ActionInstanceStateEnum, ActionLinkDescriptor, ActionParameters, ActionPositionEnum, ActionSimpleDescriptor, ActionTypeEnum, AuthorizationTypeEnum, AuthorizationUtil, ButtonStyleBuilder, ButtonStyleRoundedEnum, ColumnDescriptor, ColumnDynamicDescriptor, ColumnTypeEnum, DataProvider, DateUtil, 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_DATE_RANGE_VALUE_ACCESSOR, MNG_DROPDOWN_VALUE_ACCESSOR, MNG_MODULE_CONFIG_IT, MediusFilterMatchType, MediusFilterParam, MediusQueryMode, MediusQueryParam, MediusQueryParamBuilder, MediusQueryResult, MediusRestUtil, MngActionComponent, MngActionEditorComponent, MngActionExecutorService, MngActionRouteComponent, MngAuthorizationGuard, MngAuthorizationService, MngAutocompleteComponent, MngBooleanPipe, MngBreadcrumbComponent, MngClassMapPipe, MngCommonsModule, MngCommonsService, MngComponentDirective, MngConfigurationService, MngDateRangeComponent, 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, StyleLevelEnum, StyleSizeEnum, StylesUtil, TableDataProvider, TableDescriptor, TableDynamicColumnsModeEnum, TableDynamicDescriptor, TableFilterDisplayEnum, TablePaginationModeEnum, TableSizeEnum, TableviewActionDefaultCategories, TableviewCrudDataProvider, TableviewDataProvider, TableviewDescriptor, TableviewDynamicDescriptor, TableviewEditorTypeEnum, TableviewRouteBuilder, TypeName, TypeUtil, enumNameDecoratorPropertyName, enumsMapBase, formlyTypesConfig, formlyWrappersConfig, getEmailValidationMessage, getFormlyValidationMessages, getMaxLengthValidationMessage, getMinLengthValidationMessage, getRequiredValidationMessage, getTextPatternValidationMessage, mngConfigJsonAppInitializerProvider, mngConfigurationServiceProvider, mngFormlyConfigProvider, primeNgModules, typeMapBase, typeNameDecoratorPropertyName };
|
|
12593
12623
|
//# sourceMappingURL=mediusinc-mng-commons.mjs.map
|