json-object-editor 0.10.439 → 0.10.440
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 +1 -0
- package/css/joe-styles.css +16 -0
- package/css/joe.css +16 -0
- package/js/JsonObjectEditor.jquery.craydent.js +50 -4
- package/js/joe-full.js +50 -4
- package/js/joe.js +50 -4
- package/package.json +1 -1
- package/server/schemas/goal.js +17 -3
- package/server/schemas/tag.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
## CHANGELOG
|
|
2
2
|
|
|
3
3
|
### 0.10.400
|
|
4
|
+
440 - added joe-chip, tags rendering logic
|
|
4
5
|
439 - Enhanced route handling in Sites.js to support paths with and without leading slashes.
|
|
5
6
|
438 - enhance get function with itemtype parameter, and improve notifier functionality
|
|
6
7
|
437 - tagsList optimized using cache
|
package/css/joe-styles.css
CHANGED
|
@@ -3497,7 +3497,23 @@ th.joe-objectlist-object-row-template-header {
|
|
|
3497
3497
|
color:#202020;
|
|
3498
3498
|
margin:3px;
|
|
3499
3499
|
}
|
|
3500
|
+
/*-------------------------
|
|
3501
|
+
T2: Chips
|
|
3502
|
+
-------------------------*/
|
|
3500
3503
|
|
|
3504
|
+
joe-chips{
|
|
3505
|
+
display:block;
|
|
3506
|
+
position:relative;
|
|
3507
|
+
font-size:12px;
|
|
3508
|
+
/* padding:3px; */
|
|
3509
|
+
}
|
|
3510
|
+
joe-chip{
|
|
3511
|
+
display: inline-block;
|
|
3512
|
+
padding:2px 4px;
|
|
3513
|
+
background: #eee;
|
|
3514
|
+
color:#202020;
|
|
3515
|
+
margin:3px;
|
|
3516
|
+
}
|
|
3501
3517
|
/*-------------------------
|
|
3502
3518
|
V: Preview
|
|
3503
3519
|
-------------------------*/
|
package/css/joe.css
CHANGED
|
@@ -3983,7 +3983,23 @@ th.joe-objectlist-object-row-template-header {
|
|
|
3983
3983
|
color:#202020;
|
|
3984
3984
|
margin:3px;
|
|
3985
3985
|
}
|
|
3986
|
+
/*-------------------------
|
|
3987
|
+
T2: Chips
|
|
3988
|
+
-------------------------*/
|
|
3986
3989
|
|
|
3990
|
+
joe-chips{
|
|
3991
|
+
display:block;
|
|
3992
|
+
position:relative;
|
|
3993
|
+
font-size:12px;
|
|
3994
|
+
/* padding:3px; */
|
|
3995
|
+
}
|
|
3996
|
+
joe-chip{
|
|
3997
|
+
display: inline-block;
|
|
3998
|
+
padding:2px 4px;
|
|
3999
|
+
background: #eee;
|
|
4000
|
+
color:#202020;
|
|
4001
|
+
margin:3px;
|
|
4002
|
+
}
|
|
3987
4003
|
/*-------------------------
|
|
3988
4004
|
V: Preview
|
|
3989
4005
|
-------------------------*/
|
|
@@ -304,10 +304,43 @@ function JsonObjectEditor(specs){
|
|
|
304
304
|
}
|
|
305
305
|
this.Data = {};
|
|
306
306
|
this.Render = {
|
|
307
|
-
schema_icon:function(schema,classes){
|
|
308
|
-
var icon = (self.schemas[schema] && self.schemas[schema].menuicon)||'';
|
|
309
|
-
icon && (icon = `<joe-icon class="${classes ||''}">${icon}</joe-icon>`);
|
|
307
|
+
schema_icon: function (schema, classes) {
|
|
308
|
+
var icon = (self.schemas[schema] && self.schemas[schema].menuicon) || '';
|
|
309
|
+
icon && (icon = `<joe-icon class="${classes || ''}">${icon}</joe-icon>`);
|
|
310
310
|
return icon;
|
|
311
|
+
},
|
|
312
|
+
ref_chip: function (things, specs) {
|
|
313
|
+
specs = typeof specs === 'string' ? { cssclass: specs } : (specs || {});
|
|
314
|
+
const items = Array.isArray(things) ? things : things?.tags || [];
|
|
315
|
+
if (!items.length) return '';
|
|
316
|
+
|
|
317
|
+
const labelProp = specs.labelProp || 'name';
|
|
318
|
+
const tooltipProp = specs.tooltipProp === false ? null : (specs.tooltipProp || 'info');
|
|
319
|
+
|
|
320
|
+
let html = `<joe-chips class="${specs.cssclass || ''}">`;
|
|
321
|
+
|
|
322
|
+
items.forEach(ref => {
|
|
323
|
+
const obj = typeof ref === 'object' ? ref : $J.get(ref);
|
|
324
|
+
if (!obj) return;
|
|
325
|
+
|
|
326
|
+
const label = obj[labelProp] || '';
|
|
327
|
+
const title = tooltipProp && obj[tooltipProp] ? ` title="${obj[tooltipProp]}"` : '';
|
|
328
|
+
|
|
329
|
+
let style = '';
|
|
330
|
+
if (specs.useStatusColor && obj.status) {
|
|
331
|
+
const statusObj = _joe.Cache.get(obj.status);
|
|
332
|
+
if (statusObj?.color) {
|
|
333
|
+
style = ` style="border-left:4px solid ${statusObj.color}"`;
|
|
334
|
+
}
|
|
335
|
+
} else if (obj.color) {
|
|
336
|
+
style = ` style="background:${obj.color}"`;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
html += `<joe-chip data-id="${obj._id}"${title}${style}>${label}</joe-chip>`;
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
html += '</joe-chips>';
|
|
343
|
+
return html;
|
|
311
344
|
}
|
|
312
345
|
};
|
|
313
346
|
//TODO: make current.clear a function
|
|
@@ -9901,7 +9934,8 @@ logit(intent)
|
|
|
9901
9934
|
+'</joe-user-cube>';
|
|
9902
9935
|
|
|
9903
9936
|
return html;
|
|
9904
|
-
}
|
|
9937
|
+
},
|
|
9938
|
+
|
|
9905
9939
|
}
|
|
9906
9940
|
},
|
|
9907
9941
|
handleUpdate:function(payload){
|
|
@@ -10258,6 +10292,18 @@ logit(intent)
|
|
|
10258
10292
|
self.SERVER.loadAdditionalItems(__jsu.items);
|
|
10259
10293
|
return
|
|
10260
10294
|
}
|
|
10295
|
+
//run schema onload again just in case?
|
|
10296
|
+
for (let name in self.schemas) {
|
|
10297
|
+
const schema = self.schemas[name];
|
|
10298
|
+
if (schema.onload && self.Data[name]) {
|
|
10299
|
+
try {
|
|
10300
|
+
console.log(`Rerunning onload for schema: ${name}`);
|
|
10301
|
+
schema.onload(self.Data[name]);
|
|
10302
|
+
} catch (e) {
|
|
10303
|
+
self.Error.add('schema onload re-run error: ' + name, e);
|
|
10304
|
+
}
|
|
10305
|
+
}
|
|
10306
|
+
}
|
|
10261
10307
|
for(var sc in self.Data){
|
|
10262
10308
|
capp && capp.Button.update(sc+'SchemaBtn',{counter:self.Data[sc].length});
|
|
10263
10309
|
}
|
package/js/joe-full.js
CHANGED
|
@@ -11609,10 +11609,43 @@ function JsonObjectEditor(specs){
|
|
|
11609
11609
|
}
|
|
11610
11610
|
this.Data = {};
|
|
11611
11611
|
this.Render = {
|
|
11612
|
-
schema_icon:function(schema,classes){
|
|
11613
|
-
var icon = (self.schemas[schema] && self.schemas[schema].menuicon)||'';
|
|
11614
|
-
icon && (icon = `<joe-icon class="${classes ||''}">${icon}</joe-icon>`);
|
|
11612
|
+
schema_icon: function (schema, classes) {
|
|
11613
|
+
var icon = (self.schemas[schema] && self.schemas[schema].menuicon) || '';
|
|
11614
|
+
icon && (icon = `<joe-icon class="${classes || ''}">${icon}</joe-icon>`);
|
|
11615
11615
|
return icon;
|
|
11616
|
+
},
|
|
11617
|
+
ref_chip: function (things, specs) {
|
|
11618
|
+
specs = typeof specs === 'string' ? { cssclass: specs } : (specs || {});
|
|
11619
|
+
const items = Array.isArray(things) ? things : things?.tags || [];
|
|
11620
|
+
if (!items.length) return '';
|
|
11621
|
+
|
|
11622
|
+
const labelProp = specs.labelProp || 'name';
|
|
11623
|
+
const tooltipProp = specs.tooltipProp === false ? null : (specs.tooltipProp || 'info');
|
|
11624
|
+
|
|
11625
|
+
let html = `<joe-chips class="${specs.cssclass || ''}">`;
|
|
11626
|
+
|
|
11627
|
+
items.forEach(ref => {
|
|
11628
|
+
const obj = typeof ref === 'object' ? ref : $J.get(ref);
|
|
11629
|
+
if (!obj) return;
|
|
11630
|
+
|
|
11631
|
+
const label = obj[labelProp] || '';
|
|
11632
|
+
const title = tooltipProp && obj[tooltipProp] ? ` title="${obj[tooltipProp]}"` : '';
|
|
11633
|
+
|
|
11634
|
+
let style = '';
|
|
11635
|
+
if (specs.useStatusColor && obj.status) {
|
|
11636
|
+
const statusObj = _joe.Cache.get(obj.status);
|
|
11637
|
+
if (statusObj?.color) {
|
|
11638
|
+
style = ` style="border-left:4px solid ${statusObj.color}"`;
|
|
11639
|
+
}
|
|
11640
|
+
} else if (obj.color) {
|
|
11641
|
+
style = ` style="background:${obj.color}"`;
|
|
11642
|
+
}
|
|
11643
|
+
|
|
11644
|
+
html += `<joe-chip data-id="${obj._id}"${title}${style}>${label}</joe-chip>`;
|
|
11645
|
+
});
|
|
11646
|
+
|
|
11647
|
+
html += '</joe-chips>';
|
|
11648
|
+
return html;
|
|
11616
11649
|
}
|
|
11617
11650
|
};
|
|
11618
11651
|
//TODO: make current.clear a function
|
|
@@ -21206,7 +21239,8 @@ logit(intent)
|
|
|
21206
21239
|
+'</joe-user-cube>';
|
|
21207
21240
|
|
|
21208
21241
|
return html;
|
|
21209
|
-
}
|
|
21242
|
+
},
|
|
21243
|
+
|
|
21210
21244
|
}
|
|
21211
21245
|
},
|
|
21212
21246
|
handleUpdate:function(payload){
|
|
@@ -21563,6 +21597,18 @@ logit(intent)
|
|
|
21563
21597
|
self.SERVER.loadAdditionalItems(__jsu.items);
|
|
21564
21598
|
return
|
|
21565
21599
|
}
|
|
21600
|
+
//run schema onload again just in case?
|
|
21601
|
+
for (let name in self.schemas) {
|
|
21602
|
+
const schema = self.schemas[name];
|
|
21603
|
+
if (schema.onload && self.Data[name]) {
|
|
21604
|
+
try {
|
|
21605
|
+
console.log(`Rerunning onload for schema: ${name}`);
|
|
21606
|
+
schema.onload(self.Data[name]);
|
|
21607
|
+
} catch (e) {
|
|
21608
|
+
self.Error.add('schema onload re-run error: ' + name, e);
|
|
21609
|
+
}
|
|
21610
|
+
}
|
|
21611
|
+
}
|
|
21566
21612
|
for(var sc in self.Data){
|
|
21567
21613
|
capp && capp.Button.update(sc+'SchemaBtn',{counter:self.Data[sc].length});
|
|
21568
21614
|
}
|
package/js/joe.js
CHANGED
|
@@ -310,10 +310,43 @@ function JsonObjectEditor(specs){
|
|
|
310
310
|
}
|
|
311
311
|
this.Data = {};
|
|
312
312
|
this.Render = {
|
|
313
|
-
schema_icon:function(schema,classes){
|
|
314
|
-
var icon = (self.schemas[schema] && self.schemas[schema].menuicon)||'';
|
|
315
|
-
icon && (icon = `<joe-icon class="${classes ||''}">${icon}</joe-icon>`);
|
|
313
|
+
schema_icon: function (schema, classes) {
|
|
314
|
+
var icon = (self.schemas[schema] && self.schemas[schema].menuicon) || '';
|
|
315
|
+
icon && (icon = `<joe-icon class="${classes || ''}">${icon}</joe-icon>`);
|
|
316
316
|
return icon;
|
|
317
|
+
},
|
|
318
|
+
ref_chip: function (things, specs) {
|
|
319
|
+
specs = typeof specs === 'string' ? { cssclass: specs } : (specs || {});
|
|
320
|
+
const items = Array.isArray(things) ? things : things?.tags || [];
|
|
321
|
+
if (!items.length) return '';
|
|
322
|
+
|
|
323
|
+
const labelProp = specs.labelProp || 'name';
|
|
324
|
+
const tooltipProp = specs.tooltipProp === false ? null : (specs.tooltipProp || 'info');
|
|
325
|
+
|
|
326
|
+
let html = `<joe-chips class="${specs.cssclass || ''}">`;
|
|
327
|
+
|
|
328
|
+
items.forEach(ref => {
|
|
329
|
+
const obj = typeof ref === 'object' ? ref : $J.get(ref);
|
|
330
|
+
if (!obj) return;
|
|
331
|
+
|
|
332
|
+
const label = obj[labelProp] || '';
|
|
333
|
+
const title = tooltipProp && obj[tooltipProp] ? ` title="${obj[tooltipProp]}"` : '';
|
|
334
|
+
|
|
335
|
+
let style = '';
|
|
336
|
+
if (specs.useStatusColor && obj.status) {
|
|
337
|
+
const statusObj = _joe.Cache.get(obj.status);
|
|
338
|
+
if (statusObj?.color) {
|
|
339
|
+
style = ` style="border-left:4px solid ${statusObj.color}"`;
|
|
340
|
+
}
|
|
341
|
+
} else if (obj.color) {
|
|
342
|
+
style = ` style="background:${obj.color}"`;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
html += `<joe-chip data-id="${obj._id}"${title}${style}>${label}</joe-chip>`;
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
html += '</joe-chips>';
|
|
349
|
+
return html;
|
|
317
350
|
}
|
|
318
351
|
};
|
|
319
352
|
//TODO: make current.clear a function
|
|
@@ -9907,7 +9940,8 @@ logit(intent)
|
|
|
9907
9940
|
+'</joe-user-cube>';
|
|
9908
9941
|
|
|
9909
9942
|
return html;
|
|
9910
|
-
}
|
|
9943
|
+
},
|
|
9944
|
+
|
|
9911
9945
|
}
|
|
9912
9946
|
},
|
|
9913
9947
|
handleUpdate:function(payload){
|
|
@@ -10264,6 +10298,18 @@ logit(intent)
|
|
|
10264
10298
|
self.SERVER.loadAdditionalItems(__jsu.items);
|
|
10265
10299
|
return
|
|
10266
10300
|
}
|
|
10301
|
+
//run schema onload again just in case?
|
|
10302
|
+
for (let name in self.schemas) {
|
|
10303
|
+
const schema = self.schemas[name];
|
|
10304
|
+
if (schema.onload && self.Data[name]) {
|
|
10305
|
+
try {
|
|
10306
|
+
console.log(`Rerunning onload for schema: ${name}`);
|
|
10307
|
+
schema.onload(self.Data[name]);
|
|
10308
|
+
} catch (e) {
|
|
10309
|
+
self.Error.add('schema onload re-run error: ' + name, e);
|
|
10310
|
+
}
|
|
10311
|
+
}
|
|
10312
|
+
}
|
|
10267
10313
|
for(var sc in self.Data){
|
|
10268
10314
|
capp && capp.Button.update(sc+'SchemaBtn',{counter:self.Data[sc].length});
|
|
10269
10315
|
}
|
package/package.json
CHANGED
package/server/schemas/goal.js
CHANGED
|
@@ -42,20 +42,34 @@ var schema = {
|
|
|
42
42
|
`
|
|
43
43
|
return html;
|
|
44
44
|
},
|
|
45
|
+
|
|
45
46
|
fields:[
|
|
46
47
|
{extend:'name',specs:{width:'75%'}},
|
|
47
48
|
{name:'code',width:'25%'},
|
|
48
49
|
'info',
|
|
49
50
|
'description',
|
|
51
|
+
{name:'completion_equation',display:'completion equation',type:'code',language:'javascript',comment:'This is a javascript function that takes an item as an argument and returns a number between 0 and 1 representing the completion percentage of the goal. It can use any properties of the item or datasets in joe'},
|
|
52
|
+
{name:'complettion_percentage', reloadable:true, display:'completion percentage',type:'content',run:function(item){
|
|
53
|
+
const fn = tryEval(item.completion_equation);
|
|
54
|
+
const result = fn(item); // or any item
|
|
55
|
+
return Math.round(result*100) + '%'; // Assuming the function returns a number between 0 and 1
|
|
56
|
+
return 80 + '%'; // Placeholder, should be calculated based on completion_equation
|
|
57
|
+
}},
|
|
50
58
|
'impact',
|
|
51
59
|
'group',
|
|
52
|
-
|
|
53
|
-
{name:'milestones',
|
|
60
|
+
// {name:'has_milestones',display:'has milestones',type:'boolean',comment:'If true, this goal has milestones that can be tracked.',rerender:['milestones','timeline']},
|
|
61
|
+
{name:'milestones',
|
|
62
|
+
/*condition:function(item){return !!!item.has_milestones;},*/
|
|
63
|
+
type:'objectList',properties:[
|
|
54
64
|
{name:'name'},
|
|
55
65
|
{name:'status',type:'select',values:['','roadmap','in-progress','completed'],width:'120px'}
|
|
56
66
|
]},
|
|
57
67
|
|
|
58
|
-
{section_start:'timeline'
|
|
68
|
+
{section_start:'timeline',
|
|
69
|
+
// condition:function(item){
|
|
70
|
+
// return !!!item.has_milestones;
|
|
71
|
+
// }
|
|
72
|
+
},
|
|
59
73
|
{name:'start_dt',display:'kickoff',type:'date', native:true,width:'50%'},
|
|
60
74
|
{name:'end_dt',display:'completion',type:'date', native:true,width:'50%'},
|
|
61
75
|
{name:'phases',type:'objectList',
|
package/server/schemas/tag.js
CHANGED
|
@@ -92,7 +92,7 @@ var tag ={
|
|
|
92
92
|
tags.map(function(tag){
|
|
93
93
|
let tagObj = _joe.Cache.get(tag);//$J.get(tag);
|
|
94
94
|
if(tagObj){
|
|
95
|
-
html+= `<joe-tag data-id="${tagObj._id}" title="${tagObj.info}" style="${tagObj.color && (`background:'${tagObj.color}'`)}">${tagObj.name}</joe-tag>`;
|
|
95
|
+
html+= `<joe-tag data-id="${tagObj._id}" title="${tagObj.info}" style="${tagObj.color && (`background:'${tagObj.color}'`)||''}">${tagObj.name}</joe-tag>`;
|
|
96
96
|
}
|
|
97
97
|
})
|
|
98
98
|
html+= '</joe-tags>';
|