alchemy-form 0.2.4 → 0.2.6

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 (121) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/README.md +0 -0
  3. package/assets/stylesheets/form/alchemy_form.scss +0 -0
  4. package/assets/stylesheets/form/elements/_button.scss +0 -0
  5. package/assets/stylesheets/form/elements/_code_input.scss +0 -0
  6. package/assets/stylesheets/form/elements/_feedback_input.scss +0 -0
  7. package/assets/stylesheets/form/elements/_field.scss +0 -0
  8. package/assets/stylesheets/form/elements/_field_array.scss +0 -0
  9. package/assets/stylesheets/form/elements/_field_translatable.scss +0 -0
  10. package/assets/stylesheets/form/elements/_form.scss +0 -0
  11. package/assets/stylesheets/form/elements/_pager.scss +0 -0
  12. package/assets/stylesheets/form/elements/_pathway.scss +56 -0
  13. package/assets/stylesheets/form/elements/_query_builder.scss +0 -0
  14. package/assets/stylesheets/form/elements/_select.scss +0 -0
  15. package/assets/stylesheets/form/elements/_state.scss +0 -0
  16. package/assets/stylesheets/form/elements/_table.scss +0 -0
  17. package/assets/stylesheets/form/elements/_tabs.scss +0 -0
  18. package/assets/stylesheets/form/elements/_toggle.scss +0 -0
  19. package/assets/stylesheets/form/elements/index.scss +2 -1
  20. package/assets/stylesheets/form/general/_colors.scss +0 -0
  21. package/assets/stylesheets/form/general/_textsizes.scss +0 -0
  22. package/assets/stylesheets/form/general/index.scss +0 -0
  23. package/config/routes.js +0 -0
  24. package/controller/form_api_controller.js +0 -0
  25. package/element/10_alchemy_field_custom.js +0 -0
  26. package/element/10_dataprovider.js +0 -0
  27. package/element/15_alchemy_field_entry.js +0 -0
  28. package/element/20_query_builder_base.js +0 -0
  29. package/element/25_query_builder_data.js +0 -2
  30. package/element/30_tab_base.js +0 -0
  31. package/element/40_stateful.js +0 -0
  32. package/element/al_button.js +0 -0
  33. package/element/al_code_input.js +79 -3
  34. package/element/al_field_array.js +0 -0
  35. package/element/al_field_array_entry.js +0 -0
  36. package/element/al_field_schema.js +14 -1
  37. package/element/al_field_translatable.js +0 -0
  38. package/element/al_field_translatable_entry.js +0 -0
  39. package/element/al_label.js +0 -0
  40. package/element/al_number_input.js +0 -0
  41. package/element/al_pager.js +0 -0
  42. package/element/al_password_input.js +0 -0
  43. package/element/al_pathway.js +82 -0
  44. package/element/al_pathway_selection.js +690 -0
  45. package/element/al_query_builder.js +0 -0
  46. package/element/al_query_builder_entry.js +18 -3
  47. package/element/al_query_builder_group.js +0 -0
  48. package/element/al_query_builder_value.js +0 -0
  49. package/element/al_query_builder_variable.js +0 -0
  50. package/element/al_select.js +6 -2
  51. package/element/al_select_item.js +0 -0
  52. package/element/al_state.js +0 -0
  53. package/element/al_tab_button.js +0 -0
  54. package/element/al_tab_context.js +0 -0
  55. package/element/al_tab_list.js +0 -0
  56. package/element/al_tab_panel.js +0 -0
  57. package/element/al_table.js +0 -0
  58. package/element/al_toggle.js +0 -0
  59. package/helper/form_actions/00_form_action.js +0 -0
  60. package/helper/form_actions/url_action.js +0 -0
  61. package/helper/pathway/leaf.js +174 -0
  62. package/helper/query_builder_ns.js +0 -0
  63. package/helper/query_builder_variable_definition/00_variable_definition.js +0 -0
  64. package/helper/query_builder_variable_definition/boolean_variable_definition.js +0 -0
  65. package/helper/query_builder_variable_definition/list_variable_definition.js +0 -0
  66. package/helper/query_builder_variable_definition/number_variable_definition.js +0 -0
  67. package/helper/query_builder_variable_definition/string_variable_definition.js +0 -0
  68. package/helper_field/query_builder_assignment.js +0 -0
  69. package/helper_field/query_builder_field.js +0 -0
  70. package/helper_field/query_builder_value.js +0 -0
  71. package/helper_field/query_builder_variable.js +0 -0
  72. package/package.json +2 -2
  73. package/view/form/elements/al_pathway.hwk +5 -0
  74. package/view/form/elements/al_pathway_selection.hwk +10 -0
  75. package/view/form/elements/alchemy_button.hwk +0 -0
  76. package/view/form/elements/alchemy_field_array.hwk +0 -0
  77. package/view/form/elements/alchemy_field_array_entry.hwk +0 -0
  78. package/view/form/elements/alchemy_field_schema.hwk +0 -0
  79. package/view/form/elements/alchemy_field_translatable.hwk +0 -0
  80. package/view/form/elements/alchemy_field_translatable_entry.hwk +0 -0
  81. package/view/form/elements/alchemy_select.hwk +0 -0
  82. package/view/form/elements/alchemy_select_item.hwk +0 -0
  83. package/view/form/elements/alchemy_toggle.hwk +0 -0
  84. package/view/form/elements/code_input.hwk +0 -0
  85. package/view/form/elements/number_input.hwk +0 -0
  86. package/view/form/elements/password_input.hwk +0 -0
  87. package/view/form/elements/query_builder.hwk +0 -0
  88. package/view/form/elements/query_builder_entry.hwk +0 -0
  89. package/view/form/elements/query_builder_group.hwk +0 -0
  90. package/view/form/elements/query_builder_value.hwk +0 -0
  91. package/view/form/elements/query_builder_variable.hwk +0 -0
  92. package/view/form/inputs/edit/belongs_to.hwk +0 -0
  93. package/view/form/inputs/edit/boolean.hwk +0 -0
  94. package/view/form/inputs/edit/date.hwk +0 -0
  95. package/view/form/inputs/edit/datetime.hwk +0 -0
  96. package/view/form/inputs/edit/enum.hwk +0 -0
  97. package/view/form/inputs/edit/has_and_belongs_to_many.hwk +0 -0
  98. package/view/form/inputs/edit/has_one_parent.hwk +0 -0
  99. package/view/form/inputs/edit/html.hwk +0 -0
  100. package/view/form/inputs/edit/number.hwk +0 -0
  101. package/view/form/inputs/edit/query_builder.hwk +0 -0
  102. package/view/form/inputs/edit/query_builder_assignment.hwk +0 -0
  103. package/view/form/inputs/edit/query_builder_value.hwk +0 -0
  104. package/view/form/inputs/edit/query_builder_variable.hwk +0 -0
  105. package/view/form/inputs/edit/schema.hwk +0 -0
  106. package/view/form/inputs/edit/sourcecode.hwk +0 -0
  107. package/view/form/inputs/edit/string.hwk +0 -0
  108. package/view/form/inputs/edit/text.hwk +0 -0
  109. package/view/form/inputs/edit_inline/boolean.hwk +0 -0
  110. package/view/form/inputs/view/datetime.hwk +0 -0
  111. package/view/form/inputs/view/string.hwk +0 -0
  112. package/view/form/inputs/view_inline/boolean.hwk +0 -0
  113. package/view/form/inputs/view_inline/date.hwk +0 -0
  114. package/view/form/inputs/view_inline/datetime.hwk +0 -0
  115. package/view/form/inputs/view_inline/enum.hwk +0 -0
  116. package/view/form/inputs/view_inline/objectid.hwk +0 -0
  117. package/view/form/inputs/view_inline/string.hwk +0 -0
  118. package/view/form/select/qb_item.hwk +0 -0
  119. package/view/form/wrappers/default/default.hwk +0 -0
  120. package/view/form/wrappers/edit_inline/default.hwk +0 -0
  121. package/view/form/wrappers/view_inline/default.hwk +0 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 0.2.6 (2023-06-17)
