@qxs-bns/components-wc 0.0.2 → 0.0.3

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.
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text.mjs","sources":["../../../../packages/components-wc/src/subject/rich-text.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport '../editor/blocksuite-editor'\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-rich-text')\nexport class SubjectRichText extends LitElement {\n createRenderRoot() { return this }\n\n static styles = css`\n :host {\n display: block;\n font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif;\n font-size: 12px;\n color: #5a5a5a;\n }\n qxs-blocksuite-editor {\n display: block;\n }\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: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _content = ''\n\n private _editor: HTMLElement | null = null\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('richTextContent')) {\n this._content = this.richTextContent\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._editor = null\n }\n\n private _save(e?: Event) {\n e?.stopImmediatePropagation()\n const editorEl = this.querySelector('qxs-blocksuite-editor') as any\n const content = editorEl?.getContent?.() || this._content\n if (!content || content === '<p></p>') {\n showToast('富文本内容不能为空!')\n return\n }\n this._content = content\n this._emit('save', { richTextContent: content })\n }\n\n render() {\n const content = this._content || this.richTextContent\n return html`\n ${this.isEdit\n ? html`<qxs-blocksuite-editor .content=${content}></qxs-blocksuite-editor>`\n : html`<qxs-blocksuite-editor .content=${content} readonly preview></qxs-blocksuite-editor>`\n }\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n ?hide-add-rich-text=${true}\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 ></qxs-subject-action>\n `\n : ''}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectRichText","LitElement","constructor","super","arguments","this","orderIndex","isEdit","isSave","showAction","isSet","richTextContent","examAnswerRelationType","_content","_editor","createRenderRoot","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","updated","changed","has","disconnectedCallback","_save","e","stopImmediatePropagation","editorEl","querySelector","content","getContent","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","render","html","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","String","state","safeCustomElement"],"mappings":"6lBAmBO,IAAMA,EAAN,cAA8BC,EAA9BC,WAAAA,GAAAC,SAAAC,WAeiDC,KAAAC,WAAa,EAChBD,KAAAE,QAAS,EACTF,KAAAG,QAAS,EACLH,KAAAI,YAAa,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,CAAA;;qBAEWxD,KAAKE;oBACNF,KAAKK;gCACM;iCACC;sCACML,KAAKO;oBACvB,IAAMP,KAAKW,MAAM;kBACnBX,KAAKsB;kBACL,IAAMtB,KAAKW,MAAM;iBACjBY,GAAmBvB,KAAKW,MAAM,MAAOY,EAAEV;;QAG/C;KAER,GA7EWlB,EAGJ8D,OAASC,CAAA;;;;;;;;;;IAYsCC,EAAA,CAArDC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,iBAf1BpE,EAe2CqE,UAAA,aAAA,GACHL,EAAA,CAAlDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,aAhB3BpE,EAgBwCqE,UAAA,SAAA,GACAL,EAAA,CAAlDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,aAjB3BpE,EAiBwCqE,UAAA,SAAA,GACIL,EAAA,CAAtDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,iBAlB3BpE,EAkB4CqE,UAAA,aAAA,GACLL,EAAA,CAAjDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,YAnB3BpE,EAmBuCqE,UAAA,QAAA,GACUL,EAAA,CAA3DC,EAAS,CAAEC,KAAMK,OAAQH,UAAW,uBApB1BpE,EAoBiDqE,UAAA,kBAAA,GACQL,EAAA,CAAnEC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,+BArB1BpE,EAqByDqE,UAAA,yBAAA,GAEnDL,EAAA,CAAhBQ,KAvBUxE,EAuBMqE,UAAA,WAAA,GAvBNrE,EAANgE,EAAA,CADNS,EAAkB,0BACNzE"}
1
+ {"version":3,"file":"rich-text.mjs","sources":["../../../../packages/components-wc/src/subject/rich-text.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport '../editor/blocksuite-editor'\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-rich-text')\nexport class SubjectRichText extends LitElement {\n createRenderRoot() { return this }\n\n static styles = css`\n :host {\n display: block;\n font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif;\n font-size: 12px;\n color: #5a5a5a;\n }\n qxs-blocksuite-editor {\n display: block;\n }\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: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: Object, attribute: 'upload-image' }) 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 @state() private _content = ''\n\n private _editor: HTMLElement | null = null\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('richTextContent')) {\n this._content = this.richTextContent\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._editor = null\n }\n\n private _save(e?: Event) {\n e?.stopImmediatePropagation()\n const editorEl = this.querySelector('qxs-blocksuite-editor') as any\n const content = editorEl?.getContent?.() || this._content\n if (!content || content === '<p></p>') {\n showToast('富文本内容不能为空!')\n return\n }\n this._content = content\n this._emit('save', { richTextContent: content })\n }\n\n render() {\n const content = this._content || this.richTextContent\n return html`\n ${this.isEdit\n ? html`<qxs-blocksuite-editor .content=${content} .uploadImage=${this.uploadImage}></qxs-blocksuite-editor>`\n : html`<qxs-blocksuite-editor .content=${content} .uploadImage=${this.uploadImage} readonly preview></qxs-blocksuite-editor>`\n }\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n ?hide-add-rich-text=${true}\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 ></qxs-subject-action>\n `\n : ''}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectRichText","LitElement","constructor","super","arguments","this","orderIndex","isEdit","isSave","showAction","isSet","richTextContent","examAnswerRelationType","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_content","_editor","createRenderRoot","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","updated","changed","has","disconnectedCallback","_save","stopImmediatePropagation","editorEl","querySelector","content","getContent","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","render","html","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","String","state","safeCustomElement"],"mappings":"6lBAmBO,IAAMA,EAAN,cAA8BC,EAA9BC,WAAAA,GAAAC,SAAAC,WAeiDC,KAAAC,WAAa,EAChBD,KAAAE,QAAS,EACTF,KAAAG,QAAS,EACLH,KAAAI,YAAa,EAClBJ,KAAAK,OAAQ,EACEL,KAAAM,gBAAkB,GACVN,KAAAO,uBAAyB,EACtCP,KAAAQ,YAA+CC,SAC7F,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IA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AwBxC,KAAKQ,uCACpE6D,CAAA,mCAAuC7B,kBAAwBxC,KAAKQ;QAExER,KAAKI,WACHiE,CAAA;;qBAEWrE,KAAKE;oBACNF,KAAKK;gCACM;iCACC;sCACML,KAAKO;oBACvB,IAAMP,KAAKyB,MAAM;kBACnBzB,KAAKoC;kBACL,IAAMpC,KAAKyB,MAAM;iBACjBT,GAAmBhB,KAAKyB,MAAM,MAAOT,EAAEW;;QAG/C;KAER,GArFWhC,EAGJ2E,OAASC,CAAA;;;;;;;;;;IAYsCC,EAAA,CAArDC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,iBAf1BjF,EAe2CkF,UAAA,aAAA,GACHL,EAAA,CAAlDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,aAhB3BjF,EAgBwCkF,UAAA,SAAA,GACAL,EAAA,CAAlDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,aAjB3BjF,EAiBwCkF,UAAA,SAAA,GACIL,EAAA,CAAtDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,iBAlB3BjF,EAkB4CkF,UAAA,aAAA,GACLL,EAAA,CAAjDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,YAnB3BjF,EAmBuCkF,UAAA,QAAA,GACUL,EAAA,CAA3DC,EAAS,CAAEC,KAAMK,OAAQH,UAAW,uBApB1BjF,EAoBiDkF,UAAA,kBAAA,GACQL,EAAA,CAAnEC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,+BArB1BjF,EAqByDkF,UAAA,yBAAA,GACbL,EAAA,CAAtDC,EAAS,CAAEC,KAAM3B,OAAQ6B,UAAW,kBAtB1BjF,EAsB4CkF,UAAA,cAAA,GAStCL,EAAA,CAAhBQ,KA/BUrF,EA+BMkF,UAAA,WAAA,GA/BNlF,EAAN6E,EAAA,CADNS,EAAkB,0BACNtF"}
@@ -1,4 +1,4 @@
1
- import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as r}from"../base/define.mjs";var a=Object.defineProperty,n=Object.getOwnPropertyDescriptor,l=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?n(e,i):e,l=t.length-1;l>=0;l--)(o=t[l])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&a(e,i,r),r};const p=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>`,d=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>`;function h(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)}let c=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAnalysis=!1,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answerList")}get scaleQuestions(){return this._scaleQuestions}set scaleQuestions(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scaleQuestions")}updated(t){t.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_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}_save(t){if(t?.stopImmediatePropagation(),!this._title)return void h("题目标题不能为空!");for(let t=0;t<this._answers.length;t++)if(!this._answers[t].title)return void h(`选项${String.fromCharCode(65+t)}未填写。`);if(!this._rowTitle)return void h("行标题不能为空!");const e=this._rowTitle.split("\n").filter(t=>t.trim());0!==e.length?this._emit("save",{title:this._title,analysis:this._analysis,answers:this._answers,scaleQuestionList:e,examRichTextContent:this._showRichText?this._richText:"",examAnswerRelationType:this.examAnswerRelationType}):h("行标题不能为空!")}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t`
1
+ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as a}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";var r=Object.defineProperty,n=Object.getOwnPropertyDescriptor,l=(t,e,i,s)=>{for(var a,o=s>1?void 0:s?n(e,i):e,l=t.length-1;l>=0;l--)(a=t[l])&&(o=(s?a(e,i,o):a(o))||o);return s&&o&&r(e,i,o),o};const p=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>`,d=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>`;function h(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)}let c=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAnalysis=!1,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answerList")}get scaleQuestions(){return this._scaleQuestions}set scaleQuestions(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scaleQuestions")}updated(t){t.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_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}_save(t){if(t?.stopImmediatePropagation(),!this._title)return void h("题目标题不能为空!");for(let t=0;t<this._answers.length;t++)if(!this._answers[t].title)return void h(`选项${String.fromCharCode(65+t)}未填写。`);if(!this._rowTitle)return void h("行标题不能为空!");const e=this._rowTitle.split("\n").filter(t=>t.trim());0!==e.length?this._emit("save",{title:this._title,analysis:this._analysis,answers:this._answers,scaleQuestionList:e,examRichTextContent:this._showRichText?this._richText:"",examAnswerRelationType:this.examAnswerRelationType}):h("行标题不能为空!")}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t`
2
2
  <div class="preview">
