glib-web 4.4.0 → 4.4.1

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.
@@ -3,13 +3,13 @@ export default class {
3
3
  const dynamicGroupEntry = component.$closest("fields/internalDynamicGroupEntry");
4
4
  if (dynamicGroupEntry) {
5
5
  const values = dynamicGroupEntry.$values(spec.paramNameForFieldName || 'entry');
6
- this.executeOnGet(spec, values)
6
+ this.executeOnGet(spec, values, component)
7
7
  } else {
8
8
  console.error('Action invoked outside of dynamicGroup')
9
9
  }
10
10
  }
11
11
 
12
- executeOnGet(spec, formData) {
12
+ executeOnGet(spec, formData, component) {
13
13
  Utils.type.ifObject(spec.onGet, onGet => {
14
14
  const params = {
15
15
  // Make sure to pass along the formData from the spec.
@@ -17,7 +17,7 @@ export default class {
17
17
  };
18
18
 
19
19
  const data = Object.assign({}, onGet, params);
20
- GLib.action.execute(data, this);
20
+ GLib.action.execute(data, component);
21
21
  });
22
22
  }
23
23
  }
@@ -25,19 +25,31 @@ export default class {
25
25
  execute(spec, component) {
26
26
  let targetComponent = component;
27
27
 
28
- if (spec.targetId) {
29
- targetComponent = GLib.component.findById(spec.targetId);
30
- } else if (spec.targetIds) {
31
- targetComponent = spec.targetIds.map((id) => GLib.component.findById(id));
32
- }
33
- else {
34
- console.error(`id not recognized=${spec.targetId}`);
28
+ const dynamicGroupEntry = component.$closest("fields/internalDynamicGroupEntry");
29
+ const targetIds = spec.targetId ? [spec.targetId] : spec.targetIds
30
+ if (targetIds.length > 0) {
31
+ targetComponent = targetIds.map((id) => {
32
+ if (dynamicGroupEntry) {
33
+ id = dynamicGroupEntry.$populateIndexes(id);
34
+ }
35
+ return GLib.component.findById(id)
36
+ });
35
37
  }
36
38
 
37
39
  let data = {};
38
40
  Utils.type.ifObject(spec.conditionalData, (properties) => {
39
41
  for (const key in properties) {
40
- data[key] = jsonLogic.apply(properties[key], Object.assign({}, fieldModels, spec.variables));
42
+ let condition = properties[key];
43
+ if (dynamicGroupEntry) {
44
+ condition = dynamicGroupEntry.$populateIndexes(condition);
45
+ }
46
+ if (spec.debug) {
47
+ console.log("Evaluating...", key, condition);
48
+ }
49
+ data[key] = jsonLogic.apply(condition, Object.assign({}, fieldModels, spec.variables));
50
+ if (spec.debug) {
51
+ console.log("Result: ", key, data[key]);
52
+ }
41
53
  }
42
54
  });
43
55
  Utils.type.ifObject(spec.data, (additionalData) => {
@@ -3,9 +3,14 @@ export default class {
3
3
  return true;
4
4
  }
5
5
 
6
- execute(properties, component) {
7
- for (const action of properties.childActions) {
8
- GLib.action.execute(action, component);
6
+ execute(spec, component) {
7
+ for (const actionSpec of spec.childActions) {
8
+ const params = {
9
+ // Make sure to pass along the formData from the spec.
10
+ formData: spec.formData
11
+ }
12
+ const properties = Object.assign({}, actionSpec, params);
13
+ GLib.action.execute(properties, component);
9
14
  }
10
15
  }
11
16
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <!-- This component doesn't provide anything new in the frontend. It's mainly for backend model fields organization. -->
3
- <panels-responsive :spec="spec" />
3
+ <common-responsive ref="delegate" :spec="spec" />
4
4
  </template>
5
5
 
6
6
  <script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glib-web",
3
- "version": "4.4.0",
3
+ "version": "4.4.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -48,11 +48,6 @@ export default {
48
48
  if (spec && spec.id && this.$registryEnabled()) {
49
49
  GLib.component.deregister(spec.id, this);
50
50
  }
51
-
52
- // Utils.type.ifString(this.viewId, (viewId) => {
53
- // console.log("DEREGISTER DATA1", viewId)
54
- // GLib.component.deregisterData(viewId);
55
- // })
56
51
  },
57
52
  $registryEnabled() {
58
53
  // Common classes such as `_select` need to return false so that it doesn't override its parent (e.g. `select`).