2
+
3
+ * Fix `al-field-schema` element not being able to get schema of an arrayable field
4
+ * Add `Pathway` system for faceted breadcrumbs
5
+ * Allow `al-select` to take in simple arrays as data
6
+ * Allow getting the current operator in a query builder entry
7
+
8
+ ## 0.2.5 (2023-04-20)
9
+
10
+ * Add more configuration to `al-code-input`
11
+
1
12
  ## 0.2.4 (2023-02-26)
2
13
 
3
14
  * Don't look for a field when the path is not specified
package/README.md CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,56 @@
1
+ al-pathway {
2
+ display: flex;
3
+ }
4
+
5
+ al-pathway-selection {
6
+ display: flex;
7
+ gap: 1rem;
8
+
9
+ & > .leaf-info {
10
+ border-radius: 5px;
11
+ padding: 10px;
12
+ cursor: pointer;
13
+
14
+ background-color: var(--pathway-leaf-bg, rgb(31, 41, 55));
15
+ color: var(--pathway-leaf-color, rgb(255, 255, 255));
16
+
17
+ &:hover {
18
+ background-color: var(--pathway-leaf-hover-bg, rgb(56, 69, 85));
19
+ }
20
+ }
21
+ }
22
+
23
+
24
+ .al-pathway-leaf-dropdown {
25
+ background-color: var(--pathway-leaf-option-selection-bg, rgb(55, 65, 81));
26
+ color: var(--pathway-leaf-color, rgb(255, 255, 255));
27
+ display: flex;
28
+ border-radius: 5px;
29
+
30
+ .al-pathway-select-leaf-type,
31
+ .al-pathway-select-leaf-value {
32
+ padding: 10px 0;
33
+ }
34
+
35
+ .al-pathway-select-leaf-type {
36
+ background-color: rgba(255, 255, 255, 0.2);
37
+ }
38
+
39
+ ul {
40
+ list-style: none;
41
+ margin: 0;
42
+ padding: 0;
43
+
44
+ li {
45
+ padding: 15px 25px;
46
+ cursor: pointer;
47
+
48
+ &:hover {
49
+ background-color: var(--pathway-leaf-option-selection-hover-bg, rgb(69, 84, 101));
50
+ }
51
+ }
52
+ }
53
+
54
+
55
+
56
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -11,4 +11,5 @@
11
11
  @import "_state.scss";
12
12
  @import "_table.scss";
13
13
  @import "_toggle.scss";
14
- @import "_tabs.scss";
14
+ @import "_tabs.scss";
15
+ @import "_pathway.scss";
File without changes
File without changes
File without changes
package/config/routes.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -133,7 +133,5 @@ QueryBuilderData.setMethod(async function loadVariableData(config) {
133
133
  }
134
134
  }
135
135
 
136
- console.log('Got loadvariable data:', result);
137
-
138
136
  return result;
139
137
  });
