tuain-ng-forms-lib 15.0.28 → 15.0.31
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/classes/forms/form.mjs +7 -3
- package/esm2020/lib/components/forms/basic-form.mjs +4 -1
- package/esm2020/lib/services/event-manager.service.mjs +23 -6
- package/fesm2015/tuain-ng-forms-lib.mjs +31 -7
- package/fesm2015/tuain-ng-forms-lib.mjs.map +1 -1
- package/fesm2020/tuain-ng-forms-lib.mjs +31 -7
- package/fesm2020/tuain-ng-forms-lib.mjs.map +1 -1
- package/lib/classes/forms/form.d.ts +3 -1
- package/lib/services/event-manager.service.d.ts +4 -2
- package/package.json +1 -1
|
@@ -2119,6 +2119,7 @@ class FormStructureAndData {
|
|
|
2119
2119
|
this.stateFlow = {
|
|
2120
2120
|
defaultState: '',
|
|
2121
2121
|
states: [],
|
|
2122
|
+
stateDescriptions: [],
|
|
2122
2123
|
transitions: [],
|
|
2123
2124
|
};
|
|
2124
2125
|
}
|
|
@@ -2133,6 +2134,7 @@ class FormStructureAndData {
|
|
|
2133
2134
|
this.stateFlow = {
|
|
2134
2135
|
defaultState: '',
|
|
2135
2136
|
states: [],
|
|
2137
|
+
stateDescriptions: [],
|
|
2136
2138
|
transitions: [],
|
|
2137
2139
|
};
|
|
2138
2140
|
}
|
|
@@ -2145,7 +2147,7 @@ class FormStructureAndData {
|
|
|
2145
2147
|
this.name = this.name ?? definitionReceived?.form?.formCode;
|
|
2146
2148
|
this.title = (definitionReceived.form && definitionReceived.form.formTitle)
|
|
2147
2149
|
? definitionReceived.form.formTitle : '';
|
|
2148
|
-
this.setStateFlow(definitionReceived?.states, definitionReceived?.transitions, definitionReceived?.defaultState);
|
|
2150
|
+
this.setStateFlow(definitionReceived?.states, definitionReceived?.transitions, definitionReceived?.defaultState, definitionReceived?.stateDescriptions);
|
|
2149
2151
|
this.immutableData = definitionReceived.immutableData;
|
|
2150
2152
|
this.extraInfo = definitionReceived.extraInfo;
|
|
2151
2153
|
this.customAttributes = {};
|
|
@@ -2238,6 +2240,7 @@ class FormStructureAndData {
|
|
|
2238
2240
|
// Estados
|
|
2239
2241
|
get defaultState() { return this.stateFlow.defaultState; }
|
|
2240
2242
|
get states() { return this.stateFlow.states; }
|
|
2243
|
+
get stateDescriptions() { return this.stateFlow.stateDescriptions; }
|
|
2241
2244
|
supportState(state = '') { return (!!state && this.stateFlow.states?.includes(state)); }
|
|
2242
2245
|
changeState(newState) {
|
|
2243
2246
|
const currentState = this.state;
|
|
@@ -2257,8 +2260,9 @@ class FormStructureAndData {
|
|
|
2257
2260
|
return (this.state === newState);
|
|
2258
2261
|
}
|
|
2259
2262
|
get stateChange() { return this._stateChange; }
|
|
2260
|
-
setStateFlow(states, transitions, defaultState) {
|
|
2263
|
+
setStateFlow(states, transitions, defaultState, stateDescriptions = []) {
|
|
2261
2264
|
this.stateFlow.states = states;
|
|
2265
|
+
this.stateFlow.stateDescriptions = stateDescriptions;
|
|
2262
2266
|
this.stateFlow.defaultState = defaultState || this.stateFlow.states[0];
|
|
2263
2267
|
this.stateFlow.transitions = transitions.map(transition => {
|
|
2264
2268
|
const name = transition.name;
|
|
@@ -2716,16 +2720,33 @@ class LibFormManagerService {
|
|
|
2716
2720
|
}
|
|
2717
2721
|
|
|
2718
2722
|
class LibEventManagerService {
|
|
2719
|
-
constructor(
|
|
2723
|
+
constructor(eventSet) {
|
|
2720
2724
|
this.eventSubjects = {};
|
|
2721
|
-
|
|
2725
|
+
this.eventSubjectParams = {};
|
|
2726
|
+
eventSet.forEach((event) => { this.addEventName(event); });
|
|
2722
2727
|
}
|
|
2723
|
-
addEventName(
|
|
2724
|
-
|
|
2725
|
-
|
|
2728
|
+
addEventName(event, rebuild = false) {
|
|
2729
|
+
let name;
|
|
2730
|
+
let windowTime;
|
|
2731
|
+
let timestampProvider;
|
|
2732
|
+
if (typeof event === 'string') {
|
|
2733
|
+
name = event;
|
|
2734
|
+
}
|
|
2735
|
+
else {
|
|
2736
|
+
name = event.name;
|
|
2737
|
+
windowTime = event.windowTime;
|
|
2738
|
+
timestampProvider = event.timestampProvider;
|
|
2739
|
+
}
|
|
2740
|
+
if (rebuild || !this.eventSubjects[name]) {
|
|
2741
|
+
const newEventSubject = new ReplaySubject(1, windowTime, timestampProvider);
|
|
2726
2742
|
this.eventSubjects[name] = newEventSubject;
|
|
2743
|
+
this.eventSubjectParams[name] = { name, windowTime, timestampProvider };
|
|
2727
2744
|
}
|
|
2728
2745
|
}
|
|
2746
|
+
resetSubject(eventClassName) {
|
|
2747
|
+
const { name, windowTime, timestampProvider } = this.eventSubjectParams[eventClassName];
|
|
2748
|
+
return this.addEventName({ name, windowTime, timestampProvider });
|
|
2749
|
+
}
|
|
2729
2750
|
getEventNames() { return Object.keys(this.eventSubjects); }
|
|
2730
2751
|
getSubject(eventClassName) { return eventClassName ? this.eventSubjects[eventClassName] : null; }
|
|
2731
2752
|
subscribe(eventClassName, callback) { return this.getSubject(eventClassName).subscribe(callback); }
|
|
@@ -3042,6 +3063,9 @@ class BasicFormComponent extends FormStructureAndData {
|
|
|
3042
3063
|
this.errorDetail = '';
|
|
3043
3064
|
this.busy = true;
|
|
3044
3065
|
const formActionResponse = await this.formManagerService.execServerAction(actionDetail);
|
|
3066
|
+
if (!formActionResponse) {
|
|
3067
|
+
return null;
|
|
3068
|
+
}
|
|
3045
3069
|
this.busy = false;
|
|
3046
3070
|
if (formActionResponse.hasError()) {
|
|
3047
3071
|
const error = formActionResponse.error;
|