alchemy-form 0.2.1 → 0.2.2
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/CHANGELOG.md +5 -0
- package/element/al_button.js +2 -2
- package/element/al_field.js +9 -0
- package/element/al_form.js +26 -12
- package/package.json +2 -2
- package/view/form/inputs/edit/string.hwk +1 -0
package/CHANGELOG.md
CHANGED
package/element/al_button.js
CHANGED
|
@@ -66,7 +66,7 @@ Button.setAssignedProperty('action_instance');
|
|
|
66
66
|
*
|
|
67
67
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
68
68
|
* @since 0.2.0
|
|
69
|
-
* @version 0.2.
|
|
69
|
+
* @version 0.2.2
|
|
70
70
|
*/
|
|
71
71
|
Button.setMethod(function activate() {
|
|
72
72
|
|
|
@@ -82,7 +82,7 @@ Button.setMethod(function activate() {
|
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
let event = this.emit('activate');
|
|
85
|
+
let event = this.emit('activate', {cancelable: true});
|
|
86
86
|
|
|
87
87
|
if (event.defaultPrevented) {
|
|
88
88
|
return;
|
package/element/al_field.js
CHANGED
|
@@ -88,6 +88,15 @@ Field.setAttribute('readonly', {boolean: true});
|
|
|
88
88
|
*/
|
|
89
89
|
Field.setAssignedProperty('widget_settings');
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* The placeholder
|
|
93
|
+
*
|
|
94
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
95
|
+
* @since 0.2.2
|
|
96
|
+
* @version 0.2.2
|
|
97
|
+
*/
|
|
98
|
+
Field.setAttribute('placeholder');
|
|
99
|
+
|
|
91
100
|
/**
|
|
92
101
|
* Get the parent al-form element
|
|
93
102
|
*
|
package/element/al_form.js
CHANGED
|
@@ -153,12 +153,37 @@ Form.setMethod(Hawkejs.SERIALIZE_FORM, function serializeForm() {
|
|
|
153
153
|
*
|
|
154
154
|
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
155
155
|
* @since 0.1.0
|
|
156
|
-
* @version 0.2.
|
|
156
|
+
* @version 0.2.2
|
|
157
157
|
*/
|
|
158
158
|
Form.setMethod(async function submit() {
|
|
159
159
|
|
|
160
160
|
let result;
|
|
161
161
|
|
|
162
|
+
await this.validate();
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
result = await hawkejs.scene.onFormSubmit(this, null, {render_error: false});
|
|
166
|
+
} catch (err) {
|
|
167
|
+
if (err instanceof Classes.Alchemy.Error.Validation) {
|
|
168
|
+
this.showError(err);
|
|
169
|
+
} else {
|
|
170
|
+
this.showError(err);
|
|
171
|
+
throw err;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return result;
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Validate this form
|
|
180
|
+
*
|
|
181
|
+
* @author Jelle De Loecker <jelle@elevenways.be>
|
|
182
|
+
* @since 0.2.2
|
|
183
|
+
* @version 0.2.2
|
|
184
|
+
*/
|
|
185
|
+
Form.setMethod(async function validate() {
|
|
186
|
+
|
|
162
187
|
if (this.model) {
|
|
163
188
|
let model = alchemy.getModel(this.model);
|
|
164
189
|
|
|
@@ -174,17 +199,6 @@ Form.setMethod(async function submit() {
|
|
|
174
199
|
}
|
|
175
200
|
}
|
|
176
201
|
|
|
177
|
-
try {
|
|
178
|
-
result = await hawkejs.scene.onFormSubmit(this, null, {render_error: false});
|
|
179
|
-
} catch (err) {
|
|
180
|
-
if (err instanceof Classes.Alchemy.Error.Validation) {
|
|
181
|
-
this.showError(err);
|
|
182
|
-
} else {
|
|
183
|
-
throw err;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
return result;
|
|
188
202
|
});
|
|
189
203
|
|
|
190
204
|
/**
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "alchemy-form",
|
|
3
3
|
"description": "Form plugin for Alchemy",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.2",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type" : "git",
|
|
7
7
|
"url" : "https://github.com/11ways/alchemy-form.git"
|
|
8
8
|
},
|
|
9
9
|
"peerDependencies": {
|
|
10
10
|
"alchemymvc" : ">=1.2.0",
|
|
11
|
-
"alchemy-media" : "
|
|
11
|
+
"alchemy-media" : ">=0.7.2"
|
|
12
12
|
},
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"engines": {
|