@qxs-bns/components-wc 0.0.14 → 0.0.16
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 +2 -2
- 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/list.mjs +7 -6
- package/es/subject/list.mjs.map +1 -1
- package/es/subject/single.mjs +60 -50
- package/es/subject/single.mjs.map +1 -1
- package/lib/editor/blocksuite-editor.cjs +2 -2
- package/lib/editor/blocksuite-editor.cjs.map +1 -1
- package/lib/subject/action.cjs +3 -3
- package/lib/subject/action.cjs.map +1 -1
- package/lib/subject/list.cjs +10 -9
- package/lib/subject/list.cjs.map +1 -1
- package/lib/subject/single.cjs +16 -6
- package/lib/subject/single.cjs.map +1 -1
- package/package.json +1 -1
package/es/subject/action.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{css as e,LitElement as t,html as o}from"lit";import{property as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,s=(e,t,o,r)=>{for(var i,s=r>1?void 0:r?a(t,o):t,l=e.length-1;l>=0;l--)(i=e[l])&&(s=(r?i(t,o,s):i(s))||s);return r&&s&&n(t,o,s),s};const l=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}];let c=class extends t{constructor(){super(...arguments),this.isEdit=!1,this.isSet=!1,this.isKey=!1,this.answerCheckType=1,this.showOtherOption=!1,this.showRichText=!0,this.hideAddRichText=!1,this.pageEnd=!1,this.examAnswerRelationType=0,this._modalOpen=!1,this._currentCheckType=1}updated(e){e.has("answerCheckType")&&(this._currentCheckType=this.answerCheckType)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return l.find(e=>e.value===this.answerCheckType)?.label??""}_renderEditMode(){return o`
|
|
2
2
|
<div class="left">
|
|
3
|
-
${this.hideAddRichText?"":
|
|
3
|
+
${this.hideAddRichText?"":o`
|
|
4
4
|
<span class="link-btn" @click=${()=>this._emit("on-show-rich-text")}>+添加题目描述(图文)</span>
|
|
5
5
|
`}
|
|
6
|
-
${this.showOtherOption?
|
|
6
|
+
${this.showOtherOption?o`
|
|
7
7
|
<span class="link-btn" @click=${()=>{this._modalOpen=!0}}>答题设置</span>
|
|
8
8
|
<label class="checkbox-label">
|
|
9
9
|
<input type="checkbox" .checked=${this.isKey} @change=${e=>this._emit("set-key",{value:e.target.checked})} />
|
|
@@ -15,9 +15,9 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
|
|
|
15
15
|
<button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>
|
|
16
16
|
<button class="text-btn text-btn--primary" @click=${()=>this._emit("save")}>完成编辑</button>
|
|
17
17
|
</div>
|
|
18
|
-
`}_renderViewMode(){return
|
|
18
|
+
`}_renderViewMode(){return o`
|
|
19
19
|
<div class="left">
|
|
20
|
-
${this.showOtherOption?
|
|
20
|
+
${this.showOtherOption?o`
|
|
21
21
|
<label class="checkbox-label disabled">
|
|
22
22
|
<input type="checkbox" disabled .checked=${this.isKey} /> 核心题
|
|
23
23
|
</label>
|
|
@@ -25,12 +25,12 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
|
|
|
25
25
|
`:""}
|
|
26
26
|
</div>
|
|
27
27
|
<div class="right">
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
<button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>
|
|
29
|
+
${this.pageEnd?"":o`
|
|
30
|
+
<button class="text-btn text-btn--default" @click=${()=>this._emit("edit")}>编辑</button>
|
|
30
31
|
`}
|
|
31
|
-
<button class="text-btn text-btn--danger" @click=${()=>this._emit("delete")}>删除</button>
|
|
32
32
|
</div>
|
|
33
|
-
`}_renderModal(){return this._modalOpen?
|
|
33
|
+
`}_renderModal(){return this._modalOpen?o`
|
|
34
34
|
<div class="modal-backdrop" @click=${()=>{this._modalOpen=!1}}>
|
|
35
35
|
<div class="modal" @click=${e=>e.stopPropagation()}>
|
|
36
36
|
<div class="modal-header">
|
|
@@ -38,12 +38,12 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
|
|
|
38
38
|
<button class="modal-close" @click=${()=>{this._modalOpen=!1}}>✕</button>
|
|
39
39
|
</div>
|
|
40
40
|
<div class="modal-body">
|
|
41
|
-
${l.map(
|
|
41
|
+
${l.map(e=>o`
|
|
42
42
|
<label class="radio-item">
|
|
43
|
-
<input type="radio" name="answer-check-type" .value=${String(
|
|
44
|
-
.checked=${this._currentCheckType===
|
|
45
|
-
@change=${()=>{this._currentCheckType=
|
|
46
|
-
${
|
|
43
|
+
<input type="radio" name="answer-check-type" .value=${String(e.value)}
|
|
44
|
+
.checked=${this._currentCheckType===e.value}
|
|
45
|
+
@change=${()=>{this._currentCheckType=e.value}} />
|
|
46
|
+
${e.label}
|
|
47
47
|
</label>
|
|
48
48
|
`)}
|
|
49
49
|
</div>
|
|
@@ -53,12 +53,12 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
|
|
|
53
53
|
</div>
|
|
54
54
|
</div>
|
|
55
55
|
</div>
|
|
56
|
-
`:""}render(){return
|
|
56
|
+
`:""}render(){return o`
|
|
57
57
|
<div class="action ${this.isEdit?"active":""}">
|
|
58
|
-
${this.isSet?
|
|
58
|
+
${this.isSet?o`<div class="has-set">*此题设置了跳题逻辑</div>`:this.isEdit?this._renderEditMode():this._renderViewMode()}
|
|
59
59
|
</div>
|
|
60
60
|
${this._renderModal()}
|
|
61
|
-
`}};var c
|
|
61
|
+
`}};var d;c.styles=e`
|
|
62
62
|
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; }
|
|
63
63
|
*, ::before, ::after { box-sizing: border-box; }
|
|
64
64
|
|
|
@@ -114,5 +114,5 @@ import{html as e,css as t,LitElement as o}from"lit";import{property as r}from"..
|
|
|
114
114
|
|
|
115
115
|
.radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }
|
|
116
116
|
.radio-item:last-child { margin-bottom: 0; }
|
|
117
|
-
`,s([r({type:Boolean,attribute:"is-edit"})],
|
|
117
|
+
`,s([r({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),s([r({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),s([r({type:Boolean,attribute:"is-key"})],c.prototype,"isKey",2),s([r({type:Number,attribute:"answer-check-type"})],c.prototype,"answerCheckType",2),s([r({type:Boolean,attribute:"show-other-option"})],c.prototype,"showOtherOption",2),s([r({type:Boolean,attribute:"show-rich-text"})],c.prototype,"showRichText",2),s([r({type:Boolean,attribute:"hide-add-rich-text"})],c.prototype,"hideAddRichText",2),s([r({type:Boolean,attribute:"page-end"})],c.prototype,"pageEnd",2),s([r({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),s([i()],c.prototype,"_modalOpen",2),s([i()],c.prototype,"_currentCheckType",2),c=s([(d="qxs-subject-action",function(e){return customElements.get(d)||customElements.define(d,e),e})],c);export{c as QxsSubjectAction};
|
|
118
118
|
//# sourceMappingURL=action.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.mjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst iconEdit = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>`\nconst iconDelete = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>`\nconst iconCheck = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg>`\nconst iconSort = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z\"/></svg>`\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n <button class=\"text-btn text-btn--danger\" @click=${() => this._emit('delete')}>删除</button>\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","html","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","tagName","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"8fAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGJC,CAAA,uUACEA,CAAA,yTACDA,CAAA,iOACDA,CAAA,wKAGV,IAAMC,EAAN,cAA+BC,EAA/BC,WAAAA,GAAAC,SAAAC,WA2D8CC,KAAAC,QAAS,EACVD,KAAAE,OAAQ,EACRF,KAAAG,OAAQ,EACEH,KAAAI,gBAAkB,EACjBJ,KAAAK,iBAAkB,EACrBL,KAAAM,cAAe,EACXN,KAAAO,iBAAkB,EAC5BP,KAAAQ,SAAU,EACMR,KAAAS,uBAAyB,EAEpFT,KAAQU,YAAa,EACrBV,KAAQW,kBAAoB,CAAA,CAErCC,OAAAA,CAAQC,GACFA,EAAQC,IAAI,qBACdd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GAIf,OAHKoB,eAAeC,IAAIZ,IACtBW,eAAeE,OAAOb,EAAST,GAE1BA,CACT,IAeWhC"}
|
|
1
|
+
{"version":3,"file":"action.mjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","html","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","tagName","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"8fAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAId,IAAMC,EAAN,cAA+BC,EAA/BC,WAAAA,GAAAC,SAAAC,WA2D8CC,KAAAC,QAAS,EACVD,KAAAE,OAAQ,EACRF,KAAAG,OAAQ,EACEH,KAAAI,gBAAkB,EACjBJ,KAAAK,iBAAkB,EACrBL,KAAAM,cAAe,EACXN,KAAAO,iBAAkB,EAC5BP,KAAAQ,SAAU,EACMR,KAAAS,uBAAyB,EAEpFT,KAAQU,YAAa,EACrBV,KAAQW,kBAAoB,CAAA,CAErCC,OAAAA,CAAQC,GACFA,EAAQC,IAAI,qBACdd,KAAKW,kBAAoBX,KAAKI,gBAElC,CAEQW,KAAAA,CAAMC,EAAcC,GAC1BjB,KAAKkB,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,eAAYK,GACV,OAAO9B,EAAe+B,KAAKC,GAAKA,EAAE/B,QAAUO,KAAKI,kBAAkBV,OAAS,EAC9E,CAEQ+B,eAAAA,GACN,OAAOC,CAAA;;UAEA1B,KAAKO,gBAIJ,GAHAmB,CAAA;0CAC8B,IAAM1B,KAAKe,MAAM;;UAGjDf,KAAKK,gBACHqB,CAAA;0CAC8B,KAAQ1B,KAAKU,YAAa;;8CAEtBV,KAAKG,iBAAkBwB,GAAa3B,KAAKe,MAAM,UAAW,CAAEtB,MAAQkC,EAAEC,OAA4BC;;;UAIpI;;;sEAG0D,IAAM7B,KAAKe,MAAM;4DAC3B,IAAMf,KAAKe,MAAM;;KAG3E,CAEQe,eAAAA,GACN,OAAOJ,CAAA;;UAED1B,KAAKK,gBACHqB,CAAA;;uDAE2C1B,KAAKG;;sCAEtBH,KAAKs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W,uBA/D3BjD,EA+DkDkD,UAAA,kBAAA,GACHL,EAAA,CAAzDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,oBAhE3BjD,EAgE+CkD,UAAA,eAAA,GACIL,EAAA,CAA7DC,EAAS,CAAEC,KAAMC,QAASC,UAAW,wBAjE3BjD,EAiEmDkD,UAAA,kBAAA,GACVL,EAAA,CAAnDC,EAAS,CAAEC,KAAMC,QAASC,UAAW,cAlE3BjD,EAkEyCkD,UAAA,UAAA,GACgBL,EAAA,CAAnEC,EAAS,CAAEC,KAAMI,OAAQF,UAAW,+BAnE1BjD,EAmEyDkD,UAAA,yBAAA,GAEnDL,EAAA,CAAhBO,KArEUpD,EAqEMkD,UAAA,aAAA,GACAL,EAAA,CAAhBO,KAtEUpD,EAsEMkD,UAAA,oBAAA,GAtENlD,EAAN6C,EAAA,EAhBoBH,EAeR,qBAdV,SAAUT,GAIf,OAHKoB,eAAeC,IAAIZ,IACtBW,eAAeE,OAAOb,EAAST,GAE1BA,CACT,IAUWjC"}
|
package/es/subject/list.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as
|
|
1
|
+
import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import a from"sortablejs";import{safeCustomElement as o}from"../base/define.mjs";import{uid as l}from"../base/uid.mjs";import{SubjectError as n}from"./single.mjs";import{SubjectType as d}from"./types.mjs";import"./action.mjs";import"./blank-fill.mjs";import"./layout.mjs";import"./text-fill.mjs";import"./scale.mjs";import"./page-end.mjs";import"./type.mjs";var c=Object.defineProperty,h=Object.getOwnPropertyDescriptor,p=(t,e,s,i)=>{for(var r,a=i>1?void 0:i?h(e,s):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(i?r(e,s,a):r(a))||a);return i&&a&&c(e,s,a),a};d.SINGLE,d.MULTIPLE,d.SORT,d.BLANK_FILL,d.TEXT_FILL,d.SCALE;let m=class extends e{constructor(){super(...arguments),this.isPreview=!1,this.useModelAttr=null,this._modelValueAttr="",this.uploadImage=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this._list=[],this._sortMode=!1,this._sortable=null,this._initialDataProcessed=!1}get modelValue(){return JSON.stringify(this._list)}set modelValue(t){if(t&&t!==this._modelValueAttr){this._modelValueAttr=t;try{const e=JSON.parse(t);Array.isArray(e)&&(this._list=e.map(t=>({...t,customId:t.customId||l()})),this.requestUpdate())}catch{}}}get _useModel(){return"true"===this.useModelAttr||""===this.useModelAttr||this.hasAttribute("use-model")}get subjectList(){return this._list}set subjectList(t){if(t){if("string"==typeof t)try{t=JSON.parse(t)}catch{return this._list=[],void this.requestUpdate()}if(!Array.isArray(t))return this._list=[],void this.requestUpdate();this._list=t.map(t=>({...t,customId:t.customId||l()})),this.requestUpdate()}else this._list=[]}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),"subject-list"===t&&s&&!this._list.length){if(s.includes("[object Object]"))return;try{const t=JSON.parse(s);Array.isArray(t)&&(this._list=t.map(t=>({...t,customId:t.customId||l()})),this.requestUpdate())}catch{}}}get _isPreviewValue(){const t=this.isPreview;return"string"==typeof t?"false"!==t:!!t}connectedCallback(){super.connectedCallback(),this._initialDataProcessed||(this._initialDataProcessed=!0,Promise.resolve().then(()=>{0===this._list.length&&this._processAttributeList()}))}_processAttributeList(){const t=this.getAttribute("subject-list");if(t&&"[]"!==t&&!t.includes("[object Object]"))try{const e=JSON.parse(t);Array.isArray(e)&&e.length>0&&(this._list=e.map(t=>({...t,customId:t.customId||l()})),this.requestUpdate())}catch{}}firstUpdated(){this.updateComplete.then(()=>this._initSortable())}updated(t){t.has("_sortMode")&&(this._sortable?.destroy(),this._sortable=null,this.updateComplete.then(()=>this._initSortable())),t.has("_list")&&this._sortMode&&setTimeout(()=>{this._sortable&&(this._sortable.destroy(),this._sortable=null),this._initSortable()},50)}disconnectedCallback(){super.disconnectedCallback(),this._sortable?.destroy(),this._sortable=null}_initSortable(){if(!this._sortMode)return;this.querySelector(".sort-list")&&(this._sortable&&(this._sortable.destroy(),this._sortable=null),requestAnimationFrame(()=>{const t=this.querySelector(".sort-list");t&&!this._sortable&&(this._sortable=a.create(t,{handle:".sort-handle",animation:200,ghostClass:"sort-ghost",chosenClass:"sort-chosen",onEnd:t=>{const{oldIndex:e,newIndex:s}=t;if(void 0===e||void 0===s||e===s)return;const i=[...this._list],[r]=i.splice(e,1);i.splice(s,0,r),this._list=i,this._emitListChange()}}))}))}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_emitListChange(){this._emit("change",this._list),this._useModel&&(this._modelValueAttr=JSON.stringify(this._list),this._emit("list-change",this._list))}async toJSON(){const t=this.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-subject-rich-text");if(!t||0===t.length)return[];const e=[],s=[];for(const i of t)if("function"==typeof i.toJSON)try{const t=await i.toJSON();e.push(t)}catch(t){t instanceof n?s.push(t):s.push(new n(t.message||"未知错误","UNKNOWN","unknown"))}if(s.length>0)throw s;return e}async validate(){const t=this.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale");if(!t||0===t.length)return{valid:!0,errors:[]};const e=[];for(const s of t)if("function"==typeof s.validate){const t=s.validate();t?.length&&e.push(...t)}return{valid:0===e.length,errors:e}}get currentList(){return this._list}addSubject(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const i={customId:l(),answerType:t,title:"",answers:[],analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,isKey:!1,answerCheckType:1,examAnswerRelationType:s??0},r=[...this._list];"number"==typeof e&&e>=0?r.splice(e+1,0,i):r.push(i),this._list=r,this.requestUpdate(),this._emitListChange()}addExam(t){const e=[];t.forEach(t=>{const s={...t,customId:t.customId||l(),answers:t.answers?.map(t=>({...t,title:t.answer,answerId:t.examAnswerId,isCorrect:t.isCorrect}))||[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1};t.richTextContent||(s.answerType=t.examTypeEnum),e.push(s)}),this._list=[...this._list,...e],this._emitListChange()}uploadExcel(t){this._list=[...this._list,...t.map(t=>({...t,customId:t.customId||l(),isRealCanDel:!0}))],this._emitListChange()}setAnswerRelation(t,e,s){const i=this._list.find(t=>t.customId===e);if(i){const e=i.answers?.find(t=>t.customAnswerId===s);e&&(e.answerRelations=t)}this.requestUpdate(),this._emitListChange()}_orderIndex(t){let e=0,s=0;return this._list.forEach(i=>{e++,i.customId===t&&(s=e)}),s-1}_move(t,e){const s=[...this._list];"up"===e&&t>0?[s[t-1],s[t]]=[s[t],s[t-1]]:"down"===e&&t<s.length-1&&([s[t],s[t+1]]=[s[t+1],s[t]]),this._list=s,this._emitListChange()}_save(t,e){this._list=this._list.map((s,i)=>i===t?{...s,...e.detail,isEdit:!1,isSave:!0}:s),this._emitListChange()}_deleteByCustomId(t){this._list=this._list.filter(e=>e.customId!==t),this._emitListChange()}_delete(t){const e=[...this._list];e.splice(t,1),this._list=e,this._emitListChange()}_setEdit(t,e){this._list=this._list.map((s,i)=>i===t?{...s,isEdit:e}:s)}_renderItem(t,e){const i=this._orderIndex(t.customId),r=(t.isEdit,t.hasSet,t.isRealCanDel,this._isPreviewValue,t.examAnswerRelationType,t=>this._move(e,t.detail)),a=()=>this._deleteByCustomId(t.customId),o=t=>this._save(e,t),l=()=>this._setEdit(e,!0),n=t=>this.addSubject(t.detail?.type??t.detail,e);return[d.SINGLE,d.MULTIPLE,d.SORT].includes(t.answerType)?s`<qxs-subject-single
|
|
2
2
|
.title=${t.title||""}
|
|
3
3
|
.answerList=${t.answers||[]}
|
|
4
4
|
.uploadImage=${this.uploadImage}
|
|
@@ -17,7 +17,8 @@ import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"..
|
|
|
17
17
|
exam-expand=${t.examExpand||""}
|
|
18
18
|
custom-id=${t.customId||""}
|
|
19
19
|
exam-id=${t.examId??0}
|
|
20
|
-
@move=${
|
|
20
|
+
@move=${r} @delete=${a} @save=${o} @edit=${l} @add=${n}
|
|
21
|
+
@set-key=${t=>{this._list=this._list.map((s,i)=>i===e?{...s,isKey:t.detail.value}:s),this._emitListChange()}}
|
|
21
22
|
@set-relation=${t=>this._emit("set-relation",t.detail)}
|
|
22
23
|
></qxs-subject-single>`:t.answerType===d.BLANK_FILL?s`<qxs-blank-fill
|
|
23
24
|
.title=${t.title||""}
|
|
@@ -31,7 +32,7 @@ import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"..
|
|
|
31
32
|
rich-text-content=${t.examRichTextContent||""}
|
|
32
33
|
analysis=${t.analysis||""}
|
|
33
34
|
custom-id=${t.customId||""}
|
|
34
|
-
@move=${
|
|
35
|
+
@move=${r} @delete=${a} @save=${o} @edit=${l} @add=${n}
|
|
35
36
|
></qxs-blank-fill>`:t.answerType===d.TEXT_FILL?s`<qxs-text-fill
|
|
36
37
|
.title=${t.title||""}
|
|
37
38
|
.answerList=${t.answers||[]}
|
|
@@ -44,7 +45,7 @@ import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"..
|
|
|
44
45
|
rich-text-content=${t.examRichTextContent||""}
|
|
45
46
|
analysis=${t.analysis||""}
|
|
46
47
|
custom-id=${t.customId||""}
|
|
47
|
-
@move=${
|
|
48
|
+
@move=${r} @delete=${a} @save=${o} @edit=${l} @add=${n}
|
|
48
49
|
></qxs-text-fill>`:t.answerType===d.SCALE?s`<qxs-scale
|
|
49
50
|
.title=${t.title||""}
|
|
50
51
|
.answerList=${t.answers||[]}
|
|
@@ -56,7 +57,7 @@ import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"..
|
|
|
56
57
|
rich-text-content=${t.examRichTextContent||""}
|
|
57
58
|
analysis=${t.analysis||""}
|
|
58
59
|
custom-id=${t.customId||""}
|
|
59
|
-
@move=${
|
|
60
|
+
@move=${r} @delete=${a} @save=${o} @edit=${l} @add=${n}
|
|
60
61
|
></qxs-scale>`:s`<div style="color:#909399;padding:8px">未知题型: ${t.answerType}</div>`}render(){return s`
|
|
61
62
|
<div class="subject-list">
|
|
62
63
|
${this._list.map((t,e)=>this._renderItem(t,e))}
|
|
@@ -83,5 +84,5 @@ import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"..
|
|
|
83
84
|
.sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }
|
|
84
85
|
.sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
85
86
|
.sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }
|
|
86
|
-
`,p([i({attribute:"is-preview"})],m.prototype,"isPreview",2),p([i({type:Object})],m.prototype,"uploadImage",2),p([i({type:Array})],m.prototype,"subjectList",1),p([
|
|
87
|
+
`,p([i({attribute:"is-preview"})],m.prototype,"isPreview",2),p([i({attribute:"use-model"})],m.prototype,"useModelAttr",2),p([i({attribute:"model-value"})],m.prototype,"modelValue",1),p([i({type:Object})],m.prototype,"uploadImage",2),p([i({type:Array})],m.prototype,"subjectList",1),p([r()],m.prototype,"_list",2),p([r()],m.prototype,"_sortMode",2),m=p([o("qxs-subject-list")],m);export{m as QxsSubjectList};
|
|
87
88
|
//# sourceMappingURL=list.mjs.map
|
package/es/subject/list.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.mjs","sources":["../../../../packages/components-wc/src/subject/list.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport Sortable from 'sortablejs'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\n\n// 导入子组件以确保它们被注册为 Custom Elements\nimport './action'\nimport './blank-fill'\nimport './layout'\nimport './single'\nimport './text-fill'\nimport './scale'\nimport './page-end'\nimport './type'\n\nconst TYPE_LABEL: Record<string, string> = {\n [SubjectType.SINGLE]: '单选题', [SubjectType.MULTIPLE]: '多选题', [SubjectType.SORT]: '排序题',\n [SubjectType.BLANK_FILL]: '填空题', [SubjectType.TEXT_FILL]: '问答题', [SubjectType.SCALE]: '量表题',\n}\n\n@safeCustomElement('qxs-subject-list')\nexport class QxsSubjectList extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n *, ::before, ::after { box-sizing: border-box; }\n .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }\n .btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 12px; border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266; cursor: pointer; transition: all 0.2s; }\n .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }\n .subject-list { display: flex; flex-direction: column; }\n .subject-content { flex: 1; min-width: 0; }\n .ghost { opacity: 0.5; background: #ecf5ff; }\n .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }\n .sort-list { display: flex; flex-direction: column; gap: 8px; }\n .sort-item { display: flex; align-items: center; padding: 12px 16px; background: #f8f9fa; border: 1px solid #e4e7ed; border-radius: 6px; cursor: grab; transition: all 0.3s ease; }\n .sort-item:hover { background: #ecf5ff; border-color: #c6e2ff; }\n .sort-item:active { cursor: grabbing; }\n .sort-item.sort-ghost { opacity: 0.5; background: #ecf5ff; border: 2px dashed #409eff; }\n .sort-item.sort-chosen { background: #ecf5ff; border-color: #409eff; box-shadow: 0 4px 16px rgba(64,158,255,.3); transform: scale(1.02); }\n .sort-handle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 12px; color: #909399; flex-shrink: 0; }\n .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }\n .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }\n `\n\n\n\n @property({ attribute: 'is-preview' }) isPreview = false\n\n @property({ type: Object })\n uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = e => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array })\n get subjectList() { return this._list }\n\n set subjectList(v: any) {\n if (!v) {\n this._list = []\n return\n }\n if (typeof v === 'string') {\n try {\n v = JSON.parse(v)\n }\n catch {\n this._list = []\n this.requestUpdate()\n return\n }\n }\n if (!Array.isArray(v)) {\n this._list = []\n this.requestUpdate()\n return\n }\n this._list = v.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n super.attributeChangedCallback(name, oldVal, newVal)\n if (name === 'subject-list' && newVal && !this._list.length) {\n if (newVal.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(newVal)\n if (Array.isArray(parsed)) {\n this._list = parsed.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n }\n\n @state() private _list: any[] = []\n @state() private _sortMode = false\n private _sortable: Sortable | null = null\n\n private get _isPreviewValue(): boolean {\n const val = (this as any).isPreview\n return typeof val === 'string' ? val !== 'false' : !!val\n }\n\n private _initialDataProcessed = false\n\n connectedCallback() {\n super.connectedCallback()\n if (!this._initialDataProcessed) {\n this._initialDataProcessed = true\n Promise.resolve().then(() => {\n if (this._list.length === 0) {\n this._processAttributeList()\n }\n })\n }\n }\n\n private _processAttributeList() {\n const attr = this.getAttribute('subject-list')\n if (!attr || attr === '[]') { return }\n if (attr.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(attr)\n if (Array.isArray(parsed) && parsed.length > 0) {\n this._list = parsed.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n\n firstUpdated() {\n this.updateComplete.then(() => this._initSortable())\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('_sortMode')) {\n this._sortable?.destroy()\n this._sortable = null\n this.updateComplete.then(() => this._initSortable())\n }\n // Reinitialize Sortable when list changes in sort mode\n if (changed.has('_list') && this._sortMode) {\n // Small delay to let Lit finish DOM updates\n setTimeout(() => {\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n this._initSortable()\n }, 50)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._sortable?.destroy()\n this._sortable = null\n }\n\n private _initSortable() {\n if (!this._sortMode) { return }\n const el = this.querySelector<HTMLElement>('.sort-list')\n if (!el) { return }\n\n // Destroy existing instance first\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n\n // Small delay to ensure DOM is ready after previous destroy\n requestAnimationFrame(() => {\n const currentEl = this.querySelector<HTMLElement>('.sort-list')\n if (!currentEl || this._sortable) { return }\n\n this._sortable = Sortable.create(currentEl, {\n handle: '.sort-handle',\n animation: 200,\n ghostClass: 'sort-ghost',\n chosenClass: 'sort-chosen',\n onEnd: (evt) => {\n const { oldIndex, newIndex } = evt\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) { return }\n const arr = [...this._list]\n const [item] = arr.splice(oldIndex, 1)\n arr.splice(newIndex, 0, item)\n this._list = arr\n this._emit('change', this._list)\n },\n })\n })\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n async toJSON(): Promise<any[]> {\n const subjectEls = this.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-subject-rich-text',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return []\n }\n\n const results: any[] = []\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.toJSON === 'function') {\n try {\n const data = await el.toJSON()\n results.push(data)\n }\n catch (err: any) {\n if (err instanceof SubjectError) {\n errors.push(err)\n }\n else {\n errors.push(new SubjectError(err.message || '未知错误', 'UNKNOWN', 'unknown'))\n }\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors\n }\n\n return results\n }\n\n async validate(): Promise<{ valid: boolean, errors: SubjectError[] }> {\n const subjectEls = this.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return { valid: true, errors: [] }\n }\n\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.validate === 'function') {\n const errs = el.validate()\n if (errs?.length) {\n errors.push(...errs)\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n }\n\n // ── public API ────────────────────────────────────────────────\n get currentList() { return this._list }\n\n addSubject(type: string, index?: number, examAnswerRelationType: number | null = null) {\n const item = {\n customId: uid(), answerType: type, title: '',\n answers: [], analysis: '', scaleQuestionList: [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n isKey: false, answerCheckType: 1,\n examAnswerRelationType: examAnswerRelationType ?? 0,\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, item)\n }\n else { arr.push(item) }\n this._list = arr\n this.requestUpdate()\n this._emit('change', this._list)\n }\n\n addExam(items: any[]) {\n const newItems: any[] = []\n items.forEach((v: any) => {\n const item: any = {\n ...v,\n customId: v.customId || uid(),\n answers: v.answers?.map((c: any) => ({ ...c, title: c.answer, answerId: c.examAnswerId, isCorrect: c.isCorrect })) || [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n }\n if (!v.richTextContent) {\n item.answerType = v.examTypeEnum\n }\n newItems.push(item)\n })\n this._list = [...this._list, ...newItems]\n this._emit('change', this._list)\n }\n\n uploadExcel(list: any[]) {\n this._list = [...this._list, ...list.map((i: any) => ({ ...i, customId: i.customId || uid(), isRealCanDel: true }))]\n this._emit('change', this._list)\n }\n\n setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n const ans = item.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (ans) { ans.answerRelations = answerRelations }\n }\n this.requestUpdate()\n this._emit('change', this._list)\n }\n\n // ── private helpers ───────────────────────────────────────────\n private _orderIndex(customId: string) {\n let n = 0; let out = 0\n this._list.forEach((v: any) => {\n n++; if (v.customId === customId) { out = n }\n })\n return out - 1\n }\n\n private _move(index: number, dir: 'up' | 'down') {\n const arr = [...this._list]\n if (dir === 'up' && index > 0) { [arr[index - 1], arr[index]] = [arr[index], arr[index - 1]] }\n else if (dir === 'down' && index < arr.length - 1) { [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]] }\n this._list = arr\n this._emit('change', this._list)\n }\n\n private _save(index: number, e: CustomEvent) {\n console.log('_save receive detail:', JSON.stringify(e.detail))\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, ...e.detail, isEdit: false, isSave: true } : item,\n )\n console.log('_save after merge:', JSON.stringify(this._list[index]))\n this._emit('change', this._list)\n }\n\n private _deleteByCustomId(customId: string) {\n this._list = this._list.filter(item => item.customId !== customId)\n this._emit('change', this._list)\n }\n\n private _delete(index: number) {\n const arr = [...this._list]\n arr.splice(index, 1)\n this._list = arr\n this._emit('change', this._list)\n }\n\n private _setEdit(index: number, val: boolean) {\n this._list = this._list.map((item, i) => i === index ? { ...item, isEdit: val } : item)\n }\n\n private _renderItem(item: any, index: number) {\n const common = {\n 'order-index': this._orderIndex(item.customId),\n '?is-edit': item.isEdit || false,\n '?is-set': item.hasSet || false,\n '?is-save': !item.isRealCanDel,\n '?show-action': !this._isPreviewValue,\n 'exam-answer-relation-type': item.examAnswerRelationType ?? 0,\n }\n const onMove = (e: CustomEvent) => this._move(index, e.detail as 'up' | 'down')\n const onDelete = () => this._deleteByCustomId(item.customId)\n const onSave = (e: CustomEvent) => this._save(index, e)\n const onEdit = () => this._setEdit(index, true)\n const onAdd = (e: CustomEvent) => this.addSubject(e.detail?.type ?? e.detail, index)\n\n if ([SubjectType.SINGLE, SubjectType.MULTIPLE, SubjectType.SORT].includes(item.answerType)) {\n return html`<qxs-subject-single\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit}\n ?is-set=${item.hasSet}\n ?is-save=${!item.isRealCanDel}\n ?show-action=${!this._isPreviewValue}\n ?is-key=${item.isKey}\n question-type=${String(item.answerType)}\n answer-check-type=${item.answerCheckType ?? 1}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n least-answer-count=${item.leastAnswerCount ?? 2}\n exam-expand=${item.examExpand || ''}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @set-relation=${(e: CustomEvent) => this._emit('set-relation', e.detail)}\n ></qxs-subject-single>`\n }\n if (item.answerType === SubjectType.BLANK_FILL) {\n return html`<qxs-blank-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-blank-fill>`\n }\n if (item.answerType === SubjectType.TEXT_FILL) {\n return html`<qxs-text-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-text-fill>`\n }\n if (item.answerType === SubjectType.SCALE) {\n return html`<qxs-scale\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .scaleQuestions=${item.scaleQuestionList || []}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-scale>`\n }\n return html`<div style=\"color:#909399;padding:8px\">未知题型: ${item.answerType}</div>`\n }\n\n render() {\n return html`\n <div class=\"subject-list\">\n ${this._list.map((item, index) => this._renderItem(item, index))}\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectType","SINGLE","MULTIPLE","SORT","BLANK_FILL","TEXT_FILL","SCALE","QxsSubjectList","LitElement","constructor","super","arguments","this","isPreview","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_list","_sortMode","_sortable","_initialDataProcessed","subjectList","v","JSON","parse","requestUpdate","Array","isArray","map","i","customId","uid","attributeChangedCallback","name","oldVal","newVal","length","includes","parsed","_isPreviewValue","val","connectedCallback","then","_processAttributeList","attr","getAttribute","firstUpdated","updateComplete","_initSortable","updated","changed","has","destroy","setTimeout","disconnectedCallback","querySelector","requestAnimationFrame","currentEl","Sortable","create","handle","animation","ghostClass","chosenClass","onEnd","evt","oldIndex","newIndex","arr","item","splice","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","toJSON","subjectEls","querySelectorAll","results","errors","el","data","push","err","SubjectError","message","validate","valid","errs","currentList","addSubject","type","index","examAnswerRelationType","undefined","answerType","title","answers","analysis","scaleQuestionList","isEdit","isSave","isRealCanDel","hasSet","isKey","answerCheckType","addExam","items","newItems","forEach","c","answer","answerId","examAnswerId","isCorrect","richTextContent","examTypeEnum","uploadExcel","list","setAnswerRelation","answerRelations","customAnswerId","find","ans","_orderIndex","n","out","_move","dir","_save","_deleteByCustomId","filter","_delete","_setEdit","_renderItem","common","onMove","onDelete","onSave","onEdit","onAdd","html","String","examRichTextContent","leastAnswerCount","examExpand","examId","examAnswerSettingVO","render","styles","css","__decorateClass","property","attribute","prototype","Object","state","safeCustomElement"],"mappings":"o2BAoBGA,EAAYC,OAAiBD,EAAYE,SAAmBF,EAAYG,KACxEH,EAAYI,WAAqBJ,EAAYK,UAAoBL,EAAYM,MAIzE,IAAMC,EAAN,cAA6BC,EAA7BC,WAAAA,GAAAC,SAAAC,WA2BkCC,KAAAC,WAAY,EAGnDD,KAAA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ED9I,KAAKgB,MAAMW,IAAI,CAACyC,EAAMyB,IAAU7F,KAAKuI,YAAYnE,EAAMyB;;KAG/D,GA5bWlG,EACJ2J,OAASC,CAAA;;;;;;;;;;;;;;;;;;;;;;KA0BuBC,EAAA,CAAtCC,EAAS,CAAEC,UAAW,gBA3BZ/J,EA2B4BgK,UAAA,YAAA,GAGvCH,EAAA,CADCC,EAAS,CAAE7D,KAAMgE,UA7BPjK,EA8BXgK,UAAA,cAAA,GAUIH,EAAA,CADHC,EAAS,CAAE7D,KAAMnE,SAvCP9B,EAwCPgK,UAAA,cAAA,GA6CaH,EAAA,CAAhBK,KArFUlK,EAqFMgK,UAAA,QAAA,GACAH,EAAA,CAAhBK,KAtFUlK,EAsFMgK,UAAA,YAAA,GAtFNhK,EAAN6J,EAAA,CADNM,EAAkB,qBACNnK"}
|
|
1
|
+
{"version":3,"file":"list.mjs","sources":["../../../../packages/components-wc/src/subject/list.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport Sortable from 'sortablejs'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\n\n// 导入子组件以确保它们被注册为 Custom Elements\nimport './action'\nimport './blank-fill'\nimport './layout'\nimport './single'\nimport './text-fill'\nimport './scale'\nimport './page-end'\nimport './type'\n\nconst TYPE_LABEL: Record<string, string> = {\n [SubjectType.SINGLE]: '单选题', [SubjectType.MULTIPLE]: '多选题', [SubjectType.SORT]: '排序题',\n [SubjectType.BLANK_FILL]: '填空题', [SubjectType.TEXT_FILL]: '问答题', [SubjectType.SCALE]: '量表题',\n}\n\n@safeCustomElement('qxs-subject-list')\nexport class QxsSubjectList extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n *, ::before, ::after { box-sizing: border-box; }\n .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }\n .btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 12px; border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266; cursor: pointer; transition: all 0.2s; }\n .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }\n .subject-list { display: flex; flex-direction: column; }\n .subject-content { flex: 1; min-width: 0; }\n .ghost { opacity: 0.5; background: #ecf5ff; }\n .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }\n .sort-list { display: flex; flex-direction: column; gap: 8px; }\n .sort-item { display: flex; align-items: center; padding: 12px 16px; background: #f8f9fa; border: 1px solid #e4e7ed; border-radius: 6px; cursor: grab; transition: all 0.3s ease; }\n .sort-item:hover { background: #ecf5ff; border-color: #c6e2ff; }\n .sort-item:active { cursor: grabbing; }\n .sort-item.sort-ghost { opacity: 0.5; background: #ecf5ff; border: 2px dashed #409eff; }\n .sort-item.sort-chosen { background: #ecf5ff; border-color: #409eff; box-shadow: 0 4px 16px rgba(64,158,255,.3); transform: scale(1.02); }\n .sort-handle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 12px; color: #909399; flex-shrink: 0; }\n .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }\n .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }\n `\n\n\n\n @property({ attribute: 'is-preview' }) isPreview = false\n\n // use-model: enables two-way binding via model-value attribute + list-change event\n @property({ attribute: 'use-model' }) useModelAttr: string | null = null\n @property({ attribute: 'model-value' })\n get modelValue(): string { return JSON.stringify(this._list) }\n set modelValue(v: string) {\n if (!v || v === this._modelValueAttr) { return }\n this._modelValueAttr = v\n try {\n const parsed = JSON.parse(v)\n if (Array.isArray(parsed)) {\n this._list = parsed.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n }\n catch { /* invalid JSON, ignore */ }\n }\n\n private get _useModel(): boolean {\n return this.useModelAttr === 'true' || this.useModelAttr === '' || this.hasAttribute('use-model')\n }\n\n private _modelValueAttr = ''\n\n @property({ type: Object })\n uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = e => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array })\n get subjectList() { return this._list }\n\n set subjectList(v: any) {\n if (!v) {\n this._list = []\n return\n }\n if (typeof v === 'string') {\n try {\n v = JSON.parse(v)\n }\n catch {\n this._list = []\n this.requestUpdate()\n return\n }\n }\n if (!Array.isArray(v)) {\n this._list = []\n this.requestUpdate()\n return\n }\n this._list = v.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n super.attributeChangedCallback(name, oldVal, newVal)\n if (name === 'subject-list' && newVal && !this._list.length) {\n if (newVal.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(newVal)\n if (Array.isArray(parsed)) {\n this._list = parsed.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n }\n\n @state() private _list: any[] = []\n @state() private _sortMode = false\n private _sortable: Sortable | null = null\n\n private get _isPreviewValue(): boolean {\n const val = (this as any).isPreview\n return typeof val === 'string' ? val !== 'false' : !!val\n }\n\n private _initialDataProcessed = false\n\n connectedCallback() {\n super.connectedCallback()\n if (!this._initialDataProcessed) {\n this._initialDataProcessed = true\n Promise.resolve().then(() => {\n if (this._list.length === 0) {\n this._processAttributeList()\n }\n })\n }\n }\n\n private _processAttributeList() {\n const attr = this.getAttribute('subject-list')\n if (!attr || attr === '[]') { return }\n if (attr.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(attr)\n if (Array.isArray(parsed) && parsed.length > 0) {\n this._list = parsed.map((i: any) => ({ ...i, customId: i.customId || uid() }))\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n\n firstUpdated() {\n this.updateComplete.then(() => this._initSortable())\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('_sortMode')) {\n this._sortable?.destroy()\n this._sortable = null\n this.updateComplete.then(() => this._initSortable())\n }\n // Reinitialize Sortable when list changes in sort mode\n if (changed.has('_list') && this._sortMode) {\n // Small delay to let Lit finish DOM updates\n setTimeout(() => {\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n this._initSortable()\n }, 50)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._sortable?.destroy()\n this._sortable = null\n }\n\n private _initSortable() {\n if (!this._sortMode) { return }\n const el = this.querySelector<HTMLElement>('.sort-list')\n if (!el) { return }\n\n // Destroy existing instance first\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n\n // Small delay to ensure DOM is ready after previous destroy\n requestAnimationFrame(() => {\n const currentEl = this.querySelector<HTMLElement>('.sort-list')\n if (!currentEl || this._sortable) { return }\n\n this._sortable = Sortable.create(currentEl, {\n handle: '.sort-handle',\n animation: 200,\n ghostClass: 'sort-ghost',\n chosenClass: 'sort-chosen',\n onEnd: (evt) => {\n const { oldIndex, newIndex } = evt\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) { return }\n const arr = [...this._list]\n const [item] = arr.splice(oldIndex, 1)\n arr.splice(newIndex, 0, item)\n this._list = arr\n this._emitListChange()\n },\n })\n })\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _emitListChange() {\n this._emit('change', this._list)\n if (this._useModel) {\n this._modelValueAttr = JSON.stringify(this._list)\n this._emit('list-change', this._list)\n }\n }\n\n async toJSON(): Promise<any[]> {\n const subjectEls = this.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-subject-rich-text',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return []\n }\n\n const results: any[] = []\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.toJSON === 'function') {\n try {\n const data = await el.toJSON()\n results.push(data)\n }\n catch (err: any) {\n if (err instanceof SubjectError) {\n errors.push(err)\n }\n else {\n errors.push(new SubjectError(err.message || '未知错误', 'UNKNOWN', 'unknown'))\n }\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors\n }\n\n return results\n }\n\n async validate(): Promise<{ valid: boolean, errors: SubjectError[] }> {\n const subjectEls = this.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return { valid: true, errors: [] }\n }\n\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.validate === 'function') {\n const errs = el.validate()\n if (errs?.length) {\n errors.push(...errs)\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n }\n\n // ── public API ────────────────────────────────────────────────\n get currentList() { return this._list }\n\n addSubject(type: string, index?: number, examAnswerRelationType: number | null = null) {\n const item = {\n customId: uid(), answerType: type, title: '',\n answers: [], analysis: '', scaleQuestionList: [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n isKey: false, answerCheckType: 1,\n examAnswerRelationType: examAnswerRelationType ?? 0,\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, item)\n }\n else { arr.push(item) }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n }\n\n addExam(items: any[]) {\n const newItems: any[] = []\n items.forEach((v: any) => {\n const item: any = {\n ...v,\n customId: v.customId || uid(),\n answers: v.answers?.map((c: any) => ({ ...c, title: c.answer, answerId: c.examAnswerId, isCorrect: c.isCorrect })) || [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n }\n if (!v.richTextContent) {\n item.answerType = v.examTypeEnum\n }\n newItems.push(item)\n })\n this._list = [...this._list, ...newItems]\n this._emitListChange()\n }\n\n uploadExcel(list: any[]) {\n this._list = [...this._list, ...list.map((i: any) => ({ ...i, customId: i.customId || uid(), isRealCanDel: true }))]\n this._emitListChange()\n }\n\n setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n const ans = item.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (ans) { ans.answerRelations = answerRelations }\n }\n this.requestUpdate()\n this._emitListChange()\n }\n\n // ── private helpers ───────────────────────────────────────────\n private _orderIndex(customId: string) {\n let n = 0; let out = 0\n this._list.forEach((v: any) => {\n n++; if (v.customId === customId) { out = n }\n })\n return out - 1\n }\n\n private _move(index: number, dir: 'up' | 'down') {\n const arr = [...this._list]\n if (dir === 'up' && index > 0) { [arr[index - 1], arr[index]] = [arr[index], arr[index - 1]] }\n else if (dir === 'down' && index < arr.length - 1) { [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]] }\n this._list = arr\n this._emitListChange()\n }\n\n private _save(index: number, e: CustomEvent) {\n console.log('_save receive detail:', JSON.stringify(e.detail))\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, ...e.detail, isEdit: false, isSave: true } : item,\n )\n console.log('_save after merge:', JSON.stringify(this._list[index]))\n this._emitListChange()\n }\n\n private _deleteByCustomId(customId: string) {\n this._list = this._list.filter(item => item.customId !== customId)\n this._emitListChange()\n }\n\n private _delete(index: number) {\n const arr = [...this._list]\n arr.splice(index, 1)\n this._list = arr\n this._emitListChange()\n }\n\n private _setEdit(index: number, val: boolean) {\n this._list = this._list.map((item, i) => i === index ? { ...item, isEdit: val } : item)\n }\n\n private _renderItem(item: any, index: number) {\n const common = {\n 'order-index': this._orderIndex(item.customId),\n '?is-edit': item.isEdit || false,\n '?is-set': item.hasSet || false,\n '?is-save': !item.isRealCanDel,\n '?show-action': !this._isPreviewValue,\n 'exam-answer-relation-type': item.examAnswerRelationType ?? 0,\n }\n const onMove = (e: CustomEvent) => this._move(index, e.detail as 'up' | 'down')\n const onDelete = () => this._deleteByCustomId(item.customId)\n const onSave = (e: CustomEvent) => this._save(index, e)\n const onEdit = () => this._setEdit(index, true)\n const onAdd = (e: CustomEvent) => this.addSubject(e.detail?.type ?? e.detail, index)\n\n if ([SubjectType.SINGLE, SubjectType.MULTIPLE, SubjectType.SORT].includes(item.answerType)) {\n return html`<qxs-subject-single\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit}\n ?is-set=${item.hasSet}\n ?is-save=${!item.isRealCanDel}\n ?show-action=${!this._isPreviewValue}\n ?is-key=${item.isKey}\n question-type=${String(item.answerType)}\n answer-check-type=${item.answerCheckType ?? 1}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n least-answer-count=${item.leastAnswerCount ?? 2}\n exam-expand=${item.examExpand || ''}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @set-key=${(e: CustomEvent) => {\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, isKey: e.detail.value } : item\n )\n this._emitListChange()\n }}\n @set-relation=${(e: CustomEvent) => this._emit('set-relation', e.detail)}\n ></qxs-subject-single>`\n }\n if (item.answerType === SubjectType.BLANK_FILL) {\n return html`<qxs-blank-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-blank-fill>`\n }\n if (item.answerType === SubjectType.TEXT_FILL) {\n return html`<qxs-text-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-text-fill>`\n }\n if (item.answerType === SubjectType.SCALE) {\n return html`<qxs-scale\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .scaleQuestions=${item.scaleQuestionList || []}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-scale>`\n }\n return html`<div style=\"color:#909399;padding:8px\">未知题型: ${item.answerType}</div>`\n }\n\n render() {\n return html`\n <div class=\"subject-list\">\n ${this._list.map((item, index) => this._renderItem(item, index))}\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectType","SINGLE","MULTIPLE","SORT","BLANK_FILL","TEXT_FILL","SCALE","QxsSubjectList","LitElement","constructor","super","arguments","this","isPreview","useModelAttr","_modelValueAttr","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_list","_sortMode","_sortable","_initialDataProcessed","modelValue","JSON","stringify","v","parsed","parse","Array","isArray","map","i","customId","uid","requestUpdate","_useModel","hasAttribute","subjectList","attributeChangedCallback","name","oldVal","newVal","length","includes","_isPreviewValue","val","connectedCallback","then","_processAttributeList","attr","getAttribute","firstUpdated","updateComplete","_initSortable","updated","changed","has","destroy","setTimeout","disconnectedCallback","querySelector","requestAnimationFrame","currentEl","Sortable","create","handle","animation","ghostClass","chosenClass","onEnd","evt","oldIndex","newIndex","arr","item","splice","_emitListChange","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","toJSON","subjectEls","querySelectorAll","results","errors","el","data","push","err","SubjectError","message","validate","valid","errs","currentList","addSubject","type","index","examAnswerRelationType","undefined","answerType","title","answers","analysis","scaleQuestionList","isEdit","isSave","isRealCanDel","hasSet","isKey","answerCheckType","addExam","items","newItems","forEach","c","answer","answerId","examAnswerId","isCorrect","richTextContent","examTypeEnum","uploadExcel","list","setAnswerRelation","answerRelations","customAnswerId","find","ans","_orderIndex","n","out","_move","dir","_save","_deleteByCustomId","filter","_delete","_setEdit","_renderItem","common","onMove","onDelete","onSave","onEdit","onAdd","html","String","examRichTextContent","leastAnswerCount","examExpand","examId","value","examAnswerSettingVO","render","styles","css","__decorateClass","property","attribute","prototype","Object","state","safeCustomElement"],"mappings":"o2BAoBGA,EAAYC,OAAiBD,EAAYE,SAAmBF,EAAYG,KACxEH,EAAYI,WAAqBJ,EAAYK,UAAoBL,EAAYM,MAIzE,IAAMC,EAAN,cAA6BC,EAA7BC,WAAAA,GAAAC,SAAAC,WA2BkCC,KAAAC,WA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