alchemy-form 0.3.0-alpha.2 → 0.3.0-alpha.4

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/assets/stylesheets/form/elements/_button.scss +1 -1
  3. package/assets/stylesheets/form/elements/_enum_badge.scss +7 -0
  4. package/assets/stylesheets/form/elements/_feedback_input.scss +0 -0
  5. package/assets/stylesheets/form/elements/_field_array.scss +10 -3
  6. package/assets/stylesheets/form/elements/_query_builder.scss +0 -0
  7. package/assets/stylesheets/form/elements/_select.scss +176 -176
  8. package/assets/stylesheets/form/elements/_table.scss +169 -53
  9. package/assets/stylesheets/form/elements/_tabs.scss +25 -35
  10. package/assets/stylesheets/form/elements/_toggle.scss +0 -0
  11. package/assets/stylesheets/form/elements/index.scss +1 -1
  12. package/assets/stylesheets/form/general/_colors.scss +0 -0
  13. package/config/routes.js +10 -0
  14. package/controller/form_api_controller.js +28 -0
  15. package/element/00_form_base.js +82 -27
  16. package/element/al_button.js +12 -1
  17. package/element/al_enum_badge.js +157 -0
  18. package/element/al_field.js +134 -39
  19. package/element/al_field_array.js +22 -0
  20. package/element/al_field_schema.js +222 -55
  21. package/element/al_form.js +9 -6
  22. package/element/al_select.js +2 -2
  23. package/element/al_table.js +10 -1
  24. package/element/al_virtual_scroll.js +2 -1
  25. package/helper/field_recompute_handler.js +0 -2
  26. package/package.json +1 -1
  27. package/view/form/elements/al_enum_badge.hwk +9 -0
  28. package/view/form/elements/alchemy_field.hwk +2 -0
  29. package/view/form/elements/alchemy_field_array.hwk +17 -6
  30. package/view/form/elements/alchemy_field_array_entry.hwk +11 -5
  31. package/view/form/elements/alchemy_field_schema.hwk +2 -2
  32. package/view/form/elements/alchemy_select_item.hwk +1 -1
  33. package/view/form/inputs/edit/enum.hwk +1 -1
  34. package/view/form/inputs/edit/mixed.hwk +9 -0
  35. package/view/form/inputs/edit_sw/fallback.hwk +1 -0
  36. package/view/form/inputs/view/association_alias.hwk +16 -0
  37. package/view/form/inputs/view/schema.hwk +4 -0
  38. package/view/form/inputs/view/string.hwk +1 -1
  39. package/view/form/inputs/view_inline/belongs_to.hwk +16 -0
  40. package/view/form/inputs/view_inline/boolean.hwk +2 -2
  41. package/view/form/inputs/view_inline/datetime.hwk +1 -1
  42. package/view/form/inputs/view_inline/enum.hwk +11 -7
  43. package/view/form/inputs/view_inline/objectid.hwk +1 -1
  44. package/view/form/inputs/view_inline/string.hwk +1 -1
  45. package/view/form/wrappers/edit_sw/default.hwk +1 -0
  46. package/assets/stylesheets/form/elements/_badge.scss +0 -41
