alchemy-form 0.2.7 → 0.2.8

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 CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.8 (2023-10-15)
2
+
3
+ * Add basic `al-apex-chart` element
4
+ * Fix `al-table` always turning `DocumentList` instances into dumb arrays
5
+
1
6
  ## 0.2.7 (2023-10-05)
2
7
 
3
8
  * If a `al-field` element is assigned a `Field` instance to its `config` property without a parent `schema` property, it will be stored in its `assigned_data` property
@@ -0,0 +1,7 @@
1
+ al-apex-chart {
2
+ display: flex;
3
+
4
+ > * {
5
+ flex: 1 0 100%;
6
+ }
7
+ }
@@ -12,4 +12,5 @@
12
12
  @import "_table.scss";
13
13
  @import "_toggle.scss";
14
14
  @import "_tabs.scss";
15
- @import "_pathway.scss";
15
+ @import "_pathway.scss";
16
+ @import "_apex_charts.scss";
@@ -0,0 +1,38 @@
1
+ /**
2
+ * The apex-chart custom element
3
+ *
4
+ * @author Jelle De Loecker <jelle@elevenways.be>
5
+ * @since 0.2.8
6
+ * @version 0.2.8
7
+ */
8
+ const ApexChart = Function.inherits('Alchemy.Element.Form.Base', 'ApexChart');
9
+
10
+ /**
11
+ * The actual ApexChart config
12
+ *
13
+ * @author Jelle De Loecker <jelle@elevenways.be>
14
+ * @since 0.2.8
15
+ * @version 0.2.8
16
+ */
17
+ ApexChart.setAssignedProperty('apex_config');
18
+
19
+ /**
20
+ * The element has been added to the dom for the first time
21
+ *
22
+ * @author Jelle De Loecker <jelle@elevenways.be>
23
+ * @since 0.2.8
24
+ * @version 0.2.8
25
+ */
26
+ ApexChart.setMethod(async function introduced() {
27
+
28
+ await hawkejs.require('https://cdn.jsdelivr.net/npm/apexcharts');
29
+
30
+ let apex_config = this.apex_config;
31
+
32
+ let timeline = this.createElement('div');
33
+ timeline.classList.add('apex-chart-container');
34
+ this.append(timeline);
35
+
36
+ let instance = new ApexCharts(timeline, apex_config);
37
+ instance.render();
38
+ });
@@ -846,14 +846,10 @@ Field.setMethod(async function loadData(config, element) {
846
846
 
847
847
  if (field) {
848
848
 
849
- console.log('Loading data...', config, element);
850
-
851
849
  let result;
852
850
 
853
851
  if (typeof field.loadData == 'function') {
854
852
 
855
- console.log(' -- Using loadData of', field);
856
-
857
853
  try {
858
854
  result = await field.loadData(config, element);
859
855
  } catch (err) {
@@ -880,8 +876,6 @@ Field.setMethod(async function loadData(config, element) {
880
876
  }
881
877
  };
882
878
 
883
- console.log('Resource options:', resource_options)
884
-
885
879
  if (this.data_src) {
886
880
  resource_options.name = this.data_src;
887
881
  }
@@ -1121,7 +1121,7 @@ Table.setMethod(function getRemoteFetchConfig() {
1121
1121
  *
1122
1122
  * @author Jelle De Loecker <jelle@elevenways.be>
1123
1123
  * @since 0.2.0
1124
- * @version 0.2.3
1124
+ * @version 0.2.8
1125
1125
  */
1126
1126
  Table.setMethod(function applyFetchedData(err, result, config) {
1127
1127
 
@@ -1134,6 +1134,9 @@ Table.setMethod(function applyFetchedData(err, result, config) {
1134
1134
 
1135
1135
  if (Array.isArray(result)) {
1136
1136
  records = result;
1137
+ } else if (result.length) {
1138
+ // This way we keep `DocumentList` instances as they are!
1139
+ records = result;
1137
1140
  } else {
1138
1141
  records = result.records;
1139
1142
  }
@@ -24,7 +24,6 @@ FormAction.makeAbstractClass();
24
24
  */
25
25
  FormAction.startNewGroup('alchemy_form_actions');
26
26
 
27
-
28
27
  /**
29
28
  * Add a configuration property
30
29
  *
@@ -137,18 +137,13 @@ Leaf.setMethod(async function getPage(page_nr) {
137
137
 
138
138
  let provider = this.getProvider();
139
139
 
140
- console.log('Getting page...', page_nr, 'from', provider)
141
-
142
140
  if (!provider) {
143
141
  return;
144
142
  }
145
143
 
146
144
  let records = await provider.getAll();
147
145
 
148
- console.log('Got records:', records)
149
-
150
146
  return records;
151
-
152
147
  });
153
148
 
154
149
  /**
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.2.7",
4
+ "version": "0.2.8",
5
5
  "repository": {
6
6
  "type" : "git",
7
7
  "url" : "https://github.com/11ways/alchemy-form.git"