File without changes
File without changes
File without changes
@@ -16,12 +16,57 @@ const CodeInput = Function.inherits('Alchemy.Element.Form.Base', 'CodeInput');
16
16
  */
17
17
  CodeInput.setTemplateFile('form/elements/code_input');
18
18
 
19
+ /**
20
+ * Line number info
21
+ *
22
+ * @author Jelle De Loecker <jelle@elevenways.be>
23
+ * @since 0.2.5
24
+ * @version 0.2.5
25
+ */
26
+ CodeInput.setAttribute('show-line-numbers', {type: 'boolean', default: true});
27
+
28
+ /**
29
+ * The ace mode to use
30
+ *
31
+ * @author Jelle De Loecker <jelle@elevenways.be>
32
+ * @since 0.2.5
33
+ * @version 0.2.5
34
+ */
35
+ CodeInput.setAttribute('language-mode');
36
+
37
+ /**
38
+ * The theme to use
39
+ *
40
+ * @author Jelle De Loecker <jelle@elevenways.be>
41
+ * @since 0.2.5
42
+ * @version 0.2.5
43
+ */
44
+ CodeInput.setAttribute('color-theme');
45
+
46
+ /**
47
+ * The minimum number of lines to show (height)
48
+ *
49
+ * @author Jelle De Loecker <jelle@elevenways.be>
50
+ * @since 0.2.5
51
+ * @version 0.2.5
52
+ */
53
+ CodeInput.setAttribute('min-lines', {type: 'number'});
54
+
55
+ /**
56
+ * The maximum number of lines to show (height)
57
+ *
58
+ * @author Jelle De Loecker <jelle@elevenways.be>
59
+ * @since 0.2.5
60
+ * @version 0.2.5
61
+ */
62
+ CodeInput.setAttribute('max-lines', {type: 'number'});
63
+
19
64
  /**
20
65
  * Get/set the value
21
66
  *
22
67
  * @author Jelle De Loecker <jelle@elevenways.be>
23
68
  * @since 0.1.0
24
- * @version 0.1.0
69
+ * @version 0.2.5
25
70
  */
