@aemforms/af-core 0.22.132 → 0.22.133

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.
@@ -2740,6 +2740,7 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
2740
2740
  };
2741
2741
  const targetField = context.$field || null;
2742
2742
  const targetEvent = context.$event || null;
2743
+ response.submitter = targetField;
2743
2744
  const enhancedPayload = {
2744
2745
  request: response.originalRequest,
2745
2746
  response,
@@ -2752,7 +2753,12 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
2752
2753
  context.form.dispatch(new SubmitSuccess(response, true));
2753
2754
  }
2754
2755
  else {
2755
- context.form.dispatch(new CustomEvent(eName, response, true));
2756
+ if (context.field) {
2757
+ context.field.dispatch(new CustomEvent(eName, response, true));
2758
+ }
2759
+ else {
2760
+ context.form.dispatch(new CustomEvent(eName, response, true));
2761
+ }
2756
2762
  }
2757
2763
  context.form.dispatch(new RequestSuccess(enhancedPayload, false));
2758
2764
  }
@@ -2764,7 +2770,12 @@ const request = async (context, uri, httpVerb, payload, success, error, headers)
2764
2770
  context.form.dispatch(new SubmitFailure(response, true));
2765
2771
  }
2766
2772
  else {
2767
- context.form.dispatch(new CustomEvent(eName, response, true));
2773
+ if (context.field) {
2774
+ context.field.dispatch(new CustomEvent(eName, response, true));
2775
+ }
2776
+ else {
2777
+ context.form.dispatch(new CustomEvent(eName, response, true));
2778
+ }
2768
2779
  }
2769
2780
  context.form.dispatch(new RequestFailure(enhancedPayload, false));
2770
2781
  }
@@ -3575,6 +3586,9 @@ class Form extends Container {
3575
3586
  }
3576
3587
  }
3577
3588
  resolveQualifiedName(qualifiedName) {
3589
+ if (this.qualifiedName === qualifiedName) {
3590
+ return this;
3591
+ }
3578
3592
  let foundFormElement = null;
3579
3593
  this.visit(formElement => {
3580
3594
  if (formElement.qualifiedName === qualifiedName) {
package/lib/Form.js CHANGED
@@ -141,6 +141,9 @@ class Form extends Container_1.default {
141
141
  }
142
142
  }
143
143
  resolveQualifiedName(qualifiedName) {
144
+ if (this.qualifiedName === qualifiedName) {
145
+ return this;
146
+ }
144
147
  let foundFormElement = null;
145
148
  this.visit(formElement => {
146
149
  if (formElement.qualifiedName === qualifiedName) {
@@ -82,6 +82,7 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
82
82
  response.originalRequest = Object.assign({ url: endpoint, method: httpVerb }, encryptOutput);
83
83
  const targetField = context.$field || null;
84
84
  const targetEvent = context.$event || null;
85
+ response.submitter = targetField;
85
86
  const enhancedPayload = {
86
87
  request: response.originalRequest,
87
88
  response,
@@ -94,7 +95,12 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
94
95
  context.form.dispatch(new Events_1.SubmitSuccess(response, true));
95
96
  }
96
97
  else {
97
- context.form.dispatch(new Events_1.CustomEvent(eName, response, true));
98
+ if (context.field) {
99
+ context.field.dispatch(new Events_1.CustomEvent(eName, response, true));
100
+ }
101
+ else {
102
+ context.form.dispatch(new Events_1.CustomEvent(eName, response, true));
103
+ }
98
104
  }
99
105
  context.form.dispatch(new Events_1.RequestSuccess(enhancedPayload, false));
100
106
  }
@@ -106,7 +112,12 @@ const request = (context, uri, httpVerb, payload, success, error, headers) => __
106
112
  context.form.dispatch(new Events_1.SubmitFailure(response, true));
107
113
  }
108
114
  else {
109
- context.form.dispatch(new Events_1.CustomEvent(eName, response, true));
115
+ if (context.field) {
116
+ context.field.dispatch(new Events_1.CustomEvent(eName, response, true));
117
+ }
118
+ else {
119
+ context.form.dispatch(new Events_1.CustomEvent(eName, response, true));
120
+ }
110
121
  }
111
122
  context.form.dispatch(new Events_1.RequestFailure(enhancedPayload, false));
112
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aemforms/af-core",
3
- "version": "0.22.132",
3
+ "version": "0.22.133",
4
4
  "description": "Core Module for Forms Runtime",
5
5
  "author": "Adobe Systems",
6
6
  "license": "Adobe Proprietary",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@adobe/json-formula": "0.1.50",
40
- "@aemforms/af-formatters": "^0.22.132"
40
+ "@aemforms/af-formatters": "^0.22.133"
41
41
  },
42
42
  "devDependencies": {
43
43
  "@babel/preset-env": "^7.20.2",