3
3
  <span class="title">${this.orderIndex+1}.${this.title}(量表题)</span>
4
4
  ${this.richTextContent?t`<div style="margin-top:8px" .innerHTML=${this.richTextContent}></div>`:""}
@@ -74,7 +74,8 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
74
74
  <div class="label"><span>富文本:</span></div>
75
75
  <div style="flex:1">
76
76
  <qxs-blocksuite-editor
77
- content=${this._richText}
77
+ .content=${this._richText}
78
+ .uploadImage=${this.uploadImage}
78
79
  ?is-edit=${!0}
79
80
  ></qxs-blocksuite-editor>
80
81
  <div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>
@@ -158,5 +159,5 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
158
159
  .row-title-textarea {
159
160
  height: 200px;
160
161
  }
161
- `,l([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),l([s({type:String})],c.prototype,"title",2),l([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),l([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),l([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),l([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),l([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),l([s({type:String})],c.prototype,"analysis",2),l([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),l([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),l([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",1),l([s({type:Array,attribute:"scale-questions"})],c.prototype,"scaleQuestions",1),l([o()],c.prototype,"_answers",2),l([o()],c.prototype,"_scaleQuestions",2),l([o()],c.prototype,"_rowTitle",2),l([o()],c.prototype,"_title",2),l([o()],c.prototype,"_analysis",2),l([o()],c.prototype,"_showRichText",2),l([o()],c.prototype,"_richText",2),c=l([r("qxs-scale")],c);export{c as QxsScale};
162
+ `,l([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),l([s({type:String})],c.prototype,"title",2),l([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),l([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),l([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),l([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),l([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),l([s({type:String})],c.prototype,"analysis",2),l([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),l([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),l([s({type:Object})],c.prototype,"uploadImage",2),l([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",1),l([s({type:Array,attribute:"scale-questions"})],c.prototype,"scaleQuestions",1),l([a()],c.prototype,"_answers",2),l([a()],c.prototype,"_scaleQuestions",2),l([a()],c.prototype,"_rowTitle",2),l([a()],c.prototype,"_title",2),l([a()],c.prototype,"_analysis",2),l([a()],c.prototype,"_showRichText",2),l([a()],c.prototype,"_richText",2),c=l([o("qxs-scale")],c);export{c as QxsScale};
162
163
  //# sourceMappingURL=scale.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scale.mjs","sources":["../../../../packages/components-wc/src/subject/scale.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\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>`\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-scale')\nexport class QxsScale 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 .scale-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }\n .scale-table th, .scale-table td { border: 1px solid #e4e7ed; padding: 6px 4px; text-align: center; }\n .scale-table th { background: #f5f7fa; 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, input[type=\"text\"] {\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; white-space: pre-wrap;\n }\n textarea:focus, input[type=\"text\"]:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled, input[type=\"text\"]:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n\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 .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .answer-item { display: flex; align-items: center; margin-top: 6px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 200px; }\n .answer-item .input input {\n height: 32px; padding: 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\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 .row-title-textarea {\n height: 200px;\n }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\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: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = false\n @property({ type: String }) analysis = ''\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\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 ? arr.slice(0, 5) : [{ title: '' }, { title: '' }, { title: '' }, { title: '' }, { title: '' }]\n this.requestUpdate('answerList')\n }\n\n @property({ type: Array, attribute: 'scale-questions' })\n get scaleQuestions() { return this._scaleQuestions }\n\n set scaleQuestions(v: any) {\n this._scaleQuestions = Array.isArray(v) && v.length ? v : ['问题1']\n this.requestUpdate('scaleQuestions')\n }\n\n @state() private _answers: { title: string }[] = [{ title: '' }, { title: '' }, { title: '' }, { title: '' }, { title: '' }]\n @state() private _scaleQuestions: string[] = ['问题1']\n @state() private _rowTitle = ''\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 200\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._rowTitle = this._scaleQuestions.join('\\n')\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\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 _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\n private _save(e?: Event) {\n e?.stopImmediatePropagation()\n if (!this._title) { showToast('题目标题不能为空!'); return }\n\n for (let i = 0; i < this._answers.length; i++) {\n if (!this._answers[i].title) {\n showToast(`选项${String.fromCharCode(65 + i)}未填写。`)\n return\n }\n }\n\n if (!this._rowTitle) { showToast('行标题不能为空!'); return }\n\n const questions = this._rowTitle.split('\\n').filter(i => i.trim())\n if (questions.length === 0) { showToast('行标题不能为空!'); return }\n\n this._emit('save', {\n title: this._title,\n analysis: this._analysis,\n answers: this._answers,\n scaleQuestionList: questions,\n examRichTextContent: this._showRichText ? this._richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n })\n }\n\n private _renderPreview() {\n const colWidth = Math.floor(100 / (this._answers.length + 1))\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(量表题)</span>\n ${this.richTextContent ? html`<div style=\"margin-top:8px\" .innerHTML=${this.richTextContent}></div>` : ''}\n <table class=\"scale-table\">\n <thead><tr>\n <th style=\"width:${colWidth}%\">问题 \\ 选项</th>\n ${this._answers.map(a => html`<th style=\"width:${colWidth}%\">${a.title}</th>`)}\n </tr></thead>\n <tbody>\n ${this._scaleQuestions.map(q => html`\n <tr><td>${q}</td>${this._answers.map(() => html`<td><input type=\"radio\" disabled /></td>`)}</tr>\n `)}\n </tbody>\n </table>\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</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=\"【量表题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>行标题:</span></div>\n <div class=\"flex\" style=\"flex:1\">\n <div class=\"el-input\" style=\"width:160px\">\n <textarea class=\"row-title-textarea\" .value=${this._rowTitle} ?disabled=${this.isSave}\n @input=${(e: Event) => { this._rowTitle = (e.target as HTMLTextAreaElement).value }}\n @keydown=${(e: KeyboardEvent) => { e.stopPropagation() }}\n placeholder=\"请输入行标题\"></textarea>\n </div>\n <div style=\"flex:1;margin-left:12px\">\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${String.fromCharCode(65 + i)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${a.title} ?disabled=${this.isSave}\n maxlength=\"10\"\n @input=${(e: Event) => { this._answers = this._answers.map((x, j) => j === i ? { title: (e.target as HTMLInputElement).value } : x) }}\n placeholder=\"选项${i + 1}\" />\n </div>\n ${!this.isSave\n ? html`\n <span class=\"icon\" @click=${() => {\n if (this._answers.length < 5) { this._answers = [...this._answers, { title: '' }] }\n }}>${iconPlus}</span>\n <span class=\"icon ${this._answers.length < 3 ? 'disabled' : ''}\" @click=${() => {\n if (this._answers.length > 3) { this._answers = this._answers.filter((_, j) => j !== i) }\n }}>${iconRemove}</span>\n `\n : ''}\n </div>\n `)}\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis} ?disabled=${this.isSave}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\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 ?is-edit=${true}\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 }\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 ?show-other-option=${false}\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 @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","iconRemove","showToast","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","QxsScale","LitElement","constructor","super","arguments","this","orderIndex","title","isEdit","isSave","isSet","showAction","showAnalysis","analysis","richTextContent","examAnswerRelationType","_answers","_scaleQuestions","_rowTitle","_title","_analysis","_showRichText","_richText","TITLE_MAX","answerList","v","arr","Array","isArray","length","slice","requestUpdate","scaleQuestions","updated","changed","has","_syncProps","join","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","e","target","value","_save","stopImmediatePropagation","i","String","fromCharCode","questions","split","filter","trim","answers","scaleQuestionList","examRichTextContent","_renderPreview","colWidth","Math","floor","map","a","q","_renderEdit","stopPropagation","x","j","_","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","state","safeCustomElement"],"mappings":"qjBAIA,MAAMA,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLAEnB,SAASE,EAAUC,GACjB,MAAMC,EAAKC,SAASC,cAAc,OAClCF,EAAGG,YAAcJ,EACjBK,OAAOC,OAAOL,EAAGM,MAAO,CACtBC,SAAU,QAASC,IAAK,OAAQC,KAAM,MAAOC,UAAW,mBACxDC,QAAS,YAAaC,aAAc,MAAOC,SAAU,OAAQC,MAAO,OACpEC,WA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MI,QAASF,UAAW,mBApE3BhF,EAoE8CiF,UAAA,eAAA,GAC7BL,EAAA,CAA3BC,EAAS,CAAEC,KAAM1B,UArEPpD,EAqEiBiF,UAAA,WAAA,GACgCL,EAAA,CAA3DC,EAAS,CAAEC,KAAM1B,OAAQ4B,UAAW,uBAtE1BhF,EAsEiDiF,UAAA,kBAAA,GACQL,EAAA,CAAnEC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,+BAvE1BhF,EAuEyDiF,UAAA,yBAAA,GAEhEL,EAAA,CADHC,EAAS,CAAEC,KAAMnD,MAAOqD,UAAW,iBAxEzBhF,EAyEPiF,UAAA,aAAA,GASAL,EAAA,CADHC,EAAS,CAAEC,KAAMnD,MAAOqD,UAAW,qBAjFzBhF,EAkFPiF,UAAA,iBAAA,GAOaL,EAAA,CAAhBO,KAzFUnF,EAyFMiF,UAAA,WAAA,GACAL,EAAA,CAAhBO,KA1FUnF,EA0FMiF,UAAA,kBAAA,GACAL,EAAA,CAAhBO,KA3FUnF,EA2FMiF,UAAA,YAAA,GACAL,EAAA,CAAhBO,KA5FUnF,EA4FMiF,UAAA,SAAA,GACAL,EAAA,CAAhBO,KA7FUnF,EA6FMiF,UAAA,YAAA,GACAL,EAAA,CAAhBO,KA9FUnF,EA8FMiF,UAAA,gBAAA,GACAL,EAAA,CAAhBO,KA/FUnF,EA+FMiF,UAAA,YAAA,GA/FNjF,EAAN4E,EAAA,CADNQ,EAAkB,cACNpF"}
1
+ {"version":3,"file":"scale.mjs","sources":["../../../../packages/components-wc/src/subject/scale.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\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>`\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-scale')\nexport class QxsScale 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 .scale-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 12px; }\n .scale-table th, .scale-table td { border: 1px solid #e4e7ed; padding: 6px 4px; text-align: center; }\n .scale-table th { background: #f5f7fa; 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, input[type=\"text\"] {\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; white-space: pre-wrap;\n }\n textarea:focus, input[type=\"text\"]:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled, input[type=\"text\"]:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n\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 .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .answer-item { display: flex; align-items: center; margin-top: 6px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 200px; }\n .answer-item .input input {\n height: 32px; padding: 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\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 .row-title-textarea {\n height: 200px;\n }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\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: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = false\n @property({ type: String }) analysis = ''\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: Object })\n 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 @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 ? arr.slice(0, 5) : [{ title: '' }, { title: '' }, { title: '' }, { title: '' }, { title: '' }]\n this.requestUpdate('answerList')\n }\n\n @property({ type: Array, attribute: 'scale-questions' })\n get scaleQuestions() { return this._scaleQuestions }\n\n set scaleQuestions(v: any) {\n this._scaleQuestions = Array.isArray(v) && v.length ? v : ['问题1']\n this.requestUpdate('scaleQuestions')\n }\n\n @state() private _answers: { title: string }[] = [{ title: '' }, { title: '' }, { title: '' }, { title: '' }, { title: '' }]\n @state() private _scaleQuestions: string[] = ['问题1']\n @state() private _rowTitle = ''\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 200\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._rowTitle = this._scaleQuestions.join('\\n')\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\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 _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\n private _save(e?: Event) {\n e?.stopImmediatePropagation()\n if (!this._title) { showToast('题目标题不能为空!'); return }\n\n for (let i = 0; i < this._answers.length; i++) {\n if (!this._answers[i].title) {\n showToast(`选项${String.fromCharCode(65 + i)}未填写。`)\n return\n }\n }\n\n if (!this._rowTitle) { showToast('行标题不能为空!'); return }\n\n const questions = this._rowTitle.split('\\n').filter(i => i.trim())\n if (questions.length === 0) { showToast('行标题不能为空!'); return }\n\n this._emit('save', {\n title: this._title,\n analysis: this._analysis,\n answers: this._answers,\n scaleQuestionList: questions,\n examRichTextContent: this._showRichText ? this._richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n })\n }\n\n private _renderPreview() {\n const colWidth = Math.floor(100 / (this._answers.length + 1))\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(量表题)</span>\n ${this.richTextContent ? html`<div style=\"margin-top:8px\" .innerHTML=${this.richTextContent}></div>` : ''}\n <table class=\"scale-table\">\n <thead><tr>\n <th style=\"width:${colWidth}%\">问题 \\ 选项</th>\n ${this._answers.map(a => html`<th style=\"width:${colWidth}%\">${a.title}</th>`)}\n </tr></thead>\n <tbody>\n ${this._scaleQuestions.map(q => html`\n <tr><td>${q}</td>${this._answers.map(() => html`<td><input type=\"radio\" disabled /></td>`)}</tr>\n `)}\n </tbody>\n </table>\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</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=\"【量表题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>行标题:</span></div>\n <div class=\"flex\" style=\"flex:1\">\n <div class=\"el-input\" style=\"width:160px\">\n <textarea class=\"row-title-textarea\" .value=${this._rowTitle} ?disabled=${this.isSave}\n @input=${(e: Event) => { this._rowTitle = (e.target as HTMLTextAreaElement).value }}\n @keydown=${(e: KeyboardEvent) => { e.stopPropagation() }}\n placeholder=\"请输入行标题\"></textarea>\n </div>\n <div style=\"flex:1;margin-left:12px\">\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${String.fromCharCode(65 + i)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${a.title} ?disabled=${this.isSave}\n maxlength=\"10\"\n @input=${(e: Event) => { this._answers = this._answers.map((x, j) => j === i ? { title: (e.target as HTMLInputElement).value } : x) }}\n placeholder=\"选项${i + 1}\" />\n </div>\n ${!this.isSave\n ? html`\n <span class=\"icon\" @click=${() => {\n if (this._answers.length < 5) { this._answers = [...this._answers, { title: '' }] }\n }}>${iconPlus}</span>\n <span class=\"icon ${this._answers.length < 3 ? 'disabled' : ''}\" @click=${() => {\n if (this._answers.length > 3) { this._answers = this._answers.filter((_, j) => j !== i) }\n }}>${iconRemove}</span>\n `\n : ''}\n </div>\n `)}\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis} ?disabled=${this.isSave}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\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 ></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 }\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 ?show-other-option=${false}\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 @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","iconRemove","showToast","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","QxsScale","LitElement","constructor","super","arguments","this","orderIndex","title","isEdit","isSave","isSet","showAction","showAnalysis","analysis","richTextContent","examAnswerRelationType","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","_scaleQuestions","_rowTitle","_title","_analysis","_showRichText","_richText","TITLE_MAX","answerList","v","arr","Array","isArray","length","slice","requestUpdate","scaleQuestions","updated","changed","has","_syncProps","join","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","value","_save","stopImmediatePropagation","i","String","fromCharCode","questions","split","filter","trim","answers","scaleQuestionList","examRichTextContent","_renderPreview","colWidth","Math","floor","map","a","q","_renderEdit","stopPropagation","x","j","_","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","state","safeCustomElement"],"mappings":"qjBAIA,MAAMA,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLAEnB,SAASE,EAAUC,GACjB,MAAMC,EAAKC,SAASC,cAAc,OAClCF,EAAGG,YAAcJ,EACjBK,OAAOC,OAAOL,EAAGM,MAAO,CACtBC,SAAU,QAASC,IAAK,OAAQC,KAAM,MAAOC,UAAW,mBACxDC,QAAS,YAAaC,aAAc,MAAOC,SAAU,OAAQC,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ANwF,EAAA,CADNQ,EAAkB,cACNhG"}
@@ -1,4 +1,4 @@
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 a}from"../base/uid.mjs";var n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=(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};const d=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>`,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="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 h=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>`;function u(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)}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=!1,this.type="single",this.answerCheckType=1,this.examAnswerRelationType=0,this.richTextContent="",this.analysis="",this.leastAnswerCount=2,this.examExpand="",this.customId="",this.examId=0,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)}updated(e){e.has("isEdit")&&this.isEdit&&this._syncProps(),(e.has("examExpand")||e.has("answerList"))&&this._syncExamExpand()}_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}_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:a()}])}_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}_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 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 a}from"../base/uid.mjs";var n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=(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};const d=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>`,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="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 h=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>`;function u(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)}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=!1,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._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)}updated(e){e.has("isEdit")&&this.isEdit&&this._syncProps(),(e.has("examExpand")||e.has("answerList"))&&this._syncExamExpand()}_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}_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:a()}])}_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}_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`
2
2
  <div class="modal-backdrop" @click=${()=>{this._resultDialogOpen=!1}}>
3
3
  <div class="modal" @click=${e=>e.stopPropagation()}>
4
4
  <div class="modal-header">
@@ -134,7 +134,8 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
134
134
  <div class="label"><span>富文本:</span></div>
135
135
  <div style="flex:1">
136
136
  <qxs-blocksuite-editor
137
- content=${this._richText}
137
+ .content=${this._richText}
138
+ .uploadImage=${this.uploadImage}
138
139
  ?is-edit=${!0}
139
140
  @input=${e=>{this._richText=e.target.getContent()}}
140
141
  ></qxs-blocksuite-editor>
@@ -314,5 +315,5 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i}from"..
314
315
  .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }
315
316
  .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
316
317
  .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }
317
- `,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:String})],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:Array,attribute:"answer-list"})],x.prototype,"answerList",1),p([r()],x.prototype,"_answers",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};
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:String})],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([r()],x.prototype,"_answers",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};
318
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'\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 = false\n @property({ type: String }) type: 'single' | 'multiple' | 'sort' = '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\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 @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 updated(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (changed.has('examExpand') || changed.has('answerList')) { this._syncExamExpand() }\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\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 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 }}>&#x2715;</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 _save(e?: Event) {\n e?.stopImmediatePropagation()\n if (!this._title) { showToast('题目标题不能为空!'); return }\n if (!this._answerCheckType) { showToast('请选择答题设置'); return }\n\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n this._answers.forEach((v, i) => {\n if (!v.title?.trim()) { msg += `选项${this._label(i)}未填写。` }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (this._orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && this._orderList.length < this._leastAnswerCount) {\n showToast(`排序题至少需要设置${this._leastAnswerCount}项排序答案`); return\n }\n }\n\n if (msg) { showToast(msg); return }\n\n const uniqueAnswer = new Set(this._answers.map(a => a.title))\n if (uniqueAnswer.size !== this._answers.length) { showToast('选项不能重复'); return }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1) { showToast('请至少设置两个支持选项'); return }\n if (isSetCorrectAnswer && correctAnswerCount < this._leastAnswerCount) {\n showToast('至少选几项与支持选项数不符'); return\n }\n }\n\n if (this._answerCheckType === 2 || this._answerCheckType === 3) {\n if (!isSetCorrectAnswer) { showToast('请设置支持选项'); return }\n }\n\n this._emit('save', {\n title: this._title,\n answers: this._answers.filter(a => a.title).map((a, i) => ({ ...a, orderIndex: i + 1 })),\n examExpand: this._orderList.map(l => l.charCodeAt(0) - 65 + 1).join(','),\n analysis: this._analysis,\n isSetCorrectAnswer,\n leastAnswerCount: this._leastAnswerCount,\n examRichTextContent: this._showRichText ? this._richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n isKey: this.isKey,\n answerCheckType: this._answerCheckType,\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) }}>&#x2715;</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 ?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":["iconPlus","html","iconRemove","iconArrow","showToast","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","QxsSubjectSingle","LitElement","constructor","super","arguments","this","orderIndex","isEdit","isSave","isSet","isKey","showAction","showAnalysis","type","answerCheckType","examAnswerRelationType","richTextContent","analysis","leastAnswerCount","examExpand","customId","examId","_answers","title","isCorrect","_title","_analysis","_richText","_showRichText","_leastAnswerCount","_answerCheckType","_orderList","_resultDialogOpen","_resultDialogIndex","_resultDialogValue","_sortDropdownOpen","TITLE_MAX","ANSWER_MAX","_handleDocumentClick","e","path","composedPath","wrapper","shadowRoot","querySelector","includes","requestUpdate","answerList","v","arr","Array","isArray","length","map","a","connectedCallback","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_syncProps","_syncExamExpand","ids","split","id","answer","find","answerId","toString","String","fromCharCode","filter","Boolean","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_label","i","_titlePlaceholder","_setCorrect","item","val","forEach","_onTitleInput","target","value","slice","_onAnswerInput","idx","_addAnswer","customAnswerId","uid","_deleteAnswer","index","_","_toggleSortItem","letter","indexOf","l","_removeSortItem","_getSortOrder","pos","_openResultDialog","resultItem","_saveResultDialog","_renderResultDialog","stopPropagation","_save","stopImmediatePropagation","isSetCorrectAnswer","correctAnswerCount","trim","Set","size","answers","charCodeAt","join","examRichTextContent","_renderPreview","typeSuffix","answerRelations","_renderEdit","Number","from","Math","max","n","checked","getContent","render","styles","css","__decorateClass","property","attribute","prototype","state","safeCustomElement"],"mappings":"2lBAgBA,MAAMA,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLACDA,CAAA,yNAClB,MAAME,EAAYF,CAAA,kLAElB,SAASG,EAAUC,GACjB,MAAMC,EAAKC,SAASC,cAAc,OAClCF,EAAGG,YAAcJ,EACjBK,OAAOC,OAAOL,EAAGM,MAAO,CACtBC,SAAU,QAASC,IAAK,OAAQC,KAAM,MAAOC,UAAW,mBACxDC,QAAS,YAAaC,aAAc,MAAOC,SAAU,OAAQC,MAAO,OACpEC,WAAY,UAAWC,OAAQ,QAASC,UAAW,6BACnDC,WAAY,cAAeC,QAAS,MAEtClB,SAASmB,KAAKC,YAAYrB,GAC1BsB,WAAW,KAAQtB,EAAGM,MAAMa,QAAU,IAAKG,WAAW,IAAMtB,EAAGuB,SAAU,MAAQ,KACnF,CAGO,IAAMC,EAAN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J1B5I,EAyJkD6I,UAAA,mBAAA,GACPH,EAAA,CAArDC,EAAS,CAAE9H,KAAM0D,OAAQqE,UAAW,iBA1J1B5I,EA0J2C6I,UAAA,aAAA,GACFH,EAAA,CAAnDC,EAAS,CAAE9H,KAAM0D,OAAQqE,UAAW,eA3J1B5I,EA2JyC6I,UAAA,WAAA,GACFH,EAAA,CAAjDC,EAAS,CAAE9H,KAAMmH,OAAQY,UAAW,aA5J1B5I,EA4JuC6I,UAAA,SAAA,GAG9CH,EAAA,CADHC,EAAS,CAAE9H,KAAMqC,MAAO0F,UAAW,iBA9JzB5I,EA+JP6I,UAAA,aAAA,GAaaH,EAAA,CAAhBI,KA5KU9I,EA4KM6I,UAAA,WAAA,GAKAH,EAAA,CAAhBI,KAjLU9I,EAiLM6I,UAAA,SAAA,GACAH,EAAA,CAAhBI,KAlLU9I,EAkLM6I,UAAA,YAAA,GACAH,EAAA,CAAhBI,KAnLU9I,EAmLM6I,UAAA,YAAA,GACAH,EAAA,CAAhBI,KApLU9I,EAoLM6I,UAAA,gBAAA,GACAH,EAAA,CAAhBI,KArLU9I,EAqLM6I,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KAtLU9I,EAsLM6I,UAAA,mBAAA,GACAH,EAAA,CAAhBI,KAvLU9I,EAuLM6I,UAAA,aAAA,GACAH,EAAA,CAAhBI,KAxLU9I,EAwLM6I,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KAzLU9I,EAyLM6I,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KA1LU9I,EA0LM6I,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KA3LU9I,EA2LM6I,UAAA,oBAAA,GA3LN7I,EAAN0I,EAAA,CADNK,EAAkB,uBACN/I"}
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'\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 = false\n @property({ type: String }) type: 'single' | 'multiple' | 'sort' = '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 @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 updated(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (changed.has('examExpand') || changed.has('answerList')) { this._syncExamExpand() }\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\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 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 }}>&#x2715;</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 _save(e?: Event) {\n e?.stopImmediatePropagation()\n if (!this._title) { showToast('题目标题不能为空!'); return }\n if (!this._answerCheckType) { showToast('请选择答题设置'); return }\n\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n this._answers.forEach((v, i) => {\n if (!v.title?.trim()) { msg += `选项${this._label(i)}未填写。` }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (this._orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && this._orderList.length < this._leastAnswerCount) {\n showToast(`排序题至少需要设置${this._leastAnswerCount}项排序答案`); return\n }\n }\n\n if (msg) { showToast(msg); return }\n\n const uniqueAnswer = new Set(this._answers.map(a => a.title))\n if (uniqueAnswer.size !== this._answers.length) { showToast('选项不能重复'); return }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1) { showToast('请至少设置两个支持选项'); return }\n if (isSetCorrectAnswer && correctAnswerCount < this._leastAnswerCount) {\n showToast('至少选几项与支持选项数不符'); return\n }\n }\n\n if (this._answerCheckType === 2 || this._answerCheckType === 3) {\n if (!isSetCorrectAnswer) { showToast('请设置支持选项'); return }\n }\n\n this._emit('save', {\n title: this._title,\n answers: this._answers.filter(a => a.title).map((a, i) => ({ ...a, orderIndex: i + 1 })),\n examExpand: this._orderList.map(l => l.charCodeAt(0) - 65 + 1).join(','),\n analysis: this._analysis,\n isSetCorrectAnswer,\n leastAnswerCount: this._leastAnswerCount,\n examRichTextContent: this._showRichText ? this._richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n isKey: this.isKey,\n answerCheckType: this._answerCheckType,\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) }}>&#x2715;</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":["iconPlus","html","iconRemove","iconArrow","showToast","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","QxsSubjectSingle","LitElement","constructor","super","arguments","this","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","_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","length","map","a","connectedCallback","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_syncProps","_syncExamExpand","ids","split","id","answer","find","answerId","toString","String","fromCharCode","filter","Boolean","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_label","i","_titlePlaceholder","_setCorrect","item","val","forEach","_onTitleInput","value","slice","_onAnswerInput","idx","_addAnswer","customAnswerId","uid","_deleteAnswer","index","_","_toggleSortItem","letter","indexOf","l","_removeSortItem","_getSortOrder","pos","_openResultDialog","resultItem","_saveResultDialog","_renderResultDialog","stopPropagation","_save","stopImmediatePropagation","isSetCorrectAnswer","correctAnswerCount","trim","Set","size","answers","charCodeAt","join","examRichTextContent","_renderPreview","typeSuffix","answerRelations","_renderEdit","Number","from","Math","max","n","checked","getContent","render","styles","css","__decorateClass","property","attribute","prototype","state","safeCustomElement"],"mappings":"2lBAgBA,MAAMA,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLACDA,CAAA,yNAClB,MAAME,EAAYF,CAAA,kLAElB,SAASG,EAAUC,GACjB,MAAMC,EAAKC,SAASC,cAAc,OAClCF,EAAGG,YAAcJ,EACjBK,OAAOC,OAAOL,EAAGM,MAAO,CACtBC,SAAU,QAASC,IAAK,OAAQC,KAAM,MAAOC,UAAW,mBACxDC,QAAS,YAAaC,aAAc,MAAOC,SAAU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AAA,CAAhBI,KA7LU1J,EA6LMyJ,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KA9LU1J,EA8LMyJ,UAAA,mBAAA,GACAH,EAAA,CAAhBI,KA/LU1J,EA+LMyJ,UAAA,aAAA,GACAH,EAAA,CAAhBI,KAhMU1J,EAgMMyJ,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KAjMU1J,EAiMMyJ,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAlMU1J,EAkMMyJ,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAnMU1J,EAmMMyJ,UAAA,oBAAA,GAnMNzJ,EAANsJ,EAAA,CADNK,EAAkB,uBACN3J"}
@@ -1,4 +1,4 @@
1
- import{css as e,LitElement as t,html as i}from"lit";import{property as s}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";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=(e,t,i,s)=>{for(var r,o=s>1?void 0:s?a(t,i):t,l=e.length-1;l>=0;l--)(r=e[l])&&(o=(s?r(t,i,o):r(o))||o);return s&&o&&n(t,i,o),o};const p=[{bg:"#ecf5ff",color:"#3D61E3",border:"#d9ecff"},{bg:"#f0f9eb",color:"#67c23a",border:"#c2e7b0"},{bg:"#fdf6ec",color:"#e6a23c",border:"#faecd8"},{bg:"#fef0f0",color:"#f56c6c",border:"#fde2e2"},{bg:"#f4f4f5",color:"#909399",border:"#e9e9eb"}];function d(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)}let c=class extends t{constructor(){super(...arguments),this._iconPlus=i`<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>`,this._iconRemove=i`<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>`,this.orderIndex=0,this.title="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!1,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!0,isIgnoreCase:!0,keywordCount:1},this.answerList=[],this._answers=[{title:"",tag:"",showInput:!1}],this._title="",this._analysis="",this._isInOrder=!0,this._isIgnoreCase=!0,this._keywordCount=1,this._correct="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}updated(e){e.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this.answerList?.length&&(this._answers=this.answerList.map(e=>({title:e.title||"",tag:"",showInput:!1}))),this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase,this._keywordCount=this.examAnswerSetting.keywordCount||1),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.examExpand&&(this._correct=this.examExpand)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_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}_addTag(e){const t={...this._answers[e]};t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),t.showInput=!1,this._answers=this._answers.map((i,s)=>s===e?t:i)}_closeTag(e,t){const i={...this._answers[t]};i.title=i.title.split(",").filter(t=>t!==e).join(","),this._answers=this._answers.map((e,s)=>s===t?i:e)}_addAnswer(){this.isSave||(this._answers=[...this._answers,{title:"",tag:"",showInput:!1}])}_deleteAnswer(e){this._answers.length<2||this.isSave||(this._answers=this._answers.filter((t,i)=>i!==e))}_save(e){if(e?.stopImmediatePropagation(),this._title){if(this._keywordCount||this._correct){if(!this._keywordCount)return void d("请完善答题设置!");if(!this._correct)return void d("请输入问题正确答案!");if(this._answers.length!==this._keywordCount)return void d("关键词个数设置有误!");const e=[];if(this._answers.forEach((t,i)=>{t.title||e.push(`关键词${i+1}未设置`)}),e.length)return void d(e.join(","))}this._emit("save",{title:this._title,answers:this._answers.filter(e=>e.title).map(e=>({title:e.title})),analysis:this._analysis,isSetCorrectAnswer:!!this._correct,isKey:this.isKey,examExpand:this._correct,examAnswerSettingBO:{isIgnoreCase:this._isIgnoreCase,isInOrder:this._isInOrder,keywordCount:this._keywordCount},examRichTextContent:this._showRichText?this._richText:""})}else d("题目标题不能为空!")}_renderPreview(){return i`
1
+ import{css as e,LitElement as t,html as i}from"lit";import{property as s}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";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=(e,t,i,s)=>{for(var r,o=s>1?void 0:s?a(t,i):t,l=e.length-1;l>=0;l--)(r=e[l])&&(o=(s?r(t,i,o):r(o))||o);return s&&o&&n(t,i,o),o};const p=[{bg:"#ecf5ff",color:"#3D61E3",border:"#d9ecff"},{bg:"#f0f9eb",color:"#67c23a",border:"#c2e7b0"},{bg:"#fdf6ec",color:"#e6a23c",border:"#faecd8"},{bg:"#fef0f0",color:"#f56c6c",border:"#fde2e2"},{bg:"#f4f4f5",color:"#909399",border:"#e9e9eb"}];function d(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)}let c=class extends t{constructor(){super(...arguments),this._iconPlus=i`<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>`,this._iconRemove=i`<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>`,this.orderIndex=0,this.title="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!1,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!0,isIgnoreCase:!0,keywordCount:1},this.uploadImage=async e=>new Promise((t,i)=>{const s=new FileReader;s.onload=e=>t(e.target?.result),s.onerror=i,s.readAsDataURL(e)}),this.answerList=[],this._answers=[{title:"",tag:"",showInput:!1}],this._title="",this._analysis="",this._isInOrder=!0,this._isIgnoreCase=!0,this._keywordCount=1,this._correct="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}updated(e){e.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this.answerList?.length&&(this._answers=this.answerList.map(e=>({title:e.title||"",tag:"",showInput:!1}))),this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase,this._keywordCount=this.examAnswerSetting.keywordCount||1),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.examExpand&&(this._correct=this.examExpand)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_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}_addTag(e){const t={...this._answers[e]};t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),t.showInput=!1,this._answers=this._answers.map((i,s)=>s===e?t:i)}_closeTag(e,t){const i={...this._answers[t]};i.title=i.title.split(",").filter(t=>t!==e).join(","),this._answers=this._answers.map((e,s)=>s===t?i:e)}_addAnswer(){this.isSave||(this._answers=[...this._answers,{title:"",tag:"",showInput:!1}])}_deleteAnswer(e){this._answers.length<2||this.isSave||(this._answers=this._answers.filter((t,i)=>i!==e))}_save(e){if(e?.stopImmediatePropagation(),this._title){if(this._keywordCount||this._correct){if(!this._keywordCount)return void d("请完善答题设置!");if(!this._correct)return void d("请输入问题正确答案!");if(this._answers.length!==this._keywordCount)return void d("关键词个数设置有误!");const e=[];if(this._answers.forEach((t,i)=>{t.title||e.push(`关键词${i+1}未设置`)}),e.length)return void d(e.join(","))}this._emit("save",{title:this._title,answers:this._answers.filter(e=>e.title).map(e=>({title:e.title})),analysis:this._analysis,isSetCorrectAnswer:!!this._correct,isKey:this.isKey,examExpand:this._correct,examAnswerSettingBO:{isIgnoreCase:this._isIgnoreCase,isInOrder:this._isInOrder,keywordCount:this._keywordCount},examRichTextContent:this._showRichText?this._richText:""})}else d("题目标题不能为空!")}_renderPreview(){return i`
2
2
  <div class="preview">
