@qxs-bns/components-wc 0.0.4 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";var n=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=(e,t,o,r)=>{for(var i,a=r>1?void 0:r?s(t,o):t,l=e.length-1;l>=0;l--)(i=e[l])&&(a=(r?i(t,o,a):i(a))||a);return r&&a&&n(t,o,a),a};const l=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}];e`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,e`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>`,e`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`,e`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/></svg>`;let d=class extends o{constructor(){super(...arguments),this.isEdit=!1,this.isSet=!1,this.isKey=!1,this.answerCheckType=1,this.showOtherOption=!1,this.showRichText=!0,this.hideAddRichText=!1,this.pageEnd=!1,this.examAnswerRelationType=0,this._modalOpen=!1,this._currentCheckType=1}updated(e){e.has("answerCheckType")&&(this._currentCheckType=this.answerCheckType)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return l.find(e=>e.value===this.answerCheckType)?.label??""}_renderEditMode(){return e`
1
+ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=(e,t,o,r)=>{for(var i,s=r>1?void 0:r?a(t,o):t,l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r?i(t,o,s):i(s))||s);return r&&s&&n(t,o,s),s};const l=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}];e`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"/><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"/></svg>`,e`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/></svg>`,e`<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>`,e`<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor"><path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/></svg>`;let d=class extends o{constructor(){super(...arguments),this.isEdit=!1,this.isSet=!1,this.isKey=!1,this.answerCheckType=1,this.showOtherOption=!1,this.showRichText=!0,this.hideAddRichText=!1,this.pageEnd=!1,this.examAnswerRelationType=0,this._modalOpen=!1,this._currentCheckType=1}updated(e){e.has("answerCheckType")&&(this._currentCheckType=this.answerCheckType)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return l.find(e=>e.value===this.answerCheckType)?.label??""}_renderEditMode(){return e`
2
2
  <div class="left">
3
3
  ${this.hideAddRichText?"":e`
4
4
  <span class="link-btn" @click=${()=>this._emit("on-show-rich-text")}>+添加题目描述(图文)</span>
@@ -62,8 +62,8 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
62
62
  :host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; }
63
63
  *, ::before, ::after { box-sizing: border-box; }
64
64
 
65
- .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; flex-wrap: wrap; gap: 8px; }
66
- .action.active { background-color: #f6f7fb; }
65
+ .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; background-color: #fafafa; border-top: 1px solid #ebeef5; }
66
+ .action.active { background-color: #f6f7fb; border-top: none; }
67
67
  .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
68
68
  .right { display: flex; align-items: center; gap: 4px; }
69
69
 
@@ -114,5 +114,5 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
114
114
 
115
115
  .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }
116
116
  .radio-item:last-child { margin-bottom: 0; }
117
- `,a([r({type:Boolean,attribute:"is-edit"})],d.prototype,"isEdit",2),a([r({type:Boolean,attribute:"is-set"})],d.prototype,"isSet",2),a([r({type:Boolean,attribute:"is-key"})],d.prototype,"isKey",2),a([r({type:Number,attribute:"answer-check-type"})],d.prototype,"answerCheckType",2),a([r({type:Boolean,attribute:"show-other-option"})],d.prototype,"showOtherOption",2),a([r({type:Boolean,attribute:"show-rich-text"})],d.prototype,"showRichText",2),a([r({type:Boolean,attribute:"hide-add-rich-text"})],d.prototype,"hideAddRichText",2),a([r({type:Boolean,attribute:"page-end"})],d.prototype,"pageEnd",2),a([r({type:Number,attribute:"exam-answer-relation-type"})],d.prototype,"examAnswerRelationType",2),a([i()],d.prototype,"_modalOpen",2),a([i()],d.prototype,"_currentCheckType",2),d=a([(c="qxs-subject-action",function(e){return customElements.get(c)||customElements.define(c,e),e})],d);export{d as QxsSubjectAction};
117
+ `,s([r({type:Boolean,attribute:"is-edit"})],d.prototype,"isEdit",2),s([r({type:Boolean,attribute:"is-set"})],d.prototype,"isSet",2),s([r({type:Boolean,attribute:"is-key"})],d.prototype,"isKey",2),s([r({type:Number,attribute:"answer-check-type"})],d.prototype,"answerCheckType",2),s([r({type:Boolean,attribute:"show-other-option"})],d.prototype,"showOtherOption",2),s([r({type:Boolean,attribute:"show-rich-text"})],d.prototype,"showRichText",2),s([r({type:Boolean,attribute:"hide-add-rich-text"})],d.prototype,"hideAddRichText",2),s([r({type:Boolean,attribute:"page-end"})],d.prototype,"pageEnd",2),s([r({type:Number,attribute:"exam-answer-relation-type"})],d.prototype,"examAnswerRelationType",2),s([i()],d.prototype,"_modalOpen",2),s([i()],d.prototype,"_currentCheckType",2),d=s([(c="qxs-subject-action",function(e){return customElements.get(c)||customElements.define(c,e),e})],d);export{d as QxsSubjectAction};
118
118
  //# sourceMappingURL=action.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"action.mjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst iconEdit = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>`\nconst iconDelete = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>`\nconst iconCheck = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg>`\nconst iconSort = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z\"/></svg>`\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; flex-wrap: wrap; gap: 8px; }\n .action.active { background-color: #f6f7fb; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n <button class=\"text-btn text-btn--danger\" @click=${() => this._emit('delete')}>删除</button>\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>&#x2715;</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","html","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","tagName","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"8fAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGJC,CAAA,uUACEA,CAA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,UAAW,wBAjE3BhD,EAiEmDiD,UAAA,kBAAA,GACVL,EAAA,CAAnDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,cAlE3BhD,EAkEyCiD,UAAA,UAAA,GACgBL,EAAA,CAAnEC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,+BAnE1BhD,EAmEyDiD,UAAA,yBAAA,GAEnDL,EAAA,CAAhBO,KArEUnD,EAqEMiD,UAAA,aAAA,GACAL,EAAA,CAAhBO,KAtEUnD,EAsEMiD,UAAA,oBAAA,GAtENjD,EAAN4C,EAAA,EArBoBH,EAoBR,qBAnBV,SAAUT,GAIf,OAHKoB,eAAeC,IAAIZ,IACtBW,eAAeE,OAAOb,EAAST,GAE1BA,CACT,IAeWhC"}
1
+ {"version":3,"file":"action.mjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst iconEdit = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>`\nconst iconDelete = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>`\nconst iconCheck = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg>`\nconst iconSort = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z\"/></svg>`\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; background-color: #fafafa; border-top: 1px solid #ebeef5; }\n .action.active { background-color: #f6f7fb; border-top: none; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n <button class=\"text-btn text-btn--danger\" @click=${() => this._emit('delete')}>删除</button>\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>&#x2715;</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","html","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","tagName","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"8fAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGJC,CAAA,uUACEA,CAAA,yTACDA,CAAA,iOACDA,CAAA,wKAGV,IAAMC,EAAN,cAA+BC,EAA/BC,WAAAA,GAAAC,SAAAC,WA2D8CC,KAAAC,QAAS,EACVD,KAAAE,OAAQ,EACRF,KAAAG,OAAQ,EACEH,KAAAI,gBAAkB,EACjBJ,KAAAK,iBAAkB,EACrBL,KAAAM,cAAe,EACXN,KAAAO,iBAAkB,EAC5BP,KAAAQ,SAAU,EACMR,KAAAS,uBAAyB,EAEpFT,KAAQU,YAAa,EACrBV,KAAQW,kBAAoB,CAAA,CAErCC,OAAAA,CAAQC,GACFA,EAAQC,IAAI,qBACdd,KAAKW,kBAAoBX,KAAKI,gBAElC,CAEQW,KAAAA,CAAMC,EAAcC,GAC1BjB,KAAKkB,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,eAAYK,GACV,OAAO/B,EAAegC,KAAKC,GAAKA,EAAEhC,QAAUQ,KAAKI,kBAAkBX,OAAS,EAC9E,CAEQgC,eAAAA,GACN,OAAO/B,CAAA;;UAEAM,KAAKO,gBAIJ,GAHAb,CAAA;0CAC8B,IAAMM,KAAKe,MAAM;;UAGjDf,KAAKK,gBACHX,CAAA;0CAC8B,KAAQM,KAAKU,YAAa;;8CAEtBV,KAAKG,iBAAkBuB,GAAa1B,KAAKe,MAAM,UAAW,CAAEvB,MAAQkC,EAAEC,OAA4BC;;;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D3BhD,EA6DuCiD,UAAA,QAAA,GACUL,EAAA,CAA3DC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,uBA9D1BhD,EA8DiDiD,UAAA,kBAAA,GACCL,EAAA,CAA5DC,EAAS,CAAEC,KAAMC,QAASC,UAAW,uBA/D3BhD,EA+DkDiD,UAAA,kBAAA,GACHL,EAAA,CAAzDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,oBAhE3BhD,EAgE+CiD,UAAA,eAAA,GACIL,EAAA,CAA7DC,EAAS,CAAEC,KAAMC,QAASC,UAAW,wBAjE3BhD,EAiEmDiD,UAAA,kBAAA,GACVL,EAAA,CAAnDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,cAlE3BhD,EAkEyCiD,UAAA,UAAA,GACgBL,EAAA,CAAnEC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,+BAnE1BhD,EAmEyDiD,UAAA,yBAAA,GAEnDL,EAAA,CAAhBO,KArEUnD,EAqEMiD,UAAA,aAAA,GACAL,EAAA,CAAhBO,KAtEUnD,EAsEMiD,UAAA,oBAAA,GAtENjD,EAAN4C,EAAA,EArBoBH,EAoBR,qBAnBV,SAAUT,GAIf,OAHKoB,eAAeC,IAAIZ,IACtBW,eAAeE,OAAOb,EAAST,GAE1BA,CACT,IAeWhC"}
@@ -1,8 +1,8 @@
1
- import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as a}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as n}from"../base/define.mjs";import{SubjectError as r}from"./single.mjs";var l=Object.defineProperty,o=Object.getOwnPropertyDescriptor,p=(t,e,i,s)=>{for(var a,n=s>1?void 0:s?o(e,i):e,r=t.length-1;r>=0;r--)(a=t[r])&&(n=(s?a(e,i,n):a(n))||n);return s&&n&&l(e,i,n),n};const h=t`
1
+ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as a}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as l}from"../base/define.mjs";import{SubjectError as n}from"./single.mjs";var o=Object.defineProperty,r=Object.getOwnPropertyDescriptor,p=(t,e,i,s)=>{for(var a,l=s>1?void 0:s?r(e,i):e,n=t.length-1;n>=0;n--)(a=t[n])&&(l=(s?a(e,i,l):a(l))||l);return s&&l&&o(e,i,l),l};const d=t`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none"
3
3
  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
