json-object-editor 0.10.668 → 0.10.670

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/js/joe.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /* --------------------------------------------------------
2
2
  *
3
- * json-object-editor - v0.10.668
3
+ * json-object-editor - v0.10.670
4
4
  * Created by: Corey Hadden
5
5
  *
6
6
  * -------------------------------------------------------- */
@@ -3350,6 +3350,10 @@ this.renderHTMLContent = function(specs){
3350
3350
 
3351
3351
  //if(prop.width){
3352
3352
  //close field container
3353
+ // Add field-jobs-container if queryJobs is true
3354
+ if (prop.queryJobs && self.current && self.current.object && self.current.object._id) {
3355
+ html += '<field-jobs-container data-object-id="' + self.current.object._id + '" data-field-name="' + prop.name + '"></field-jobs-container>';
3356
+ }
3353
3357
  html+='</joe-field-container>';
3354
3358
  // }
3355
3359
 
@@ -3561,13 +3565,28 @@ this.renderHTMLContent = function(specs){
3561
3565
  try{
3562
3566
  var aiLabel = self.propAsFuncOrValue(prop.ai.label) || 'AI';
3563
3567
  var fieldName = prop.name || '';
3568
+ var obj = self.current && self.current.object || {};
3569
+ var objectId = obj._id || '';
3570
+ // Generate progress token using centralized function
3571
+ var progressToken = '';
3572
+ if (objectId && fieldName && window._joe && _joe.Ai && _joe.Ai.generateProgressToken) {
3573
+ progressToken = _joe.Ai.generateProgressToken(objectId, fieldName);
3574
+ }
3564
3575
  html +=
3565
- '<button type="button" class="joe-ai-autofill-button joe-iconed-button joe-button" ' +
3576
+ '<joe-button class="joe-button joe-ai-button joe-ai-autofill-button joe-iconed-button" ' +
3577
+ 'data-progress-token="' + progressToken + '" ' +
3578
+ 'data-original-text="' + aiLabel.replace(/"/g, '&quot;') + '" ' +
3579
+ 'data-field-name="' + fieldName + '" ' +
3580
+ 'data-object-id="' + objectId + '" ' +
3566
3581
  'onclick="if(window._joe && _joe.Ai && _joe.Ai.populateField){_joe.Ai.populateField(\''+fieldName+'\');}" ' +
3567
3582
  'title="Let AI suggest a value for this field">'+
3568
3583
  aiLabel+
3569
- '</button>'
3570
- +'<div class="clear"></div>';
3584
+ '</joe-button>';
3585
+ if (progressToken) {
3586
+ html += '<div class="joe-ai-progress" data-for-token="' + progressToken + '" style="font-size:12px; color:#666; margin-top:4px; min-height:16px;"></div>';
3587
+ html += '<div class="joe-ai-jobs" data-for-token="' + progressToken + '" style="margin-top:4px;"></div>';
3588
+ }
3589
+ html += '<div class="clear"></div>';
3571
3590
  }catch(_e){
3572
3591
  // fail silently if something about the ai config is invalid
3573
3592
  }