@qxs-bns/components-wc 0.0.23 → 0.0.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/es/editor/blocksuite-editor.mjs +14 -14
  2. package/es/editor/blocksuite-editor.mjs.map +1 -1
  3. package/es/subject/action.mjs +18 -18
  4. package/es/subject/action.mjs.map +1 -1
  5. package/es/subject/blank-fill.mjs +128 -49
  6. package/es/subject/blank-fill.mjs.map +1 -1
  7. package/es/subject/layout.mjs +3 -3
  8. package/es/subject/layout.mjs.map +1 -1
  9. package/es/subject/list.mjs +80 -46
  10. package/es/subject/list.mjs.map +1 -1
  11. package/es/subject/page-end.mjs +8 -8
  12. package/es/subject/page-end.mjs.map +1 -1
  13. package/es/subject/scale.mjs +110 -29
  14. package/es/subject/scale.mjs.map +1 -1
  15. package/es/subject/single.mjs +48 -48
  16. package/es/subject/single.mjs.map +1 -1
  17. package/es/subject/text-fill.mjs +139 -98
  18. package/es/subject/text-fill.mjs.map +1 -1
  19. package/lib/editor/blocksuite-editor.cjs +4 -4
  20. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  21. package/lib/subject/action.cjs +18 -18
  22. package/lib/subject/action.cjs.map +1 -1
  23. package/lib/subject/blank-fill.cjs +123 -44
  24. package/lib/subject/blank-fill.cjs.map +1 -1
  25. package/lib/subject/layout.cjs +2 -2
  26. package/lib/subject/layout.cjs.map +1 -1
  27. package/lib/subject/list.cjs +83 -49
  28. package/lib/subject/list.cjs.map +1 -1
  29. package/lib/subject/page-end.cjs +8 -8
  30. package/lib/subject/page-end.cjs.map +1 -1
  31. package/lib/subject/scale.cjs +103 -22
  32. package/lib/subject/scale.cjs.map +1 -1
  33. package/lib/subject/single.cjs +48 -48
  34. package/lib/subject/single.cjs.map +1 -1
  35. package/lib/subject/text-fill.cjs +128 -87
  36. package/lib/subject/text-fill.cjs.map +1 -1
  37. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"list.cjs","sources":["../../../../packages/components-wc/src/subject/list.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport Sortable from 'sortablejs'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\n\n// 导入子组件以确保它们被注册为 Custom Elements\nimport './action'\nimport './blank-fill'\nimport './layout'\nimport './text-fill'\nimport './scale'\nimport './page-end'\nimport './type'\n\nconst TYPE_LABEL: Record<string, string> = {\n [SubjectType.SINGLE]: '单选题', [SubjectType.MULTIPLE]: '多选题', [SubjectType.SORT]: '排序题',\n [SubjectType.BLANK_FILL]: '填空题', [SubjectType.TEXT_FILL]: '问答题', [SubjectType.SCALE]: '量表题',\n page_end: '分页符',\n}\n\n@safeCustomElement('qxs-subject-list')\nexport class QxsSubjectList extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n *, ::before, ::after { box-sizing: border-box; }\n .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }\n .btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 12px; border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266; cursor: pointer; transition: all 0.2s; }\n .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }\n .subject-list { display: flex; flex-direction: column; }\n .subject-content { flex: 1; min-width: 0; }\n .ghost { opacity: 0.5; background: #ecf5ff; }\n .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }\n .sort-list { display: flex; flex-direction: column; gap: 8px; }\n .sort-item { display: flex; align-items: center; padding: 12px 16px; background: #f8f9fa; border: 1px solid #e4e7ed; border-radius: 6px; cursor: grab; transition: all 0.3s ease; }\n .sort-item:hover { background: #ecf5ff; border-color: #c6e2ff; }\n .sort-item:active { cursor: grabbing; }\n .sort-item.sort-ghost { opacity: 0.5; background: #ecf5ff; border: 2px dashed #409eff; }\n .sort-item.sort-chosen { background: #ecf5ff; border-color: #409eff; box-shadow: 0 4px 16px rgba(64,158,255,.3); transform: scale(1.02); }\n .sort-handle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 12px; color: #909399; flex-shrink: 0; }\n .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }\n .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }\n `\n\n @property({ attribute: 'is-preview' }) isPreview = false\n\n // use-model: enables two-way binding via model-value attribute + list-change event\n @property({ attribute: 'use-model' }) useModelAttr: string | null = null\n @property({ attribute: 'model-value' })\n get modelValue(): string { return JSON.stringify(this._list) }\n\n set modelValue(v: string) {\n if (!v || v === this._modelValueAttr) { return }\n this._modelValueAttr = v\n try {\n const parsed = JSON.parse(v)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch { /* invalid JSON, ignore */ }\n }\n\n private get _useModel(): boolean {\n return this.useModelAttr === 'true' || this.useModelAttr === '' || this.hasAttribute('use-model')\n }\n\n private _modelValueAttr = ''\n\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: 'category-list' }) categoryList: any[] = []\n @property({ type: Boolean, attribute: 'show-tag' }) showTag = false\n @property({ type: Boolean, attribute: 'show-category' }) showCategory = false\n @property({ type: Boolean, attribute: 'show-ai' }) showAi = false\n @property({ type: Boolean, attribute: 'show-resource' }) showResource = false\n @property({ type: Boolean, attribute: 'show-jump' }) showJump = false\n @property({ type: Boolean, attribute: 'show-add' }) showAdd = true\n @property({ type: Boolean, attribute: 'show-answer-setting' }) showAnswerSetting = false\n @property({ type: Boolean, attribute: 'show-key' }) showKey = false\n @property({ type: String, attribute: 'search-api' }) searchApi = ''\n @property({ type: Object }) searchHandler?: (query: string, answerType: number) => Promise<any[]>\n\n @property({ type: Array })\n get subjectList() { return this._list }\n\n set subjectList(v: any) {\n if (!v) {\n this._list = []\n return\n }\n if (typeof v === 'string') {\n try {\n v = JSON.parse(v)\n }\n catch {\n this._list = []\n this.requestUpdate()\n return\n }\n }\n if (!Array.isArray(v)) {\n this._list = []\n this.requestUpdate()\n return\n }\n this._list = this._normalizeIncomingList(v)\n this.requestUpdate()\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n super.attributeChangedCallback(name, oldVal, newVal)\n if (name === 'subject-list' && newVal && !this._list.length) {\n if (newVal.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(newVal)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n }\n\n @state() private _list: any[] = []\n @state() private _sortMode = false\n private _sortable: Sortable | null = null\n\n private get _isPreviewValue(): boolean {\n const val = (this as any).isPreview\n return typeof val === 'string' ? val !== 'false' : !!val\n }\n\n private _initialDataProcessed = false\n\n connectedCallback() {\n super.connectedCallback()\n if (!this._initialDataProcessed) {\n this._initialDataProcessed = true\n Promise.resolve().then(() => {\n if (this._list.length === 0) {\n this._processAttributeList()\n }\n })\n }\n }\n\n private _processAttributeList() {\n const attr = this.getAttribute('subject-list')\n if (!attr || attr === '[]') { return }\n if (attr.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(attr)\n if (Array.isArray(parsed) && parsed.length > 0) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n\n private _normalizeAnswer(answer: any) {\n return {\n ...answer,\n title: String(answer?.title ?? answer?.answer ?? ''),\n answerId: answer?.answerId ?? answer?.examAnswerId,\n }\n }\n\n private _normalizeItem(item: any) {\n const answerType = item?.answerType || (!item?.richTextContent ? item?.examTypeEnum : item?.answerType)\n const answers = Array.isArray(item?.answers) ? item.answers.map((answer: any) => this._normalizeAnswer(answer)) : []\n return {\n ...item,\n customId: item?.customId || uid(),\n ...(answerType ? { answerType } : {}),\n ...(answers.length || Array.isArray(item?.answers) ? { answers } : {}),\n }\n }\n\n private _rebuildPageEndMarkers(items: any[]) {\n if (!items.length) { return items }\n if (items.some(item => item?.answerType === 'page_end')) { return items }\n if (!items.some(item => Number(item?.pageIndex) > 1)) { return items }\n\n let currentPageIndex = 1\n const rebuilt: any[] = []\n\n items.forEach((item) => {\n const pageIndex = Number(item?.pageIndex) || 1\n if (pageIndex > currentPageIndex) {\n if (rebuilt.length > 0) {\n while (currentPageIndex < pageIndex) {\n rebuilt.push({ customId: uid(), answerType: 'page_end' })\n currentPageIndex++\n }\n }\n else {\n currentPageIndex = pageIndex\n }\n }\n rebuilt.push(item)\n })\n\n return rebuilt\n }\n\n private _normalizeIncomingList(items: any[]) {\n const normalized = items.map((item: any) => this._normalizeItem(item))\n return this._rebuildPageEndMarkers(normalized)\n }\n\n firstUpdated() {\n this.updateComplete.then(() => this._initSortable())\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('_sortMode')) {\n this._sortable?.destroy()\n this._sortable = null\n this.updateComplete.then(() => this._initSortable())\n }\n // Reinitialize Sortable when list changes in sort mode\n if (changed.has('_list') && this._sortMode) {\n // Small delay to let Lit finish DOM updates\n setTimeout(() => {\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n this._initSortable()\n }, 50)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._sortable?.destroy()\n this._sortable = null\n }\n\n private _initSortable() {\n if (!this._sortMode) { return }\n const el = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!el) { return }\n\n // Destroy existing instance first\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n\n // Small delay to ensure DOM is ready after previous destroy\n requestAnimationFrame(() => {\n const currentEl = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!currentEl || this._sortable) { return }\n\n this._sortable = Sortable.create(currentEl, {\n handle: '.sort-handle',\n animation: 200,\n ghostClass: 'sort-ghost',\n chosenClass: 'sort-chosen',\n onEnd: (evt) => {\n const { oldIndex, newIndex } = evt\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) { return }\n const arr = [...this._list]\n const [item] = arr.splice(oldIndex, 1)\n arr.splice(newIndex, 0, item)\n this._list = arr\n this._emitListChange()\n },\n })\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 _emitListChange() {\n this._emit('change', this._list)\n if (this._useModel) {\n this._modelValueAttr = JSON.stringify(this._list)\n this._emit('list-change', this._list)\n }\n }\n\n private _withPageIndex(items: any[]) {\n const serialized: any[] = []\n let pageIndex = 1\n let pendingBoundary = false\n\n items.forEach((item) => {\n if (!item) { return }\n if (item.answerType === 'page_end') {\n if (serialized.length > 0) {\n pendingBoundary = true\n }\n return\n }\n if (pendingBoundary) {\n pageIndex += 1\n pendingBoundary = false\n }\n serialized.push({\n ...item,\n pageIndex,\n })\n })\n\n return serialized\n }\n\n async toJSON(): Promise<any[]> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return []\n }\n\n const results: any[] = []\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.toJSON === 'function') {\n try {\n const data = await el.toJSON()\n results.push(data)\n }\n catch (err: any) {\n if (err instanceof SubjectError) {\n errors.push(err)\n }\n else {\n errors.push(new SubjectError(err.message || '未知错误', 'UNKNOWN', 'unknown'))\n }\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors\n }\n\n return this._withPageIndex(results)\n }\n\n async validate(): Promise<{ valid: boolean, errors: SubjectError[] }> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return { valid: true, errors: [] }\n }\n\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.validate === 'function') {\n const errs = el.validate()\n if (errs?.length) {\n errors.push(...errs)\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n }\n\n // ── public API ────────────────────────────────────────────────\n get currentList() { return this._list }\n\n addSubject(type: string, index?: number, examAnswerRelationType: number | null = null) {\n // 分页符只需要最少的必要字段\n if (type === 'page_end') {\n const pageEndItem = {\n customId: uid(),\n answerType: 'page_end',\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, pageEndItem)\n }\n else {\n arr.push(pageEndItem)\n }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n return\n }\n\n const item = {\n customId: uid(), answerType: type, title: '',\n answers: [], analysis: '', scaleQuestionList: [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n isKey: false, answerCheckType: 1,\n examAnswerRelationType: examAnswerRelationType ?? 0,\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, item)\n }\n else { arr.push(item) }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n }\n\n addExam(items: any[]) {\n const newItems = this._normalizeIncomingList(items).map((item: any) => ({\n ...item,\n isEdit: true,\n isSave: false,\n isRealCanDel: true,\n hasSet: false,\n }))\n this._list = [...this._list, ...newItems]\n this._emitListChange()\n }\n\n uploadExcel(list: any[]) {\n this._list = [\n ...this._list,\n ...this._normalizeIncomingList(list).map((item: any) => ({ ...item, isRealCanDel: true })),\n ]\n this._emitListChange()\n }\n\n setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n const ans = item.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (ans) { ans.answerRelations = answerRelations }\n }\n this.requestUpdate()\n this._emitListChange()\n }\n\n setTagList(tagList: any[], customId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n item.tagInfos = Array.isArray(tagList) ? tagList : []\n item.memberTagInfo = Array.isArray(tagList) ? tagList : []\n this._list = [...this._list]\n this._emitListChange()\n return\n }\n this.requestUpdate()\n }\n\n // ── private helpers ───────────────────────────────────────────\n private _orderIndex(customId: string) {\n let n = 0; let out = 0\n this._list.forEach((v: any) => {\n n++; if (v.customId === customId) { out = n }\n })\n return out - 1\n }\n\n private _move(index: number, dir: 'up' | 'down') {\n const arr = [...this._list]\n if (dir === 'up' && index > 0) { [arr[index - 1], arr[index]] = [arr[index], arr[index - 1]] }\n else if (dir === 'down' && index < arr.length - 1) { [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]] }\n this._list = arr\n this._emitListChange()\n }\n\n private _save(index: number, e: CustomEvent) {\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, ...e.detail, isEdit: false, isSave: true } : item,\n )\n this._emitListChange()\n }\n\n private _deleteByCustomId(customId: string) {\n this._list = this._list.filter(item => item.customId !== customId)\n this._emitListChange()\n }\n\n private _delete(index: number) {\n const arr = [...this._list]\n arr.splice(index, 1)\n this._list = arr\n this._emitListChange()\n }\n\n private _setEdit(index: number, val: boolean) {\n this._list = this._list.map((item, i) => i === index ? { ...item, isEdit: val } : item)\n }\n\n private _pageEndTotal() {\n return this._list.filter(item => item.answerType === 'page_end').length + 1\n }\n\n private _pageEndIndex(index: number) {\n return this._list.slice(0, index + 1).filter(item => item.answerType === 'page_end').length\n }\n\n private _syncRelationAnswer(index: number, detail: any) {\n const item = this._list[index]\n if (!item || !Array.isArray(item.answers) || !detail?.answer) { return }\n const answers = [...item.answers]\n const currentAnswer = detail.answer\n let answerIndex = typeof detail.answerIndex === 'number' ? detail.answerIndex : -1\n\n if (answerIndex < 0 || answerIndex >= answers.length) {\n answerIndex = answers.findIndex((answer: any, currentIndex: number) => {\n return String(answer.customAnswerId || '') === String(currentAnswer.customAnswerId || '')\n || String(answer.answerId || '') === String(currentAnswer.answerId || '')\n || String(answer.orderIndex || currentIndex + 1) === String(currentAnswer.orderIndex || '')\n })\n }\n\n if (answerIndex < 0) { return }\n answers[answerIndex] = {\n ...answers[answerIndex],\n customAnswerId: currentAnswer.customAnswerId || answers[answerIndex].customAnswerId || currentAnswer.answerId,\n }\n this._list[index] = {\n ...item,\n answers,\n }\n this._list = [...this._list]\n }\n\n private _renderItem(item: any, index: number) {\n const common = {\n 'order-index': this._orderIndex(item.customId),\n '?is-edit': item.isEdit || false,\n '?is-set': item.hasSet || false,\n '?is-save': !item.isRealCanDel,\n '?show-action': !this._isPreviewValue,\n 'exam-answer-relation-type': item.examAnswerRelationType ?? 0,\n }\n const onMove = (e: CustomEvent) => this._move(index, e.detail as 'up' | 'down')\n const onDelete = () => this._deleteByCustomId(item.customId)\n const onSave = (e: CustomEvent) => this._save(index, e)\n const onEdit = () => this._setEdit(index, true)\n const onAdd = (e: CustomEvent) => this.addSubject(e.detail?.type ?? e.detail, index)\n\n if ([SubjectType.SINGLE, SubjectType.MULTIPLE, SubjectType.SORT].includes(item.answerType)) {\n return html`<qxs-subject-single\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .tagList=${item.tagInfos || item.memberTagInfo || []}\n .categoryList=${this.categoryList}\n .resourceList=${item.examResourceBOList || item.resourceList || []}\n .searchHandler=${this.searchHandler}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit}\n .isSet=${!!item.hasSet}\n .isSave=${!item.isRealCanDel}\n .showAction=${!this._isPreviewValue}\n .showAdd=${this.showAdd}\n .showAnswerSetting=${this.showAnswerSetting}\n .showKey=${this.showKey}\n .showTag=${this.showTag}\n .showCategory=${this.showCategory}\n .showAi=${this.showAi}\n .showResource=${this.showResource}\n .showJump=${this.showJump}\n .isKey=${!!item.isKey}\n question-type=${String(item.answerType)}\n answer-check-type=${item.answerCheckType ?? 1}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n .leastAnswerCount=${Number(item.leastAnswerCount) || 0}\n exam-expand=${item.examExpand || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n ai-answer=${item.aiAnswer || ''}\n search-api=${this.searchApi}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @set-key=${(e: CustomEvent) => {\n this._list[index].isKey = e.detail.value\n this.requestUpdate()\n }}\n @title-select=${(e: CustomEvent) => this._emit('title-select', e.detail)}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n @jump=${(e: CustomEvent) => this._emit('jump', { ...e.detail, item: this._list[index] })}\n @set-relation=${(e: CustomEvent) => {\n this._syncRelationAnswer(index, e.detail)\n this._emit('set-relation', { ...e.detail, item: this._list[index] })\n }}\n ></qxs-subject-single>`\n }\n if (item.answerType === SubjectType.BLANK_FILL) {\n return html`<qxs-blank-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit} .isSet=${!!item.hasSet} .isSave=${!item.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}\n .showAnswerSetting=${this.showAnswerSetting}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-blank-fill>`\n }\n if (item.answerType === SubjectType.TEXT_FILL) {\n return html`<qxs-text-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit} .isSet=${!!item.hasSet} .isSave=${!item.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}\n .showAnswerSetting=${this.showAnswerSetting}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-text-fill>`\n }\n if (item.answerType === SubjectType.SCALE) {\n return html`<qxs-scale\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .scaleQuestions=${item.scaleQuestionList || []}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit} .isSet=${!!item.hasSet} .isSave=${!item.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-scale>`\n }\n if (item.answerType === 'page_end') {\n return html`<qxs-page-end\n current-page-index=${item.currentPageIndex || this._pageEndIndex(index)}\n total-page=${item.totalPage || this._pageEndTotal()}\n .showAction=${!this._isPreviewValue}\n .showAdd=${this.showAdd}\n custom-id=${item.customId || ''}\n @delete=${onDelete}\n @add=${onAdd}\n ></qxs-page-end>`\n }\n return html`<div style=\"color:#909399;padding:8px\">未知题型: ${item.answerType}</div>`\n }\n\n render() {\n return html`\n <div class=\"subject-list\">\n ${this._list.map((item, index) => this._renderItem(item, index))}\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectType","SINGLE","MULTIPLE","SORT","BLANK_FILL","TEXT_FILL","SCALE","QxsSubjectList","LitElement","constructor","super","arguments","this","isPreview","useModelAttr","_modelValueAttr","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","categoryList","showTag","showCategory","showAi","showResource","showJump","showAdd","showAnswerSetting","showKey","searchApi","_list","_sortMode","_sortable","_initialDataProcessed","modelValue","JSON","stringify","v","parsed","parse","Array","isArray","_normalizeIncomingList","requestUpdate","_useModel","hasAttribute","subjectList","attributeChangedCallback","name","oldVal","newVal","length","includes","_isPreviewValue","val","connectedCallback","then","_processAttributeList","attr","getAttribute","_normalizeAnswer","answer","title","String","answerId","examAnswerId","_normalizeItem","item","answerType","richTextContent","examTypeEnum","answers","map","customId","uid","_rebuildPageEndMarkers","items","some","Number","pageIndex","currentPageIndex","rebuilt","forEach","push","normalized","firstUpdated","updateComplete","_initSortable","updated","changed","has","destroy","setTimeout","disconnectedCallback","renderRoot","querySelector","requestAnimationFrame","currentEl","Sortable","create","handle","animation","ghostClass","chosenClass","onEnd","evt","oldIndex","newIndex","arr","splice","_emitListChange","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_withPageIndex","serialized","pendingBoundary","toJSON","subjectEls","querySelectorAll","results","errors","el","data","err","SubjectError","message","validate","valid","errs","currentList","addSubject","type","index","examAnswerRelationType","undefined","pageEndItem","analysis","scaleQuestionList","isEdit","isSave","isRealCanDel","hasSet","isKey","answerCheckType","addExam","newItems","uploadExcel","list","setAnswerRelation","answerRelations","customAnswerId","find","ans","c","setTagList","tagList","tagInfos","memberTagInfo","_orderIndex","n","out","_move","dir","_save","i","_deleteByCustomId","filter","_delete","_setEdit","_pageEndTotal","_pageEndIndex","slice","_syncRelationAnswer","currentAnswer","answerIndex","findIndex","currentIndex","orderIndex","_renderItem","common","onMove","onDelete","onSave","onEdit","onAdd","html","examResourceBOList","resourceList","searchHandler","examRichTextContent","leastAnswerCount","examExpand","categoryId","category","aiAnswer","examId","value","examAnswerSettingBO","examAnswerSettingVO","totalPage","render","styles","css","__decorateClass","property","attribute","prototype","Object","Boolean","state","safeCustomElement"],"mappings":"ujBAkBGA,EAAAA,YAAYC,OAAiBD,EAAAA,YAAYE,SAAmBF,EAAAA,YAAYG,KACxEH,EAAAA,YAAYI,WAAqBJ,EAAAA,YAAYK,UAAoBL,EAAAA,YAAYM,MAKnEC,QAAAA,eAAN,cAA6BC,EAAAA,WAA7BC,WAAAA,GAAAC,SAAAC,WAyBkCC,KAAAC,WAAY,EAGbD,KAAAE,aAA8B,KAqBpEF,KAAQG,gBAAkB,GAG1BH,KAAAI,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAASC,GAAKL,EAAQK,EAAEC,QAAQC,QACvCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAI8BjB,KAAAkB,aAAsB,GACzBlB,KAAAmB,SAAU,EACLnB,KAAAoB,cAAe,EACrBpB,KAAAqB,QAAS,EACHrB,KAAAsB,cAAe,EACnBtB,KAAAuB,UAAW,EACZvB,KAAAwB,SAAU,EACCxB,KAAAyB,mBAAoB,EAC/BzB,KAAA0B,SAAU,EACT1B,KAAA2B,UAAY,GAiDxD3B,KAAQ4B,MAAe,GACvB5B,KAAQ6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subject/list.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport Sortable from 'sortablejs'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\n\n// 导入子组件以确保它们被注册为 Custom Elements\nimport './action'\nimport './blank-fill'\nimport './layout'\nimport './text-fill'\nimport './scale'\nimport './page-end'\nimport './type'\n\n@safeCustomElement('qxs-subject-list')\nexport class QxsSubjectList extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n *, ::before, ::after { box-sizing: border-box; }\n .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }\n .btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 12px; border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266; cursor: pointer; transition: all 0.2s; }\n .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }\n .subject-list { display: flex; flex-direction: column; }\n .subject-content { flex: 1; min-width: 0; }\n .ghost { opacity: 0.5; background: #ecf5ff; }\n .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }\n .sort-list { display: flex; flex-direction: column; gap: 8px; }\n .sort-item { display: flex; align-items: center; padding: 12px 16px; background: #f8f9fa; border: 1px solid #e4e7ed; border-radius: 6px; cursor: grab; transition: all 0.3s ease; }\n .sort-item:hover { background: #ecf5ff; border-color: #c6e2ff; }\n .sort-item:active { cursor: grabbing; }\n .sort-item.sort-ghost { opacity: 0.5; background: #ecf5ff; border: 2px dashed #409eff; }\n .sort-item.sort-chosen { background: #ecf5ff; border-color: #409eff; box-shadow: 0 4px 16px rgba(64,158,255,.3); transform: scale(1.02); }\n .sort-handle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 12px; color: #909399; flex-shrink: 0; }\n .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }\n .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }\n `\n\n @property({ attribute: 'is-preview' }) 'is-preview' = false\n\n // use-model: enables two-way binding via model-value attribute + list-change event\n @property({ attribute: 'use-model' }) 'use-model': string | null = null\n @property({ attribute: 'model-value' })\n get 'model-value'(): string { return JSON.stringify(this._list) }\n\n set 'model-value'(v: string) {\n if (!v || v === this._modelValueAttr) { return }\n this._modelValueAttr = v\n try {\n const parsed = JSON.parse(v)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch { /* invalid JSON, ignore */ }\n }\n\n private get _useModel(): boolean {\n return this['use-model'] === 'true' || this['use-model'] === '' || this.hasAttribute('use-model')\n }\n\n private _modelValueAttr = ''\n\n @property({ type: Object, attribute: 'upload-image' })\n 'upload-image': (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = e => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'category-list' }) 'category-list': any[] = []\n @property({ type: Boolean, attribute: 'show-tag' }) 'show-tag' = false\n @property({ type: Boolean, attribute: 'show-category' }) 'show-category' = false\n @property({ type: Boolean, attribute: 'show-ai' }) 'show-ai' = false\n @property({ type: Boolean, attribute: 'show-resource' }) 'show-resource' = false\n @property({ type: Boolean, attribute: 'show-jump' }) 'show-jump' = false\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-key' }) 'show-key' = false\n @property({ type: String, attribute: 'search-api' }) 'search-api' = ''\n @property({ type: Object, attribute: 'search-handler' }) 'search-handler'?: (query: string, answerType: number) => Promise<any[]>\n\n @property({ type: Array, attribute: 'subject-list' })\n get 'subject-list'() { return this._list }\n\n set 'subject-list'(v: any) {\n if (!v) {\n this._list = []\n return\n }\n if (typeof v === 'string') {\n try {\n v = JSON.parse(v)\n }\n catch {\n this._list = []\n this.requestUpdate()\n return\n }\n }\n if (!Array.isArray(v)) {\n this._list = []\n this.requestUpdate()\n return\n }\n this._list = this._normalizeIncomingList(v)\n this.requestUpdate()\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n super.attributeChangedCallback(name, oldVal, newVal)\n if (name === 'subject-list' && newVal && !this._list.length) {\n if (newVal.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(newVal)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n }\n\n @state() private _list: any[] = []\n @state() private _sortMode = false\n private _sortable: Sortable | null = null\n\n private get _isPreviewValue(): boolean {\n const val = this['is-preview']\n return typeof val === 'string' ? val !== 'false' : !!val\n }\n\n private _initialDataProcessed = false\n\n connectedCallback() {\n super.connectedCallback()\n if (!this._initialDataProcessed) {\n this._initialDataProcessed = true\n Promise.resolve().then(() => {\n if (this._list.length === 0) {\n this._processAttributeList()\n }\n })\n }\n }\n\n private _processAttributeList() {\n const attr = this.getAttribute('subject-list')\n if (!attr || attr === '[]') { return }\n if (attr.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(attr)\n if (Array.isArray(parsed) && parsed.length > 0) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n\n private _normalizeAnswer(answer: any) {\n return {\n ...answer,\n title: String(answer?.title ?? answer?.answer ?? ''),\n answerId: answer?.answerId ?? answer?.examAnswerId,\n }\n }\n\n private _normalizeItem(item: any) {\n const answerType = item?.answerType || (!item?.richTextContent ? item?.examTypeEnum : item?.answerType)\n const answers = Array.isArray(item?.answers) ? item.answers.map((answer: any) => this._normalizeAnswer(answer)) : []\n return {\n ...item,\n customId: item?.customId || uid(),\n ...(answerType ? { answerType } : {}),\n ...(answers.length || Array.isArray(item?.answers) ? { answers } : {}),\n }\n }\n\n private _rebuildPageEndMarkers(items: any[]) {\n if (!items.length) { return items }\n if (items.some(item => item?.answerType === 'page_end')) { return items }\n if (!items.some(item => Number(item?.pageIndex) > 1)) { return items }\n\n let currentPageIndex = 1\n const rebuilt: any[] = []\n\n items.forEach((item) => {\n const pageIndex = Number(item?.pageIndex) || 1\n if (pageIndex > currentPageIndex) {\n if (rebuilt.length > 0) {\n while (currentPageIndex < pageIndex) {\n rebuilt.push({ customId: uid(), answerType: 'page_end' })\n currentPageIndex++\n }\n }\n else {\n currentPageIndex = pageIndex\n }\n }\n rebuilt.push(item)\n })\n\n return rebuilt\n }\n\n private _normalizeIncomingList(items: any[]) {\n const normalized = items.map((item: any) => this._normalizeItem(item))\n return this._rebuildPageEndMarkers(normalized)\n }\n\n firstUpdated() {\n this.updateComplete.then(() => this._initSortable())\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('_sortMode')) {\n this._sortable?.destroy()\n this._sortable = null\n this.updateComplete.then(() => this._initSortable())\n }\n // Reinitialize Sortable when list changes in sort mode\n if (changed.has('_list') && this._sortMode) {\n // Small delay to let Lit finish DOM updates\n setTimeout(() => {\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n this._initSortable()\n }, 50)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._sortable?.destroy()\n this._sortable = null\n }\n\n private _initSortable() {\n if (!this._sortMode) { return }\n const el = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!el) { return }\n\n // Destroy existing instance first\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n\n // Small delay to ensure DOM is ready after previous destroy\n requestAnimationFrame(() => {\n const currentEl = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!currentEl || this._sortable) { return }\n\n this._sortable = Sortable.create(currentEl, {\n handle: '.sort-handle',\n animation: 200,\n ghostClass: 'sort-ghost',\n chosenClass: 'sort-chosen',\n onEnd: (evt) => {\n const { oldIndex, newIndex } = evt\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) { return }\n const arr = [...this._list]\n const [item] = arr.splice(oldIndex, 1)\n arr.splice(newIndex, 0, item)\n this._list = arr\n this._emitListChange()\n },\n })\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 _emitListChange() {\n this._emit('change', this._list)\n if (this._useModel) {\n this._modelValueAttr = JSON.stringify(this._list)\n this._emit('list-change', this._list)\n }\n }\n\n private _withPageIndex(items: any[]) {\n const serialized: any[] = []\n let pageIndex = 1\n let pendingBoundary = false\n\n items.forEach((item) => {\n if (!item) { return }\n if (item.answerType === 'page_end') {\n if (serialized.length > 0) {\n pendingBoundary = true\n }\n return\n }\n if (pendingBoundary) {\n pageIndex += 1\n pendingBoundary = false\n }\n serialized.push({\n ...item,\n pageIndex,\n })\n })\n\n return serialized\n }\n\n async toJSON(): Promise<any[]> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return []\n }\n\n const results: any[] = []\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.toJSON === 'function') {\n try {\n const data = await el.toJSON()\n results.push(data)\n }\n catch (err: any) {\n if (err instanceof SubjectError) {\n errors.push(err)\n }\n else {\n errors.push(new SubjectError(err.message || '未知错误', 'UNKNOWN', 'unknown'))\n }\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors\n }\n\n return this._withPageIndex(results)\n }\n\n async validate(): Promise<{ valid: boolean, errors: SubjectError[] }> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return { valid: true, errors: [] }\n }\n\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.validate === 'function') {\n const errs = el.validate()\n if (errs?.length) {\n errors.push(...errs)\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n }\n\n // ── public API ────────────────────────────────────────────────\n get currentList() { return this._list }\n\n addSubject(type: string, index?: number, examAnswerRelationType: number | null = null) {\n // 分页符只需要最少的必要字段\n if (type === 'page_end') {\n const pageEndItem = {\n customId: uid(),\n answerType: 'page_end',\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, pageEndItem)\n }\n else {\n arr.push(pageEndItem)\n }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n return\n }\n\n const item = {\n customId: uid(), answerType: type, title: '',\n answers: [], analysis: '', scaleQuestionList: [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n isKey: false, answerCheckType: 1,\n examAnswerRelationType: examAnswerRelationType ?? 0,\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, item)\n }\n else { arr.push(item) }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n }\n\n addExam(items: any[]) {\n const newItems = this._normalizeIncomingList(items).map((item: any) => ({\n ...item,\n isEdit: true,\n isSave: false,\n isRealCanDel: true,\n hasSet: false,\n }))\n this._list = [...this._list, ...newItems]\n this._emitListChange()\n }\n\n uploadExcel(list: any[]) {\n this._list = [\n ...this._list,\n ...this._normalizeIncomingList(list).map((item: any) => ({ ...item, isRealCanDel: true })),\n ]\n this._emitListChange()\n }\n\n setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n const ans = item.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (ans) { ans.answerRelations = answerRelations }\n }\n this.requestUpdate()\n this._emitListChange()\n }\n\n setTagList(tagList: any[], customId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n item.tagInfos = Array.isArray(tagList) ? tagList : []\n item.memberTagInfo = Array.isArray(tagList) ? tagList : []\n this._list = [...this._list]\n this._emitListChange()\n return\n }\n this.requestUpdate()\n }\n\n // ── private helpers ───────────────────────────────────────────\n private _orderIndex(customId: string) {\n let n = 0; let out = 0\n this._list.forEach((v: any) => {\n n++; if (v.customId === customId) { out = n }\n })\n return out - 1\n }\n\n private _move(index: number, dir: 'up' | 'down') {\n const arr = [...this._list]\n if (dir === 'up' && index > 0) { [arr[index - 1], arr[index]] = [arr[index], arr[index - 1]] }\n else if (dir === 'down' && index < arr.length - 1) { [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]] }\n this._list = arr\n this._emitListChange()\n }\n\n private _save(index: number, e: CustomEvent) {\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, ...e.detail, isEdit: false, isSave: true } : item,\n )\n this._emitListChange()\n }\n\n private _deleteByCustomId(customId: string) {\n this._list = this._list.filter(item => item.customId !== customId)\n this._emitListChange()\n }\n\n private _delete(index: number) {\n const arr = [...this._list]\n arr.splice(index, 1)\n this._list = arr\n this._emitListChange()\n }\n\n private _setEdit(index: number, val: boolean) {\n this._list = this._list.map((item, i) => i === index ? { ...item, isEdit: val } : item)\n }\n\n private _pageEndTotal() {\n return this._list.filter(item => item.answerType === 'page_end').length + 1\n }\n\n private _pageEndIndex(index: number) {\n return this._list.slice(0, index + 1).filter(item => item.answerType === 'page_end').length\n }\n\n private _syncRelationAnswer(index: number, detail: any) {\n const item = this._list[index]\n if (!item || !Array.isArray(item.answers) || !detail?.answer) { return }\n const answers = [...item.answers]\n const currentAnswer = detail.answer\n let answerIndex = typeof detail.answerIndex === 'number' ? detail.answerIndex : -1\n\n if (answerIndex < 0 || answerIndex >= answers.length) {\n answerIndex = answers.findIndex((answer: any, currentIndex: number) => {\n return String(answer.customAnswerId || '') === String(currentAnswer.customAnswerId || '')\n || String(answer.answerId || '') === String(currentAnswer.answerId || '')\n || String(answer.orderIndex || currentIndex + 1) === String(currentAnswer.orderIndex || '')\n })\n }\n\n if (answerIndex < 0) { return }\n answers[answerIndex] = {\n ...answers[answerIndex],\n customAnswerId: currentAnswer.customAnswerId || answers[answerIndex].customAnswerId || currentAnswer.answerId,\n }\n this._list[index] = {\n ...item,\n answers,\n }\n this._list = [...this._list]\n }\n\n private _renderItem(item: any, index: number) {\n const common = {\n 'order-index': this._orderIndex(item.customId),\n '?is-edit': item.isEdit || false,\n '?is-set': item.hasSet || false,\n '?is-save': !item.isRealCanDel,\n '?show-action': !this._isPreviewValue,\n 'exam-answer-relation-type': item.examAnswerRelationType ?? 0,\n }\n const onMove = (e: CustomEvent) => this._move(index, e.detail as 'up' | 'down')\n const onDelete = () => this._deleteByCustomId(item.customId)\n const onSave = (e: CustomEvent) => this._save(index, e)\n const onEdit = () => this._setEdit(index, true)\n const onAdd = (e: CustomEvent) => this.addSubject(e.detail?.type ?? e.detail, index)\n\n if ([SubjectType.SINGLE, SubjectType.MULTIPLE, SubjectType.SORT].includes(item.answerType)) {\n return html`<qxs-subject-single\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .tag-list=${item.tagInfos || item.memberTagInfo || []}\n .category-list=${this['category-list']}\n .resource-list=${item.examResourceBOList || item.resourceList || []}\n .search-handler=${this['search-handler']}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit}\n .is-set=${!!item.hasSet}\n .is-save=${!item.isRealCanDel}\n .show-action=${!this._isPreviewValue}\n .show-add=${this['show-add']}\n .show-answer-setting=${this['show-answer-setting']}\n .show-key=${this['show-key']}\n .show-tag=${this['show-tag']}\n .show-category=${this['show-category']}\n .show-ai=${this['show-ai']}\n .show-resource=${this['show-resource']}\n .show-jump=${this['show-jump']}\n .is-key=${!!item.isKey}\n question-type=${String(item.answerType)}\n answer-check-type=${item.answerCheckType ?? 1}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n .least-answer-count=${Number(item.leastAnswerCount) || 0}\n exam-expand=${item.examExpand || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n ai-answer=${item.aiAnswer || ''}\n search-api=${this['search-api']}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @set-key=${(e: CustomEvent) => {\n this._list[index].isKey = e.detail.value\n this.requestUpdate()\n }}\n @title-select=${(e: CustomEvent) => this._emit('title-select', e.detail)}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n @jump=${(e: CustomEvent) => this._emit('jump', { ...e.detail, item: this._list[index] })}\n @set-relation=${(e: CustomEvent) => {\n this._syncRelationAnswer(index, e.detail)\n this._emit('set-relation', { ...e.detail, item: this._list[index] })\n }}\n ></qxs-subject-single>`\n }\n if (item.answerType === SubjectType.BLANK_FILL) {\n return html`<qxs-blank-fill\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .tag-list=${item.tagInfos || item.memberTagInfo || []}\n .category-list=${this['category-list']}\n .resource-list=${item.examResourceBOList || item.resourceList || []}\n .exam-answer-setting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit} .is-set=${!!item.hasSet} .is-save=${!item.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this['show-add']}\n .show-answer-setting=${this['show-answer-setting']}\n .show-tag=${this['show-tag']}\n .show-category=${this['show-category']}\n .show-resource=${this['show-resource']}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n ></qxs-blank-fill>`\n }\n if (item.answerType === SubjectType.TEXT_FILL) {\n return html`<qxs-text-fill\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .tag-list=${item.tagInfos || item.memberTagInfo || []}\n .category-list=${this['category-list']}\n .resource-list=${item.examResourceBOList || item.resourceList || []}\n .search-handler=${this['search-handler']}\n .exam-answer-setting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit} .is-set=${!!item.hasSet} .is-save=${!item.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this['show-add']}\n .show-answer-setting=${this['show-answer-setting']}\n .show-tag=${this['show-tag']}\n .show-category=${this['show-category']}\n .show-resource=${this['show-resource']}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n ></qxs-text-fill>`\n }\n if (item.answerType === SubjectType.SCALE) {\n return html`<qxs-scale\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .scale-questions=${item.scaleQuestionList || []}\n .tag-list=${item.tagInfos || item.memberTagInfo || []}\n .category-list=${this['category-list']}\n .resource-list=${item.examResourceBOList || item.resourceList || []}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit} .is-set=${!!item.hasSet} .is-save=${!item.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this['show-add']}\n .show-tag=${this['show-tag']}\n .show-category=${this['show-category']}\n .show-resource=${this['show-resource']}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n ></qxs-scale>`\n }\n if (item.answerType === 'page_end') {\n return html`<qxs-page-end\n .current-page-index=${item.currentPageIndex || this._pageEndIndex(index)}\n .total-page=${item.totalPage || this._pageEndTotal()}\n .show-action=${!this._isPreviewValue}\n .show-add=${this['show-add']}\n custom-id=${item.customId || ''}\n @delete=${onDelete}\n @add=${onAdd}\n ></qxs-page-end>`\n }\n return html`<div style=\"color:#909399;padding:8px\">未知题型: ${item.answerType}</div>`\n }\n\n render() {\n return html`\n <div class=\"subject-list\">\n ${this._list.map((item, index) => this._renderItem(item, index))}\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["QxsSubjectList","LitElement","constructor","super","arguments","this","_modelValueAttr","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_list","_sortMode","_sortable","_initialDataProcessed","JSON","stringify","v","parsed","parse","Array","isArray","_normalizeIncomingList","requestUpdate","_useModel","hasAttribute","attributeChangedCallback","name","oldVal","newVal","length","includes","_isPreviewValue","val","connectedCallback","then","_processAttributeList","attr","getAttribute","_normalizeAnswer","answer","title","String","answerId","examAnswerId","_normalizeItem","item","answerType","richTextContent","examTypeEnum","answers","map","customId","uid","_rebuildPageEndMarkers","items","some","Number","pageIndex","currentPageIndex","rebuilt","forEach","push","normalized","firstUpdated","updateComplete","_initSortable","updated","changed","has","destroy","setTimeout","disconnectedCallback","renderRoot","querySelector","requestAnimationFrame","currentEl","Sortable","create","handle","animation","ghostClass","chosenClass","onEnd","evt","oldIndex","newIndex","arr","splice","_emitListChange","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_withPageIndex","serialized","pendingBoundary","toJSON","subjectEls","querySelectorAll","results","errors","el","data","err","SubjectError","message","validate","valid","errs","currentList","addSubject","type","index","examAnswerRelationType","undefined","pageEndItem","analysis","scaleQuestionList","isEdit","isSave","isRealCanDel","hasSet","isKey","answerCheckType","addExam","newItems","uploadExcel","list","setAnswerRelation","answerRelations","customAnswerId","find","ans","c","setTagList","tagList","tagInfos","memberTagInfo","_orderIndex","n","out","_move","dir","_save","i","_deleteByCustomId","filter","_delete","_setEdit","_pageEndTotal","_pageEndIndex","slice","_syncRelationAnswer","currentAnswer","answerIndex","findIndex","currentIndex","orderIndex","_renderItem","common","onMove","onDelete","onSave","onEdit","onAdd","SubjectType","SINGLE","MULTIPLE","SORT","html","examResourceBOList","resourceList","examRichTextContent","leastAnswerCount","examExpand","categoryId","category","aiAnswer","examId","value","BLANK_FILL","examAnswerSettingBO","examAnswerSettingVO","TEXT_FILL","SCALE","totalPage","render","styles","css","__decorateClass","property","attribute","prototype","Object","Boolean","state","safeCustomElement"],"mappings":"ujBAkBaA,QAAAA,eAAN,cAA6BC,EAAAA,WAA7BC,WAAAA,GAAAC,SAAAC,WAyBkCC,KAAA,eAAe,EAGhBA,KAAA,aAA6B,KAqBnEA,KAAQC,gBAAkB,GAG1BD,KAAA,gBAAkDE,SACzC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAASC,GAAKL,EAAQK,EAAEC,QAAQC,QACvCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAI8Bd,KAAA,iBAAyB,GAC5BA,KAAA,aAAa,EACRA,KAAA,kBAAkB,EACxBA,KAAA,YAAY,EACNA,KAAA,kBAAkB,EACtBA,KAAA,cAAc,EACfA,KAAA,aAAa,EACFA,KAAA,wBAAwB,EACnCA,KAAA,aAAa,EACZA,KAAA,cAAe,GAiD3DA,KAAQe,MAAe,GACvBf,KAAQgB,WAAY,EAC7BhB,KAAQiB,UAA6B,KAOrCjB,KAAQkB,uBAAwB,CAAA,CAlGhC,gBAAI,GAA0B,OAAOC,KAAKC,UAAUpB,KAAKe,MAAO,CAEhE,gBAAI,CAAcM,GAChB,GAAKA,GAAKA,IAAMrB,KAAKC,gBAArB,CACAD,KAAKC,gBAAkBoB,EACvB,IACE,MAAMC,EAASH,KAAKI,MAAMF,GACtBG,MAAMC,QAAQH,KAChBtB,KAAKe,MAAQf,KAAK0B,uBAAuBJ,GACzCtB,KAAK2B,gBAET,CAAA,MACmC,CATY,CAUjD,CA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AAA,UAAA,GACMH,EAAA,CAAxDC,EAAAA,SAAS,CAAE/E,KAAMmF,QAASH,UAAW,mBAjE3B3M,QAAAA,eAiE8C4M,UAAA,gBAAA,GACJH,EAAA,CAApDC,EAAAA,SAAS,CAAE/E,KAAMmF,QAASH,UAAW,eAlE3B3M,QAAAA,eAkE0C4M,UAAA,YAAA,GACDH,EAAA,CAAnDC,EAAAA,SAAS,CAAE/E,KAAMmF,QAASH,UAAW,cAnE3B3M,QAAAA,eAmEyC4M,UAAA,WAAA,GACWH,EAAA,CAA9DC,EAAAA,SAAS,CAAE/E,KAAMmF,QAASH,UAAW,yBApE3B3M,QAAAA,eAoEoD4M,UAAA,sBAAA,GACXH,EAAA,CAAnDC,EAAAA,SAAS,CAAE/E,KAAMmF,QAASH,UAAW,cArE3B3M,QAAAA,eAqEyC4M,UAAA,WAAA,GACCH,EAAA,CAApDC,EAAAA,SAAS,CAAE/E,KAAMxE,OAAQwJ,UAAW,gBAtE1B3M,QAAAA,eAsE0C4M,UAAA,aAAA,GACIH,EAAA,CAAxDC,EAAAA,SAAS,CAAE/E,KAAMkF,OAAQF,UAAW,oBAvE1B3M,QAAAA,eAuE8C4M,UAAA,iBAAA,GAGrDH,EAAA,CADHC,EAAAA,SAAS,CAAE/E,KAAM9F,MAAO8K,UAAW,kBAzEzB3M,QAAAA,eA0EP4M,UAAA,eAAA,GA6CaH,EAAA,CAAhBM,EAAAA,SAvHU/M,QAAAA,eAuHM4M,UAAA,QAAA,GACAH,EAAA,CAAhBM,EAAAA,SAxHU/M,QAAAA,eAwHM4M,UAAA,YAAA,GAxHN5M,QAAAA,eAANyM,EAAA,CADNO,EAAAA,kBAAkB,qBACNhN,QAAAA"}