4
4
  <line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>
5
- </svg>`;let d=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!1,isIgnoreCase:!0},this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this.answerList=[],this._title="",this._analysis="",this._answers=[{title:"",tag:"",showInput:!1}],this._isInOrder=!1,this._isIgnoreCase=!0,this._showRichText=!1,this._richText="",this.TITLE_MAX=400}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){if(this._title=(this.title||"").replaceAll(/<filter><\/filter>/g," ______"),this._analysis=this.analysis||"",this.answerList?.length)this._answers=this.answerList.map(t=>({title:t.title||"",tag:"",showInput:!1}));else{const t=(this._title.match(/ ______/g)||[]).length||1;this._answers=Array.from({length:t},()=>({title:"",tag:"",showInput:!1}))}this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_addBlank(){this._title+=" ______",this._answers=[...this._answers,{title:"",tag:"",showInput:!1}],this.requestUpdate()}_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;const i=(this._title.match(/ ______/g)||[]).length;if(i!==this._answers.length)if(i>this._answers.length)for(let t=this._answers.length;t<i;t++)this._answers=[...this._answers,{title:"",tag:"",showInput:!1}];else this._answers=this._answers.slice(0,i)}_handleAddTag(t){t.showInput=!1,t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),this.requestUpdate()}_closeTag(t,e){if(t){const i=e.title.split(","),s=i.findIndex(e=>e===t);s>-1&&(i.splice(s,1),e.title=i.join(",")),this.requestUpdate()}}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"blank_fill",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",a=this.isEdit?this._answers:this.answerList||[],n=this.isEdit?this._analysis:this.analysis||"",l=this.isEdit?this._isInOrder:this.examAnswerSetting?.isInOrder??!1,o=this.isEdit?this._isIgnoreCase:this.examAnswerSetting?.isIgnoreCase??!0,p=this.isEdit?this._showRichText:!!this.richTextContent,h=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void e(new r("题目标题不能为空!","EMPTY_TITLE","title",i));if(a.length<1)return void e(new r("至少添加一个填空符!","NO_BLANK","answers",i));const d={answerType:"blank_fill",title:s.replaceAll(/ ______/g,"<filter></filter>"),answers:a.map(t=>({title:t.title,isCorrect:!0})),analysis:n,isSetCorrectAnswer:!0,isKey:this.isKey,examAnswerSettingBO:{isIgnoreCase:o,isInOrder:l},examRichTextContent:p?h:""};this.customId&&(d.customId=this.customId),t(d)})}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:"blank_fill",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",s=this.isEdit?this._answers:this.answerList||[];return i||t.push(new r("题目标题不能为空!","EMPTY_TITLE","title",e)),s.length<1&&t.push(new r("至少添加一个填空符!","NO_BLANK","answers",e)),t}_renderPreview(){const e=this.title.replaceAll(/<filter><\/filter>/g," ______");return t`
5
+ </svg>`;let h=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!1,isIgnoreCase:!0},this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this.answerList=[],this.modelValue="",this.useModel=!1,this._title="",this._analysis="",this._answers=[{title:"",tag:"",showInput:!1}],this._isInOrder=!1,this._isIgnoreCase=!0,this._showRichText=!1,this._richText="",this.TITLE_MAX=400}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue.replaceAll(/<filter><\/filter>/g," ______"))}_syncProps(){if(this._title=(this.title||"").replaceAll(/<filter><\/filter>/g," ______"),this._analysis=this.analysis||"",this.answerList?.length)this._answers=this.answerList.map(t=>({title:t.title||"",tag:"",showInput:!1}));else{const t=(this._title.match(/ ______/g)||[]).length||1;this._answers=Array.from({length:t},()=>({title:"",tag:"",showInput:!1}))}this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_addBlank(){this._title+=" ______",this._answers=[...this._answers,{title:"",tag:"",showInput:!1}],this.requestUpdate(),this._emitModelUpdate()}_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;const i=(this._title.match(/ ______/g)||[]).length;if(i!==this._answers.length)if(i>this._answers.length)for(let t=this._answers.length;t<i;t++)this._answers=[...this._answers,{title:"",tag:"",showInput:!1}];else this._answers=this._answers.slice(0,i);this._emitModelUpdate()}_emitModelUpdate(){if(this.useModel){const t=this._title.replaceAll(/ ______/g,"<filter></filter>");this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:t}))}}_handleAddTag(t){t.showInput=!1,t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),this.requestUpdate()}_closeTag(t,e){if(t){const i=e.title.split(","),s=i.findIndex(e=>e===t);s>-1&&(i.splice(s,1),e.title=i.join(",")),this.requestUpdate()}}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"blank_fill",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",a=this.isEdit?this._answers:this.answerList||[],l=this.isEdit?this._analysis:this.analysis||"",o=this.isEdit?this._isInOrder:this.examAnswerSetting?.isInOrder??!1,r=this.isEdit?this._isIgnoreCase:this.examAnswerSetting?.isIgnoreCase??!0,p=this.isEdit?this._showRichText:!!this.richTextContent,d=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void e(new n("题目标题不能为空!","EMPTY_TITLE","title",i));if(a.length<1)return void e(new n("至少添加一个填空符!","NO_BLANK","answers",i));const h={answerType:"blank_fill",title:s.replaceAll(/ ______/g,"<filter></filter>"),answers:a.map(t=>({title:t.title,isCorrect:!0})),analysis:l,isSetCorrectAnswer:!0,isKey:this.isKey,examAnswerSettingBO:{isIgnoreCase:r,isInOrder:o},examRichTextContent:p?d:""};this.customId&&(h.customId=this.customId),t(h)})}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:"blank_fill",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",s=this.isEdit?this._answers:this.answerList||[];return i||t.push(new n("题目标题不能为空!","EMPTY_TITLE","title",e)),s.length<1&&t.push(new n("至少添加一个填空符!","NO_BLANK","answers",e)),t}_renderPreview(){const e=this.title.replaceAll(/<filter><\/filter>/g," ______");return t`
6
6
  <div class="preview">
