@qxs-bns/components-wc 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/es/editor/blocksuite-editor.mjs +14 -14
  2. package/es/editor/blocksuite-editor.mjs.map +1 -1
  3. package/es/subject/action.mjs +18 -18
  4. package/es/subject/action.mjs.map +1 -1
  5. package/es/subject/blank-fill.mjs +128 -49
  6. package/es/subject/blank-fill.mjs.map +1 -1
  7. package/es/subject/layout.mjs +3 -3
  8. package/es/subject/layout.mjs.map +1 -1
  9. package/es/subject/list.mjs +80 -46
  10. package/es/subject/list.mjs.map +1 -1
  11. package/es/subject/page-end.mjs +8 -8
  12. package/es/subject/page-end.mjs.map +1 -1
  13. package/es/subject/scale.mjs +110 -29
  14. package/es/subject/scale.mjs.map +1 -1
  15. package/es/subject/single.mjs +48 -48
  16. package/es/subject/single.mjs.map +1 -1
  17. package/es/subject/text-fill.mjs +139 -98
  18. package/es/subject/text-fill.mjs.map +1 -1
  19. package/lib/editor/blocksuite-editor.cjs +4 -4
  20. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  21. package/lib/subject/action.cjs +18 -18
  22. package/lib/subject/action.cjs.map +1 -1
  23. package/lib/subject/blank-fill.cjs +123 -44
  24. package/lib/subject/blank-fill.cjs.map +1 -1
  25. package/lib/subject/layout.cjs +2 -2
  26. package/lib/subject/layout.cjs.map +1 -1
  27. package/lib/subject/list.cjs +83 -49
  28. package/lib/subject/list.cjs.map +1 -1
  29. package/lib/subject/page-end.cjs +8 -8
  30. package/lib/subject/page-end.cjs.map +1 -1
  31. package/lib/subject/scale.cjs +103 -22
  32. package/lib/subject/scale.cjs.map +1 -1
  33. package/lib/subject/single.cjs +48 -48
  34. package/lib/subject/single.cjs.map +1 -1
  35. package/lib/subject/text-fill.cjs +128 -87
  36. package/lib/subject/text-fill.cjs.map +1 -1
  37. package/package.json +1 -1
