cavalion-vcl 1.1.73 → 1.1.74
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/.md +11 -0
- package/CHANGELOG.md +20 -0
- package/SNIPPETS.md +10 -0
- package/package.json +1 -1
- package/src/Component.js +1 -1
- package/src/Control.js +6 -0
- package/src/Factory.js +23 -15
- package/src/Reader.js +31 -52
- package/src/data/Array.js +1 -1
- package/src/prototypes/App.desktop.js +3 -3
- package/src/prototypes/App.toast.js +18 -3
- package/src/prototypes/ui/forms/Home.tree.js +29 -34
- package/src/ui/Select.js +2 -1
package/.md
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
* [CHANGELOG.md]() - [README.md]() - [package.json]()
|
|
2
|
+
* [SNIPPETS.md]()
|
|
2
3
|
* [.workspace](`(devtools/Workspace<${ws.getSpecializer()}>)`) - [.js]() - [src](:/)
|
|
3
4
|
|
|
5
|
+
# `2023/05/12` Gelijk trekken textRenders en rendering
|
|
6
|
+
|
|
7
|
+
* Control vs ListColumn?
|
|
8
|
+
|
|
9
|
+
# `2023/05/11` up() does not find closeable nodes
|
|
10
|
+
|
|
11
|
+
Sigh! The infamous vcl/ui/Node.closeable seems to bite me in the ass.
|
|
12
|
+
|
|
13
|
+
* **Solution**: Use [Node-closeable](src/vcl/ui/:.js) instead
|
|
14
|
+
|
|
4
15
|
# cavalion-vcl / classes
|
|
5
16
|
|
|
6
17
|
* [Factory](src/:.js) [.parse](src/Factory:.js) - [Reader](src/:.js) - [Writer](src/:.js)
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,23 @@
|
|
|
1
|
+
### 2023/05/29 - 1.1.74
|
|
2
|
+
|
|
3
|
+
* Node.closeable deprecated
|
|
4
|
+
|
|
5
|
+
* `af4757a` - refactors Node.closeable => Node-closeable updates loading style for Nodes adds SNIPPETS.md
|
|
6
|
+
|
|
7
|
+
* Adding debugging tools
|
|
8
|
+
|
|
9
|
+
* `3d7b43e` - adds Control.tree() - useful for debugging nested structure of controls
|
|
10
|
+
* `9421731` - adds dumpControls snippet removes comments fixes deps global
|
|
11
|
+
|
|
12
|
+
* Working on vcl/prototype
|
|
13
|
+
|
|
14
|
+
* `1720907` - fixes message params situation
|
|
15
|
+
* `fc159df` - fixes ms situation with toasts fixes toast styles
|
|
16
|
+
|
|
17
|
+
* Minor changes
|
|
18
|
+
|
|
19
|
+
* `6e3222b` - updates toast style
|
|
20
|
+
|
|
1
21
|
### 2023/03/26 - 1.1.73
|
|
2
22
|
|
|
3
23
|
* Fixes issues with Component.getImplicitBasesByUri
|
package/SNIPPETS.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# `2023/05/06` Snippet
|
|
2
|
+
|
|
3
|
+
const dumpControls = (parent) => parent.getControls().reduce((r, c) => {
|
|
4
|
+
r[js.nameOf(c)] = dumpControls(c);
|
|
5
|
+
return r;
|
|
6
|
+
}, Object.create(parent, { hashCode: { value: () => ";-)" } }));
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
* [Control.js](src/Control.js) - require("vcl/Control").dump
|
|
10
|
+
|
package/package.json
CHANGED
package/src/Component.js
CHANGED
package/src/Control.js
CHANGED
|
@@ -1852,6 +1852,12 @@ this._updateCalls = this._updateCalls || 0; this._updateCalls++;
|
|
|
1852
1852
|
updateCallCount: 0,
|
|
1853
1853
|
|
|
1854
1854
|
focused: null,
|
|
1855
|
+
|
|
1856
|
+
tree: (root) => root.getControls().reduce((r, c) => {
|
|
1857
|
+
r[js.nameOf(c)] = Control.tree(c);
|
|
1858
|
+
return r;
|
|
1859
|
+
}, Object.create(root, { hashCode: { value: () => ";-)" } })),
|
|
1860
|
+
|
|
1855
1861
|
|
|
1856
1862
|
findByNode: function(node) {
|
|
1857
1863
|
while(node !== null && node[EventDispatcher.elementKey] === undefined) {
|
package/src/Factory.js
CHANGED
|
@@ -141,21 +141,17 @@ define(function(require) {
|
|
|
141
141
|
},
|
|
142
142
|
load: function(source, success, failure) {
|
|
143
143
|
if(source.charAt(0) === "\"" && source.indexOf("\"use strict\";") !== 0) {
|
|
144
|
+
/*- Parse require section */
|
|
144
145
|
if(source.indexOf("\"use ") === 0) {
|
|
145
|
-
// TODO this should be the default
|
|
146
|
-
source = "\"" + source.substring(5);
|
|
146
|
+
source = "\"" + source.substring(5); // TODO this should be the default
|
|
147
147
|
}
|
|
148
|
-
/*- Parse require section */
|
|
149
148
|
var i = source.indexOf("\";");
|
|
150
149
|
if(i !== -1) {
|
|
151
|
-
deps = source.substring(1, i).replace(/\s/g, "");
|
|
152
|
-
deps = deps.split(",");
|
|
153
|
-
|
|
150
|
+
var deps = source.substring(1, i).replace(/\s/g, "");
|
|
154
151
|
/*- require all dependecies */
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
}, failure);
|
|
152
|
+
return this._parentRequire(deps.split(","),
|
|
153
|
+
() => this.doLoad(source, success, failure),
|
|
154
|
+
failure);
|
|
159
155
|
}
|
|
160
156
|
}
|
|
161
157
|
return this.doLoad(source, success, failure);
|
|
@@ -515,6 +511,12 @@ define(function(require) {
|
|
|
515
511
|
DEFAULT_NAMESPACES: {
|
|
516
512
|
},
|
|
517
513
|
|
|
514
|
+
overrides: function(reg, req) {
|
|
515
|
+
for(var k in reg) {
|
|
516
|
+
define(js.sf("vcl/Factory!%s", k), reg[k], new Factory(req || window.require, k))
|
|
517
|
+
}
|
|
518
|
+
},
|
|
519
|
+
|
|
518
520
|
implicit_sources: {},
|
|
519
521
|
|
|
520
522
|
load: function(name, parentRequire, load, config) {
|
|
@@ -527,11 +529,10 @@ define(function(require) {
|
|
|
527
529
|
var sourceUri = Factory.makeTextUri(name);
|
|
528
530
|
|
|
529
531
|
function instantiate(source, local) {
|
|
530
|
-
var
|
|
532
|
+
var p = "";//local ? ".skip-fetch.local" : "";
|
|
533
|
+
var factory = new Factory(parentRequire, name + p, sourceUri + p);
|
|
531
534
|
// console.log("instantiate", name + p);
|
|
532
|
-
factory.load(source,
|
|
533
|
-
load(factory, source);
|
|
534
|
-
});
|
|
535
|
+
factory.load(source, () => load(factory, source));
|
|
535
536
|
}
|
|
536
537
|
|
|
537
538
|
function fallback() {
|
|
@@ -548,6 +549,14 @@ define(function(require) {
|
|
|
548
549
|
});
|
|
549
550
|
}
|
|
550
551
|
|
|
552
|
+
if(name.endsWith(".skip-fetch")) {
|
|
553
|
+
// console.log("skip-fetch", name);
|
|
554
|
+
name = name.split(".");
|
|
555
|
+
name.pop();
|
|
556
|
+
name = name.join(".");
|
|
557
|
+
return fallback()
|
|
558
|
+
}
|
|
559
|
+
|
|
551
560
|
// console.log("fetch", name);
|
|
552
561
|
this.fetch(name)
|
|
553
562
|
.then(source => source ? instantiate(source, true) : fallback())
|
|
@@ -651,6 +660,5 @@ define(function(require) {
|
|
|
651
660
|
},
|
|
652
661
|
getFactoryUri: getFactoryUri
|
|
653
662
|
}
|
|
654
|
-
|
|
655
663
|
}));
|
|
656
664
|
});
|
package/src/Reader.js
CHANGED
|
@@ -26,9 +26,6 @@ define(function(require) {
|
|
|
26
26
|
_uri: null,
|
|
27
27
|
_references: null,
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
29
|
constructor: function(factory, root) {
|
|
33
30
|
this._factory = factory;
|
|
34
31
|
if(root !== undefined) {
|
|
@@ -36,17 +33,17 @@ define(function(require) {
|
|
|
36
33
|
}
|
|
37
34
|
},
|
|
38
35
|
|
|
39
|
-
/**
|
|
40
|
-
* Read the source of a component. Basically instantiates a
|
|
41
|
-
* component
|
|
42
|
-
*
|
|
43
|
-
* @param source
|
|
44
|
-
* The actual source
|
|
45
|
-
* @param uri
|
|
46
|
-
* The uri of the source and thus the resulting root
|
|
47
|
-
* component
|
|
48
|
-
*/
|
|
49
36
|
read: function(source, uri) {
|
|
37
|
+
/**
|
|
38
|
+
* Read the source of a component. Basically instantiates a
|
|
39
|
+
* component
|
|
40
|
+
*
|
|
41
|
+
* @param source
|
|
42
|
+
* The actual source
|
|
43
|
+
* @param uri
|
|
44
|
+
* The uri of the source and thus the resulting root
|
|
45
|
+
* component
|
|
46
|
+
*/
|
|
50
47
|
var deferred = new Deferred();
|
|
51
48
|
var thisObj = this;
|
|
52
49
|
|
|
@@ -81,22 +78,21 @@ define(function(require) {
|
|
|
81
78
|
|
|
82
79
|
return deferred;
|
|
83
80
|
},
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Instantiates a component based upon a definition hold by a node
|
|
87
|
-
* which was delivered/parsed by Reader.evaluate. It figures out
|
|
88
|
-
* whether the node references a inherited ComponentClass or
|
|
89
|
-
* inherited component.
|
|
90
|
-
*
|
|
91
|
-
* @param node
|
|
92
|
-
* The actual node holding information to it's inherited
|
|
93
|
-
* prototypes, name, properties, children
|
|
94
|
-
* @param success
|
|
95
|
-
* To receive the component
|
|
96
|
-
* @param failure
|
|
97
|
-
* To receive errors
|
|
98
|
-
*/
|
|
99
81
|
instantiateComponent: function(node, success, failure) {
|
|
82
|
+
/**
|
|
83
|
+
* Instantiates a component based upon a definition hold by a node
|
|
84
|
+
* which was delivered/parsed by Reader.evaluate. It figures out
|
|
85
|
+
* whether the node references a inherited ComponentClass or
|
|
86
|
+
* inherited component.
|
|
87
|
+
*
|
|
88
|
+
* @param node
|
|
89
|
+
* The actual node holding information to it's inherited
|
|
90
|
+
* prototypes, name, properties, children
|
|
91
|
+
* @param success
|
|
92
|
+
* To receive the component
|
|
93
|
+
* @param failure
|
|
94
|
+
* To receive errors
|
|
95
|
+
*/
|
|
100
96
|
var component, me = this;
|
|
101
97
|
if(node.inherits instanceof Array) {
|
|
102
98
|
// inherits (a) ComponentClass-instance(s), require all the
|
|
@@ -133,10 +129,6 @@ define(function(require) {
|
|
|
133
129
|
success(component);
|
|
134
130
|
}
|
|
135
131
|
},
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
*
|
|
139
|
-
*/
|
|
140
132
|
createRootComponent: function(rootNode, success, failure) {
|
|
141
133
|
var me = this;
|
|
142
134
|
|
|
@@ -185,10 +177,6 @@ define(function(require) {
|
|
|
185
177
|
f(this._root);
|
|
186
178
|
}
|
|
187
179
|
},
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
*
|
|
191
|
-
*/
|
|
192
180
|
initializeComponent: function(component, node, success, failure) {
|
|
193
181
|
if(component !== this._root) {
|
|
194
182
|
// This is an owned/nested component
|
|
@@ -220,10 +208,6 @@ define(function(require) {
|
|
|
220
208
|
success(component);
|
|
221
209
|
}
|
|
222
210
|
},
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
*
|
|
226
|
-
*/
|
|
227
211
|
createComponents: function(nodes, success, failure) {
|
|
228
212
|
var count = nodes.length;
|
|
229
213
|
var result;
|
|
@@ -245,16 +229,12 @@ define(function(require) {
|
|
|
245
229
|
});
|
|
246
230
|
}
|
|
247
231
|
},
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
*
|
|
251
|
-
*/
|
|
252
232
|
setProperties: function(component, node) {
|
|
253
233
|
// extend properties
|
|
254
234
|
component['@properties'] = js.extend(component['@properties'] || {}, node.properties);
|
|
255
235
|
|
|
256
236
|
var properties = component.defineProperties();
|
|
257
|
-
for(
|
|
237
|
+
for(var k in node.properties) {
|
|
258
238
|
var property;
|
|
259
239
|
if((property = properties[k]) === undefined) {
|
|
260
240
|
// console.warn(String.format("Property %n.%s does not exist - %n", component.constructor, k,
|
|
@@ -265,14 +245,13 @@ define(function(require) {
|
|
|
265
245
|
}
|
|
266
246
|
}
|
|
267
247
|
},
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
*
|
|
271
|
-
* @param property
|
|
272
|
-
* @param component
|
|
273
|
-
* @param value
|
|
274
|
-
*/
|
|
275
248
|
setPropertyValue: function(property, component, value) {
|
|
249
|
+
/**
|
|
250
|
+
*
|
|
251
|
+
* @param property
|
|
252
|
+
* @param component
|
|
253
|
+
* @param value
|
|
254
|
+
*/
|
|
276
255
|
if(property.isReference()) {
|
|
277
256
|
this._references.push({
|
|
278
257
|
property: property,
|
package/src/data/Array.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
var scope = this.getScope();
|
|
16
16
|
var elem = new Element(this);
|
|
17
17
|
|
|
18
|
-
var timeout = options.hasOwnProperty("timeout") ? options.timeout : 1500;
|
|
18
|
+
var timeout = options.ms || (options.hasOwnProperty("timeout") ? options.timeout : 1500);
|
|
19
19
|
var content = options.content || "No toast content";
|
|
20
20
|
var classes = options.classes || "fade";
|
|
21
21
|
|
|
@@ -64,9 +64,10 @@
|
|
|
64
64
|
},
|
|
65
65
|
right: "0",
|
|
66
66
|
left: "0",
|
|
67
|
-
bottom: "
|
|
67
|
+
bottom: "20px",
|
|
68
68
|
"z-index": "20000",
|
|
69
69
|
"pointer-events": "none",
|
|
70
|
+
|
|
70
71
|
".{./Element}": {
|
|
71
72
|
"pointer-events": "all",
|
|
72
73
|
"a": {
|
|
@@ -117,7 +118,21 @@
|
|
|
117
118
|
"&.padding-right-20px": {
|
|
118
119
|
"padding-right": "20px"
|
|
119
120
|
},
|
|
120
|
-
|
|
121
|
+
"&.centered": {
|
|
122
|
+
"text-align": "center",
|
|
123
|
+
// ".{./Element}": {
|
|
124
|
+
"margin-left": "auto",
|
|
125
|
+
"margin-right": "auto",
|
|
126
|
+
"text-align": "left",
|
|
127
|
+
"float": "none"
|
|
128
|
+
// },
|
|
129
|
+
},
|
|
130
|
+
"&.paragraph": {
|
|
131
|
+
'max-width': "35%"
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
|
|
121
136
|
}
|
|
122
137
|
}]
|
|
123
138
|
]];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"vcl/ui/LargeIcon, vcl/ui/Node, vcl/ui/FormContainer, vcl/ui/Node
|
|
1
|
+
"vcl/ui/LargeIcon, vcl/ui/Node, vcl/ui/FormContainer, vcl/ui/Node-closeable";
|
|
2
2
|
|
|
3
3
|
var Node = require("vcl/ui/Node");
|
|
4
4
|
var FormContainer = require("vcl/ui/FormContainer");
|
|
@@ -219,7 +219,7 @@ var Handlers = {
|
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
221
|
|
|
222
|
-
["", {
|
|
222
|
+
[(""), {
|
|
223
223
|
vars: {
|
|
224
224
|
"App": {
|
|
225
225
|
getState: function() {
|
|
@@ -297,22 +297,16 @@ var Handlers = {
|
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
},
|
|
300
|
-
onMessage: function(name,
|
|
300
|
+
onMessage: function(name, message, sender) {
|
|
301
301
|
var scope = this.getScope();
|
|
302
302
|
|
|
303
303
|
if(name === "openform") {
|
|
304
|
-
var Node = require("vcl/ui/Node
|
|
304
|
+
var Node = require("vcl/ui/Node-closeable");
|
|
305
305
|
var FormContainer = require("vcl/ui/FormContainer");
|
|
306
306
|
|
|
307
307
|
// TODO Merge with Portal
|
|
308
308
|
|
|
309
|
-
var parent =
|
|
310
|
-
|
|
311
|
-
// TODO find the correct parent based upon the sender
|
|
312
|
-
// while(parent && parent.getVar("control")._form !== sender._owner) {
|
|
313
|
-
// parent = parent._parent;
|
|
314
|
-
// }
|
|
315
|
-
|
|
309
|
+
var parent = message.parent || scope.tree.getSelection()[0];
|
|
316
310
|
var node = new Node(this);
|
|
317
311
|
node.override({
|
|
318
312
|
onclick: function(evt) {
|
|
@@ -326,21 +320,22 @@ var Handlers = {
|
|
|
326
320
|
node.addClass("closeable");
|
|
327
321
|
|
|
328
322
|
var container = new FormContainer(node);
|
|
329
|
-
container.setFormUri(
|
|
330
|
-
if(
|
|
331
|
-
container.setFormParams(
|
|
332
|
-
node.setVars(
|
|
323
|
+
container.setFormUri(message.uri);
|
|
324
|
+
if(message.params) {
|
|
325
|
+
container.setFormParams(message.params);
|
|
326
|
+
node.setVars(message.params);
|
|
333
327
|
}
|
|
334
328
|
|
|
335
|
-
if(
|
|
336
|
-
node.print("varring path",
|
|
337
|
-
node.vars("path",
|
|
329
|
+
if(message.path) {
|
|
330
|
+
node.print("varring path", message.path);
|
|
331
|
+
node.vars("path", message.path);
|
|
338
332
|
}
|
|
339
333
|
|
|
340
334
|
// @overrides ui/forms/Home<>
|
|
341
335
|
container.setVisible(false);
|
|
342
336
|
container.setParent(scope.client);
|
|
343
|
-
|
|
337
|
+
|
|
338
|
+
node.setText(message.text || message.title || " ");
|
|
344
339
|
node.setVar("control", container);
|
|
345
340
|
node.setParent(parent || scope.tree);
|
|
346
341
|
node.update(function() {
|
|
@@ -354,12 +349,12 @@ var Handlers = {
|
|
|
354
349
|
},
|
|
355
350
|
"formloadstart": function() {
|
|
356
351
|
node.addClass("loading");
|
|
357
|
-
node.setText(
|
|
352
|
+
node.setText(message.title || " ");
|
|
358
353
|
},
|
|
359
354
|
"formloadend": function() {
|
|
360
355
|
node.removeClass("loading");
|
|
361
|
-
if(
|
|
362
|
-
|
|
356
|
+
if(message.callback) {
|
|
357
|
+
message.callback(this._form);
|
|
363
358
|
}
|
|
364
359
|
},
|
|
365
360
|
"formload": function() {
|
|
@@ -370,7 +365,7 @@ var Handlers = {
|
|
|
370
365
|
if (text instanceof Array) {
|
|
371
366
|
node.setText(text.join(""));
|
|
372
367
|
} else {
|
|
373
|
-
node.setText(String.format("%H", text ||
|
|
368
|
+
node.setText(String.format("%H", text || message.title));
|
|
374
369
|
}
|
|
375
370
|
}
|
|
376
371
|
form.on("captionchanged", f);
|
|
@@ -382,17 +377,17 @@ var Handlers = {
|
|
|
382
377
|
parent.setExpanded(true);
|
|
383
378
|
}
|
|
384
379
|
|
|
385
|
-
if(
|
|
380
|
+
if(message.activate !== false) {
|
|
386
381
|
scope.tree.setSelection([node]);
|
|
387
|
-
} else if(
|
|
382
|
+
} else if(message.lazyLoad !== true) {
|
|
388
383
|
container.forceLoad();
|
|
389
384
|
}
|
|
390
385
|
|
|
391
|
-
parent && parent.setTimeout("update", () => {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
}, 500);
|
|
386
|
+
// parent && parent.setTimeout("update", () => {
|
|
387
|
+
// // Hmprf, what is going on here?
|
|
388
|
+
// parent._parent.updateChildren(true, true);
|
|
389
|
+
// parent._parent.updateChildren(true, true);
|
|
390
|
+
// }, 500);
|
|
396
391
|
|
|
397
392
|
return true;
|
|
398
393
|
}
|
|
@@ -407,11 +402,11 @@ var Handlers = {
|
|
|
407
402
|
"padding-left": "16px",
|
|
408
403
|
".{./Node}": {
|
|
409
404
|
"&.loading": {
|
|
410
|
-
"background-image": "url(/shared/vcl/images/loading.gif)",
|
|
411
|
-
"background-repeat": "no-repeat",
|
|
412
|
-
"background-position": "-8px 4px",
|
|
413
405
|
">.selection": {
|
|
414
|
-
|
|
406
|
+
"background-image": "url(/shared/vcl/images/loading.gif)",
|
|
407
|
+
"background-repeat": "no-repeat",
|
|
408
|
+
"background-position": "10px 5px",
|
|
409
|
+
// "opacity": "0.5"
|
|
415
410
|
},
|
|
416
411
|
"&.selected >.text": {
|
|
417
412
|
"font-weight": "normal"
|