7
7
  <span class="title">${this.orderIndex+1}.${e}(填空题)</span>
8
8
  ${this.richTextContent?t`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
@@ -67,7 +67,7 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
67
67
  @blur=${()=>this._handleAddTag(e)} />
68
68
  `:t`
69
69
  <span class="el-button--small" @click=${()=>{e.showInput=!0,this.requestUpdate(),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(".el-input--small")?.focus()})}}>
70
- ${h}
70
+ ${d}
71
71
  <span>${e.title?"添加同义词":"添加答案"}</span>
72
72
  </span>
73
73
  `}
@@ -123,7 +123,7 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
123
123
  ></qxs-subject-action>
124
124
  `:""}
125
125
  </qxs-subject-layout>
126
- `}};d.styles=e`
126
+ `}};h.styles=e`
127
127
  :host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
128
128
  *, ::before, ::after { box-sizing: border-box; }
129
129
 
@@ -201,5 +201,5 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
201
201
  .answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
202
202
  .answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }
203
203
  .answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
204
- `,p([s({type:Number,attribute:"order-index"})],d.prototype,"orderIndex",2),p([s({type:String})],d.prototype,"title",2),p([s({type:String,attribute:"custom-id"})],d.prototype,"customId",2),p([s({type:Boolean,attribute:"is-edit"})],d.prototype,"isEdit",2),p([s({type:Boolean,attribute:"is-save"})],d.prototype,"isSave",2),p([s({type:Boolean,attribute:"is-set"})],d.prototype,"isSet",2),p([s({type:Boolean,attribute:"is-key"})],d.prototype,"isKey",2),p([s({type:Boolean,attribute:"show-action"})],d.prototype,"showAction",2),p([s({type:Boolean,attribute:"show-analysis"})],d.prototype,"showAnalysis",2),p([s({type:String,attribute:"rich-text-content"})],d.prototype,"richTextContent",2),p([s({type:String})],d.prototype,"analysis",2),p([s({type:Number,attribute:"exam-answer-relation-type"})],d.prototype,"examAnswerRelationType",2),p([s({type:String,attribute:"exam-expand"})],d.prototype,"examExpand",2),p([s({type:Object,attribute:"exam-answer-setting"})],d.prototype,"examAnswerSetting",2),p([s({type:Object})],d.prototype,"uploadImage",2),p([s({type:Array,attribute:"answer-list"})],d.prototype,"answerList",2),p([a()],d.prototype,"_title",2),p([a()],d.prototype,"_analysis",2),p([a()],d.prototype,"_answers",2),p([a()],d.prototype,"_isInOrder",2),p([a()],d.prototype,"_isIgnoreCase",2),p([a()],d.prototype,"_showRichText",2),p([a()],d.prototype,"_richText",2),d=p([n("qxs-blank-fill")],d);export{d as QxsBlankFill};
204
+ `,p([s({type:Number,attribute:"order-index"})],h.prototype,"orderIndex",2),p([s({type:String})],h.prototype,"title",2),p([s({type:String,attribute:"custom-id"})],h.prototype,"customId",2),p([s({type:Boolean,attribute:"is-edit"})],h.prototype,"isEdit",2),p([s({type:Boolean,attribute:"is-save"})],h.prototype,"isSave",2),p([s({type:Boolean,attribute:"is-set"})],h.prototype,"isSet",2),p([s({type:Boolean,attribute:"is-key"})],h.prototype,"isKey",2),p([s({type:Boolean,attribute:"show-action"})],h.prototype,"showAction",2),p([s({type:Boolean,attribute:"show-analysis"})],h.prototype,"showAnalysis",2),p([s({type:String,attribute:"rich-text-content"})],h.prototype,"richTextContent",2),p([s({type:String})],h.prototype,"analysis",2),p([s({type:Number,attribute:"exam-answer-relation-type"})],h.prototype,"examAnswerRelationType",2),p([s({type:String,attribute:"exam-expand"})],h.prototype,"examExpand",2),p([s({type:Object,attribute:"exam-answer-setting"})],h.prototype,"examAnswerSetting",2),p([s({type:Object})],h.prototype,"uploadImage",2),p([s({type:Array,attribute:"answer-list"})],h.prototype,"answerList",2),p([s({type:String,attribute:"model-value"})],h.prototype,"modelValue",2),p([s({type:Boolean,attribute:"use-model"})],h.prototype,"useModel",2),p([a()],h.prototype,"_title",2),p([a()],h.prototype,"_analysis",2),p([a()],h.prototype,"_answers",2),p([a()],h.prototype,"_isInOrder",2),p([a()],h.prototype,"_isIgnoreCase",2),p([a()],h.prototype,"_showRichText",2),p([a()],h.prototype,"_richText",2),h=p([l("qxs-blank-fill")],h);export{h as QxsBlankFill};
205
205
  //# sourceMappingURL=blank-fill.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"blank-fill.mjs","sources":["../../../../packages/components-wc/src/subject/blank-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\n\ninterface BlankAnswer { title: string, tag: string, showInput: boolean }\n\nconst iconPlus = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n </svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-blank-fill')\nexport class QxsBlankFill extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview .content { color: #a8abb2; margin-top: 10px; }\n\n .flex { display: flex; }\n .flex-wrap { flex-wrap: wrap; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 70px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n /* Tag style */\n .el-tag {\n display: inline-flex; align-items: center; height: 24px; padding: 0 9px;\n font-size: 12px; line-height: 1; color: #3D61E3; background: #ecf5ff;\n border: 1px solid #d9ecff; border-radius: 4px; white-space: nowrap;\n }\n .el-tag .el-tag__close {\n display: inline-flex; align-items: center; justify-content: center;\n margin-left: 4px; width: 16px; height: 16px; border-radius: 50%;\n font-size: 12px; color: #909399; cursor: pointer; transition: all .2s;\n }\n .el-tag .el-tag__close:hover { background: #909399; color: #fff; }\n\n /* Button small style */\n .el-button--small {\n display: inline-flex; align-items: center; gap: 4px;\n height: 24px; padding: 0 10px; font-size: 12px; line-height: 1;\n border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266;\n cursor: pointer; transition: all .2s; white-space: nowrap;\n }\n .el-button--small:hover { color: #3D61E3; border-color: #c6e2ff; background-color: #ecf5ff; }\n\n /* Link style */\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; text-decoration: none; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.is-disabled { color: #c0c4cc; cursor: not-allowed; }\n\n /* Input small for tag */\n .el-input--small { width: 80px; }\n .el-input--small input {\n height: 24px; padding: 0 8px; font-size: 12px; line-height: 24px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n }\n .el-input--small input:focus { border-color: #3D61E3; outline: none; }\n\n /* Checkbox style */\n .el-checkbox {\n display: inline-flex; align-items: center; gap: 6px; cursor: pointer;\n font-size: 13px; color: #606266; user-select: none; margin-right: 16px;\n }\n .el-checkbox input[type=\"checkbox\"] {\n width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3;\n }\n\n .answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }\n .answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }\n .answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean } = { isInOrder: false, isIgnoreCase: true }\n @property({ type: Object })\n uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _answers: BlankAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _isInOrder = false\n @state() private _isIgnoreCase = true\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 400\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n }\n\n private _syncProps() {\n this._title = (this.title || '').replaceAll(/<filter><\\/filter>/g, ' ______')\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n else {\n const blankCount = (this._title.match(/ ______/g) || []).length || 1\n this._answers = Array.from({ length: blankCount }, () => ({ title: '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n }\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\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 _addBlank() {\n this._title += ' ______'\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n this.requestUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n const blankCount = (this._title.match(/ ______/g) || []).length\n if (blankCount !== this._answers.length) {\n if (blankCount > this._answers.length) {\n for (let i = this._answers.length; i < blankCount; i++) {\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n }\n else {\n this._answers = this._answers.slice(0, blankCount)\n }\n }\n }\n\n private _handleAddTag(item: BlankAnswer) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n this.requestUpdate()\n }\n\n private _closeTag(tag: string, item: BlankAnswer) {\n if (tag) {\n const tags = item.title.split(',')\n const idx = tags.findIndex((t: string) => t === tag)\n if (idx > -1) { tags.splice(idx, 1); item.title = tags.join(',') }\n this.requestUpdate()\n }\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? false\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\n const showRichText = this.isEdit ? this._showRichText : !!this.richTextContent\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (answers.length < 1) {\n reject(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n return\n }\n const result: any = {\n answerType: 'blank_fill',\n title: title.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.map((a: any) => ({ title: a.title, isCorrect: true })),\n analysis,\n isSetCorrectAnswer: true,\n isKey: this.isKey,\n examAnswerSettingBO: { isIgnoreCase, isInOrder },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (answers.length < 1) {\n errors.push(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n }\n\n return errors\n }\n\n private _renderPreview() {\n const displayTitle = this.title.replaceAll(/<filter><\\/filter>/g, ' ______')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${displayTitle}(填空题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div class=\"content flex flex-wrap\">\n <span>正确答案:</span>\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">填空${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"3\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【填空题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex flex-justify-end\">\n <span class=\"el-link ${this.isSave ? 'is-disabled' : ''}\"\n @click=${() => {\n if (!this.isSave) { this._addBlank() }\n }}>插入填空符</span>\n </div>\n\n <div class=\"flex flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\" style=\"margin-top:12px\">\n <div class=\"label\"><span>第${i + 1}空答案:</span></div>\n <div class=\"answer-tags\">\n ${a.title.split(',').filter(Boolean).map(tag => html`\n <span class=\"el-tag\">\n ${tag}\n ${!this.isSave ? html`<span class=\"el-tag__close\" @click=${() => this._closeTag(tag, a)}>×</span>` : ''}\n </span>\n `)}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" class=\"el-input--small\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._handleAddTag(a) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._handleAddTag(a)} />\n `\n : html`\n <span class=\"el-button--small\" @click=${() => { a.showInput = true; this.requestUpdate(); this.updateComplete.then(() => { (this.shadowRoot?.querySelector('.el-input--small') as HTMLInputElement)?.focus() }) }}>\n ${iconPlus}\n <span>${a.title ? '添加同义词' : '添加答案'}</span>\n </span>\n `}\n `\n : ''}\n </div>\n </div>\n `)}\n\n ${this._showRichText\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex flex-justify-end\" style=\"margin-top:8px\">\n <span class=\"el-link\" style=\"color:#f56c6c\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span>\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","QxsBlankFill","LitElement","constructor","super","arguments","this","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","_title","_analysis","_answers","tag","showInput","_isInOrder","_isIgnoreCase","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","replaceAll","length","map","a","blankCount","match","Array","from","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_addBlank","requestUpdate","_onTitleInput","el","value","slice","i","_handleAddTag","item","join","_closeTag","tags","split","idx","findIndex","t","splice","toJSON","row","answerType","answers","showRichText","richText","SubjectError","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","_renderPreview","displayTitle","some","_renderEdit","checked","filter","Boolean","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","String","state","safeCustomElement"],"mappings":"imBA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,EA6GMoJ,UAAA,YAAA,GACAL,EAAA,CAAhBO,KA9GUtJ,EA8GMoJ,UAAA,WAAA,GACAL,EAAA,CAAhBO,KA/GUtJ,EA+GMoJ,UAAA,aAAA,GACAL,EAAA,CAAhBO,KAhHUtJ,EAgHMoJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,KAjHUtJ,EAiHMoJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,KAlHUtJ,EAkHMoJ,UAAA,YAAA,GAlHNpJ,EAAN+I,EAAA,CADNQ,EAAkB,mBACNvJ"}