@@ -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'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\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: String, attribute: 'custom-id' }) customId = ''\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-add' }) showAdd = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\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 // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (!this.isEdit && (changed.has('title') || changed.has('answerList') || changed.has('analysis') || changed.has('richTextContent') || changed.has('scaleQuestions'))) {\n this._syncProps()\n }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue\n }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._rowTitle = this._scaleQuestions.join('\\n')\n this._richText = this.richTextContent || ''\n this._showRichText = !!this.richTextContent\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'scale', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const rowTitle = this.isEdit ? this._rowTitle : (this.scaleQuestions?.join('\\n') || '')\n const showRichText = this.isEdit ? this._showRichText : !!this.richTextContent\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n\n for (let i = 0; i < answers.length; i++) {\n if (!answers[i].title) {\n reject(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写。`, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n }\n\n if (!rowTitle) {\n reject(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n return\n }\n\n const questions = rowTitle.split('\\n').filter((i: string) => i.trim())\n if (questions.length === 0) {\n reject(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n return\n }\n\n const result: any = {\n answerType: SubjectType.SCALE,\n title,\n analysis,\n answers,\n scaleQuestionList: questions,\n examRichTextContent: showRichText ? richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\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 if (this.useModel) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'scale', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const rowTitle = this.isEdit ? this._rowTitle : (this.scaleQuestions?.join('\\n') || '')\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n\n answers.forEach((a: any, i: number) => {\n if (!a.title) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n })\n\n if (!rowTitle) {\n errors.push(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n }\n else {\n const questions = rowTitle.split('\\n').filter((i: string) => i.trim())\n if (questions.length === 0) {\n errors.push(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n }\n }\n\n return errors\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 ${!this.showAction\n ? html`<div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>`\n : ''}\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout .showEdit=${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 .isEdit=${this.isEdit}\n .isSet=${this.isSet}\n .showAdd=${this.showAdd}\n .showRichText=${this._showRichText}\n .showOtherOption=${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=${() => {\n this._showRichText = !this._showRichText\n if (!this._showRichText) {\n this._richText = ''\n }\n }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","iconRemove","QxsScale","LitElement","constructor","super","arguments","this","orderIndex","title","customId","isEdit","isSave","isSet","showAction","showAdd","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","modelValue","useModel","TITLE_MAX","answerList","v","arr","Array","isArray","length","slice","requestUpdate","scaleQuestions","willUpdate","changed","has","_syncProps","join","toJSON","row","answerType","answers","rowTitle","showRichText","richText","SubjectError","i","String","fromCharCode","questions","split","filter","trim","SubjectType","SCALE","scaleQuestionList","examRichTextContent","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","value","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","forEach","a","_renderPreview","colWidth","Math","floor","map","q","_renderEdit","stopPropagation","x","j","_","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","state","safeCustomElement"],"mappings":"ybAMA,MAAMA,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLAgBZ,IAAME,EAAN,cAAuBC,EAAvBC,WAAAA,GAAAC,SAAAC,WA8DiDC,KAAAC,WAAa,EACvCD,KAAAE,MAAQ,GACgBF,KAAAG,SAAW,GACZH,KAAAI,QAAS,EACTJ,KAAAK,QAAS,EACVL,KAAAM,OAAQ,EACHN,KAAAO,YAAa,EAChBP,KAAAQ,SAAU,EACLR,KAAAS,cAAe,EAC5CT,KAAAU,SAAW,GACqBV,KAAAW,gBAAkB,GACVX,KAAAY,uBAAyB,EAE7FZ,KAAAa,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAAUC,GAAML,EAAQK,EAAEC,QAAQC,QACzCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAoBhB1B,KAAQ2B,SAAgC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UAAA,yBAAA,GAEpEL,EAAA,CADCC,EAAS,CAAEC,KAAM3C,UA1EP7F,EA2EX2I,UAAA,cAAA,GASIL,EAAA,CADHC,EAAS,CAAEC,KAAM3F,MAAO6F,UAAW,iBAnFzB1I,EAoFP2I,UAAA,aAAA,GASAL,EAAA,CADHC,EAAS,CAAEC,KAAM3F,MAAO6F,UAAW,qBA5FzB1I,EA6FP2I,UAAA,iBAAA,GAOaL,EAAA,CAAhBO,KApGU7I,EAoGM2I,UAAA,WAAA,GACAL,EAAA,CAAhBO,KArGU7I,EAqGM2I,UAAA,kBAAA,GACAL,EAAA,CAAhBO,KAtGU7I,EAsGM2I,UAAA,YAAA,GACAL,EAAA,CAAhBO,KAvGU7I,EAuGM2I,UAAA,SAAA,GACAL,EAAA,CAAhBO,KAxGU7I,EAwGM2I,UAAA,YAAA,GACAL,EAAA,CAAhBO,KAzGU7I,EAyGM2I,UAAA,gBAAA,GACAL,EAAA,CAAhBO,KA1GU7I,EA0GM2I,UAAA,YAAA,GAGqCL,EAAA,CAArDC,EAAS,CAAEC,KAAMvE,OAAQyE,UAAW,iBA7G1B1I,EA6G2C2I,UAAA,aAAA,GACDL,EAAA,CAApDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,eA9G3B1I,EA8G0C2I,UAAA,WAAA,GA9G1C3I,EAANsI,EAAA,CADNQ,EAAkB,cACN9I"}
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'\nimport { type Category, type Resource, SubjectError, type TagItem } from './single'\nimport { SubjectType } from './types'\n\ninterface ScaleAnswer {\n title: string\n answerId?: string | number\n [key: string]: any\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>`\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 { height: 200px; }\n .section-row { margin-top: 12px; }\n .value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }\n .tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }\n .tag-item {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 4px 8px; font-size: 12px; line-height: 1;\n color: #3D61E3; background: #ecf5ff; border: 1px solid #d9ecff; border-radius: 4px;\n }\n .tag-item .close { cursor: pointer; color: #909399; }\n .tag-item .close:hover { color: #f56c6c; }\n .tag-hint { font-size: 12px; color: #909399; }\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 .resource-summary { font-size: 12px; color: #606266; }\n .resource-thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }\n .resource-thumb {\n width: 72px; height: 72px; object-fit: cover; border-radius: 6px;\n border: 1px solid #e4e7ed; background: #f5f7fa;\n }\n `\n\n @property({ type: Number, attribute: 'order-index' }) 'order-index' = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-save' }) 'is-save' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = true\n @property({ type: String }) analysis = ''\n @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n @property({ type: Number, attribute: 'exam-id' }) 'exam-id' = 0\n @property({ type: String, attribute: 'category-id' }) 'category-id' = ''\n @property({ type: Array, attribute: 'tag-list' }) 'tag-list': TagItem[] = []\n @property({ type: Array, attribute: 'category-list' }) 'category-list': Category[] = []\n @property({ type: Array, attribute: 'resource-list' }) 'resource-list': Resource[] = []\n @property({ type: Boolean, attribute: 'show-tag' }) 'show-tag' = false\n @property({ type: Boolean, attribute: 'show-category' }) 'show-category' = false\n @property({ type: Boolean, attribute: 'show-resource' }) 'show-resource' = false\n @property({ type: Object, attribute: 'upload-image' })\n 'upload-image': (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 'answer-list'() { return this._answers }\n\n set 'answer-list'(value: any) {\n const arr = Array.isArray(value) ? value : []\n this._answers = arr.length ? arr.slice(0, 5) : [{ title: '' }, { title: '' }, { title: '' }, { title: '' }, { title: '' }]\n this.requestUpdate('answer-list')\n }\n\n @property({ type: Array, attribute: 'scale-questions' })\n get 'scale-questions'() { return this._scaleQuestions }\n\n set 'scale-questions'(value: any) {\n this._scaleQuestions = Array.isArray(value) && value.length ? value : ['问题1']\n this.requestUpdate('scale-questions')\n }\n\n @state() private _answers: ScaleAnswer[] = [{ 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 @state() private _selectedTagList: TagItem[] = []\n @state() private _categoryId = ''\n\n @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = false\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('is-edit') && this['is-edit']) { this._syncProps() }\n if (!this['is-edit'] && (changed.has('title') || changed.has('answer-list') || changed.has('analysis') || changed.has('rich-text-content') || changed.has('scale-questions') || changed.has('tag-list') || changed.has('category-id'))) {\n this._syncProps()\n }\n if (changed.has('model-value') && this['use-model']) {\n this._title = this['model-value']\n }\n if (changed.has('tag-list')) {\n this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n }\n if (changed.has('category-id')) {\n this._categoryId = this['category-id'] ? String(this['category-id']) : ''\n }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._rowTitle = this._scaleQuestions.join('\\n')\n this._richText = this['rich-text-content'] || ''\n this._showRichText = !!this['rich-text-content']\n this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n this._categoryId = this['category-id'] ? String(this['category-id']) : ''\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 if (this['use-model']) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private _removeTag(tagId: string | number) {\n this._selectedTagList = this._selectedTagList.filter(item => String(item.tagId) !== String(tagId))\n this._emit('tag-change', {\n value: this._selectedTagList,\n customId: this['custom-id'] || '',\n examId: this['exam-id'] || 0,\n })\n }\n\n private _chooseTag() {\n this._emit('choose-tag', {\n value: this._selectedTagList,\n customId: this['custom-id'] || '',\n examId: this['exam-id'] || 0,\n })\n }\n\n private _onCategoryChange(value: string) {\n this._categoryId = value\n this._emit('category-change', {\n value,\n customId: this['custom-id'] || '',\n examId: this['exam-id'] || 0,\n })\n }\n\n private _imageResources() {\n return (this['resource-list'] || [])\n .filter(item => item.resourceType === 1)\n .map(item => item.resource.middle || item.resource.url)\n .filter(Boolean) as string[]\n }\n\n private _videoResource() {\n return (this['resource-list'] || []).find(item => item.resourceType === 2)?.resource || null\n }\n\n private _categoryLabel() {\n const matched = this['category-list'].find((item: any) => String(item.categoryId) === String(this._categoryId))\n return matched?.title || matched?.categoryName || this._categoryId || '未选择分类'\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this['custom-id'] || undefined, answerType: 'scale', orderIndex: this['order-index'] }\n\n const title = this['is-edit'] ? this._title : this.title || ''\n const answers = this['is-edit'] ? this._answers : (this['answer-list'] || [])\n const analysis = this['is-edit'] ? this._analysis : this.analysis || ''\n const rowTitle = this['is-edit'] ? this._rowTitle : (this['scale-questions']?.join('\\n') || '')\n const showRichText = this['is-edit'] ? this._showRichText : !!this['rich-text-content']\n const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n const selectedTagList = this._selectedTagList || []\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n\n for (let i = 0; i < answers.length; i++) {\n if (!answers[i].title) {\n reject(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写。`, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n }\n\n if (!rowTitle) {\n reject(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n return\n }\n\n const questions = rowTitle.split('\\n').filter((item: string) => item.trim())\n if (questions.length === 0) {\n reject(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n return\n }\n\n const result: any = {\n answerType: SubjectType.SCALE,\n title,\n analysis,\n answers,\n scaleQuestionList: questions,\n examRichTextContent: showRichText ? richText : '',\n examAnswerRelationType: this['exam-answer-relation-type'],\n categoryId: this._categoryId || '',\n memberTagInfo: selectedTagList,\n tagInfos: selectedTagList,\n resourceList: this['resource-list'] || [],\n examResourceBOList: this['resource-list'] || [],\n isSetCorrectAnswer: false,\n }\n if (this['custom-id']) { result.customId = this['custom-id'] }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this['custom-id'] || undefined, answerType: 'scale', orderIndex: this['order-index'] }\n\n const title = this['is-edit'] ? this._title : this.title || ''\n const answers = this['is-edit'] ? this._answers : (this['answer-list'] || [])\n const rowTitle = this['is-edit'] ? this._rowTitle : (this['scale-questions']?.join('\\n') || '')\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n\n answers.forEach((answer: any, index: number) => {\n if (!answer.title) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + index)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n })\n\n if (!rowTitle) {\n errors.push(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n }\n else {\n const questions = rowTitle.split('\\n').filter((item: string) => item.trim())\n if (questions.length === 0) {\n errors.push(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n }\n }\n\n return errors\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['order-index'] + 1}.${this.title}(量表题)</span>\n ${this['rich-text-content'] ? html`<div style=\"margin-top:8px\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n <table class=\"scale-table\">\n <thead><tr>\n <th style=\"width:${colWidth}%\">问题 \\ 选项</th>\n ${this._answers.map(answer => html`<th style=\"width:${colWidth}%\">${answer.title}</th>`)}\n </tr></thead>\n <tbody>\n ${this._scaleQuestions.map(question => html`\n <tr><td>${question}</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 ${this['show-category'] && this._categoryId\n ? html`<div class=\"section-row\"><span class=\"value-text\">分类:${this._categoryLabel()}</span></div>`\n : ''}\n ${this['show-tag'] && this._selectedTagList.length\n ? html`\n <div class=\"section-row\">\n <span class=\"value-text\">标签/关键信息:</span>\n <div class=\"tag-list\" style=\"margin-top:6px\">\n ${this._selectedTagList.map(item => html`<span class=\"tag-item\">${item.tagName}</span>`)}\n </div>\n </div>\n `\n : ''}\n ${this._renderResourceSection()}\n </div>\n `\n }\n\n private _renderTagSection() {\n if (!this['show-tag']) { return '' }\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>标签:</span></div>\n <div style=\"flex:1\">\n <div class=\"tag-list\">\n ${this._selectedTagList.length\n ? this._selectedTagList.map(item => html`\n <span class=\"tag-item\">\n ${item.tagName}\n ${!this['is-save'] ? html`<span class=\"close\" @click=${() => this._removeTag(item.tagId)}>×</span>` : ''}\n </span>\n `)\n : html`<span class=\"tag-hint\">暂无标签/关键信息</span>`}\n </div>\n ${this['is-edit'] && !this['is-save']\n ? html`<div style=\"margin-top:8px\"><span class=\"el-link\" @click=${() => this._chooseTag()}>选择</span></div>`\n : ''}\n </div>\n </div>\n `\n }\n\n private _renderCategorySection() {\n if (!this['show-category']) { return '' }\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>分类:</span></div>\n <div style=\"flex:1\">\n ${this['is-edit']\n ? html`\n <select class=\"el-select\" .value=${String(this._categoryId)} ?disabled=${this['is-save']}\n @change=${(e: Event) => this._onCategoryChange((e.target as HTMLSelectElement).value)}>\n <option value=\"\">选择分类</option>\n ${this['category-list'].map((item: any) => html`\n <option value=${String(item.categoryId)} ?selected=${String(item.categoryId) === String(this._categoryId)}>${item.title || item.categoryName}</option>\n `)}\n </select>\n `\n : html`<span class=\"value-text\">${this._categoryLabel()}</span>`}\n </div>\n </div>\n `\n }\n\n private _renderResourceSection() {\n if (!this['show-resource']) { return '' }\n const images = this._imageResources()\n const video = this._videoResource()\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>资源:</span></div>\n <div style=\"flex:1\">\n <div class=\"resource-summary\">图片 ${images.length} 张${video?.url ? ',含视频资源' : ''}</div>\n ${images.length\n ? html`\n <div class=\"resource-thumbs\">\n ${images.slice(0, 4).map(src => html`<img class=\"resource-thumb\" src=${src} alt=\"resource\" />`)}\n </div>\n `\n : ''}\n ${video?.url ? html`<div style=\"margin-top:8px\"><a class=\"el-link\" href=${video.url} target=\"_blank\" rel=\"noreferrer\">查看视频</a></div>` : ''}\n ${!images.length && !video?.url ? html`<div class=\"tag-hint\">暂无资源</div>` : ''}\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['is-save']}\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 ${this._renderTagSection()}\n\n ${this._renderCategorySection()}\n\n ${this._renderResourceSection()}\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['is-save']}\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((answer, index) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${String.fromCharCode(65 + index)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${answer.title} ?disabled=${this['is-save']}\n maxlength=\"10\"\n @input=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? { ...item, title: value } : item)\n }}\n placeholder=\"选项${index + 1}\" />\n </div>\n ${!this['is-save']\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((_, currentIndex) => currentIndex !== index) }\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['is-save']}\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 .upload-image=${this['upload-image']}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n ${!this['show-action']\n ? html`<div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>`\n : ''}\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout .show-edit=${this['is-edit']}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this['show-action']\n ? html`\n <qxs-subject-action\n .is-edit=${this['is-edit']}\n .is-set=${this['is-set']}\n .show-add=${this['show-add']}\n .show-rich-text=${this._showRichText}\n .show-other-option=${false}\n exam-answer-relation-type=${this['exam-answer-relation-type']}\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=${() => {\n this._showRichText = !this._showRichText\n if (!this._showRichText) {\n this._richText = ''\n }\n }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","iconRemove","QxsScale","LitElement","constructor","super","arguments","this","title","analysis","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","_scaleQuestions","_rowTitle","_title","_analysis","_showRichText","_richText","_selectedTagList","_categoryId","TITLE_MAX","value","arr","Array","isArray","length","slice","requestUpdate","willUpdate","changed","has","_syncProps","map","item","String","join","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","_removeTag","tagId","filter","customId","examId","_chooseTag","_onCategoryChange","_imageResources","resourceType","resource","middle","url","Boolean","_videoResource","find","_categoryLabel","matched","categoryId","categoryName","toJSON","row","answerType","orderIndex","answers","rowTitle","showRichText","richText","selectedTagList","SubjectError","i","fromCharCode","questions","split","trim","SubjectType","SCALE","scaleQuestionList","examRichTextContent","examAnswerRelationType","memberTagInfo","tagInfos","resourceList","examResourceBOList","isSetCorrectAnswer","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","forEach","answer","index","_renderPreview","colWidth","Math","floor","question","tagName","_renderResourceSection","_renderTagSection","_renderCategorySection","images","video","src","_renderEdit","stopPropagation","currentIndex","_","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","state","safeCustomElement"],"mappings":"ybAYA,MAAMA,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLAgBZ,IAAME,EAAN,cAAuBC,EAAvBC,WAAAA,GAAAC,SAAAC,WAmFiDC,KAAA,eAAgB,EAC1CA,KAAAC,MAAQ,GACgBD,KAAA,aAAc,GACfA,KAAA,YAAY,EACZA,KAAA,YAAY,EACbA,KAAA,WAAW,EACNA,KAAA,gBAAgB,EACnBA,KAAA,aAAa,EACRA,KAAA,kBAAkB,EAC/CA,KAAAE,SAAW,GACqBF,KAAA,qBAAsB,GACdA,KAAA,6BAA8B,EAChDA,KAAA,WAAY,EACRA,KAAA,eAAgB,GACpBA,KA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ACDL,EAAA,CAApDC,EAAS,CAAEC,KAAMzF,QAAS2F,UAAW,eA7I3B9J,EA6I0C+J,UAAA,YAAA,GA7I1C/J,EAAN0J,EAAA,CADNO,EAAkB,cACNjK"}
@@ -1,4 +1,4 @@
1
- import{html as e,css as t,LitElement as s}from"lit";import{property as i,state as r}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";import{uid as a}from"../base/uid.mjs";var n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,h=(e,t,s,i)=>{for(var r,o=i>1?void 0:i?l(t,s):t,a=e.length-1;a>=0;a--)(r=e[a])&&(o=(i?r(t,s,o):r(o))||o);return i&&o&&n(t,s,o),o};class c extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VALIDATION_ERROR",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;super(e),this.code=t,this.field=s,this.row=i,this.name="SubjectError"}static from(e){return new c(e.message,e.code,e.field,e.row)}}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>`,p=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>`,u=e`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>`;function g(e){return e.replace(/^\d+\.\s*/,"").replace(/[\s,,。.!!??;;::、'"“”‘’()()\[\]【】\-_/\\]+/g,"").toLowerCase()}function m(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}let w=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.showAdd=!0,this.showAnswerSetting=!1,this.showKey=!1,this.showAnalysis=!0,this.type="single",this.answerCheckType=1,this.examAnswerRelationType=0,this.richTextContent="",this.analysis="",this.leastAnswerCount=0,this.examExpand="",this.customId="",this.examId=0,this.categoryId="",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.tagList=[],this.categoryList=[],this.aiAnswer="",this.resourceList=[],this.showTag=!1,this.showCategory=!1,this.showAi=!1,this.showResource=!1,this.showJump=!1,this.hasJump=!1,this.searchApi="",this.modelValue="",this.useModel=!1,this._answers=[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.title="",this._title="",this._analysis="",this._richText="",this._showRichText=!1,this._leastAnswerCount=0,this._answerCheckType=1,this._isKey=!1,this._orderList=[],this._selectedTagList=[],this._categoryId="",this._searchResults=[],this._searchOpen=!1,this._searchLoading=!1,this._resultDialogOpen=!1,this._resultDialogIndex=0,this._resultDialogValue="",this._sortDropdownOpen=!1,this._imageViewerOpen=!1,this._imageViewerIndex=0,this._videoViewerOpen=!1,this._correctHintDialogOpen=!1,this._hasShownCorrectHint=!1,this._searchTimer=null,this._searchToken=0,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper"),i=this.shadowRoot?.querySelector(".search-wrap");s&&!t.includes(s)&&(this._sortDropdownOpen=!1),i&&!t.includes(i)&&(this._searchOpen=!1),this.requestUpdate()}}get answerList(){return this._answers}set answerList(e){if(this.isEdit)return;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),this._syncExternalProps()}firstUpdated(){this._syncExternalProps()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null)}willUpdate(e){e.has("isEdit")&&this.isEdit&&this._syncProps(),!this.isEdit&&(e.has("title")||e.has("answerList")||e.has("analysis")||e.has("leastAnswerCount")||e.has("answerCheckType")||e.has("tagList")||e.has("categoryId")||e.has("richTextContent"))&&this._syncExternalProps(),e.has("isKey")&&(this._isKey=this.isKey),e.has("tagList")&&(this._selectedTagList=Array.isArray(this.tagList)?this.tagList.map(e=>({...e})):[]),e.has("categoryId")&&(this._categoryId=this.categoryId?String(this.categoryId):""),(e.has("examExpand")||e.has("answerList"))&&this._syncExamExpand(),e.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=Number(this.leastAnswerCount)||0,this._answerCheckType=this.answerCheckType||1,this._isKey=this.isKey,this._selectedTagList=Array.isArray(this.tagList)?this.tagList.map(e=>({...e})):[],this._categoryId=this.categoryId?String(this.categoryId):"",this._richText=this.richTextContent||"",this._showRichText=!!this.richTextContent,this.answerList?.length&&(this._answers=this.answerList.map(e=>({...e,title:e.title||"",isCorrect:!!e.isCorrect})))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=Number(this.leastAnswerCount)||0,this._answerCheckType=this.answerCheckType||1,this._isKey=this.isKey,this._selectedTagList=Array.isArray(this.tagList)?this.tagList.map(e=>({...e})):[],this._categoryId=this.categoryId?String(this.categoryId):"",this._richText=this.richTextContent||"",this._showRichText=!!this.richTextContent,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(","),t=this.answerList;this._orderList=e.map(e=>{const s=t.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return s>=0?this._label(s):""}).filter(Boolean)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_searchAnswerType(){return"single"===this.type?0:"multiple"===this.type?1:5}_queueSearch(e){this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null);const t=e.trim();if(!t||!this.searchApi&&"function"!=typeof this.searchHandler)return this._searchResults=[],this._searchOpen=!1,void(this._searchLoading=!1);this._searchTimer=window.setTimeout(()=>{this._runSearch(t)},300)}async _runSearch(e){const t=++this._searchToken;this._searchLoading=!0,this._searchOpen=!0,this.requestUpdate();try{let s=[];if("function"==typeof this.searchHandler)s=await this.searchHandler(e,this._searchAnswerType());else if(this.searchApi){const t=new URLSearchParams({searchKey:e,answerType:String(this._searchAnswerType())}),i=await fetch(`${this.searchApi}${this.searchApi.includes("?")?"&":"?"}${t.toString()}`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const r=await i.json();s=(Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[]).map(e=>({...e,value:e?.value||e?.title||""}))}if(t!==this._searchToken)return;this._searchResults=Array.isArray(s)?s:[]}catch(e){if(t!==this._searchToken)return;this._searchResults=[],m(e?.message||"题库搜索失败")}finally{t===this._searchToken&&(this._searchLoading=!1,this.requestUpdate())}}_selectSearchResult(e){const t=e.value||e.title||"";this._title=t,this._searchResults=[],this._searchOpen=!1,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title})),this._emit("title-select",{...e,id:e.id??e.examId??e.questionId,title:e.title||t,value:t,customId:this.customId||""})}_applyAiAnswer(){if(!this.aiAnswer?.trim())return void m("暂无 AI 推荐答案");const e=this.aiAnswer.split(/\r?\n/).map(e=>g(e)).filter(Boolean);let t=0;if("single"===this.type){let s=!1;this._answers=this._answers.map(i=>{const r=!s&&e.includes(g(i.title||""));return r&&(s=!0,t++),{...i,isCorrect:r}})}else this._answers=this._answers.map(s=>{const i=e.includes(g(s.title||""));return i&&t++,{...s,isCorrect:i}});t?this.requestUpdate():m("未找到匹配的选项,请检查选项内容是否一致")}_removeTag(e){this._selectedTagList=this._selectedTagList.filter(t=>String(t.tagId)!==String(e)),this._emit("tag-change",{value:this._selectedTagList,customId:this.customId||"",examId:this.examId||0})}_chooseTag(){this._emit("choose-tag",{value:this._selectedTagList,customId:this.customId||"",examId:this.examId||0})}_onCategoryChange(e){this._categoryId=e,this._emit("category-change",{value:e,customId:this.customId||"",examId:this.examId||0})}_setRelation(e,t){const s=e.customAnswerId?{...e}:{...e,customAnswerId:e.answerId||a()};this._answers=this._answers.map((e,i)=>i===t?s:e),this.requestUpdate(),this._emit("set-relation",{customId:this.customId||"",examId:this.examId||0,answerIndex:t,answer:s})}_relationLength(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,t)=>e+(Array.isArray(t?.relationAnswers)?t.relationAnswers.length:0),0)}_imageResources(){return(this.resourceList||[]).filter(e=>1===e.resourceType).map(e=>e.resource.middle||e.resource.url).filter(Boolean)}_videoResource(){return(this.resourceList||[]).find(e=>2===e.resourceType)?.resource||null}_openImageViewer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._imageResources().length&&(this._imageViewerIndex=e,this._imageViewerOpen=!0)}_closeImageViewer(){this._imageViewerOpen=!1}_moveImage(e){const t=this._imageResources();t.length&&(this._imageViewerIndex=(this._imageViewerIndex+e+t.length)%t.length)}_openVideoViewer(){this._videoResource()?.url&&(this._videoViewerOpen=!0)}_closeVideoViewer(){this._videoViewerOpen=!1}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){"single"===this.type?(this._answers.forEach(e=>{e.isCorrect=!1}),e.isCorrect=t):e.isCorrect=t,this.requestUpdate()}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value,this._queueSearch(this._title),this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_onAnswerInput(e,t){const s=e.target;s.value.length>this.ANSWER_MAX&&(s.value=s.value.slice(0,this.ANSWER_MAX)),this._answers[t].title=s.value,this.requestUpdate()}_addAnswer(e){if(this.isSave)return;const t=[...this._answers];t.splice(e+1,0,{title:"",isCorrect:!1,customAnswerId:a()}),this._answers=t}_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}_sortAnswerValue(e){const t=e.charCodeAt(0)-65,s=this._answers[t];return s?.answerId??t+1}_shouldShowCorrectHint(){return"sort"===this.type?!this._orderList.length:!this._answers.some(e=>!!e.isCorrect)}async toJSON(){return new Promise((e,t)=>{const s={customId:this.customId||void 0,answerType:this.type,orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title||"",r=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._answerCheckType:this.answerCheckType||1,a=this.isEdit?this._leastAnswerCount:Number(this.leastAnswerCount)||0,n=this.isEdit?this._analysis:this.analysis||"",l=this._selectedTagList||[],h=this.isEdit?this._orderList.map(e=>this._sortAnswerValue(e)).join(","):this.examExpand||"",d=this.isEdit?this._showRichText:!!this.richTextContent,p=this.isEdit?this._richText:this.richTextContent||"",u=this.isEdit?this._orderList:(()=>{const e=this.examExpand;return e?e.split(",").map(e=>{const t=this.answerList?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();if(!i)return void t(new c("题目标题不能为空!","EMPTY_TITLE","title",s));if(this.showTag&&0===l.length)return void t(new c("请选择标签/关键信息","EMPTY_TAGS","tagList",s));if(!o)return void t(new c("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",s));let g="",m=!1,w=0;if("multiple"===this.type||"single"===this.type)r.forEach((e,t)=>{e.title?.trim()||(g+=`选项${String.fromCharCode(65+t)}未填写。`),e.isCorrect&&(m=!0,w++)});else if("sort"===this.type&&(u.length&&(m=!0),m&&u.length<a))return void t(new c(`排序题至少需要设置${a}项排序答案`,"SORT_COUNT_INVALID","orderList",s));if(g)return void t(new c(g,"ANSWER_EMPTY","answers",s));if(new Set(r.map(e=>e.title)).size!==r.length)return void t(new c("选项不能重复","DUPLICATE_ANSWERS","answers",s));if("multiple"===this.type){if(1===w)return void t(new c("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",s));if(m&&w<a)return void t(new c("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))}if((2===o||3===o)&&!m)return void t(new c("请设置支持选项","NO_CORRECT_ANSWER","answers",s));const x={answerType:String(this.type),title:i,answers:r.filter(e=>e.title).map((e,t)=>({...e,orderIndex:t+1})),examExpand:h,analysis:n,isSetCorrectAnswer:m,leastAnswerCount:a||"",examRichTextContent:d?p:"",examAnswerRelationType:this.examAnswerRelationType,isKey:this._isKey,answerCheckType:o,categoryId:this._categoryId||"",memberTagInfo:l,tagInfos:l,aiAnswer:this.aiAnswer||"",resourceList:this.resourceList||[],examResourceBOList:this.resourceList||[]};this.customId&&(x.customId=this.customId),e(x)})}validate(){const e=[],t={customId:this.customId||void 0,answerType:this.type,orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",i=this.isEdit?this._answers:this.answerList||[],r=this.isEdit?this._answerCheckType:this.answerCheckType||1,o=this.isEdit?this._leastAnswerCount:Number(this.leastAnswerCount)||0,a=this._selectedTagList||[],n=this.isEdit?this._orderList:(()=>{const e=this.examExpand;return e?e.split(",").map(e=>{const t=this.answerList?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();s||e.push(new c("题目标题不能为空!","EMPTY_TITLE","title",t)),this.showTag&&0===a.length&&e.push(new c("请选择标签/关键信息","EMPTY_TAGS","tagList",t)),r||e.push(new c("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",t));let l=!1,h=0;"multiple"===this.type||"single"===this.type?i.forEach((s,i)=>{s.title?.trim()||e.push(new c(`选项${String.fromCharCode(65+i)}未填写`,"ANSWER_EMPTY","answers",t)),s.isCorrect&&(l=!0,h++)}):"sort"===this.type&&(n.length&&(l=!0),l&&n.length<o&&e.push(new c(`排序题至少需要设置${o}项排序答案`,"SORT_COUNT_INVALID","orderList",t)));return new Set(i.map(e=>e.title)).size!==i.length&&i.length>0&&e.push(new c("选项不能重复","DUPLICATE_ANSWERS","answers",t)),"multiple"===this.type&&(1===h&&i.length>0&&e.push(new c("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",t)),l&&h<o&&e.push(new c("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",t))),2!==r&&3!==r||l||e.push(new c("请设置支持选项","NO_CORRECT_ANSWER","answers",t)),e}_openResultDialog(e){this._resultDialogIndex=e,this._resultDialogValue=this._answers[e].resultItem||"",this._resultDialogOpen=!0}_saveResultDialog(){this._answers[this._resultDialogIndex].resultItem=this._resultDialogValue,this._resultDialogOpen=!1,this.requestUpdate()}_renderCorrectHintDialog(){return this._correctHintDialogOpen?e`
1
+ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state as r}from"lit/decorators.js";import{safeCustomElement as a}from"../base/define.mjs";import{uid as o}from"../base/uid.mjs";var n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,c=(e,t,s,i)=>{for(var r,a=i>1?void 0:i?l(t,s):t,o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i?r(t,s,a):r(a))||a);return i&&a&&n(t,s,a),a};class h extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"VALIDATION_ERROR",s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0;super(e),this.code=t,this.field=s,this.row=i,this.name="SubjectError"}static from(e){return new h(e.message,e.code,e.field,e.row)}}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>`,p=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>`,u=e`<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="6 9 12 15 18 9"/></svg>`;function g(e){return e.replace(/^\d+\.\s*/,"").replace(/[\s,,。.!!??;;::、'"“”‘’()()[\]【】\-_/\\]+/g,"").toLowerCase()}function m(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}let w=class extends s{constructor(){super(...arguments),this["order-index"]=0,this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-analysis"]=!0,this.type="single",this["answer-check-type"]=1,this["exam-answer-relation-type"]=0,this["rich-text-content"]="",this.analysis="",this["least-answer-count"]=0,this["exam-expand"]="",this["custom-id"]="",this["exam-id"]=0,this["category-id"]="",this["upload-image"]=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this["tag-list"]=[],this["category-list"]=[],this["ai-answer"]="",this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-ai"]=!1,this["show-resource"]=!1,this["show-jump"]=!1,this["has-jump"]=!1,this["search-api"]="",this["model-value"]="",this["use-model"]=!1,this._answers=[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.title="",this._title="",this._analysis="",this._richText="",this._showRichText=!1,this._leastAnswerCount=0,this._answerCheckType=1,this._isKey=!1,this._orderList=[],this._selectedTagList=[],this._categoryId="",this._searchResults=[],this._searchOpen=!1,this._searchLoading=!1,this._resultDialogOpen=!1,this._resultDialogIndex=0,this._resultDialogValue="",this._sortDropdownOpen=!1,this._imageViewerOpen=!1,this._imageViewerIndex=0,this._videoViewerOpen=!1,this._correctHintDialogOpen=!1,this._hasShownCorrectHint=!1,this._searchTimer=null,this._searchToken=0,this.TITLE_MAX=200,this.ANSWER_MAX=100,this._handleDocumentClick=e=>{const t=e.composedPath(),s=this.shadowRoot?.querySelector(".multi-select-wrapper"),i=this.shadowRoot?.querySelector(".search-wrap");s&&!t.includes(s)&&(this._sortDropdownOpen=!1),i&&!t.includes(i)&&(this._searchOpen=!1),this.requestUpdate()}}get"answer-list"(){return this._answers}set"answer-list"(e){if(this["is-edit"])return;const t=Array.isArray(e)?e:[];this._answers=t.length?t.map(e=>({...e})):[{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1},{title:"",isCorrect:!1}],this.requestUpdate("answer-list")}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick),this._syncExternalProps()}firstUpdated(){this._syncExternalProps()}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick),this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null)}willUpdate(e){e.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(e.has("title")||e.has("answer-list")||e.has("analysis")||e.has("least-answer-count")||e.has("answer-check-type")||e.has("tag-list")||e.has("category-id")||e.has("rich-text-content"))&&this._syncExternalProps(),e.has("is-key")&&(this._isKey=this["is-key"]),e.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[]),e.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):""),(e.has("exam-expand")||e.has("answer-list"))&&this._syncExamExpand(),e.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_syncExternalProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=Number(this["least-answer-count"])||0,this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>({...e,title:e.title||"",isCorrect:!!e.isCorrect})))}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._leastAnswerCount=Number(this["least-answer-count"])||0,this._answerCheckType=this["answer-check-type"]||1,this._isKey=this["is-key"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(e=>({...e})):[],this._categoryId=this["category-id"]?String(this["category-id"]):"",this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this["answer-list"]?.length&&(this._answers=this["answer-list"].map(e=>({...e,title:e.title||"",isCorrect:!!e.isCorrect}))),this._syncExamExpand()}_syncExamExpand(){if(!this["exam-expand"]||!this["answer-list"]?.length)return;const e=this["exam-expand"].split(","),t=this["answer-list"];this._orderList=e.map(e=>{const s=t.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return s>=0?this._label(s):""}).filter(Boolean)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_searchAnswerType(){return"single"===this.type?0:"multiple"===this.type?1:5}_queueSearch(e){this._searchTimer&&(window.clearTimeout(this._searchTimer),this._searchTimer=null);const t=e.trim();if(!t||!this["search-api"]&&"function"!=typeof this["search-handler"])return this._searchResults=[],this._searchOpen=!1,void(this._searchLoading=!1);this._searchTimer=window.setTimeout(()=>{this._runSearch(t)},300)}async _runSearch(e){const t=++this._searchToken;this._searchLoading=!0,this._searchOpen=!0,this.requestUpdate();try{let s=[];if("function"==typeof this["search-handler"])s=await this["search-handler"](e,this._searchAnswerType());else if(this["search-api"]){const t=new URLSearchParams({searchKey:e,answerType:String(this._searchAnswerType())}),i=await fetch(`${this["search-api"]}${this["search-api"].includes("?")?"&":"?"}${t.toString()}`);if(!i.ok)throw new Error(`HTTP ${i.status}`);const r=await i.json();s=(Array.isArray(r)?r:Array.isArray(r?.data)?r.data:[]).map(e=>({...e,value:e?.value||e?.title||""}))}if(t!==this._searchToken)return;this._searchResults=Array.isArray(s)?s:[]}catch(e){if(t!==this._searchToken)return;this._searchResults=[],m(e?.message||"题库搜索失败")}finally{t===this._searchToken&&(this._searchLoading=!1,this.requestUpdate())}}_selectSearchResult(e){const t=e.value||e.title||"";this._title=t,this._searchResults=[],this._searchOpen=!1,this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title})),this._emit("title-select",{...e,id:e.id??e.examId??e.questionId,title:e.title||t,value:t,customId:this["custom-id"]||""})}_applyAiAnswer(){if(!this["ai-answer"]?.trim())return void m("暂无 AI 推荐答案");const e=this["ai-answer"].split(/\r?\n/).map(e=>g(e)).filter(Boolean);let t=0;if("single"===this.type){let s=!1;this._answers=this._answers.map(i=>{const r=!s&&e.includes(g(i.title||""));return r&&(s=!0,t++),{...i,isCorrect:r}})}else this._answers=this._answers.map(s=>{const i=e.includes(g(s.title||""));return i&&t++,{...s,isCorrect:i}});t?this.requestUpdate():m("未找到匹配的选项,请检查选项内容是否一致")}_removeTag(e){this._selectedTagList=this._selectedTagList.filter(t=>String(t.tagId)!==String(e)),this._emit("tag-change",{value:this._selectedTagList,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_chooseTag(){this._emit("choose-tag",{value:this._selectedTagList,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_onCategoryChange(e){this._categoryId=e,this._emit("category-change",{value:e,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_setRelation(e,t){const s=e.customAnswerId?{...e}:{...e,customAnswerId:e.answerId||o()};this._answers=this._answers.map((e,i)=>i===t?s:e),this.requestUpdate(),this._emit("set-relation",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerIndex:t,answer:s})}_relationLength(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).reduce((e,t)=>e+(Array.isArray(t?.relationAnswers)?t.relationAnswers.length:0),0)}_imageResources(){return(this["resource-list"]||[]).filter(e=>1===e.resourceType).map(e=>e.resource.middle||e.resource.url).filter(Boolean)}_videoResource(){return(this["resource-list"]||[]).find(e=>2===e.resourceType)?.resource||null}_openImageViewer(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this._imageResources().length&&(this._imageViewerIndex=e,this._imageViewerOpen=!0)}_closeImageViewer(){this._imageViewerOpen=!1}_moveImage(e){const t=this._imageResources();t.length&&(this._imageViewerIndex=(this._imageViewerIndex+e+t.length)%t.length)}_openVideoViewer(){this._videoResource()?.url&&(this._videoViewerOpen=!0)}_closeVideoViewer(){this._videoViewerOpen=!1}_label(e){return String.fromCharCode(65+e)}get _titlePlaceholder(){return"single"===this.type?"单选题":"multiple"===this.type?"多选题":"排序题"}_setCorrect(e,t){"single"===this.type?(this._answers.forEach(e=>{e.isCorrect=!1}),e.isCorrect=t):e.isCorrect=t,this.requestUpdate()}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value,this._queueSearch(this._title),this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_onAnswerInput(e,t){const s=e.target;s.value.length>this.ANSWER_MAX&&(s.value=s.value.slice(0,this.ANSWER_MAX)),this._answers[t].title=s.value,this.requestUpdate()}_addAnswer(e){if(this["is-save"])return;const t=[...this._answers];t.splice(e+1,0,{title:"",isCorrect:!1,customAnswerId:o()}),this._answers=t}_deleteAnswer(e){this._answers.length<3||this["is-save"]||(this._answers=this._answers.filter((t,s)=>s!==e))}_toggleSortItem(e){const t=this._orderList.indexOf(e);this._orderList=t>=0?this._orderList.filter(t=>t!==e):[...this._orderList,e],this.requestUpdate()}_removeSortItem(e){this._orderList=this._orderList.filter(t=>t!==e),this.requestUpdate()}_getSortOrder(e){const t=this._orderList.indexOf(this._label(e));return t>=0?t+1:null}_sortAnswerValue(e){const t=e.charCodeAt(0)-65,s=this._answers[t];return s?.answerId??t+1}_shouldShowCorrectHint(){return"sort"===this.type?!this._orderList.length:!this._answers.some(e=>!!e.isCorrect)}async toJSON(){return new Promise((e,t)=>{const s={customId:this["custom-id"]||void 0,answerType:this.type,orderIndex:this["order-index"]},i=this["is-edit"]?this._title:this.title||"",r=this["is-edit"]?this._answers:this["answer-list"]||[],a=this["is-edit"]?this._answerCheckType:this["answer-check-type"]||1,o=this["is-edit"]?this._leastAnswerCount:Number(this["least-answer-count"])||0,n=this["is-edit"]?this._analysis:this.analysis||"",l=this._selectedTagList||[],c=this["is-edit"]?this._orderList.map(e=>this._sortAnswerValue(e)).join(","):this["exam-expand"]||"",d=this["is-edit"]?this._showRichText:!!this["rich-text-content"],p=this["is-edit"]?this._richText:this["rich-text-content"]||"",u=this["is-edit"]?this._orderList:(()=>{const e=this["exam-expand"];return e?e.split(",").map(e=>{const t=this["answer-list"]?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();if(!i)return void t(new h("题目标题不能为空!","EMPTY_TITLE","title",s));if(this["show-tag"]&&0===l.length)return void t(new h("请选择标签/关键信息","EMPTY_TAGS","tagList",s));if(!a)return void t(new h("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",s));let g="",m=!1,w=0;if("multiple"===this.type||"single"===this.type)r.forEach((e,t)=>{e.title?.trim()||(g+=`选项${String.fromCharCode(65+t)}未填写。`),e.isCorrect&&(m=!0,w++)});else if("sort"===this.type&&(u.length&&(m=!0),m&&u.length<o))return void t(new h(`排序题至少需要设置${o}项排序答案`,"SORT_COUNT_INVALID","orderList",s));if(g)return void t(new h(g,"ANSWER_EMPTY","answers",s));if(new Set(r.map(e=>e.title)).size!==r.length)return void t(new h("选项不能重复","DUPLICATE_ANSWERS","answers",s));if("multiple"===this.type){if(1===w)return void t(new h("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",s));if(m&&w<o)return void t(new h("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",s))}if((2===a||3===a)&&!m)return void t(new h("请设置支持选项","NO_CORRECT_ANSWER","answers",s));const x={answerType:String(this.type),title:i,answers:r.filter(e=>e.title).map((e,t)=>({...e,orderIndex:t+1})),examExpand:c,analysis:n,isSetCorrectAnswer:m,leastAnswerCount:o||"",examRichTextContent:d?p:"",examAnswerRelationType:this["exam-answer-relation-type"],isKey:this._isKey,answerCheckType:a,categoryId:this._categoryId||"",memberTagInfo:l,tagInfos:l,aiAnswer:this["ai-answer"]||"",resourceList:this["resource-list"]||[],examResourceBOList:this["resource-list"]||[]};this["custom-id"]&&(x.customId=this["custom-id"]),e(x)})}validate(){const e=[],t={customId:this["custom-id"]||void 0,answerType:this.type,orderIndex:this["order-index"]},s=this["is-edit"]?this._title:this.title||"",i=this["is-edit"]?this._answers:this["answer-list"]||[],r=this["is-edit"]?this._answerCheckType:this["answer-check-type"]||1,a=this["is-edit"]?this._leastAnswerCount:Number(this["least-answer-count"])||0,o=this._selectedTagList||[],n=this["is-edit"]?this._orderList:(()=>{const e=this["exam-expand"];return e?e.split(",").map(e=>{const t=this["answer-list"]?.findIndex((t,s)=>String(t.answerId??t.orderIndex??s+1)===String(e));return t>=0?this._label(t):""}).filter(Boolean):[]})();s||e.push(new h("题目标题不能为空!","EMPTY_TITLE","title",t)),this["show-tag"]&&0===o.length&&e.push(new h("请选择标签/关键信息","EMPTY_TAGS","tagList",t)),r||e.push(new h("请选择答题设置","NO_ANSWER_CHECK_TYPE","answerCheckType",t));let l=!1,c=0;"multiple"===this.type||"single"===this.type?i.forEach((s,i)=>{s.title?.trim()||e.push(new h(`选项${String.fromCharCode(65+i)}未填写`,"ANSWER_EMPTY","answers",t)),s.isCorrect&&(l=!0,c++)}):"sort"===this.type&&(n.length&&(l=!0),l&&n.length<a&&e.push(new h(`排序题至少需要设置${a}项排序答案`,"SORT_COUNT_INVALID","orderList",t)));return new Set(i.map(e=>e.title)).size!==i.length&&i.length>0&&e.push(new h("选项不能重复","DUPLICATE_ANSWERS","answers",t)),"multiple"===this.type&&(1===c&&i.length>0&&e.push(new h("请至少设置两个支持选项","CORRECT_COUNT_INVALID","answers",t)),l&&c<a&&e.push(new h("至少选几项与支持选项数不符","LEAST_ANSWER_COUNT_INVALID","answers",t))),2!==r&&3!==r||l||e.push(new h("请设置支持选项","NO_CORRECT_ANSWER","answers",t)),e}_openResultDialog(e){this._resultDialogIndex=e,this._resultDialogValue=this._answers[e].resultItem||"",this._resultDialogOpen=!0}_saveResultDialog(){this._answers[this._resultDialogIndex].resultItem=this._resultDialogValue,this._resultDialogOpen=!1,this.requestUpdate()}_renderCorrectHintDialog(){return this._correctHintDialogOpen?e`
2
2
  <div class="modal-backdrop" @click=${()=>{this._correctHintDialogOpen=!1}}>
3
3
  <div class="modal" @click=${e=>e.stopPropagation()}>
4
4
  <div class="modal-header">
@@ -31,13 +31,13 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
31
31
  </div>
32
32
  </div>
33
33
  </div>
34
- `}_renderSearchDropdown(){return this.isEdit&&(this._searchOpen||this._searchLoading)?e`
34
+ `}_renderSearchDropdown(){return this["is-edit"]&&(this._searchOpen||this._searchLoading)?e`
35
35
  <div class="search-dropdown">
36
36
  ${this._searchLoading?e`<div class="search-empty">搜索中...</div>`:this._searchResults.length?this._searchResults.map(t=>e`
37
37
  <div class="search-item" @click=${()=>this._selectSearchResult(t)}>${t.value||t.title}</div>
38
38
  `):e`<div class="search-empty">暂无匹配题目</div>`}
39
39
  </div>
40
- `:""}_renderTagSection(){return this.showTag?e`
40
+ `:""}_renderTagSection(){return this["show-tag"]?e`
41
41
  <div class="flex-items-start section-row">
42
42
  <div class="label"><span>标签:</span></div>
43
43
  <div style="flex:1">
@@ -45,41 +45,41 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
45
45
  ${this._selectedTagList.length?this._selectedTagList.map(t=>e`
46
46
  <span class="tag-item">
47
47
  ${t.tagName}
48
- ${this.isSave?"":e`<span class="close" @click=${()=>this._removeTag(t.tagId)}>×</span>`}
48
+ ${this["is-save"]?"":e`<span class="close" @click=${()=>this._removeTag(t.tagId)}>×</span>`}
49
49
  </span>
50
50
  `):e`<span class="tag-hint">暂无标签/关键信息</span>`}
51
51
  </div>
52
- ${this.isEdit&&!this.isSave?e`
52
+ ${this["is-edit"]&&!this["is-save"]?e`
53
53
  <div style="margin-top:8px">
54
54
  <span class="el-link" @click=${()=>this._chooseTag()}>选择</span>
55
55
  </div>
56
56
  `:""}
57
57
  </div>
58
58
  </div>
59
- `:""}_renderCategorySection(){return this.showCategory?e`
59
+ `:""}_renderCategorySection(){return this["show-category"]?e`
60
60
  <div class="flex-items-start section-row">
61
61
  <div class="label"><span>分类:</span></div>
62
62
  <div style="flex:1">
63
- ${this.isEdit?e`
64
- <select class="el-select" .value=${String(this._categoryId)} ?disabled=${this.isSave}
63
+ ${this["is-edit"]?e`
64
+ <select class="el-select" .value=${String(this._categoryId)} ?disabled=${this["is-save"]}
65
65
  @change=${e=>this._onCategoryChange(e.target.value)}>
66
66
  <option value="">选择分类</option>
67
- ${this.categoryList.map(t=>e`
67
+ ${this["category-list"].map(t=>e`
68
68
  <option value=${String(t.categoryId)} ?selected=${String(t.categoryId)===String(this._categoryId)}>${t.title}</option>
69
69
  `)}
70
70
  </select>
71
- `:e`<span class="value-text">${this.categoryList.find(e=>String(e.categoryId)===String(this._categoryId))?.title||"未选择分类"}</span>`}
71
+ `:e`<span class="value-text">${this["category-list"].find(e=>String(e.categoryId)===String(this._categoryId))?.title||"未选择分类"}</span>`}
72
72
  </div>
73
73
  </div>
74
- `:""}_renderAiSection(){return this.showAi&&["single","multiple"].includes(this.type)?e`
74
+ `:""}_renderAiSection(){return this["show-ai"]&&["single","multiple"].includes(this.type)?e`
75
75
  <div class="flex-items-start section-row">
76
76
  <div class="label"><span>AI推荐:</span></div>
77
77
  <div style="flex:1">
78
- <span class="value-text">${this.aiAnswer||"暂无"}</span>
79
- ${this.isEdit?e`<div style="margin-top:8px"><span class="el-link" @click=${()=>this._applyAiAnswer()}>一键勾选</span></div>`:""}
78
+ <span class="value-text">${this["ai-answer"]||"暂无"}</span>
79
+ ${this["is-edit"]?e`<div style="margin-top:8px"><span class="el-link" @click=${()=>this._applyAiAnswer()}>一键勾选</span></div>`:""}
80
80
  </div>
81
81
  </div>
82
- `:""}_renderResourceSection(){if(!this.showResource)return"";const t=this._imageResources(),s=this._videoResource();return e`
82
+ `:""}_renderResourceSection(){if(!this["show-resource"])return"";const t=this._imageResources(),s=this._videoResource();return e`
83
83
  <div class="flex-items-start section-row">
84
84
  <div class="label"><span>资源:</span></div>
85
85
  <div style="flex:1">
@@ -139,23 +139,23 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
139
139
  </div>
140
140
  </div>
141
141
  </div>
142
- `:""}async _save(e){e?.stopImmediatePropagation();const t=this.validate();if(t.length)m(t[0].message);else if(this._hasShownCorrectHint||!this._shouldShowCorrectHint())try{const e=await this.toJSON();this._emit("save",e)}catch(e){m(e.message)}else this._correctHintDialogOpen=!0}_renderPreview(){const t="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this.leastAnswerCount?`,至少选${this.leastAnswerCount}项${"sort"===this.type?"并排序":""}`:""})`,s=this.answerList;return e`
142
+ `:""}async _save(e){e?.stopImmediatePropagation();const t=this.validate();if(t.length)m(t[0].message);else if(this._hasShownCorrectHint||!this._shouldShowCorrectHint())try{const e=await this.toJSON();this._emit("save",e)}catch(e){m(e.message)}else this._correctHintDialogOpen=!0}_renderPreview(){const t="single"===this.type?"(单选题)":`(${this._titlePlaceholder}${this["least-answer-count"]?`,至少选${this["least-answer-count"]}项${"sort"===this.type?"并排序":""}`:""})`,s=this["answer-list"];return e`
143
143
  <div class="preview">
144
- <div><span class="title">${this.orderIndex+1}.${this.title||""}${t}${this.showKey&&this._isKey?e`<span class="key-badge">核心题</span>`:""}</span></div>
145
- ${this.richTextContent?e`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
144
+ <div><span class="title">${this["order-index"]+1}.${this.title||""}${t}${this["show-key"]&&this._isKey?e`<span class="key-badge">核心题</span>`:""}</span></div>
145
+ ${this["rich-text-content"]?e`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
146
146
  <div class="preview-answer">
147
147
  ${s.map((t,s)=>e`
148
148
  <label class="radio">
149
149
  <input type="${"sort"===this.type?"checkbox":"radio"}" .checked=${!!t.isCorrect} disabled />
150
150
  <span class="order">${this._label(s)}.</span> ${t.title}
151
151
  ${"sort"!==this.type&&t.isCorrect?e`<span class="correct">(支持选项)</span>`:""}
152
- ${"sort"!==this.type&&1===this.examAnswerRelationType?e`<span class="result-info">${t.resultItem?"(已设置结果项)":"(未设置结果项)"}</span>`:""}
153
- ${"sort"!==this.type&&2===this.examAnswerRelationType?e`<span class="result-info">${t.answerRelations?.length?"(已设置关联)":"(未设置关联)"}</span>`:""}
152
+ ${"sort"!==this.type&&1===this["exam-answer-relation-type"]?e`<span class="result-info">${t.resultItem?"(已设置结果项)":"(未设置结果项)"}</span>`:""}
153
+ ${"sort"!==this.type&&2===this["exam-answer-relation-type"]?e`<span class="result-info">${t.answerRelations?.length?"(已设置关联)":"(未设置关联)"}</span>`:""}
154
154
  </label>
155
155
  `)}
156
156
  </div>
157
- ${this.showCategory&&this._categoryId?e`<div class="section-row"><span class="value-text">分类:${this.categoryList.find(e=>String(e.categoryId)===String(this._categoryId))?.title||this._categoryId}</span></div>`:""}
158
- ${this._selectedTagList.length&&this.showTag?e`
157
+ ${this["show-category"]&&this._categoryId?e`<div class="section-row"><span class="value-text">分类:${this["category-list"].find(e=>String(e.categoryId)===String(this._categoryId))?.title||this._categoryId}</span></div>`:""}
158
+ ${this._selectedTagList.length&&this["show-tag"]?e`
159
159
  <div class="section-row">
160
160
  <span class="value-text">标签/关键信息:</span>
161
161
  <div class="tag-list" style="margin-top:6px">
@@ -163,14 +163,14 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
163
163
  </div>
164
164
  </div>
165
165
  `:""}
166
- ${this.showResource?this._renderResourceSection():""}
166
+ ${this["show-resource"]?this._renderResourceSection():""}
167
167
  </div>
168
168
  `}_renderEdit(){return e`
169
169
  <div class="flex-items-start">
170
170
  <div class="label"><span>题目:</span></div>
171
171
  <div style="flex:1">
172
172
  <div class="el-input search-wrap">
173
- <textarea rows="2" .value=${this._title} ?disabled=${this.isSave}
173
+ <textarea rows="2" .value=${this._title} ?disabled=${this["is-save"]}
174
174
  maxlength=${this.TITLE_MAX}
175
175
  @input=${e=>this._onTitleInput(e)}
176
176
  placeholder="【${this._titlePlaceholder}】请输入问题"></textarea>
@@ -183,7 +183,7 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
183
183
  ${["multiple","sort"].includes(this.type)?e`
184
184
  <div class="flex-items-start" style="margin-top:12px">
185
185
  <div class="label"><span>设置:</span></div>
186
- <select class="el-select" .value=${this._leastAnswerCount?String(this._leastAnswerCount):""} ?disabled=${this.isSave}
186
+ <select class="el-select" .value=${this._leastAnswerCount?String(this._leastAnswerCount):""} ?disabled=${this["is-save"]}
187
187
  @change=${e=>{const t=e.target.value;this._leastAnswerCount=t?Number(t):0}}>
188
188
  <option value="">至少选择几项</option>
189
189
  ${Array.from({length:Math.max(0,this._answers.length-1)},(e,t)=>t+2).map(t=>e`
@@ -198,7 +198,7 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
198
198
  <div class="answer-item">
199
199
  <span class="label">${this._label(s)}.</span>
200
200
  <div class="input">
201
- <input type="text" .value=${t.title} ?disabled=${this.isSave}
201
+ <input type="text" .value=${t.title} ?disabled=${this["is-save"]}
202
202
  maxlength=${this.ANSWER_MAX}
203
203
  @input=${e=>this._onAnswerInput(e,s)}
204
204
  placeholder="选项${this._label(s)}" />
@@ -209,25 +209,25 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
209
209
 
210
210
  ${["single","multiple"].includes(this.type)?e`
211
211
  <label class="correct ${t.isCorrect?"is-correct":""}">
212
- <input type="checkbox" .checked=${t.isCorrect} ?disabled=${this.isSave}
212
+ <input type="checkbox" .checked=${t.isCorrect} ?disabled=${this["is-save"]}
213
213
  @change=${e=>this._setCorrect(t,e.target.checked)} />
214
214
  支持选项
215
215
  </label>
216
216
  `:""}
217
217
 
218
- <span class="icon ${this.isSave?"disabled":""}"
218
+ <span class="icon ${this["is-save"]?"disabled":""}"
219
219
  @click=${()=>this._addAnswer(s)}>
220
220
  ${d}
221
221
  </span>
222
- <span class="icon ${this.isSave||this._answers.length<3?"disabled":""}"
222
+ <span class="icon ${this["is-save"]||this._answers.length<3?"disabled":""}"
223
223
  @click=${()=>this._deleteAnswer(s)}>
224
224
  ${p}
225
225
  </span>
226
226
 
227
- ${1===this.examAnswerRelationType&&"sort"!==this.type?e`
227
+ ${1===this["exam-answer-relation-type"]&&"sort"!==this.type?e`
228
228
  <span class="link" @click=${()=>this._openResultDialog(s)}>${t.resultItem?"编辑结果":"添加结果"}</span>
229
229
  `:""}
230
- ${2===this.examAnswerRelationType&&"sort"!==this.type?e`
230
+ ${2===this["exam-answer-relation-type"]&&"sort"!==this.type?e`
231
231
  <span class="link" @click=${()=>this._setRelation(t,s)}>${t.answerRelations?.length?`关联了${this._relationLength(t.answerRelations)}项`:"关联检查"}</span>
232
232
  `:""}
233
233
  </div>
@@ -239,8 +239,8 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
239
239
  <div class="label"><span>排序答案:</span></div>
240
240
  <div style="flex:1">
241
241
  <div class="multi-select-wrapper">
242
- <div class="multi-select ${this._sortDropdownOpen?"focused":""} ${this.isSave?"disabled":""}"
243
- @click=${()=>{this.isSave||(this._sortDropdownOpen=!this._sortDropdownOpen,this.requestUpdate())}}>
242
+ <div class="multi-select ${this._sortDropdownOpen?"focused":""} ${this["is-save"]?"disabled":""}"
243
+ @click=${()=>{this["is-save"]||(this._sortDropdownOpen=!this._sortDropdownOpen,this.requestUpdate())}}>
244
244
  ${this._orderList.length>0?this._orderList.map(t=>e`
245
245
  <span class="tag">
246
246
  ${t}
@@ -278,16 +278,16 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
278
278
  <div style="flex:1">
279
279
  <qxs-blocksuite-editor
280
280
  .content=${this._richText}
281
- .uploadImage=${this.uploadImage}
281
+ .upload-image=${this["upload-image"]}
282
282
  ?is-edit=${!0}
283
283
  @input=${e=>{this._richText=e.target.getContent()}}
284
284
  ></qxs-blocksuite-editor>
285
- ${this.showAction?"":e`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
285
+ ${this["show-action"]?"":e`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
286
286
  </div>
287
287
  </div>
288
288
  `:""}
289
289
 
290
- ${this.showAnalysis?e`
290
+ ${this["show-analysis"]?e`
291
291
  <div class="flex-items-start" style="margin-top:12px">
292
292
  <div class="label"><span>解析:</span></div>
293
293
  <div style="flex:1">
@@ -298,26 +298,26 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
298
298
  </div>
299
299
  `:""}
300
300
  `}render(){return e`
301
- <qxs-subject-layout .showEdit=${this.isEdit}>
301
+ <qxs-subject-layout .show-edit=${this["is-edit"]}>
302
302
  <div slot="preview">${this._renderPreview()}</div>
303
303
  <div slot="edit">${this._renderEdit()}</div>
304
- ${this.showAction?e`
304
+ ${this["show-action"]?e`
305
305
  <qxs-subject-action
306
- .isEdit=${this.isEdit}
307
- .isSet=${this.isSet}
308
- .isKey=${this._isKey}
309
- .showAdd=${this.showAdd}
310
- .showAnswerSetting=${this.showAnswerSetting&&["single","multiple","sort"].includes(this.type)}
311
- .showKey=${this.showKey&&["single","multiple","sort"].includes(this.type)}
312
- .showRichText=${this._showRichText}
313
- .showJump=${this.showJump}
306
+ .is-edit=${this["is-edit"]}
307
+ .is-set=${this["is-set"]}
308
+ .is-key=${this._isKey}
309
+ .show-add=${this["show-add"]}
310
+ .show-answer-setting=${["single","multiple","sort"].includes(this.type)}
311
+ .show-key=${this["show-key"]&&["single","multiple","sort"].includes(this.type)}
312
+ .show-rich-text=${this._showRichText}
313
+ .show-jump=${this["show-jump"]}
314
314
  answer-check-type=${this._answerCheckType}
315
- exam-answer-relation-type=${this.examAnswerRelationType}
315
+ exam-answer-relation-type=${this["exam-answer-relation-type"]}
316
316
  @delete=${()=>this._emit("delete")}
317
317
  @save=${this._save}
318
318
  @edit=${()=>this._emit("edit")}
319
319
  @move=${e=>this._emit("move",e.detail)}
320
- @jump=${()=>this._emit("jump",{customId:this.customId||"",examId:this.examId||0,answerType:this.type})}
320
+ @jump=${()=>this._emit("jump",{customId:this["custom-id"]||"",examId:this["exam-id"]||0,answerType:this.type})}
321
321
  @add=${e=>this._emit("add",e.detail)}
322
322
  @set-key=${e=>{this._isKey=e.detail.value,this._emit("set-key",e.detail)}}
323
323
  @set-answer-setting=${e=>{this._answerCheckType=e.detail.value}}
@@ -519,5 +519,5 @@ import{html as e,css as t,LitElement as s}from"lit";import{property as i,state a
519
519
  .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }
520
520
  .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
521
521
  .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }
522
- `,h([i({type:Number,attribute:"order-index"})],w.prototype,"orderIndex",2),h([i({type:Boolean,attribute:"is-edit"})],w.prototype,"isEdit",2),h([i({type:Boolean,attribute:"is-save"})],w.prototype,"isSave",2),h([i({type:Boolean,attribute:"is-set"})],w.prototype,"isSet",2),h([i({type:Boolean,attribute:"is-key"})],w.prototype,"isKey",2),h([i({type:Boolean,attribute:"show-action"})],w.prototype,"showAction",2),h([i({type:Boolean,attribute:"show-add"})],w.prototype,"showAdd",2),h([i({type:Boolean,attribute:"show-answer-setting"})],w.prototype,"showAnswerSetting",2),h([i({type:Boolean,attribute:"show-key"})],w.prototype,"showKey",2),h([i({type:Boolean,attribute:"show-analysis"})],w.prototype,"showAnalysis",2),h([i({attribute:"question-type",reflect:!0})],w.prototype,"type",2),h([i({type:Number,attribute:"answer-check-type"})],w.prototype,"answerCheckType",2),h([i({type:Number,attribute:"exam-answer-relation-type"})],w.prototype,"examAnswerRelationType",2),h([i({type:String,attribute:"rich-text-content"})],w.prototype,"richTextContent",2),h([i({type:String})],w.prototype,"analysis",2),h([i({type:Number,attribute:"least-answer-count"})],w.prototype,"leastAnswerCount",2),h([i({type:String,attribute:"exam-expand"})],w.prototype,"examExpand",2),h([i({type:String,attribute:"custom-id"})],w.prototype,"customId",2),h([i({type:Number,attribute:"exam-id"})],w.prototype,"examId",2),h([i({type:String,attribute:"category-id"})],w.prototype,"categoryId",2),h([i({type:Object})],w.prototype,"uploadImage",2),h([i({type:Array,attribute:"answer-list"})],w.prototype,"answerList",1),h([i({type:Array,attribute:"tag-list"})],w.prototype,"tagList",2),h([i({type:Array,attribute:"category-list"})],w.prototype,"categoryList",2),h([i({type:String,attribute:"ai-answer"})],w.prototype,"aiAnswer",2),h([i({type:Array,attribute:"resource-list"})],w.prototype,"resourceList",2),h([i({type:Boolean,attribute:"show-tag"})],w.prototype,"showTag",2),h([i({type:Boolean,attribute:"show-category"})],w.prototype,"showCategory",2),h([i({type:Boolean,attribute:"show-ai"})],w.prototype,"showAi",2),h([i({type:Boolean,attribute:"show-resource"})],w.prototype,"showResource",2),h([i({type:Boolean,attribute:"show-jump"})],w.prototype,"showJump",2),h([i({type:Boolean,attribute:"has-jump"})],w.prototype,"hasJump",2),h([i({type:String,attribute:"search-api"})],w.prototype,"searchApi",2),h([i({type:Object})],w.prototype,"searchHandler",2),h([i({type:String,attribute:"model-value"})],w.prototype,"modelValue",2),h([i({type:Boolean,attribute:"use-model"})],w.prototype,"useModel",2),h([r()],w.prototype,"_answers",2),h([i({type:String})],w.prototype,"title",2),h([r()],w.prototype,"_title",2),h([r()],w.prototype,"_analysis",2),h([r()],w.prototype,"_richText",2),h([r()],w.prototype,"_showRichText",2),h([r()],w.prototype,"_leastAnswerCount",2),h([r()],w.prototype,"_answerCheckType",2),h([r()],w.prototype,"_isKey",2),h([r()],w.prototype,"_orderList",2),h([r()],w.prototype,"_selectedTagList",2),h([r()],w.prototype,"_categoryId",2),h([r()],w.prototype,"_searchResults",2),h([r()],w.prototype,"_searchOpen",2),h([r()],w.prototype,"_searchLoading",2),h([r()],w.prototype,"_resultDialogOpen",2),h([r()],w.prototype,"_resultDialogIndex",2),h([r()],w.prototype,"_resultDialogValue",2),h([r()],w.prototype,"_sortDropdownOpen",2),h([r()],w.prototype,"_imageViewerOpen",2),h([r()],w.prototype,"_imageViewerIndex",2),h([r()],w.prototype,"_videoViewerOpen",2),h([r()],w.prototype,"_correctHintDialogOpen",2),h([r()],w.prototype,"_hasShownCorrectHint",2),w=h([o("qxs-subject-single")],w);export{w as QxsSubjectSingle,c as SubjectError};
522
+ `,c([i({type:Number,attribute:"order-index"})],w.prototype,"order-index",2),c([i({type:Boolean,attribute:"is-edit"})],w.prototype,"is-edit",2),c([i({type:Boolean,attribute:"is-save"})],w.prototype,"is-save",2),c([i({type:Boolean,attribute:"is-set"})],w.prototype,"is-set",2),c([i({type:Boolean,attribute:"is-key"})],w.prototype,"is-key",2),c([i({type:Boolean,attribute:"show-action"})],w.prototype,"show-action",2),c([i({type:Boolean,attribute:"show-add"})],w.prototype,"show-add",2),c([i({type:Boolean,attribute:"show-answer-setting"})],w.prototype,"show-answer-setting",2),c([i({type:Boolean,attribute:"show-key"})],w.prototype,"show-key",2),c([i({type:Boolean,attribute:"show-analysis"})],w.prototype,"show-analysis",2),c([i({attribute:"question-type",reflect:!0})],w.prototype,"type",2),c([i({type:Number,attribute:"answer-check-type"})],w.prototype,"answer-check-type",2),c([i({type:Number,attribute:"exam-answer-relation-type"})],w.prototype,"exam-answer-relation-type",2),c([i({type:String,attribute:"rich-text-content"})],w.prototype,"rich-text-content",2),c([i({type:String})],w.prototype,"analysis",2),c([i({type:Number,attribute:"least-answer-count"})],w.prototype,"least-answer-count",2),c([i({type:String,attribute:"exam-expand"})],w.prototype,"exam-expand",2),c([i({type:String,attribute:"custom-id"})],w.prototype,"custom-id",2),c([i({type:Number,attribute:"exam-id"})],w.prototype,"exam-id",2),c([i({type:String,attribute:"category-id"})],w.prototype,"category-id",2),c([i({type:Object,attribute:"upload-image"})],w.prototype,"upload-image",2),c([i({type:Array,attribute:"answer-list"})],w.prototype,"answer-list",1),c([i({type:Array,attribute:"tag-list"})],w.prototype,"tag-list",2),c([i({type:Array,attribute:"category-list"})],w.prototype,"category-list",2),c([i({type:String,attribute:"ai-answer"})],w.prototype,"ai-answer",2),c([i({type:Array,attribute:"resource-list"})],w.prototype,"resource-list",2),c([i({type:Boolean,attribute:"show-tag"})],w.prototype,"show-tag",2),c([i({type:Boolean,attribute:"show-category"})],w.prototype,"show-category",2),c([i({type:Boolean,attribute:"show-ai"})],w.prototype,"show-ai",2),c([i({type:Boolean,attribute:"show-resource"})],w.prototype,"show-resource",2),c([i({type:Boolean,attribute:"show-jump"})],w.prototype,"show-jump",2),c([i({type:Boolean,attribute:"has-jump"})],w.prototype,"has-jump",2),c([i({type:String,attribute:"search-api"})],w.prototype,"search-api",2),c([i({type:Object,attribute:"search-handler"})],w.prototype,"search-handler",2),c([i({type:String,attribute:"model-value"})],w.prototype,"model-value",2),c([i({type:Boolean,attribute:"use-model"})],w.prototype,"use-model",2),c([r()],w.prototype,"_answers",2),c([i({type:String})],w.prototype,"title",2),c([r()],w.prototype,"_title",2),c([r()],w.prototype,"_analysis",2),c([r()],w.prototype,"_richText",2),c([r()],w.prototype,"_showRichText",2),c([r()],w.prototype,"_leastAnswerCount",2),c([r()],w.prototype,"_answerCheckType",2),c([r()],w.prototype,"_isKey",2),c([r()],w.prototype,"_orderList",2),c([r()],w.prototype,"_selectedTagList",2),c([r()],w.prototype,"_categoryId",2),c([r()],w.prototype,"_searchResults",2),c([r()],w.prototype,"_searchOpen",2),c([r()],w.prototype,"_searchLoading",2),c([r()],w.prototype,"_resultDialogOpen",2),c([r()],w.prototype,"_resultDialogIndex",2),c([r()],w.prototype,"_resultDialogValue",2),c([r()],w.prototype,"_sortDropdownOpen",2),c([r()],w.prototype,"_imageViewerOpen",2),c([r()],w.prototype,"_imageViewerIndex",2),c([r()],w.prototype,"_videoViewerOpen",2),c([r()],w.prototype,"_correctHintDialogOpen",2),c([r()],w.prototype,"_hasShownCorrectHint",2),w=c([a("qxs-subject-single")],w);export{w as QxsSubjectSingle,h as SubjectError};
523
523
  //# sourceMappingURL=single.mjs.map