cavalion-vcl 1.1.45 → 1.1.48

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,6 +1,25 @@
1
+ ### 2022/01/22 - 1.1.48
2
+
3
+ * Removed obsolete files (./vcl-comps/*)
4
+ * Adding extra onLoad-event to cavalion-blocks
5
+ * Working on prototypes/ui/forms/Home.tree
6
+
7
+ ### 2022/01/18 - 1.1.47
8
+
9
+ `#CVLN-20220118-1`
10
+
11
+ * Workaround for weird rendering bug in ui/List
12
+
13
+ ### 2022/01/18 - 1.1.46
14
+
15
+ * **ui/List**: Adding "ignore-busy" class behaviour
16
+ * **ui/List**: Refactoring `groupByColumn(...)` -> `groupBy(column, ...)`
17
+ * **ui/List**: Refactoring `render` => `render_` (vcl/Control.prototype.render was not being overridden/nameclashing)
18
+
19
+
1
20
  ### 2022/01/07 - 1.1.45
2
21
 
3
- * Fix for `context` parameter in data/Array:onFilterObject-event
22
+ * **data/Array**: Fix for `context` parameter in `onFilterObject`-event
4
23
 
5
24
  ### 2022/01/04
6
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cavalion-vcl",
3
- "version": "1.1.45",
3
+ "version": "1.1.48",
4
4
  "description": "Visual Component Library for vcl-comps",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -4,8 +4,12 @@
4
4
  align: "client",
5
5
  onNodeCreated() {
6
6
  var uri = this.vars("uri") || js.sf("%s<%s>", this.getSpecializer(), this.vars("specializer") || this._name);
7
+ var onLoad = this.vars("onLoad");
7
8
  require("B").instantiate(uri, { owner: this }).then(_ => {
8
9
  _.setParent(this); // TODO why can't this be in property decl?
10
+ if(onLoad) {
11
+ onLoad.apply(this, [_]);
12
+ }
9
13
  });
10
14
  }
11
15
  }];
@@ -17,6 +17,7 @@ var Handlers = {
17
17
  form_scope = form.getScope();
18
18
  if(name === "formload" && !form_scope.left) {
19
19
  root_scope.description.revertPropertyValue("content");
20
+ // root_scope.description.setContent(form.vars(["description"]) || (form.qs("#description") || {})._content);
20
21
  // console.log(js.sf("%n / description set to: %s", root_scope.description, root_scope.description._content));
21
22
  }
22
23
  if(form_scope.left && form_scope.left._uri.endsWith("prototypes/ui/forms/View")) {
@@ -104,6 +105,7 @@ var Handlers = {
104
105
  form_scope = form.getScope();
105
106
  if(name === "formload" && !form_scope.left) {
106
107
  root_scope.description.revertPropertyValue("content");
108
+ // /*!!!*/root_scope.description.setContent("--reverted1--");
107
109
  }