1
+ {"version":3,"file":"blank-fill.mjs","sources":["../../../../packages/components-wc/src/subject/blank-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\n\ninterface BlankAnswer { title: string, tag: string, showInput: boolean }\n\nconst iconPlus = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n </svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-blank-fill')\nexport class QxsBlankFill extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview .content { color: #a8abb2; margin-top: 10px; }\n\n .flex { display: flex; }\n .flex-wrap { flex-wrap: wrap; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 70px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n /* Tag style */\n .el-tag {\n display: inline-flex; align-items: center; height: 24px; padding: 0 9px;\n font-size: 12px; line-height: 1; color: #3D61E3; background: #ecf5ff;\n border: 1px solid #d9ecff; border-radius: 4px; white-space: nowrap;\n }\n .el-tag .el-tag__close {\n display: inline-flex; align-items: center; justify-content: center;\n margin-left: 4px; width: 16px; height: 16px; border-radius: 50%;\n font-size: 12px; color: #909399; cursor: pointer; transition: all .2s;\n }\n .el-tag .el-tag__close:hover { background: #909399; color: #fff; }\n\n /* Button small style */\n .el-button--small {\n display: inline-flex; align-items: center; gap: 4px;\n height: 24px; padding: 0 10px; font-size: 12px; line-height: 1;\n border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266;\n cursor: pointer; transition: all .2s; white-space: nowrap;\n }\n .el-button--small:hover { color: #3D61E3; border-color: #c6e2ff; background-color: #ecf5ff; }\n\n /* Link style */\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; text-decoration: none; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.is-disabled { color: #c0c4cc; cursor: not-allowed; }\n\n /* Input small for tag */\n .el-input--small { width: 80px; }\n .el-input--small input {\n height: 24px; padding: 0 8px; font-size: 12px; line-height: 24px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n }\n .el-input--small input:focus { border-color: #3D61E3; outline: none; }\n\n /* Checkbox style */\n .el-checkbox {\n display: inline-flex; align-items: center; gap: 6px; cursor: pointer;\n font-size: 13px; color: #606266; user-select: none; margin-right: 16px;\n }\n .el-checkbox input[type=\"checkbox\"] {\n width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3;\n }\n\n .answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }\n .answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }\n .answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean } = { isInOrder: false, isIgnoreCase: true }\n @property({ type: Object })\n uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _answers: BlankAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _isInOrder = false\n @state() private _isIgnoreCase = true\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 400\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue.replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n }\n\n private _syncProps() {\n this._title = (this.title || '').replaceAll(/<filter><\\/filter>/g, ' ______')\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n else {\n const blankCount = (this._title.match(/ ______/g) || []).length || 1\n this._answers = Array.from({ length: blankCount }, () => ({ title: '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n }\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\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 _addBlank() {\n this._title += ' ______'\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n this.requestUpdate()\n this._emitModelUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n const blankCount = (this._title.match(/ ______/g) || []).length\n if (blankCount !== this._answers.length) {\n if (blankCount > this._answers.length) {\n for (let i = this._answers.length; i < blankCount; i++) {\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n }\n else {\n this._answers = this._answers.slice(0, blankCount)\n }\n }\n this._emitModelUpdate()\n }\n\n // 双向绑定:通知外部更新\n private _emitModelUpdate() {\n if (this.useModel) {\n const modelValue = this._title.replaceAll(/ ______/g, '<filter></filter>')\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: modelValue,\n }))\n }\n }\n\n private _handleAddTag(item: BlankAnswer) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n this.requestUpdate()\n }\n\n private _closeTag(tag: string, item: BlankAnswer) {\n if (tag) {\n const tags = item.title.split(',')\n const idx = tags.findIndex((t: string) => t === tag)\n if (idx > -1) { tags.splice(idx, 1); item.title = tags.join(',') }\n this.requestUpdate()\n }\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? false\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\n const showRichText = this.isEdit ? this._showRichText : !!this.richTextContent\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (answers.length < 1) {\n reject(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n return\n }\n const result: any = {\n answerType: 'blank_fill',\n title: title.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.map((a: any) => ({ title: a.title, isCorrect: true })),\n analysis,\n isSetCorrectAnswer: true,\n isKey: this.isKey,\n examAnswerSettingBO: { isIgnoreCase, isInOrder },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (answers.length < 1) {\n errors.push(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n }\n\n return errors\n }\n\n private _renderPreview() {\n const displayTitle = this.title.replaceAll(/<filter><\\/filter>/g, ' ______')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${displayTitle}(填空题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div class=\"content flex flex-wrap\">\n <span>正确答案:</span>\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">填空${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"3\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【填空题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex flex-justify-end\">\n <span class=\"el-link ${this.isSave ? 'is-disabled' : ''}\"\n @click=${() => {\n if (!this.isSave) { this._addBlank() }\n }}>插入填空符</span>\n </div>\n\n <div class=\"flex flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\" style=\"margin-top:12px\">\n <div class=\"label\"><span>第${i + 1}空答案:</span></div>\n <div class=\"answer-tags\">\n ${a.title.split(',').filter(Boolean).map(tag => html`\n <span class=\"el-tag\">\n ${tag}\n ${!this.isSave ? html`<span class=\"el-tag__close\" @click=${() => this._closeTag(tag, a)}>×</span>` : ''}\n </span>\n `)}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" class=\"el-input--small\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._handleAddTag(a) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._handleAddTag(a)} />\n `\n : html`\n <span class=\"el-button--small\" @click=${() => { a.showInput = true; this.requestUpdate(); this.updateComplete.then(() => { (this.shadowRoot?.querySelector('.el-input--small') as HTMLInputElement)?.focus() }) }}>\n ${iconPlus}\n <span>${a.title ? '添加同义词' : '添加答案'}</span>\n </span>\n `}\n `\n : ''}\n </div>\n </div>\n `)}\n\n ${this._showRichText\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex flex-justify-end\" style=\"margin-top:8px\">\n <span class=\"el-link\" style=\"color:#f56c6c\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span>\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","QxsBlankFill","LitElement","constructor","super","arguments","this","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","modelValue","useModel","_title","_analysis","_answers","tag","showInput","_isInOrder","_isIgnoreCase","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","replaceAll","length","map","a","blankCount","match","Array","from","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_addBlank","requestUpdate","_emitModelUpdate","_onTitleInput","el","value","slice","i","_handleAddTag","item","join","_closeTag","tags","split","idx","findIndex","t","splice","toJSON","row","answerType","answers","showRichText","richText","SubjectError","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","_renderPreview","displayTitle","some","_renderEdit","checked","filter","Boolean","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","String","state","safeCustomElement"],"mappings":"imBAOA,MAAMA,EAAWC,CAAA;;;;UAoBV,IAAMC,EAAN,cAA2BC,EAA3BC,WAAAA,GAAAC,SAAAC,WAiFiDC,KAAAC,WAAa,EACvCD,KAAAE,MAAQ,GACgBF,KAAAG,SAAW,GACZH,KAAAI,QAAS,EACTJ,KAAAK,QAAS,EACVL,KAAAM,OAAQ,EACRN,KAAAO,OAAQ,EACHP,KAAAQ,YAAa,EACXR,KAAAS,cAAe,EACZT,KAAAU,gBAAkB,GAClDV,KAAAW,SAAW,GAC6BX,KAAAY,uBAAyB,EACvCZ,KAAAa,WAAa,GAEnEb,KAAAc,kBAAmE,CAAEC,WAAW,EAAOC,cAAc,GAErGhB,KAAAiB,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAAUC,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L,EAAA,CAAhBO,KAjHUzJ,EAiHMuJ,UAAA,YAAA,GACAL,EAAA,CAAhBO,KAlHUzJ,EAkHMuJ,UAAA,WAAA,GACAL,EAAA,CAAhBO,KAnHUzJ,EAmHMuJ,UAAA,aAAA,GACAL,EAAA,CAAhBO,KApHUzJ,EAoHMuJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,KArHUzJ,EAqHMuJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,KAtHUzJ,EAsHMuJ,UAAA,YAAA,GAtHNvJ,EAANkJ,EAAA,CADNQ,EAAkB,mBACN1J"}
@@ -1,4 +1,4 @@
1
- import{css as t,LitElement as e,html as o}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{safeCustomElement as r}from"../base/define.mjs";var i=Object.defineProperty,l=Object.getOwnPropertyDescriptor,a=(t,e,o,s)=>{for(var r,a=s>1?void 0:s?l(e,o):e,d=t.length-1;d>=0;d--)(r=t[d])&&(a=(s?r(e,o,a):r(a))||a);return s&&a&&i(e,o,a),a};let d=class extends e{constructor(){super(...arguments),this.showEdit=!1}render(){return this.showEdit?o`
1
+ import{css as e,LitElement as t,html as o}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{safeCustomElement as r}from"../base/define.mjs";var i=Object.defineProperty,d=Object.getOwnPropertyDescriptor,a=(e,t,o,s)=>{for(var r,a=s>1?void 0:s?d(t,o):t,p=e.length-1;p>=0;p--)(r=e[p])&&(a=(s?r(t,o,a):r(a))||a);return s&&a&&i(t,o,a),a};let p=class extends t{constructor(){super(...arguments),this.showEdit=!1}render(){return this.showEdit?o`
2
2
  <div class="layout">
3
3
  <div class="edit">
4
4
  <slot name="edit"></slot>
@@ -7,12 +7,15 @@ import{css as t,LitElement as e,html as o}from"lit";import{property as s}from"..
7
7
  </div>
8
8
  `:o`
9
9
  <div class="layout">
10
- <slot name="preview"></slot>
11
- <slot></slot>
10
+ <div class="preview">
11
+ <slot name="preview"></slot>
12
+ <slot></slot>
13
+ </div>
12
14
  </div>
13
- `}};d.styles=t`
15
+ `}};p.styles=e`
14
16
  :host { display: block; width: 100%; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
15
- .layout { padding: 10px; }
16
- .edit { position: relative; padding: 12px 10px 10px; background-color: #f6f7fb; border-radius: 8px; }
17
- `,a([s({type:Boolean,attribute:"show-edit"})],d.prototype,"showEdit",2),d=a([r("qxs-subject-layout")],d);export{d as QxsSubjectLayout};
17
+ .layout { padding: 10px; background-color: #f6f7fb; border-radius: 8px; }
18
+ .preview { padding: 12px 10px 10px; }
19
+ .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
20
+ `,a([s({type:Boolean,attribute:"show-edit"})],p.prototype,"showEdit",2),p=a([r("qxs-subject-layout")],p);export{p as QxsSubjectLayout};
18
21
  //# sourceMappingURL=layout.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.mjs","sources":["../../../../packages/components-wc/src/subject/layout.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-subject-layout')\nexport class QxsSubjectLayout extends LitElement {\n static styles = css`\n :host { display: block; width: 100%; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n .layout { padding: 10px; }\n .edit { position: relative; padding: 12px 10px 10px; background-color: #f6f7fb; border-radius: 8px; }\n `\n\n @property({ type: Boolean, attribute: 'show-edit' }) showEdit = false\n\n render() {\n if (this.showEdit) {\n return html`\n <div class=\"layout\">\n <div class=\"edit\">\n <slot name=\"edit\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n return html`\n <div class=\"layout\">\n <slot name=\"preview\"></slot>\n <slot></slot>\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["QxsSubjectLayout","LitElement","constructor","super","arguments","this","showEdit","render","html","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","safeCustomElement"],"mappings":"mbAKO,IAAMA,EAAN,cAA+BC,EAA/BC,WAAAA,GAAAC,SAAAC,WAOgDC,KAAAC,UAAW,CAAA,CAEhEC,MAAAA,GACE,OAAIF,KAAKC,SACAE,CAAA;;;;;;;QASFA,CAAA;;;;;KAMT,GA1BWR,EACJS,OAASC,CAAA;;;;IAMqCC,EAAA,CAApDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,eAP3Bf,EAO0CgB,UAAA,WAAA,GAP1ChB,EAANW,EAAA,CADNM,EAAkB,uBACNjB"}
1
+ {"version":3,"file":"layout.mjs","sources":["../../../../packages/components-wc/src/subject/layout.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-subject-layout')\nexport class QxsSubjectLayout extends LitElement {\n static styles = css`\n :host { display: block; width: 100%; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n .layout { padding: 10px; background-color: #f6f7fb; border-radius: 8px; }\n .preview { padding: 12px 10px 10px; }\n .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }\n `\n\n @property({ type: Boolean, attribute: 'show-edit' }) showEdit = false\n\n render() {\n if (this.showEdit) {\n return html`\n <div class=\"layout\">\n <div class=\"edit\">\n <slot name=\"edit\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n return html`\n <div class=\"layout\">\n <div class=\"preview\">\n <slot name=\"preview\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["QxsSubjectLayout","LitElement","constructor","super","arguments","this","showEdit","render","html","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","safeCustomElement"],"mappings":"mbAKO,IAAMA,EAAN,cAA+BC,EAA/BC,WAAAA,GAAAC,SAAAC,WAQgDC,KAAAC,UAAW,CAAA,CAEhEC,MAAAA,GACE,OAAIF,KAAKC,SACAE,CAAA;;;;;;;QASFA,CAAA;;;;;;;KAQT,GA7BWR,EACJS,OAASC,CAAA;;;;;IAOqCC,EAAA,CAApDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,eAR3Bf,EAQ0CgB,UAAA,WAAA,GAR1ChB,EAANW,EAAA,CADNM,EAAkB,uBACNjB"}
@@ -1,5 +1,5 @@
1
- import{css as t,LitElement as e,html as i}from"lit";import{property as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as n}from"../base/define.mjs";import{SubjectError as r}from"./single.mjs";import"../editor/blocksuite-editor.mjs";var a=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(t,e,i,o)=>{for(var s,n=o>1?void 0:o?d(e,i):e,r=t.length-1;r>=0;r--)(s=t[r])&&(n=(o?s(e,i,n):s(n))||n);return o&&n&&a(e,i,n),n};let p=class extends e{constructor(){super(...arguments),this.orderIndex=0,this.customId="",this.isEdit=!1,this.isSave=!1,this.showAction=!0,this.isSet=!1,this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const o=new FileReader;o.onload=t=>e(t.target?.result),o.onerror=i,o.readAsDataURL(t)}),this._content="",this._initialized=!1,this._editor=null}createRenderRoot(){return this}willUpdate(t){t.has("richTextContent")&&!this._initialized&&(this._content=this.richTextContent,this._initialized=!0)}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"rich_text",orderIndex:this.orderIndex},o=this.isEdit?this.querySelector("qxs-blocksuite-editor")?.getContent?.()||this._content:this.richTextContent||this._content;if(!o||"<p></p>"===o)return void e(new r("富文本内容不能为空!","EMPTY_CONTENT","richTextContent",i));const s={answerType:"rich_text",richTextContent:o};this.customId&&(s.customId=this.customId),t(s)})}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}disconnectedCallback(){super.disconnectedCallback(),this._editor=null}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._content=t.richTextContent,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:"rich_text",orderIndex:this.orderIndex},i=this.isEdit?this.querySelector("qxs-blocksuite-editor")?.getContent?.()||this._content:this.richTextContent||this._content;return i&&"<p></p>"!==i||t.push(new r("富文本内容不能为空!","EMPTY_CONTENT","richTextContent",e)),t}render(){const t=this._content||this.richTextContent;return i`
2
- ${this.isEdit?i`<qxs-blocksuite-editor .content=${t} .uploadImage=${this.uploadImage} is-edit></qxs-blocksuite-editor>`:i`<qxs-blocksuite-editor .content=${t} .uploadImage=${this.uploadImage} readonly preview></qxs-blocksuite-editor>`}
1
+ import{css as t,LitElement as e,html as i}from"lit";import{property as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as n}from"../base/define.mjs";import{SubjectError as r}from"./single.mjs";import"../editor/blocksuite-editor.mjs";var a=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(t,e,i,o)=>{for(var s,n=o>1?void 0:o?d(e,i):e,r=t.length-1;r>=0;r--)(s=t[r])&&(n=(o?s(e,i,n):s(n))||n);return o&&n&&a(e,i,n),n};let p=class extends e{constructor(){super(...arguments),this.orderIndex=0,this.customId="",this.isEdit=!1,this.isSave=!1,this.showAction=!0,this.isSet=!1,this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const o=new FileReader;o.onload=t=>e(t.target?.result),o.onerror=i,o.readAsDataURL(t)}),this._content="",this._initialized=!1,this._editor=null,this.modelValue="",this.useModel=!1}createRenderRoot(){return this}willUpdate(t){t.has("richTextContent")&&!this._initialized&&(this._content=this.richTextContent,this._initialized=!0),t.has("modelValue")&&this.useModel&&(this._content=this.modelValue)}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"rich_text",orderIndex:this.orderIndex},o=this.isEdit?this.querySelector("qxs-blocksuite-editor")?.getContent?.()||this._content:this.richTextContent||this._content;if(!o||"<p></p>"===o)return void e(new r("富文本内容不能为空!","EMPTY_CONTENT","richTextContent",i));const s={answerType:"rich_text",richTextContent:o};this.customId&&(s.customId=this.customId),t(s)})}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}disconnectedCallback(){super.disconnectedCallback(),this._editor=null}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._content=t.richTextContent,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:"rich_text",orderIndex:this.orderIndex},i=this.isEdit?this.querySelector("qxs-blocksuite-editor")?.getContent?.()||this._content:this.richTextContent||this._content;return i&&"<p></p>"!==i||t.push(new r("富文本内容不能为空!","EMPTY_CONTENT","richTextContent",e)),t}_handleEditorInput(t){this._content=t.detail,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._content}))}render(){const t=this._content||this.richTextContent;return i`
2
+ ${this.isEdit?i`<qxs-blocksuite-editor .content=${t} .uploadImage=${this.uploadImage} is-edit @input=${this._handleEditorInput}></qxs-blocksuite-editor>`:i`<qxs-blocksuite-editor .content=${t} .uploadImage=${this.uploadImage} readonly preview></qxs-blocksuite-editor>`}
3
3
  ${this.showAction?i`
4
4
  <qxs-subject-action
5
5
  ?is-edit=${this.isEdit}
@@ -23,5 +23,5 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as o}from"..
23
23
  qxs-blocksuite-editor {
24
24
  display: block;
25
25
  }
26
- `,c([o({type:Number,attribute:"order-index"})],p.prototype,"orderIndex",2),c([o({type:String,attribute:"custom-id"})],p.prototype,"customId",2),c([o({type:Boolean,attribute:"is-edit"})],p.prototype,"isEdit",2),c([o({type:Boolean,attribute:"is-save"})],p.prototype,"isSave",2),c([o({type:Boolean,attribute:"show-action"})],p.prototype,"showAction",2),c([o({type:Boolean,attribute:"is-set"})],p.prototype,"isSet",2),c([o({type:String,attribute:"rich-text-content"})],p.prototype,"richTextContent",2),c([o({type:Number,attribute:"exam-answer-relation-type"})],p.prototype,"examAnswerRelationType",2),c([o({type:Object,attribute:"upload-image"})],p.prototype,"uploadImage",2),c([s()],p.prototype,"_content",2),p=c([n("qxs-subject-rich-text")],p);export{p as SubjectRichText};
26
+ `,c([o({type:Number,attribute:"order-index"})],p.prototype,"orderIndex",2),c([o({type:String,attribute:"custom-id"})],p.prototype,"customId",2),c([o({type:Boolean,attribute:"is-edit"})],p.prototype,"isEdit",2),c([o({type:Boolean,attribute:"is-save"})],p.prototype,"isSave",2),c([o({type:Boolean,attribute:"show-action"})],p.prototype,"showAction",2),c([o({type:Boolean,attribute:"is-set"})],p.prototype,"isSet",2),c([o({type:String,attribute:"rich-text-content"})],p.prototype,"richTextContent",2),c([o({type:Number,attribute:"exam-answer-relation-type"})],p.prototype,"examAnswerRelationType",2),c([o({type:Object,attribute:"upload-image"})],p.prototype,"uploadImage",2),c([s()],p.prototype,"_content",2),c([o({type:String,attribute:"model-value"})],p.prototype,"modelValue",2),c([o({type:Boolean,attribute:"use-model"})],p.prototype,"useModel",2),p=c([n("qxs-subject-rich-text")],p);export{p as SubjectRichText};
27
27
  //# sourceMappingURL=rich-text.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"rich-text.mjs","sources":["../../../../packages/components-wc/src/subject/rich-text.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\nimport '../editor/blocksuite-editor'\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-subject-rich-text')\nexport class SubjectRichText extends LitElement {\n createRenderRoot() { return this }\n\n static styles = css`\n :host {\n display: block;\n font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif;\n font-size: 12px;\n color: #5a5a5a;\n }\n qxs-blocksuite-editor {\n display: block;\n }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: Object, attribute: 'upload-image' }) uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @state() private _content = ''\n private _initialized = false\n\n private _editor: HTMLElement | null = null\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('richTextContent') && !this._initialized) {\n this._content = this.richTextContent\n this._initialized = true\n }\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'rich_text', orderIndex: this.orderIndex }\n\n const content = this.isEdit\n ? (this.querySelector('qxs-blocksuite-editor') as any)?.getContent?.() || this._content\n : this.richTextContent || this._content\n\n if (!content || content === '<p></p>') {\n reject(new SubjectError('富文本内容不能为空!', 'EMPTY_CONTENT', 'richTextContent', row))\n return\n }\n const result: any = { answerType: 'rich_text', richTextContent: content }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._editor = null\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._content = data.richTextContent\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'rich_text', orderIndex: this.orderIndex }\n\n const content = this.isEdit\n ? (this.querySelector('qxs-blocksuite-editor') as any)?.getContent?.() || this._content\n : this.richTextContent || this._content\n\n if (!content || content === '<p></p>') {\n errors.push(new SubjectError('富文本内容不能为空!', 'EMPTY_CONTENT', 'richTextContent', row))\n }\n\n return errors\n }\n\n render() {\n const content = this._content || this.richTextContent\n return html`\n ${this.isEdit\n ? html`<qxs-blocksuite-editor .content=${content} .uploadImage=${this.uploadImage} is-edit></qxs-blocksuite-editor>`\n : html`<qxs-blocksuite-editor .content=${content} .uploadImage=${this.uploadImage} readonly preview></qxs-blocksuite-editor>`\n }\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n ?hide-add-rich-text=${true}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n ></qxs-subject-action>\n `\n : ''}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectRichText","LitElement","constructor","super","arguments","this","orderIndex","customId","isEdit","isSave","showAction","isSet","richTextContent","examAnswerRelationType","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_content","_initialized","_editor","createRenderRoot","willUpdate","changed","has","toJSON","row","answerType","content","querySelector","getContent","SubjectError","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","disconnectedCallback","_save","stopImmediatePropagation","data","err","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","render","html","styles","css","__decorateClass","property","type","Number","attribute","prototype","String","Boolean","state","safeCustomElement"],"mappings":"yoBAoBO,IAAMA,EAAN,cAA8BC,EAA9BC,WAAAA,GAAAC,SAAAC,WAeiDC,KAAAC,WAAa,EACfD,KAAAE,SAAW,GACZF,KAAAG,QAAS,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,MAAM,MAAOpB,EAAEsB;;QAG/C;KAER,GAzHW5C,EAGJsF,OAASC,CAAA;;;;;;;;;;IAYsCC,EAAA,CAArDC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,iBAf1B5F,EAe2C6F,UAAA,aAAA,GACFL,EAAA,CAAnDC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,eAhB1B5F,EAgByC6F,UAAA,WAAA,GACDL,EAAA,CAAlDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,aAjB3B5F,EAiBwC6F,UAAA,SAAA,GACAL,EAAA,CAAlDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,aAlB3B5F,EAkBwC6F,UAAA,SAAA,GACIL,EAAA,CAAtDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,iBAnB3B5F,EAmB4C6F,UAAA,aAAA,GACLL,EAAA,CAAjDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,YApB3B5F,EAoBuC6F,UAAA,QAAA,GACUL,EAAA,CAA3DC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,uBArB1B5F,EAqBiD6F,UAAA,kBAAA,GACQL,EAAA,CAAnEC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,+BAtB1B5F,EAsByD6F,UAAA,yBAAA,GACbL,EAAA,CAAtDC,EAAS,CAAEC,KAAM/B,OAAQiC,UAAW,kBAvB1B5F,EAuB4C6F,UAAA,cAAA,GAStCL,EAAA,CAAhBQ,KAhCUhG,EAgCM6F,UAAA,WAAA,GAhCN7F,EAANwF,EAAA,CADNS,EAAkB,0BACNjG"}
1
+ {"version":3,"file":"rich-text.mjs","sources":["../../../../packages/components-wc/src/subject/rich-text.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\nimport '../editor/blocksuite-editor'\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-subject-rich-text')\nexport class SubjectRichText extends LitElement {\n createRenderRoot() { return this }\n\n static styles = css`\n :host {\n display: block;\n font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif;\n font-size: 12px;\n color: #5a5a5a;\n }\n qxs-blocksuite-editor {\n display: block;\n }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: Object, attribute: 'upload-image' }) uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @state() private _content = ''\n private _initialized = false\n\n private _editor: HTMLElement | null = null\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('richTextContent') && !this._initialized) {\n this._content = this.richTextContent\n this._initialized = true\n }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._content = this.modelValue\n }\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'rich_text', orderIndex: this.orderIndex }\n\n const content = this.isEdit\n ? (this.querySelector('qxs-blocksuite-editor') as any)?.getContent?.() || this._content\n : this.richTextContent || this._content\n\n if (!content || content === '<p></p>') {\n reject(new SubjectError('富文本内容不能为空!', 'EMPTY_CONTENT', 'richTextContent', row))\n return\n }\n const result: any = { answerType: 'rich_text', richTextContent: content }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._editor = null\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._content = data.richTextContent\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'rich_text', orderIndex: this.orderIndex }\n\n const content = this.isEdit\n ? (this.querySelector('qxs-blocksuite-editor') as any)?.getContent?.() || this._content\n : this.richTextContent || this._content\n\n if (!content || content === '<p></p>') {\n errors.push(new SubjectError('富文本内容不能为空!', 'EMPTY_CONTENT', 'richTextContent', row))\n }\n\n return errors\n }\n\n private _handleEditorInput(e: CustomEvent) {\n this._content = e.detail\n // 双向绑定:通知外部更新\n if (this.useModel) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._content,\n }))\n }\n }\n\n render() {\n const content = this._content || this.richTextContent\n return html`\n ${this.isEdit\n ? html`<qxs-blocksuite-editor .content=${content} .uploadImage=${this.uploadImage} is-edit @input=${this._handleEditorInput}></qxs-blocksuite-editor>`\n : html`<qxs-blocksuite-editor .content=${content} .uploadImage=${this.uploadImage} readonly preview></qxs-blocksuite-editor>`\n }\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n ?hide-add-rich-text=${true}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n ></qxs-subject-action>\n `\n : ''}\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectRichText","LitElement","constructor","super","arguments","this","orderIndex","customId","isEdit","isSave","showAction","isSet","richTextContent","examAnswerRelationType","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_content","_initialized","_editor","modelValue","useModel","createRenderRoot","willUpdate","changed","has","toJSON","row","answerType","content","querySelector","getContent","SubjectError","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","disconnectedCallback","_save","stopImmediatePropagation","data","err","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","_handleEditorInput","render","html","styles","css","__decorateClass","property","type","Number","attribute","prototype","String","Boolean","state","safeCustomElement"],"mappings":"yoBAoBO,IAAMA,EAAN,cAA8BC,EAA9BC,WAAAA,GAAAC,SAAAC,WAeiDC,KAAAC,WAAa,EACfD,KAAAE,SAAW,GACZF,KAAAG,QAAS,EACTH,KAAAI,QAAS,EACLJ,KAAAK,YAAa,EAClBL,KAAAM,OAAQ,EACEN,KAAAO,gBAAkB,GACVP,KAAAQ,uBAAyB,EACtCR,KAAAS,YAA+CC,SAC7F,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAAUC,GAAML,EAAQK,EAAEC,QAAQC,QACzCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAIhBtB,KAAQuB,SAAW,GAC5BvB,KAAQwB,cAAe,EAEvBxB,KAAQyB,QAA8B,KA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yF,OAASC,CAAA;;;;;;;;;;IAYsCC,EAAA,CAArDC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,iBAf1B/F,EAe2CgG,UAAA,aAAA,GACFL,EAAA,CAAnDC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,eAhB1B/F,EAgByCgG,UAAA,WAAA,GACDL,EAAA,CAAlDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,aAjB3B/F,EAiBwCgG,UAAA,SAAA,GACAL,EAAA,CAAlDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,aAlB3B/F,EAkBwCgG,UAAA,SAAA,GACIL,EAAA,CAAtDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,iBAnB3B/F,EAmB4CgG,UAAA,aAAA,GACLL,EAAA,CAAjDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,YApB3B/F,EAoBuCgG,UAAA,QAAA,GACUL,EAAA,CAA3DC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,uBArB1B/F,EAqBiDgG,UAAA,kBAAA,GACQL,EAAA,CAAnEC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,+BAtB1B/F,EAsByDgG,UAAA,yBAAA,GACbL,EAAA,CAAtDC,EAAS,CAAEC,KAAMhC,OAAQkC,UAAW,kBAvB1B/F,EAuB4CgG,UAAA,cAAA,GAStCL,EAAA,CAAhBQ,KAhCUnG,EAgCMgG,UAAA,WAAA,GAMqCL,EAAA,CAArDC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,iBAtC1B/F,EAsC2CgG,UAAA,aAAA,GACDL,EAAA,CAApDC,EAAS,CAAEC,KAAMK,QAASH,UAAW,eAvC3B/F,EAuC0CgG,UAAA,WAAA,GAvC1ChG,EAAN2F,EAAA,CADNS,EAAkB,0BACNpG"}
@@ -1,4 +1,4 @@
1
- import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as r}from"../base/define.mjs";import{SubjectError as a}from"./single.mjs";var n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?l(e,i):e,a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&n(e,i,r),r};const p=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,h=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;let c=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAnalysis=!0,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answerList")}get scaleQuestions(){return this._scaleQuestions}set scaleQuestions(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scaleQuestions")}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",o=this.isEdit?this._answers:this.answerList||[],r=this.isEdit?this._analysis:this.analysis||"",n=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"",l=this.isEdit?this._showRichText:!!this.richTextContent,d=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void e(new a("题目标题不能为空!","EMPTY_TITLE","title",i));for(let t=0;t<o.length;t++)if(!o[t].title)return void e(new a(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",i));if(!n)return void e(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const p=n.split("\n").filter(t=>t.trim());if(0===p.length)return void e(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const h={answerType:"scale",title:s,analysis:r,answers:o,scaleQuestionList:p,examRichTextContent:l?d:"",examAnswerRelationType:this.examAnswerRelationType};this.customId&&(h.customId=this.customId),t(h)})}_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}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},i=this.isEdit?this._title:this.title||"",s=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"";if(i||t.push(new a("题目标题不能为空!","EMPTY_TITLE","title",e)),s.forEach((i,s)=>{i.title||t.push(new a(`选项${String.fromCharCode(65+s)}未填写`,"ANSWER_EMPTY","answers",e))}),o){0===o.split("\n").filter(t=>t.trim()).length&&t.push(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e))}else t.push(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e));return t}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t`
1
+ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as r}from"../base/define.mjs";import{SubjectError as a}from"./single.mjs";var n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,d=(t,e,i,s)=>{for(var o,r=s>1?void 0:s?l(e,i):e,a=t.length-1;a>=0;a--)(o=t[a])&&(r=(s?o(e,i,r):o(r))||r);return s&&r&&n(e,i,r),r};const p=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,h=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;let c=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAnalysis=!0,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.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(),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.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",o=this.isEdit?this._answers:this.answerList||[],r=this.isEdit?this._analysis:this.analysis||"",n=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"",l=this.isEdit?this._showRichText:!!this.richTextContent,d=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void e(new a("题目标题不能为空!","EMPTY_TITLE","title",i));for(let t=0;t<o.length;t++)if(!o[t].title)return void e(new a(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",i));if(!n)return void e(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const p=n.split("\n").filter(t=>t.trim());if(0===p.length)return void e(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const h={answerType:"scale",title:s,analysis:r,answers:o,scaleQuestionList:p,examRichTextContent:l?d:"",examAnswerRelationType:this.examAnswerRelationType};this.customId&&(h.customId=this.customId),t(h)})}_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},i=this.isEdit?this._title:this.title||"",s=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"";if(i||t.push(new a("题目标题不能为空!","EMPTY_TITLE","title",e)),s.forEach((i,s)=>{i.title||t.push(new a(`选项${String.fromCharCode(65+s)}未填写`,"ANSWER_EMPTY","answers",e))}),o){0===o.split("\n").filter(t=>t.trim()).length&&t.push(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e))}else t.push(new a("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e));return t}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t`
2
2
  <div class="preview">
