drill-widgets 2.7.22 → 2.7.23
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/dist/drill-widgets.es.js
CHANGED
|
@@ -3913,7 +3913,11 @@ let v = class extends N {
|
|
|
3913
3913
|
}, this._draggedStepId = null, this._dragOverStepId = null, this._selectedStepId = null, this._questions = [], this._editingStepId = null, this._stepAssignmentCategory = "individual", this._stepAssignmentType = "subject", this._stepAssignmentTarget = "", this._stepAssignmentFirstName = "", this._stepAssignmentLastName = "", this._openMenuStepId = null;
|
|
3914
3914
|
}
|
|
3915
3915
|
connectedCallback() {
|
|
3916
|
-
|
|
3916
|
+
var s;
|
|
3917
|
+
super.connectedCallback(), this.workflow ? (this._templateData = { ...this.workflow }, this.workflow.steps && this.workflow.steps.length > 0 && (this._selectedStepId = this.workflow.steps[0].id), console.log("Builder loaded with existing workflow:", this.workflow.name)) : (this._templateData = this._getDefaultWorkflowData(), this.subjectTypes && this.subjectTypes.length > 0 && ((s = this.subjectTypes[0]) != null && s.name) && (this._templateData = {
|
|
3918
|
+
...this._templateData,
|
|
3919
|
+
subjectType: this.subjectTypes[0].name
|
|
3920
|
+
})), this._clickOutsideHandler = () => this._closeStepMenu(), document.addEventListener("click", this._clickOutsideHandler);
|
|
3917
3921
|
}
|
|
3918
3922
|
disconnectedCallback() {
|
|
3919
3923
|
super.disconnectedCallback(), this._clickOutsideHandler && document.removeEventListener("click", this._clickOutsideHandler);
|
|
@@ -4874,7 +4878,12 @@ Use **bold** and *italic* text.`;
|
|
|
4874
4878
|
<label for="subject-type-select">Subject Type</label>
|
|
4875
4879
|
<select id="subject-type-select" @change=${this._handleSubjectTypeChange}>
|
|
4876
4880
|
${this.subjectTypes.map(
|
|
4877
|
-
(t) => l`<option
|
|
4881
|
+
(t) => l`<option
|
|
4882
|
+
value=${t.name}
|
|
4883
|
+
?selected=${this._templateData.subjectType === t.name}
|
|
4884
|
+
>
|
|
4885
|
+
${t.name}
|
|
4886
|
+
</option>`
|
|
4878
4887
|
)}
|
|
4879
4888
|
</select>
|
|
4880
4889
|
</div>` : l``}
|
|
@@ -9202,7 +9211,6 @@ function Gt() {
|
|
|
9202
9211
|
`;
|
|
9203
9212
|
}
|
|
9204
9213
|
function Xt(s, e = {}) {
|
|
9205
|
-
var r;
|
|
9206
9214
|
if (!customElements.get("builder-widget"))
|
|
9207
9215
|
return console.error("Error: <builder-widget> is not defined. Make sure it was imported."), null;
|
|
9208
9216
|
const t = document.getElementById(s);
|
|
@@ -9210,7 +9218,7 @@ function Xt(s, e = {}) {
|
|
|
9210
9218
|
return console.error(`Error: Target element with ID '${s}' not found.`), null;
|
|
9211
9219
|
t.innerHTML = "";
|
|
9212
9220
|
const i = document.createElement("builder-widget");
|
|
9213
|
-
return e.workflow && (i.workflow = e.workflow
|
|
9221
|
+
return e.workflow && (i.workflow = e.workflow), e.onWorkflowCreated && (i.onWorkflowCreated = e.onWorkflowCreated), e.onWorkflowDeleted && (i.onWorkflowDeleted = e.onWorkflowDeleted), e.onWorkflowUpdated && (i.onWorkflowUpdated = e.onWorkflowUpdated), i.labelForDrill = e.labelForDrill || "Drill", i.labelForGroup = e.labelForGroup || "Group", i.subjectTypes = e.subjectTypes || [], i.groups = e.groups || [], t.appendChild(i), console.log(`Drill Builder mounted on #${s}`), i;
|
|
9214
9222
|
}
|
|
9215
9223
|
function Zt(s, e) {
|
|
9216
9224
|
if (!customElements.get("runner-widget"))
|
|
@@ -3297,7 +3297,7 @@
|
|
|
3297
3297
|
flex-direction: column;
|
|
3298
3298
|
}
|
|
3299
3299
|
}
|
|
3300
|
-
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,x=(s,e,t,i)=>{for(var r=i>1?void 0:i?mt(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&>(e,t,r),r};let v=class extends j{constructor(){super(...arguments),this.labelForDrill="Drill",this.labelForGroup="Group",this.subjectTypes=[],this.groups=[],this._templateData={name:"",description:"",steps:[]},this._showStepModal=!1,this._stepFormData={title:"",description:""},this._draggedStepId=null,this._dragOverStepId=null,this._selectedStepId=null,this._questions=[],this._editingStepId=null,this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName="",this._openMenuStepId=null}connectedCallback(){super.connectedCallback(),this.workflow?(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Builder loaded with existing workflow:",this.workflow.name)):this._templateData=this._getDefaultWorkflowData(),this._clickOutsideHandler=()=>this._closeStepMenu(),document.addEventListener("click",this._clickOutsideHandler)}disconnectedCallback(){super.disconnectedCallback(),this._clickOutsideHandler&&document.removeEventListener("click",this._clickOutsideHandler)}updated(s){s.has("workflow")&&this.workflow&&(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Workflow property changed, reloading template data"))}_getDefaultWorkflowData(){const s={id:E(),title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:E(),name:"",description:"",steps:[s]}}_handleTitleChange(s){const e=s.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(s){const e=s.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var s;console.log("🚫 Builder Widget: Cancel button clicked"),(s=this.onCancel)==null||s.call(this)}_handleSave(){var s,e,t;if((s=this._templateData.name)!=null&&s.trim()){const i={id:this._templateData.id||E(),name:this._templateData.name,description:this._templateData.description||"",steps:this._templateData.steps||[],subjectType:this._templateData.subjectType};console.log("💾 Builder Widget: Save button clicked"),console.log("📄 Workflow Template:",JSON.stringify(i,null,2)),this.workflow?(console.log("Calling onWorkflowUpdated callback"),(e=this.onWorkflowUpdated)==null||e.call(this,i)):(console.log("Calling onWorkflowCreated callback"),(t=this.onWorkflowCreated)==null||t.call(this,i))}else console.log("⚠️ Builder Widget: Save attempted but no title provided")}_addStep(){console.log("🔹 Opening step creation modal"),this._stepFormData={title:"",description:""},this._showStepModal=!0}_closeStepModal(){console.log("🔹 Closing step creation modal"),this._showStepModal=!1,this._editingStepId=null,this._stepFormData={title:"",description:""},this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName=""}_handleStepFormInput(s){const e=s.target,{name:t,value:i}=e;this._stepFormData={...this._stepFormData,[t]:i}}_toggleStepMenu(s,e){s.stopPropagation(),this._openMenuStepId=this._openMenuStepId===e?null:e}_closeStepMenu(){this._openMenuStepId=null}_editStep(s){var t;const e=(t=this._templateData.steps)==null?void 0:t.find(i=>i.id===s);if(e){if(this._editingStepId=s,this._stepFormData={title:e.title,description:e.description},this._stepAssignmentCategory=e.assignment.category,this._stepAssignmentType=e.assignment.type,this._stepAssignmentTarget=e.assignment.email||e.assignment.targetId||"",this._stepAssignmentType==="specific_user"){const r=(e.assignment.targetName||"").split(" ");this._stepAssignmentFirstName=r[0]||"",this._stepAssignmentLastName=r.slice(1).join(" ")||""}else this._stepAssignmentFirstName="",this._stepAssignmentLastName="";this._showStepModal=!0,this._closeStepMenu(),console.log("Editing step:",s)}}_duplicateStep(s){var r,n;const e=(r=this._templateData.steps)==null?void 0:r.find(a=>a.id===s);if(!e)return;const t=this._templateData.steps||[],i={...e,id:E(),title:`${e.title} (Copy)`,order:t.length+1,elements:((n=e.elements)==null?void 0:n.map(a=>({...a,id:E()})))||[]};this._templateData={...this._templateData,steps:[...t,i]},this._closeStepMenu(),console.log("Step duplicated:",s)}_deleteStep(s){const e=(this._templateData.steps||[]).filter(t=>t.id!==s);e.forEach((t,i)=>{t.order=i+1}),this._templateData={...this._templateData,steps:e},this._selectedStepId===s&&(this._selectedStepId=e.length>0?e[0].id:null),this._closeStepMenu(),console.log("Step deleted:",s)}_createStep(){var t,i;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const s=this._templateData.steps||[],e={category:this._stepAssignmentCategory,type:this._stepAssignmentType};if(this._stepAssignmentType==="specific_user"&&this._stepAssignmentTarget?(e.email=this._stepAssignmentTarget,this._stepAssignmentFirstName||this._stepAssignmentLastName?e.targetName=`${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim():e.targetName=this._stepAssignmentTarget):this._stepAssignmentType==="instance_role_assignee_select"&&this._stepAssignmentTarget&&(e.targetId=this._stepAssignmentTarget),this._editingStepId){const r=s.map(n=>{var a;return n.id===this._editingStepId?{...n,title:this._stepFormData.title.trim(),description:((a=this._stepFormData.description)==null?void 0:a.trim())||"",assignment:e}:n});this._templateData={...this._templateData,steps:r},console.log("✅ Step updated:",this._editingStepId)}else{const r={id:E(),title:this._stepFormData.title.trim(),description:((i=this._stepFormData.description)==null?void 0:i.trim())||"",order:s.length+1,assignment:e,elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...s,r]},this._selectedStepId=r.id,console.log("✅ Step created and selected:",r)}this._closeStepModal()}_selectStep(s){this._selectedStepId=s,console.log("🎯 Step selected:",s)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(s=>s.id===this._selectedStepId)||null}_handleDragStart(s,e){this._draggedStepId=e,s.dataTransfer&&(s.dataTransfer.effectAllowed="move",s.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(s){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(s,e){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(s){const e=s.relatedTarget;s.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(s,e){if(s.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],i=t.findIndex(o=>o.id===this._draggedStepId),r=t.findIndex(o=>o.id===e);if(i===-1||r===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((o,d)=>`${d+1}: ${o.title}`));const n=[...t],[a]=n.splice(i,1);n.splice(r,0,a),n.forEach((o,d)=>{o.order=d+1}),console.log("🔄 After reorder:",n.map((o,d)=>`${d+1}: ${o.title}`)),this._templateData={...this._templateData,steps:n},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_handleSubjectTypeChange(s){this._templateData={...this._templateData,subjectType:s.target.value}}_addQuestion(s="text_input"){var i,r;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add questions without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}if(["text","html","divider","markdown"].includes(s)){let n={id:E(),type:s,order:(((i=e.elements)==null?void 0:i.length)||0)+1};switch(s){case"text":n.content="Enter your text content here...";break;case"html":n.content="<p>Enter your HTML content here...</p>";break;case"divider":n.content="",n.caption="Section Divider";break;case"markdown":n.content=`## Enter your markdown content here...
|
|
3300
|
+
`;var gt=Object.defineProperty,mt=Object.getOwnPropertyDescriptor,x=(s,e,t,i)=>{for(var r=i>1?void 0:i?mt(e,t):e,n=s.length-1,a;n>=0;n--)(a=s[n])&&(r=(i?a(e,t,r):a(r))||r);return i&&r&>(e,t,r),r};let v=class extends j{constructor(){super(...arguments),this.labelForDrill="Drill",this.labelForGroup="Group",this.subjectTypes=[],this.groups=[],this._templateData={name:"",description:"",steps:[]},this._showStepModal=!1,this._stepFormData={title:"",description:""},this._draggedStepId=null,this._dragOverStepId=null,this._selectedStepId=null,this._questions=[],this._editingStepId=null,this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName="",this._openMenuStepId=null}connectedCallback(){var s;super.connectedCallback(),this.workflow?(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Builder loaded with existing workflow:",this.workflow.name)):(this._templateData=this._getDefaultWorkflowData(),this.subjectTypes&&this.subjectTypes.length>0&&((s=this.subjectTypes[0])!=null&&s.name)&&(this._templateData={...this._templateData,subjectType:this.subjectTypes[0].name})),this._clickOutsideHandler=()=>this._closeStepMenu(),document.addEventListener("click",this._clickOutsideHandler)}disconnectedCallback(){super.disconnectedCallback(),this._clickOutsideHandler&&document.removeEventListener("click",this._clickOutsideHandler)}updated(s){s.has("workflow")&&this.workflow&&(this._templateData={...this.workflow},this.workflow.steps&&this.workflow.steps.length>0&&(this._selectedStepId=this.workflow.steps[0].id),console.log("Workflow property changed, reloading template data"))}_getDefaultWorkflowData(){const s={id:E(),title:"Step 1",description:"",order:1,assignment:{category:"individual",type:"subject"},elements:[],status:"pending"};return{id:E(),name:"",description:"",steps:[s]}}_handleTitleChange(s){const e=s.target;this._templateData={...this._templateData,name:e.value}}_handleDescriptionChange(s){const e=s.target;this._templateData={...this._templateData,description:e.value}}_handleCancel(){var s;console.log("🚫 Builder Widget: Cancel button clicked"),(s=this.onCancel)==null||s.call(this)}_handleSave(){var s,e,t;if((s=this._templateData.name)!=null&&s.trim()){const i={id:this._templateData.id||E(),name:this._templateData.name,description:this._templateData.description||"",steps:this._templateData.steps||[],subjectType:this._templateData.subjectType};console.log("💾 Builder Widget: Save button clicked"),console.log("📄 Workflow Template:",JSON.stringify(i,null,2)),this.workflow?(console.log("Calling onWorkflowUpdated callback"),(e=this.onWorkflowUpdated)==null||e.call(this,i)):(console.log("Calling onWorkflowCreated callback"),(t=this.onWorkflowCreated)==null||t.call(this,i))}else console.log("⚠️ Builder Widget: Save attempted but no title provided")}_addStep(){console.log("🔹 Opening step creation modal"),this._stepFormData={title:"",description:""},this._showStepModal=!0}_closeStepModal(){console.log("🔹 Closing step creation modal"),this._showStepModal=!1,this._editingStepId=null,this._stepFormData={title:"",description:""},this._stepAssignmentCategory="individual",this._stepAssignmentType="subject",this._stepAssignmentTarget="",this._stepAssignmentFirstName="",this._stepAssignmentLastName=""}_handleStepFormInput(s){const e=s.target,{name:t,value:i}=e;this._stepFormData={...this._stepFormData,[t]:i}}_toggleStepMenu(s,e){s.stopPropagation(),this._openMenuStepId=this._openMenuStepId===e?null:e}_closeStepMenu(){this._openMenuStepId=null}_editStep(s){var t;const e=(t=this._templateData.steps)==null?void 0:t.find(i=>i.id===s);if(e){if(this._editingStepId=s,this._stepFormData={title:e.title,description:e.description},this._stepAssignmentCategory=e.assignment.category,this._stepAssignmentType=e.assignment.type,this._stepAssignmentTarget=e.assignment.email||e.assignment.targetId||"",this._stepAssignmentType==="specific_user"){const r=(e.assignment.targetName||"").split(" ");this._stepAssignmentFirstName=r[0]||"",this._stepAssignmentLastName=r.slice(1).join(" ")||""}else this._stepAssignmentFirstName="",this._stepAssignmentLastName="";this._showStepModal=!0,this._closeStepMenu(),console.log("Editing step:",s)}}_duplicateStep(s){var r,n;const e=(r=this._templateData.steps)==null?void 0:r.find(a=>a.id===s);if(!e)return;const t=this._templateData.steps||[],i={...e,id:E(),title:`${e.title} (Copy)`,order:t.length+1,elements:((n=e.elements)==null?void 0:n.map(a=>({...a,id:E()})))||[]};this._templateData={...this._templateData,steps:[...t,i]},this._closeStepMenu(),console.log("Step duplicated:",s)}_deleteStep(s){const e=(this._templateData.steps||[]).filter(t=>t.id!==s);e.forEach((t,i)=>{t.order=i+1}),this._templateData={...this._templateData,steps:e},this._selectedStepId===s&&(this._selectedStepId=e.length>0?e[0].id:null),this._closeStepMenu(),console.log("Step deleted:",s)}_createStep(){var t,i;if(!((t=this._stepFormData.title)!=null&&t.trim())){console.log("⚠️ Step title is required");return}const s=this._templateData.steps||[],e={category:this._stepAssignmentCategory,type:this._stepAssignmentType};if(this._stepAssignmentType==="specific_user"&&this._stepAssignmentTarget?(e.email=this._stepAssignmentTarget,this._stepAssignmentFirstName||this._stepAssignmentLastName?e.targetName=`${this._stepAssignmentFirstName} ${this._stepAssignmentLastName}`.trim():e.targetName=this._stepAssignmentTarget):this._stepAssignmentType==="instance_role_assignee_select"&&this._stepAssignmentTarget&&(e.targetId=this._stepAssignmentTarget),this._editingStepId){const r=s.map(n=>{var a;return n.id===this._editingStepId?{...n,title:this._stepFormData.title.trim(),description:((a=this._stepFormData.description)==null?void 0:a.trim())||"",assignment:e}:n});this._templateData={...this._templateData,steps:r},console.log("✅ Step updated:",this._editingStepId)}else{const r={id:E(),title:this._stepFormData.title.trim(),description:((i=this._stepFormData.description)==null?void 0:i.trim())||"",order:s.length+1,assignment:e,elements:[],status:"pending"};this._templateData={...this._templateData,steps:[...s,r]},this._selectedStepId=r.id,console.log("✅ Step created and selected:",r)}this._closeStepModal()}_selectStep(s){this._selectedStepId=s,console.log("🎯 Step selected:",s)}_getSelectedStep(){return!this._selectedStepId||!this._templateData.steps?null:this._templateData.steps.find(s=>s.id===this._selectedStepId)||null}_handleDragStart(s,e){this._draggedStepId=e,s.dataTransfer&&(s.dataTransfer.effectAllowed="move",s.dataTransfer.setData("text/plain",e)),console.log("🔄 Drag started for step:",e)}_handleDragEnd(s){this._draggedStepId=null,this._dragOverStepId=null,console.log("🔄 Drag ended")}_handleDragOver(s,e){s.preventDefault(),s.dataTransfer&&(s.dataTransfer.dropEffect="move"),this._dragOverStepId!==e&&(this._dragOverStepId=e)}_handleDragLeave(s){const e=s.relatedTarget;s.currentTarget.contains(e)||(this._dragOverStepId=null)}_handleDrop(s,e){if(s.preventDefault(),!this._draggedStepId||this._draggedStepId===e){this._draggedStepId=null,this._dragOverStepId=null;return}const t=this._templateData.steps||[],i=t.findIndex(o=>o.id===this._draggedStepId),r=t.findIndex(o=>o.id===e);if(i===-1||r===-1){console.error("Could not find step indices for reordering");return}console.log("🔄 Before reorder:",t.map((o,d)=>`${d+1}: ${o.title}`));const n=[...t],[a]=n.splice(i,1);n.splice(r,0,a),n.forEach((o,d)=>{o.order=d+1}),console.log("🔄 After reorder:",n.map((o,d)=>`${d+1}: ${o.title}`)),this._templateData={...this._templateData,steps:n},console.log("📝 Template updated with new step order"),this._draggedStepId=null,this._dragOverStepId=null}_handleSubjectTypeChange(s){this._templateData={...this._templateData,subjectType:s.target.value}}_addQuestion(s="text_input"){var i,r;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add questions without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}if(["text","html","divider","markdown"].includes(s)){let n={id:E(),type:s,order:(((i=e.elements)==null?void 0:i.length)||0)+1};switch(s){case"text":n.content="Enter your text content here...";break;case"html":n.content="<p>Enter your HTML content here...</p>";break;case"divider":n.content="",n.caption="Section Divider";break;case"markdown":n.content=`## Enter your markdown content here...
|
|
3301
3301
|
|
|
3302
3302
|
Use **bold** and *italic* text.`;break}const a=this._templateData.steps.map(o=>o.id===this._selectedStepId?{...o,elements:[...o.elements||[],n]}:o);this._templateData={...this._templateData,steps:a},console.log("✅ Content element added to step:",this._selectedStepId)}else{const n={id:E(),type:s,label:this._getQuestionTypeDisplayName(s),order:(((r=e.elements)==null?void 0:r.length)||0)+1,required:!1};["select","radio","checkbox"].includes(s)&&(n.options=["Option 1","Option 2"]);const a=this._templateData.steps.map(o=>o.id===this._selectedStepId?{...o,elements:[...o.elements||[],n]}:o);this._templateData={...this._templateData,steps:a},console.log("✅ Question added to step:",this._selectedStepId)}}_addContentElement(s){var r;if(!this._templateData.steps||this._templateData.steps.length===0||!this._selectedStepId){console.log("⚠️ Cannot add content without steps or selected step");return}const e=this._getSelectedStep();if(!e){console.log("⚠️ No step selected");return}let t={id:E(),type:s,order:(((r=e.elements)==null?void 0:r.length)||0)+1};switch(s){case"text":t.content="Enter your text content here...";break;case"html":t.content="<p>Enter your HTML content here...</p>";break;case"image":t.content="",t.url="",t.alt="",t.caption="";break;case"video":t.content="",t.url="",t.caption="";break;case"file":t.content="",t.url="",t.caption="";break;case"divider":t.content="",t.caption="Section Divider";break;case"markdown":t.content=`## Enter your markdown content here...
|
|
3303
3303
|
|
|
@@ -3643,7 +3643,12 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(n=>n
|
|
|
3643
3643
|
${this.subjectTypes.length>0?l`<div class="form-group">
|
|
3644
3644
|
<label for="subject-type-select">Subject Type</label>
|
|
3645
3645
|
<select id="subject-type-select" @change=${this._handleSubjectTypeChange}>
|
|
3646
|
-
${this.subjectTypes.map(t=>l`<option
|
|
3646
|
+
${this.subjectTypes.map(t=>l`<option
|
|
3647
|
+
value=${t.name}
|
|
3648
|
+
?selected=${this._templateData.subjectType===t.name}
|
|
3649
|
+
>
|
|
3650
|
+
${t.name}
|
|
3651
|
+
</option>`)}
|
|
3647
3652
|
</select>
|
|
3648
3653
|
</div>`:l``}
|
|
3649
3654
|
</div>
|
|
@@ -5439,4 +5444,4 @@ Use **bold** and *italic* text.`;break}const i=this._templateData.steps.map(n=>n
|
|
|
5439
5444
|
margin: 2px 0;
|
|
5440
5445
|
line-height: 1.4;
|
|
5441
5446
|
}
|
|
5442
|
-
`}function qt(s,e={}){
|
|
5447
|
+
`}function qt(s,e={}){if(!customElements.get("builder-widget"))return console.error("Error: <builder-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;t.innerHTML="";const i=document.createElement("builder-widget");return e.workflow&&(i.workflow=e.workflow),e.onWorkflowCreated&&(i.onWorkflowCreated=e.onWorkflowCreated),e.onWorkflowDeleted&&(i.onWorkflowDeleted=e.onWorkflowDeleted),e.onWorkflowUpdated&&(i.onWorkflowUpdated=e.onWorkflowUpdated),i.labelForDrill=e.labelForDrill||"Drill",i.labelForGroup=e.labelForGroup||"Group",i.subjectTypes=e.subjectTypes||[],i.groups=e.groups||[],t.appendChild(i),console.log(`Drill Builder mounted on #${s}`),i}function Kt(s,e){if(!customElements.get("runner-widget"))return console.error("Error: <runner-widget> is not defined. Make sure it was imported."),null;const t=document.getElementById(s);if(!t)return console.error(`Error: Target element with ID '${s}' not found.`),null;if(e.mode==="preview"){if(!e||!e.workflow)return console.error("Error: Workflow data must be provided for preview mode."),t.innerHTML='<p style="color: red;">Error: Workflow data required for preview mode.</p>',null;if(!e.workflow.steps||e.workflow.steps.length===0)return console.error("Error: Workflow provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Workflow has no steps.</p>',null}else{if(!e||!e.instance)return console.error("Error: Instance data must be provided in runner config."),t.innerHTML='<p style="color: red;">Error: Instance data required.</p>',null;if(!e.instance.steps||e.instance.steps.length===0)return console.error("Error: Instance provided to runner has no steps defined."),t.innerHTML='<p style="color: red;">Error: Instance has no steps.</p>',null}t.innerHTML="";const i=document.createElement("runner-widget");return e.mode==="preview"?(i.workflow=e.workflow,i.mode="preview"):(i.instance=e.instance,i.mode=e.mode||"default"),e.mode&&(i.mode=e.mode),e.isLoading!==void 0&&(i.isLoading=e.isLoading),e.onSignatureCaptured&&(i.onSignatureCaptured=e.onSignatureCaptured),e.onFileUploaded&&(i.onFileUploaded=e.onFileUploaded),e.currentUser&&(i.currentUser=e.currentUser),e.onInstanceUpdated&&(i.onInstanceUpdated=e.onInstanceUpdated),t.appendChild(i),console.log(`Drill Runner mounted on #${s}`),i}function Jt(s,e){const t=s.getFormData(),i=JSON.parse(JSON.stringify(e));return i.steps&&i.steps.forEach(r=>{r.responses||(r.responses=[]),r.elements.forEach(n=>{if(n.type==="text_input"||n.type==="textarea"||n.type==="select"||n.type==="number"||n.type==="radio"||n.type==="checkbox"||n.type==="date"||n.type==="file_upload"||n.type==="signature"){const a=t[n.id];if(a!==void 0){let o=r.responses.find(d=>d.elementId===n.id);o?(o.value=a,o.answeredAt=new Date):(o={elementId:n.id,value:a,answeredAt:new Date},r.responses.push(o))}}})}),i}function Xt(s,e){const t={};e.steps&&e.steps.forEach(i=>{i.responses&&i.responses.forEach(r=>{t[r.elementId]=r.value})}),s.restoreFormData(),console.log("Form data restored to runner widget:",t)}A.createBuilder=qt,A.createRunner=Kt,A.generateInstanceHTML=Et,A.restoreFormDataToRunner=Xt,A.updateInstanceFromRunnerForm=Jt,Object.defineProperty(A,Symbol.toStringTag,{value:"Module"})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "drill-widgets",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.23",
|
|
4
4
|
"description": "Easily embed powerful workflow building and running capabilities into your web applications with Lit-based web components. Includes HTML export for server-side PDF generation.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|