@@ -1,16 +1,16 @@
1
- "use strict";var e=require("lit"),t=require("lit/decorators.js"),s=require("../base/define.cjs"),o=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=(e,t,s,i)=>{for(var a,d=i>1?void 0:i?r(t,s):t,n=e.length-1;n>=0;n--)(a=e[n])&&(d=(i?a(t,s,d):a(d))||d);return i&&d&&o(t,s,d),d};exports.QxsPageEnd=class extends e.LitElement{constructor(){super(...arguments),this.currentPageIndex=1,this.totalPage=1,this.showAction=!0,this.showAdd=!0,this.customId=""}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}async toJSON(){const e={answerType:"page_end"};return this.customId&&(e.customId=this.customId),e}validate(){return[]}render(){return e.html`
1
+ "use strict";var e=require("lit"),t=require("lit/decorators.js"),s=require("../base/define.cjs"),i=Object.defineProperty,o=Object.getOwnPropertyDescriptor,r=(e,t,s,r)=>{for(var a,d=r>1?void 0:r?o(t,s):t,n=e.length-1;n>=0;n--)(a=e[n])&&(d=(r?a(t,s,d):a(d))||d);return r&&d&&i(t,s,d),d};exports.QxsPageEnd=class extends e.LitElement{constructor(){super(...arguments),this["current-page-index"]=1,this["total-page"]=1,this["show-action"]=!0,this["show-add"]=!0,this["custom-id"]=""}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}async toJSON(){const e={answerType:"page_end"};return this["custom-id"]&&(e.customId=this["custom-id"]),e}validate(){return[]}render(){return e.html`
2
2
  <div class="container">
3
3
  <div class="divider">
4
4
  <div class="line"></div>
5
- <span class="label">第${this.currentPageIndex} / ${this.totalPage}页</span>
5
+ <span class="label">第${this["current-page-index"]} / ${this["total-page"]}页</span>
6
6
  <div class="line"></div>
7
7
  </div>
8
- ${this.showAction?e.html`
8
+ ${this["show-action"]?e.html`
9
9
  <qxs-subject-action
10
- .pageEnd=${!0}
11
- .showAdd=${this.showAdd}
12
- .showOtherOption=${!1}
13
- .showRichText=${!1}
10
+ .page-end=${!0}
11
+ .show-add=${this["show-add"]}
12
+ .show-other-option=${!1}
13
+ .show-rich-text=${!1}
14
14
  @delete=${()=>this._emit("delete")}
15
15
  @add=${e=>this._emit("add",e.detail)}
16
16
  ></qxs-subject-action>
@@ -22,5 +22,5 @@
22
22
  .divider { display: flex; align-items: center; padding: 12px 0; }
23
23
  .line { flex: 1; height: 1px; background-color: #e4e7ed; }
24
24
  .label { padding: 0 12px; font-size: 12px; color: #8c8c8c; }
25
- `,i([t.property({type:Number,attribute:"current-page-index"})],exports.QxsPageEnd.prototype,"currentPageIndex",2),i([t.property({type:Number,attribute:"total-page"})],exports.QxsPageEnd.prototype,"totalPage",2),i([t.property({type:Boolean,attribute:"show-action"})],exports.QxsPageEnd.prototype,"showAction",2),i([t.property({type:Boolean,attribute:"show-add"})],exports.QxsPageEnd.prototype,"showAdd",2),i([t.property({type:String,attribute:"custom-id"})],exports.QxsPageEnd.prototype,"customId",2),exports.QxsPageEnd=i([s.safeCustomElement("qxs-page-end")],exports.QxsPageEnd);
25
+ `,r([t.property({type:Number,attribute:"current-page-index"})],exports.QxsPageEnd.prototype,"current-page-index",2),r([t.property({type:Number,attribute:"total-page"})],exports.QxsPageEnd.prototype,"total-page",2),r([t.property({type:Boolean,attribute:"show-action"})],exports.QxsPageEnd.prototype,"show-action",2),r([t.property({type:Boolean,attribute:"show-add"})],exports.QxsPageEnd.prototype,"show-add",2),r([t.property({type:String,attribute:"custom-id"})],exports.QxsPageEnd.prototype,"custom-id",2),exports.QxsPageEnd=r([s.safeCustomElement("qxs-page-end")],exports.QxsPageEnd);
26
26
  //# sourceMappingURL=page-end.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-end.cjs","sources":["../../../../packages/components-wc/src/subject/page-end.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-page-end')\nexport class QxsPageEnd extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n .container { width: 100%; }\n .divider { display: flex; align-items: center; padding: 12px 0; }\n .line { flex: 1; height: 1px; background-color: #e4e7ed; }\n .label { padding: 0 12px; font-size: 12px; color: #8c8c8c; }\n `\n\n @property({ type: Number, attribute: 'current-page-index' }) currentPageIndex = 1\n @property({ type: Number, attribute: 'total-page' }) totalPage = 1\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-add' }) showAdd = true\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n async toJSON(): Promise<any> {\n const result: any = {\n answerType: 'page_end',\n }\n if (this.customId) {\n result.customId = this.customId\n }\n return result\n }\n\n validate() {\n return []\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"divider\">\n <div class=\"line\"></div>\n <span class=\"label\">第${this.currentPageIndex} / ${this.totalPage}页</span>\n <div class=\"line\"></div>\n </div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n .pageEnd=${true}\n .showAdd=${this.showAdd}\n .showOtherOption=${false}\n .showRichText=${false}\n @delete=${() => this._emit('delete')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n ></qxs-subject-action>\n `\n : ''}\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["QxsPageEnd","LitElement","constructor","super","arguments","this","currentPageIndex","totalPage","showAction","showAdd","customId","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","toJSON","result","answerType","validate","render","html","e","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","String","safeCustomElement"],"mappings":"6RAKaA,QAAAA,WAAN,cAAyBC,EAAAA,WAAzBC,WAAAA,GAAAC,SAAAC,WASwDC,KAAAC,iBAAmB,EAC3BD,KAAAE,UAAY,EACVF,KAAAG,YAAa,EAChBH,KAAAI,SAAU,EACVJ,KAAAK,SAAW,EAAA,CAEvDC,KAAAA,CAAMC,EAAcC,GAC1BR,KAAKS,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,YAAMK,GACJ,MAAMC,EAAc,CAClBC,WAAY,YAKd,OAHIf,KAAKK,WACPS,EAAOT,SAAWL,KAAKK,UAElBS,CACT,CAEAE,QAAAA,GACE,MAAO,EACT,CAEAC,MAAAA,GACE,OAAOC,EAAAA,IAAA;;;;iCAIsBlB,KAAKC,sBAAsBD,KAAKE;;;UAGvDF,KAAKG,WACHe,EAAAA,IAAA;;wBAEW;uBACAlB,KAAKI;gCACG;6BACH;sBACN,IAAMJ,KAAKM,MAAM;mBACnBa,GAAmBnB,KAAKM,MAAM,MAAOa,EAAEX;;UAG/C;;KAGV,GAvDWb,QAAAA,WACJyB,OAASC,EAAAA,GAAA;;;;;;IAQ6CC,EAAA,CAA5DC,EAAAA,SAAS,CAAEC,KAAMC,OAAQC,UAAW,wBAT1B/B,QAAAA,WASkDgC,UAAA,mBAAA,GACRL,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAMC,OAAQC,UAAW,gBAV1B/B,QAAAA,WAU0CgC,UAAA,YAAA,GACEL,EAAA,CAAtDC,EAAAA,SAAS,CAAEC,KAAMI,QAASF,UAAW,iBAX3B/B,QAAAA,WAW4CgC,UAAA,aAAA,GACHL,EAAA,CAAnDC,EAAAA,SAAS,CAAEC,KAAMI,QAASF,UAAW,cAZ3B/B,QAAAA,WAYyCgC,UAAA,UAAA,GACAL,EAAA,CAAnDC,EAAAA,SAAS,CAAEC,KAAMK,OAAQH,UAAW,eAb1B/B,QAAAA,WAayCgC,UAAA,WAAA,GAbzChC,QAAAA,WAAN2B,EAAA,CADNQ,EAAAA,kBAAkB,iBACNnC,QAAAA"}
1
+ {"version":3,"file":"page-end.cjs","sources":["../../../../packages/components-wc/src/subject/page-end.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-page-end')\nexport class QxsPageEnd extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n .container { width: 100%; }\n .divider { display: flex; align-items: center; padding: 12px 0; }\n .line { flex: 1; height: 1px; background-color: #e4e7ed; }\n .label { padding: 0 12px; font-size: 12px; color: #8c8c8c; }\n `\n\n @property({ type: Number, attribute: 'current-page-index' }) 'current-page-index' = 1\n @property({ type: Number, attribute: 'total-page' }) 'total-page' = 1\n @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n async toJSON(): Promise<any> {\n const result: any = {\n answerType: 'page_end',\n }\n if (this['custom-id']) {\n result.customId = this['custom-id']\n }\n return result\n }\n\n validate() {\n return []\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"divider\">\n <div class=\"line\"></div>\n <span class=\"label\">第${this['current-page-index']} / ${this['total-page']}页</span>\n <div class=\"line\"></div>\n </div>\n ${this['show-action']\n ? html`\n <qxs-subject-action\n .page-end=${true}\n .show-add=${this['show-add']}\n .show-other-option=${false}\n .show-rich-text=${false}\n @delete=${() => this._emit('delete')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n ></qxs-subject-action>\n `\n : ''}\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["QxsPageEnd","LitElement","constructor","super","arguments","this","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","toJSON","result","answerType","customId","validate","render","html","e","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","String","safeCustomElement"],"mappings":"6RAKaA,QAAAA,WAAN,cAAyBC,EAAAA,WAAzBC,WAAAA,GAAAC,SAAAC,WASwDC,KAAA,sBAAuB,EAC/BA,KAAA,cAAe,EACbA,KAAA,gBAA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s"),i=require("./single.cjs"),r=require("./types.cjs"),o=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=(t,e,s,i)=>{for(var r,l=i>1?void 0:i?a(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(l=(i?r(e,s,l):r(l))||l);return i&&l&&o(e,s,l),l};const n=t.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>`,p=t.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>`;exports.QxsScale=class extends t.LitElement{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAdd=!0,this.showAnalysis=!0,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.modelValue="",this.useModel=!1,this.TITLE_MAX=200}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answerList")}get scaleQuestions(){return this._scaleQuestions}set scaleQuestions(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scaleQuestions")}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),!this.isEdit&&(t.has("title")||t.has("answerList")||t.has("analysis")||t.has("richTextContent")||t.has("scaleQuestions"))&&this._syncProps(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this._richText=this.richTextContent||"",this._showRichText=!!this.richTextContent}async toJSON(){return new Promise((t,e)=>{const s={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},o=this.isEdit?this._title:this.title||"",a=this.isEdit?this._answers:this.answerList||[],l=this.isEdit?this._analysis:this.analysis||"",n=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"",p=this.isEdit?this._showRichText:!!this.richTextContent,h=this.isEdit?this._richText:this.richTextContent||"";if(!o)return void e(new i.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",s));for(let t=0;t<a.length;t++)if(!a[t].title)return void e(new i.SubjectError(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",s));if(!n)return void e(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",s));const d=n.split("\n").filter(t=>t.trim());if(0===d.length)return void e(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",s));const c={answerType:r.SubjectType.SCALE,title:o,analysis:l,answers:a,scaleQuestionList:d,examRichTextContent:p?h:"",examAnswerRelationType:this.examAnswerRelationType};this.customId&&(c.customId=this.customId),t(c)})}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}validate(){const t=[],e={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",r=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"";if(s||t.push(new i.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",e)),r.forEach((s,r)=>{s.title||t.push(new i.SubjectError(`选项${String.fromCharCode(65+r)}未填写`,"ANSWER_EMPTY","answers",e))}),o){0===o.split("\n").filter(t=>t.trim()).length&&t.push(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e))}else t.push(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e));return t}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t.html`
1
+ "use strict";var t=require("lit"),e=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("./single.cjs"),r=require("./types.cjs"),a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,l=(t,e,s,i)=>{for(var r,l=i>1?void 0:i?o(e,s):e,n=t.length-1;n>=0;n--)(r=t[n])&&(l=(i?r(e,s,l):r(l))||l);return i&&l&&a(e,s,l),l};const n=t.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>`,p=t.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>`;exports.QxsScale=class extends t.LitElement{constructor(){super(...arguments),this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["show-analysis"]=!0,this.analysis="",this["rich-text-content"]="",this["exam-answer-relation-type"]=0,this["exam-id"]=0,this["category-id"]="",this["tag-list"]=[],this["category-list"]=[],this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-resource"]=!1,this["upload-image"]=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this._selectedTagList=[],this._categoryId="",this["model-value"]="",this["use-model"]=!1,this.TITLE_MAX=200}get"answer-list"(){return this._answers}set"answer-list"(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answer-list")}get"scale-questions"(){return this._scaleQuestions}set"scale-questions"(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scale-questions")}willUpdate(t){t.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(t.has("title")||t.has("answer-list")||t.has("analysis")||t.has("rich-text-content")||t.has("scale-questions")||t.has("tag-list")||t.has("category-id"))&&this._syncProps(),t.has("model-value")&&this["use-model"]&&(this._title=this["model-value"]),t.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(t=>({...t})):[]),t.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):"")}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(t=>({...t})):[],this._categoryId=this["category-id"]?String(this["category-id"]):""}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_removeTag(t){this._selectedTagList=this._selectedTagList.filter(e=>String(e.tagId)!==String(t)),this._emit("tag-change",{value:this._selectedTagList,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_chooseTag(){this._emit("choose-tag",{value:this._selectedTagList,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_onCategoryChange(t){this._categoryId=t,this._emit("category-change",{value:t,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_imageResources(){return(this["resource-list"]||[]).filter(t=>1===t.resourceType).map(t=>t.resource.middle||t.resource.url).filter(Boolean)}_videoResource(){return(this["resource-list"]||[]).find(t=>2===t.resourceType)?.resource||null}_categoryLabel(){const t=this["category-list"].find(t=>String(t.categoryId)===String(this._categoryId));return t?.title||t?.categoryName||this._categoryId||"未选择分类"}async toJSON(){return new Promise((t,e)=>{const s={customId:this["custom-id"]||void 0,answerType:"scale",orderIndex:this["order-index"]},a=this["is-edit"]?this._title:this.title||"",o=this["is-edit"]?this._answers:this["answer-list"]||[],l=this["is-edit"]?this._analysis:this.analysis||"",n=this["is-edit"]?this._rowTitle:this["scale-questions"]?.join("\n")||"",p=this["is-edit"]?this._showRichText:!!this["rich-text-content"],c=this["is-edit"]?this._richText:this["rich-text-content"]||"",h=this._selectedTagList||[];if(!a)return void e(new i.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",s));for(let t=0;t<o.length;t++)if(!o[t].title)return void e(new i.SubjectError(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",s));if(!n)return void e(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",s));const d=n.split("\n").filter(t=>t.trim());if(0===d.length)return void e(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",s));const x={answerType:r.SubjectType.SCALE,title:a,analysis:l,answers:o,scaleQuestionList:d,examRichTextContent:p?c:"",examAnswerRelationType:this["exam-answer-relation-type"],categoryId:this._categoryId||"",memberTagInfo:h,tagInfos:h,resourceList:this["resource-list"]||[],examResourceBOList:this["resource-list"]||[],isSetCorrectAnswer:!1};this["custom-id"]&&(x.customId=this["custom-id"]),t(x)})}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}validate(){const t=[],e={customId:this["custom-id"]||void 0,answerType:"scale",orderIndex:this["order-index"]},s=this["is-edit"]?this._title:this.title||"",r=this["is-edit"]?this._answers:this["answer-list"]||[],a=this["is-edit"]?this._rowTitle:this["scale-questions"]?.join("\n")||"";if(s||t.push(new i.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",e)),r.forEach((s,r)=>{s.title||t.push(new i.SubjectError(`选项${String.fromCharCode(65+r)}未填写`,"ANSWER_EMPTY","answers",e))}),a){0===a.split("\n").filter(t=>t.trim()).length&&t.push(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e))}else t.push(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e));return t}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t.html`
2
2
  <div class="preview">
3
- <span class="title">${this.orderIndex+1}.${this.title}(量表题)</span>
4
- ${this.richTextContent?t.html`<div style="margin-top:8px" .innerHTML=${this.richTextContent}></div>`:""}
3
+ <span class="title">${this["order-index"]+1}.${this.title}(量表题)</span>
4
+ ${this["rich-text-content"]?t.html`<div style="margin-top:8px" .innerHTML=${this["rich-text-content"]}></div>`:""}
5
5
  <table class="scale-table">
6
6
  <thead><tr>
7
7
  <th style="width:${e}%">问题 \ 选项</th>
@@ -14,13 +14,67 @@
14
14
  </tbody>
15
15
  </table>
16
16
  ${this.analysis?t.html`<div style="color:#909399;font-size:12px;margin-top:8px">解析: ${this.analysis}</div>`:""}
17
+ ${this["show-category"]&&this._categoryId?t.html`<div class="section-row"><span class="value-text">分类:${this._categoryLabel()}</span></div>`:""}
18
+ ${this["show-tag"]&&this._selectedTagList.length?t.html`
19
+ <div class="section-row">
20
+ <span class="value-text">标签/关键信息:</span>
21
+ <div class="tag-list" style="margin-top:6px">
22
+ ${this._selectedTagList.map(e=>t.html`<span class="tag-item">${e.tagName}</span>`)}
23
+ </div>
24
+ </div>
25
+ `:""}
26
+ ${this._renderResourceSection()}
27
+ </div>
28
+ `}_renderTagSection(){return this["show-tag"]?t.html`
29
+ <div class="flex-items-start section-row">
30
+ <div class="label"><span>标签:</span></div>
31
+ <div style="flex:1">
32
+ <div class="tag-list">
33
+ ${this._selectedTagList.length?this._selectedTagList.map(e=>t.html`
34
+ <span class="tag-item">
35
+ ${e.tagName}
36
+ ${this["is-save"]?"":t.html`<span class="close" @click=${()=>this._removeTag(e.tagId)}>×</span>`}
37
+ </span>
38
+ `):t.html`<span class="tag-hint">暂无标签/关键信息</span>`}
39
+ </div>
40
+ ${this["is-edit"]&&!this["is-save"]?t.html`<div style="margin-top:8px"><span class="el-link" @click=${()=>this._chooseTag()}>选择</span></div>`:""}
41
+ </div>
42
+ </div>
43
+ `:""}_renderCategorySection(){return this["show-category"]?t.html`
44
+ <div class="flex-items-start section-row">
45
+ <div class="label"><span>分类:</span></div>
46
+ <div style="flex:1">
47
+ ${this["is-edit"]?t.html`
48
+ <select class="el-select" .value=${String(this._categoryId)} ?disabled=${this["is-save"]}
49
+ @change=${t=>this._onCategoryChange(t.target.value)}>
50
+ <option value="">选择分类</option>
51
+ ${this["category-list"].map(e=>t.html`
52
+ <option value=${String(e.categoryId)} ?selected=${String(e.categoryId)===String(this._categoryId)}>${e.title||e.categoryName}</option>
53
+ `)}
54
+ </select>
55
+ `:t.html`<span class="value-text">${this._categoryLabel()}</span>`}
56
+ </div>
57
+ </div>
58
+ `:""}_renderResourceSection(){if(!this["show-resource"])return"";const e=this._imageResources(),s=this._videoResource();return t.html`
59
+ <div class="flex-items-start section-row">
60
+ <div class="label"><span>资源:</span></div>
61
+ <div style="flex:1">
62
+ <div class="resource-summary">图片 ${e.length} 张${s?.url?",含视频资源":""}</div>
63
+ ${e.length?t.html`
64
+ <div class="resource-thumbs">
65
+ ${e.slice(0,4).map(e=>t.html`<img class="resource-thumb" src=${e} alt="resource" />`)}
66
+ </div>
67
+ `:""}
68
+ ${s?.url?t.html`<div style="margin-top:8px"><a class="el-link" href=${s.url} target="_blank" rel="noreferrer">查看视频</a></div>`:""}
69
+ ${e.length||s?.url?"":t.html`<div class="tag-hint">暂无资源</div>`}
70
+ </div>
17
71
  </div>
18
72
  `}_renderEdit(){return t.html`
19
73
  <div class="flex-items-start">
20
74
  <div class="label"><span>题目:</span></div>
21
75
  <div style="flex:1">
22
76
  <div class="el-input">
23
- <textarea rows="2" .value=${this._title} ?disabled=${this.isSave}
77
+ <textarea rows="2" .value=${this._title} ?disabled=${this["is-save"]}
24
78
  maxlength=${this.TITLE_MAX}
25
79
  @input=${t=>this._onTitleInput(t)}
26
80
  placeholder="【量表题】请输入问题"></textarea>
@@ -29,11 +83,17 @@
29
83
  </div>
30
84
  </div>
31
85
 
86
+ ${this._renderTagSection()}
87
+
88
+ ${this._renderCategorySection()}
89
+
90
+ ${this._renderResourceSection()}
91
+
32
92
  <div class="flex-items-start" style="margin-top:12px">
33
93
  <div class="label"><span>行标题:</span></div>
34
94
  <div class="flex" style="flex:1">
35
95
  <div class="el-input" style="width:160px">
36
- <textarea class="row-title-textarea" .value=${this._rowTitle} ?disabled=${this.isSave}
96
+ <textarea class="row-title-textarea" .value=${this._rowTitle} ?disabled=${this["is-save"]}
37
97
  @input=${t=>{this._rowTitle=t.target.value}}
38
98
  @keydown=${t=>{t.stopPropagation()}}
39
99
  placeholder="请输入行标题"></textarea>
@@ -43,12 +103,12 @@
43
103
  <div class="answer-item">
44
104
  <span class="label">${String.fromCharCode(65+s)}.</span>
45
105
  <div class="input">
46
- <input type="text" .value=${e.title} ?disabled=${this.isSave}
106
+ <input type="text" .value=${e.title} ?disabled=${this["is-save"]}
47
107
  maxlength="10"
48
- @input=${t=>{this._answers=this._answers.map((e,i)=>i===s?{title:t.target.value}:e)}}
108
+ @input=${t=>{const e=t.target.value;this._answers=this._answers.map((t,i)=>i===s?{...t,title:e}:t)}}
49
109
  placeholder="选项${s+1}" />
50
110
  </div>
51
- ${this.isSave?"":t.html`
111
+ ${this["is-save"]?"":t.html`
52
112
  <span class="icon" @click=${()=>{this._answers.length<5&&(this._answers=[...this._answers,{title:""}])}}>${n}</span>
53
113
  <span class="icon ${this._answers.length<3?"disabled":""}" @click=${()=>{this._answers.length>3&&(this._answers=this._answers.filter((t,e)=>e!==s))}}>${p}</span>
54
114
  `}
@@ -62,7 +122,7 @@
62
122
  <div class="label"><span>解析:</span></div>
63
123
  <div style="flex:1">
64
124
  <div class="el-input">
65
- <textarea rows="2" .value=${this._analysis} ?disabled=${this.isSave}
125
+ <textarea rows="2" .value=${this._analysis} ?disabled=${this["is-save"]}
66
126
  @input=${t=>{this._analysis=t.target.value}}
67
127
  placeholder="请输入题目解析"></textarea>
68
128
  </div>
@@ -75,25 +135,25 @@
75
135
  <div style="flex:1">
76
136
  <qxs-blocksuite-editor
77
137
  .content=${this._richText}
78
- .uploadImage=${this.uploadImage}
138
+ .upload-image=${this["upload-image"]}
79
139
  ?is-edit=${!0}
80
140
  ></qxs-blocksuite-editor>
81
- ${this.showAction?"":t.html`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
141
+ ${this["show-action"]?"":t.html`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
82
142
  </div>
83
143
  </div>
84
144
  `:""}
85
145
  `}render(){return t.html`
86
- <qxs-subject-layout .showEdit=${this.isEdit}>
146
+ <qxs-subject-layout .show-edit=${this["is-edit"]}>
87
147
  <div slot="preview">${this._renderPreview()}</div>
88
148
  <div slot="edit">${this._renderEdit()}</div>
89
- ${this.showAction?t.html`
149
+ ${this["show-action"]?t.html`
90
150
  <qxs-subject-action
91
- .isEdit=${this.isEdit}
92
- .isSet=${this.isSet}
93
- .showAdd=${this.showAdd}
94
- .showRichText=${this._showRichText}
95
- .showOtherOption=${!1}
96
- exam-answer-relation-type=${this.examAnswerRelationType}
151
+ .is-edit=${this["is-edit"]}
152
+ .is-set=${this["is-set"]}
153
+ .show-add=${this["show-add"]}
154
+ .show-rich-text=${this._showRichText}
155
+ .show-other-option=${!1}
156
+ exam-answer-relation-type=${this["exam-answer-relation-type"]}
97
157
  @delete=${()=>this._emit("delete")}
98
158
  @save=${this._save}
99
159
  @edit=${()=>this._emit("edit")}
@@ -158,8 +218,29 @@
158
218
  .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
159
219
  .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }
160
220
 
161
- .row-title-textarea {
162
- height: 200px;
221
+ .row-title-textarea { height: 200px; }
222
+ .section-row { margin-top: 12px; }
223
+ .value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }
224
+ .tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
225
+ .tag-item {
226
+ display: inline-flex; align-items: center; gap: 4px;
227
+ padding: 4px 8px; font-size: 12px; line-height: 1;
228
+ color: #3D61E3; background: #ecf5ff; border: 1px solid #d9ecff; border-radius: 4px;
229
+ }
230
+ .tag-item .close { cursor: pointer; color: #909399; }
231
+ .tag-item .close:hover { color: #f56c6c; }
232
+ .tag-hint { font-size: 12px; color: #909399; }
233
+ .el-select {
234
+ width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;
235
+ padding: 0 8px; font-size: 13px; background: #fff; appearance: none;
236
+ 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");
237
+ background-repeat: no-repeat; background-position: right 8px center;
238
+ }
239
+ .resource-summary { font-size: 12px; color: #606266; }
240
+ .resource-thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
241
+ .resource-thumb {
242
+ width: 72px; height: 72px; object-fit: cover; border-radius: 6px;
243
+ border: 1px solid #e4e7ed; background: #f5f7fa;
163
244
  }
164
- `,l([e.property({type:Number,attribute:"order-index"})],exports.QxsScale.prototype,"orderIndex",2),l([e.property({type:String})],exports.QxsScale.prototype,"title",2),l([e.property({type:String,attribute:"custom-id"})],exports.QxsScale.prototype,"customId",2),l([e.property({type:Boolean,attribute:"is-edit"})],exports.QxsScale.prototype,"isEdit",2),l([e.property({type:Boolean,attribute:"is-save"})],exports.QxsScale.prototype,"isSave",2),l([e.property({type:Boolean,attribute:"is-set"})],exports.QxsScale.prototype,"isSet",2),l([e.property({type:Boolean,attribute:"show-action"})],exports.QxsScale.prototype,"showAction",2),l([e.property({type:Boolean,attribute:"show-add"})],exports.QxsScale.prototype,"showAdd",2),l([e.property({type:Boolean,attribute:"show-analysis"})],exports.QxsScale.prototype,"showAnalysis",2),l([e.property({type:String})],exports.QxsScale.prototype,"analysis",2),l([e.property({type:String,attribute:"rich-text-content"})],exports.QxsScale.prototype,"richTextContent",2),l([e.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsScale.prototype,"examAnswerRelationType",2),l([e.property({type:Object})],exports.QxsScale.prototype,"uploadImage",2),l([e.property({type:Array,attribute:"answer-list"})],exports.QxsScale.prototype,"answerList",1),l([e.property({type:Array,attribute:"scale-questions"})],exports.QxsScale.prototype,"scaleQuestions",1),l([e.state()],exports.QxsScale.prototype,"_answers",2),l([e.state()],exports.QxsScale.prototype,"_scaleQuestions",2),l([e.state()],exports.QxsScale.prototype,"_rowTitle",2),l([e.state()],exports.QxsScale.prototype,"_title",2),l([e.state()],exports.QxsScale.prototype,"_analysis",2),l([e.state()],exports.QxsScale.prototype,"_showRichText",2),l([e.state()],exports.QxsScale.prototype,"_richText",2),l([e.property({type:String,attribute:"model-value"})],exports.QxsScale.prototype,"modelValue",2),l([e.property({type:Boolean,attribute:"use-model"})],exports.QxsScale.prototype,"useModel",2),exports.QxsScale=l([s.safeCustomElement("qxs-scale")],exports.QxsScale);
245
+ `,l([e.property({type:Number,attribute:"order-index"})],exports.QxsScale.prototype,"order-index",2),l([e.property({type:String})],exports.QxsScale.prototype,"title",2),l([e.property({type:String,attribute:"custom-id"})],exports.QxsScale.prototype,"custom-id",2),l([e.property({type:Boolean,attribute:"is-edit"})],exports.QxsScale.prototype,"is-edit",2),l([e.property({type:Boolean,attribute:"is-save"})],exports.QxsScale.prototype,"is-save",2),l([e.property({type:Boolean,attribute:"is-set"})],exports.QxsScale.prototype,"is-set",2),l([e.property({type:Boolean,attribute:"show-action"})],exports.QxsScale.prototype,"show-action",2),l([e.property({type:Boolean,attribute:"show-add"})],exports.QxsScale.prototype,"show-add",2),l([e.property({type:Boolean,attribute:"show-analysis"})],exports.QxsScale.prototype,"show-analysis",2),l([e.property({type:String})],exports.QxsScale.prototype,"analysis",2),l([e.property({type:String,attribute:"rich-text-content"})],exports.QxsScale.prototype,"rich-text-content",2),l([e.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsScale.prototype,"exam-answer-relation-type",2),l([e.property({type:Number,attribute:"exam-id"})],exports.QxsScale.prototype,"exam-id",2),l([e.property({type:String,attribute:"category-id"})],exports.QxsScale.prototype,"category-id",2),l([e.property({type:Array,attribute:"tag-list"})],exports.QxsScale.prototype,"tag-list",2),l([e.property({type:Array,attribute:"category-list"})],exports.QxsScale.prototype,"category-list",2),l([e.property({type:Array,attribute:"resource-list"})],exports.QxsScale.prototype,"resource-list",2),l([e.property({type:Boolean,attribute:"show-tag"})],exports.QxsScale.prototype,"show-tag",2),l([e.property({type:Boolean,attribute:"show-category"})],exports.QxsScale.prototype,"show-category",2),l([e.property({type:Boolean,attribute:"show-resource"})],exports.QxsScale.prototype,"show-resource",2),l([e.property({type:Object,attribute:"upload-image"})],exports.QxsScale.prototype,"upload-image",2),l([e.property({type:Array,attribute:"answer-list"})],exports.QxsScale.prototype,"answer-list",1),l([e.property({type:Array,attribute:"scale-questions"})],exports.QxsScale.prototype,"scale-questions",1),l([e.state()],exports.QxsScale.prototype,"_answers",2),l([e.state()],exports.QxsScale.prototype,"_scaleQuestions",2),l([e.state()],exports.QxsScale.prototype,"_rowTitle",2),l([e.state()],exports.QxsScale.prototype,"_title",2),l([e.state()],exports.QxsScale.prototype,"_analysis",2),l([e.state()],exports.QxsScale.prototype,"_showRichText",2),l([e.state()],exports.QxsScale.prototype,"_richText",2),l([e.state()],exports.QxsScale.prototype,"_selectedTagList",2),l([e.state()],exports.QxsScale.prototype,"_categoryId",2),l([e.property({type:String,attribute:"model-value"})],exports.QxsScale.prototype,"model-value",2),l([e.property({type:Boolean,attribute:"use-model"})],exports.QxsScale.prototype,"use-model",2),exports.QxsScale=l([s.safeCustomElement("qxs-scale")],exports.QxsScale);
165
246
  //# sourceMappingURL=scale.cjs.map