3
3
  <span class="title">${this.orderIndex+1}.${this.title}(量表题)</span>
4
4
  ${this.richTextContent?t`<div style="margin-top:8px" .innerHTML=${this.richTextContent}></div>`:""}
@@ -159,5 +159,5 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
159
159
  .row-title-textarea {
160
160
  height: 200px;
161
161
  }
162
- `,d([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),d([s({type:String})],c.prototype,"title",2),d([s({type:String,attribute:"custom-id"})],c.prototype,"customId",2),d([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),d([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),d([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),d([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),d([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),d([s({type:String})],c.prototype,"analysis",2),d([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),d([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),d([s({type:Object})],c.prototype,"uploadImage",2),d([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",1),d([s({type:Array,attribute:"scale-questions"})],c.prototype,"scaleQuestions",1),d([o()],c.prototype,"_answers",2),d([o()],c.prototype,"_scaleQuestions",2),d([o()],c.prototype,"_rowTitle",2),d([o()],c.prototype,"_title",2),d([o()],c.prototype,"_analysis",2),d([o()],c.prototype,"_showRichText",2),d([o()],c.prototype,"_richText",2),c=d([r("qxs-scale")],c);export{c as QxsScale};
162
+ `,d([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),d([s({type:String})],c.prototype,"title",2),d([s({type:String,attribute:"custom-id"})],c.prototype,"customId",2),d([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),d([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),d([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),d([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),d([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),d([s({type:String})],c.prototype,"analysis",2),d([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),d([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),d([s({type:Object})],c.prototype,"uploadImage",2),d([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",1),d([s({type:Array,attribute:"scale-questions"})],c.prototype,"scaleQuestions",1),d([o()],c.prototype,"_answers",2),d([o()],c.prototype,"_scaleQuestions",2),d([o()],c.prototype,"_rowTitle",2),d([o()],c.prototype,"_title",2),d([o()],c.prototype,"_analysis",2),d([o()],c.prototype,"_showRichText",2),d([o()],c.prototype,"_richText",2),d([s({type:String,attribute:"model-value"})],c.prototype,"modelValue",2),d([s({type:Boolean,attribute:"use-model"})],c.prototype,"useModel",2),c=d([r("qxs-scale")],c);export{c as QxsScale};
163
163
  //# sourceMappingURL=scale.mjs.map