json-object-editor 0.10.668 → 0.10.671

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.
@@ -3344,6 +3344,10 @@ this.renderHTMLContent = function(specs){
3344
3344
 
3345
3345
  //if(prop.width){
3346
3346
  //close field container
3347
+ // Add field-jobs-container if queryJobs is true
3348
+ if (prop.queryJobs && self.current && self.current.object && self.current.object._id) {
3349
+ html += '<field-jobs-container data-object-id="' + self.current.object._id + '" data-field-name="' + prop.name + '"></field-jobs-container>';
3350
+ }
3347
3351
  html+='</joe-field-container>';
3348
3352
  // }
3349
3353
 
@@ -3555,13 +3559,28 @@ this.renderHTMLContent = function(specs){
3555
3559
  try{
3556
3560
  var aiLabel = self.propAsFuncOrValue(prop.ai.label) || 'AI';
3557
3561
  var fieldName = prop.name || '';
3562
+ var obj = self.current && self.current.object || {};
3563
+ var objectId = obj._id || '';
3564
+ // Generate progress token using centralized function
3565
+ var progressToken = '';
3566
+ if (objectId && fieldName && window._joe && _joe.Ai && _joe.Ai.generateProgressToken) {
3567
+ progressToken = _joe.Ai.generateProgressToken(objectId, fieldName);
3568
+ }
3558
3569
  html +=
3559
- '<button type="button" class="joe-ai-autofill-button joe-iconed-button joe-button" ' +
3570
+ '<joe-button class="joe-button joe-ai-button joe-ai-autofill-button joe-iconed-button" ' +
3571
+ 'data-progress-token="' + progressToken + '" ' +
3572
+ 'data-original-text="' + aiLabel.replace(/"/g, '&quot;') + '" ' +
3573
+ 'data-field-name="' + fieldName + '" ' +
3574
+ 'data-object-id="' + objectId + '" ' +
3560
3575
  'onclick="if(window._joe && _joe.Ai && _joe.Ai.populateField){_joe.Ai.populateField(\''+fieldName+'\');}" ' +
3561
3576
  'title="Let AI suggest a value for this field">'+
3562
3577
  aiLabel+
3563
- '</button>'
3564
- +'<div class="clear"></div>';
3578
+ '</joe-button>';
3579
+ if (progressToken) {
3580
+ html += '<div class="joe-ai-progress" data-for-token="' + progressToken + '" style="font-size:12px; color:#666; margin-top:4px; min-height:16px;"></div>';
3581
+ html += '<div class="joe-ai-jobs" data-for-token="' + progressToken + '" style="margin-top:4px;"></div>';
3582
+ }
3583
+ html += '<div class="clear"></div>';
3565
3584
  }catch(_e){
3566
3585
  // fail silently if something about the ai config is invalid
3567
3586
  }