tuain-ng-forms-lib 15.0.30 → 15.1.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.
@@ -2720,16 +2720,35 @@ class LibFormManagerService {
2720
2720
  }
2721
2721
 
2722
2722
  class LibEventManagerService {
2723
- constructor(eventNames) {
2723
+ constructor(eventSet) {
2724
2724
  this.eventSubjects = {};
2725
- eventNames.forEach((name) => { this.addEventName(name); });
2726
- }
2727
- addEventName(name) {
2728
- if (!this.eventSubjects[name]) {
2729
- const newEventSubject = new ReplaySubject(1);
2730
- this.eventSubjects[name] = newEventSubject;
2725
+ this.eventSubjectParams = {};
2726
+ eventSet.forEach((event) => { this.addEventName(event); });
2727
+ }
2728
+ addEventName(event, rebuild = false) {
2729
+ const eventObject = (typeof event === 'string') ? { name: event } : event;
2730
+ const { name, type, initialValue, windowTime, timestampProvider } = eventObject;
2731
+ const currentSubject = this.eventSubjects[name];
2732
+ if (rebuild || !currentSubject) {
2733
+ if (type === 'beahavior') {
2734
+ const newEventSubject = new BehaviorSubject(initialValue);
2735
+ this.eventSubjects[name] = newEventSubject;
2736
+ }
2737
+ else if (type === 'subject') {
2738
+ const newEventSubject = new Subject();
2739
+ this.eventSubjects[name] = newEventSubject;
2740
+ }
2741
+ else {
2742
+ const newEventSubject = new ReplaySubject(initialValue, windowTime, timestampProvider);
2743
+ this.eventSubjects[name] = newEventSubject;
2744
+ }
2745
+ this.eventSubjectParams[name] = { name: name, windowTime, timestampProvider };
2731
2746
  }
2732
2747
  }
2748
+ resetSubject(eventClassName) {
2749
+ const { name, windowTime, timestampProvider } = this.eventSubjectParams[eventClassName];
2750
+ return this.addEventName({ name, windowTime, timestampProvider });
2751
+ }
2733
2752
  getEventNames() { return Object.keys(this.eventSubjects); }
2734
2753
  getSubject(eventClassName) { return eventClassName ? this.eventSubjects[eventClassName] : null; }
2735
2754
  subscribe(eventClassName, callback) { return this.getSubject(eventClassName).subscribe(callback); }
@@ -3046,6 +3065,9 @@ class BasicFormComponent extends FormStructureAndData {
3046
3065
  this.errorDetail = '';
3047
3066
  this.busy = true;
3048
3067
  const formActionResponse = await this.formManagerService.execServerAction(actionDetail);
3068
+ if (!formActionResponse) {
3069
+ return null;
3070
+ }
3049
3071
  this.busy = false;
3050
3072
  if (formActionResponse.hasError()) {
3051
3073
  const error = formActionResponse.error;