108
110
  if(form_scope.left && form_scope.left._uri.endsWith("prototypes/ui/forms/View")) {
109
111
  if(name === "formload") {
@@ -195,6 +197,7 @@ var Handlers = {
195
197
  }
196
198
 
197
199
  scope.description.revertPropertyValue("content");
200
+ // /*!!!*/scope.description.setContent("--reverted2--");
198
201
  // console.log(js.sf("%n / description set to: %s", scope.description, scope.description._content));
199
202
 
200
203
  // Is there a node selected?
@@ -337,7 +340,7 @@ var Handlers = {
337
340
  // @overrides ui/forms/Home<>
338
341
  container.setVisible(false);
339
342
  container.setParent(scope.client);
340
- node.setText(params.title || "&nbsp;");
343
+ node.setText(params.text || params.title || "&nbsp;");
341
344
  node.setVar("control", container);
342
345
  node.setParent(parent || scope.tree);
343
346
  node.update(function() {
package/src/ui/Form.js CHANGED
@@ -27,7 +27,7 @@ define(function(require) {
27
27
  _onReflectHash: null,
28
28
 
29
29
  onshow: function() {
30
- /** s ../Control.prototype.onshow */
30
+ /** @overrides ../Control.prototype.onshow */
31
31
  if(this.fire("onShow", arguments) !== false) {
32
32
  var me = this;
33
33
  (function() {
@@ -43,12 +43,12 @@ define(function(require) {
43
43
  }
44
44
  },
45
45
  onhide: function() {
46
- /** s ../Control.prototype.onhide */
46
+ /** @overrides ../Control.prototype.onhide */
47
47
  if(this.fire("onHide", arguments) !== false) {
48
48
  }
49
49
  },
50
50
  visibleChanged: function() {
51
- /** s ../Control.prototype.visibleChanged */
51
+ /** @overrides ../Control.prototype.visibleChanged */
52
52
  var r = this.inherited(arguments);
53
53
 
54
54
  if(this.isVisible()) {
package/src/ui/List.js CHANGED
@@ -102,6 +102,15 @@ define(function(require) {
102
102
  _onColumnGetValue: null,
103
103
  _onColumnRenderCell: null,
104
104
 
105
+ /**-- #CVLN-20220118-1-workaround */
106
+ visibleChanged() {
107
+ if(this.isVisible()) {
108
+ // this.print("#CVLN-20220118-1 Calling rowHeightChanged-workaround");
109
+ this._body.rowHeightChanged();
110
+ }
111
+ return this.inherited(arguments);
112
+ },
113
+
105
114
  /**-- overrides ../Component.prototype */
106
115
  destroy: function() {
107
116
  /** @overrides ../Component.prototype.destroy */
@@ -212,7 +221,7 @@ define(function(require) {
212
221
  var topRow = parseInt(me._nodes.body.scrollTop / me._rowHeight, 10);
213
222
  me._topRow = topRow;
214
223
 
215
- me.render();
224
+ me.render_();
216
225
  }
217
226
 
218
227
  return this.inherited(arguments);
@@ -336,7 +345,7 @@ define(function(require) {
336
345
  },
337
346
 
338
347
  notifyEvent: function(event, data) {},
339
- render: function(bodyUpdateRows/*TODO*/) {
348
+ render_: function(bodyUpdateRows/*TODO*/) {
340
349
  if(bodyUpdateRows) return this._body.updateRows();
341
350
 
342
351
  var vrc = this.getVisibleRowCount(true);
@@ -346,8 +355,6 @@ define(function(require) {
346
355
  }
347
356
 
348
357
  var start = this._topRow - this._rowBuffer;
349
-
350
-
351
358
  var end = start + vrc + this._rowBuffer * 2;
352
359
 
353
360
  if(start < 0) {
@@ -390,7 +397,7 @@ define(function(require) {
390
397
  }
391
398
  }, 50);
392
399
  }
393
- this._body.render();
400
+ this._body.render_();
394
401
  },
395
402
  renderCell: function(cell, row, column) {
396
403
  var value, orgValue;
@@ -489,7 +496,7 @@ define(function(require) {
489
496
  }
490
497
  this.setSelection([]);
491
498
  //this.alignControls();
492
- this.render();
499
+ this.render_();
493
500
  }
494
501
  },
495
502
 
@@ -533,7 +540,7 @@ define(function(require) {
533
540
  setVisibleRowCount: function(value) {
534
541
  if(this._visibleRowCount !== value) {
535
542
  this._visibleRowCount = value;
536
- this.render();
543
+ this.render_();
537
544
  }
538
545
  },
539
546
 
@@ -655,12 +662,13 @@ define(function(require) {
655
662
  this.notifyEvent("columnsChanged");
656
663
  },
657
664
  updateColumns: function() {
658
- this.resetColumnAutoWidth();
659
-
660
665
  var updateColumns = this.updateColumns;
661
666
  this.updateColumns = function() {
662
667
  console.log("updateColumns blocked");
663
668
  };
669
+
670
+ this.resetColumnAutoWidth();
671
+
664
672
  try {
665
673
  if(this._source !== null) {
666
674
  var columns = [].concat(this._columns);
@@ -712,7 +720,7 @@ define(function(require) {
712
720
  for(var i = 0; i < this._columns.length; ++i) {
713
721
  this._columns[i].setAutoWidthValue("", true);
714
722
  }
715
- this.render();
723
+ this.render_();
716
724
  },
717
725
  getAutoColumns: function() {
718
726
  return this._autoColumns;
@@ -751,7 +759,7 @@ define(function(require) {
751
759
  break;
752
760
 
753
761
  case SourceEvent.busyChanged:
754
- if(data && this._topRow > 0) { /* TODO what about scrolling up? */
762
+ if((data && this._topRow > 0) || this.hasClass("ignore-busy")) { /* TODO what about scrolling up? */
755
763
  return;
756
764
  }
757
765
  this.setTimeout("update-busy", function() {
@@ -833,10 +841,10 @@ define(function(require) {
833
841
  }
834
842
  return value;
835
843
  },
836
- groupByColumn(column/*, ... TODO */) {
844
+ groupBy(column/*, ... TODO */) {
837
845
  var r = {};
838
846
  this._source.getObjects().forEach((obj, row) => {
839
- var value = this.getValueByColumnAndRow(column, row);
847
+ var value = this.valueByColumnAndRow(column, row);
840
848
  (r[value] = r[value] || []).push(obj);
841
849
  });
842
850
  return r;
@@ -53,7 +53,7 @@ define(function(require) {
53
53
  getList: function() {
54
54
  return this._parent !== null ? this._parent : null;
55
55
  },
56
- render: function() {
56
+ render_: function() {
57
57
  var list = this.getList();
58
58
  if(list.getCount() === 0) {
59
59
  this._firstRow = 0;
@@ -242,9 +242,8 @@ define(function(require) {
242
242
  return r;
243
243
  },
244
244
 
245
-
246
245
  groupBy: function() {
247
- return this._list.groupByColumn(this);
246
+ return this._list.groupBy(this);
248
247
  },
249
248
 
250
249
  sizing: function(evt) {
@@ -9,9 +9,7 @@ define(function(require) {
9
9
  var ListColumn = require("js/referenceClass!./List");
10
10
 
11
11
  var ListHeader = {
12
-
13
12
  inherits: Panel,
14
-
15
13
  prototype: {
16
14
 
17
15
  "@css": {
@@ -44,30 +42,17 @@ define(function(require) {
44
42
  }
45
43
  },
46
44
 
47
- /**
48
- *
49
- constructor: function() {
50
- },
51
- */
52
-
53
- /**
54
- * @overrides ../Control.prototype
55
- */
45
+ /** @overrides ../Control.prototype */
56
46
  _align: "top",
57
47
  _autoSize: "height",
58
48
  _content: "<div></div>",
59
49
 
60
- /**
61
- * @overrides ../Control.prototype.getClientNode
62
- */
63
50
  getClientNode: function() {
51
+ /** overrides ../Control.prototype.getClientNode */
64
52
  return this._node.childNodes[0];
65
53
  },
66
-
67
- /**
68
- * @overrides ../Control.prototype.setParent
69
- */
70
54
  setParent: function(value) {
55
+ /** overrides ../Control.prototype.setParent */
71
56
  if(this._parent !== value) {
72
57
  if(this._parent !== null) {
73
58
  Method.disconnect(this._parent, "notifyEvent", this, "listNotifyEvent");
@@ -81,11 +66,8 @@ define(function(require) {
81
66
  }
82
67
  }
83
68
  },
84
-
85
- /**
86
- * @overrides ../Control.prototype.dispatchChildEvent
87
- */
88
69
  dispatchChildEvent: function(component, name, evt, f) {
70
+ /** overrides ../Control.prototype.dispatchChildEvent */
89
71
  if(component instanceof ListColumn && component._parent === this) {
90
72
  if(name === "dragstart" && component.hasClass("size") === false) {
91
73
  var listview = this.getList();
@@ -141,25 +123,16 @@ define(function(require) {
141
123
  return this.inherited(arguments);
142
124
  },
143
125
 
144
- /**
145
- *
146
- */
147
126
  listNotifyEvent: function(event, data) {
148
127
  if(event === "setScrollLeft" && this._node !== null) {
149
128
  this._node/*.childNodes[0]*/.scrollLeft = data;
150
129
  }
151
130
  },
152
-
153
- /**
154
- *
155
- */
156
131
  getList: function() {
157
132
  return this._parent !== null ? this._parent : null;
158
133
  }
159
134
  },
160
-
161
135
  properties: {
162
-
163
136
  "align": {
164
137
  set: Method,
165
138
  type: Panel.ALIGN
@@ -172,4 +145,4 @@ define(function(require) {
172
145
  };
173
146
 
174
147
  return (ListHeader = Class.define(require, ListHeader));
175
- });
148
+ });
@@ -1,114 +0,0 @@
1
- "locale, vcl/ui/Node";
2
-
3
- var Node = require("vcl/ui/Node");
4
-
5
- var locale = window.locale;
6
-
7
- var styles = {
8
-
9
- "#search-panel": "padding: 4px 6px;",
10
- "#search": "padding: 4px; width: 100%; border-radius: 5px; border: 1px solid #f0f0f0;"
11
- };
12
- var handlers = {
13
- "loaded": function() {
14
- var scope = this.scope();
15
-
16
- scope.tree.refresh();
17
-
18
- // var arr = scope.nodes._array;
19
- // scope.nodes.setArray(null);
20
- // scope.nodes.setArray(arr);
21
- }
22
- }
23
-
24
- var letters = "aaaaaabbccdddeeeeeeeeefgghiiijjkklllmmnnnnnnoooooppqrrssttuuuuuvvwxyzzz";
25
- function randomWord() {
26
- var n = Math.random() * 10;
27
- if(n > 7) {
28
- n += Math.random() * 5;
29
- }
30
-
31
- n = parseInt(n) + 1;
32
-
33
- var r = "", p;
34
- while(n-- >= 0) {
35
- p = parseInt(Math.random() * letters.length);
36
- r += letters.substring(p, p + 1);
37
- }
38
-
39
- return r.substring(0, 1).toUpperCase() + r.substring(1);
40
- }
41
-
42
- function Node_render() {
43
- /**
44
- * @overrides Node.prototype.render
45
- */
46
- var record = this._vars.record;
47
- // this._nodes.text.innerHTML =
48
- this._nodes.icon.innerHTML = String.format("<i class='fa fa-%s'></i>", record.icon);
49
- this._nodes.text.textContent = record.text;
50
- }
51
-
52
- var ID = 7;
53
-
54
- $("vcl/ui/Form", { css: styles, handlers: handlers }, [
55
-
56
- $("vcl/ui/Panel#search-panel", { align: "top", autoSize: "height" }, [
57
- $("vcl/ui/Input#search")
58
- ]),
59
-
60
- $("vcl/data/Array#nodes", {
61
- array: [
62
- { id: 1, parent: 0, text: locale("Root"), icon: "home" },
63
- { id: 2, parent: 1, text: locale("Sub1") },
64
- { id: 3, parent: 1, text: locale("Sub2") },
65
- { id: 4, parent: 1, text: locale("Sub3 ++ ") },
66
- { id: 6, parent: 4, text: "Sub3.1" },
67
- { id: 5, parent: 1, text: locale("Sub4") }
68
- ]
69
- }),
70
-
71
- $("vcl/ui/Tree#tree", { align: "left", width: 300,
72
- onSelectionChange: function() {
73
- // this.scope().console.print("selectionchange", arguments);
74
- },
75
- onNodesNeeded: function(parent) {
76
- var scope = this.scope(), owner = this._owner;
77
-
78
- if(parent === null) {
79
- parent = this;
80
- scope.nodes.getArray().forEach(function(record) {
81
- if(record.parent === 0) {
82
- node = new Node(owner);
83
- node.render = Node_render;
84
- node.setVar("record", record);
85
- node.setExpandable(true);
86
- node.setParent(parent);
87
- }
88
- });
89
- } else {
90
- var parentId = parent.getVar("record.id");
91
- parent.setExpandable(false);
92
- // parent.addClass("loading");
93
- setTimeout(function() {
94
- parent.setExpandable(true);
95
- parent.removeClass("loading");
96
- for(var i = 0; i < 2 + Math.random() * 20; ++i) {
97
- var record = {text: randomWord(), id: ID++};
98
-
99
- node = new Node(owner);
100
- node.render = Node_render;
101
- node.setVar("record", record);
102
- node.setExpandable(true);
103
- node.setParent(parent);
104
- }
105
-
106
- }, Math.round(Math.random() * 500));
107
- }
108
- } }),//, source: "#nodes" }),
109
-
110
- $("vcl/ui/List", { autoColumns: true, align: "client", source: "nodes" }),
111
-
112
- $("vcl/ui/Console#console", { align: "bottom", height: 200, onEvaluate: function(expr) { var scope = this.scope(); return eval(expr); }})
113
-
114
- ]);