3
3
  <span class="title">${this.orderIndex+1}.${this.title}(问答题)</span>
4
4
  ${this.richTextContent?i`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
@@ -97,7 +97,8 @@ import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"..
97
97
  <div class="label"><span>富文本:</span></div>
98
98
  <div style="flex:1">
99
99
  <qxs-blocksuite-editor
100
- content=${this._richText}
100
+ .content=${this._richText}
101
+ .uploadImage=${this.uploadImage}
101
102
  ?is-edit=${!0}
102
103
  ></qxs-blocksuite-editor>
103
104
  <div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>
@@ -225,5 +226,5 @@ import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"..
225
226
  .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }
226
227
  .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
227
228
  .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }
228
- `,l([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),l([s({type:String})],c.prototype,"title",2),l([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),l([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),l([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),l([s({type:Boolean,attribute:"is-key"})],c.prototype,"isKey",2),l([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),l([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),l([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),l([s({type:String})],c.prototype,"analysis",2),l([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),l([s({type:String,attribute:"exam-expand"})],c.prototype,"examExpand",2),l([s({type:Object,attribute:"exam-answer-setting"})],c.prototype,"examAnswerSetting",2),l([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",2),l([r()],c.prototype,"_answers",2),l([r()],c.prototype,"_title",2),l([r()],c.prototype,"_analysis",2),l([r()],c.prototype,"_isInOrder",2),l([r()],c.prototype,"_isIgnoreCase",2),l([r()],c.prototype,"_keywordCount",2),l([r()],c.prototype,"_correct",2),l([r()],c.prototype,"_showRichText",2),l([r()],c.prototype,"_richText",2),c=l([o("qxs-text-fill")],c);export{c as QxsTextFill};
229
+ `,l([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),l([s({type:String})],c.prototype,"title",2),l([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),l([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),l([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),l([s({type:Boolean,attribute:"is-key"})],c.prototype,"isKey",2),l([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),l([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),l([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),l([s({type:String})],c.prototype,"analysis",2),l([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),l([s({type:String,attribute:"exam-expand"})],c.prototype,"examExpand",2),l([s({type:Object,attribute:"exam-answer-setting"})],c.prototype,"examAnswerSetting",2),l([s({type:Object})],c.prototype,"uploadImage",2),l([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",2),l([r()],c.prototype,"_answers",2),l([r()],c.prototype,"_title",2),l([r()],c.prototype,"_analysis",2),l([r()],c.prototype,"_isInOrder",2),l([r()],c.prototype,"_isIgnoreCase",2),l([r()],c.prototype,"_keywordCount",2),l([r()],c.prototype,"_correct",2),l([r()],c.prototype,"_showRichText",2),l([r()],c.prototype,"_richText",2),c=l([o("qxs-text-fill")],c);export{c as QxsTextFill};
229
230
  //# sourceMappingURL=text-fill.mjs.map