@qxs-bns/components-wc 0.0.13 → 0.0.15
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/es/editor/blocksuite-editor.mjs +3 -3
- package/es/editor/blocksuite-editor.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/subject/action.mjs +18 -18
- package/es/subject/action.mjs.map +1 -1
- package/es/subject/list.mjs +7 -7
- package/es/subject/list.mjs.map +1 -1
- package/es/subject/single.mjs +50 -50
- package/es/subject/single.mjs.map +1 -1
- package/lib/editor/blocksuite-editor.cjs +2 -2
- package/lib/editor/blocksuite-editor.cjs.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/subject/action.cjs +3 -3
- package/lib/subject/action.cjs.map +1 -1
- package/lib/subject/list.cjs +10 -10
- package/lib/subject/list.cjs.map +1 -1
- package/lib/subject/single.cjs +3 -3
- package/lib/subject/single.cjs.map +1 -1
- package/package.json +1 -1
package/es/subject/single.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as o}from"../base/define.mjs";import{uid as n}from"../base/uid.mjs";var a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=(e,t,s,i)=>{for(var r,o=i>1?void 0:i?l(t,s):t,n=e.length-1;n>=0;n--)(r=e[n])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&a(t,s,o),o};class d extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VALIDATION_ERROR",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;super(e),this.code=t,this.field=s,this.row=i,this.name="SubjectError"}static from(e){return new d(e.message,e.code,e.field,e.row)}}const c=e`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,h=e`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;e`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`;const u=e`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>`;let x=class extends s{constructor(){super(...arguments),this.orderIndex=0,this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.type="single",this.answerCheckType=1,this.examAnswerRelationType=0,this.richTextContent="",this.analysis="",this.leastAnswerCount=2,this.examExpand="",this.customId="",this.examId=0,this.uploadImage=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this.modelValue="",this.useModel=!1,this._answers=[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this._title="",this._analysis="",this._richText="",this._showRichText=!1,this._leastAnswerCount=2,this._answerCheckType=1,this._orderList=[],this._resultDialogOpen=!1,this._resultDialogIndex=0,this._resultDialogValue="",this._sortDropdownOpen=!1,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper");s&&!t.includes(s)&&(this._sortDropdownOpen=!1,this.requestUpdate())}}get answerList(){return this._answers}set answerList(e){const t=Array.isArray(e)?e:[];this._answers=t.length?t.map(e=>({...e})):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answerList")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick)}willUpdate(e){e.has("isEdit")&&this.isEdit&&this._syncProps(),(e.has("examExpand")||e.has("answerList"))&&this._syncExamExpand(),e.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this.leastAnswerCount||2,this._answerCheckType=this.answerCheckType||1,this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.answerList?.length&&(this._answers=this.answerList.map(e=>({...e,title:e.title||"",isCorrect:!!e.isCorrect}))),this._syncExamExpand()}_syncExamExpand(){if(!this.examExpand||!this.answerList?.length)return;const e=this.examExpand.split(",");this._orderList=e.map(e=>{const t=this.answerList.find(t=>t.answerId?.toString()===e);return t?String.fromCharCode(65+t.orderIndex-1):e}).filter(Boolean)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){"single"===this.type?(this._answers.forEach(e=>{e.isCorrect=!1}),e.isCorrect=t):e.isCorrect=t,this.requestUpdate()}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_onAnswerInput(e,t){const s=e.target;s.value.length>this.ANSWER_MAX&&(s.value=s.value.slice(0,this.ANSWER_MAX)),this._answers[t].title=s.value,this.requestUpdate()}_addAnswer(){this.isSave||(this._answers=[...this._answers,{title:"",isCorrect:!1,customAnswerId:n()}])}_deleteAnswer(e){this._answers.length<3||this.isSave||(this._answers=this._answers.filter((t,s)=>s!==e))}_toggleSortItem(e){const t=this._orderList.indexOf(e);this._orderList=t>=0?this._orderList.filter(t=>t!==e):[...this._orderList,e],this.requestUpdate()}_removeSortItem(e){this._orderList=this._orderList.filter(t=>t!==e),this.requestUpdate()}_getSortOrder(e){const t=this._orderList.indexOf(this._label(e));return t>=0?t+1:null}async toJSON(){return new Promise((e,t)=>{const s={customId:this.customId||void 0,answerType:this.type,orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title||"",r=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._answerCheckType:this.answerCheckType||1,n=this.isEdit?this._leastAnswerCount:this.leastAnswerCount||2,a=this.isEdit?this._analysis:this.analysis||"",l=this.isEdit?this._orderList.map(e=>e.charCodeAt(0)-65+1).join(","):this.examExpand||"",p=this.isEdit?this._showRichText:!!this.richTextContent,c=this.isEdit?this._richText:this.richTextContent||"",h=this.isEdit?this._orderList:(()=>{const e=this.examExpand;return e?e.split(",").map(e=>{const t=this.answerList?.find(t=>t.answerId?.toString()===e);return t?String.fromCharCode(65+t.orderIndex-1):e}).filter(Boolean):[]})();if(!i)return void t(new d("题目标题不能为空!","EMPTY_TITLE","title",s));if(!o)return void t(new d("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",s));let u="",x=!1,w=0;if("multiple"===this.type||"single"===this.type)r.forEach((e,t)=>{e.title?.trim()||(u+=`选项${String.fromCharCode(65+t)}未填写。`),e.isCorrect&&(x=!0,w++)});else if("sort"===this.type&&(h.length&&(x=!0),x&&h.length<n))return void t(new d(`排序题至少需要设置${n}项排序答案`,"SORT_COUNT_INVALID","orderList",s));if(u)return void t(new d(u,"ANSWER_EMPTY","answers",s));if(new Set(r.map(e=>e.title)).size!==r.length)return void t(new d("选项不能重复","DUPLICATE_ANSWERS","answers",s));if("multiple"===this.type){if(1===w)return void t(new d("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",s));if(x&&w<n)return void t(new d("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))}if((2===o||3===o)&&!x)return void t(new d("请设置支持选项","NO_CORRECT_ANSWER","answers",s));const m={answerType:this.type,title:i,answers:r.filter(e=>e.title).map((e,t)=>({...e,orderIndex:t+1})),examExpand:l,analysis:a,isSetCorrectAnswer:x,leastAnswerCount:n,examRichTextContent:p?c:"",examAnswerRelationType:this.examAnswerRelationType,isKey:this.isKey,answerCheckType:o};this.customId&&(m.customId=this.customId),e(m)})}validate(){const e=[],t={customId:this.customId||void 0,answerType:this.type,orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",i=this.isEdit?this._answers:this.answerList||[],r=this.isEdit?this._answerCheckType:this.answerCheckType||1,o=this.isEdit?this._leastAnswerCount:this.leastAnswerCount||2,n=this.isEdit?this._orderList:(()=>{const e=this.examExpand;return e?e.split(",").map(e=>{const t=this.answerList?.find(t=>t.answerId?.toString()===e);return t?String.fromCharCode(65+t.orderIndex-1):e}).filter(Boolean):[]})();s||e.push(new d("题目标题不能为空!","EMPTY_TITLE","title",t)),r||e.push(new d("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",t));let a=!1,l=0;"multiple"===this.type||"single"===this.type?i.forEach((s,i)=>{s.title?.trim()||e.push(new d(`选项${String.fromCharCode(65+i)}未填写`,"ANSWER_EMPTY","answers",t)),s.isCorrect&&(a=!0,l++)}):"sort"===this.type&&(n.length&&(a=!0),a&&n.length<o&&e.push(new d(`排序题至少需要设置${o}项排序答案`,"SORT_COUNT_INVALID","orderList",t)));return new Set(i.map(e=>e.title)).size!==i.length&&i.length>0&&e.push(new d("选项不能重复","DUPLICATE_ANSWERS","answers",t)),"multiple"===this.type&&(1===l&&i.length>0&&e.push(new d("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",t)),a&&l<o&&e.push(new d("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",t))),2!==r&&3!==r||a||e.push(new d("请设置支持选项","NO_CORRECT_ANSWER","answers",t)),e}_openResultDialog(e){this._resultDialogIndex=e,this._resultDialogValue=this._answers[e].resultItem||"",this._resultDialogOpen=!0}_saveResultDialog(){this._answers[this._resultDialogIndex].resultItem=this._resultDialogValue,this._resultDialogOpen=!1,this.requestUpdate()}_renderResultDialog(){if(!this._resultDialogOpen)return"";const t=this._label(this._resultDialogIndex);return e`
|
|
1
|
+
import{html as t,css as e,LitElement as s}from"lit";import{property as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as o}from"../base/define.mjs";import{uid as n}from"../base/uid.mjs";var a=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?l(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&a(e,s,o),o};class d extends Error{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VALIDATION_ERROR",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;super(t),this.code=e,this.field=s,this.row=i,this.name="SubjectError"}static from(t){return new d(t.message,t.code,t.field,t.row)}}const h=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,c=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;t`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="18" y1="6" x2="6" y2="18"/><line x1="6" y1="6" x2="18" y2="18"/></svg>`;const u=t`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>`;let x=class extends s{constructor(){super(...arguments),this.orderIndex=0,this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.type="single",this.answerCheckType=1,this.examAnswerRelationType=0,this.richTextContent="",this.analysis="",this.leastAnswerCount=2,this.examExpand="",this.customId="",this.examId=0,this.uploadImage=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this.modelValue="",this.useModel=!1,this._answers=[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.title="",this._title="",this._analysis="",this._richText="",this._showRichText=!1,this._leastAnswerCount=2,this._answerCheckType=1,this._orderList=[],this._resultDialogOpen=!1,this._resultDialogIndex=0,this._resultDialogValue="",this._sortDropdownOpen=!1,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=t=>{const e=t.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper");s&&!e.includes(s)&&(this._sortDropdownOpen=!1,this.requestUpdate())}}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.map(t=>({...t})):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answerList")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this._syncExternalProps(),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}firstUpdated(){this._syncExternalProps(),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick)}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),(t.has("title")||t.has("answerList")||t.has("analysis")||t.has("leastAnswerCount")||t.has("answerCheckType"))&&this._syncExternalProps(),(t.has("examExpand")||t.has("answerList"))&&this._syncExamExpand(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this.leastAnswerCount||2,this._answerCheckType=this.answerCheckType||1,this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.answerList?.length&&(this._answers=this.answerList.map(t=>({...t,title:t.title||"",isCorrect:!!t.isCorrect})))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this.leastAnswerCount||2,this._answerCheckType=this.answerCheckType||1,this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.answerList?.length&&(this._answers=this.answerList.map(t=>({...t,title:t.title||"",isCorrect:!!t.isCorrect}))),this._syncExamExpand()}_syncExamExpand(){if(!this.examExpand||!this.answerList?.length)return;const t=this.examExpand.split(",");this._orderList=t.map(t=>{const e=this.answerList.find(e=>e.answerId?.toString()===t);return e?String.fromCharCode(65+e.orderIndex-1):t}).filter(Boolean)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_label(t){return String.fromCharCode(65+t)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(t,e){"single"===this.type?(this._answers.forEach(t=>{t.isCorrect=!1}),t.isCorrect=e):t.isCorrect=e,this.requestUpdate()}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_onAnswerInput(t,e){const s=t.target;s.value.length>this.ANSWER_MAX&&(s.value=s.value.slice(0,this.ANSWER_MAX)),this._answers[e].title=s.value,this.requestUpdate()}_addAnswer(){this.isSave||(this._answers=[...this._answers,{title:"",isCorrect:!1,customAnswerId:n()}])}_deleteAnswer(t){this._answers.length<3||this.isSave||(this._answers=this._answers.filter((e,s)=>s!==t))}_toggleSortItem(t){const e=this._orderList.indexOf(t);this._orderList=e>=0?this._orderList.filter(e=>e!==t):[...this._orderList,t],this.requestUpdate()}_removeSortItem(t){this._orderList=this._orderList.filter(e=>e!==t),this.requestUpdate()}_getSortOrder(t){const e=this._orderList.indexOf(this._label(t));return e>=0?e+1:null}async toJSON(){return new Promise((t,e)=>{const s={customId:this.customId||void 0,answerType:this.type,orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title||"",r=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._answerCheckType:this.answerCheckType||1,n=this.isEdit?this._leastAnswerCount:this.leastAnswerCount||2,a=this.isEdit?this._analysis:this.analysis||"",l=this.isEdit?this._orderList.map(t=>t.charCodeAt(0)-65+1).join(","):this.examExpand||"",p=this.isEdit?this._showRichText:!!this.richTextContent,h=this.isEdit?this._richText:this.richTextContent||"",c=this.isEdit?this._orderList:(()=>{const t=this.examExpand;return t?t.split(",").map(t=>{const e=this.answerList?.find(e=>e.answerId?.toString()===t);return e?String.fromCharCode(65+e.orderIndex-1):t}).filter(Boolean):[]})();if(!i)return void e(new d("题目标题不能为空!","EMPTY_TITLE","title",s));if(!o)return void e(new d("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",s));let u="",x=!1,w=0;if("multiple"===this.type||"single"===this.type)r.forEach((t,e)=>{t.title?.trim()||(u+=`选项${String.fromCharCode(65+e)}未填写。`),t.isCorrect&&(x=!0,w++)});else if("sort"===this.type&&(c.length&&(x=!0),x&&c.length<n))return void e(new d(`排序题至少需要设置${n}项排序答案`,"SORT_COUNT_INVALID","orderList",s));if(u)return void e(new d(u,"ANSWER_EMPTY","answers",s));if(new Set(r.map(t=>t.title)).size!==r.length)return void e(new d("选项不能重复","DUPLICATE_ANSWERS","answers",s));if("multiple"===this.type){if(1===w)return void e(new d("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",s));if(x&&w<n)return void e(new d("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))}if((2===o||3===o)&&!x)return void e(new d("请设置支持选项","NO_CORRECT_ANSWER","answers",s));const m={answerType:String(this.type),title:i,answers:r.filter(t=>t.title).map((t,e)=>({...t,orderIndex:e+1})),examExpand:l,analysis:a,isSetCorrectAnswer:x,leastAnswerCount:n,examRichTextContent:p?h:"",examAnswerRelationType:this.examAnswerRelationType,isKey:this.isKey,answerCheckType:o};this.customId&&(m.customId=this.customId),t(m)})}validate(){const t=[],e={customId:this.customId||void 0,answerType:this.type,orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",i=this.isEdit?this._answers:this.answerList||[],r=this.isEdit?this._answerCheckType:this.answerCheckType||1,o=this.isEdit?this._leastAnswerCount:this.leastAnswerCount||2,n=this.isEdit?this._orderList:(()=>{const t=this.examExpand;return t?t.split(",").map(t=>{const e=this.answerList?.find(e=>e.answerId?.toString()===t);return e?String.fromCharCode(65+e.orderIndex-1):t}).filter(Boolean):[]})();s||t.push(new d("题目标题不能为空!","EMPTY_TITLE","title",e)),r||t.push(new d("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",e));let a=!1,l=0;"multiple"===this.type||"single"===this.type?i.forEach((s,i)=>{s.title?.trim()||t.push(new d(`选项${String.fromCharCode(65+i)}未填写`,"ANSWER_EMPTY","answers",e)),s.isCorrect&&(a=!0,l++)}):"sort"===this.type&&(n.length&&(a=!0),a&&n.length<o&&t.push(new d(`排序题至少需要设置${o}项排序答案`,"SORT_COUNT_INVALID","orderList",e)));return new Set(i.map(t=>t.title)).size!==i.length&&i.length>0&&t.push(new d("选项不能重复","DUPLICATE_ANSWERS","answers",e)),"multiple"===this.type&&(1===l&&i.length>0&&t.push(new d("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",e)),a&&l<o&&t.push(new d("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",e))),2!==r&&3!==r||a||t.push(new d("请设置支持选项","NO_CORRECT_ANSWER","answers",e)),t}_openResultDialog(t){this._resultDialogIndex=t,this._resultDialogValue=this._answers[t].resultItem||"",this._resultDialogOpen=!0}_saveResultDialog(){this._answers[this._resultDialogIndex].resultItem=this._resultDialogValue,this._resultDialogOpen=!1,this.requestUpdate()}_renderResultDialog(){if(!this._resultDialogOpen)return"";const e=this._label(this._resultDialogIndex);return t`
|
|
2
2
|
<div class="modal-backdrop" @click=${()=>{this._resultDialogOpen=!1}}>
|
|
3
|
-
<div class="modal" @click=${
|
|
3
|
+
<div class="modal" @click=${t=>t.stopPropagation()}>
|
|
4
4
|
<div class="modal-header">
|
|
5
|
-
<span class="modal-title">编辑结果项 — 选项 ${
|
|
5
|
+
<span class="modal-title">编辑结果项 — 选项 ${e}</span>
|
|
6
6
|
<button class="modal-close" @click=${()=>{this._resultDialogOpen=!1}}>✕</button>
|
|
7
7
|
</div>
|
|
8
8
|
<div class="modal-body">
|
|
9
9
|
<textarea rows="5" .value=${this._resultDialogValue}
|
|
10
|
-
@input=${
|
|
10
|
+
@input=${t=>{this._resultDialogValue=t.target.value}}
|
|
11
11
|
placeholder="请输入该选项的结果项内容"></textarea>
|
|
12
12
|
</div>
|
|
13
13
|
<div class="modal-footer">
|
|
@@ -16,107 +16,107 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
|
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
18
|
</div>
|
|
19
|
-
`}async _save(
|
|
19
|
+
`}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}_renderPreview(){const e="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this.leastAnswerCount?`至少选${this.leastAnswerCount}项${"sort"===this.type?"并排序":""}`:""})`,s=this.answerList;return t`
|
|
20
20
|
<div class="preview">
|
|
21
|
-
<div><span class="title">${this.orderIndex+1}.${this.title||""}${
|
|
22
|
-
${this.richTextContent?
|
|
21
|
+
<div><span class="title">${this.orderIndex+1}.${this.title||""}${e}</span></div>
|
|
22
|
+
${this.richTextContent?t`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
|
|
23
23
|
<div class="preview-answer">
|
|
24
|
-
${s.map((
|
|
24
|
+
${s.map((e,s)=>t`
|
|
25
25
|
<label class="radio">
|
|
26
26
|
<input type="${"sort"===this.type?"checkbox":"radio"}" disabled />
|
|
27
|
-
<span class="order">${this._label(s)}.</span> ${
|
|
28
|
-
${"sort"!==this.type&&
|
|
29
|
-
${"sort"!==this.type&&1===this.examAnswerRelationType?
|
|
30
|
-
${"sort"!==this.type&&2===this.examAnswerRelationType?
|
|
27
|
+
<span class="order">${this._label(s)}.</span> ${e.title}
|
|
28
|
+
${"sort"!==this.type&&e.isCorrect?t`<span class="correct">(支持选项)</span>`:""}
|
|
29
|
+
${"sort"!==this.type&&1===this.examAnswerRelationType?t`<span class="result-info">${e.resultItem?"(已设置结果项)":"(未设置结果项)"}</span>`:""}
|
|
30
|
+
${"sort"!==this.type&&2===this.examAnswerRelationType?t`<span class="result-info">${e.answerRelations?.length?"(已设置关联)":"(未设置关联)"}</span>`:""}
|
|
31
31
|
</label>
|
|
32
32
|
`)}
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
35
|
-
`}_renderEdit(){return
|
|
35
|
+
`}_renderEdit(){return t`
|
|
36
36
|
<div class="flex-items-start">
|
|
37
37
|
<div class="label"><span>题目:</span></div>
|
|
38
38
|
<div style="flex:1">
|
|
39
39
|
<div class="el-input">
|
|
40
40
|
<textarea rows="2" .value=${this._title} ?disabled=${this.isSave}
|
|
41
41
|
maxlength=${this.TITLE_MAX}
|
|
42
|
-
@input=${
|
|
42
|
+
@input=${t=>this._onTitleInput(t)}
|
|
43
43
|
placeholder="【${this._titlePlaceholder}】请输入问题"></textarea>
|
|
44
44
|
<span class="char-counter">${this._title.length}/${this.TITLE_MAX}</span>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
-
${["multiple","sort"].includes(this.type)?
|
|
49
|
+
${["multiple","sort"].includes(this.type)?t`
|
|
50
50
|
<div class="flex-items-start" style="margin-top:12px">
|
|
51
51
|
<div class="label"><span>设置:</span></div>
|
|
52
52
|
<select class="el-select" .value=${String(this._leastAnswerCount)} ?disabled=${this.isSave}
|
|
53
|
-
@change=${
|
|
54
|
-
${Array.from({length:Math.max(0,this._answers.length-1)},(e
|
|
55
|
-
<option value=${
|
|
53
|
+
@change=${t=>{this._leastAnswerCount=Number(t.target.value)}}>
|
|
54
|
+
${Array.from({length:Math.max(0,this._answers.length-1)},(t,e)=>e+2).map(e=>t`
|
|
55
|
+
<option value=${e} ?selected=${this._leastAnswerCount===e}>至少选择${e}项</option>
|
|
56
56
|
`)}
|
|
57
57
|
</select>
|
|
58
58
|
</div>
|
|
59
59
|
`:""}
|
|
60
60
|
|
|
61
61
|
<div class="answer-list">
|
|
62
|
-
${this._answers.map((
|
|
62
|
+
${this._answers.map((e,s)=>t`
|
|
63
63
|
<div class="answer-item">
|
|
64
64
|
<span class="label">${this._label(s)}.</span>
|
|
65
65
|
<div class="input">
|
|
66
|
-
<input type="text" .value=${
|
|
66
|
+
<input type="text" .value=${e.title} ?disabled=${this.isSave}
|
|
67
67
|
maxlength=${this.ANSWER_MAX}
|
|
68
|
-
@input=${
|
|
68
|
+
@input=${t=>this._onAnswerInput(t,s)}
|
|
69
69
|
placeholder="选项${this._label(s)}" />
|
|
70
|
-
<span class="char-counter">${
|
|
70
|
+
<span class="char-counter">${e.title.length}/${this.ANSWER_MAX}</span>
|
|
71
71
|
</div>
|
|
72
72
|
|
|
73
|
-
${"sort"===this.type&&null!==this._getSortOrder(s)?
|
|
73
|
+
${"sort"===this.type&&null!==this._getSortOrder(s)?t`<span class="sort-badge">第${this._getSortOrder(s)}位</span>`:""}
|
|
74
74
|
|
|
75
|
-
${["single","multiple"].includes(this.type)?
|
|
76
|
-
<label class="correct ${
|
|
77
|
-
<input type="checkbox" .checked=${
|
|
78
|
-
@change=${
|
|
75
|
+
${["single","multiple"].includes(this.type)?t`
|
|
76
|
+
<label class="correct ${e.isCorrect?"is-correct":""}">
|
|
77
|
+
<input type="checkbox" .checked=${e.isCorrect} ?disabled=${this.isSave}
|
|
78
|
+
@change=${t=>this._setCorrect(e,t.target.checked)} />
|
|
79
79
|
支持选项
|
|
80
80
|
</label>
|
|
81
81
|
`:""}
|
|
82
82
|
|
|
83
83
|
<span class="icon ${this.isSave?"disabled":""}"
|
|
84
84
|
@click=${()=>this._addAnswer()}>
|
|
85
|
-
${
|
|
85
|
+
${h}
|
|
86
86
|
</span>
|
|
87
87
|
<span class="icon ${this.isSave||this._answers.length<3?"disabled":""}"
|
|
88
88
|
@click=${()=>this._deleteAnswer(s)}>
|
|
89
|
-
${
|
|
89
|
+
${c}
|
|
90
90
|
</span>
|
|
91
91
|
|
|
92
|
-
${1===this.examAnswerRelationType&&"sort"!==this.type?
|
|
93
|
-
<span class="link" @click=${()=>this._openResultDialog(s)}>${
|
|
92
|
+
${1===this.examAnswerRelationType&&"sort"!==this.type?t`
|
|
93
|
+
<span class="link" @click=${()=>this._openResultDialog(s)}>${e.resultItem?"编辑结果":"添加结果"}</span>
|
|
94
94
|
`:""}
|
|
95
|
-
${2===this.examAnswerRelationType&&"sort"!==this.type?
|
|
95
|
+
${2===this.examAnswerRelationType&&"sort"!==this.type?t`
|
|
96
96
|
<span class="link">关联检查</span>
|
|
97
97
|
`:""}
|
|
98
98
|
</div>
|
|
99
99
|
`)}
|
|
100
100
|
</div>
|
|
101
101
|
|
|
102
|
-
${"sort"===this.type?
|
|
102
|
+
${"sort"===this.type?t`
|
|
103
103
|
<div class="flex-items-center" style="margin-top:12px">
|
|
104
104
|
<div class="label"><span>排序答案:</span></div>
|
|
105
105
|
<div style="flex:1">
|
|
106
106
|
<div class="multi-select-wrapper">
|
|
107
107
|
<div class="multi-select ${this._sortDropdownOpen?"focused":""} ${this.isSave?"disabled":""}"
|
|
108
108
|
@click=${()=>{this.isSave||(this._sortDropdownOpen=!this._sortDropdownOpen,this.requestUpdate())}}>
|
|
109
|
-
${this._orderList.length>0?this._orderList.map(t
|
|
109
|
+
${this._orderList.length>0?this._orderList.map(e=>t`
|
|
110
110
|
<span class="tag">
|
|
111
|
-
${
|
|
112
|
-
<span class="tag-close" @click=${
|
|
111
|
+
${e}
|
|
112
|
+
<span class="tag-close" @click=${t=>{t.stopPropagation(),this._removeSortItem(e)}}>✕</span>
|
|
113
113
|
</span>
|
|
114
|
-
`):
|
|
114
|
+
`):t`<span class="placeholder">请按顺序选择排序答案</span>`}
|
|
115
115
|
<span class="arrow">${u}</span>
|
|
116
116
|
</div>
|
|
117
|
-
${this._sortDropdownOpen?
|
|
117
|
+
${this._sortDropdownOpen?t`
|
|
118
118
|
<div class="multi-select-dropdown">
|
|
119
|
-
${this._answers.map((
|
|
119
|
+
${this._answers.map((e,s)=>t`
|
|
120
120
|
<div class="multi-select-option ${this._orderList.includes(this._label(s))?"selected":""}"
|
|
121
121
|
@click=${()=>{this._toggleSortItem(this._label(s)),this.requestUpdate()}}>
|
|
122
122
|
${this._label(s)}
|
|
@@ -129,7 +129,7 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
|
|
|
129
129
|
</div>
|
|
130
130
|
`:""}
|
|
131
131
|
|
|
132
|
-
${this._showRichText?
|
|
132
|
+
${this._showRichText?t`
|
|
133
133
|
<div class="flex-items-start" style="margin-top:12px">
|
|
134
134
|
<div class="label"><span>富文本:</span></div>
|
|
135
135
|
<div style="flex:1">
|
|
@@ -137,28 +137,28 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
|
|
|
137
137
|
.content=${this._richText}
|
|
138
138
|
.uploadImage=${this.uploadImage}
|
|
139
139
|
?is-edit=${!0}
|
|
140
|
-
@input=${
|
|
140
|
+
@input=${t=>{this._richText=t.target.getContent()}}
|
|
141
141
|
></qxs-blocksuite-editor>
|
|
142
142
|
<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>
|
|
143
143
|
</div>
|
|
144
144
|
</div>
|
|
145
145
|
`:""}
|
|
146
146
|
|
|
147
|
-
${this.showAnalysis?
|
|
147
|
+
${this.showAnalysis?t`
|
|
148
148
|
<div class="flex-items-start" style="margin-top:12px">
|
|
149
149
|
<div class="label"><span>解析:</span></div>
|
|
150
150
|
<div style="flex:1">
|
|
151
151
|
<textarea rows="2" .value=${this._analysis}
|
|
152
|
-
@input=${
|
|
152
|
+
@input=${t=>{this._analysis=t.target.value}}
|
|
153
153
|
placeholder="请输入题目解析"></textarea>
|
|
154
154
|
</div>
|
|
155
155
|
</div>
|
|
156
156
|
`:""}
|
|
157
|
-
`}render(){return
|
|
157
|
+
`}render(){return t`
|
|
158
158
|
<qxs-subject-layout ?show-edit=${this.isEdit}>
|
|
159
159
|
<div slot="preview">${this._renderPreview()}</div>
|
|
160
160
|
<div slot="edit">${this._renderEdit()}</div>
|
|
161
|
-
${this.showAction?
|
|
161
|
+
${this.showAction?t`
|
|
162
162
|
<qxs-subject-action
|
|
163
163
|
?is-edit=${this.isEdit}
|
|
164
164
|
?is-set=${this.isSet}
|
|
@@ -169,15 +169,15 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
|
|
|
169
169
|
@delete=${()=>this._emit("delete")}
|
|
170
170
|
@save=${this._save}
|
|
171
171
|
@edit=${()=>this._emit("edit")}
|
|
172
|
-
@add=${
|
|
173
|
-
@set-key=${
|
|
174
|
-
@set-answer-setting=${
|
|
172
|
+
@add=${t=>this._emit("add",t.detail)}
|
|
173
|
+
@set-key=${t=>{this._emit("set-key",t.detail)}}
|
|
174
|
+
@set-answer-setting=${t=>{this._answerCheckType=t.detail.value}}
|
|
175
175
|
@on-show-rich-text=${()=>{this._showRichText=!0}}
|
|
176
176
|
></qxs-subject-action>
|
|
177
177
|
`:""}
|
|
178
178
|
</qxs-subject-layout>
|
|
179
179
|
${this._renderResultDialog()}
|
|
180
|
-
`}};x.styles=
|
|
180
|
+
`}};x.styles=e`
|
|
181
181
|
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
|
|
182
182
|
*, ::before, ::after { box-sizing: border-box; }
|
|
183
183
|
|
|
@@ -315,5 +315,5 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
|
|
|
315
315
|
.modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }
|
|
316
316
|
.modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
|
|
317
317
|
.modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }
|
|
318
|
-
`,p([i({type:Number,attribute:"order-index"})],x.prototype,"orderIndex",2),p([i({type:Boolean,attribute:"is-edit"})],x.prototype,"isEdit",2),p([i({type:Boolean,attribute:"is-save"})],x.prototype,"isSave",2),p([i({type:Boolean,attribute:"is-set"})],x.prototype,"isSet",2),p([i({type:Boolean,attribute:"is-key"})],x.prototype,"isKey",2),p([i({type:Boolean,attribute:"show-action"})],x.prototype,"showAction",2),p([i({type:Boolean,attribute:"show-analysis"})],x.prototype,"showAnalysis",2),p([i({type
|
|
318
|
+
`,p([i({type:Number,attribute:"order-index"})],x.prototype,"orderIndex",2),p([i({type:Boolean,attribute:"is-edit"})],x.prototype,"isEdit",2),p([i({type:Boolean,attribute:"is-save"})],x.prototype,"isSave",2),p([i({type:Boolean,attribute:"is-set"})],x.prototype,"isSet",2),p([i({type:Boolean,attribute:"is-key"})],x.prototype,"isKey",2),p([i({type:Boolean,attribute:"show-action"})],x.prototype,"showAction",2),p([i({type:Boolean,attribute:"show-analysis"})],x.prototype,"showAnalysis",2),p([i({attribute:"question-type",reflect:!0})],x.prototype,"type",2),p([i({type:Number,attribute:"answer-check-type"})],x.prototype,"answerCheckType",2),p([i({type:Number,attribute:"exam-answer-relation-type"})],x.prototype,"examAnswerRelationType",2),p([i({type:String,attribute:"rich-text-content"})],x.prototype,"richTextContent",2),p([i({type:String})],x.prototype,"analysis",2),p([i({type:Number,attribute:"least-answer-count"})],x.prototype,"leastAnswerCount",2),p([i({type:String,attribute:"exam-expand"})],x.prototype,"examExpand",2),p([i({type:String,attribute:"custom-id"})],x.prototype,"customId",2),p([i({type:Number,attribute:"exam-id"})],x.prototype,"examId",2),p([i({type:Object})],x.prototype,"uploadImage",2),p([i({type:Array,attribute:"answer-list"})],x.prototype,"answerList",1),p([i({type:String,attribute:"model-value"})],x.prototype,"modelValue",2),p([i({type:Boolean,attribute:"use-model"})],x.prototype,"useModel",2),p([r()],x.prototype,"_answers",2),p([i({type:String})],x.prototype,"title",2),p([r()],x.prototype,"_title",2),p([r()],x.prototype,"_analysis",2),p([r()],x.prototype,"_richText",2),p([r()],x.prototype,"_showRichText",2),p([r()],x.prototype,"_leastAnswerCount",2),p([r()],x.prototype,"_answerCheckType",2),p([r()],x.prototype,"_orderList",2),p([r()],x.prototype,"_resultDialogOpen",2),p([r()],x.prototype,"_resultDialogIndex",2),p([r()],x.prototype,"_resultDialogValue",2),p([r()],x.prototype,"_sortDropdownOpen",2),x=p([o("qxs-subject-single")],x);export{x as QxsSubjectSingle,d as SubjectError};
|
|
319
319
|
//# sourceMappingURL=single.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.mjs","sources":["../../../../packages/components-wc/src/subject/single.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectType } from './types'\nimport type { AnswerType } from './types'\n\nexport interface SubjectErrorOptions {\n message: string\n code?: string\n field?: string\n row?: any\n}\n\nexport class SubjectError extends Error {\n constructor(\n message: string,\n public code: string = 'VALIDATION_ERROR',\n public field?: string,\n public row?: any,\n ) {\n super(message)\n this.name = 'SubjectError'\n }\n\n static from(options: SubjectErrorOptions): SubjectError {\n return new SubjectError(options.message, options.code, options.field, options.row)\n }\n}\n\ninterface Answer {\n title: string\n isCorrect: boolean\n customAnswerId?: string\n answerId?: string\n resultItem?: string\n orderIndex?: number\n answerRelations?: any[]\n relationType?: number | null\n}\n\nconst iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconClose = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>`\nconst iconArrow = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"6 9 12 15 18 9\"/></svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-subject-single')\nexport class QxsSubjectSingle extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-select {\n width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n background-repeat: no-repeat; background-position: right 8px center;\n }\n .el-select:focus { border-color: #3D61E3; outline: none; }\n .el-select:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-select.sort-select {\n width: 360px; height: auto; min-height: 32px; appearance: auto;\n }\n\n .sort-badge { font-weight: bold; color: #3D61E3; margin-left: 10px; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n /* Multi-select with tags (Element Plus style) */\n .multi-select-wrapper { position: relative; }\n .multi-select {\n width: 240px; height: 28px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 30px 0 8px; font-size: 13px; background: #fff; cursor: pointer;\n display: flex; flex-wrap: nowrap; align-items: center; gap: 4px;\n transition: border-color .2s; position: relative; overflow: hidden;\n }\n .multi-select:hover { border-color: #c0c4cc; }\n .multi-select.focused { border-color: #3D61E3; }\n .multi-select.disabled { background: #f5f7fa; cursor: not-allowed; }\n .multi-select .placeholder { color: #c0c4cc; font-size: 13px; padding: 4px 0; }\n .multi-select .arrow {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n color: #c0c4cc; display: inline-flex; transition: transform .2s;\n }\n .multi-select.focused .arrow { transform: translateY(-50%) rotate(180deg); color: #3D61E3; }\n .multi-select .tag {\n display: inline-flex; align-items: center; gap: 2px;\n background: #f0f2f5; border-radius: 3px; padding: 0 6px; height: 20px;\n font-size: 12px; color: #606266; line-height: 20px;\n }\n .multi-select .tag .tag-close {\n display: inline-flex; cursor: pointer; color: #909399; margin-left: 2px; line-height: 1;\n }\n .multi-select .tag .tag-close:hover { color: #3D61E3; }\n .multi-select-dropdown {\n position: absolute; z-index: 100; background: #fff; left: 0; top: 100%; margin-top: 4px;\n border: 1px solid #e4e7ed; border-radius: 3px;\n box-shadow: 0 4px 12px rgba(0,0,0,.12); min-width: 240px; max-height: 140px; overflow-y: auto;\n }\n .multi-select-option {\n padding: 4px 12px; font-size: 13px; color: #606266; cursor: pointer;\n transition: background .2s;\n }\n .multi-select-option:hover { background: #f5f7fa; }\n .multi-select-option.selected { color: #3D61E3; font-weight: 500; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String }) type: AnswerType = 'single'\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'least-answer-count' }) leastAnswerCount = 2\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Number, attribute: 'exam-id' }) examId = 0\n @property({ type: Object }) uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' })\n get answerList() { return this._answers }\n\n set answerList(v: any) {\n const arr = Array.isArray(v) ? v : []\n this._answers = arr.length\n ? arr.map((a: any) => ({ ...a }))\n : [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n this.requestUpdate('answerList')\n }\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _answers: Answer[] = [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _richText = ''\n @state() private _showRichText = false\n @state() private _leastAnswerCount = 2\n @state() private _answerCheckType = 1\n @state() private _orderList: string[] = []\n @state() private _resultDialogOpen = false\n @state() private _resultDialogIndex = 0\n @state() private _resultDialogValue = ''\n @state() private _sortDropdownOpen = false\n\n private readonly TITLE_MAX = 200\n private readonly ANSWER_MAX = 100\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrapper = this.shadowRoot?.querySelector('.multi-select-wrapper')\n if (wrapper && !path.includes(wrapper)) {\n this._sortDropdownOpen = false\n this.requestUpdate()\n }\n }\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (changed.has('examExpand') || changed.has('answerList')) { this._syncExamExpand() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue\n }\n }\n\n private _syncProps() {\n this._title = (this as any).title || ''\n this._analysis = this.analysis || ''\n this._leastAnswerCount = this.leastAnswerCount || 2\n this._answerCheckType = this.answerCheckType || 1\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({\n ...a,\n title: a.title || '',\n isCorrect: !!a.isCorrect,\n }))\n }\n this._syncExamExpand()\n }\n\n private _syncExamExpand() {\n if (!this.examExpand || !this.answerList?.length) { return }\n const ids = this.examExpand.split(',')\n this._orderList = ids.map((id) => {\n const answer = (this.answerList as any[]).find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _label(i: number) { return String.fromCharCode(65 + i) }\n\n private get _titlePlaceholder() {\n return this.type === 'single' ? '单选题' : this.type === 'multiple' ? '多选题' : '排序题'\n }\n\n private _setCorrect(item: Answer, val: boolean) {\n if (this.type === 'single') {\n this._answers.forEach((a) => { a.isCorrect = false })\n item.isCorrect = val\n }\n else {\n item.isCorrect = val\n }\n this.requestUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n // 双向绑定:通知外部更新\n if (this.useModel) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private _onAnswerInput(e: Event, idx: number) {\n const el = e.target as HTMLInputElement\n if (el.value.length > this.ANSWER_MAX) { el.value = el.value.slice(0, this.ANSWER_MAX) }\n this._answers[idx].title = el.value\n this.requestUpdate()\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', isCorrect: false, customAnswerId: uid() }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 3 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private _toggleSortItem(letter: string) {\n const idx = this._orderList.indexOf(letter)\n if (idx >= 0) {\n this._orderList = this._orderList.filter(l => l !== letter)\n }\n else {\n this._orderList = [...this._orderList, letter]\n }\n this.requestUpdate()\n }\n\n private _removeSortItem(letter: string) {\n this._orderList = this._orderList.filter(l => l !== letter)\n this.requestUpdate()\n }\n\n private _getSortOrder(index: number): number | null {\n const pos = this._orderList.indexOf(this._label(index))\n return pos >= 0 ? pos + 1 : null\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const examExpand = this.isEdit\n ? this._orderList.map((l: string) => l.charCodeAt(0) - 65 + 1).join(',')\n : ((this as any).examExpand || '')\n const showRichText = this.isEdit ? this._showRichText : !!(this.richTextContent)\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (!answerCheckType) {\n reject(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n return\n }\n\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) { msg += `选项${String.fromCharCode(65 + i)}未填写。` }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n reject(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n return\n }\n }\n\n if (msg) {\n reject(new SubjectError(msg, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length) {\n reject(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n return\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1) {\n reject(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n return\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n reject(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n return\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n reject(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n return\n }\n }\n\n const result: any = {\n answerType: this.type,\n title,\n answers: answers.filter((a: any) => a.title).map((a: any, i: number) => ({ ...a, orderIndex: i + 1 })),\n examExpand,\n analysis,\n isSetCorrectAnswer,\n leastAnswerCount,\n examRichTextContent: showRichText ? richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n isKey: this.isKey,\n answerCheckType,\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (!answerCheckType) {\n errors.push(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n }\n\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n errors.push(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n }\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length && answers.length > 0) {\n errors.push(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1 && answers.length > 0) {\n errors.push(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n errors.push(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n errors.push(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n }\n }\n\n return errors\n }\n\n private _openResultDialog(idx: number) {\n this._resultDialogIndex = idx\n this._resultDialogValue = this._answers[idx].resultItem || ''\n this._resultDialogOpen = true\n }\n\n private _saveResultDialog() {\n this._answers[this._resultDialogIndex].resultItem = this._resultDialogValue\n this._resultDialogOpen = false\n this.requestUpdate()\n }\n\n private _renderResultDialog() {\n if (!this._resultDialogOpen) { return '' }\n const letter = this._label(this._resultDialogIndex)\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._resultDialogOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">编辑结果项 — 选项 ${letter}</span>\n <button class=\"modal-close\" @click=${() => { this._resultDialogOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n <textarea rows=\"5\" .value=${this._resultDialogValue}\n @input=${(e: Event) => { this._resultDialogValue = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入该选项的结果项内容\"></textarea>\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._resultDialogOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => this._saveResultDialog()}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n private _renderPreview() {\n const typeSuffix = this.type === 'single'\n ? '(单选题)'\n : `(${this._titlePlaceholder}${this.leastAnswerCount ? `至少选${this.leastAnswerCount}项${this.type === 'sort' ? '并排序' : ''}` : ''})`\n const answers = this.answerList as Answer[]\n return html`\n <div class=\"preview\">\n <div><span class=\"title\">${this.orderIndex + 1}.${(this as any).title || ''}${typeSuffix}</span></div>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n <div class=\"preview-answer\">\n ${answers.map((a, i) => html`\n <label class=\"radio\">\n <input type=\"${this.type === 'sort' ? 'checkbox' : 'radio'}\" disabled />\n <span class=\"order\">${this._label(i)}.</span> ${a.title}\n ${this.type !== 'sort' && a.isCorrect ? html`<span class=\"correct\">(支持选项)</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 1 ? html`<span class=\"result-info\">${a.resultItem ? '(已设置结果项)' : '(未设置结果项)'}</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 2 ? html`<span class=\"result-info\">${a.answerRelations?.length ? '(已设置关联)' : '(未设置关联)'}</span>` : ''}\n </label>\n `)}\n </div>\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【${this._titlePlaceholder}】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n ${['multiple', 'sort'].includes(this.type)\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>设置:</span></div>\n <select class=\"el-select\" .value=${String(this._leastAnswerCount)} ?disabled=${this.isSave}\n @change=${(e: Event) => { this._leastAnswerCount = Number((e.target as HTMLSelectElement).value) }}>\n ${Array.from({ length: Math.max(0, this._answers.length - 1) }, (_, i) => i + 2).map(n => html`\n <option value=${n} ?selected=${this._leastAnswerCount === n}>至少选择${n}项</option>\n `)}\n </select>\n </div>\n `\n : ''}\n\n <div class=\"answer-list\">\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${this._label(i)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${a.title} ?disabled=${this.isSave}\n maxlength=${this.ANSWER_MAX}\n @input=${(e: Event) => this._onAnswerInput(e, i)}\n placeholder=\"选项${this._label(i)}\" />\n <span class=\"char-counter\">${a.title.length}/${this.ANSWER_MAX}</span>\n </div>\n\n ${this.type === 'sort' && this._getSortOrder(i) !== null\n ? html`<span class=\"sort-badge\">第${this._getSortOrder(i)}位</span>`\n : ''}\n\n ${['single', 'multiple'].includes(this.type)\n ? html`\n <label class=\"correct ${a.isCorrect ? 'is-correct' : ''}\">\n <input type=\"checkbox\" .checked=${a.isCorrect} ?disabled=${this.isSave}\n @change=${(e: Event) => this._setCorrect(a, (e.target as HTMLInputElement).checked)} />\n 支持选项\n </label>\n `\n : ''}\n\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\"\n @click=${() => this._addAnswer()}>\n ${iconPlus}\n </span>\n <span class=\"icon ${this.isSave || this._answers.length < 3 ? 'disabled' : ''}\"\n @click=${() => this._deleteAnswer(i)}>\n ${iconRemove}\n </span>\n\n ${this.examAnswerRelationType === 1 && this.type !== 'sort'\n ? html`\n <span class=\"link\" @click=${() => this._openResultDialog(i)}>${a.resultItem ? '编辑结果' : '添加结果'}</span>\n `\n : ''}\n ${this.examAnswerRelationType === 2 && this.type !== 'sort'\n ? html`\n <span class=\"link\">关联检查</span>\n `\n : ''}\n </div>\n `)}\n </div>\n\n ${this.type === 'sort'\n ? html`\n <div class=\"flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>排序答案:</span></div>\n <div style=\"flex:1\">\n <div class=\"multi-select-wrapper\">\n <div class=\"multi-select ${this._sortDropdownOpen ? 'focused' : ''} ${this.isSave ? 'disabled' : ''}\"\n @click=${() => { if (!this.isSave) { this._sortDropdownOpen = !this._sortDropdownOpen; this.requestUpdate() } }}>\n ${this._orderList.length > 0\n ? this._orderList.map(l => html`\n <span class=\"tag\">\n ${l}\n <span class=\"tag-close\" @click=${(e: Event) => { e.stopPropagation(); this._removeSortItem(l) }}>✕</span>\n </span>\n `)\n : html`<span class=\"placeholder\">请按顺序选择排序答案</span>`\n }\n <span class=\"arrow\">${iconArrow}</span>\n </div>\n ${this._sortDropdownOpen\n ? html`\n <div class=\"multi-select-dropdown\">\n ${this._answers.map((_, i) => html`\n <div class=\"multi-select-option ${this._orderList.includes(this._label(i)) ? 'selected' : ''}\"\n @click=${() => { this._toggleSortItem(this._label(i)); this.requestUpdate() }}>\n ${this._label(i)}\n </div>\n `)}\n </div>\n `\n : ''}\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?is-key=${this.isKey}\n ?show-other-option=${this.type === 'multiple' || this.type === 'single'}\n answer-check-type=${this._answerCheckType}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @set-answer-setting=${(e: CustomEvent) => { this._answerCheckType = e.detail.value }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n ${this._renderResultDialog()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectError","Error","constructor","message","code","arguments","length","undefined","field","row","super","this","name","from","options","iconPlus","html","iconRemove","iconArrow","QxsSubjectSingle","LitElement","orderIndex","isEdit","isSave","isSet","isKey","showAction","showAnalysis","type","answerCheckType","examAnswerRelationType","richTextContent","analysis","leastAnswerCount","examExpand","customId","examId","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","modelValue","useModel","_answers","title","isCorrect","_title","_analysis","_richText","_showRichText","_leastAnswerCount","_answerCheckType","_orderList","_resultDialogOpen","_resultDialogIndex","_resultDialogValue","_sortDropdownOpen","TITLE_MAX","ANSWER_MAX","_handleDocumentClick","path","composedPath","wrapper","shadowRoot","querySelector","includes","requestUpdate","answerList","v","arr","Array","isArray","map","a","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","willUpdate","changed","has","_syncProps","_syncExamExpand","ids","split","id","answer","find","answerId","toString","String","fromCharCode","filter","Boolean","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_label","i","_titlePlaceholder","_setCorrect","item","val","forEach","_onTitleInput","el","value","slice","_onAnswerInput","idx","_addAnswer","customAnswerId","uid","_deleteAnswer","index","_","_toggleSortItem","letter","indexOf","l","_removeSortItem","_getSortOrder","pos","toJSON","answerType","answers","charCodeAt","join","showRichText","richText","orderList","expand","msg","isSetCorrectAnswer","correctAnswerCount","trim","Set","size","examRichTextContent","validate","errors","push","_openResultDialog","resultItem","_saveResultDialog","_renderResultDialog","stopPropagation","_save","stopImmediatePropagation","data","err","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","_renderPreview","typeSuffix","answerRelations","_renderEdit","Number","Math","max","n","checked","getContent","render","styles","css","__decorateClass","property","attribute","prototype","state","safeCustomElement"],"mappings":"2lBAcO,MAAMA,UAAqBC,MAChCC,WAAAA,CACEC,GAIA,IAHOC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAe,mBACfG,yCACAC,EAAAJ,UAAAC,OAAA,EAAAD,kBAAAE,EAEPG,MAAMP,GAJCQ,KAAAP,KAAAA,EACAO,KAAAH,MAAAA,EACAG,KAAAF,IAAAA,EAGPE,KAAKC,KAAO,cACd,CAEA,WAAOC,CAAKC,GACV,OAAO,IAAId,EAAac,EAAQX,QAASW,EAAQV,KAAMU,EAAQN,MAAOM,EAAQL,IAChF,EAcF,MAAMM,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLACDA,CAAA,yNAClB,MAAME,EAAYF,CAAA,kLAgBX,IAAMG,EAAN,cAA+BC,EAA/BlB,WAAAA,GAAAQ,SAAAL,WA6IiDM,KAAAU,WAAa,EAChBV,KAAAW,QAAS,EACTX,KAAAY,QAAS,EACVZ,KAAAa,OAAQ,EACRb,KAAAc,OAAQ,EACHd,KAAAe,YAAa,EACXf,KAAAgB,cAAe,EAC5ChB,KAAAiB,KAAmB,SACajB,KAAAkB,gBAAkB,EACVlB,KAAAmB,uBAAyB,EACjCnB,KAAAoB,gBAAkB,GAClDpB,KAAAqB,SAAW,GACsBrB,KAAAsB,iBAAmB,EAC1BtB,KAAAuB,WAAa,GACfvB,KAA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AE9K,KAAMoK,OAAQW,UAAW,aA5J1BxL,EA4JuCyL,UAAA,SAAA,GACtBH,EAAA,CAA3BC,EAAS,CAAE9K,KAAM2I,UA7JPpJ,EA6JiByL,UAAA,cAAA,GAUxBH,EAAA,CADHC,EAAS,CAAE9K,KAAMoD,MAAO2H,UAAW,iBAtKzBxL,EAuKPyL,UAAA,aAAA,GAckDH,EAAA,CAArDC,EAAS,CAAE9K,KAAMyE,OAAQsG,UAAW,iBArL1BxL,EAqL2CyL,UAAA,aAAA,GACDH,EAAA,CAApDC,EAAS,CAAE9K,KAAM4E,QAASmG,UAAW,eAtL3BxL,EAsL0CyL,UAAA,WAAA,GAEpCH,EAAA,CAAhBI,KAxLU1L,EAwLMyL,UAAA,WAAA,GAKAH,EAAA,CAAhBI,KA7LU1L,EA6LMyL,UAAA,SAAA,GACAH,EAAA,CAAhBI,KA9LU1L,EA8LMyL,UAAA,YAAA,GACAH,EAAA,CAAhBI,KA/LU1L,EA+LMyL,UAAA,YAAA,GACAH,EAAA,CAAhBI,KAhMU1L,EAgMMyL,UAAA,gBAAA,GACAH,EAAA,CAAhBI,KAjMU1L,EAiMMyL,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KAlMU1L,EAkMMyL,UAAA,mBAAA,GACAH,EAAA,CAAhBI,KAnMU1L,EAmMMyL,UAAA,aAAA,GACAH,EAAA,CAAhBI,KApMU1L,EAoMMyL,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KArMU1L,EAqMMyL,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAtMU1L,EAsMMyL,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAvMU1L,EAuMMyL,UAAA,oBAAA,GAvMNzL,EAANsL,EAAA,CADNK,EAAkB,uBACN3L"}
|
|
1
|
+
{"version":3,"file":"single.mjs","sources":["../../../../packages/components-wc/src/subject/single.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectType } from './types'\nimport type { AnswerType } from './types'\n\nexport interface SubjectErrorOptions {\n message: string\n code?: string\n field?: string\n row?: any\n}\n\nexport class SubjectError extends Error {\n constructor(\n message: string,\n public code: string = 'VALIDATION_ERROR',\n public field?: string,\n public row?: any,\n ) {\n super(message)\n this.name = 'SubjectError'\n }\n\n static from(options: SubjectErrorOptions): SubjectError {\n return new SubjectError(options.message, options.code, options.field, options.row)\n }\n}\n\ninterface Answer {\n title: string\n isCorrect: boolean\n customAnswerId?: string\n answerId?: string\n resultItem?: string\n orderIndex?: number\n answerRelations?: any[]\n relationType?: number | null\n}\n\nconst iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconClose = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>`\nconst iconArrow = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"6 9 12 15 18 9\"/></svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-subject-single')\nexport class QxsSubjectSingle extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-select {\n width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n background-repeat: no-repeat; background-position: right 8px center;\n }\n .el-select:focus { border-color: #3D61E3; outline: none; }\n .el-select:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-select.sort-select {\n width: 360px; height: auto; min-height: 32px; appearance: auto;\n }\n\n .sort-badge { font-weight: bold; color: #3D61E3; margin-left: 10px; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n /* Multi-select with tags (Element Plus style) */\n .multi-select-wrapper { position: relative; }\n .multi-select {\n width: 240px; height: 28px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 30px 0 8px; font-size: 13px; background: #fff; cursor: pointer;\n display: flex; flex-wrap: nowrap; align-items: center; gap: 4px;\n transition: border-color .2s; position: relative; overflow: hidden;\n }\n .multi-select:hover { border-color: #c0c4cc; }\n .multi-select.focused { border-color: #3D61E3; }\n .multi-select.disabled { background: #f5f7fa; cursor: not-allowed; }\n .multi-select .placeholder { color: #c0c4cc; font-size: 13px; padding: 4px 0; }\n .multi-select .arrow {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n color: #c0c4cc; display: inline-flex; transition: transform .2s;\n }\n .multi-select.focused .arrow { transform: translateY(-50%) rotate(180deg); color: #3D61E3; }\n .multi-select .tag {\n display: inline-flex; align-items: center; gap: 2px;\n background: #f0f2f5; border-radius: 3px; padding: 0 6px; height: 20px;\n font-size: 12px; color: #606266; line-height: 20px;\n }\n .multi-select .tag .tag-close {\n display: inline-flex; cursor: pointer; color: #909399; margin-left: 2px; line-height: 1;\n }\n .multi-select .tag .tag-close:hover { color: #3D61E3; }\n .multi-select-dropdown {\n position: absolute; z-index: 100; background: #fff; left: 0; top: 100%; margin-top: 4px;\n border: 1px solid #e4e7ed; border-radius: 3px;\n box-shadow: 0 4px 12px rgba(0,0,0,.12); min-width: 240px; max-height: 140px; overflow-y: auto;\n }\n .multi-select-option {\n padding: 4px 12px; font-size: 13px; color: #606266; cursor: pointer;\n transition: background .2s;\n }\n .multi-select-option:hover { background: #f5f7fa; }\n .multi-select-option.selected { color: #3D61E3; font-weight: 500; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ attribute: 'question-type', reflect: true }) type: AnswerType = 'single'\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'least-answer-count' }) leastAnswerCount = 2\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Number, attribute: 'exam-id' }) examId = 0\n @property({ type: Object }) uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' })\n get answerList() { return this._answers }\n\n set answerList(v: any) {\n const arr = Array.isArray(v) ? v : []\n this._answers = arr.length\n ? arr.map((a: any) => ({ ...a }))\n : [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n this.requestUpdate('answerList')\n }\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _answers: Answer[] = [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n\n @property({ type: String }) title = ''\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _richText = ''\n @state() private _showRichText = false\n @state() private _leastAnswerCount = 2\n @state() private _answerCheckType = 1\n @state() private _orderList: string[] = []\n @state() private _resultDialogOpen = false\n @state() private _resultDialogIndex = 0\n @state() private _resultDialogValue = ''\n @state() private _sortDropdownOpen = false\n\n private readonly TITLE_MAX = 200\n private readonly ANSWER_MAX = 100\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n this._syncExternalProps()\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\n }\n\n firstUpdated() {\n this._syncExternalProps()\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrapper = this.shadowRoot?.querySelector('.multi-select-wrapper')\n if (wrapper && !path.includes(wrapper)) {\n this._sortDropdownOpen = false\n this.requestUpdate()\n }\n }\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (changed.has('title') || changed.has('answerList') || changed.has('analysis') || changed.has('leastAnswerCount') || changed.has('answerCheckType')) {\n this._syncExternalProps()\n }\n if (changed.has('examExpand') || changed.has('answerList')) { this._syncExamExpand() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue\n }\n }\n\n private _syncExternalProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._leastAnswerCount = this.leastAnswerCount || 2\n this._answerCheckType = this.answerCheckType || 1\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({\n ...a,\n title: a.title || '',\n isCorrect: !!a.isCorrect,\n }))\n }\n }\n\n private _syncProps() {\n this._title = (this as any).title || ''\n this._analysis = this.analysis || ''\n this._leastAnswerCount = this.leastAnswerCount || 2\n this._answerCheckType = this.answerCheckType || 1\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({\n ...a,\n title: a.title || '',\n isCorrect: !!a.isCorrect,\n }))\n }\n this._syncExamExpand()\n }\n\n private _syncExamExpand() {\n if (!this.examExpand || !this.answerList?.length) { return }\n const ids = this.examExpand.split(',')\n this._orderList = ids.map((id) => {\n const answer = (this.answerList as any[]).find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _label(i: number) { return String.fromCharCode(65 + i) }\n\n private get _titlePlaceholder() {\n return this.type === 'single' ? '单选题' : this.type === 'multiple' ? '多选题' : '排序题'\n }\n\n private _setCorrect(item: Answer, val: boolean) {\n if (this.type === 'single') {\n this._answers.forEach((a) => { a.isCorrect = false })\n item.isCorrect = val\n }\n else {\n item.isCorrect = val\n }\n this.requestUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n // 双向绑定:通知外部更新\n if (this.useModel) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private _onAnswerInput(e: Event, idx: number) {\n const el = e.target as HTMLInputElement\n if (el.value.length > this.ANSWER_MAX) { el.value = el.value.slice(0, this.ANSWER_MAX) }\n this._answers[idx].title = el.value\n this.requestUpdate()\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', isCorrect: false, customAnswerId: uid() }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 3 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private _toggleSortItem(letter: string) {\n const idx = this._orderList.indexOf(letter)\n if (idx >= 0) {\n this._orderList = this._orderList.filter(l => l !== letter)\n }\n else {\n this._orderList = [...this._orderList, letter]\n }\n this.requestUpdate()\n }\n\n private _removeSortItem(letter: string) {\n this._orderList = this._orderList.filter(l => l !== letter)\n this.requestUpdate()\n }\n\n private _getSortOrder(index: number): number | null {\n const pos = this._orderList.indexOf(this._label(index))\n return pos >= 0 ? pos + 1 : null\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const examExpand = this.isEdit\n ? this._orderList.map((l: string) => l.charCodeAt(0) - 65 + 1).join(',')\n : ((this as any).examExpand || '')\n const showRichText = this.isEdit ? this._showRichText : !!(this.richTextContent)\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (!answerCheckType) {\n reject(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n return\n }\n\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) { msg += `选项${String.fromCharCode(65 + i)}未填写。` }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n reject(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n return\n }\n }\n\n if (msg) {\n reject(new SubjectError(msg, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length) {\n reject(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n return\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1) {\n reject(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n return\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n reject(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n return\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n reject(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n return\n }\n }\n\n console.log('toJSON this.type:', this.type, typeof this.type)\n const result: any = {\n answerType: String(this.type),\n title,\n answers: answers.filter((a: any) => a.title).map((a: any, i: number) => ({ ...a, orderIndex: i + 1 })),\n examExpand,\n analysis,\n isSetCorrectAnswer,\n leastAnswerCount,\n examRichTextContent: showRichText ? richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n isKey: this.isKey,\n answerCheckType,\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (!answerCheckType) {\n errors.push(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n }\n\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n errors.push(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n }\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length && answers.length > 0) {\n errors.push(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1 && answers.length > 0) {\n errors.push(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n errors.push(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n errors.push(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n }\n }\n\n return errors\n }\n\n private _openResultDialog(idx: number) {\n this._resultDialogIndex = idx\n this._resultDialogValue = this._answers[idx].resultItem || ''\n this._resultDialogOpen = true\n }\n\n private _saveResultDialog() {\n this._answers[this._resultDialogIndex].resultItem = this._resultDialogValue\n this._resultDialogOpen = false\n this.requestUpdate()\n }\n\n private _renderResultDialog() {\n if (!this._resultDialogOpen) { return '' }\n const letter = this._label(this._resultDialogIndex)\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._resultDialogOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">编辑结果项 — 选项 ${letter}</span>\n <button class=\"modal-close\" @click=${() => { this._resultDialogOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n <textarea rows=\"5\" .value=${this._resultDialogValue}\n @input=${(e: Event) => { this._resultDialogValue = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入该选项的结果项内容\"></textarea>\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._resultDialogOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => this._saveResultDialog()}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n private _renderPreview() {\n const typeSuffix = this.type === 'single'\n ? '(单选题)'\n : `(${this._titlePlaceholder}${this.leastAnswerCount ? `至少选${this.leastAnswerCount}项${this.type === 'sort' ? '并排序' : ''}` : ''})`\n const answers = this.answerList as Answer[]\n return html`\n <div class=\"preview\">\n <div><span class=\"title\">${this.orderIndex + 1}.${(this as any).title || ''}${typeSuffix}</span></div>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n <div class=\"preview-answer\">\n ${answers.map((a, i) => html`\n <label class=\"radio\">\n <input type=\"${this.type === 'sort' ? 'checkbox' : 'radio'}\" disabled />\n <span class=\"order\">${this._label(i)}.</span> ${a.title}\n ${this.type !== 'sort' && a.isCorrect ? html`<span class=\"correct\">(支持选项)</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 1 ? html`<span class=\"result-info\">${a.resultItem ? '(已设置结果项)' : '(未设置结果项)'}</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 2 ? html`<span class=\"result-info\">${a.answerRelations?.length ? '(已设置关联)' : '(未设置关联)'}</span>` : ''}\n </label>\n `)}\n </div>\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【${this._titlePlaceholder}】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n ${['multiple', 'sort'].includes(this.type)\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>设置:</span></div>\n <select class=\"el-select\" .value=${String(this._leastAnswerCount)} ?disabled=${this.isSave}\n @change=${(e: Event) => { this._leastAnswerCount = Number((e.target as HTMLSelectElement).value) }}>\n ${Array.from({ length: Math.max(0, this._answers.length - 1) }, (_, i) => i + 2).map(n => html`\n <option value=${n} ?selected=${this._leastAnswerCount === n}>至少选择${n}项</option>\n `)}\n </select>\n </div>\n `\n : ''}\n\n <div class=\"answer-list\">\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${this._label(i)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${a.title} ?disabled=${this.isSave}\n maxlength=${this.ANSWER_MAX}\n @input=${(e: Event) => this._onAnswerInput(e, i)}\n placeholder=\"选项${this._label(i)}\" />\n <span class=\"char-counter\">${a.title.length}/${this.ANSWER_MAX}</span>\n </div>\n\n ${this.type === 'sort' && this._getSortOrder(i) !== null\n ? html`<span class=\"sort-badge\">第${this._getSortOrder(i)}位</span>`\n : ''}\n\n ${['single', 'multiple'].includes(this.type)\n ? html`\n <label class=\"correct ${a.isCorrect ? 'is-correct' : ''}\">\n <input type=\"checkbox\" .checked=${a.isCorrect} ?disabled=${this.isSave}\n @change=${(e: Event) => this._setCorrect(a, (e.target as HTMLInputElement).checked)} />\n 支持选项\n </label>\n `\n : ''}\n\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\"\n @click=${() => this._addAnswer()}>\n ${iconPlus}\n </span>\n <span class=\"icon ${this.isSave || this._answers.length < 3 ? 'disabled' : ''}\"\n @click=${() => this._deleteAnswer(i)}>\n ${iconRemove}\n </span>\n\n ${this.examAnswerRelationType === 1 && this.type !== 'sort'\n ? html`\n <span class=\"link\" @click=${() => this._openResultDialog(i)}>${a.resultItem ? '编辑结果' : '添加结果'}</span>\n `\n : ''}\n ${this.examAnswerRelationType === 2 && this.type !== 'sort'\n ? html`\n <span class=\"link\">关联检查</span>\n `\n : ''}\n </div>\n `)}\n </div>\n\n ${this.type === 'sort'\n ? html`\n <div class=\"flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>排序答案:</span></div>\n <div style=\"flex:1\">\n <div class=\"multi-select-wrapper\">\n <div class=\"multi-select ${this._sortDropdownOpen ? 'focused' : ''} ${this.isSave ? 'disabled' : ''}\"\n @click=${() => { if (!this.isSave) { this._sortDropdownOpen = !this._sortDropdownOpen; this.requestUpdate() } }}>\n ${this._orderList.length > 0\n ? this._orderList.map(l => html`\n <span class=\"tag\">\n ${l}\n <span class=\"tag-close\" @click=${(e: Event) => { e.stopPropagation(); this._removeSortItem(l) }}>✕</span>\n </span>\n `)\n : html`<span class=\"placeholder\">请按顺序选择排序答案</span>`\n }\n <span class=\"arrow\">${iconArrow}</span>\n </div>\n ${this._sortDropdownOpen\n ? html`\n <div class=\"multi-select-dropdown\">\n ${this._answers.map((_, i) => html`\n <div class=\"multi-select-option ${this._orderList.includes(this._label(i)) ? 'selected' : ''}\"\n @click=${() => { this._toggleSortItem(this._label(i)); this.requestUpdate() }}>\n ${this._label(i)}\n </div>\n `)}\n </div>\n `\n : ''}\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?is-key=${this.isKey}\n ?show-other-option=${this.type === 'multiple' || this.type === 'single'}\n answer-check-type=${this._answerCheckType}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @set-answer-setting=${(e: CustomEvent) => { this._answerCheckType = e.detail.value }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n ${this._renderResultDialog()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectError","Error","constructor","message","code","arguments","length","undefined","field","row","super","this","name","from","options","iconPlus","html","iconRemove","iconArrow","QxsSubjectSingle","LitElement","orderIndex","isEdit","isSave","isSet","isKey","showAction","showAnalysis","type","answerCheckType","examAnswerRelationType","richTextContent","analysis","leastAnswerCount","examExpand","customId","examId","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","modelValue","useModel","_answers","title","isCorrect","_title","_analysis","_richText","_showRichText","_leastAnswerCount","_answerCheckType","_orderList","_resultDialogOpen","_resultDialogIndex","_resultDialogValue","_sortDropdownOpen","TITLE_MAX","ANSWER_MAX","_handleDocumentClick","path","composedPath","wrapper","shadowRoot","querySelector","includes","requestUpdate","answerList","v","arr","Array","isArray","map","a","connectedCallback","document","addEventListener","_syncExternalProps","firstUpdated","disconnectedCallback","removeEventListener","willUpdate","changed","has","_syncProps","_syncExamExpand","ids","split","id","answer","find","answerId","toString","String","fromCharCode","filter","Boolean","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_label","i","_titlePlaceholder","_setCorrect","item","val","forEach","_onTitleInput","el","value","slice","_onAnswerInput","idx","_addAnswer","customAnswerId","uid","_deleteAnswer","index","_","_toggleSortItem","letter","indexOf","l","_removeSortItem","_getSortOrder","pos","toJSON","answerType","answers","charCodeAt","join","showRichText","richText","orderList","expand","msg","isSetCorrectAnswer","correctAnswerCount","trim","Set","size","examRichTextContent","validate","errors","push","_openResultDialog","resultItem","_saveResultDialog","_renderResultDialog","stopPropagation","_save","stopImmediatePropagation","data","err","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","_renderPreview","typeSuffix","answerRelations","_renderEdit","Number","Math","max","n","checked","getContent","render","styles","css","__decorateClass","property","attribute","prototype","reflect","state","safeCustomElement"],"mappings":"2lBAcO,MAAMA,UAAqBC,MAChCC,WAAAA,CACEC,GAIA,IAHOC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAe,mBACfG,yCACAC,EAAAJ,UAAAC,OAAA,EAAAD,kBAAAE,EAEPG,MAAMP,GAJCQ,KAAAP,KAAAA,EACAO,KAAAH,MAAAA,EACAG,KAAAF,IAAAA,EAGPE,KAAKC,KAAO,cACd,CAEA,WAAOC,CAAKC,GAC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