@@ -17,80 +17,87 @@ var FieldSchema = Function.inherits('Alchemy.Element.Form.FieldCustom', 'FieldSc
17
17
  FieldSchema.setTemplateFile('form/elements/alchemy_field_schema');
18
18
 
19
19
  /**
20
- * Get the actual schema
20
+ * Get the parent "schema" al-field element.
21
+ * This is NOT the `al-field[field-type="schema"]` element this
22
+ * `al-field-schema` is part of, but the one that is part of!
23
+ *
24
+ * It is possible this does not use the "schema" type in the HTML attribute.
21
25
  *
22
26
  * @author Jelle De Loecker <jelle@elevenways.be>
23
- * @since 0.1.0
24
- * @version 0.2.9
27
+ * @since 0.3.0
28
+ * @version 0.3.0
25
29
  */
26
- FieldSchema.setProperty(function schema() {
27
-
28
- const field_element = this.alchemy_field;
29
- const field = field_element?.config;
30
-
31
- if (field?.options) {
32
-
33
- let schema = field.options.schema;
34
-
35
- // If the schema is a string, it's actually a reference to another field
36
- // that *should* contain the schema.
37
- if (typeof schema == 'string') {
38
-
39
- let parent_schema_value;
30
+ FieldSchema.setProperty(function parent_schema_field() {
40
31
 
41
- let parent_schema = field_element.queryParents('al-field[field-type="schema"]');
32
+ // Start looking from the parent element of our own `al-field` element
33
+ let current = this.alchemy_field?.parentElement;
42
34
 
43
- if (parent_schema) {
44
- parent_schema_value = parent_schema.value;
45
- } else {
35
+ while (current) {
46
36
 
47
- const form = field_element.alchemy_form;
48
-
49
- let record_value = form.getMainValue();
50
- parent_schema_value = record_value;
51
- }
37
+ if (current.nodeName != 'AL-FIELD') {
38
+ current = current.parentElement;
39
+ continue;
40
+ }
52
41
 
53
- // If this field is inside an array, get the index
54
- let array_entry_element = field_element.queryParents('al-field-array-entry');
55
- if (array_entry_element) {
56
- let index = array_entry_element.index;
42
+ // If it is using the explicit schema type, return it
43
+ if (current.field_type == 'schema') {
44
+ return current;
45
+ }
57
46
 
58
- // If it has an index, get the value at that index
59
- if (index != null && Array.isArray(parent_schema_value)) {
60
- parent_schema_value = parent_schema_value[index];
61
- }
62
- }
47
+ let field = current.config;
63
48
 
64
- return field.getSubschema(parent_schema_value, schema)
49
+ if (field && field instanceof Classes.Alchemy.Field.Schema) {
50
+ return current;
65
51
  }
66
-
67
- return schema;
68
52
  }
53
+
54
+ return false;
69
55
  });
70
56
 
71
57
  /**
72
- * Get the actual subschema fields
58
+ * Get the parent schema value this field is part of
73
59
  *
74
60
  * @author Jelle De Loecker <jelle@elevenways.be>
75
- * @since 0.1.0
76
- * @version 0.1.3
61
+ * @since 0.3.0
62
+ * @version 0.3.0
77
63
  */
78
- FieldSchema.setProperty(function sub_fields() {
64
+ FieldSchema.setProperty(function parent_schema_value() {
79
65
 
80
- let schema = this.schema;
66
+ const field_element = this.alchemy_field;
81
67
 
82
- if (schema) {
68
+ if (!field_element) {
69
+ return;
70
+ }
71
+
72
+ let parent_schema_value,
73
+ parent_schema = this.parent_schema_field;
74
+
75
+ if (parent_schema) {
76
+ parent_schema_value = parent_schema.value;
77
+ } else {
83
78
 
84
- if (typeof schema != 'object') {
85
- throw new Error('Expected a schema object, but found "' + typeof schema + '" instead');
79
+ const form = field_element.alchemy_form;
80
+
81
+ if (form) {
82
+ let record_value = form.getMainValue();
83
+ parent_schema_value = record_value;
84
+ } else {
85
+ parent_schema_value = field_element.original_value_container;
86
86
  }
87
+ }
88
+
89
+ // If this field is inside an array, get the index
90
+ let array_entry_element = field_element.queryParents('al-field-array-entry');
91
+ if (array_entry_element) {
92
+ let index = array_entry_element.index;
87
93
 
88
- if (schema) {
89
- return schema.getSorted();
94
+ // If it has an index, get the value at that index
95
+ if (index != null && Array.isArray(parent_schema_value)) {
96
+ parent_schema_value = parent_schema_value[index];
90
97
  }
91
98
  }
92
99
 
93
- return [];
100
+ return parent_schema_value;
94
101
  });
95
102
 
96
103
  /**
@@ -118,12 +125,105 @@ FieldSchema.setProperty(function value() {
118
125
  throw new Error('Unable to set value of schema field');
119
126
  });
120
127
 
128
+ /**
129
+ * Get the actual schema
130
+ *
131
+ * @author Jelle De Loecker <jelle@elevenways.be>
132
+ * @since 0.1.0
133
+ * @version 0.3.0
134
+ *
135
+ * @return {Alchemy.Schema|Pledge<Alchemy.Schema>}
136
+ */
137
+ FieldSchema.setMethod(function getSchema() {
138
+
139
+ const field_element = this.alchemy_field,
140
+ field = field_element?.config;
141
+
142
+ if (!field) {
143
+ return;
144
+ }
145
+
146
+ if (Classes.Alchemy.Client.Schema.isSchema(field)) {
147
+ return field;
148
+ }
149
+
150
+ if (field?.options) {
151
+
152
+ let schema = field.options.schema;
153
+
154
+ // If the schema is a string, it's actually a reference to another field
155
+ // that *should* contain the schema.
156
+ if (typeof schema == 'string') {
157
+
158
+ let parent_schema_value = this.parent_schema_value;
159
+
160
+ let schema_context = new Classes.Alchemy.OperationalContext.Schema();
161
+ schema_context.setHolder(parent_schema_value);
162
+ schema_context.setSchema(field.schema);
163
+
164
+ return field.getSubSchema(schema_context);
165
+ }
166
+
167
+ return schema;
168
+ }
169
+ });
170
+
171
+ /**
172
+ * Get the actual subschema fields
173
+ *
174
+ * @author Jelle De Loecker <jelle@elevenways.be>
175
+ * @since 0.1.0
176
+ * @version 0.3.0
177
+ */
178
+ FieldSchema.setMethod(function getSubFields() {
179
+
180
+ let schema = this.getSchema();
181
+
182
+ if (Pledge.isThenable(schema)) {
183
+ let pledge = new Swift();
184
+
185
+ Swift.done(schema, (err, result) => {
186
+
187
+ if (err) {
188
+ return pledge.reject(err);
189
+ }
190
+
191
+ pledge.resolve(this.getFieldsFromSchema(result));
192
+ });
193
+
194
+ return pledge;
195
+ }
196
+
197
+ return this.getFieldsFromSchema(schema);
198
+ });
199
+
200
+ /**
201
+ * Get the fields from the given schema
202
+ *
203
+ * @author Jelle De Loecker <jelle@elevenways.be>
204
+ * @since 0.1.0
205
+ * @version 0.3.0
206
+ */
207
+ FieldSchema.setMethod(function getFieldsFromSchema(schema) {
208
+
209
+ if (!schema) {
210
+ return [];
211
+ }
212
+
213
+ if (typeof schema != 'object') {
214
+ throw new Error('Expected a schema object, but found "' + typeof schema + '" instead');
215
+ }
216
+
217
+ // Don't show meta fields by default
218
+ return schema.getSorted().filter(field => !field.is_meta_field);
219
+ });
220
+
121
221
  /**
122
222
  * Get the optional field that is supplying the schema
123
223
  *
124
224
  * @author Jelle De Loecker <jelle@elevenways.be>
125
225
  * @since 0.1.3
126
- * @version 0.1.3
226
+ * @version 0.3.0
127
227
  */
128
228
  FieldSchema.setMethod(function getSchemaSupplierField() {
129
229
 
@@ -134,7 +234,12 @@ FieldSchema.setMethod(function getSchemaSupplierField() {
134
234
  let schema = this.alchemy_field.config.options.schema;
135
235
 
136
236
  if (typeof schema == 'string') {
137
- let other_field_path = this.resolvePath(schema);
237
+ let other_field_path = this.resolvePathToArray(schema),
238
+ schema_path;
239
+
240
+ if (schema.includes('.')) {
241
+ schema_path = other_field_path.pop();
242
+ }
138
243
 
139
244
  schema = null;
140
245
 
@@ -146,6 +251,41 @@ FieldSchema.setMethod(function getSchemaSupplierField() {
146
251
  }
147
252
  });
148
253
 
254
+ /**
255
+ * Prepare variables
256
+ *
257
+ * @author Jelle De Loecker <jelle@elevenways.be>
258
+ * @since 0.3.0
259
+ * @version 0.3.0
260
+ */
261
+ FieldSchema.setMethod(function prepareRenderVariables() {
262
+
263
+ let schema = this.getSchema();
264
+
265
+ if (Pledge.isThenable(schema)) {
266
+ let pledge = new Pledge.Swift();
267
+
268
+ Pledge.Swift.done(schema, (err, schema) => {
269
+
270
+ if (err) {
271
+ return pledge.reject(err);
272
+ }
273
+
274
+ pledge.resolve({
275
+ sub_fields: this.getFieldsFromSchema(schema),
276
+ sub_schema: schema,
277
+ });
278
+ });
279
+
280
+ return pledge;
281
+ }
282
+
283
+ return {
284
+ sub_fields: this.getFieldsFromSchema(schema),
285
+ sub_schema: schema,
286
+ };
287
+ });
288
+
149
289
  /**
150
290
  * Added to the DOM for the first time
151
291
  *
@@ -163,6 +303,10 @@ FieldSchema.setMethod(function introduced() {
163
303
  });
164
304
 
165
305
  this.rerender();
306
+ } else {
307
+ // @TODO: Some fields seem to get added to the DOM for a second
308
+ // before being removed.
309
+ //console.warn('Failed to find supplier field for', this, this.parentElement);
166
310
  }
167
311
  });
168
312
 
@@ -171,18 +315,41 @@ FieldSchema.setMethod(function introduced() {
171
315
  *
172
316
  * @author Jelle De Loecker <jelle@elevenways.be>
173
317
  * @since 0.1.4
174
- * @version 0.1.4
318
+ * @version 0.3.0
175
319
  */
176
320
  FieldSchema.setProperty(function original_value() {
177
321
 
178
322
  let field = this.alchemy_field,
179
323
  path = this.field_path_in_record;
180
324
 
325
+ let array_entry = this.queryUp('al-field-array-entry'),
326
+ original_value_context = field;
327
+
328
+ if (array_entry) {
329
+ if (!array_entry.isConnected || (field && field.contains(array_entry))) {
330
+ original_value_context = array_entry;
331
+ }
332
+ }
333
+
334
+ // This is needed for SemanticWiki's metadata fields.
335
+ // They use al-field-schema elements, but they refer to the main
336
+ // `al-form` element, and that is not where it can find the original value...
337
+ if (original_value_context && original_value_context.original_value) {
338
+ return original_value_context.original_value;
339
+ }
340
+
181
341
  if (field && path) {
182
- let form = field.alchemy_form || this.alchemy_form || this.field_context.alchemy_form;
342
+ let form = field.alchemy_form || this.alchemy_form || this.field_context.alchemy_form,
343
+ value_container;
183
344
 
184
345
  if (form) {
185
- return Object.path(form.document, path);
346
+ value_container = form.document;
347
+ } else {
348
+ value_container = field.original_value_container;
349
+ }
350
+
351
+ if (value_container) {
352
+ return Object.path(value_container, path);
186
353
  }
187
354
  }
188
355
 
@@ -193,7 +360,7 @@ FieldSchema.setProperty(function original_value() {
193
360
  data = context.original_value;
194
361
  } else {
195
362
  context = this.field_context.alchemy_form || this.alchemy_field.alchemy_form;
196
- data = context.document;
363
+ data = context?.document;
197
364
  }
198
365
 
199
366
  path = this.field_path_in_current_schema;
@@ -428,7 +428,7 @@ Form.setMethod(async function showViolations(err) {
428
428
  *
429
429
  * @author Jelle De Loecker <jelle@elevenways.be>
430
430
  * @since 0.1.0
431
- * @version 0.2.4
431
+ * @version 0.3.0
432
432
  *
433
433
  * @param {String} path
434
434
  *
@@ -441,11 +441,15 @@ Form.setMethod(function findFieldByPath(path) {
441
441
  }
442
442
 
443
443
  let current = this,
444
- result,
445
- pieces = path.split('.'),
444
+ pieces,
446
445
  piece,
447
- query,
448
- temp;
446
+ query;
447
+
448
+ if (Array.isArray(path)) {
449
+ pieces = path;
450
+ } else {
451
+ pieces = path.split('.');
452
+ }
449
453
 
450
454
  for (piece of pieces) {
451
455
 
@@ -463,7 +467,6 @@ Form.setMethod(function findFieldByPath(path) {
463
467
  }
464
468
 
465
469
  return current;
466
-
467
470
  });
468
471
 
469
472
  /**
@@ -957,7 +957,7 @@ AlchemySelect.setMethod(function applyFetchedData(err, result, config) {
957
957
 
958
958
  if (err) {
959
959
  this.loading_dropdown = false;
960
- alchemy.handleError(err);
960
+ alchemy.registerError(err);
961
961
  return;
962
962
  }
963
963
 
@@ -1165,7 +1165,7 @@ AlchemySelect.setMethod(function open(event) {
1165
1165
  this.dropdown_content.scrollTop = 0;
1166
1166
 
1167
1167
  // Make the dropdown the same width
1168
- this.dropdown.style.width = ~~this.clientWidth + 'px';
1168
+ this.dropdown.style.width = (~~this.clientWidth + 1) + 'px';
1169
1169
 
1170
1170
  if (event) {
1171
1171
  if (event.key) {
@@ -602,7 +602,7 @@ Table.setMethod(function showPagination() {
602
602
  * @param {FieldConfig} field_config The config on how to display the field
603
603
  * @param {Object} container The container where the field should be in
604
604
  *
605
- * @return
605
+ * @return {Element.AlField}
606
606
  */
607
607
  Table.setMethod(function getFieldConfigView(field_config, container) {
608
608
 
@@ -642,6 +642,11 @@ Table.setMethod(function getFieldConfigView(field_config, container) {
642
642
  alchemy_field.original_value = value;
643
643
  alchemy_field.model = field?.schema?.model_name;
644
644
 
645
+ // Since these fields are not inside a form,
646
+ // they won't be able to remember their original value container.
647
+ // So force them to:
648
+ alchemy_field.rememberOriginalValueContainer(container);
649
+
645
650
  return alchemy_field;
646
651
  });
647
652
 
@@ -927,6 +932,10 @@ Table.setMethod(function onFieldsetAssignment(value, old_value) {
927
932
 
928
933
  this.clearAll();
929
934
 
935
+ if (!value) {
936
+ return;
937
+ }
938
+
930
939
  if (!(value instanceof Classes.Alchemy.Criteria.FieldSet)) {
931
940
  if (Array.isArray(value)) {
932
941
  value = Classes.Alchemy.Criteria.FieldSet.fromArray(value);
@@ -281,7 +281,8 @@ VirtualScroll.setMethod(function ensureTriggerElements() {
281
281
  }
282
282
  }
283
283
  }, {
284
- threshold: 0,
284
+ threshold: 0.1,
285
+ root: this,
285
286
  rootMargin: '50px 0px 50px 0px',
286
287
  });
287
288
 
@@ -30,8 +30,6 @@ alchemy.registerCustomHandler('recompute_field', async function fieldRecomputeHa
30
30
  field : field.name,
31
31
  };
32
32
 
33
- console.log(document)
34
-
35
33
  let helpers;
36
34
 
37
35
  if (Blast.isServer) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "alchemy-form",
3
3
  "description": "Form plugin for Alchemy",
4
- "version": "0.3.0-alpha.2",
4
+ "version": "0.3.0-alpha.4",
5
5
  "repository": {
6
6
  "type" : "git",
7
7
  "url" : "https://github.com/11ways/alchemy-form.git"
@@ -0,0 +1,9 @@
1
+ {% if icon %}
2
+ <al-icon icon-name={% icon %}></al-icon>
3
+ {% /if %}
4
+ {% if title %}
5
+ <span class="enum-badge-title">{{ title }}</span>
6
+ {% /if %}
7
+ {% if color %}
8
+ <% $0.dataset.badgeColorSet = color %>
9
+ {% /if %}
@@ -12,6 +12,8 @@
12
12
  <al-field-array
13
13
  #field_context=<% self %>
14
14
  #alchemy_field=<% self %>
15
+ max-entry-count={% self.max_entry_count %}
16
+ min-entry-count={% self.min_entry_count %}
15
17
  ></al-field-array>
16
18
  <% } else if (view_files && view_files.length) { %>
17
19
  <div class="field">
@@ -2,13 +2,25 @@
2
2
  <% view_files = alchemy_field.view_files %>
3
3
  <% values = self.original_value %>
4
4
 
5
- <button class="add-entry">
6
- {%t "add-entry" name=alchemy_field.field_name title=alchemy_field.field_title %}
7
- </button>
5
+ {% if self.field_context.max_entry_count eq 1 %}
6
+ <%
7
+ if (!values) {
8
+ self.original_value = values = [];
9
+ }
10
+
11
+ if (values.length === 0) {
12
+ values.push(undefined);
13
+ }
14
+ %>
15
+ {% else %}
16
+ <button class="button add-entry">
17
+ <al-icon icon-name="plus"></al-icon>
18
+ {%t "add-entry" name=alchemy_field.field_name title=alchemy_field.field_title %}
19
+ </button>
20
+ {% /if %}
8
21
 
9
22
  <div class="entries">
10
- {% with values as value %}
11
- {% each %}
23
+ {% each values as value %}
12
24
  <al-field-array-entry
13
25
  #alchemy_field_array=<% self %>
14
26
  #field_context=<% self %>
@@ -18,5 +30,4 @@
18
30
  index=<% $index %>
19
31
  ></al-field-array-entry>
20
32
  {% /each %}
21
- {% /with %}
22
33
  </div>
@@ -10,8 +10,14 @@
10
10
  <div class="field">
11
11
  <% include(view_files, variables) %>
12
12
  </div>
13
- <div class="button">
14
- <button class="remove">
15
- {%t "remove-entry" name=alchemy_field.field_name title=alchemy_field.field_title %}
16
- </button>
17
- </div>
13
+
14
+ {% if self.alchemy_field_array.max_entry_count eq 1 %}
15
+
16
+ {% else %}
17
+ <div class="button-remove-wrapper">
18
+ <button class="button remove">
19
+ <al-icon icon-name="trash"></al-icon>
20
+ {%t "remove-entry" name=alchemy_field.field_name title=alchemy_field.field_title %}
21
+ </button>
22
+ </div>
23
+ {% /if %}
@@ -1,7 +1,7 @@
1
- {% each self.sub_fields as sub_field %}
1
+ {% each sub_fields as sub_field %}
2
2
  <al-field
3
3
  #alchemy_field_schema=<% self %>
4
- #schema=<% self.schema %>
4
+ #schema=<% sub_schema %>
5
5
  field-name=<% sub_field.name %>
6
6
  ></al-field>
7
7
  {% /each %}
@@ -1,5 +1,5 @@
1
1
  {% if self.custom_template %}
2
- {% include self.custom_template %}
2
+ {% include self.custom_template self=self %}
3
3
  {% else %}
4
4
  {{ self.display_title }}
5
5
  {% /if %}
@@ -1,7 +1,7 @@
1
1
  <al-select
2
2
  class="alchemy-field-value"
3
3
  ><%
4
- $0.values = vars.alchemy_field.config.options.values;
4
+ $0.values = alchemy_field?.config?.options?.values;
5
5
  $0.value = value;
6
6
  $0.name = path;
7
7
  %></al-select>
@@ -0,0 +1,9 @@
1
+ <al-code-input
2
+ class="alchemy-field-value"
3
+ form=<% form_id %>
4
+ name=<% path %>
5
+ placeholder={% alchemy_field.placeholder %}
6
+ language-mode="json"
7
+ value-is-object
8
+ #value={% value %}
9
+ ></al-code-input>
@@ -0,0 +1 @@
1
+ {% include "form/inputs/edit/" + alchemy_field.getFieldType() %}
@@ -0,0 +1,16 @@
1
+ <div>
2
+ <span class="alchemy-field-value">
3
+ <% if (value) { %>
4
+ {{ value.getDisplayTitle() }}
5
+ <% } else { %>
6
+ <span class="badge alchemy-field-empty-value-placeholder">
7
+ {%t
8
+ "empty-value"
9
+ field=field_context.config.name
10
+ path=field_context.config.path_in_document
11
+ zone=self.zone
12
+ %}
13
+ </span>
14
+ <% } %>
15
+ </span>
16
+ </div>
@@ -0,0 +1,4 @@
1
+ <al-field-schema
2
+ #alchemy_field=<% alchemy_field %>
3
+ #field_context=<% field_context %>
4
+ ></al-field-schema>
@@ -3,7 +3,7 @@
3
3
  <% if (value || value === false) { %>
4
4
  {{ value }}
5
5
  <% } else { %>
6
- <span class="alchemy-badge alchemy-field-empty-value-placeholder">
6
+ <span class="badge alchemy-field-empty-value-placeholder">
7
7
  {%t
8
8
  "empty-value"
9
9
  field=field_context.config.name
@@ -0,0 +1,16 @@
1
+ <div>
2
+ <span class="alchemy-field-value">
3
+ <% if (value || value === false) { %>
4
+ {{ value }}
5
+ <% } else { %>
6
+ <span class="badge alchemy-field-empty-value-placeholder">
7
+ {%t
8
+ "empty-value"
9
+ field=field_context.config.name
10
+ path=field_context.config.path_in_document
11
+ zone=self.zone
12
+ %}
13
+ </span>
14
+ <% } %>
15
+ </span>
16
+ </div>
@@ -1,11 +1,11 @@
1
1
  {% if (value_is_empty AND self.allow_empty_value_placeholder) %}
2
2
  <span class="alchemy-field-value">
3
- <span class="alchemy-badge alchemy-field-empty-value-placeholder">
3
+ <span class="badge alchemy-field-empty-value-placeholder">
4
4
  {{ self.createEmptyValuePlaceholderText() }}
5
5
  </span>
6
6
  </span>
7
7
  {% else %}
8
- <span class="alchemy-badge alchemy-field-value">
8
+ <span class="badge alchemy-field-value">
9
9
  <% $0.classList.add('boolean-' + value) %>
10
10
 
11
11
  {% if value %}
@@ -1,6 +1,6 @@
1
1
  {% if (value_is_empty AND self.allow_empty_value_placeholder) %}
2
2
  <span class="alchemy-field-value">
3
- <span class="alchemy-badge alchemy-field-empty-value-placeholder">
3
+ <span class="badge alchemy-field-empty-value-placeholder">
4
4
  {{ self.createEmptyValuePlaceholderText() }}
5
5
  </span>
6
6
  </span>