@qxs-bns/components-wc 0.0.30 → 0.0.32

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.
Files changed (49) hide show
  1. package/es/editor/blocksuite-editor.mjs +166 -357
  2. package/es/editor/blocksuite-editor.mjs.map +1 -1
  3. package/es/editor/toolbar.mjs +2 -0
  4. package/es/editor/toolbar.mjs.map +1 -0
  5. package/es/subject/action.mjs +7 -8
  6. package/es/subject/action.mjs.map +1 -1
  7. package/es/subject/blank-fill.mjs +243 -132
  8. package/es/subject/blank-fill.mjs.map +1 -1
  9. package/es/subject/layout.mjs +5 -5
  10. package/es/subject/layout.mjs.map +1 -1
  11. package/es/subject/page-end.mjs +1 -1
  12. package/es/subject/page-end.mjs.map +1 -1
  13. package/es/subject/scale.mjs +165 -126
  14. package/es/subject/scale.mjs.map +1 -1
  15. package/es/subject/shared-methods.mjs +2 -0
  16. package/es/subject/shared-methods.mjs.map +1 -0
  17. package/es/subject/shared-styles.mjs +75 -0
  18. package/es/subject/shared-styles.mjs.map +1 -0
  19. package/es/subject/single.mjs +243 -187
  20. package/es/subject/single.mjs.map +1 -1
  21. package/es/subject/sortable.mjs +7 -7
  22. package/es/subject/sortable.mjs.map +1 -1
  23. package/es/subject/text-fill.mjs +273 -138
  24. package/es/subject/text-fill.mjs.map +1 -1
  25. package/lib/editor/blocksuite-editor.cjs +166 -357
  26. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  27. package/lib/editor/toolbar.cjs +2 -0
  28. package/lib/editor/toolbar.cjs.map +1 -0
  29. package/lib/subject/action.cjs +33 -34
  30. package/lib/subject/action.cjs.map +1 -1
  31. package/lib/subject/blank-fill.cjs +247 -136
  32. package/lib/subject/blank-fill.cjs.map +1 -1
  33. package/lib/subject/layout.cjs +3 -3
  34. package/lib/subject/layout.cjs.map +1 -1
  35. package/lib/subject/page-end.cjs +2 -2
  36. package/lib/subject/page-end.cjs.map +1 -1
  37. package/lib/subject/scale.cjs +165 -126
  38. package/lib/subject/scale.cjs.map +1 -1
  39. package/lib/subject/shared-methods.cjs +2 -0
  40. package/lib/subject/shared-methods.cjs.map +1 -0
  41. package/lib/subject/shared-styles.cjs +75 -0
  42. package/lib/subject/shared-styles.cjs.map +1 -0
  43. package/lib/subject/single.cjs +243 -187
  44. package/lib/subject/single.cjs.map +1 -1
  45. package/lib/subject/sortable.cjs +1 -1
  46. package/lib/subject/sortable.cjs.map +1 -1
  47. package/lib/subject/text-fill.cjs +273 -138
  48. package/lib/subject/text-fill.cjs.map +1 -1
  49. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("lit"),t=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("../base/uid.cjs"),r=require("./sorting-card.cjs"),o=require("./title-prefix.cjs"),a=require("./types.cjs"),n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=(e,t,s,i)=>{for(var r,o=i>1?void 0:i?l(t,s):t,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&n(t,s,o),o};class p 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 p(e.message,e.code,e.field,e.row)}}const h=e.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>`,d=e.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>`,u=e.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>`;function x(e){return e.replace(/^\d+\.\s*/,"").replace(/[\s,,。.!!??;;::、'"“”‘’()()[\]【】\-_/\\]+/g,"").toLowerCase()}function g(e){return String(e??"").trim()}function m(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.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(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}exports.QxsSubjectSingle=class extends e.LitElement{constructor(){super(...arguments),this["order-index"]=0,this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-set-correct-answer"]=!1,this.lockAnswerKey=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["hide-add-rich-text"]=!1,this["show-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this.sorting=!1,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-analysis"]=!1,this.type="single",this["answer-check-type"]=1,this["exam-answer-relation-type"]=0,this["rich-text-content"]="",this.analysis="",this["least-answer-count"]=null,this["exam-expand"]="",this["custom-id"]="",this["exam-id"]=0,this["category-id"]="",this["upload-image"]=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this["tag-list"]=[],this["category-list"]=[],this["ai-answer"]="",this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-ai"]=!1,this["show-resource"]=!1,this["show-jump"]=!1,this["has-jump"]=!1,this["search-api"]="",this["model-value"]="",this["use-model"]=!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=null,this._answerCheckType=1,this._isKey=!1,this._orderList=[],this._selectedTagList=[],this._categoryId="",this._searchResults=[],this._searchOpen=!1,this._searchLoading=!1,this._sortDropdownOpen=!1,this._imageViewerOpen=!1,this._imageViewerIndex=0,this._videoViewerOpen=!1,this._correctHintDialogOpen=!1,this._hasShownCorrectHint=!1,this._changeTypeDialogOpen=!1,this._searchTimer=null,this._searchToken=0,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper"),i=this.shadowRoot?.querySelector(".search-wrap");s&&!t.includes(s)&&(this._sortDropdownOpen=!1),i&&!t.includes(i)&&(this._searchOpen=!1),this.requestUpdate()}}get"answer-list"(){return this._answers}set"answer-list"(e){if(this["is-edit"])return;const t=Array.isArray(e)?e:[];this._answers=t.length?t.map(e=>this._normalizeAnswerItem(e)):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answer-list")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this._syncExternalProps()}firstUpdated(){this._syncExternalProps()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null)}willUpdate(e){e.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(e.has("title")||e.has("answer-list")||e.has("analysis")||e.has("least-answer-count")||e.has("answer-check-type")||e.has("tag-list")||e.has("category-id")||e.has("rich-text-content"))&&this._syncExternalProps(),e.has("is-key")&&(this._isKey=this["is-key"]),e.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[]),e.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):""),(e.has("exam-expand")||e.has("answer-list"))&&this._syncExamExpand(),e.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_supportsLeastAnswerCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;return"multiple"===e||"sort"===e}_normalizeLeastAnswerCount(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;if(!this._supportsLeastAnswerCount(t)||""===e||null==e)return null;const s=Number(e);return Number.isFinite(s)&&s>0?s:null}_leastAnswerCountSuffix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return this._supportsLeastAnswerCount(t)&&null!==e?`,至少选${e}项${"sort"===t?"并排序":""}`:""}_normalizeAnswerItem(e){const t={...e,title:g(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect},s=e?.answerId??e?.examAnswerId;return void 0!==s&&(t.answerId=s),t}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e)))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e))),this._syncExamExpand()}_syncExamExpand(){if(!this["exam-expand"]||!this["answer-list"]?.length)return;const e=this["exam-expand"].split(","),t=this["answer-list"];this._orderList=e.map(e=>{const s=t.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return s>=0?this._label(s):""}).filter(Boolean)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_searchAnswerType(){return"single"===this.type?0:"multiple"===this.type?1:5}_queueSearch(e){this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null);const t=e.trim();if(!t||!this["search-api"]&&"function"!=typeof this["search-handler"])return this._searchResults=[],this._searchOpen=!1,void(this._searchLoading=!1);this._searchTimer=window.setTimeout(()=>{this._runSearch(t)},300)}async _runSearch(e){const t=++this._searchToken;this._searchLoading=!0,this._searchOpen=!0,this.requestUpdate();try{let s=[];if("function"==typeof this["search-handler"])s=await this["search-handler"](e,this._searchAnswerType());else if(this["search-api"]){const t=new URLSearchParams({searchKey:e,answerType:String(this._searchAnswerType())}),i=await fetch(`${this["search-api"]}${this["search-api"].includes("?")?"&":"?"}${t.toString()}`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const r=await i.json();s=(Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[]).map(e=>({...e,value:e?.value||e?.title||""}))}if(t!==this._searchToken)return;this._searchResults=Array.isArray(s)?s:[]}catch(e){if(t!==this._searchToken)return;this._searchResults=[],m(e?.message||"题库搜索失败")}finally{t===this._searchToken&&(this._searchLoading=!1,this.requestUpdate())}}_selectSearchResult(e){const t=e.value||e.title||"";this._title=t,this._searchResults=[],this._searchOpen=!1,this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title})),this._emit("title-select",{...e,id:e.id??e.examId??e.questionId,title:e.title||t,value:t,customId:this["custom-id"]||""})}_applyAiAnswer(){if(!this["ai-answer"]?.trim())return void m("暂无 AI 推荐答案");const e=this["ai-answer"].split(/\r?\n/).map(e=>x(e)).filter(Boolean);let t=0;if("single"===this.type){let s=!1;this._answers=this._answers.map(i=>{const r=!s&&e.includes(x(i.title||""));return r&&(s=!0,t++),{...i,isCorrect:r}})}else this._answers=this._answers.map(s=>{const i=e.includes(x(s.title||""));return i&&t++,{...s,isCorrect:i}});t?this.requestUpdate():m("未找到匹配的选项,请检查选项内容是否一致")}_onCategoryChange(e){this._categoryId=e,this._emit("category-change",{value:e,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_setRelation(e,t){const s=e.customAnswerId?{...e}:{...e,customAnswerId:e.answerId||i.uid()};this._answers=this._answers.map((e,i)=>i===t?s:e),this.requestUpdate(),this._emit("set-relation",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:s})}_relationLength(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,t)=>e+(Array.isArray(t?.relationAnswers)?t.relationAnswers.length:0),0)}_emitEditResultItem(e,t){this._emit("edit-result-item",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:{...e},resultItem:e.resultItem||""})}_resultSlotName(e){return`business-result-item-${e}`}_imageResources(){return(this["resource-list"]||[]).filter(e=>1===e.resourceType).map(e=>e.resource.middle||e.resource.url).filter(Boolean)}_videoResource(){return(this["resource-list"]||[]).find(e=>2===e.resourceType)?.resource||null}_openImageViewer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._imageResources().length&&(this._imageViewerIndex=e,this._imageViewerOpen=!0)}_closeImageViewer(){this._imageViewerOpen=!1}_moveImage(e){const t=this._imageResources();t.length&&(this._imageViewerIndex=(this._imageViewerIndex+e+t.length)%t.length)}_openVideoViewer(){this._videoResource()?.url&&(this._videoViewerOpen=!0)}_closeVideoViewer(){this._videoViewerOpen=!1}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){this.lockAnswerKey||(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._queueSearch(this._title),this["use-model"]&&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(e){const t=[...this._answers];t.splice(e+1,0,{title:"",isCorrect:!1,customAnswerId:i.uid()}),this._answers=t}_deleteAnswer(e){this._answers.length<3||(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}_sortAnswerValue(e){const t=e.charCodeAt(0)-65,s=this._answers[t];return s?.answerId??t+1}_rowMeta(){return{customId:this["custom-id"]||void 0,answerType:this.type,orderIndex:this["order-index"]}}_collectSnapshot(){const e=(this["is-edit"]?this._answers:this["answer-list"]||[]).map(e=>({...e,title:g(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect,resultItem:g(e?.resultItem??"")})),t=this["is-edit"]?[...this._orderList]:(()=>{const e=this["exam-expand"];return e?e.split(",").map(e=>{const t=this["answer-list"]?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();return{title:g(this["is-edit"]?this._title:this.title||""),answers:e,analysis:g(this["is-edit"]?this._analysis:this.analysis||""),leastAnswerCount:this["is-edit"]?this._leastAnswerCount:this._normalizeLeastAnswerCount(this["least-answer-count"]),selectedTagList:Array.isArray(this._selectedTagList)?[...this._selectedTagList]:[],examExpand:this["is-edit"]?t.map(e=>this._sortAnswerValue(e)).join(","):this["exam-expand"]||"",showRichText:this["is-edit"]?this._showRichText:!!this["rich-text-content"],richText:this["is-edit"]?this._richText:this["rich-text-content"]||"",orderList:t}}_validateSnapshot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;const s=this._rowMeta(),i=[];e.title||i.push(new p("题目标题不能为空!","EMPTY_TITLE","title",s));let r=!1,o=0;e.answers.forEach((e,a)=>{e.title?.trim()||i.push(new p(`选项${String.fromCharCode(65+a)}未填写`,"ANSWER_EMPTY","answers",s)),"sort"!==t&&e.isCorrect&&(r=!0,o++)});return new Set(e.answers.map(e=>e.title)).size!==e.answers.length&&e.answers.length>0&&i.push(new p("选项不能重复","DUPLICATE_ANSWERS","answers",s)),"single"===t&&o>1&&i.push(new p("此题为单选题,设置了多个推荐/正确选项,请保存时确认是否切换为多选题","SINGLE_MULTI_CORRECT","answers",s)),"multiple"===t&&(1===o&&i.push(new p("请设置至少两个推荐/正确选项","CORRECT_COUNT_INVALID","answers",s)),o>0&&(r=!0),r&&null!==e.leastAnswerCount&&o<e.leastAnswerCount&&i.push(new p("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))),"sort"===t&&(r=e.orderList.length>0,null!==e.leastAnswerCount&&e.orderList.length<e.leastAnswerCount&&i.push(new p("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","orderList",s))),{errors:i,isSetCorrectAnswer:r,correctAnswerCount:o}}_serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;const t=this._collectSnapshot(),{errors:s,isSetCorrectAnswer:i}=this._validateSnapshot(t,e);if(s.length)throw s[0];const r={answerType:String(e),examTypeEnum:String(e),title:t.title,answers:t.answers.map((e,t)=>{const s=e.resultItem?1:Array.isArray(e.answerRelations)&&e.answerRelations.length?2:null,i={...e,orderIndex:t+1,answer:e.title,relationType:s};return void 0!==e.answerId&&(i.examAnswerId=e.answerId),null===s&&delete i.relationType,i}),examExpand:t.examExpand,analysis:t.analysis,isSetCorrectAnswer:i,examRichTextContent:t.showRichText?t.richText:""};return this["exam-answer-relation-type"]&&(r.examAnswerRelationType=this["exam-answer-relation-type"]),this._supportsLeastAnswerCount(e)&&(r.leastAnswerCount=t.leastAnswerCount),this["custom-id"]&&(r.customId=this["custom-id"]),r}_shouldShowCorrectHint(){return"sort"===this.type?!this._orderList.length:!this._answers.some(e=>!!e.isCorrect)}async _finalizeSave(){try{const e=await this.toJSON();this._emit("save",e)}catch(e){m(e.message)}}async toJSON(){return Promise.resolve(this._serialize())}validate(){return this._validateSnapshot(this._collectSnapshot()).errors}setResultItem(e,t){e<0||e>=this._answers.length||(this._answers=this._answers.map((s,i)=>i===e?{...s,resultItem:t||""}:s),this.requestUpdate())}setAnswerRelation(e,t){e&&(this._answers=this._answers.map(s=>String(s.customAnswerId??s.answerId??"")===String(e)?{...s,answerRelations:t}:s),this.requestUpdate())}_renderCorrectHintDialog(){return this._correctHintDialogOpen?e.html`