26
71
  CodeInput.setProperty(function value(value) {
27
72
 
@@ -34,6 +79,11 @@ CodeInput.setProperty(function value(value) {
34
79
  if (editor_el) {
35
80
  return editor_el.textContent;
36
81
  }
82
+
83
+ if (this.assigned_data.value) {
84
+ return this.assigned_data.value;
85
+ }
86
+
37
87
  }, function setValue(value) {
38
88
 
39
89
  if (this._editor) {
@@ -51,6 +101,7 @@ CodeInput.setProperty(function value(value) {
51
101
  return editor_el.textContent = value;
52
102
  }
53
103
 
104
+ this.assigned_data.value = value;
54
105
  });
55
106
 
56
107
  /**
@@ -58,7 +109,7 @@ CodeInput.setProperty(function value(value) {
58
109
  *
59
110
  * @author Jelle De Loecker <jelle@elevenways.be>
60
111
  * @since 0.1.0
61
- * @version 0.1.10
112
+ * @version 0.2.5
62
113
  */
63
114
  CodeInput.setMethod(async function introduced() {
64
115
 
@@ -68,7 +119,20 @@ CodeInput.setMethod(async function introduced() {
68
119
 
69
120
  editor_el.hidden = false;
70
121
 
71
- let editor = ace.edit(editor_el);
122
+ let theme = this.color_theme || 'ace/theme/tomorrow_night_eighties';
123
+
124
+ if (!theme.startsWith('ace/theme')) {
125
+ theme = 'ace/theme/' + theme;
126
+ }
127
+
128
+ let options = {
129
+ showLineNumbers : this.show_line_numbers,
130
+ minLines : this.minLines || 4,
131
+ maxLines : this.maxLines || 50,
132
+ theme : theme,
133
+ };
134
+
135
+ let editor = ace.edit(editor_el, options);
72
136
 
73
137
  editor.session.setUseWrapMode(true);
74
138
  editor.setFontSize(16);
@@ -88,5 +152,17 @@ CodeInput.setMethod(async function introduced() {
88
152
  editor.session.setMode(mode);
89
153
  }
90
154
 
155
+ if (this.assigned_data.value) {
156
+ editor.setValue(this.assigned_data.value, -1);
157
+ }
158
+
159
+ if (this.language_mode) {
160
+ try {
161
+ editor.session.setMode('ace/mode/' + this.language_mode);
162
+ } catch (err) {
163
+ // Ignore
164
+ }
165
+ }
166
+
91
167
  this._editor = editor;
92
168
  });
File without changes
File without changes
@@ -21,7 +21,7 @@ FieldSchema.setTemplateFile('form/elements/alchemy_field_schema');
21
21
  *
22
22
  * @author Jelle De Loecker <jelle@elevenways.be>
23
23
  * @since 0.1.0
24
- * @version 0.2.4
24
+ * @version 0.2.6
25
25
  */
26
26
  FieldSchema.setProperty(function schema() {
27
27
 
@@ -32,6 +32,8 @@ FieldSchema.setProperty(function schema() {
32
32
 
33
33
  let schema = field.options.schema;
34
34
 
35
+ // If the schema is a string, it's actually a reference to another field
36
+ // that *should* contain the schema.
35
37
  if (typeof schema == 'string') {
36
38
 
37
39
  let parent_schema_value;
@@ -53,6 +55,17 @@ FieldSchema.setProperty(function schema() {
53
55
  parent_schema_value = record_value;
54
56
  }
55
57
 
58
+ // If this field is inside an array, get the index
59
+ let array_entry_element = field_element.queryParents('al-field-array-entry');
60
+ if (array_entry_element) {
61
+ let index = array_entry_element.index;
62
+
63
+ // If it has an index, get the value at that index
64
+ if (index != null && Array.isArray(parent_schema_value)) {
65
+ parent_schema_value = parent_schema_value[index];
66
+ }
67
+ }
68
+
56
69
  return field.getSubschema(parent_schema_value, schema)
57
70
  }
58
71
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,82 @@
1
+ /**
2
+ * The al-pathway element
3
+ *
4
+ * @author Jelle De Loecker <jelle@elevenways.be>
5
+ * @since 0.2.6
6
+ * @version 0.2.6
7
+ */
8
+ const Pathway = Function.inherits('Alchemy.Element.Form.Base', 'Pathway');
9
+
10
+ /**
11
+ * The hawkejs template to use
12
+ *
13
+ * @author Jelle De Loecker <jelle@elevenways.be>
14
+ * @since 0.2.6
15
+ * @version 0.2.6
16
+ */
17
+ Pathway.setTemplateFile('form/elements/al_pathway');
18
+
19
+ /**
20
+ * The root leaf property
21
+ *
22
+ * @author Jelle De Loecker <jelle@elevenways.be>
23
+ * @since 0.2.6
24
+ * @version 0.2.6
25
+ */
26
+ Pathway.setAssignedProperty('rootleaf');
27
+
28
+ /**
29
+ * The current value
30
+ *
31
+ * @author Jelle De Loecker <jelle@elevenways.be>
32
+ * @since 0.2.6
33
+ * @version 0.2.6
34
+ */
35
+ Pathway.setAssignedProperty(function value(val) {
36
+
37
+ let new_val = this.getValue();
38
+
39
+ if (new_val) {
40
+ return new_val;
41
+ }
42
+
43
+ return val;
44
+ }, function setValue(val) {
45
+
46
+ let child = this.querySelector('.al-pathway-selection-root');
47
+
48
+ if (child) {
49
+ child.value = val;
50
+ }
51
+
52
+ });
53
+
54
+ /**
55
+ * Get the current value
56
+ *
57
+ * @author Jelle De Loecker <jelle@elevenways.be>
58
+ * @since 0.2.6
59
+ * @version 0.2.6
60
+ */
61
+ Pathway.setMethod(function getValue() {
62
+
63
+ let child = this.querySelector('.al-pathway-selection-root');
64
+
65
+ if (child) {
66
+ return child.getValue();
67
+ }
68
+ });
69
+
70
+ /**
71
+ * Incoming change
72
+ *
73
+ * @author Jelle De Loecker <jelle@elevenways.be>
74
+ * @since 0.2.6
75
+ * @version 0.2.6
76
+ *
77
+ * @param {PathwaySelection} element
78
+ */
79
+ Pathway.setMethod(function triggerChange(element) {
80
+
81
+ alchemy.emit('story_pathway', this, element);
82
+ });