@qxs-bns/components-wc 0.0.23 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/editor/blocksuite-editor.mjs +14 -14
- package/es/editor/blocksuite-editor.mjs.map +1 -1
- package/es/subject/action.mjs +18 -18
- package/es/subject/action.mjs.map +1 -1
- package/es/subject/blank-fill.mjs +21 -21
- package/es/subject/blank-fill.mjs.map +1 -1
- package/es/subject/layout.mjs +3 -3
- package/es/subject/layout.mjs.map +1 -1
- package/es/subject/list.mjs +84 -84
- package/es/subject/list.mjs.map +1 -1
- package/es/subject/page-end.mjs +8 -8
- package/es/subject/page-end.mjs.map +1 -1
- package/es/subject/scale.mjs +19 -19
- package/es/subject/scale.mjs.map +1 -1
- package/es/subject/single.mjs +48 -48
- package/es/subject/single.mjs.map +1 -1
- package/es/subject/text-fill.mjs +45 -45
- package/es/subject/text-fill.mjs.map +1 -1
- package/lib/editor/blocksuite-editor.cjs +4 -4
- package/lib/editor/blocksuite-editor.cjs.map +1 -1
- package/lib/subject/action.cjs +18 -18
- package/lib/subject/action.cjs.map +1 -1
- package/lib/subject/blank-fill.cjs +20 -20
- package/lib/subject/blank-fill.cjs.map +1 -1
- package/lib/subject/layout.cjs +2 -2
- package/lib/subject/layout.cjs.map +1 -1
- package/lib/subject/list.cjs +49 -49
- package/lib/subject/list.cjs.map +1 -1
- package/lib/subject/page-end.cjs +8 -8
- package/lib/subject/page-end.cjs.map +1 -1
- package/lib/subject/scale.cjs +19 -19
- package/lib/subject/scale.cjs.map +1 -1
- package/lib/subject/single.cjs +48 -48
- package/lib/subject/single.cjs.map +1 -1
- package/lib/subject/text-fill.cjs +21 -21
- package/lib/subject/text-fill.cjs.map +1 -1
- package/package.json +1 -1
package/es/subject/action.mjs
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import{css as e,LitElement as t,html as o}from"lit";import{property as i,state as
|
|
1
|
+
import{css as e,LitElement as t,html as o}from"lit";import{property as i,state as s}from"lit/decorators.js";import{safeCustomElement as n}from"../base/define.mjs";var a=Object.defineProperty,r=Object.getOwnPropertyDescriptor,l=(e,t,o,i)=>{for(var s,n=i>1?void 0:i?r(t,o):t,l=e.length-1;l>=0;l--)(s=e[l])&&(n=(i?s(t,o,n):s(n))||n);return i&&n&&a(t,o,n),n};const d=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}],c=[{type:"single",label:"单选题"},{type:"multiple",label:"多选题"},{type:"blank_fill",label:"填空题"},{type:"text_fill",label:"问答题"},{type:"scale",label:"量表题"},{type:"sort",label:"排序题"},{type:"page_end",label:"分页符"}];let p=class extends t{constructor(){super(...arguments),this["is-edit"]=!1,this["is-set"]=!1,this["is-key"]=!1,this["answer-check-type"]=1,this["show-other-option"]=!1,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-rich-text"]=!1,this["hide-add-rich-text"]=!1,this["page-end"]=!1,this["show-move"]=!1,this["show-add"]=!0,this["show-jump"]=!1,this["exam-answer-relation-type"]=0,this._modalOpen=!1,this._currentCheckType=1,this._addMenuOpen=!1,this._handleDocumentClick=e=>{const t=e.composedPath(),o=this.shadowRoot?.querySelector(".add-menu-wrap");o&&!t.includes(o)&&(this._addMenuOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick)}updated(e){e.has("answer-check-type")&&(this._currentCheckType=this["answer-check-type"])}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return d.find(e=>e.value===this["answer-check-type"])?.label??""}get _showAnswerSetting(){return this["show-other-option"]||this["show-answer-setting"]}get _showKey(){return this["show-other-option"]||this["show-key"]}_renderEditMode(){return o`
|
|
2
2
|
<div class="left">
|
|
3
3
|
<span class="inline-actions">
|
|
4
|
-
${this
|
|
4
|
+
${this["show-add"]?o`
|
|
5
5
|
<span class="add-menu-wrap">
|
|
6
6
|
<span class="link-btn" @click=${()=>{this._addMenuOpen=!this._addMenuOpen}}>在此题后加入新题</span>
|
|
7
7
|
${this._renderAddMenu()}
|
|
8
8
|
</span>
|
|
9
9
|
`:""}
|
|
10
|
-
${this
|
|
10
|
+
${this["hide-add-rich-text"]?"":o`
|
|
11
11
|
<span class="link-btn" @click=${()=>this._emit("on-show-rich-text")}>
|
|
12
|
-
${this
|
|
12
|
+
${this["show-rich-text"]?"删除题目描述(图文)":"+添加题目描述(图文)"}
|
|
13
13
|
</span>
|
|
14
14
|
`}
|
|
15
|
-
${this
|
|
16
|
-
<span class="link-btn" @click=${()=>this._emit("jump")}>${this
|
|
15
|
+
${this["show-jump"]?o`
|
|
16
|
+
<span class="link-btn" @click=${()=>this._emit("jump")}>${this["is-set"]?"编辑跳题逻辑":"设置跳题逻辑"}</span>
|
|
17
17
|
`:""}
|
|
18
18
|
${this._showAnswerSetting?o`
|
|
19
19
|
<span class="link-btn" @click=${()=>{this._modalOpen=!0}}>答题设置</span>
|
|
20
20
|
`:""}
|
|
21
21
|
${this._showKey?o`
|
|
22
22
|
<label class="checkbox-label">
|
|
23
|
-
<input type="checkbox" .checked=${this
|
|
23
|
+
<input type="checkbox" .checked=${this["is-key"]} @change=${e=>this._emit("set-key",{value:e.target.checked})} />
|
|
24
24
|
核心题
|
|
25
25
|
</label>
|
|
26
26
|
`:""}
|
|
@@ -35,30 +35,30 @@ import{css as e,LitElement as t,html as o}from"lit";import{property as i,state a
|
|
|
35
35
|
<span class="inline-actions">
|
|
36
36
|
${this._showKey?o`
|
|
37
37
|
<label class="checkbox-label disabled">
|
|
38
|
-
<input type="checkbox" disabled .checked=${this
|
|
38
|
+
<input type="checkbox" disabled .checked=${this["is-key"]} /> 核心题
|
|
39
39
|
</label>
|
|
40
40
|
`:""}
|
|
41
41
|
${this._showAnswerSetting?o`
|
|
42
42
|
<span class="answer-text">${this._answerText}</span>
|
|
43
43
|
`:""}
|
|
44
|
-
${this
|
|
44
|
+
${this["show-add"]?o`
|
|
45
45
|
<span class="add-menu-wrap">
|
|
46
46
|
<span class="link-btn" @click=${()=>{this._addMenuOpen=!this._addMenuOpen}}>在此题后加入新题</span>
|
|
47
47
|
${this._renderAddMenu()}
|
|
48
48
|
</span>
|
|
49
49
|
`:""}
|
|
50
|
-
${this
|
|
51
|
-
<span class="link-btn" @click=${()=>this._emit("jump")}>${this
|
|
50
|
+
${this["show-jump"]?o`
|
|
51
|
+
<span class="link-btn" @click=${()=>this._emit("jump")}>${this["is-set"]?"编辑跳题逻辑":"设置跳题逻辑"}</span>
|
|
52
52
|
`:""}
|
|
53
53
|
</span>
|
|
54
54
|
</div>
|
|
55
55
|
<div class="right">
|
|
56
|
-
${!this
|
|
56
|
+
${!this["is-set"]&&this["show-move"]?o`
|
|
57
57
|
<button class="text-btn text-btn--default" @click=${()=>this._emit("move","up")}>上移</button>
|
|
58
58
|
<button class="text-btn text-btn--default btn-margin" @click=${()=>this._emit("move","down")}>下移</button>
|
|
59
59
|
`:""}
|
|
60
|
-
${this
|
|
61
|
-
${this
|
|
60
|
+
${this["is-set"]?"":o`<button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>`}
|
|
61
|
+
${this["page-end"]||this["is-set"]?"":o`
|
|
62
62
|
<button class="text-btn text-btn--default" @click=${()=>this._emit("edit")}>编辑</button>
|
|
63
63
|
`}
|
|
64
64
|
</div>
|
|
@@ -92,9 +92,9 @@ import{css as e,LitElement as t,html as o}from"lit";import{property as i,state a
|
|
|
92
92
|
`)}
|
|
93
93
|
</div>
|
|
94
94
|
`:""}render(){return o`
|
|
95
|
-
<div class="action ${this
|
|
96
|
-
${this
|
|
97
|
-
${this
|
|
95
|
+
<div class="action ${this["is-edit"]?"active":""}">
|
|
96
|
+
${this["is-edit"]?this._renderEditMode():this._renderViewMode()}
|
|
97
|
+
${this["is-set"]?o`<div class="has-set">*此题设置了跳题逻辑</div>`:""}
|
|
98
98
|
</div>
|
|
99
99
|
${this._renderModal()}
|
|
100
100
|
`}};p.styles=e`
|
|
@@ -168,5 +168,5 @@ import{css as e,LitElement as t,html as o}from"lit";import{property as i,state a
|
|
|
168
168
|
background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;
|
|
169
169
|
}
|
|
170
170
|
.add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
|
|
171
|
-
`,l([i({type:Boolean,attribute:"is-edit"})],p.prototype,"
|
|
171
|
+
`,l([i({type:Boolean,attribute:"is-edit"})],p.prototype,"is-edit",2),l([i({type:Boolean,attribute:"is-set"})],p.prototype,"is-set",2),l([i({type:Boolean,attribute:"is-key"})],p.prototype,"is-key",2),l([i({type:Number,attribute:"answer-check-type"})],p.prototype,"answer-check-type",2),l([i({type:Boolean,attribute:"show-other-option"})],p.prototype,"show-other-option",2),l([i({type:Boolean,attribute:"show-answer-setting"})],p.prototype,"show-answer-setting",2),l([i({type:Boolean,attribute:"show-key"})],p.prototype,"show-key",2),l([i({type:Boolean,attribute:"show-rich-text"})],p.prototype,"show-rich-text",2),l([i({type:Boolean,attribute:"hide-add-rich-text"})],p.prototype,"hide-add-rich-text",2),l([i({type:Boolean,attribute:"page-end"})],p.prototype,"page-end",2),l([i({type:Boolean,attribute:"show-move"})],p.prototype,"show-move",2),l([i({type:Boolean,attribute:"show-add"})],p.prototype,"show-add",2),l([i({type:Boolean,attribute:"show-jump"})],p.prototype,"show-jump",2),l([i({type:Number,attribute:"exam-answer-relation-type"})],p.prototype,"exam-answer-relation-type",2),l([s()],p.prototype,"_modalOpen",2),l([s()],p.prototype,"_currentCheckType",2),l([s()],p.prototype,"_addMenuOpen",2),p=l([n("qxs-subject-action")],p);export{p as QxsSubjectAction};
|
|
172
172
|
//# 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'\nimport { safeCustomElement } from '../base/define'\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst addSubjectOptions = [\n { type: 'single', label: '单选题' },\n { type: 'multiple', label: '多选题' },\n { type: 'blank_fill', label: '填空题' },\n { type: 'text_fill', label: '问答题' },\n { type: 'scale', label: '量表题' },\n { type: 'sort', label: '排序题' },\n { type: 'page_end', label: '分页符' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n\n .inline-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }\n .add-menu-wrap { position: relative; display: inline-flex; }\n .add-menu {\n position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;\n display: grid; grid-template-columns: repeat(2, minmax(84px, 1fr)); gap: 8px;\n min-width: 196px; padding: 10px; background: #fff; border: 1px solid #e4e7ed;\n border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12);\n }\n .add-item {\n display: inline-flex; align-items: center; justify-content: center;\n min-height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px;\n background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;\n }\n .add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-answer-setting' }) showAnswerSetting = false\n @property({ type: Boolean, attribute: 'show-key' }) showKey = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = false\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Boolean, attribute: 'show-move' }) showMove = false\n @property({ type: Boolean, attribute: 'show-add' }) showAdd = true\n @property({ type: Boolean, attribute: 'show-jump' }) showJump = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n @state() private _addMenuOpen = false\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrap = this.shadowRoot?.querySelector('.add-menu-wrap')\n if (wrap && !path.includes(wrap)) {\n this._addMenuOpen = false\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private get _showAnswerSetting() {\n return this.showOtherOption || this.showAnswerSetting\n }\n\n private get _showKey() {\n return this.showOtherOption || this.showKey\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this.showAdd\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>\n ${this.showRichText ? '删除题目描述(图文)' : '+添加题目描述(图文)'}\n </span>\n `\n : ''}\n ${this.showJump\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this.isSet ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n `\n : ''}\n ${this._showKey\n ? html`\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this._showKey\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n ${this.showAdd\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${this.showJump\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this.isSet ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n ${!this.isSet && this.showMove\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('move', 'up')}>上移</button>\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('move', 'down')}>下移</button>\n `\n : ''}\n ${!this.isSet\n ? html`<button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>`\n : ''}\n ${!this.pageEnd && !this.isSet\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private _renderAddMenu() {\n if (!this._addMenuOpen) { return '' }\n return html`\n <div class=\"add-menu\">\n ${addSubjectOptions.map(item => html`\n <button class=\"add-item\" @click=${() => {\n this._addMenuOpen = false\n this._emit('add', item.type)\n }}>${item.label}</button>\n `)}\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isEdit ? this._renderEditMode() : this._renderViewMode()}\n ${this.isSet ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>` : ''}\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","addSubjectOptions","type","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showAnswerSetting","showKey","showRichText","hideAddRichText","pageEnd","showMove","showAdd","showJump","examAnswerRelationType","_modalOpen","_currentCheckType","_addMenuOpen","_handleDocumentClick","e","path","composedPath","wrap","shadowRoot","querySelector","includes","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_showAnswerSetting","_showKey","_renderEditMode","html","_renderAddMenu","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","Boolean","attribute","prototype","Number","state","safeCustomElement"],"mappings":"mWAIA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGfC,EAAoB,CACxB,CAAEC,KAAM,SAAUF,MAAO,OACzB,CAAEE,KAAM,WAAYF,MAAO,OAC3B,CAAEE,KAAM,aAAcF,MAA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|
|
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'\nimport { safeCustomElement } from '../base/define'\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst addSubjectOptions = [\n { type: 'single', label: '单选题' },\n { type: 'multiple', label: '多选题' },\n { type: 'blank_fill', label: '填空题' },\n { type: 'text_fill', label: '问答题' },\n { type: 'scale', label: '量表题' },\n { type: 'sort', label: '排序题' },\n { type: 'page_end', label: '分页符' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n\n .inline-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }\n .add-menu-wrap { position: relative; display: inline-flex; }\n .add-menu {\n position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;\n display: grid; grid-template-columns: repeat(2, minmax(84px, 1fr)); gap: 8px;\n min-width: 196px; padding: 10px; background: #fff; border: 1px solid #e4e7ed;\n border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12);\n }\n .add-item {\n display: inline-flex; align-items: center; justify-content: center;\n min-height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px;\n background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;\n }\n .add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n @property({ type: Number, attribute: 'answer-check-type' }) 'answer-check-type' = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) 'show-other-option' = false\n @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-key' }) 'show-key' = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) 'show-rich-text' = false\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) 'hide-add-rich-text' = false\n @property({ type: Boolean, attribute: 'page-end' }) 'page-end' = false\n @property({ type: Boolean, attribute: 'show-move' }) 'show-move' = false\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'show-jump' }) 'show-jump' = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n @state() private _addMenuOpen = false\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answer-check-type')) {\n this._currentCheckType = this['answer-check-type']\n }\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrap = this.shadowRoot?.querySelector('.add-menu-wrap')\n if (wrap && !path.includes(wrap)) {\n this._addMenuOpen = false\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this['answer-check-type'])?.label ?? ''\n }\n\n private get _showAnswerSetting() {\n return this['show-other-option'] || this['show-answer-setting']\n }\n\n private get _showKey() {\n return this['show-other-option'] || this['show-key']\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this['show-add']\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${!this['hide-add-rich-text']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>\n ${this['show-rich-text'] ? '删除题目描述(图文)' : '+添加题目描述(图文)'}\n </span>\n `\n : ''}\n ${this['show-jump']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this['is-set'] ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n `\n : ''}\n ${this._showKey\n ? html`\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this['is-key']} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this._showKey\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this['is-key']} /> 核心题\n </label>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n ${this['show-add']\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${this['show-jump']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this['is-set'] ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n ${!this['is-set'] && this['show-move']\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('move', 'up')}>上移</button>\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('move', 'down')}>下移</button>\n `\n : ''}\n ${!this['is-set']\n ? html`<button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>`\n : ''}\n ${!this['page-end'] && !this['is-set']\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private _renderAddMenu() {\n if (!this._addMenuOpen) { return '' }\n return html`\n <div class=\"add-menu\">\n ${addSubjectOptions.map(item => html`\n <button class=\"add-item\" @click=${() => {\n this._addMenuOpen = false\n this._emit('add', item.type)\n }}>${item.label}</button>\n `)}\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this['is-edit'] ? 'active' : ''}\">\n ${this['is-edit'] ? this._renderEditMode() : this._renderViewMode()}\n ${this['is-set'] ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>` : ''}\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","addSubjectOptions","type","QxsSubjectAction","LitElement","constructor","super","arguments","this","_modalOpen","_currentCheckType","_addMenuOpen","_handleDocumentClick","e","path","composedPath","wrap","shadowRoot","querySelector","includes","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_showAnswerSetting","_showKey","_renderEditMode","html","_renderAddMenu","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","Boolean","attribute","prototype","Number","state","safeCustomElement"],"mappings":"mWAIA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGfC,EAAoB,CACxB,CAAEC,KAAM,SAAUF,MAAO,OACzB,CAAEE,K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s,state as a}from"lit/decorators.js";import{safeCustomElement as
|
|
1
|
+
import{html as t,css as e,LitElement as i}from"lit";import{property as s,state as a}from"lit/decorators.js";import{safeCustomElement as l}from"../base/define.mjs";import{SubjectError as n}from"./single.mjs";import{SubjectType as r}from"./types.mjs";var o=Object.defineProperty,h=Object.getOwnPropertyDescriptor,p=(t,e,i,s)=>{for(var a,l=s>1?void 0:s?h(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 c=class extends i{constructor(){super(...arguments),this
|
|
5
|
+
</svg>`;let c=class extends i{constructor(){super(...arguments),this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["show-answer-setting"]=!1,this["show-analysis"]=!0,this["rich-text-content"]="",this.analysis="",this["exam-answer-relation-type"]=0,this["exam-expand"]="",this["exam-answer-setting"]={isInOrder:!1,isIgnoreCase:!0},this["upload-image"]=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this["answer-list"]=[],this["model-value"]="",this["use-model"]=!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("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(t.has("title")||t.has("answer-list")||t.has("analysis")||t.has("exam-answer-setting")||t.has("rich-text-content"))&&this._syncProps(),t.has("model-value")&&this["use-model"]&&(this._title=this["model-value"].replaceAll(/<filter><\/filter>/g," ______"))}_normalizeAnswerTitle(t){return String(t?.title??t?.answer??"")}_syncProps(){if(this._title=(this.title||"").replaceAll(/<filter><\/filter>/g," ______"),this._analysis=this.analysis||"",this["answer-list"]?.length)this._answers=this["answer-list"].map(t=>({title:this._normalizeAnswerTitle(t),tag:"",showInput:!1}));else{const t=(this._title.match(/ ______/g)||[]).length||1;this._answers=Array.from({length:t},()=>({title:"",tag:"",showInput:!1}))}this["exam-answer-setting"]&&(this._isInOrder=!!this["exam-answer-setting"].isInOrder,this._isIgnoreCase=!!this["exam-answer-setting"].isIgnoreCase),this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"]}_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["use-model"]){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["custom-id"]||void 0,answerType:"blank_fill",orderIndex:this["order-index"]},s=this["is-edit"]?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",a=this["is-edit"]?this._answers:(this["answer-list"]||[]).map(t=>({...t,title:this._normalizeAnswerTitle(t)})),l=this["is-edit"]?this._analysis:this.analysis||"",o=this["is-edit"]?this._isInOrder:this["exam-answer-setting"]?.isInOrder??!1,h=this["is-edit"]?this._isIgnoreCase:this["exam-answer-setting"]?.isIgnoreCase??!0,p=this["is-edit"]?this._showRichText:!!this["rich-text-content"],d=this["is-edit"]?this._richText:this["rich-text-content"]||"";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 c={answerType:r.BLANK_FILL,title:s.replaceAll(/ ______/g,"<filter></filter>"),answers:a.map(t=>({title:t.title,isCorrect:!0})),analysis:l,isSetCorrectAnswer:!0,isKey:this["is-key"],examAnswerSettingBO:{isIgnoreCase:h,isInOrder:o},examRichTextContent:p?d:""};this["custom-id"]&&(c.customId=this["custom-id"]),t(c)})}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}validate(){const t=[],e={customId:this["custom-id"]||void 0,answerType:"blank_fill",orderIndex:this["order-index"]},i=this["is-edit"]?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",s=this["is-edit"]?this._answers:(this["answer-list"]||[]).map(t=>({...t,title:this._normalizeAnswerTitle(t)}));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," ______"),i=this["is-edit"]?this._answers:(this["answer-list"]||[]).map(t=>({...t,title:this._normalizeAnswerTitle(t)}));return t`
|
|
6
6
|
<div class="preview">
|
|
7
|
-
<span class="title">${this
|
|
8
|
-
${this
|
|
7
|
+
<span class="title">${this["order-index"]+1}.${e}(填空题)</span>
|
|
8
|
+
${this["rich-text-content"]?t`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
|
|
9
9
|
${i.some(t=>t.title)?t`
|
|
10
10
|
<div class="content flex flex-wrap">
|
|
11
11
|
<span>正确答案:</span>
|
|
@@ -21,7 +21,7 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
21
21
|
<div class="label"><span>题目:</span></div>
|
|
22
22
|
<div style="flex:1">
|
|
23
23
|
<div class="el-input">
|
|
24
|
-
<textarea rows="3" .value=${this._title} ?disabled=${this
|
|
24
|
+
<textarea rows="3" .value=${this._title} ?disabled=${this["is-save"]}
|
|
25
25
|
maxlength=${this.TITLE_MAX}
|
|
26
26
|
@input=${t=>this._onTitleInput(t)}
|
|
27
27
|
placeholder="【填空题】请输入问题"></textarea>
|
|
@@ -31,11 +31,11 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
31
31
|
</div>
|
|
32
32
|
|
|
33
33
|
<div class="flex flex-justify-end">
|
|
34
|
-
<span class="el-link ${this
|
|
35
|
-
@click=${()=>{this
|
|
34
|
+
<span class="el-link ${this["is-save"]?"is-disabled":""}"
|
|
35
|
+
@click=${()=>{this["is-save"]||this._addBlank()}}>插入填空符</span>
|
|
36
36
|
</div>
|
|
37
37
|
|
|
38
|
-
${this
|
|
38
|
+
${this["show-answer-setting"]?t`
|
|
39
39
|
<div class="flex flex-items-center" style="margin-top:12px">
|
|
40
40
|
<div class="label"><span>答题设置:</span></div>
|
|
41
41
|
<label class="el-checkbox">
|
|
@@ -58,10 +58,10 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
58
58
|
${e.title.split(",").filter(Boolean).map(i=>t`
|
|
59
59
|
<span class="el-tag">
|
|
60
60
|
${i}
|
|
61
|
-
${this
|
|
61
|
+
${this["is-save"]?"":t`<span class="el-tag__close" @click=${()=>this._closeTag(i,e)}>×</span>`}
|
|
62
62
|
</span>
|
|
63
63
|
`)}
|
|
64
|
-
${this
|
|
64
|
+
${this["is-save"]?"":t`
|
|
65
65
|
${e.showInput?t`
|
|
66
66
|
<input type="text" class="el-input--small"
|
|
67
67
|
@keydown=${t=>{"Enter"===t.key&&this._handleAddTag(e)}}
|
|
@@ -84,10 +84,10 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
84
84
|
<div style="flex:1">
|
|
85
85
|
<qxs-blocksuite-editor
|
|
86
86
|
.content=${this._richText}
|
|
87
|
-
.
|
|
87
|
+
.upload-image=${this["upload-image"]}
|
|
88
88
|
?is-edit=${!0}
|
|
89
89
|
></qxs-blocksuite-editor>
|
|
90
|
-
${this
|
|
90
|
+
${this["show-action"]?"":t`
|
|
91
91
|
<div class="flex flex-justify-end" style="margin-top:8px">
|
|
92
92
|
<span class="el-link" style="color:#f56c6c" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span>
|
|
93
93
|
</div>
|
|
@@ -96,7 +96,7 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
96
96
|
</div>
|
|
97
97
|
`:""}
|
|
98
98
|
|
|
99
|
-
${this
|
|
99
|
+
${this["show-analysis"]?t`
|
|
100
100
|
<div class="flex flex-items-start" style="margin-top:12px">
|
|
101
101
|
<div class="label"><span>解析:</span></div>
|
|
102
102
|
<div style="flex:1">
|
|
@@ -109,16 +109,16 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
109
109
|
</div>
|
|
110
110
|
`:""}
|
|
111
111
|
`}render(){return t`
|
|
112
|
-
<qxs-subject-layout .
|
|
112
|
+
<qxs-subject-layout .show-edit=${this["is-edit"]}>
|
|
113
113
|
<div slot="preview">${this._renderPreview()}</div>
|
|
114
114
|
<div slot="edit">${this._renderEdit()}</div>
|
|
115
|
-
${this
|
|
115
|
+
${this["show-action"]?t`
|
|
116
116
|
<qxs-subject-action
|
|
117
|
-
.
|
|
118
|
-
.
|
|
119
|
-
.
|
|
120
|
-
.
|
|
121
|
-
exam-answer-relation-type=${this
|
|
117
|
+
.is-edit=${this["is-edit"]}
|
|
118
|
+
.is-set=${this["is-set"]}
|
|
119
|
+
.show-add=${this["show-add"]}
|
|
120
|
+
.show-rich-text=${this._showRichText}
|
|
121
|
+
exam-answer-relation-type=${this["exam-answer-relation-type"]}
|
|
122
122
|
@delete=${()=>this._emit("delete")}
|
|
123
123
|
@save=${this._save}
|
|
124
124
|
@edit=${()=>this._emit("edit")}
|
|
@@ -206,5 +206,5 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
|
|
|
206
206
|
.answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
|
|
207
207
|
.answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }
|
|
208
208
|
.answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
|
|
209
|
-
`,p([s({type:Number,attribute:"order-index"})],c.prototype,"
|
|
209
|
+
`,p([s({type:Number,attribute:"order-index"})],c.prototype,"order-index",2),p([s({type:String})],c.prototype,"title",2),p([s({type:String,attribute:"custom-id"})],c.prototype,"custom-id",2),p([s({type:Boolean,attribute:"is-edit"})],c.prototype,"is-edit",2),p([s({type:Boolean,attribute:"is-save"})],c.prototype,"is-save",2),p([s({type:Boolean,attribute:"is-set"})],c.prototype,"is-set",2),p([s({type:Boolean,attribute:"is-key"})],c.prototype,"is-key",2),p([s({type:Boolean,attribute:"show-action"})],c.prototype,"show-action",2),p([s({type:Boolean,attribute:"show-add"})],c.prototype,"show-add",2),p([s({type:Boolean,attribute:"show-answer-setting"})],c.prototype,"show-answer-setting",2),p([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"show-analysis",2),p([s({type:String,attribute:"rich-text-content"})],c.prototype,"rich-text-content",2),p([s({type:String})],c.prototype,"analysis",2),p([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"exam-answer-relation-type",2),p([s({type:String,attribute:"exam-expand"})],c.prototype,"exam-expand",2),p([s({type:Object,attribute:"exam-answer-setting"})],c.prototype,"exam-answer-setting",2),p([s({type:Object,attribute:"upload-image"})],c.prototype,"upload-image",2),p([s({type:Array,attribute:"answer-list"})],c.prototype,"answer-list",2),p([s({type:String,attribute:"model-value"})],c.prototype,"model-value",2),p([s({type:Boolean,attribute:"use-model"})],c.prototype,"use-model",2),p([a()],c.prototype,"_title",2),p([a()],c.prototype,"_analysis",2),p([a()],c.prototype,"_answers",2),p([a()],c.prototype,"_isInOrder",2),p([a()],c.prototype,"_isIgnoreCase",2),p([a()],c.prototype,"_showRichText",2),p([a()],c.prototype,"_richText",2),c=p([l("qxs-blank-fill")],c);export{c as QxsBlankFill};
|
|
210
210
|
//# 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'\nimport { SubjectType } from './types'\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-add' }) showAdd = true\n @property({ type: Boolean, attribute: 'show-answer-setting' }) showAnswerSetting = false\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean } = { 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 if (!this.isEdit && (changed.has('title') || changed.has('answerList') || changed.has('analysis') || changed.has('examAnswerSetting') || changed.has('richTextContent'))) {\n this._syncProps()\n }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue.replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n }\n\n private _normalizeAnswerTitle(answer: any) {\n return String(answer?.title ?? answer?.answer ?? '')\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: this._normalizeAnswerTitle(a), 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 this._richText = this.richTextContent || ''\n this._showRichText = !!this.richTextContent\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 || []).map((answer: any) => ({ ...answer, title: this._normalizeAnswerTitle(answer) }))\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: SubjectType.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 || []).map((answer: any) => ({ ...answer, title: this._normalizeAnswerTitle(answer) }))\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 const previewAnswers = this.isEdit ? this._answers : (this.answerList || []).map((answer: any) => ({ ...answer, title: this._normalizeAnswerTitle(answer) }))\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 ${previewAnswers.some(a => a.title)\n ? html`\n <div class=\"content flex flex-wrap\">\n <span>正确答案:</span>\n ${previewAnswers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">填空${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${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 ${this.showAnswerSetting\n ? html`\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 : ''}\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 ${!this.showAction\n ? html`\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 `\n : ''}\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 .showEdit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n .isEdit=${this.isEdit}\n .isSet=${this.isSet}\n .showAdd=${this.showAdd}\n .showRichText=${this._showRichText}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => {\n this._showRichText = !this._showRichText\n if (!this._showRichText) {\n this._richText = ''\n }\n }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","QxsBlankFill","LitElement","constructor","super","arguments","this","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAdd","showAnswerSetting","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","_normalizeAnswerTitle","answer","String","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","SubjectType","BLANK_FILL","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","previewAnswers","some","_renderEdit","checked","filter","Boolean","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","state","safeCustomElement"],"mappings":"ybAQA,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,EAChBR,KAAAS,SAAU,EACCT,KAAAU,mBAAoB,EAC1BV,KAAAW,cAAe,EACZX,KAAAY,gBAAkB,GAClDZ,KAAAa,SAAW,GAC6Bb,KAAAc,uBAAyB,EACvCd,KAAAe,WAAa,GAEnEf,KAAAgB,kBAAmE,CAAEC,WAAW,EAAOC,cAAc,GAErGlB,KAAAmB,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAAUC,GAAML,EAAQK,EAAEC,QAAQC,QACzCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAI4BhC,KAAAiC,WAAoB,GAGnBjC,KAAAkC,WAAa,GACdlC,KAAAmC,UAAW,EAEvDnC,KAAQoC,OAAS,GACjBpC,KAAQqC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AAQC,UAAW,+BA9F1B9J,EA8FyD+J,UAAA,yBAAA,GACdL,EAAA,CAArDC,EAAS,CAAEC,KAAMlG,OAAQoG,UAAW,iBA/F1B9J,EA+F2C+J,UAAA,aAAA,GAEtDL,EAAA,CADCC,EAAS,CAAEC,KAAM5C,OAAQ8C,UAAW,yBAhG1B9J,EAiGX+J,UAAA,oBAAA,GAEAL,EAAA,CADCC,EAAS,CAAEC,KAAM5C,UAlGPhH,EAmGX+J,UAAA,cAAA,GASqDL,EAAA,CAApDC,EAAS,CAAEC,KAAM5F,MAAO8F,UAAW,iBA5GzB9J,EA4G0C+J,UAAA,aAAA,GAGCL,EAAA,CAArDC,EAAS,CAAEC,KAAMlG,OAAQoG,UAAW,iBA/G1B9J,EA+G2C+J,UAAA,aAAA,GACDL,EAAA,CAApDC,EAAS,CAAEC,KAAMZ,QAASc,UAAW,eAhH3B9J,EAgH0C+J,UAAA,WAAA,GAEpCL,EAAA,CAAhBM,KAlHUhK,EAkHM+J,UAAA,SAAA,GACAL,EAAA,CAAhBM,KAnHUhK,EAmHM+J,UAAA,YAAA,GACAL,EAAA,CAAhBM,KApHUhK,EAoHM+J,UAAA,WAAA,GACAL,EAAA,CAAhBM,KArHUhK,EAqHM+J,UAAA,aAAA,GACAL,EAAA,CAAhBM,KAtHUhK,EAsHM+J,UAAA,gBAAA,GACAL,EAAA,CAAhBM,KAvHUhK,EAuHM+J,UAAA,gBAAA,GACAL,EAAA,CAAhBM,KAxHUhK,EAwHM+J,UAAA,YAAA,GAxHN/J,EAAN0J,EAAA,CADNO,EAAkB,mBACNjK"}
|
|
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'\nimport { SubjectType } from './types'\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' }) 'order-index' = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-save' }) 'is-save' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = true\n @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n @property({ type: String, attribute: 'exam-expand' }) 'exam-expand' = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n 'exam-answer-setting': { isInOrder: boolean, isIgnoreCase: boolean } = { isInOrder: false, isIgnoreCase: true }\n\n @property({ type: Object, attribute: 'upload-image' })\n 'upload-image': (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = e => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' }) 'answer-list': any[] = []\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = 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('is-edit') && this['is-edit']) { this._syncProps() }\n if (!this['is-edit'] && (changed.has('title') || changed.has('answer-list') || changed.has('analysis') || changed.has('exam-answer-setting') || changed.has('rich-text-content'))) {\n this._syncProps()\n }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('model-value') && this['use-model']) {\n this._title = this['model-value'].replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n }\n\n private _normalizeAnswerTitle(answer: any) {\n return String(answer?.title ?? answer?.answer ?? '')\n }\n\n private _syncProps() {\n this._title = (this.title || '').replaceAll(/<filter><\\/filter>/g, ' ______')\n this._analysis = this.analysis || ''\n if (this['answer-list']?.length) {\n this._answers = this['answer-list'].map((a: any) => ({ title: this._normalizeAnswerTitle(a), 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['exam-answer-setting']) {\n this._isInOrder = !!this['exam-answer-setting'].isInOrder\n this._isIgnoreCase = !!this['exam-answer-setting'].isIgnoreCase\n }\n this._richText = this['rich-text-content'] || ''\n this._showRichText = !!this['rich-text-content']\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['use-model']) {\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['custom-id'] || undefined, answerType: 'blank_fill', orderIndex: this['order-index'] }\n\n const title = this['is-edit'] ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this['is-edit'] ? this._answers : (this['answer-list'] || []).map((answer: any) => ({ ...answer, title: this._normalizeAnswerTitle(answer) }))\n const analysis = this['is-edit'] ? this._analysis : this.analysis || ''\n const isInOrder = this['is-edit'] ? this._isInOrder : this['exam-answer-setting']?.isInOrder ?? false\n const isIgnoreCase = this['is-edit'] ? this._isIgnoreCase : this['exam-answer-setting']?.isIgnoreCase ?? true\n const showRichText = this['is-edit'] ? this._showRichText : !!this['rich-text-content']\n const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n\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: SubjectType.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['is-key'],\n examAnswerSettingBO: { isIgnoreCase, isInOrder },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this['custom-id']) { result.customId = this['custom-id'] }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this['custom-id'] || undefined, answerType: 'blank_fill', orderIndex: this['order-index'] }\n\n const title = this['is-edit'] ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this['is-edit'] ? this._answers : (this['answer-list'] || []).map((answer: any) => ({ ...answer, title: this._normalizeAnswerTitle(answer) }))\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 const previewAnswers = this['is-edit'] ? this._answers : (this['answer-list'] || []).map((answer: any) => ({ ...answer, title: this._normalizeAnswerTitle(answer) }))\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this['order-index'] + 1}.${displayTitle}(填空题)</span>\n ${this['rich-text-content'] ? html`<div class=\"rich-text\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n ${previewAnswers.some(a => a.title)\n ? html`\n <div class=\"content flex flex-wrap\">\n <span>正确答案:</span>\n ${previewAnswers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">填空${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${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['is-save']}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【填空题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex flex-justify-end\">\n <span class=\"el-link ${this['is-save'] ? 'is-disabled' : ''}\"\n @click=${() => {\n if (!this['is-save']) { this._addBlank() }\n }}>插入填空符</span>\n </div>\n\n ${this['show-answer-setting']\n ? html`\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 : ''}\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['is-save'] ? html`<span class=\"el-tag__close\" @click=${() => this._closeTag(tag, a)}>×</span>` : ''}\n </span>\n `)}\n ${!this['is-save']\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 .upload-image=${this['upload-image']}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n ${!this['show-action']\n ? html`\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 `\n : ''}\n </div>\n </div>\n `\n : ''}\n\n ${this['show-analysis']\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['is-edit']}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this['show-action']\n ? html`\n <qxs-subject-action\n .is-edit=${this['is-edit']}\n .is-set=${this['is-set']}\n .show-add=${this['show-add']}\n .show-rich-text=${this._showRichText}\n exam-answer-relation-type=${this['exam-answer-relation-type']}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => {\n this._showRichText = !this._showRichText\n if (!this._showRichText) {\n this._richText = ''\n }\n }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","QxsBlankFill","LitElement","constructor","super","arguments","this","title","analysis","isInOrder","isIgnoreCase","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_title","_analysis","_answers","tag","showInput","_isInOrder","_isIgnoreCase","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","replaceAll","_normalizeAnswerTitle","answer","String","length","map","a","blankCount","match","Array","from","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_addBlank","requestUpdate","_emitModelUpdate","_onTitleInput","el","value","slice","i","modelValue","_handleAddTag","item","join","_closeTag","tags","split","idx","findIndex","t","splice","toJSON","row","customId","answerType","orderIndex","answers","showRichText","richText","SubjectError","SubjectType","BLANK_FILL","isCorrect","isSetCorrectAnswer","isKey","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","previewAnswers","some","_renderEdit","checked","filter","Boolean","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","state","safeCustomElement"],"mappings":"ybAQA,MAAMA,EAAWC,CAAA;;;;UAoBV,IAAMC,EAAN,cAA2BC,EAA3BC,WAAAA,GAAAC,SAAAC,WAiFiDC,KAAA,eAAgB,EAC1CA,KAAAC,MAAQ,GACgBD,KAAA,aAAc,GACfA,KAAA,YAAY,EACZA,KAAA,YAAY,EACbA,KAAA,WAAW,EACXA,KAAA,WAAW,EACNA,KAAA,gBAAgB,EACnBA,KAAA,aAAa,EACFA,KAAA,wBAAwB,EAC9BA,KAAA,kBAAkB,EACfA,KAAA,qBAAsB,GACtDA,KAAAE,SAAW,GAC6BF,KAAA,6BAA8B,EAC5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ACAL,EAAA,CAAhBM,KAzHUlJ,EAyHMiJ,UAAA,YAAA,GAzHNjJ,EAAN4I,EAAA,CADNO,EAAkB,mBACNnJ"}
|
package/es/subject/layout.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{css as t,LitElement as
|
|
1
|
+
import{css as t,LitElement as e,html as o}from"lit";import{property as s}from"lit/decorators.js";import{safeCustomElement as i}from"../base/define.mjs";var r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,d=(t,e,o,s)=>{for(var i,d=s>1?void 0:s?a(e,o):e,l=t.length-1;l>=0;l--)(i=t[l])&&(d=(s?i(e,o,d):i(d))||d);return s&&d&&r(e,o,d),d};let l=class extends e{constructor(){super(...arguments),this["show-edit"]=!1}render(){return this["show-edit"]?o`
|
|
2
2
|
<div class="layout">
|
|
3
3
|
<div class="edit">
|
|
4
4
|
<slot name="edit"></slot>
|
|
5
5
|
<slot></slot>
|
|
6
6
|
</div>
|
|
7
7
|
</div>
|
|
8
|
-
`:
|
|
8
|
+
`:o`
|
|
9
9
|
<div class="layout">
|
|
10
10
|
<div class="preview">
|
|
11
11
|
<slot name="preview"></slot>
|
|
@@ -17,5 +17,5 @@ import{css as t,LitElement as o,html as e}from"lit";import{property as s}from"li
|
|
|
17
17
|
.layout { }
|
|
18
18
|
.preview { padding: 12px 10px 10px; }
|
|
19
19
|
.edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; }
|
|
20
|
-
`,d([s({type:Boolean,attribute:"show-edit"})],l.prototype,"
|
|
20
|
+
`,d([s({type:Boolean,attribute:"show-edit"})],l.prototype,"show-edit",2),l=d([i("qxs-subject-layout")],l);export{l as QxsSubjectLayout};
|
|
21
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 { }\n .preview { padding: 12px 10px 10px; }\n .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; }\n `\n\n @property({ type: Boolean, attribute: 'show-edit' })
|
|
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 { }\n .preview { padding: 12px 10px 10px; }\n .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; }\n `\n\n @property({ type: Boolean, attribute: 'show-edit' }) 'show-edit' = false\n\n render() {\n if (this['show-edit']) {\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","render","html","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","safeCustomElement"],"mappings":"wVAKO,IAAMA,EAAN,cAA+BC,EAA/BC,WAAAA,GAAAC,SAAAC,WAQgDC,KAAA,cAAc,CAAA,CAEnEC,MAAAA,GACE,OAAID,KAAK,aACAE,CAAA;;;;;;;QASFA,CAAA;;;;;;;KAQT,GA7BWP,EACJQ,OAASC,CAAA;;;;;IAOqCC,EAAA,CAApDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,eAR3Bd,EAQ0Ce,UAAA,YAAA,GAR1Cf,EAANU,EAAA,CADNM,EAAkB,uBACNhB"}
|