@qxs-bns/components-wc 0.0.20 → 0.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"text-fill.mjs","sources":["../../../../packages/components-wc/src/subject/text-fill.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\ninterface TextAnswer { title: string, tag: string, showInput: boolean }\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' }, // primary\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' }, // success\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' }, // warning\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' }, // danger\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' }, // info\n]\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-text-fill')\nexport class QxsTextFill extends LitElement {\n private readonly _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>`\n private readonly _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\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: 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: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean, keywordCount: number } = { isInOrder: true, isIgnoreCase: true, keywordCount: 1 }\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\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = true\n @state() private _isIgnoreCase = true\n @state() private _keywordCount = 1\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\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 if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n this._keywordCount = this.examAnswerSetting.keywordCount || 1\n }\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\n if (this.examExpand) {\n this._correct = this.examExpand\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 _addTag(i: number) {\n const a = { ...this._answers[i] }\n if (a.tag) {\n a.title = a.title ? [a.title, a.tag].join(',') : a.tag\n a.tag = ''\n }\n a.showInput = false\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _closeTag(tag: string, i: number) {\n const a = { ...this._answers[i] }\n a.title = a.title.split(',').filter(t => t !== tag).join(',')\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'text_fill', 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 correct = this.isEdit ? this._correct : (this as any).examExpand || ''\n const keywordCount = this.isEdit ? this._keywordCount : this.examAnswerSetting?.keywordCount || 1\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? true\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\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 if (keywordCount || correct) {\n if (!keywordCount) {\n reject(new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row))\n return\n }\n if (!correct) {\n reject(new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row))\n return\n }\n if (answers.length !== keywordCount) {\n reject(new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row))\n return\n }\n const msg: string[] = []\n answers.forEach((item: any, i: number) => {\n if (!item.title) { msg.push(`关键词${i + 1}未设置`) }\n })\n if (msg.length) {\n reject(new SubjectError(msg.join(','), 'KEYWORD_EMPTY', 'answers', row))\n return\n }\n }\n const result: any = {\n answerType: SubjectType.TEXT_FILL,\n title,\n answers: answers.filter((a: any) => a.title).map((a: any) => ({ title: a.title })),\n analysis,\n isSetCorrectAnswer: !!correct,\n isKey: this.isKey,\n examExpand: correct,\n examAnswerSettingBO: { isIgnoreCase, isInOrder, keywordCount },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\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: 'text_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const correct = this.isEdit ? this._correct : (this as any).examExpand || ''\n const keywordCount = this.isEdit ? this._keywordCount : this.examAnswerSetting?.keywordCount || 1\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (keywordCount || correct) {\n if (!keywordCount) {\n errors.push(new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row))\n }\n if (!correct) {\n errors.push(new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row))\n }\n if (answers.length !== keywordCount) {\n errors.push(new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row))\n }\n answers.forEach((item: any, i: number) => {\n if (!item.title) {\n errors.push(new SubjectError(`关键词${i + 1}未设置`, 'KEYWORD_EMPTY', 'answers', row))\n }\n })\n }\n\n return errors\n }\n\n private _renderPreview() {\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(问答题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">关键词${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this._correct ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${this._correct}</div>` : ''}\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 style=\"flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px\">\n <span style=\"font-size:13px;color:#606266\">共答对</span>\n <input type=\"number\" style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${String(this._keywordCount)} min=\"1\"\n @change=${(e: Event) => { this._keywordCount = Number((e.target as HTMLInputElement).value) }} />\n <span style=\"font-size:13px;color:#606266\">个关键词,算是正确的</span>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\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._correct} ?disabled=${this.isSave}\n maxlength=\"200\"\n @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入正确答案\"></textarea>\n <span class=\"char-counter\">${this._correct.length}/200</span>\n </div>\n </div>\n </div>\n\n <div class=\"answer-list\" style=\"margin-top:12px\">\n <span style=\"padding-left:60px;font-size:12px;color:#909399\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${i + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${a.title.split(',').filter(Boolean).map((tag) => {\n const c = TAG_COLORS[i % TAG_COLORS.length]; return html`\n <span style=\"display:inline-flex;align-items:center;background:${c.bg};color:${c.color};border:1px solid ${c.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n ${!this.isSave ? html`<span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, i)}>×</span>` : ''}\n </span>\n `\n })}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" style=\"width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._addTag(i) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(i)} />\n <button class=\"el-link\" @click=${() => this._addTag(i)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((x, j) => j === i ? { ...x, showInput: true } : x); this.updateComplete.then(() => { (this.shadowRoot?.querySelector(`input[style*=\"width:80px\"]`) as HTMLInputElement)?.focus() }) }}>\n ${a.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `\n : ''}\n </div>\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this.isSave || this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(i)}>${this._iconRemove}</span>\n </div>\n `)}\n </div>\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","keywordCount","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","modelValue","useModel","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","length","map","a","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","value","slice","_addTag","i","join","x","j","_closeTag","split","filter","t","toJSON","row","answerType","answers","correct","showRichText","richText","SubjectError","msg","forEach","item","push","SubjectType","TEXT_FILL","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_addAnswer","_deleteAnswer","index","_","_save","stopImmediatePropagation","data","err","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","_renderPreview","some","_renderEdit","String","Number","checked","Boolean","c","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","attribute","prototype","Array","state","safeCustomElement"],"mappings":"2oBAQA,MAAMA,EAAa,CACjB,CAAEC,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,YAiBtC,I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AW,iBA3G1BzJ,EA2G2C0J,UAAA,aAAA,GAEtDJ,EAAA,CADCC,EAAS,CAAEC,KAAM1C,OAAQ2C,UAAW,yBA5G1BzJ,EA6GX0J,UAAA,oBAAA,GAEAJ,EAAA,CADCC,EAAS,CAAEC,KAAM1C,UA9GP9G,EA+GX0J,UAAA,cAAA,GASqDJ,EAAA,CAApDC,EAAS,CAAEC,KAAMG,MAAOF,UAAW,iBAxHzBzJ,EAwH0C0J,UAAA,aAAA,GAGCJ,EAAA,CAArDC,EAAS,CAAEC,KAAMhB,OAAQiB,UAAW,iBA3H1BzJ,EA2H2C0J,UAAA,aAAA,GACDJ,EAAA,CAApDC,EAAS,CAAEC,KAAMb,QAASc,UAAW,eA5H3BzJ,EA4H0C0J,UAAA,WAAA,GAEpCJ,EAAA,CAAhBM,KA9HU5J,EA8HM0J,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KA/HU5J,EA+HM0J,UAAA,SAAA,GACAJ,EAAA,CAAhBM,KAhIU5J,EAgIM0J,UAAA,YAAA,GACAJ,EAAA,CAAhBM,KAjIU5J,EAiIM0J,UAAA,aAAA,GACAJ,EAAA,CAAhBM,KAlIU5J,EAkIM0J,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAnIU5J,EAmIM0J,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KApIU5J,EAoIM0J,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KArIU5J,EAqIM0J,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAtIU5J,EAsIM0J,UAAA,YAAA,GAtIN1J,EAANsJ,EAAA,CADNO,EAAkB,kBACN7J"}
1
+ {"version":3,"file":"text-fill.mjs","sources":["../../../../packages/components-wc/src/subject/text-fill.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\ninterface TextAnswer {\n title: string\n tag: string\n showInput: boolean\n answerId?: string | number\n customAnswerId?: string | number\n}\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' }, // primary\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' }, // success\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' }, // warning\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' }, // danger\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' }, // info\n]\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-text-fill')\nexport class QxsTextFill extends LitElement {\n private readonly _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>`\n private readonly _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\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: 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: 'is-key' }) isKey = 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-answer-setting' }) showAnswerSetting = false\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean, keywordCount: number } = { isInOrder: true, isIgnoreCase: true, keywordCount: 1 }\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\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = true\n @state() private _isIgnoreCase = true\n @state() private _keywordCount = 1\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\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('examAnswerSetting') || changed.has('richTextContent') || changed.has('examExpand'))) {\n this._syncProps()\n }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue\n }\n }\n\n private _normalizeAnswerTitle(answer: any) {\n return String(answer?.title ?? answer?.answer ?? '')\n }\n\n private _normalizedAnswerList(source: any[] = []) {\n return (Array.isArray(source) ? source : []).map((answer: any) => ({\n ...answer,\n answerId: answer?.answerId ?? answer?.examAnswerId,\n title: this._normalizeAnswerTitle(answer),\n }))\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this._normalizedAnswerList(this.answerList).map((a: any) => ({\n title: a.title || '',\n tag: '',\n showInput: false,\n answerId: a.answerId,\n customAnswerId: a.customAnswerId,\n }))\n }\n else {\n this._answers = [{ title: '', tag: '', showInput: false }]\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n this._keywordCount = this.examAnswerSetting.keywordCount || 1\n }\n this._richText = this.richTextContent || ''\n this._showRichText = !!this.richTextContent\n this._correct = this.examExpand || ''\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 _addTag(i: number) {\n const a = { ...this._answers[i] }\n if (a.tag) {\n a.title = a.title ? [a.title, a.tag].join(',') : a.tag\n a.tag = ''\n }\n a.showInput = false\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _closeTag(tag: string, i: number) {\n const a = { ...this._answers[i] }\n a.title = a.title.split(',').filter(t => t !== tag).join(',')\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'text_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : this._normalizedAnswerList(this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const correct = this.isEdit ? this._correct : (this as any).examExpand || ''\n const keywordCount = this.isEdit ? this._keywordCount : this.examAnswerSetting?.keywordCount || 1\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? true\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\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 if (keywordCount || correct) {\n if (!keywordCount) {\n reject(new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row))\n return\n }\n if (!correct) {\n reject(new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row))\n return\n }\n if (answers.length !== keywordCount) {\n reject(new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row))\n return\n }\n const msg: string[] = []\n answers.forEach((item: any, i: number) => {\n if (!this._normalizeAnswerTitle(item)) { msg.push(`关键词${i + 1}未设置`) }\n })\n if (msg.length) {\n reject(new SubjectError(msg.join(','), 'KEYWORD_EMPTY', 'answers', row))\n return\n }\n }\n const result: any = {\n answerType: SubjectType.TEXT_FILL,\n title,\n answers: answers\n .filter((a: any) => this._normalizeAnswerTitle(a))\n .map((a: any) => ({\n title: this._normalizeAnswerTitle(a),\n ...(a.answerId ? { answerId: a.answerId } : {}),\n ...(a.customAnswerId ? { customAnswerId: a.customAnswerId } : {}),\n })),\n analysis,\n isSetCorrectAnswer: !!correct,\n isKey: this.isKey,\n examExpand: correct,\n examAnswerSettingBO: { isIgnoreCase, isInOrder, keywordCount },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\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: 'text_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : this._normalizedAnswerList(this.answerList || [])\n const correct = this.isEdit ? this._correct : (this as any).examExpand || ''\n const keywordCount = this.isEdit ? this._keywordCount : this.examAnswerSetting?.keywordCount || 1\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (keywordCount || correct) {\n if (!keywordCount) {\n errors.push(new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row))\n }\n if (!correct) {\n errors.push(new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row))\n }\n if (answers.length !== keywordCount) {\n errors.push(new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row))\n }\n answers.forEach((item: any, i: number) => {\n if (!this._normalizeAnswerTitle(item)) {\n errors.push(new SubjectError(`关键词${i + 1}未设置`, 'KEYWORD_EMPTY', 'answers', row))\n }\n })\n }\n\n return errors\n }\n\n private _renderPreview() {\n const previewAnswers = this.isEdit ? this._answers : this._normalizedAnswerList(this.answerList || [])\n const previewCorrect = this.isEdit ? this._correct : (this.examExpand || '')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(问答题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${previewAnswers.some(a => a.title)\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${previewAnswers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">关键词${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${previewCorrect ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${previewCorrect}</div>` : ''}\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 ${this.showAnswerSetting\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <div style=\"flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px\">\n <span style=\"font-size:13px;color:#606266\">共答对</span>\n <input type=\"number\" style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${String(this._keywordCount)} min=\"1\"\n @change=${(e: Event) => { this._keywordCount = Number((e.target as HTMLInputElement).value) }} />\n <span style=\"font-size:13px;color:#606266\">个关键词,算是正确的</span>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n </div>\n `\n : ''}\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._correct} ?disabled=${this.isSave}\n maxlength=\"200\"\n @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入正确答案\"></textarea>\n <span class=\"char-counter\">${this._correct.length}/200</span>\n </div>\n </div>\n </div>\n\n <div class=\"answer-list\" style=\"margin-top:12px\">\n <span style=\"padding-left:60px;font-size:12px;color:#909399\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${i + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${a.title.split(',').filter(Boolean).map((tag) => {\n const c = TAG_COLORS[i % TAG_COLORS.length]; return html`\n <span style=\"display:inline-flex;align-items:center;background:${c.bg};color:${c.color};border:1px solid ${c.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n ${!this.isSave ? html`<span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, i)}>×</span>` : ''}\n </span>\n `\n })}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" style=\"width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._addTag(i) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(i)} />\n <button class=\"el-link\" @click=${() => this._addTag(i)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((x, j) => j === i ? { ...x, showInput: true } : x); this.updateComplete.then(() => { (this.shadowRoot?.querySelector(`input[style*=\"width:80px\"]`) as HTMLInputElement)?.focus() }) }}>\n ${a.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `\n : ''}\n </div>\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this.isSave || this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(i)}>${this._iconRemove}</span>\n </div>\n `)}\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 ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-add=${this.showAdd}\n ?show-rich-text=${this._showRichText}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @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":["TAG_COLORS","bg","color","border","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAdd","showAnswerSetting","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","keywordCount","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","modelValue","useModel","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","_normalizeAnswerTitle","answer","String","_normalizedAnswerList","source","length","undefined","Array","isArray","map","answerId","examAnswerId","a","customAnswerId","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","value","slice","_addTag","i","join","x","j","_closeTag","split","filter","t","toJSON","row","answerType","answers","correct","showRichText","richText","SubjectError","msg","forEach","item","push","SubjectType","TEXT_FILL","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_addAnswer","_deleteAnswer","index","_","_save","stopImmediatePropagation","data","err","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","_renderPreview","previewAnswers","previewCorrect","some","_renderEdit","Number","checked","Boolean","c","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","attribute","prototype","state","safeCustomElement"],"mappings":"2oBAcA,MAAMA,EAAa,CACjB,CAAEC,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,YAiBtC,IAAMC,EAAN,cAA0BC,EAA1BC,WAAAA,GAAAC,SAAAC,WACLC,KAAiBC,UAAYC,CAAA,2NAC7BF,KAAiBG,YAAcD,CAAA,qLA6FuBF,KAAAI,WAAa,EACvCJ,KAAAK,MAAQ,GACgBL,KAAAM,SAAW,GACZN,KAAAO,QAAS,EACTP,KAAAQ,QAAS,EACVR,KAAAS,OAAQ,EACRT,KAAAU,OAAQ,EACHV,KAAAW,YAAa,EAChBX,KAAAY,SAAU,EACCZ,KAAAa,mBAAoB,EAC1Bb,KAAAc,cAAe,EACZd,KAAAe,gBAAkB,GAClDf,KAAAgB,SAAW,GAC6BhB,KAAAiB,uBAAyB,EACvCjB,KAAAkB,WAAa,GAEnElB,KAAAmB,kBAAyF,CAAEC,WAAW,EAAMC,cAAc,EAAMC,aAAc,GAE9ItB,KAAAuB,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MA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A,CAAhBK,KAhIUzK,EAgIMwK,UAAA,WAAA,GACAJ,EAAA,CAAhBK,KAjIUzK,EAiIMwK,UAAA,SAAA,GACAJ,EAAA,CAAhBK,KAlIUzK,EAkIMwK,UAAA,YAAA,GACAJ,EAAA,CAAhBK,KAnIUzK,EAmIMwK,UAAA,aAAA,GACAJ,EAAA,CAAhBK,KApIUzK,EAoIMwK,UAAA,gBAAA,GACAJ,EAAA,CAAhBK,KArIUzK,EAqIMwK,UAAA,gBAAA,GACAJ,EAAA,CAAhBK,KAtIUzK,EAsIMwK,UAAA,WAAA,GACAJ,EAAA,CAAhBK,KAvIUzK,EAuIMwK,UAAA,gBAAA,GACAJ,EAAA,CAAhBK,KAxIUzK,EAwIMwK,UAAA,YAAA,GAxINxK,EAANoK,EAAA,CADNM,EAAkB,kBACN1K"}
@@ -1,4 +1,4 @@
1
- import{css as e,LitElement as t,html as i}from"lit";import{safeCustomElement as s}from"../base/define.mjs";import{SubjectType as l}from"./types.mjs";var a=Object.getOwnPropertyDescriptor;const p=[{type:l.SINGLE,label:"单选题"},{type:l.MULTIPLE,label:"多选题"},{type:l.BLANK_FILL,label:"填空题"},{type:l.TEXT_FILL,label:"问答题"},{type:l.SCALE,label:"量表题"},{type:l.SORT,label:"排序题"}],o=[{type:l.SINGLE,label:"单选题"},{type:l.MULTIPLE,label:"多选题"}];let n=class extends t{emit(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{type:e,canSet:t}}))}render(){return i`
1
+ import{css as e,LitElement as t,html as i}from"lit";import{safeCustomElement as s}from"../base/define.mjs";import{SubjectType as l}from"./types.mjs";var a=Object.getOwnPropertyDescriptor;const p=[{type:l.SINGLE,label:"单选题"},{type:l.MULTIPLE,label:"多选题"},{type:l.BLANK_FILL,label:"填空题"},{type:l.TEXT_FILL,label:"问答题"},{type:l.SCALE,label:"量表题"},{type:l.SORT,label:"排序题"},{type:"page_end",label:"分页符"}],o=[{type:l.SINGLE,label:"单选题"},{type:l.MULTIPLE,label:"多选题"}];let n=class extends t{emit(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{type:e,canSet:t}}))}render(){return i`
2
2
  <div class="container">
3
3
  <div class="type-item">
4
4
  <div class="section-title">普通题目类型</div>
@@ -1 +1 @@
1
- {"version":3,"file":"type.mjs","sources":["../../../../packages/components-wc/src/subject/type.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectType } from './types'\n\nconst subjectOptions = [\n { type: SubjectType.SINGLE, label: '单选题' },\n { type: SubjectType.MULTIPLE, label: '多选题' },\n { type: SubjectType.BLANK_FILL, label: '填空题' },\n { type: SubjectType.TEXT_FILL, label: '问答题' },\n { type: SubjectType.SCALE, label: '量表题' },\n { type: SubjectType.SORT, label: '排序题' },\n]\n\nconst interactionOptions = [\n { type: SubjectType.SINGLE, label: '单选题' },\n { type: SubjectType.MULTIPLE, label: '多选题' },\n]\n\n@safeCustomElement('qxs-subject-type')\nexport class QxsSubjectType extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n .container { padding: 16px; }\n .type-item { margin-bottom: 20px; }\n .section-title { margin-bottom: 10px; font-size: 13px; color: #909399; }\n .base-subject { display: flex; flex-wrap: wrap; gap: 8px; }\n .item {\n display: inline-flex; align-items: center; justify-content: center;\n min-width: 64px; height: 28px; padding: 0 12px; font-size: 13px;\n color: #606266; cursor: pointer; background: #fff;\n border: 1px solid #dcdfe6; border-radius: 4px; transition: all 0.15s;\n }\n .item:hover { color: #409eff; border-color: #409eff; }\n `\n\n private emit(type: string, canSet = false) {\n this.dispatchEvent(new CustomEvent('select', {\n bubbles: true, composed: true,\n detail: { type, canSet },\n }))\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"type-item\">\n <div class=\"section-title\">普通题目类型</div>\n <div class=\"base-subject\">\n ${subjectOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type)}>${item.label}</span>\n `)}\n </div>\n </div>\n <div class=\"type-item\">\n <div class=\"section-title\">互动问答类型(支持设置结果项)</div>\n <div class=\"base-subject\">\n ${interactionOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type, true)}>${item.label}</span>\n `)}\n </div>\n </div>\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["subjectOptions","type","SubjectType","SINGLE","label","MULTIPLE","BLANK_FILL","TEXT_FILL","SCALE","SORT","interactionOptions","QxsSubjectType","LitElement","emit","canSet","arguments","length","undefined","this","dispatchEvent","CustomEvent","bubbles","composed","detail","render","html","map","item","styles","css","__decorateClass","safeCustomElement"],"mappings":"2LAKA,MAAMA,EAAiB,CACrB,CAAEC,KAAMC,EAAYC,OAAQC,MAAO,OACnC,CAAEH,KAAMC,EAAYG,SAAUD,MAAO,OACrC,CAAEH,KAAMC,EAAYI,WAAYF,MAAO,OACvC,CAAEH,KAAMC,EAAYK,UAAWH,MAAO,OACtC,CAAEH,KAAMC,EAAYM,MAAOJ,MAAO,OAClC,CAAEH,KAAMC,EAAYO,KAAML,MAAO,QAG7BM,EAAqB,CACzB,CAAET,KAAMC,EAAYC,OAAQC,MAAO,OACnC,CAAEH,KAAMC,EAAYG,SAAUD,MAAO,QAIhC,IAAMO,EAAN,cAA6BC,EAgB1BC,IAAAA,CAAKZ,GAA8B,IAAhBa,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GACzBG,KAAKC,cAAc,IAAIC,YAAY,SAAU,CAC3CC,SAAS,EAAMC,UAAU,EACzBC,OAAQ,CAAEtB,OAAMa,YAEpB,CAEAU,MAAAA,GACE,OAAOC,CAAA;;;;;cAKGzB,EAAe0B,IAAIC,GAAQF,CAAA;0CACC,IAAMP,KAAKL,KAAKc,EAAK1B,SAAS0B,EAAKvB;;;;;;;cAO/DM,EAAmBgB,IAAIC,GAAQF,CAAA;0CACH,IAAMP,KAAKL,KAAKc,EAAK1B,MAAM,MAAS0B,EAAKvB;;;;;KAMjF,GA5CWO,EACJiB,OAASC,CAAA;;;;;;;;;;;;;IADLlB,uGAANmB,CAAA,CADNC,EAAkB,qBACNpB"}
1
+ {"version":3,"file":"type.mjs","sources":["../../../../packages/components-wc/src/subject/type.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectType } from './types'\n\nconst subjectOptions = [\n { type: SubjectType.SINGLE, label: '单选题' },\n { type: SubjectType.MULTIPLE, label: '多选题' },\n { type: SubjectType.BLANK_FILL, label: '填空题' },\n { type: SubjectType.TEXT_FILL, label: '问答题' },\n { type: SubjectType.SCALE, label: '量表题' },\n { type: SubjectType.SORT, label: '排序题' },\n { type: 'page_end', label: '分页符' },\n]\n\nconst interactionOptions = [\n { type: SubjectType.SINGLE, label: '单选题' },\n { type: SubjectType.MULTIPLE, label: '多选题' },\n]\n\n@safeCustomElement('qxs-subject-type')\nexport class QxsSubjectType extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n .container { padding: 16px; }\n .type-item { margin-bottom: 20px; }\n .section-title { margin-bottom: 10px; font-size: 13px; color: #909399; }\n .base-subject { display: flex; flex-wrap: wrap; gap: 8px; }\n .item {\n display: inline-flex; align-items: center; justify-content: center;\n min-width: 64px; height: 28px; padding: 0 12px; font-size: 13px;\n color: #606266; cursor: pointer; background: #fff;\n border: 1px solid #dcdfe6; border-radius: 4px; transition: all 0.15s;\n }\n .item:hover { color: #409eff; border-color: #409eff; }\n `\n\n private emit(type: string, canSet = false) {\n this.dispatchEvent(new CustomEvent('select', {\n bubbles: true, composed: true,\n detail: { type, canSet },\n }))\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"type-item\">\n <div class=\"section-title\">普通题目类型</div>\n <div class=\"base-subject\">\n ${subjectOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type)}>${item.label}</span>\n `)}\n </div>\n </div>\n <div class=\"type-item\">\n <div class=\"section-title\">互动问答类型(支持设置结果项)</div>\n <div class=\"base-subject\">\n ${interactionOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type, true)}>${item.label}</span>\n `)}\n </div>\n </div>\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["subjectOptions","type","SubjectType","SINGLE","label","MULTIPLE","BLANK_FILL","TEXT_FILL","SCALE","SORT","interactionOptions","QxsSubjectType","LitElement","emit","canSet","arguments","length","undefined","this","dispatchEvent","CustomEvent","bubbles","composed","detail","render","html","map","item","styles","css","__decorateClass","safeCustomElement"],"mappings":"2LAKA,MAAMA,EAAiB,CACrB,CAAEC,KAAMC,EAAYC,OAAQC,MAAO,OACnC,CAAEH,KAAMC,EAAYG,SAAUD,MAAO,OACrC,CAAEH,KAAMC,EAAYI,WAAYF,MAAO,OACvC,CAAEH,KAAMC,EAAYK,UAAWH,MAAO,OACtC,CAAEH,KAAMC,EAAYM,MAAOJ,MAAO,OAClC,CAAEH,KAAMC,EAAYO,KAAML,MAAO,OACjC,CAAEH,KAAM,WAAYG,MAAO,QAGvBM,EAAqB,CACzB,CAAET,KAAMC,EAAYC,OAAQC,MAAO,OACnC,CAAEH,KAAMC,EAAYG,SAAUD,MAAO,QAIhC,IAAMO,EAAN,cAA6BC,EAgB1BC,IAAAA,CAAKZ,GAA8B,IAAhBa,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GACzBG,KAAKC,cAAc,IAAIC,YAAY,SAAU,CAC3CC,SAAS,EAAMC,UAAU,EACzBC,OAAQ,CAAEtB,OAAMa,YAEpB,CAEAU,MAAAA,GACE,OAAOC,CAAA;;;;;cAKGzB,EAAe0B,IAAIC,GAAQF,CAAA;0CACC,IAAMP,KAAKL,KAAKc,EAAK1B,SAAS0B,EAAKvB;;;;;;;cAO/DM,EAAmBgB,IAAIC,GAAQF,CAAA;0CACH,IAAMP,KAAKL,KAAKc,EAAK1B,MAAM,MAAS0B,EAAKvB;;;;;KAMjF,GA5CWO,EACJiB,OAASC,CAAA;;;;;;;;;;;;;IADLlB,uGAANmB,CAAA,CADNC,EAAkB,qBACNpB"}
@@ -1,15 +1,30 @@
1
- "use strict";var e=require("lit"),t=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),r=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=(e,t,o,n)=>{for(var s,a=n>1?void 0:n?i(t,o):t,c=e.length-1;c>=0;c--)(s=e[c])&&(a=(n?s(t,o,a):s(a))||a);return n&&a&&r(t,o,a),a};const s=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}];var a;exports.QxsSubjectAction=class extends e.LitElement{constructor(){super(...arguments),this.isEdit=!1,this.isSet=!1,this.isKey=!1,this.answerCheckType=1,this.showOtherOption=!1,this.showRichText=!0,this.hideAddRichText=!1,this.pageEnd=!1,this.examAnswerRelationType=0,this._modalOpen=!1,this._currentCheckType=1}updated(e){e.has("answerCheckType")&&(this._currentCheckType=this.answerCheckType)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return s.find(e=>e.value===this.answerCheckType)?.label??""}_renderEditMode(){return e.html`
1
+ "use strict";var e=require("lit"),t=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),o=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,n=(e,t,o,n)=>{for(var r,a=n>1?void 0:n?s(t,o):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(n?r(t,o,a):r(a))||a);return n&&a&&i(t,o,a),a};const r=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}],a=[{type:"single",label:"单选题"},{type:"multiple",label:"多选题"},{type:"blank_fill",label:"填空题"},{type:"text_fill",label:"问答题"},{type:"scale",label:"量表题"},{type:"sort",label:"排序题"},{type:"page_end",label:"分页符"}];var l;exports.QxsSubjectAction=class extends e.LitElement{constructor(){super(...arguments),this.isEdit=!1,this.isSet=!1,this.isKey=!1,this.answerCheckType=1,this.showOtherOption=!1,this.showAnswerSetting=!1,this.showKey=!1,this.showRichText=!1,this.hideAddRichText=!1,this.pageEnd=!1,this.showMove=!1,this.showAdd=!0,this.showJump=!1,this.examAnswerRelationType=0,this._modalOpen=!1,this._currentCheckType=1,this._addMenuOpen=!1,this._handleDocumentClick=e=>{const t=e.composedPath(),o=this.shadowRoot?.querySelector(".add-menu-wrap");o&&!t.includes(o)&&(this._addMenuOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick)}updated(e){e.has("answerCheckType")&&(this._currentCheckType=this.answerCheckType)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return r.find(e=>e.value===this.answerCheckType)?.label??""}get _showAnswerSetting(){return this.showOtherOption||this.showAnswerSetting}get _showKey(){return this.showOtherOption||this.showKey}_renderEditMode(){return e.html`
2
2
  <div class="left">
3
- ${this.hideAddRichText?"":e.html`
4
- <span class="link-btn" @click=${()=>this._emit("on-show-rich-text")}>+添加题目描述(图文)</span>
5
- `}
6
- ${this.showOtherOption?e.html`
7
- <span class="link-btn" @click=${()=>{this._modalOpen=!0}}>答题设置</span>
8
- <label class="checkbox-label">
9
- <input type="checkbox" .checked=${this.isKey} @change=${e=>this._emit("set-key",{value:e.target.checked})} />
10
- 核心题
11
- </label>
12
- `:""}
3
+ <span class="inline-actions">
4
+ ${this.showAdd?e.html`
5
+ <span class="add-menu-wrap">
6
+ <span class="link-btn" @click=${()=>{this._addMenuOpen=!this._addMenuOpen}}>在此题后加入新题</span>
7
+ ${this._renderAddMenu()}
8
+ </span>
9
+ `:""}
10
+ ${this.hideAddRichText?"":e.html`
11
+ <span class="link-btn" @click=${()=>this._emit("on-show-rich-text")}>
12
+ ${this.showRichText?"删除题目描述(图文)":"+添加题目描述(图文)"}
13
+ </span>
14
+ `}
15
+ ${this.showJump?e.html`
16
+ <span class="link-btn" @click=${()=>this._emit("jump")}>${this.isSet?"编辑跳题逻辑":"设置跳题逻辑"}</span>
17
+ `:""}
18
+ ${this._showAnswerSetting?e.html`
19
+ <span class="link-btn" @click=${()=>{this._modalOpen=!0}}>答题设置</span>
20
+ `:""}
21
+ ${this._showKey?e.html`
22
+ <label class="checkbox-label">
23
+ <input type="checkbox" .checked=${this.isKey} @change=${e=>this._emit("set-key",{value:e.target.checked})} />
24
+ 核心题
25
+ </label>
26
+ `:""}
27
+ </span>
13
28
  </div>
14
29
  <div class="right">
15
30
  <button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>
@@ -17,16 +32,33 @@
17
32
  </div>
18
33
  `}_renderViewMode(){return e.html`
19
34
  <div class="left">
20
- ${this.showOtherOption?e.html`
21
- <label class="checkbox-label disabled">
22
- <input type="checkbox" disabled .checked=${this.isKey} /> 核心题
23
- </label>
24
- <span class="answer-text">${this._answerText}</span>
25
- `:""}
35
+ <span class="inline-actions">
36
+ ${this._showKey?e.html`
37
+ <label class="checkbox-label disabled">
38
+ <input type="checkbox" disabled .checked=${this.isKey} /> 核心题
39
+ </label>
40
+ `:""}
41
+ ${this._showAnswerSetting?e.html`
42
+ <span class="answer-text">${this._answerText}</span>
43
+ `:""}
44
+ ${this.showAdd?e.html`
45
+ <span class="add-menu-wrap">
46
+ <span class="link-btn" @click=${()=>{this._addMenuOpen=!this._addMenuOpen}}>在此题后加入新题</span>
47
+ ${this._renderAddMenu()}
48
+ </span>
49
+ `:""}
50
+ ${this.showJump?e.html`
51
+ <span class="link-btn" @click=${()=>this._emit("jump")}>${this.isSet?"编辑跳题逻辑":"设置跳题逻辑"}</span>
52
+ `:""}
53
+ </span>
26
54
  </div>
27
55
  <div class="right">
28
- <button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>
29
- ${this.pageEnd?"":e.html`
56
+ ${!this.isSet&&this.showMove?e.html`
57
+ <button class="text-btn text-btn--default" @click=${()=>this._emit("move","up")}>上移</button>
58
+ <button class="text-btn text-btn--default btn-margin" @click=${()=>this._emit("move","down")}>下移</button>
59
+ `:""}
60
+ ${this.isSet?"":e.html`<button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>`}
61
+ ${this.pageEnd||this.isSet?"":e.html`
30
62
  <button class="text-btn text-btn--default" @click=${()=>this._emit("edit")}>编辑</button>
31
63
  `}
32
64
  </div>
@@ -38,7 +70,7 @@
38
70
  <button class="modal-close" @click=${()=>{this._modalOpen=!1}}>&#x2715;</button>
39
71
  </div>
40
72
  <div class="modal-body">
41
- ${s.map(t=>e.html`
73
+ ${r.map(t=>e.html`
42
74
  <label class="radio-item">
43
75
  <input type="radio" name="answer-check-type" .value=${String(t.value)}
44
76
  .checked=${this._currentCheckType===t.value}
@@ -53,9 +85,16 @@
53
85
  </div>
54
86
  </div>
55
87
  </div>
88
+ `:""}_renderAddMenu(){return this._addMenuOpen?e.html`
89
+ <div class="add-menu">
90
+ ${a.map(t=>e.html`
91
+ <button class="add-item" @click=${()=>{this._addMenuOpen=!1,this._emit("add",t.type)}}>${t.label}</button>
92
+ `)}
93
+ </div>
56
94
  `:""}render(){return e.html`
57
95
  <div class="action ${this.isEdit?"active":""}">
58
- ${this.isSet?e.html`<div class="has-set">*此题设置了跳题逻辑</div>`:this.isEdit?this._renderEditMode():this._renderViewMode()}
96
+ ${this.isEdit?this._renderEditMode():this._renderViewMode()}
97
+ ${this.isSet?e.html`<div class="has-set">*此题设置了跳题逻辑</div>`:""}
59
98
  </div>
60
99
  ${this._renderModal()}
61
100
  `}},exports.QxsSubjectAction.styles=e.css`
@@ -114,5 +153,20 @@
114
153
 
115
154
  .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }
116
155
  .radio-item:last-child { margin-bottom: 0; }
117
- `,n([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectAction.prototype,"isEdit",2),n([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectAction.prototype,"isSet",2),n([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectAction.prototype,"isKey",2),n([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectAction.prototype,"answerCheckType",2),n([t.property({type:Boolean,attribute:"show-other-option"})],exports.QxsSubjectAction.prototype,"showOtherOption",2),n([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectAction.prototype,"showRichText",2),n([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectAction.prototype,"hideAddRichText",2),n([t.property({type:Boolean,attribute:"page-end"})],exports.QxsSubjectAction.prototype,"pageEnd",2),n([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectAction.prototype,"examAnswerRelationType",2),n([o.state()],exports.QxsSubjectAction.prototype,"_modalOpen",2),n([o.state()],exports.QxsSubjectAction.prototype,"_currentCheckType",2),exports.QxsSubjectAction=n([(a="qxs-subject-action",function(e){return customElements.get(a)||customElements.define(a,e),e})],exports.QxsSubjectAction);
156
+
157
+ .inline-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
158
+ .add-menu-wrap { position: relative; display: inline-flex; }
159
+ .add-menu {
160
+ position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;
161
+ display: grid; grid-template-columns: repeat(2, minmax(84px, 1fr)); gap: 8px;
162
+ min-width: 196px; padding: 10px; background: #fff; border: 1px solid #e4e7ed;
163
+ border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12);
164
+ }
165
+ .add-item {
166
+ display: inline-flex; align-items: center; justify-content: center;
167
+ min-height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px;
168
+ background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;
169
+ }
170
+ .add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
171
+ `,n([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectAction.prototype,"isEdit",2),n([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectAction.prototype,"isSet",2),n([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectAction.prototype,"isKey",2),n([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectAction.prototype,"answerCheckType",2),n([t.property({type:Boolean,attribute:"show-other-option"})],exports.QxsSubjectAction.prototype,"showOtherOption",2),n([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectAction.prototype,"showAnswerSetting",2),n([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectAction.prototype,"showKey",2),n([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectAction.prototype,"showRichText",2),n([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectAction.prototype,"hideAddRichText",2),n([t.property({type:Boolean,attribute:"page-end"})],exports.QxsSubjectAction.prototype,"pageEnd",2),n([t.property({type:Boolean,attribute:"show-move"})],exports.QxsSubjectAction.prototype,"showMove",2),n([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectAction.prototype,"showAdd",2),n([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectAction.prototype,"showJump",2),n([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectAction.prototype,"examAnswerRelationType",2),n([o.state()],exports.QxsSubjectAction.prototype,"_modalOpen",2),n([o.state()],exports.QxsSubjectAction.prototype,"_currentCheckType",2),n([o.state()],exports.QxsSubjectAction.prototype,"_addMenuOpen",2),exports.QxsSubjectAction=n([(l="qxs-subject-action",function(e){return customElements.get(l)||customElements.define(l,e),e})],exports.QxsSubjectAction);
118
172
  //# sourceMappingURL=action.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"action.cjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction 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; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\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 get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>&#x2715;</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","tagName","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","html","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"+cAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAZrB,IAA2BC,EAgBdC,QAAAA,iBAAN,cAA+BC,EAAAA,WAA/BC,WAAAA,GAAAC,SAAAC,WA2D8CC,KAAAC,QAAS,EACVD,KAAAE,OAAQ,EACRF,KAAAG,OAAQ,EACEH,KAAAI,gBAAkB,EACjBJ,KAAAK,iBAAkB,EACrBL,KAAAM,cAAe,EACXN,KAAAO,iBAAkB,EAC5BP,KAAAQ,SAAU,EACMR,KAAAS,uBAAyB,EAEpFT,KAAQU,YAAa,EACrBV,KAAQW,kBAAoB,CAAA,CAErCC,OAAAA,CAAQC,GACFA,EAAQC,IAAI,qBACdd,KAAKW,kBAAoBX,KAAKI,gBAElC,CAEQW,KAAAA,CAAMC,EAAcC,GAC1BjB,KAAKkB,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,eAAYK,GACV,OAAO/B,EAAegC,KAAKC,GAAKA,EAAEhC,QAAUQ,KAAKI,kBAAkBX,OAAS,EAC9E,CAEQgC,eAAAA,GACN,OAAOC,EAAAA,IAAA;;UAEA1B,KAAKO,gBAIJ,GAHAmB,EAAAA,IAAA;0CAC8B,IAAM1B,KAAKe,MAAM;;UAGjDf,KAAKK,gBACHqB,EAAAA,IA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/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst addSubjectOptions = [\n { type: 'single', label: '单选题' },\n { type: 'multiple', label: '多选题' },\n { type: 'blank_fill', label: '填空题' },\n { type: 'text_fill', label: '问答题' },\n { type: 'scale', label: '量表题' },\n { type: 'sort', label: '排序题' },\n { type: 'page_end', label: '分页符' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction 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; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n\n .inline-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }\n .add-menu-wrap { position: relative; display: inline-flex; }\n .add-menu {\n position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;\n display: grid; grid-template-columns: repeat(2, minmax(84px, 1fr)); gap: 8px;\n min-width: 196px; padding: 10px; background: #fff; border: 1px solid #e4e7ed;\n border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12);\n }\n .add-item {\n display: inline-flex; align-items: center; justify-content: center;\n min-height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px;\n background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;\n }\n .add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-answer-setting' }) showAnswerSetting = false\n @property({ type: Boolean, attribute: 'show-key' }) showKey = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = false\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Boolean, attribute: 'show-move' }) showMove = false\n @property({ type: Boolean, attribute: 'show-add' }) showAdd = true\n @property({ type: Boolean, attribute: 'show-jump' }) showJump = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n @state() private _addMenuOpen = false\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrap = this.shadowRoot?.querySelector('.add-menu-wrap')\n if (wrap && !path.includes(wrap)) {\n this._addMenuOpen = false\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 get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private get _showAnswerSetting() {\n return this.showOtherOption || this.showAnswerSetting\n }\n\n private get _showKey() {\n return this.showOtherOption || this.showKey\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this.showAdd\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>\n ${this.showRichText ? '删除题目描述(图文)' : '+添加题目描述(图文)'}\n </span>\n `\n : ''}\n ${this.showJump\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this.isSet ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n `\n : ''}\n ${this._showKey\n ? html`\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this._showKey\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n ${this.showAdd\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${this.showJump\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this.isSet ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n ${!this.isSet && this.showMove\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('move', 'up')}>上移</button>\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('move', 'down')}>下移</button>\n `\n : ''}\n ${!this.isSet\n ? html`<button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>`\n : ''}\n ${!this.pageEnd && !this.isSet\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>&#x2715;</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private _renderAddMenu() {\n if (!this._addMenuOpen) { return '' }\n return html`\n <div class=\"add-menu\">\n ${addSubjectOptions.map(item => html`\n <button class=\"add-item\" @click=${() => {\n this._addMenuOpen = false\n this._emit('add', item.type)\n }}>${item.label}</button>\n `)}\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isEdit ? this._renderEditMode() : this._renderViewMode()}\n ${this.isSet ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>` : ''}\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","addSubjectOptions","type","tagName","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showAnswerSetting","showKey","showRichText","hideAddRichText","pageEnd","showMove","showAdd","showJump","examAnswerRelationType","_modalOpen","_currentCheckType","_addMenuOpen","_handleDocumentClick","e","path","composedPath","wrap","shadowRoot","querySelector","includes","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_showAnswerSetting","_showKey","_renderEditMode","html","_renderAddMenu","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"+cAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGfC,EAAoB,CACxB,CAAEC,KAAM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