@qxs-bns/components-wc 0.0.9 → 0.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/editor/blocksuite-editor.mjs +27 -18
- package/es/editor/blocksuite-editor.mjs.map +1 -1
- package/es/index.mjs +1 -1
- package/es/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.mjs.map +1 -0
- package/es/subject/action.mjs +3 -3
- package/es/subject/action.mjs.map +1 -1
- package/es/subject/blank-fill.mjs +5 -5
- package/es/subject/blank-fill.mjs.map +1 -1
- package/es/subject/layout.mjs +5 -5
- package/es/subject/layout.mjs.map +1 -1
- package/es/subject/list.mjs +14 -51
- package/es/subject/list.mjs.map +1 -1
- package/es/subject/scale.mjs +5 -5
- package/es/subject/scale.mjs.map +1 -1
- package/es/subject/single.mjs +6 -6
- package/es/subject/single.mjs.map +1 -1
- package/es/subject/text-fill.mjs +4 -4
- package/es/subject/text-fill.mjs.map +1 -1
- package/es/subject/types.mjs +2 -0
- package/es/subject/types.mjs.map +1 -0
- package/lib/editor/blocksuite-editor.cjs +17 -8
- package/lib/editor/blocksuite-editor.cjs.map +1 -1
- package/lib/index.cjs +1 -1
- package/lib/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.cjs.map +1 -0
- package/lib/subject/action.cjs +1 -1
- package/lib/subject/action.cjs.map +1 -1
- package/lib/subject/blank-fill.cjs +4 -4
- package/lib/subject/blank-fill.cjs.map +1 -1
- package/lib/subject/layout.cjs +3 -3
- package/lib/subject/layout.cjs.map +1 -1
- package/lib/subject/list.cjs +13 -50
- package/lib/subject/list.cjs.map +1 -1
- package/lib/subject/scale.cjs +4 -4
- package/lib/subject/scale.cjs.map +1 -1
- package/lib/subject/single.cjs +5 -5
- package/lib/subject/single.cjs.map +1 -1
- package/lib/subject/text-fill.cjs +3 -3
- package/lib/subject/text-fill.cjs.map +1 -1
- package/lib/subject/types.cjs +2 -0
- package/lib/subject/types.cjs.map +1 -0
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"single.mjs","sources":["../../../../packages/components-wc/src/subject/single.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\n\nexport interface SubjectErrorOptions {\n message: string\n code?: string\n field?: string\n row?: any\n}\n\nexport class SubjectError extends Error {\n constructor(\n message: string,\n public code: string = 'VALIDATION_ERROR',\n public field?: string,\n public row?: any,\n ) {\n super(message)\n this.name = 'SubjectError'\n }\n\n static from(options: SubjectErrorOptions): SubjectError {\n return new SubjectError(options.message, options.code, options.field, options.row)\n }\n}\n\ninterface Answer {\n title: string\n isCorrect: boolean\n customAnswerId?: string\n answerId?: string\n resultItem?: string\n orderIndex?: number\n answerRelations?: any[]\n relationType?: number | null\n}\n\nconst iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconClose = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>`\nconst iconArrow = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"6 9 12 15 18 9\"/></svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-subject-single')\nexport class QxsSubjectSingle extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-select {\n width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n background-repeat: no-repeat; background-position: right 8px center;\n }\n .el-select:focus { border-color: #3D61E3; outline: none; }\n .el-select:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-select.sort-select {\n width: 360px; height: auto; min-height: 32px; appearance: auto;\n }\n\n .sort-badge { font-weight: bold; color: #3D61E3; margin-left: 10px; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n /* Multi-select with tags (Element Plus style) */\n .multi-select-wrapper { position: relative; }\n .multi-select {\n width: 240px; height: 28px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 30px 0 8px; font-size: 13px; background: #fff; cursor: pointer;\n display: flex; flex-wrap: nowrap; align-items: center; gap: 4px;\n transition: border-color .2s; position: relative; overflow: hidden;\n }\n .multi-select:hover { border-color: #c0c4cc; }\n .multi-select.focused { border-color: #3D61E3; }\n .multi-select.disabled { background: #f5f7fa; cursor: not-allowed; }\n .multi-select .placeholder { color: #c0c4cc; font-size: 13px; padding: 4px 0; }\n .multi-select .arrow {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n color: #c0c4cc; display: inline-flex; transition: transform .2s;\n }\n .multi-select.focused .arrow { transform: translateY(-50%) rotate(180deg); color: #3D61E3; }\n .multi-select .tag {\n display: inline-flex; align-items: center; gap: 2px;\n background: #f0f2f5; border-radius: 3px; padding: 0 6px; height: 20px;\n font-size: 12px; color: #606266; line-height: 20px;\n }\n .multi-select .tag .tag-close {\n display: inline-flex; cursor: pointer; color: #909399; margin-left: 2px; line-height: 1;\n }\n .multi-select .tag .tag-close:hover { color: #3D61E3; }\n .multi-select-dropdown {\n position: absolute; z-index: 100; background: #fff; left: 0; top: 100%; margin-top: 4px;\n border: 1px solid #e4e7ed; border-radius: 3px;\n box-shadow: 0 4px 12px rgba(0,0,0,.12); min-width: 240px; max-height: 140px; overflow-y: auto;\n }\n .multi-select-option {\n padding: 4px 12px; font-size: 13px; color: #606266; cursor: pointer;\n transition: background .2s;\n }\n .multi-select-option:hover { background: #f5f7fa; }\n .multi-select-option.selected { color: #3D61E3; font-weight: 500; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String }) type: 'single' | 'multiple' | 'sort' = 'single'\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'least-answer-count' }) leastAnswerCount = 2\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Number, attribute: 'exam-id' }) examId = 0\n @property({ type: Object }) uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' })\n get answerList() { return this._answers }\n\n set answerList(v: any) {\n const arr = Array.isArray(v) ? v : []\n this._answers = arr.length\n ? arr.map((a: any) => ({ ...a }))\n : [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n this.requestUpdate('answerList')\n }\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _answers: Answer[] = [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _richText = ''\n @state() private _showRichText = false\n @state() private _leastAnswerCount = 2\n @state() private _answerCheckType = 1\n @state() private _orderList: string[] = []\n @state() private _resultDialogOpen = false\n @state() private _resultDialogIndex = 0\n @state() private _resultDialogValue = ''\n @state() private _sortDropdownOpen = false\n\n private readonly TITLE_MAX = 200\n private readonly ANSWER_MAX = 100\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrapper = this.shadowRoot?.querySelector('.multi-select-wrapper')\n if (wrapper && !path.includes(wrapper)) {\n this._sortDropdownOpen = false\n this.requestUpdate()\n }\n }\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (changed.has('examExpand') || changed.has('answerList')) { this._syncExamExpand() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue\n }\n }\n\n private _syncProps() {\n this._title = (this as any).title || ''\n this._analysis = this.analysis || ''\n this._leastAnswerCount = this.leastAnswerCount || 2\n this._answerCheckType = this.answerCheckType || 1\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({\n ...a,\n title: a.title || '',\n isCorrect: !!a.isCorrect,\n }))\n }\n this._syncExamExpand()\n }\n\n private _syncExamExpand() {\n if (!this.examExpand || !this.answerList?.length) { return }\n const ids = this.examExpand.split(',')\n this._orderList = ids.map((id) => {\n const answer = (this.answerList as any[]).find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _label(i: number) { return String.fromCharCode(65 + i) }\n\n private get _titlePlaceholder() {\n return this.type === 'single' ? '单选题' : this.type === 'multiple' ? '多选题' : '排序题'\n }\n\n private _setCorrect(item: Answer, val: boolean) {\n if (this.type === 'single') {\n this._answers.forEach((a) => { a.isCorrect = false })\n item.isCorrect = val\n }\n else {\n item.isCorrect = val\n }\n this.requestUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n // 双向绑定:通知外部更新\n if (this.useModel) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private _onAnswerInput(e: Event, idx: number) {\n const el = e.target as HTMLInputElement\n if (el.value.length > this.ANSWER_MAX) { el.value = el.value.slice(0, this.ANSWER_MAX) }\n this._answers[idx].title = el.value\n this.requestUpdate()\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', isCorrect: false, customAnswerId: uid() }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 3 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private _toggleSortItem(letter: string) {\n const idx = this._orderList.indexOf(letter)\n if (idx >= 0) {\n this._orderList = this._orderList.filter(l => l !== letter)\n }\n else {\n this._orderList = [...this._orderList, letter]\n }\n this.requestUpdate()\n }\n\n private _removeSortItem(letter: string) {\n this._orderList = this._orderList.filter(l => l !== letter)\n this.requestUpdate()\n }\n\n private _getSortOrder(index: number): number | null {\n const pos = this._orderList.indexOf(this._label(index))\n return pos >= 0 ? pos + 1 : null\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const examExpand = this.isEdit\n ? this._orderList.map((l: string) => l.charCodeAt(0) - 65 + 1).join(',')\n : ((this as any).examExpand || '')\n const showRichText = this.isEdit ? this._showRichText : !!(this.richTextContent)\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (!answerCheckType) {\n reject(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n return\n }\n\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) { msg += `选项${String.fromCharCode(65 + i)}未填写。` }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n reject(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n return\n }\n }\n\n if (msg) {\n reject(new SubjectError(msg, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length) {\n reject(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n return\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1) {\n reject(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n return\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n reject(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n return\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n reject(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n return\n }\n }\n\n const result: any = {\n answerType: this.type,\n title,\n answers: answers.filter((a: any) => a.title).map((a: any, i: number) => ({ ...a, orderIndex: i + 1 })),\n examExpand,\n analysis,\n isSetCorrectAnswer,\n leastAnswerCount,\n examRichTextContent: showRichText ? richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n isKey: this.isKey,\n answerCheckType,\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (!answerCheckType) {\n errors.push(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n }\n\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n errors.push(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n }\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length && answers.length > 0) {\n errors.push(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1 && answers.length > 0) {\n errors.push(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n errors.push(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n errors.push(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n }\n }\n\n return errors\n }\n\n private _openResultDialog(idx: number) {\n this._resultDialogIndex = idx\n this._resultDialogValue = this._answers[idx].resultItem || ''\n this._resultDialogOpen = true\n }\n\n private _saveResultDialog() {\n this._answers[this._resultDialogIndex].resultItem = this._resultDialogValue\n this._resultDialogOpen = false\n this.requestUpdate()\n }\n\n private _renderResultDialog() {\n if (!this._resultDialogOpen) { return '' }\n const letter = this._label(this._resultDialogIndex)\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._resultDialogOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">编辑结果项 — 选项 ${letter}</span>\n <button class=\"modal-close\" @click=${() => { this._resultDialogOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n <textarea rows=\"5\" .value=${this._resultDialogValue}\n @input=${(e: Event) => { this._resultDialogValue = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入该选项的结果项内容\"></textarea>\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._resultDialogOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => this._saveResultDialog()}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n private _renderPreview() {\n const typeSuffix = this.type === 'single'\n ? '(单选题)'\n : `(${this._titlePlaceholder}${this.leastAnswerCount ? `至少选${this.leastAnswerCount}项${this.type === 'sort' ? '并排序' : ''}` : ''})`\n const answers = this.answerList as Answer[]\n return html`\n <div class=\"preview\">\n <div><span class=\"title\">${this.orderIndex + 1}.${(this as any).title || ''}${typeSuffix}</span></div>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n <div class=\"preview-answer\">\n ${answers.map((a, i) => html`\n <label class=\"radio\">\n <input type=\"${this.type === 'sort' ? 'checkbox' : 'radio'}\" disabled />\n <span class=\"order\">${this._label(i)}.</span> ${a.title}\n ${this.type !== 'sort' && a.isCorrect ? html`<span class=\"correct\">(支持选项)</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 1 ? html`<span class=\"result-info\">${a.resultItem ? '(已设置结果项)' : '(未设置结果项)'}</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 2 ? html`<span class=\"result-info\">${a.answerRelations?.length ? '(已设置关联)' : '(未设置关联)'}</span>` : ''}\n </label>\n `)}\n </div>\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【${this._titlePlaceholder}】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n ${['multiple', 'sort'].includes(this.type)\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>设置:</span></div>\n <select class=\"el-select\" .value=${String(this._leastAnswerCount)} ?disabled=${this.isSave}\n @change=${(e: Event) => { this._leastAnswerCount = Number((e.target as HTMLSelectElement).value) }}>\n ${Array.from({ length: Math.max(0, this._answers.length - 1) }, (_, i) => i + 2).map(n => html`\n <option value=${n} ?selected=${this._leastAnswerCount === n}>至少选择${n}项</option>\n `)}\n </select>\n </div>\n `\n : ''}\n\n <div class=\"answer-list\">\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${this._label(i)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${a.title} ?disabled=${this.isSave}\n maxlength=${this.ANSWER_MAX}\n @input=${(e: Event) => this._onAnswerInput(e, i)}\n placeholder=\"选项${this._label(i)}\" />\n <span class=\"char-counter\">${a.title.length}/${this.ANSWER_MAX}</span>\n </div>\n\n ${this.type === 'sort' && this._getSortOrder(i) !== null\n ? html`<span class=\"sort-badge\">第${this._getSortOrder(i)}位</span>`\n : ''}\n\n ${['single', 'multiple'].includes(this.type)\n ? html`\n <label class=\"correct ${a.isCorrect ? 'is-correct' : ''}\">\n <input type=\"checkbox\" .checked=${a.isCorrect} ?disabled=${this.isSave}\n @change=${(e: Event) => this._setCorrect(a, (e.target as HTMLInputElement).checked)} />\n 支持选项\n </label>\n `\n : ''}\n\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\"\n @click=${() => this._addAnswer()}>\n ${iconPlus}\n </span>\n <span class=\"icon ${this.isSave || this._answers.length < 3 ? 'disabled' : ''}\"\n @click=${() => this._deleteAnswer(i)}>\n ${iconRemove}\n </span>\n\n ${this.examAnswerRelationType === 1 && this.type !== 'sort'\n ? html`\n <span class=\"link\" @click=${() => this._openResultDialog(i)}>${a.resultItem ? '编辑结果' : '添加结果'}</span>\n `\n : ''}\n ${this.examAnswerRelationType === 2 && this.type !== 'sort'\n ? html`\n <span class=\"link\">关联检查</span>\n `\n : ''}\n </div>\n `)}\n </div>\n\n ${this.type === 'sort'\n ? html`\n <div class=\"flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>排序答案:</span></div>\n <div style=\"flex:1\">\n <div class=\"multi-select-wrapper\">\n <div class=\"multi-select ${this._sortDropdownOpen ? 'focused' : ''} ${this.isSave ? 'disabled' : ''}\"\n @click=${() => { if (!this.isSave) { this._sortDropdownOpen = !this._sortDropdownOpen; this.requestUpdate() } }}>\n ${this._orderList.length > 0\n ? this._orderList.map(l => html`\n <span class=\"tag\">\n ${l}\n <span class=\"tag-close\" @click=${(e: Event) => { e.stopPropagation(); this._removeSortItem(l) }}>✕</span>\n </span>\n `)\n : html`<span class=\"placeholder\">请按顺序选择排序答案</span>`\n }\n <span class=\"arrow\">${iconArrow}</span>\n </div>\n ${this._sortDropdownOpen\n ? html`\n <div class=\"multi-select-dropdown\">\n ${this._answers.map((_, i) => html`\n <div class=\"multi-select-option ${this._orderList.includes(this._label(i)) ? 'selected' : ''}\"\n @click=${() => { this._toggleSortItem(this._label(i)); this.requestUpdate() }}>\n ${this._label(i)}\n </div>\n `)}\n </div>\n `\n : ''}\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?is-key=${this.isKey}\n ?show-other-option=${this.type === 'multiple' || this.type === 'single'}\n answer-check-type=${this._answerCheckType}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @set-answer-setting=${(e: CustomEvent) => { this._answerCheckType = e.detail.value }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n ${this._renderResultDialog()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectError","Error","constructor","message","code","arguments","length","undefined","field","row","super","this","name","from","options","iconPlus","html","iconRemove","iconArrow","QxsSubjectSingle","LitElement","orderIndex","isEdit","isSave","isSet","isKey","showAction","showAnalysis","type","answerCheckType","examAnswerRelationType","richTextContent","analysis","leastAnswerCount","examExpand","customId","examId","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","modelValue","useModel","_answers","title","isCorrect","_title","_analysis","_richText","_showRichText","_leastAnswerCount","_answerCheckType","_orderList","_resultDialogOpen","_resultDialogIndex","_resultDialogValue","_sortDropdownOpen","TITLE_MAX","ANSWER_MAX","_handleDocumentClick","path","composedPath","wrapper","shadowRoot","querySelector","includes","requestUpdate","answerList","v","arr","Array","isArray","map","a","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","willUpdate","changed","has","_syncProps","_syncExamExpand","ids","split","id","answer","find","answerId","toString","String","fromCharCode","filter","Boolean","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_label","i","_titlePlaceholder","_setCorrect","item","val","forEach","_onTitleInput","el","value","slice","_onAnswerInput","idx","_addAnswer","customAnswerId","uid","_deleteAnswer","index","_","_toggleSortItem","letter","indexOf","l","_removeSortItem","_getSortOrder","pos","toJSON","answerType","answers","charCodeAt","join","showRichText","richText","orderList","expand","msg","isSetCorrectAnswer","correctAnswerCount","trim","Set","size","examRichTextContent","validate","errors","push","_openResultDialog","resultItem","_saveResultDialog","_renderResultDialog","stopPropagation","_save","stopImmediatePropagation","data","err","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","_renderPreview","typeSuffix","answerRelations","_renderEdit","Number","Math","max","n","checked","getContent","render","styles","css","__decorateClass","property","attribute","prototype","state","safeCustomElement"],"mappings":"2lBAYO,MAAMA,UAAqBC,MAChCC,WAAAA,CACEC,GAIA,IAHOC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAe,mBACfG,yCACAC,EAAAJ,UAAAC,OAAA,EAAAD,kBAAAE,EAEPG,MAAMP,GAJCQ,KAAAP,KAAAA,EACAO,KAAAH,MAAAA,EACAG,KAAAF,IAAAA,EAGPE,KAAKC,KAAO,cACd,CAEA,WAAOC,CAAKC,GACV,OAAO,IAAId,EAAac,EAAQX,QAASW,EAAQV,KAAMU,EAAQN,MAAOM,EAAQL,IAChF,EAcF,MAAMM,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLACDA,CAAA,yNAClB,MAAME,EAAYF,CAAA,kLAgBX,IAAMG,EAAN,cAA+BC,EAA/BlB,WAAAA,GAAAQ,SAAAL,WA6IiDM,KAAAU,WAAa,EAChBV,KAAAW,QAAS,EACTX,KAAAY,QAAS,EACVZ,KAAAa,OAAQ,EACRb,KAAAc,OAAQ,EACHd,KAAAe,YAAa,EACXf,KAAAgB,cAAe,EAC5ChB,KAAAiB,KAAuC,SACPjB,KAAAkB,gBAAkB,EACVlB,KAAAmB,uBAAyB,EACjCnB,KAAAoB,gBAAkB,GAClDpB,KAAAqB,SAAW,GACsBrB,KAAAsB,iBAAmB,EAC1BtB,KAAAuB,WAAa,GACfvB,KAAAwB,SAAW,GACbxB,KAAAyB,OAAS,EAC/BzB,KAAA0B,YAA+CC,SAClE,IA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,EAAA,CAA3BC,EAAS,CAAE9K,KAAM2I,UA7JPpJ,EA6JiByL,UAAA,cAAA,GAUxBH,EAAA,CADHC,EAAS,CAAE9K,KAAMoD,MAAO2H,UAAW,iBAtKzBxL,EAuKPyL,UAAA,aAAA,GAckDH,EAAA,CAArDC,EAAS,CAAE9K,KAAMyE,OAAQsG,UAAW,iBArL1BxL,EAqL2CyL,UAAA,aAAA,GACDH,EAAA,CAApDC,EAAS,CAAE9K,KAAM4E,QAASmG,UAAW,eAtL3BxL,EAsL0CyL,UAAA,WAAA,GAEpCH,EAAA,CAAhBI,KAxLU1L,EAwLMyL,UAAA,WAAA,GAKAH,EAAA,CAAhBI,KA7LU1L,EA6LMyL,UAAA,SAAA,GACAH,EAAA,CAAhBI,KA9LU1L,EA8LMyL,UAAA,YAAA,GACAH,EAAA,CAAhBI,KA/LU1L,EA+LMyL,UAAA,YAAA,GACAH,EAAA,CAAhBI,KAhMU1L,EAgMMyL,UAAA,gBAAA,GACAH,EAAA,CAAhBI,KAjMU1L,EAiMMyL,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KAlMU1L,EAkMMyL,UAAA,mBAAA,GACAH,EAAA,CAAhBI,KAnMU1L,EAmMMyL,UAAA,aAAA,GACAH,EAAA,CAAhBI,KApMU1L,EAoMMyL,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KArMU1L,EAqMMyL,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAtMU1L,EAsMMyL,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAvMU1L,EAuMMyL,UAAA,oBAAA,GAvMNzL,EAANsL,EAAA,CADNK,EAAkB,uBACN3L"}
|
|
1
|
+
{"version":3,"file":"single.mjs","sources":["../../../../packages/components-wc/src/subject/single.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { ExamType, ExamTypeMap, getExamType } from './types'\n\nexport interface SubjectErrorOptions {\n message: string\n code?: string\n field?: string\n row?: any\n}\n\nexport class SubjectError extends Error {\n constructor(\n message: string,\n public code: string = 'VALIDATION_ERROR',\n public field?: string,\n public row?: any,\n ) {\n super(message)\n this.name = 'SubjectError'\n }\n\n static from(options: SubjectErrorOptions): SubjectError {\n return new SubjectError(options.message, options.code, options.field, options.row)\n }\n}\n\ninterface Answer {\n title: string\n isCorrect: boolean\n customAnswerId?: string\n answerId?: string\n resultItem?: string\n orderIndex?: number\n answerRelations?: any[]\n relationType?: number | null\n}\n\nconst iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconClose = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"/><line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"/></svg>`\nconst iconArrow = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"6 9 12 15 18 9\"/></svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-subject-single')\nexport class QxsSubjectSingle extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-select {\n width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n background-repeat: no-repeat; background-position: right 8px center;\n }\n .el-select:focus { border-color: #3D61E3; outline: none; }\n .el-select:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-select.sort-select {\n width: 360px; height: auto; min-height: 32px; appearance: auto;\n }\n\n .sort-badge { font-weight: bold; color: #3D61E3; margin-left: 10px; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n /* Multi-select with tags (Element Plus style) */\n .multi-select-wrapper { position: relative; }\n .multi-select {\n width: 240px; height: 28px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 30px 0 8px; font-size: 13px; background: #fff; cursor: pointer;\n display: flex; flex-wrap: nowrap; align-items: center; gap: 4px;\n transition: border-color .2s; position: relative; overflow: hidden;\n }\n .multi-select:hover { border-color: #c0c4cc; }\n .multi-select.focused { border-color: #3D61E3; }\n .multi-select.disabled { background: #f5f7fa; cursor: not-allowed; }\n .multi-select .placeholder { color: #c0c4cc; font-size: 13px; padding: 4px 0; }\n .multi-select .arrow {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n color: #c0c4cc; display: inline-flex; transition: transform .2s;\n }\n .multi-select.focused .arrow { transform: translateY(-50%) rotate(180deg); color: #3D61E3; }\n .multi-select .tag {\n display: inline-flex; align-items: center; gap: 2px;\n background: #f0f2f5; border-radius: 3px; padding: 0 6px; height: 20px;\n font-size: 12px; color: #606266; line-height: 20px;\n }\n .multi-select .tag .tag-close {\n display: inline-flex; cursor: pointer; color: #909399; margin-left: 2px; line-height: 1;\n }\n .multi-select .tag .tag-close:hover { color: #3D61E3; }\n .multi-select-dropdown {\n position: absolute; z-index: 100; background: #fff; left: 0; top: 100%; margin-top: 4px;\n border: 1px solid #e4e7ed; border-radius: 3px;\n box-shadow: 0 4px 12px rgba(0,0,0,.12); min-width: 240px; max-height: 140px; overflow-y: auto;\n }\n .multi-select-option {\n padding: 4px 12px; font-size: 13px; color: #606266; cursor: pointer;\n transition: background .2s;\n }\n .multi-select-option:hover { background: #f5f7fa; }\n .multi-select-option.selected { color: #3D61E3; font-weight: 500; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String }) type: 'single' | 'multiple' | 'sort' = 'single'\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'least-answer-count' }) leastAnswerCount = 2\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Number, attribute: 'exam-id' }) examId = 0\n @property({ type: Object }) uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' })\n get answerList() { return this._answers }\n\n set answerList(v: any) {\n const arr = Array.isArray(v) ? v : []\n this._answers = arr.length\n ? arr.map((a: any) => ({ ...a }))\n : [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n this.requestUpdate('answerList')\n }\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _answers: Answer[] = [\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n { title: '', isCorrect: false }, { title: '', isCorrect: false },\n ]\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _richText = ''\n @state() private _showRichText = false\n @state() private _leastAnswerCount = 2\n @state() private _answerCheckType = 1\n @state() private _orderList: string[] = []\n @state() private _resultDialogOpen = false\n @state() private _resultDialogIndex = 0\n @state() private _resultDialogValue = ''\n @state() private _sortDropdownOpen = false\n\n private readonly TITLE_MAX = 200\n private readonly ANSWER_MAX = 100\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrapper = this.shadowRoot?.querySelector('.multi-select-wrapper')\n if (wrapper && !path.includes(wrapper)) {\n this._sortDropdownOpen = false\n this.requestUpdate()\n }\n }\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n if (changed.has('examExpand') || changed.has('answerList')) { this._syncExamExpand() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue\n }\n }\n\n private _syncProps() {\n this._title = (this as any).title || ''\n this._analysis = this.analysis || ''\n this._leastAnswerCount = this.leastAnswerCount || 2\n this._answerCheckType = this.answerCheckType || 1\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({\n ...a,\n title: a.title || '',\n isCorrect: !!a.isCorrect,\n }))\n }\n this._syncExamExpand()\n }\n\n private _syncExamExpand() {\n if (!this.examExpand || !this.answerList?.length) { return }\n const ids = this.examExpand.split(',')\n this._orderList = ids.map((id) => {\n const answer = (this.answerList as any[]).find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _label(i: number) { return String.fromCharCode(65 + i) }\n\n private get _titlePlaceholder() {\n return this.type === 'single' ? '单选题' : this.type === 'multiple' ? '多选题' : '排序题'\n }\n\n private _setCorrect(item: Answer, val: boolean) {\n if (this.type === 'single') {\n this._answers.forEach((a) => { a.isCorrect = false })\n item.isCorrect = val\n }\n else {\n item.isCorrect = val\n }\n this.requestUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n // 双向绑定:通知外部更新\n if (this.useModel) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private _onAnswerInput(e: Event, idx: number) {\n const el = e.target as HTMLInputElement\n if (el.value.length > this.ANSWER_MAX) { el.value = el.value.slice(0, this.ANSWER_MAX) }\n this._answers[idx].title = el.value\n this.requestUpdate()\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', isCorrect: false, customAnswerId: uid() }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 3 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private _toggleSortItem(letter: string) {\n const idx = this._orderList.indexOf(letter)\n if (idx >= 0) {\n this._orderList = this._orderList.filter(l => l !== letter)\n }\n else {\n this._orderList = [...this._orderList, letter]\n }\n this.requestUpdate()\n }\n\n private _removeSortItem(letter: string) {\n this._orderList = this._orderList.filter(l => l !== letter)\n this.requestUpdate()\n }\n\n private _getSortOrder(index: number): number | null {\n const pos = this._orderList.indexOf(this._label(index))\n return pos >= 0 ? pos + 1 : null\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const examExpand = this.isEdit\n ? this._orderList.map((l: string) => l.charCodeAt(0) - 65 + 1).join(',')\n : ((this as any).examExpand || '')\n const showRichText = this.isEdit ? this._showRichText : !!(this.richTextContent)\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (!answerCheckType) {\n reject(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n return\n }\n\n let msg = ''\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) { msg += `选项${String.fromCharCode(65 + i)}未填写。` }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n reject(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n return\n }\n }\n\n if (msg) {\n reject(new SubjectError(msg, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length) {\n reject(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n return\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1) {\n reject(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n return\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n reject(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n return\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n reject(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n return\n }\n }\n\n const result: any = {\n answerType: getExamType(this.type),\n title,\n answers: answers.filter((a: any) => a.title).map((a: any, i: number) => ({ ...a, orderIndex: i + 1 })),\n examExpand,\n analysis,\n isSetCorrectAnswer,\n leastAnswerCount,\n examRichTextContent: showRichText ? richText : '',\n examAnswerRelationType: this.examAnswerRelationType,\n isKey: this.isKey,\n answerCheckType,\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: this.type, orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : (this as any).title || ''\n const answers = this.isEdit ? this._answers : this.answerList || []\n const answerCheckType = this.isEdit ? this._answerCheckType : this.answerCheckType || 1\n const leastAnswerCount = this.isEdit ? this._leastAnswerCount : this.leastAnswerCount || 2\n const orderList = this.isEdit ? this._orderList : (() => {\n const expand = (this as any).examExpand\n if (!expand) return []\n return expand.split(',').map((id: string) => {\n const answer = (this.answerList as any[])?.find(a => a.answerId?.toString() === id)\n return answer ? String.fromCharCode(65 + answer.orderIndex - 1) : id\n }).filter(Boolean)\n })()\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (!answerCheckType) {\n errors.push(new SubjectError('请选择答题设置', 'NO_ANSWER_CHECK_TYPE', 'answerCheckType', row))\n }\n\n let isSetCorrectAnswer = false\n let correctAnswerCount = 0\n\n if (this.type === 'multiple' || this.type === 'single') {\n answers.forEach((v: any, i: number) => {\n if (!v.title?.trim()) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n if (v.isCorrect) { isSetCorrectAnswer = true; correctAnswerCount++ }\n })\n }\n else if (this.type === 'sort') {\n if (orderList.length) { isSetCorrectAnswer = true }\n if (isSetCorrectAnswer && orderList.length < leastAnswerCount) {\n errors.push(new SubjectError(`排序题至少需要设置${leastAnswerCount}项排序答案`, 'SORT_COUNT_INVALID', 'orderList', row))\n }\n }\n\n const uniqueAnswer = new Set(answers.map((a: any) => a.title))\n if (uniqueAnswer.size !== answers.length && answers.length > 0) {\n errors.push(new SubjectError('选项不能重复', 'DUPLICATE_ANSWERS', 'answers', row))\n }\n\n if (this.type === 'multiple') {\n if (correctAnswerCount === 1 && answers.length > 0) {\n errors.push(new SubjectError('请至少设置两个支持选项', 'CORRECT_COUNT_INVALID', 'answers', row))\n }\n if (isSetCorrectAnswer && correctAnswerCount < leastAnswerCount) {\n errors.push(new SubjectError('至少选几项与支持选项数不符', 'LEAST_ANSWER_COUNT_INVALID', 'answers', row))\n }\n }\n\n if (answerCheckType === 2 || answerCheckType === 3) {\n if (!isSetCorrectAnswer) {\n errors.push(new SubjectError('请设置支持选项', 'NO_CORRECT_ANSWER', 'answers', row))\n }\n }\n\n return errors\n }\n\n private _openResultDialog(idx: number) {\n this._resultDialogIndex = idx\n this._resultDialogValue = this._answers[idx].resultItem || ''\n this._resultDialogOpen = true\n }\n\n private _saveResultDialog() {\n this._answers[this._resultDialogIndex].resultItem = this._resultDialogValue\n this._resultDialogOpen = false\n this.requestUpdate()\n }\n\n private _renderResultDialog() {\n if (!this._resultDialogOpen) { return '' }\n const letter = this._label(this._resultDialogIndex)\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._resultDialogOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">编辑结果项 — 选项 ${letter}</span>\n <button class=\"modal-close\" @click=${() => { this._resultDialogOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n <textarea rows=\"5\" .value=${this._resultDialogValue}\n @input=${(e: Event) => { this._resultDialogValue = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入该选项的结果项内容\"></textarea>\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._resultDialogOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => this._saveResultDialog()}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n private _renderPreview() {\n const typeSuffix = this.type === 'single'\n ? '(单选题)'\n : `(${this._titlePlaceholder}${this.leastAnswerCount ? `至少选${this.leastAnswerCount}项${this.type === 'sort' ? '并排序' : ''}` : ''})`\n const answers = this.answerList as Answer[]\n return html`\n <div class=\"preview\">\n <div><span class=\"title\">${this.orderIndex + 1}.${(this as any).title || ''}${typeSuffix}</span></div>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n <div class=\"preview-answer\">\n ${answers.map((a, i) => html`\n <label class=\"radio\">\n <input type=\"${this.type === 'sort' ? 'checkbox' : 'radio'}\" disabled />\n <span class=\"order\">${this._label(i)}.</span> ${a.title}\n ${this.type !== 'sort' && a.isCorrect ? html`<span class=\"correct\">(支持选项)</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 1 ? html`<span class=\"result-info\">${a.resultItem ? '(已设置结果项)' : '(未设置结果项)'}</span>` : ''}\n ${this.type !== 'sort' && this.examAnswerRelationType === 2 ? html`<span class=\"result-info\">${a.answerRelations?.length ? '(已设置关联)' : '(未设置关联)'}</span>` : ''}\n </label>\n `)}\n </div>\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【${this._titlePlaceholder}】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n ${['multiple', 'sort'].includes(this.type)\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>设置:</span></div>\n <select class=\"el-select\" .value=${String(this._leastAnswerCount)} ?disabled=${this.isSave}\n @change=${(e: Event) => { this._leastAnswerCount = Number((e.target as HTMLSelectElement).value) }}>\n ${Array.from({ length: Math.max(0, this._answers.length - 1) }, (_, i) => i + 2).map(n => html`\n <option value=${n} ?selected=${this._leastAnswerCount === n}>至少选择${n}项</option>\n `)}\n </select>\n </div>\n `\n : ''}\n\n <div class=\"answer-list\">\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${this._label(i)}.</span>\n <div class=\"input\">\n <input type=\"text\" .value=${a.title} ?disabled=${this.isSave}\n maxlength=${this.ANSWER_MAX}\n @input=${(e: Event) => this._onAnswerInput(e, i)}\n placeholder=\"选项${this._label(i)}\" />\n <span class=\"char-counter\">${a.title.length}/${this.ANSWER_MAX}</span>\n </div>\n\n ${this.type === 'sort' && this._getSortOrder(i) !== null\n ? html`<span class=\"sort-badge\">第${this._getSortOrder(i)}位</span>`\n : ''}\n\n ${['single', 'multiple'].includes(this.type)\n ? html`\n <label class=\"correct ${a.isCorrect ? 'is-correct' : ''}\">\n <input type=\"checkbox\" .checked=${a.isCorrect} ?disabled=${this.isSave}\n @change=${(e: Event) => this._setCorrect(a, (e.target as HTMLInputElement).checked)} />\n 支持选项\n </label>\n `\n : ''}\n\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\"\n @click=${() => this._addAnswer()}>\n ${iconPlus}\n </span>\n <span class=\"icon ${this.isSave || this._answers.length < 3 ? 'disabled' : ''}\"\n @click=${() => this._deleteAnswer(i)}>\n ${iconRemove}\n </span>\n\n ${this.examAnswerRelationType === 1 && this.type !== 'sort'\n ? html`\n <span class=\"link\" @click=${() => this._openResultDialog(i)}>${a.resultItem ? '编辑结果' : '添加结果'}</span>\n `\n : ''}\n ${this.examAnswerRelationType === 2 && this.type !== 'sort'\n ? html`\n <span class=\"link\">关联检查</span>\n `\n : ''}\n </div>\n `)}\n </div>\n\n ${this.type === 'sort'\n ? html`\n <div class=\"flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>排序答案:</span></div>\n <div style=\"flex:1\">\n <div class=\"multi-select-wrapper\">\n <div class=\"multi-select ${this._sortDropdownOpen ? 'focused' : ''} ${this.isSave ? 'disabled' : ''}\"\n @click=${() => { if (!this.isSave) { this._sortDropdownOpen = !this._sortDropdownOpen; this.requestUpdate() } }}>\n ${this._orderList.length > 0\n ? this._orderList.map(l => html`\n <span class=\"tag\">\n ${l}\n <span class=\"tag-close\" @click=${(e: Event) => { e.stopPropagation(); this._removeSortItem(l) }}>✕</span>\n </span>\n `)\n : html`<span class=\"placeholder\">请按顺序选择排序答案</span>`\n }\n <span class=\"arrow\">${iconArrow}</span>\n </div>\n ${this._sortDropdownOpen\n ? html`\n <div class=\"multi-select-dropdown\">\n ${this._answers.map((_, i) => html`\n <div class=\"multi-select-option ${this._orderList.includes(this._label(i)) ? 'selected' : ''}\"\n @click=${() => { this._toggleSortItem(this._label(i)); this.requestUpdate() }}>\n ${this._label(i)}\n </div>\n `)}\n </div>\n `\n : ''}\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?is-key=${this.isKey}\n ?show-other-option=${this.type === 'multiple' || this.type === 'single'}\n answer-check-type=${this._answerCheckType}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @set-answer-setting=${(e: CustomEvent) => { this._answerCheckType = e.detail.value }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n ${this._renderResultDialog()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectError","Error","constructor","message","code","arguments","length","undefined","field","row","super","this","name","from","options","iconPlus","html","iconRemove","iconArrow","QxsSubjectSingle","LitElement","orderIndex","isEdit","isSave","isSet","isKey","showAction","showAnalysis","type","answerCheckType","examAnswerRelationType","richTextContent","analysis","leastAnswerCount","examExpand","customId","examId","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","modelValue","useModel","_answers","title","isCorrect","_title","_analysis","_richText","_showRichText","_leastAnswerCount","_answerCheckType","_orderList","_resultDialogOpen","_resultDialogIndex","_resultDialogValue","_sortDropdownOpen","TITLE_MAX","ANSWER_MAX","_handleDocumentClick","path","composedPath","wrapper","shadowRoot","querySelector","includes","requestUpdate","answerList","v","arr","Array","isArray","map","a","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","willUpdate","changed","has","_syncProps","_syncExamExpand","ids","split","id","answer","find","answerId","toString","String","fromCharCode","filter","Boolean","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_label","i","_titlePlaceholder","_setCorrect","item","val","forEach","_onTitleInput","el","value","slice","_onAnswerInput","idx","_addAnswer","customAnswerId","uid","_deleteAnswer","index","_","_toggleSortItem","letter","indexOf","l","_removeSortItem","_getSortOrder","pos","toJSON","answerType","answers","charCodeAt","join","showRichText","richText","orderList","expand","msg","isSetCorrectAnswer","correctAnswerCount","trim","Set","size","getExamType","examRichTextContent","validate","errors","push","_openResultDialog","resultItem","_saveResultDialog","_renderResultDialog","stopPropagation","_save","stopImmediatePropagation","data","err","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","_renderPreview","typeSuffix","answerRelations","_renderEdit","Number","Math","max","n","checked","getContent","render","styles","css","__decorateClass","property","attribute","prototype","state","safeCustomElement"],"mappings":"qoBAaO,MAAMA,UAAqBC,MAChCC,WAAAA,CACEC,GAIA,IAHOC,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAe,mBACfG,yCACAC,EAAAJ,UAAAC,OAAA,EAAAD,kBAAAE,EAEPG,MAAMP,GAJCQ,KAAAP,KAAAA,EACAO,KAAAH,MAAAA,EACAG,KAAAF,IAAAA,EAGPE,KAAKC,KAAO,cACd,CAEA,WAAOC,CAAKC,GACV,OAAO,IAAId,EAAac,EAAQX,QAASW,EAAQV,KAAMU,EAAQN,MAAOM,EAAQL,IAChF,EAcF,MAAMM,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLACDA,CAAA,yNAClB,MAAME,EAAYF,CAAA,kLAgBX,IAAMG,EAAN,cAA+BC,EAA/BlB,WAAAA,GAAAQ,SAAAL,WA6IiDM,KAAAU,WAAa,EAChBV,KAAAW,QAAS,EACTX,KAAAY,QAAS,EACVZ,KAAAa,OAAQ,EACRb,KAAAc,OAAQ,EACHd,KAAAe,YAAa,EACXf,KAAAgB,cAAe,EAC5ChB,KAAAiB,KAAuC,SACPjB,KAAAkB,gBAAkB,EACVlB,KAAAmB,uBAAyB,EACjCnB,KAAAoB,gBAAkB,GAClDpB,KAAAqB,SAAW,GACsBrB,KAAAsB,iBAAmB,EAC1BtB,KAAAuB,WAAa,GACfvB,KAAAwB,SAAW,GACbxB,KAAAyB,OAAS,EAC/BzB,KAAA0B,YAA+CC,SAClE,IAA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AA,GACtBH,EAAA,CAA3BC,EAAS,CAAE/K,KAAM4I,UA7JPrJ,EA6JiB0L,UAAA,cAAA,GAUxBH,EAAA,CADHC,EAAS,CAAE/K,KAAMoD,MAAO4H,UAAW,iBAtKzBzL,EAuKP0L,UAAA,aAAA,GAckDH,EAAA,CAArDC,EAAS,CAAE/K,KAAMyE,OAAQuG,UAAW,iBArL1BzL,EAqL2C0L,UAAA,aAAA,GACDH,EAAA,CAApDC,EAAS,CAAE/K,KAAM4E,QAASoG,UAAW,eAtL3BzL,EAsL0C0L,UAAA,WAAA,GAEpCH,EAAA,CAAhBI,KAxLU3L,EAwLM0L,UAAA,WAAA,GAKAH,EAAA,CAAhBI,KA7LU3L,EA6LM0L,UAAA,SAAA,GACAH,EAAA,CAAhBI,KA9LU3L,EA8LM0L,UAAA,YAAA,GACAH,EAAA,CAAhBI,KA/LU3L,EA+LM0L,UAAA,YAAA,GACAH,EAAA,CAAhBI,KAhMU3L,EAgMM0L,UAAA,gBAAA,GACAH,EAAA,CAAhBI,KAjMU3L,EAiMM0L,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KAlMU3L,EAkMM0L,UAAA,mBAAA,GACAH,EAAA,CAAhBI,KAnMU3L,EAmMM0L,UAAA,aAAA,GACAH,EAAA,CAAhBI,KApMU3L,EAoMM0L,UAAA,oBAAA,GACAH,EAAA,CAAhBI,KArMU3L,EAqMM0L,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAtMU3L,EAsMM0L,UAAA,qBAAA,GACAH,EAAA,CAAhBI,KAvMU3L,EAuMM0L,UAAA,oBAAA,GAvMN1L,EAANuL,EAAA,CADNK,EAAkB,uBACN5L"}
|
package/es/subject/text-fill.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as r}from"../base/define.mjs";import{SubjectError as n}from"./single.mjs";var
|
|
1
|
+
import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as r}from"../base/define.mjs";import{SubjectError as n}from"./single.mjs";import{ExamType as a}from"./types.mjs";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,p=(e,t,i,s)=>{for(var o,r=s>1?void 0:s?d(t,i):t,n=e.length-1;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&l(t,i,r),r};const c=[{bg:"#ecf5ff",color:"#3D61E3",border:"#d9ecff"},{bg:"#f0f9eb",color:"#67c23a",border:"#c2e7b0"},{bg:"#fdf6ec",color:"#e6a23c",border:"#faecd8"},{bg:"#fef0f0",color:"#f56c6c",border:"#fde2e2"},{bg:"#f4f4f5",color:"#909399",border:"#e9e9eb"}];let h=class extends t{constructor(){super(...arguments),this._iconPlus=i`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,this._iconRemove=i`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`,this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!0,isIgnoreCase:!0,keywordCount:1},this.uploadImage=async e=>new Promise((t,i)=>{const s=new FileReader;s.onload=e=>t(e.target?.result),s.onerror=i,s.readAsDataURL(e)}),this.answerList=[],this.modelValue="",this.useModel=!1,this._answers=[{title:"",tag:"",showInput:!1}],this._title="",this._analysis="",this._isInOrder=!0,this._isIgnoreCase=!0,this._keywordCount=1,this._correct="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}willUpdate(e){e.has("isEdit")&&this.isEdit&&this._syncProps(),e.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this.answerList?.length&&(this._answers=this.answerList.map(e=>({title:e.title||"",tag:"",showInput:!1}))),this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase,this._keywordCount=this.examAnswerSetting.keywordCount||1),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.examExpand&&(this._correct=this.examExpand)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_addTag(e){const t={...this._answers[e]};t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),t.showInput=!1,this._answers=this._answers.map((i,s)=>s===e?t:i)}_closeTag(e,t){const i={...this._answers[t]};i.title=i.title.split(",").filter(t=>t!==e).join(","),this._answers=this._answers.map((e,s)=>s===t?i:e)}async toJSON(){return new Promise((e,t)=>{const i={customId:this.customId||void 0,answerType:"text_fill",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",o=this.isEdit?this._answers:this.answerList||[],r=this.isEdit?this._analysis:this.analysis||"",l=this.isEdit?this._correct:this.examExpand||"",d=this.isEdit?this._keywordCount:this.examAnswerSetting?.keywordCount||1,p=this.isEdit?this._isInOrder:this.examAnswerSetting?.isInOrder??!0,c=this.isEdit?this._isIgnoreCase:this.examAnswerSetting?.isIgnoreCase??!0,h=this.isEdit?this._showRichText:!!this.richTextContent,x=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void t(new n("题目标题不能为空!","EMPTY_TITLE","title",i));if(d||l){if(!d)return void t(new n("请完善答题设置!","NO_KEYWORD_COUNT","keywordCount",i));if(!l)return void t(new n("请输入问题正确答案!","NO_CORRECT_ANSWER","correct",i));if(o.length!==d)return void t(new n("关键词个数设置有误!","KEYWORD_COUNT_MISMATCH","answers",i));const e=[];if(o.forEach((t,i)=>{t.title||e.push(`关键词${i+1}未设置`)}),e.length)return void t(new n(e.join(","),"KEYWORD_EMPTY","answers",i))}const u={answerType:a.TEXT_FILL,title:s,answers:o.filter(e=>e.title).map(e=>({title:e.title})),analysis:r,isSetCorrectAnswer:!!l,isKey:this.isKey,examExpand:l,examAnswerSettingBO:{isIgnoreCase:c,isInOrder:p,keywordCount:d},examRichTextContent:h?x:""};this.customId&&(u.customId=this.customId),e(u)})}_addAnswer(){this.isSave||(this._answers=[...this._answers,{title:"",tag:"",showInput:!1}])}_deleteAnswer(e){this._answers.length<2||this.isSave||(this._answers=this._answers.filter((t,i)=>i!==e))}async _save(e){e?.stopImmediatePropagation();try{const e=await this.toJSON();this._emit("save",e)}catch(e){!function(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}(e.message)}}validate(){const e=[],t={customId:this.customId||void 0,answerType:"text_fill",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title||"",s=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._correct:this.examExpand||"",r=this.isEdit?this._keywordCount:this.examAnswerSetting?.keywordCount||1;return i||e.push(new n("题目标题不能为空!","EMPTY_TITLE","title",t)),(r||o)&&(r||e.push(new n("请完善答题设置!","NO_KEYWORD_COUNT","keywordCount",t)),o||e.push(new n("请输入问题正确答案!","NO_CORRECT_ANSWER","correct",t)),s.length!==r&&e.push(new n("关键词个数设置有误!","KEYWORD_COUNT_MISMATCH","answers",t)),s.forEach((i,s)=>{i.title||e.push(new n(`关键词${s+1}未设置`,"KEYWORD_EMPTY","answers",t))})),e}_renderPreview(){return i`
|
|
2
2
|
<div class="preview">
|
|
3
3
|
<span class="title">${this.orderIndex+1}.${this.title}(问答题)</span>
|
|
4
4
|
${this.richTextContent?i`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
|
|
@@ -66,7 +66,7 @@ import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"..
|
|
|
66
66
|
<div class="answer-item">
|
|
67
67
|
<span class="label">关键词${t+1}:</span>
|
|
68
68
|
<div class="answer-tags" style="display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px">
|
|
69
|
-
${e.title.split(",").filter(Boolean).map(e=>{const s=
|
|
69
|
+
${e.title.split(",").filter(Boolean).map(e=>{const s=c[t%c.length];return i`
|
|
70
70
|
<span style="display:inline-flex;align-items:center;background:${s.bg};color:${s.color};border:1px solid ${s.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px">
|
|
71
71
|
${e}
|
|
72
72
|
${this.isSave?"":i`<span style="cursor:pointer;margin-left:4px;color:#909399" @click=${()=>this._closeTag(e,t)}>×</span>`}
|
|
@@ -137,7 +137,7 @@ import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"..
|
|
|
137
137
|
></qxs-subject-action>
|
|
138
138
|
`:""}
|
|
139
139
|
</qxs-subject-layout>
|
|
140
|
-
`}};
|
|
140
|
+
`}};h.styles=e`
|
|
141
141
|
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
|
|
142
142
|
*, ::before, ::after { box-sizing: border-box; }
|
|
143
143
|
|
|
@@ -226,5 +226,5 @@ import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"..
|
|
|
226
226
|
.modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }
|
|
227
227
|
.modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
|
|
228
228
|
.modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }
|
|
229
|
-
`,
|
|
229
|
+
`,p([s({type:Number,attribute:"order-index"})],h.prototype,"orderIndex",2),p([s({type:String})],h.prototype,"title",2),p([s({type:String,attribute:"custom-id"})],h.prototype,"customId",2),p([s({type:Boolean,attribute:"is-edit"})],h.prototype,"isEdit",2),p([s({type:Boolean,attribute:"is-save"})],h.prototype,"isSave",2),p([s({type:Boolean,attribute:"is-set"})],h.prototype,"isSet",2),p([s({type:Boolean,attribute:"is-key"})],h.prototype,"isKey",2),p([s({type:Boolean,attribute:"show-action"})],h.prototype,"showAction",2),p([s({type:Boolean,attribute:"show-analysis"})],h.prototype,"showAnalysis",2),p([s({type:String,attribute:"rich-text-content"})],h.prototype,"richTextContent",2),p([s({type:String})],h.prototype,"analysis",2),p([s({type:Number,attribute:"exam-answer-relation-type"})],h.prototype,"examAnswerRelationType",2),p([s({type:String,attribute:"exam-expand"})],h.prototype,"examExpand",2),p([s({type:Object,attribute:"exam-answer-setting"})],h.prototype,"examAnswerSetting",2),p([s({type:Object})],h.prototype,"uploadImage",2),p([s({type:Array,attribute:"answer-list"})],h.prototype,"answerList",2),p([s({type:String,attribute:"model-value"})],h.prototype,"modelValue",2),p([s({type:Boolean,attribute:"use-model"})],h.prototype,"useModel",2),p([o()],h.prototype,"_answers",2),p([o()],h.prototype,"_title",2),p([o()],h.prototype,"_analysis",2),p([o()],h.prototype,"_isInOrder",2),p([o()],h.prototype,"_isIgnoreCase",2),p([o()],h.prototype,"_keywordCount",2),p([o()],h.prototype,"_correct",2),p([o()],h.prototype,"_showRichText",2),p([o()],h.prototype,"_richText",2),h=p([r("qxs-text-fill")],h);export{h as QxsTextFill};
|
|
230
230
|
//# sourceMappingURL=text-fill.mjs.map
|
|
@@ -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'\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: '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","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":"imBAOA,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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AAQiB,UAAW,iBA3G1BvJ,EA2G2CwJ,UAAA,aAAA,GAEtDJ,EAAA,CADCC,EAAS,CAAEC,KAAM1C,OAAQ2C,UAAW,yBA5G1BvJ,EA6GXwJ,UAAA,oBAAA,GAEAJ,EAAA,CADCC,EAAS,CAAEC,KAAM1C,UA9GP5G,EA+GXwJ,UAAA,cAAA,GASqDJ,EAAA,CAApDC,EAAS,CAAEC,KAAMG,MAAOF,UAAW,iBAxHzBvJ,EAwH0CwJ,UAAA,aAAA,GAGCJ,EAAA,CAArDC,EAAS,CAAEC,KAAMhB,OAAQiB,UAAW,iBA3H1BvJ,EA2H2CwJ,UAAA,aAAA,GACDJ,EAAA,CAApDC,EAAS,CAAEC,KAAMb,QAASc,UAAW,eA5H3BvJ,EA4H0CwJ,UAAA,WAAA,GAEpCJ,EAAA,CAAhBM,KA9HU1J,EA8HMwJ,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KA/HU1J,EA+HMwJ,UAAA,SAAA,GACAJ,EAAA,CAAhBM,KAhIU1J,EAgIMwJ,UAAA,YAAA,GACAJ,EAAA,CAAhBM,KAjIU1J,EAiIMwJ,UAAA,aAAA,GACAJ,EAAA,CAAhBM,KAlIU1J,EAkIMwJ,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAnIU1J,EAmIMwJ,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KApIU1J,EAoIMwJ,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KArIU1J,EAqIMwJ,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAtIU1J,EAsIMwJ,UAAA,YAAA,GAtINxJ,EAANoJ,EAAA,CADNO,EAAkB,kBACN3J"}
|
|
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 { ExamType } 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: ExamType.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","ExamType","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":"woBAQA,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,EACXX,KAAAY,cAAe,EACZZ,KAAAa,gBAAkB,GA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AAS,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"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var l=(l=>(l[l.SINGLE=0]="SINGLE",l[l.MULTIPLE=1]="MULTIPLE",l[l.BLANK_FILL=2]="BLANK_FILL",l[l.TEXT_FILL=3]="TEXT_FILL",l[l.SORT=5]="SORT",l[l.SCALE=6]="SCALE",l))(l||{});const L={0:"single",1:"multiple",2:"blank_fill",3:"text_fill",5:"sort",6:"scale"};function t(l){return{single:0,multiple:1,blank_fill:2,text_fill:3,sort:5,scale:6}[l]??0}function e(l){return L[l]||"single"}export{l as ExamType,L as ExamTypeMap,t as getExamType,e as getSubjectType};
|
|
2
|
+
//# sourceMappingURL=types.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.mjs","sources":["../../../../packages/components-wc/src/subject/types.ts"],"sourcesContent":["export enum ExamType {\n SINGLE = 0,\n MULTIPLE = 1,\n BLANK_FILL = 2,\n TEXT_FILL = 3,\n SORT = 5,\n SCALE = 6,\n}\n\nexport const ExamTypeMap = {\n [ExamType.SINGLE]: 'single',\n [ExamType.MULTIPLE]: 'multiple',\n [ExamType.BLANK_FILL]: 'blank_fill',\n [ExamType.TEXT_FILL]: 'text_fill',\n [ExamType.SORT]: 'sort',\n [ExamType.SCALE]: 'scale',\n} as const\n\nexport const ExamTypeLabelMap = {\n [ExamType.SINGLE]: '单选题',\n [ExamType.MULTIPLE]: '多选题',\n [ExamType.BLANK_FILL]: '填空题',\n [ExamType.TEXT_FILL]: '问答题',\n [ExamType.SORT]: '排序题',\n [ExamType.SCALE]: '量表题',\n} as const\n\nexport type SubjectType = 'single' | 'multiple' | 'blank_fill' | 'text_fill' | 'sort' | 'scale'\n\nexport function getExamType(type: SubjectType): ExamType {\n const map: Record<SubjectType, ExamType> = {\n 'single': ExamType.SINGLE,\n 'multiple': ExamType.MULTIPLE,\n 'blank_fill': ExamType.BLANK_FILL,\n 'text_fill': ExamType.TEXT_FILL,\n 'sort': ExamType.SORT,\n 'scale': ExamType.SCALE,\n }\n return map[type] ?? ExamType.SINGLE\n}\n\nexport function getSubjectType(examType: number): SubjectType {\n return ExamTypeMap[examType as ExamType] || 'single'\n}\n"],"names":["ExamType","ExamTypeMap","getExamType","type","single","multiple","blank_fill","text_fill","sort","scale","getSubjectType","examType"],"mappings":"IAAYA,GAAAA,IACVA,EAAAA,SAAS,GAAT,SACAA,EAAAA,WAAW,GAAX,WACAA,EAAAA,aAAa,GAAb,aACAA,EAAAA,YAAY,GAAZ,YACAA,EAAAA,OAAO,GAAP,OACAA,EAAAA,QAAQ,GAAR,QANUA,IAAAA,GAAA,CAAA,GASL,MAAMC,EAAc,CACzB,EAAmB,SACnB,EAAqB,WACrB,EAAuB,aACvB,EAAsB,YACtB,EAAiB,OACjB,EAAkB,SAcb,SAASC,EAAYC,GAS1B,MAR2C,CACzCC,OAAU,EACVC,SAAY,EACZC,WAAc,EACdC,UAAa,EACbC,KAAQ,EACRC,MAAS,GAEAN,IAAS,CACtB,CAEO,SAASO,EAAeC,GAC7B,OAAOV,EAAYU,IAAyB,QAC9C"}
|