1
+ "use strict";var e=require("lit"),t=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("../base/uid.cjs"),r=require("../editor/toolbar.cjs"),o=require("./shared-methods.cjs"),a=require("./shared-styles.cjs"),n=require("./sorting-card.cjs"),l=require("./types.cjs"),c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,p=(e,t,s,i)=>{for(var r,o=i>1?void 0:i?h(t,s):t,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&c(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 u=e.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>`,x=e.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>`,g=e.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>`;function w(e){return e.replace(/^\d+\.\s*/,"").replace(/[\s,,。.!!??;;::、'"“”‘’()()[\]【】\-_/\\]+/g,"").toLowerCase()}function m(e){return String(e??"").trim()}exports.QxsSubjectSingle=class extends e.LitElement{constructor(){super(...arguments),this["order-index"]=0,this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-set-correct-answer"]=!1,this.lockAnswerKey=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["hide-add-rich-text"]=!1,this["show-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this.sorting=!1,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-analysis"]=!1,this.type="single",this["answer-check-type"]=1,this["exam-answer-relation-type"]=0,this["rich-text-content"]="",this.analysis="",this["least-answer-count"]=null,this["exam-expand"]="",this["custom-id"]="",this["exam-id"]=0,this["category-id"]="",this["upload-image"]=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this["tag-list"]=[],this["category-list"]=[],this["ai-answer"]="",this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-ai"]=!1,this["show-resource"]=!1,this["show-jump"]=!1,this["has-jump"]=!1,this["search-api"]="",this["model-value"]="",this["use-model"]=!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=null,this._answerCheckType=1,this._isKey=!1,this._orderList=[],this._selectedTagList=[],this._categoryId="",this._searchResults=[],this._searchOpen=!1,this._searchLoading=!1,this._sortDropdownOpen=!1,this._imageViewerOpen=!1,this._imageViewerIndex=0,this._videoViewerOpen=!1,this._correctHintDialogOpen=!1,this._hasShownCorrectHint=!1,this._changeTypeDialogOpen=!1,this._searchTimer=null,this._searchToken=0,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper"),i=this.shadowRoot?.querySelector(".search-wrap");s&&!t.includes(s)&&(this._sortDropdownOpen=!1),i&&!t.includes(i)&&(this._searchOpen=!1),this.requestUpdate()}}get"answer-list"(){return this._answers}set"answer-list"(e){if(this["is-edit"])return;const t=Array.isArray(e)?e:[];this._answers=t.length?t.map(e=>this._normalizeAnswerItem(e)):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answer-list")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this._syncExternalProps()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null)}willUpdate(e){e.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(e.has("title")||e.has("answer-list")||e.has("analysis")||e.has("least-answer-count")||e.has("answer-check-type")||e.has("tag-list")||e.has("category-id")||e.has("rich-text-content"))&&this._syncExternalProps(),e.has("is-key")&&(this._isKey=this["is-key"]),e.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[]),e.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):""),(e.has("exam-expand")||e.has("answer-list"))&&this._syncExamExpand(),e.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_supportsLeastAnswerCount(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;return"multiple"===e||"sort"===e}_normalizeLeastAnswerCount(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;if(!this._supportsLeastAnswerCount(t)||""===e||null==e)return null;const s=Number(e);return Number.isFinite(s)&&s>0?s:null}_leastAnswerCountSuffix(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return this._supportsLeastAnswerCount(t)&&null!==e?`,至少选${e}项${"sort"===t?"并排序":""}`:""}_normalizeAnswerItem(e){const t={...e,title:m(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect},s=e?.answerId??e?.examAnswerId;return void 0!==s&&(t.answerId=s),t}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e)))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=this._normalizeLeastAnswerCount(this["least-answer-count"]),this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>this._normalizeAnswerItem(e))),this._syncExamExpand()}_syncExamExpand(){if(!this["exam-expand"]||!this["answer-list"]?.length)return;const e=this["exam-expand"].split(","),t=this["answer-list"];this._orderList=e.map(e=>{const s=t.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return s>=0?this._label(s):""}).filter(Boolean)}_emit(e,t){o.emitSubjectEvent(this,e,t)}_searchAnswerType(){return"single"===this.type?0:"multiple"===this.type?1:5}_queueSearch(e){this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null);const t=e.trim();if(!t||!this["search-api"]&&"function"!=typeof this["search-handler"])return this._searchResults=[],this._searchOpen=!1,void(this._searchLoading=!1);this._searchTimer=window.setTimeout(()=>{this._runSearch(t)},300)}async _runSearch(e){const t=++this._searchToken;this._searchLoading=!0,this._searchOpen=!0,this.requestUpdate();try{let s=[];if("function"==typeof this["search-handler"])s=await this["search-handler"](e,this._searchAnswerType());else if(this["search-api"]){const t=new URLSearchParams({searchKey:e,answerType:String(this._searchAnswerType())}),i=await fetch(`${this["search-api"]}${this["search-api"].includes("?")?"&":"?"}${t.toString()}`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const r=await i.json();s=(Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[]).map(e=>({...e,value:e?.value||e?.title||""}))}if(t!==this._searchToken)return;this._searchResults=Array.isArray(s)?s:[]}catch(e){if(t!==this._searchToken)return;this._searchResults=[],o.showSubjectToast(e?.message||"题库搜索失败")}finally{t===this._searchToken&&(this._searchLoading=!1,this.requestUpdate())}}_selectSearchResult(e){const t=e.value||e.title||"";this._title=t,this._searchResults=[],this._searchOpen=!1,this["use-model"]&&o.emitSubjectModelValue(this,this._title),this._emit("title-select",{...e,id:e.id??e.examId??e.questionId,title:e.title||t,value:t,customId:this["custom-id"]||""})}_applyAiAnswer(){if(!this["ai-answer"]?.trim())return void o.showSubjectToast("暂无 AI 推荐答案");const e=this["ai-answer"].split(/\r?\n/).map(e=>w(e)).filter(Boolean);let t=0;if("single"===this.type){let s=!1;this._answers=this._answers.map(i=>{const r=!s&&e.includes(w(i.title||""));return r&&(s=!0,t++),{...i,isCorrect:r}})}else this._answers=this._answers.map(s=>{const i=e.includes(w(s.title||""));return i&&t++,{...s,isCorrect:i}});t?this.requestUpdate():o.showSubjectToast("未找到匹配的选项,请检查选项内容是否一致")}_onCategoryChange(e){this._categoryId=e,this._emit("category-change",{value:e,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_setRelation(e,t){const s=e.customAnswerId?{...e}:{...e,customAnswerId:e.answerId||i.uid()};this._answers=this._answers.map((e,i)=>i===t?s:e),this.requestUpdate(),this._emit("set-relation",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:s})}_relationLength(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,t)=>e+(Array.isArray(t?.relationAnswers)?t.relationAnswers.length:0),0)}_emitEditResultItem(e,t){this._emit("edit-result-item",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:{...e},resultItem:e.resultItem||""})}_resultSlotName(e){return`business-result-item-${e}`}_imageResources(){return o.getSubjectImageResources(this["resource-list"]||[])}_videoResource(){return o.getSubjectVideoResource(this["resource-list"]||[])}_openImageViewer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._imageResources().length&&(this._imageViewerIndex=e,this._imageViewerOpen=!0)}_closeImageViewer(){this._imageViewerOpen=!1}_moveImage(e){const t=this._imageResources();t.length&&(this._imageViewerIndex=(this._imageViewerIndex+e+t.length)%t.length)}_openVideoViewer(){this._videoResource()?.url&&(this._videoViewerOpen=!0)}_closeVideoViewer(){this._videoViewerOpen=!1}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){this.lockAnswerKey||(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._queueSearch(this._title),this["use-model"]&&o.emitSubjectModelValue(this,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(e){const t=[...this._answers];t.splice(e+1,0,{title:"",isCorrect:!1,customAnswerId:i.uid()}),this._answers=t}_deleteAnswer(e){this._answers.length<3||(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}_sortAnswerValue(e){const t=e.charCodeAt(0)-65,s=this._answers[t];return s?.answerId??t+1}_rowMeta(){return{customId:this["custom-id"]||void 0,answerType:this.type,orderIndex:this["order-index"]}}_collectSnapshot(){const e=(this["is-edit"]?this._answers:this["answer-list"]||[]).map(e=>({...e,title:m(e?.title??e?.answer??""),isCorrect:!!e?.isCorrect,resultItem:m(e?.resultItem??"")})),t=this["is-edit"]?[...this._orderList]:(()=>{const e=this["exam-expand"];return e?e.split(",").map(e=>{const t=this["answer-list"]?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();return{title:m(this["is-edit"]?this._title:this.title||""),answers:e,analysis:m(this["is-edit"]?this._analysis:this.analysis||""),leastAnswerCount:this["is-edit"]?this._leastAnswerCount:this._normalizeLeastAnswerCount(this["least-answer-count"]),selectedTagList:Array.isArray(this._selectedTagList)?[...this._selectedTagList]:[],examExpand:this["is-edit"]?t.map(e=>this._sortAnswerValue(e)).join(","):this["exam-expand"]||"",showRichText:this["is-edit"]?this._showRichText:!!this["rich-text-content"],richText:this["is-edit"]?this._richText:this["rich-text-content"]||"",orderList:t}}_validateSnapshot(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;const s=this._rowMeta(),i=[];e.title||i.push(new d("题目标题不能为空!","EMPTY_TITLE","title",s));let r=!1,o=0;e.answers.forEach((e,a)=>{e.title?.trim()||i.push(new d(`选项${String.fromCharCode(65+a)}未填写`,"ANSWER_EMPTY","answers",s)),"sort"!==t&&e.isCorrect&&(r=!0,o++)});return new Set(e.answers.map(e=>e.title)).size!==e.answers.length&&e.answers.length>0&&i.push(new d("选项不能重复","DUPLICATE_ANSWERS","answers",s)),"single"===t&&o>1&&i.push(new d("此题为单选题,设置了多个推荐/正确选项,请保存时确认是否切换为多选题","SINGLE_MULTI_CORRECT","answers",s)),"multiple"===t&&(1===o&&i.push(new d("请设置至少两个推荐/正确选项","CORRECT_COUNT_INVALID","answers",s)),o>0&&(r=!0),r&&null!==e.leastAnswerCount&&o<e.leastAnswerCount&&i.push(new d("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))),"sort"===t&&(r=e.orderList.length>0,null!==e.leastAnswerCount&&e.orderList.length<e.leastAnswerCount&&i.push(new d("至少选几项与推荐/正确选项数不符","LEAST_ANSWER_COUNT_INVALID","orderList",s))),{errors:i,isSetCorrectAnswer:r,correctAnswerCount:o}}_serialize(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.type;const t=this._collectSnapshot(),{errors:s,isSetCorrectAnswer:i}=this._validateSnapshot(t,e);if(s.length)throw s[0];const r={answerType:String(e),examTypeEnum:String(e),title:t.title,answers:t.answers.map((e,t)=>{const s=e.resultItem?1:Array.isArray(e.answerRelations)&&e.answerRelations.length?2:null,i={...e,orderIndex:t+1,answer:e.title,relationType:s};return void 0!==e.answerId&&(i.examAnswerId=e.answerId),null===s&&delete i.relationType,i}),examExpand:t.examExpand,analysis:t.analysis,isSetCorrectAnswer:i,examRichTextContent:t.showRichText?t.richText:""};return this["exam-answer-relation-type"]&&(r.examAnswerRelationType=this["exam-answer-relation-type"]),this._supportsLeastAnswerCount(e)&&(r.leastAnswerCount=t.leastAnswerCount),this["custom-id"]&&(r.customId=this["custom-id"]),r}_shouldShowCorrectHint(){return"sort"===this.type?!this._orderList.length:!this._answers.some(e=>!!e.isCorrect)}async _finalizeSave(){try{const e=await this.toJSON();this._emit("save",e)}catch(e){o.showSubjectToast(e.message)}}async toJSON(){return Promise.resolve(this._serialize())}validate(){return this._validateSnapshot(this._collectSnapshot()).errors}setResultItem(e,t){e<0||e>=this._answers.length||(this._answers=this._answers.map((s,i)=>i===e?{...s,resultItem:t||""}:s),this.requestUpdate())}setAnswerRelation(e,t){e&&(this._answers=this._answers.map(s=>String(s.customAnswerId??s.answerId??"")===String(e)?{...s,answerRelations:t}:s),this.requestUpdate())}_renderCorrectHintDialog(){return this._correctHintDialogOpen?e.html`
2
2
  <div class="modal-backdrop" @click=${()=>{this._correctHintDialogOpen=!1}}>
3
3
  <div class="modal correct-hint-dialog" @click=${e=>e.stopPropagation()}>
4
4
  <div class="modal-header">
@@ -27,7 +27,7 @@
27
27
  </div>
28
28
  <div class="modal-footer">
29
29
  <button @click=${()=>{this._changeTypeDialogOpen=!1}}>取消</button>
30
- <button class="primary" @click=${()=>{try{const e=this._serialize("multiple");this._changeTypeDialogOpen=!1,this._emit("save",e)}catch(e){m(e?.message||"保存失败")}}}>切换</button>
30
+ <button class="primary" @click=${()=>{try{const e=this._serialize("multiple");this._changeTypeDialogOpen=!1,this._emit("save",e)}catch(e){o.showSubjectToast(e?.message||"保存失败")}}}>切换</button>
31
31
  </div>
32
32
  </div>
33
33
  </div>
@@ -49,7 +49,7 @@
49
49
  <option value=${String(t.categoryId)} ?selected=${String(t.categoryId)===String(this._categoryId)}>${t.title}</option>
50
50
  `)}
51
51
  </select>
52
- `:e.html`<span class="value-text">${this["category-list"].find(e=>String(e.categoryId)===String(this._categoryId))?.title||"未选择分类"}</span>`}
52
+ `:e.html`<span class="value-text">${o.resolveSubjectCategoryLabel(this["category-list"],this._categoryId)}</span>`}
53
53
  </div>
54
54
  </div>
55
55
  `:""}_renderAiSection(){return this["show-ai"]&&["single","multiple"].includes(this.type)?e.html`
@@ -120,166 +120,188 @@
120
120
  </div>
121
121
  </div>
122
122
  </div>
123
- `:""}async _save(e){e?.stopImmediatePropagation();const t=this.validate(),s=t.find(e=>"SINGLE_MULTI_CORRECT"===e.code),i=t.filter(e=>"SINGLE_MULTI_CORRECT"!==e.code);i.length?m(i[0].message):s?this._changeTypeDialogOpen=!0:this._hasShownCorrectHint||!this._shouldShowCorrectHint()?await this._finalizeSave():this._correctHintDialogOpen=!0}_renderPreview(){const t="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this._leastAnswerCountSuffix(this._normalizeLeastAnswerCount(this["least-answer-count"]))})`,s=this["answer-list"],i=o.joinSubjectTitle(o.resolveSubjectPrefix(this["subject-prefix"],`${this["order-index"]+1}.`),this.title||"");return e.html`
123
+ `:""}async _save(e){e?.stopImmediatePropagation();const t=this.validate(),s=t.find(e=>"SINGLE_MULTI_CORRECT"===e.code),i=t.filter(e=>"SINGLE_MULTI_CORRECT"!==e.code);i.length?o.showSubjectToast(i[0].message):s?this._changeTypeDialogOpen=!0:this._hasShownCorrectHint||!this._shouldShowCorrectHint()?await this._finalizeSave():this._correctHintDialogOpen=!0}_renderPreview(){const t="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this._leastAnswerCountSuffix(this._normalizeLeastAnswerCount(this["least-answer-count"]))})`,s=this["answer-list"],i=o.buildSubjectPreviewTitle(this["subject-prefix"],this["order-index"],this.title||"");return e.html`
124
124
  <div class="preview">
125
- <div><span class="title">${i}${t}</span></div>
126
- ${this["show-rich-text"]&&this["rich-text-content"]?e.html`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
125
+ <div class="preview-header">
126
+ <div class="preview-title-row">
127
+ <span class="title">${i}</span>
128
+ <span class="preview-type">${t.replace(/[()]/g,"")}</span>
129
+ </div>
130
+ ${this["show-rich-text"]&&this["rich-text-content"]?e.html`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
131
+ </div>
127
132
  <div class="preview-answer">
128
133
  ${s.map((t,s)=>e.html`
129
- <label class="radio">
134
+ <div class="radio">
130
135
  <input type="${"sort"===this.type?"checkbox":"radio"}" .checked=${!!t.isCorrect} disabled />
131
- <span class="order">${this._label(s)}.</span> ${t.title}
132
- ${"sort"!==this.type&&t.isCorrect?e.html`<span class="correct">(推荐/正确选项)</span>`:""}
133
- ${1===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`<span class="correct">(${t.resultItem?"已设置结果项":"未设置结果项"})</span>`:""}
134
- ${2===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`<span class="correct">(${Array.isArray(t.answerRelations)&&t.answerRelations.length?`关联了${this._relationLength(t.answerRelations)}项`:"未设置关联"})</span>`:""}
135
- </label>
136
+ <span class="order">${this._label(s)}.</span>
137
+ <div class="answer-main">
138
+ <span class="answer-text">${t.title}</span>
139
+ ${"sort"!==this.type&&t.isCorrect?e.html`<span class="correct">推荐 / 正确选项</span>`:""}
140
+ </div>
141
+ ${"sort"===this.type||1!==this["exam-answer-relation-type"]&&2!==this["exam-answer-relation-type"]?"":e.html`
142
+ <div class="answer-meta">
143
+ ${1===this["exam-answer-relation-type"]?e.html`<span class="result-info">${t.resultItem?"已设置结果项":"未设置结果项"}</span>`:""}
144
+ ${2===this["exam-answer-relation-type"]?e.html`<span class="result-info">${Array.isArray(t.answerRelations)&&t.answerRelations.length?`关联了${this._relationLength(t.answerRelations)}项`:"未设置关联"}</span>`:""}
145
+ </div>
146
+ `}
147
+ </div>
136
148
  `)}
137
149
  </div>
138
- ${this["show-category"]&&this._categoryId?e.html`<div class="section-row"><span class="value-text">分类:${this["category-list"].find(e=>String(e.categoryId)===String(this._categoryId))?.title||this._categoryId}</span></div>`:""}
150
+ ${this["show-category"]&&this._categoryId?e.html`<div class="section-row"><span class="value-text">分类:${o.resolveSubjectCategoryLabel(this["category-list"],this._categoryId)}</span></div>`:""}
139
151
  ${this["show-resource"]?this._renderResourceSection():""}
140
152
  </div>
141
- `}_renderSorting(){const e=g(this["is-edit"]?this._title:this.title||"")||"未命名题目",t=o.joinSubjectTitle(o.resolveSubjectPrefix(this["subject-prefix"],`${this["order-index"]+1}. `),e);return r.renderSortingCard(t,a.SubjectTypeLabel[this.type]||this.type)}_renderEdit(){return e.html`
142
- <div class="flex-items-start">
143
- <div class="label"><span>题目:</span></div>
144
- <div style="flex:1">
145
- <div class="el-input search-wrap">
146
- <textarea rows="2" .value=${this._title}
147
- maxlength=${this.TITLE_MAX}
148
- @input=${e=>this._onTitleInput(e)}
149
- placeholder="【${this._titlePlaceholder}】请输入问题"></textarea>
150
- <span class="char-counter">${this._title.length}/${this.TITLE_MAX}</span>
151
- ${this._renderSearchDropdown()}
153
+ `}_renderSorting(){const e=m(this["is-edit"]?this._title:this.title||"")||"未命名题目",t=o.buildSubjectSortingTitle(this["subject-prefix"],this["order-index"],e);return n.renderSortingCard(t,l.SubjectTypeLabel[this.type]||this.type)}_renderEdit(){return e.html`
154
+ <div class="edit-form">
155
+ <div class="edit-row">
156
+ <div class="label"><span>题目:</span></div>
157
+ <div class="row-body">
158
+ <div class="el-input search-wrap">
159
+ <textarea rows="2" .value=${this._title}
160
+ maxlength=${this.TITLE_MAX}
161
+ @input=${e=>this._onTitleInput(e)}
162
+ placeholder="【${this._titlePlaceholder}】请输入问题"></textarea>
163
+ <span class="char-counter">${this._title.length}/${this.TITLE_MAX}</span>
164
+ ${this._renderSearchDropdown()}
165
+ </div>
152
166
  </div>
153
167
  </div>
154
- </div>
155
168
 
156
- ${["multiple","sort"].includes(this.type)?e.html`
157
- <div class="flex-items-start" style="margin-top:12px">
158
- <div class="label"><span>设置:</span></div>
159
- <select class="el-select" .value=${null===this._leastAnswerCount?"":String(this._leastAnswerCount)} ?disabled=${this.lockAnswerKey}
160
- @change=${e=>{const t=e.target.value;this._leastAnswerCount=this._normalizeLeastAnswerCount(t)}}>
161
- <option value="">至少选择几项</option>
162
- ${Array.from({length:Math.max(0,this._answers.length-1)},(e,t)=>t+2).map(t=>e.html`
163
- <option value=${t} ?selected=${this._leastAnswerCount===t}>至少选择${t}项</option>
164
- `)}
165
- </select>
166
- </div>
167
- `:""}
168
-
169
- <div class="answer-list">
170
- ${this._answers.map((t,s)=>e.html`
171
- <div class="answer-item">
172
- <span class="label">${this._label(s)}.</span>
173
- <div class="input">
174
- <input type="text" .value=${t.title}
175
- maxlength=${this.ANSWER_MAX}
176
- @input=${e=>this._onAnswerInput(e,s)}
177
- placeholder="选项${this._label(s)}" />
178
- <span class="char-counter">${t.title.length}/${this.ANSWER_MAX}</span>
169
+ ${["multiple","sort"].includes(this.type)?e.html`
170
+ <div class="edit-row section-row">
171
+ <div class="label"><span>设置:</span></div>
172
+ <div class="row-body">
173
+ <select class="el-select" .value=${null===this._leastAnswerCount?"":String(this._leastAnswerCount)} ?disabled=${this.lockAnswerKey}
174
+ @change=${e=>{const t=e.target.value;this._leastAnswerCount=this._normalizeLeastAnswerCount(t)}}>
175
+ <option value="">至少选择几项</option>
176
+ ${Array.from({length:Math.max(0,this._answers.length-1)},(e,t)=>t+2).map(t=>e.html`
177
+ <option value=${t} ?selected=${this._leastAnswerCount===t}>至少选择${t}项</option>
178
+ `)}
179
+ </select>
179
180
  </div>
181
+ </div>
182
+ `:""}
180
183
 
181
- ${"sort"===this.type&&null!==this._getSortOrder(s)?e.html`<span class="sort-badge">第${this._getSortOrder(s)}位</span>`:""}
182
-
183
- ${["single","multiple"].includes(this.type)?e.html`
184
- <label class="correct ${t.isCorrect?"is-correct":""}">
185
- <input type="checkbox" .checked=${t.isCorrect} ?disabled=${this.lockAnswerKey}
186
- @change=${e=>this._setCorrect(t,e.target.checked)} />
187
- 推荐/正确选项
188
- </label>
189
- `:""}
190
-
191
- <span class="icon"
192
- @click=${()=>this._addAnswer(s)}>
193
- ${h}
194
- </span>
195
- <span class="icon ${this._answers.length<3?"disabled":""}"
196
- @click=${()=>this._deleteAnswer(s)}>
197
- ${d}
198
- </span>
199
-
200
- ${1===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`
201
- <slot name=${this._resultSlotName(s)}>
202
- <button class="el-link" @click=${()=>this._emitEditResultItem(t,s)}>
203
- ${t.resultItem?"编辑结果":"添加结果"}
204
- </button>
205
- </slot>
206
- `:""}
184
+ <div class="edit-row section-row edit-row--compact">
185
+ <div class="label"><span>${"sort"===this.type?"排序项:":"选项:"}</span></div>
186
+ <div class="row-body">
187
+ <div class="answer-list">
188
+ ${this._answers.map((t,s)=>e.html`
189
+ <div class="answer-item">
190
+ <span class="label">${this._label(s)}.</span>
191
+ <div class="input">
192
+ <input type="text" .value=${t.title}
193
+ maxlength=${this.ANSWER_MAX}
194
+ @input=${e=>this._onAnswerInput(e,s)}
195
+ placeholder="选项${this._label(s)}" />
196
+ <span class="char-counter">${t.title.length}/${this.ANSWER_MAX}</span>
197
+ </div>
207
198
 
208
- ${2===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`
209
- <button class="el-link" @click=${()=>this._setRelation(t,s)}>
210
- ${Array.isArray(t.answerRelations)&&t.answerRelations.length?`关联了${this._relationLength(t.answerRelations)}项`:"关联检查"}
211
- </button>
212
- `:""}
199
+ ${"sort"===this.type&&null!==this._getSortOrder(s)?e.html`<span class="sort-badge">第${this._getSortOrder(s)}位</span>`:""}
213
200
 
214
- </div>
215
- `)}
216
- </div>
201
+ ${["single","multiple"].includes(this.type)?e.html`
202
+ <label class="correct ${t.isCorrect?"is-correct":""}">
203
+ <input type="checkbox" .checked=${t.isCorrect} ?disabled=${this.lockAnswerKey}
204
+ @change=${e=>this._setCorrect(t,e.target.checked)} />
205
+ 推荐/正确选项
206
+ </label>
207
+ `:""}
208
+
209
+ <span class="icon"
210
+ @click=${()=>this._addAnswer(s)}>
211
+ ${u}
212
+ </span>
213
+ <span class="icon ${this._answers.length<3?"disabled":""}"
214
+ @click=${()=>this._deleteAnswer(s)}>
215
+ ${x}
216
+ </span>
217
+
218
+ ${1===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`
219
+ <slot name=${this._resultSlotName(s)}>
220
+ <button class="el-link" @click=${()=>this._emitEditResultItem(t,s)}>
221
+ ${t.resultItem?"编辑结果":"添加结果"}
222
+ </button>
223
+ </slot>
224
+ `:""}
225
+
226
+ ${2===this["exam-answer-relation-type"]&&"sort"!==this.type?e.html`
227
+ <button class="el-link" @click=${()=>this._setRelation(t,s)}>
228
+ ${Array.isArray(t.answerRelations)&&t.answerRelations.length?`关联了${this._relationLength(t.answerRelations)}项`:"关联检查"}
229
+ </button>
230
+ `:""}
217
231
 
218
- ${"sort"===this.type?e.html`
219
- <div class="flex-items-center" style="margin-top:12px">
220
- <div class="label"><span>排序答案:</span></div>
221
- <div style="flex:1">
222
- <div class="multi-select-wrapper">
223
- <div class="multi-select ${this._sortDropdownOpen?"focused":""} ${this.lockAnswerKey?"disabled":""}"
224
- @click=${()=>{this.lockAnswerKey||(this._sortDropdownOpen=!this._sortDropdownOpen,this.requestUpdate())}}>
225
- ${this._orderList.length>0?this._orderList.map(t=>e.html`
226
- <span class="tag">
227
- ${t}
228
- <span class="tag-close" @click=${e=>{this.lockAnswerKey||(e.stopPropagation(),this._removeSortItem(t))}}>&#x2715;</span>
229
- </span>
230
- `):e.html`<span class="placeholder">请按顺序选择排序答案</span>`}
231
- <span class="arrow">${u}</span>
232
- </div>
233
- ${this._sortDropdownOpen?e.html`
234
- <div class="multi-select-dropdown">
235
- ${this._answers.map((t,s)=>e.html`
236
- <div class="multi-select-option ${this._orderList.includes(this._label(s))?"selected":""}"
237
- @click=${()=>{this.lockAnswerKey||(this._toggleSortItem(this._label(s)),this.requestUpdate())}}>
238
- ${this._label(s)}
239
- </div>
240
- `)}
241
232
  </div>
242
- `:""}
233
+ `)}
243
234
  </div>
244
235
  </div>
245
236
  </div>
246
- `:""}
247
237
 
248
- <slot name="business-tag"></slot>
238
+ ${"sort"===this.type?e.html`
239
+ <div class="edit-row section-row">
240
+ <div class="label"><span>排序答案:</span></div>
241
+ <div class="row-body">
242
+ <div class="multi-select-wrapper">
243
+ <div class="multi-select ${this._sortDropdownOpen?"focused":""} ${this.lockAnswerKey?"disabled":""}"
244
+ @click=${()=>{this.lockAnswerKey||(this._sortDropdownOpen=!this._sortDropdownOpen,this.requestUpdate())}}>
245
+ ${this._orderList.length>0?this._orderList.map(t=>e.html`
246
+ <span class="tag">
247
+ ${t}
248
+ <span class="tag-close" @click=${e=>{this.lockAnswerKey||(e.stopPropagation(),this._removeSortItem(t))}}>&#x2715;</span>
249
+ </span>
250
+ `):e.html`<span class="placeholder">请按顺序选择排序答案</span>`}
251
+ <span class="arrow">${g}</span>
252
+ </div>
253
+ ${this._sortDropdownOpen?e.html`
254
+ <div class="multi-select-dropdown">
255
+ ${this._answers.map((t,s)=>e.html`
256
+ <div class="multi-select-option ${this._orderList.includes(this._label(s))?"selected":""}"
257
+ @click=${()=>{this.lockAnswerKey||(this._toggleSortItem(this._label(s)),this.requestUpdate())}}>
258
+ ${this._label(s)}
259
+ </div>
260
+ `)}
261
+ </div>
262
+ `:""}
263
+ </div>
264
+ </div>
265
+ </div>
266
+ `:""}
267
+
268
+ <slot name="business-tag"></slot>
249
269
 
250
- ${this._renderCategorySection()}
270
+ ${this._renderCategorySection()}
251
271
 
252
- ${this._renderAiSection()}
272
+ ${this._renderAiSection()}
253
273
 
254
- ${this._renderResourceSection()}
274
+ ${this._renderResourceSection()}
255
275
 
256
- ${this["show-rich-text"]&&this._showRichText?e.html`
257
- <div class="flex-items-start" style="margin-top:12px">
258
- <div class="label"><span>副文本:</span></div>
259
- <div style="flex:1">
260
- <slot name="sub-text">
261
- <qxs-blocksuite-editor
262
- .content=${this._richText}
263
- .upload-image=${this["upload-image"]}
264
- ?is-edit=${!0}
265
- @input=${e=>{this._richText=e.target.getContent()}}
266
- ></qxs-blocksuite-editor>
267
- </slot>
268
- ${this["show-action"]?"":e.html`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
276
+ ${this["show-rich-text"]&&this._showRichText?e.html`
277
+ <div class="edit-row section-row">
278
+ <div class="label"><span>副文本:</span></div>
279
+ <div class="row-body">
280
+ <slot name="sub-text">
281
+ <qxs-blocksuite-editor
282
+ .content=${this._richText}
283
+ .toolbar=${r.SUB_TEXT_EDITOR_TOOLBAR}
284
+ .upload-image=${this["upload-image"]}
285
+ ?is-edit=${!0}
286
+ @input=${e=>{this._richText=e.target.getContent()}}
287
+ ></qxs-blocksuite-editor>
288
+ </slot>
289
+ ${this["show-action"]?"":e.html`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
290
+ </div>
269
291
  </div>
270
- </div>
271
- `:""}
272
-
273
- ${this["show-analysis"]?e.html`
274
- <div class="flex-items-start" style="margin-top:12px">
275
- <div class="label"><span>解析:</span></div>
276
- <div style="flex:1">
277
- <textarea rows="2" .value=${this._analysis}
278
- @input=${e=>{this._analysis=e.target.value}}
279
- placeholder="请输入题目解析"></textarea>
292
+ `:""}
293
+
294
+ ${this["show-analysis"]?e.html`
295
+ <div class="edit-row section-row">
296
+ <div class="label"><span>解析:</span></div>
297
+ <div class="row-body">
298
+ <textarea rows="2" .value=${this._analysis}
299
+ @input=${e=>{this._analysis=e.target.value}}
300
+ placeholder="请输入题目解析"></textarea>
301
+ </div>
280
302
  </div>
281
- </div>
282
- `:""}
303
+ `:""}
304
+ </div>
283
305
  `}render(){if(this.sorting)return this._renderSorting();const t=this["is-edit"]?e.html`<div slot="edit">${this._renderEdit()}</div>`:e.html`<div slot="preview">${this._renderPreview()}</div>`;return e.html`
284
306
  <qxs-subject-layout .show-edit=${this["is-edit"]}>
285
307
  ${t}
@@ -308,61 +330,59 @@
308
330
  ${this._renderChangeTypeDialog()}
309
331
  ${this._renderImageViewer()}
310
332
  ${this._renderVideoViewer()}
311
- `}},exports.QxsSubjectSingle.styles=[r.sortingCardStyles,e.css`
312
- :host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
313
- *, ::before, ::after { box-sizing: border-box; }
314
-
315
- .preview { padding: 12px 0; }
316
- .preview .title { font-size: 14px; color: #303133; }
317
- .preview .title .key-badge {
318
- display: inline-block;
319
- margin-left: 8px;
320
- padding: 1px 6px;
321
- font-size: 11px;
322
- color: #fff;
323
- background: #f56c6c;
324
- border-radius: 3px;
325
- vertical-align: middle;
326
- }
327
- .preview .rich-text { margin-top: 8px; }
328
- .preview .rich-text img { max-width: 100%; }
329
- .preview .rich-text img[data-align="left"] { display: block !important; margin: 0 auto 0 0 !important; }
330
- .preview .rich-text img[data-align="center"] { display: block !important; margin: 0 auto !important; }
331
- .preview .rich-text img[data-align="right"] { display: block !important; margin: 0 0 0 auto !important; }
332
- .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }
333
- .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }
334
- .preview-answer .order { color: #909399; }
335
- .preview-answer .correct { color: #67c23a; }
336
- .preview-answer .result-info { color: #909399; }
333
+ `}},exports.QxsSubjectSingle.styles=[n.sortingCardStyles,a.subjectHostStyles,a.subjectControlResetStyles,a.subjectPreviewBaseStyles,a.subjectFormBaseStyles,a.subjectTextareaStyles,e.css`
334
+ .preview-answer { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
335
+ .preview-answer .radio { display: grid; grid-template-columns: auto auto minmax(0, 1fr); column-gap: 10px; row-gap: 3px; align-items: center; }
336
+ .preview-answer .order { color: #6b7280; font-size: 13px; font-weight: 600; }
337
+ .preview-answer .answer-main { min-width: 0; display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
338
+ .preview-answer .answer-text { min-width: 0; font-size: 14px; line-height: 1.7; font-weight: 500; color: #303133; }
339
+ .preview-answer .answer-meta { grid-column: 3; display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; line-height: 1.6; color: #8b95a7; }
340
+ .preview-answer .correct { color: #3D61E3; font-weight: 600; }
341
+ .preview-answer .result-info { color: #8b95a7; }
337
342
 
338
343
  .flex { display: flex; }
339
344
  .flex-items-center { display: flex; align-items: center; }
340
345
  .flex-items-start { display: flex; align-items: flex-start; }
341
346
  .flex-justify-end { display: flex; justify-content: flex-end; }
342
- .label { min-width: 60px; font-size: 13px; color: #606266; }
343
-
344
- textarea {
345
- border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;
346
- font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;
347
- line-height: 1.5; display: block; box-sizing: border-box;
347
+ .edit-actions {
348
+ display: flex;
349
+ justify-content: flex-end;
350
+ padding-left: 88px;
348
351
  }
349
- textarea:focus { border-color: #3D61E3; outline: none; }
350
- textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }
351
- .el-input { position: relative; display: block; }
352
- .el-input textarea { padding-bottom: 24px; }
353
- .el-input .char-counter {
354
- position: absolute; right: 12px; bottom: 8px;
355
- font-size: 12px; color: #909399; line-height: 1; pointer-events: none;
352
+ .edit-inline {
353
+ display: flex;
354
+ align-items: center;
355
+ flex-wrap: wrap;
356
+ gap: 8px 14px;
357
+ min-height: 32px;
358
+ }
359
+ .edit-note {
360
+ margin-top: 6px;
361
+ font-size: 12px;
362
+ line-height: 1.6;
363
+ color: #909399;
356
364
  }
357
365
 
358
- .answer-list { margin-top: 12px; }
359
- .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }
360
- .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }
361
- .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }
366
+ .answer-list { display: flex; flex-direction: column; gap: 10px; }
367
+ .answer-item {
368
+ display: flex;
369
+ align-items: center;
370
+ flex-wrap: wrap;
371
+ gap: 8px;
372
+ border-radius: 4px;
373
+ }
374
+ .answer-item .label {
375
+ min-width: 28px;
376
+ font-size: 13px;
377
+ font-weight: 600;
378
+ color: #6b7280;
379
+ letter-spacing: 0;
380
+ }
381
+ .answer-item .input { flex: 1; min-width: 240px; max-width: 380px; position: relative; display: block; }
362
382
  .answer-item .input input {
363
- height: 32px; padding: 0 50px 0 8px;
383
+ height: 36px; padding: 0 56px 0 10px;
364
384
  font-size: 13px; line-height: 32px;
365
- border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;
385
+ border: 1px solid #dcdfe6; border-radius: 6px; width: 100%;
366
386
  transition: border-color .2s; box-sizing: border-box;
367
387
  }
368
388
  .answer-item .input input:focus { border-color: #3D61E3; outline: none; }
@@ -372,7 +392,14 @@
372
392
  font-size: 12px; color: #909399; line-height: 1; pointer-events: none;
373
393
  }
374
394
 
375
- .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
395
+ .answer-item .correct {
396
+ color: #909399;
397
+ cursor: pointer;
398
+ display: inline-flex;
399
+ align-items: center;
400
+ gap: 4px;
401
+ white-space: nowrap;
402
+ }
376
403
  .answer-item .correct:hover { color: #3D61E3; }
377
404
  .answer-item .correct.is-correct { color: #67c23a; }
378
405
  .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }
@@ -387,11 +414,16 @@
387
414
  .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
388
415
  .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }
389
416
 
390
- .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }
417
+ .answer-item .link {
418
+ color: #3D61E3;
419
+ cursor: pointer;
420
+ font-size: 12px;
421
+ white-space: nowrap;
422
+ }
391
423
  .answer-item .link:hover { color: #2D4CB8; }
392
424
 
393
425
  .el-select {
394
- width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;
426
+ width: 150px; height: 34px; border: 1px solid #dcdfe6; border-radius: 6px;
395
427
  padding: 0 8px; font-size: 13px; background: #fff; appearance: none;
396
428
  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");
397
429
  background-repeat: no-repeat; background-position: right 8px center;
@@ -405,7 +437,6 @@
405
437
  .el-link:hover { color: #2D4CB8; }
406
438
  .el-link.danger { color: #f56c6c; }
407
439
 
408
- .section-row { margin-top: 12px; }
409
440
  .value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }
410
441
  .muted-text { font-size: 12px; color: #909399; }
411
442
 
@@ -453,7 +484,7 @@
453
484
  /* Multi-select with tags (Element Plus style) */
454
485
  .multi-select-wrapper { position: relative; }
455
486
  .multi-select {
456
- width: 240px; height: 28px; border: 1px solid #dcdfe6; border-radius: 3px;
487
+ width: 240px; min-height: 36px; border: 1px solid #dcdfe6; border-radius: 6px;
457
488
  padding: 0 30px 0 8px; font-size: 13px; background: #fff; cursor: pointer;
458
489
  display: flex; flex-wrap: nowrap; align-items: center; gap: 4px;
459
490
  transition: border-color .2s; position: relative; overflow: hidden;
@@ -488,6 +519,31 @@
488
519
  .multi-select-option:hover { background: #f5f7fa; }
489
520
  .multi-select-option.selected { color: #3D61E3; font-weight: 500; }
490
521
 
522
+ @media (max-width: 720px) {
523
+ .edit-row,
524
+ .section-row {
525
+ flex-direction: column;
526
+ gap: 8px;
527
+ }
528
+
529
+ .edit-row > .label,
530
+ .section-row > .label {
531
+ min-width: 0;
532
+ padding-top: 0;
533
+ }
534
+
535
+ .edit-actions {
536
+ padding-left: 0;
537
+ justify-content: flex-start;
538
+ }
539
+
540
+ .answer-item .input {
541
+ min-width: 0;
542
+ max-width: none;
543
+ width: 100%;
544
+ }
545
+ }
546
+
491
547
  .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }
492
548
  .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; }
493
549
  .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }
@@ -527,5 +583,5 @@
527
583
  font-size: 14px;
528
584
  border-radius: 4px;
529
585
  }
530
- `],c([t.property({type:Number,attribute:"order-index"})],exports.QxsSubjectSingle.prototype,"order-index",2),c([t.property({type:String,attribute:"subject-prefix"})],exports.QxsSubjectSingle.prototype,"subject-prefix",2),c([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectSingle.prototype,"is-edit",2),c([t.property({type:Boolean,attribute:"is-save"})],exports.QxsSubjectSingle.prototype,"is-save",2),c([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectSingle.prototype,"is-set",2),c([t.property({type:Boolean,attribute:"is-set-correct-answer"})],exports.QxsSubjectSingle.prototype,"is-set-correct-answer",2),c([t.property({type:Boolean,attribute:"lock-answer-key"})],exports.QxsSubjectSingle.prototype,"lockAnswerKey",2),c([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectSingle.prototype,"is-key",2),c([t.property({type:Boolean,attribute:"show-action"})],exports.QxsSubjectSingle.prototype,"show-action",2),c([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectSingle.prototype,"show-add",2),c([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectSingle.prototype,"hide-add-rich-text",2),c([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectSingle.prototype,"show-rich-text",2),c([t.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsSubjectSingle.prototype,"show-delete-action",2),c([t.property({type:Boolean,attribute:"show-save-action"})],exports.QxsSubjectSingle.prototype,"show-save-action",2),c([t.property({type:Boolean,reflect:!0})],exports.QxsSubjectSingle.prototype,"sorting",2),c([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectSingle.prototype,"show-answer-setting",2),c([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectSingle.prototype,"show-key",2),c([t.property({type:Boolean,attribute:"show-analysis"})],exports.QxsSubjectSingle.prototype,"show-analysis",2),c([t.property({attribute:"question-type",reflect:!0})],exports.QxsSubjectSingle.prototype,"type",2),c([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectSingle.prototype,"answer-check-type",2),c([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectSingle.prototype,"exam-answer-relation-type",2),c([t.property({type:String,attribute:"rich-text-content"})],exports.QxsSubjectSingle.prototype,"rich-text-content",2),c([t.property({type:String})],exports.QxsSubjectSingle.prototype,"analysis",2),c([t.property({type:Number,attribute:"least-answer-count"})],exports.QxsSubjectSingle.prototype,"least-answer-count",2),c([t.property({type:String,attribute:"exam-expand"})],exports.QxsSubjectSingle.prototype,"exam-expand",2),c([t.property({type:String,attribute:"custom-id"})],exports.QxsSubjectSingle.prototype,"custom-id",2),c([t.property({type:Number,attribute:"exam-id"})],exports.QxsSubjectSingle.prototype,"exam-id",2),c([t.property({type:String,attribute:"category-id"})],exports.QxsSubjectSingle.prototype,"category-id",2),c([t.property({type:Object,attribute:"upload-image"})],exports.QxsSubjectSingle.prototype,"upload-image",2),c([t.property({type:Array,attribute:"answer-list"})],exports.QxsSubjectSingle.prototype,"answer-list",1),c([t.property({type:Array,attribute:"tag-list"})],exports.QxsSubjectSingle.prototype,"tag-list",2),c([t.property({type:Array,attribute:"category-list"})],exports.QxsSubjectSingle.prototype,"category-list",2),c([t.property({type:String,attribute:"ai-answer"})],exports.QxsSubjectSingle.prototype,"ai-answer",2),c([t.property({type:Array,attribute:"resource-list"})],exports.QxsSubjectSingle.prototype,"resource-list",2),c([t.property({type:Boolean,attribute:"show-tag"})],exports.QxsSubjectSingle.prototype,"show-tag",2),c([t.property({type:Boolean,attribute:"show-category"})],exports.QxsSubjectSingle.prototype,"show-category",2),c([t.property({type:Boolean,attribute:"show-ai"})],exports.QxsSubjectSingle.prototype,"show-ai",2),c([t.property({type:Boolean,attribute:"show-resource"})],exports.QxsSubjectSingle.prototype,"show-resource",2),c([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectSingle.prototype,"show-jump",2),c([t.property({type:Boolean,attribute:"has-jump"})],exports.QxsSubjectSingle.prototype,"has-jump",2),c([t.property({type:String,attribute:"search-api"})],exports.QxsSubjectSingle.prototype,"search-api",2),c([t.property({type:Object,attribute:"search-handler"})],exports.QxsSubjectSingle.prototype,"search-handler",2),c([t.property({type:String,attribute:"model-value"})],exports.QxsSubjectSingle.prototype,"model-value",2),c([t.property({type:Boolean,attribute:"use-model"})],exports.QxsSubjectSingle.prototype,"use-model",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_answers",2),c([t.property({type:String})],exports.QxsSubjectSingle.prototype,"title",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_title",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_analysis",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_richText",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_showRichText",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_leastAnswerCount",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_answerCheckType",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_isKey",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_orderList",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_selectedTagList",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_categoryId",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_searchResults",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_searchOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_searchLoading",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_sortDropdownOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerIndex",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_videoViewerOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_correctHintDialogOpen",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_hasShownCorrectHint",2),c([t.state()],exports.QxsSubjectSingle.prototype,"_changeTypeDialogOpen",2),exports.QxsSubjectSingle=c([s.safeCustomElement("qxs-subject-single")],exports.QxsSubjectSingle),exports.SubjectError=p,exports.trimCommaSeparatedText=function(e){return String(e??"").split(",").map(e=>e.trim()).filter(Boolean).join(",")},exports.trimText=g;
586
+ `],p([t.property({type:Number,attribute:"order-index"})],exports.QxsSubjectSingle.prototype,"order-index",2),p([t.property({type:String,attribute:"subject-prefix"})],exports.QxsSubjectSingle.prototype,"subject-prefix",2),p([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectSingle.prototype,"is-edit",2),p([t.property({type:Boolean,attribute:"is-save"})],exports.QxsSubjectSingle.prototype,"is-save",2),p([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectSingle.prototype,"is-set",2),p([t.property({type:Boolean,attribute:"is-set-correct-answer"})],exports.QxsSubjectSingle.prototype,"is-set-correct-answer",2),p([t.property({type:Boolean,attribute:"lock-answer-key"})],exports.QxsSubjectSingle.prototype,"lockAnswerKey",2),p([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectSingle.prototype,"is-key",2),p([t.property({type:Boolean,attribute:"show-action"})],exports.QxsSubjectSingle.prototype,"show-action",2),p([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectSingle.prototype,"show-add",2),p([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectSingle.prototype,"hide-add-rich-text",2),p([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectSingle.prototype,"show-rich-text",2),p([t.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsSubjectSingle.prototype,"show-delete-action",2),p([t.property({type:Boolean,attribute:"show-save-action"})],exports.QxsSubjectSingle.prototype,"show-save-action",2),p([t.property({type:Boolean,reflect:!0})],exports.QxsSubjectSingle.prototype,"sorting",2),p([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectSingle.prototype,"show-answer-setting",2),p([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectSingle.prototype,"show-key",2),p([t.property({type:Boolean,attribute:"show-analysis"})],exports.QxsSubjectSingle.prototype,"show-analysis",2),p([t.property({attribute:"question-type",reflect:!0})],exports.QxsSubjectSingle.prototype,"type",2),p([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectSingle.prototype,"answer-check-type",2),p([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectSingle.prototype,"exam-answer-relation-type",2),p([t.property({type:String,attribute:"rich-text-content"})],exports.QxsSubjectSingle.prototype,"rich-text-content",2),p([t.property({type:String})],exports.QxsSubjectSingle.prototype,"analysis",2),p([t.property({type:Number,attribute:"least-answer-count"})],exports.QxsSubjectSingle.prototype,"least-answer-count",2),p([t.property({type:String,attribute:"exam-expand"})],exports.QxsSubjectSingle.prototype,"exam-expand",2),p([t.property({type:String,attribute:"custom-id"})],exports.QxsSubjectSingle.prototype,"custom-id",2),p([t.property({type:Number,attribute:"exam-id"})],exports.QxsSubjectSingle.prototype,"exam-id",2),p([t.property({type:String,attribute:"category-id"})],exports.QxsSubjectSingle.prototype,"category-id",2),p([t.property({type:Object,attribute:"upload-image"})],exports.QxsSubjectSingle.prototype,"upload-image",2),p([t.property({type:Array,attribute:"answer-list"})],exports.QxsSubjectSingle.prototype,"answer-list",1),p([t.property({type:Array,attribute:"tag-list"})],exports.QxsSubjectSingle.prototype,"tag-list",2),p([t.property({type:Array,attribute:"category-list"})],exports.QxsSubjectSingle.prototype,"category-list",2),p([t.property({type:String,attribute:"ai-answer"})],exports.QxsSubjectSingle.prototype,"ai-answer",2),p([t.property({type:Array,attribute:"resource-list"})],exports.QxsSubjectSingle.prototype,"resource-list",2),p([t.property({type:Boolean,attribute:"show-tag"})],exports.QxsSubjectSingle.prototype,"show-tag",2),p([t.property({type:Boolean,attribute:"show-category"})],exports.QxsSubjectSingle.prototype,"show-category",2),p([t.property({type:Boolean,attribute:"show-ai"})],exports.QxsSubjectSingle.prototype,"show-ai",2),p([t.property({type:Boolean,attribute:"show-resource"})],exports.QxsSubjectSingle.prototype,"show-resource",2),p([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectSingle.prototype,"show-jump",2),p([t.property({type:Boolean,attribute:"has-jump"})],exports.QxsSubjectSingle.prototype,"has-jump",2),p([t.property({type:String,attribute:"search-api"})],exports.QxsSubjectSingle.prototype,"search-api",2),p([t.property({type:Object,attribute:"search-handler"})],exports.QxsSubjectSingle.prototype,"search-handler",2),p([t.property({type:String,attribute:"model-value"})],exports.QxsSubjectSingle.prototype,"model-value",2),p([t.property({type:Boolean,attribute:"use-model"})],exports.QxsSubjectSingle.prototype,"use-model",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_answers",2),p([t.property({type:String})],exports.QxsSubjectSingle.prototype,"title",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_title",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_analysis",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_richText",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_showRichText",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_leastAnswerCount",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_answerCheckType",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_isKey",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_orderList",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_selectedTagList",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_categoryId",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_searchResults",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_searchOpen",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_searchLoading",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_sortDropdownOpen",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerOpen",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_imageViewerIndex",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_videoViewerOpen",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_correctHintDialogOpen",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_hasShownCorrectHint",2),p([t.state()],exports.QxsSubjectSingle.prototype,"_changeTypeDialogOpen",2),exports.QxsSubjectSingle=p([s.safeCustomElement("qxs-subject-single")],exports.QxsSubjectSingle),exports.SubjectError=d,exports.trimCommaSeparatedText=function(e){return String(e??"").split(",").map(e=>e.trim()).filter(Boolean).join(",")},exports.trimText=m;
531
587
  //# sourceMappingURL=single.cjs.map