@qxs-bns/components-wc 0.0.30 → 0.0.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/es/editor/blocksuite-editor.mjs +166 -357
  2. package/es/editor/blocksuite-editor.mjs.map +1 -1
  3. package/es/editor/toolbar.mjs +2 -0
  4. package/es/editor/toolbar.mjs.map +1 -0
  5. package/es/subject/action.mjs +7 -8
  6. package/es/subject/action.mjs.map +1 -1
  7. package/es/subject/blank-fill.mjs +243 -132
  8. package/es/subject/blank-fill.mjs.map +1 -1
  9. package/es/subject/layout.mjs +4 -4
  10. package/es/subject/layout.mjs.map +1 -1
  11. package/es/subject/page-end.mjs +1 -1
  12. package/es/subject/page-end.mjs.map +1 -1
  13. package/es/subject/scale.mjs +165 -126
  14. package/es/subject/scale.mjs.map +1 -1
  15. package/es/subject/shared-methods.mjs +2 -0
  16. package/es/subject/shared-methods.mjs.map +1 -0
  17. package/es/subject/shared-styles.mjs +75 -0
  18. package/es/subject/shared-styles.mjs.map +1 -0
  19. package/es/subject/single.mjs +243 -187
  20. package/es/subject/single.mjs.map +1 -1
  21. package/es/subject/sortable.mjs +7 -7
  22. package/es/subject/sortable.mjs.map +1 -1
  23. package/es/subject/text-fill.mjs +273 -138
  24. package/es/subject/text-fill.mjs.map +1 -1
  25. package/lib/editor/blocksuite-editor.cjs +166 -357
  26. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  27. package/lib/editor/toolbar.cjs +2 -0
  28. package/lib/editor/toolbar.cjs.map +1 -0
  29. package/lib/subject/action.cjs +33 -34
  30. package/lib/subject/action.cjs.map +1 -1
  31. package/lib/subject/blank-fill.cjs +247 -136
  32. package/lib/subject/blank-fill.cjs.map +1 -1
  33. package/lib/subject/layout.cjs +2 -2
  34. package/lib/subject/layout.cjs.map +1 -1
  35. package/lib/subject/page-end.cjs +2 -2
  36. package/lib/subject/page-end.cjs.map +1 -1
  37. package/lib/subject/scale.cjs +165 -126
  38. package/lib/subject/scale.cjs.map +1 -1
  39. package/lib/subject/shared-methods.cjs +2 -0
  40. package/lib/subject/shared-methods.cjs.map +1 -0
  41. package/lib/subject/shared-styles.cjs +75 -0
  42. package/lib/subject/shared-styles.cjs.map +1 -0
  43. package/lib/subject/single.cjs +243 -187
  44. package/lib/subject/single.cjs.map +1 -1
  45. package/lib/subject/sortable.cjs +1 -1
  46. package/lib/subject/sortable.cjs.map +1 -1
  47. package/lib/subject/text-fill.cjs +273 -138
  48. package/lib/subject/text-fill.cjs.map +1 -1
  49. package/package.json +1 -1
@@ -1,12 +1,17 @@
1
- "use strict";var t=require("lit"),e=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("./single.cjs"),r=require("./sorting-card.cjs"),o=require("./title-prefix.cjs"),a=require("./types.cjs"),n=Object.defineProperty,l=Object.getOwnPropertyDescriptor,p=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?l(e,s):e,a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&n(e,s,o),o};function h(){return{title:""}}function c(){return Array.from({length:5},h)}function d(t){const e={...t,title:i.trimText(t?.title??t?.answer??"")},s=t?.answerId??t?.examAnswerId;return void 0!==s&&(e.answerId=s),delete e.answer,delete e.examAnswerId,delete e.isCorrect,e}function x(t,e){const s={...d(t),orderIndex:e+1,answer:i.trimText(t?.title??t?.answer??"")};return s.title=i.trimText(s.title??""),void 0!==s.answerId&&(s.examAnswerId=s.answerId),void 0===s.answerId&&delete s.answerId,delete s.isCorrect,s}const u=t.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,y=t.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;exports.QxsScale=class extends t.LitElement{constructor(){super(...arguments),this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["hide-add-rich-text"]=!1,this["show-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this.sorting=!1,this["show-analysis"]=!1,this.analysis="",this["rich-text-content"]="",this["exam-answer-relation-type"]=0,this["upload-image"]=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this._answers=c(),this._scaleQuestions=[],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this["model-value"]="",this["use-model"]=!1,this.TITLE_MAX=200}get"answer-list"(){return this._answers}set"answer-list"(t){const e=function(t){return Array.isArray(t)?t.map(d):[]}(t);this._answers=e.length?e:c(),this.requestUpdate("answer-list")}get"scale-question-list"(){return this._scaleQuestions}set"scale-question-list"(t){this._scaleQuestions=function(t){return Array.isArray(t)?t.map(t=>String(t??"").trim()).filter(Boolean):[]}(t),this.requestUpdate("scale-question-list")}get"scale-questions"(){return this._scaleQuestions}set"scale-questions"(t){this["scale-question-list"]=t,this.requestUpdate("scale-questions")}willUpdate(t){const e=t.has("title")||t.has("answer-list")||t.has("rich-text-content")||t.has("scale-question-list")||t.has("scale-questions");(t.has("is-edit")&&this["is-edit"]||!this["is-edit"]&&e)&&this._syncProps(),t.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"]}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this["use-model"]&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}_resolvedQuestions(){const t=this["is-edit"]?this._rowTitle:this._scaleQuestions.join("\n");return t.split("\n").map(t=>t.trim()).filter(Boolean)}_resolvedAnswers(){const t=this["is-edit"]?this._answers:this["answer-list"];return Array.isArray(t)?t.map(d):[]}_createAnswerCountError(t){return new i.SubjectError("量表题选项数量必须在 3-5 个之间!","ANSWER_COUNT_INVALID","answers",t)}async toJSON(){return new Promise((t,e)=>{const s={customId:this["custom-id"]||void 0,answerType:a.SubjectType.SCALE,orderIndex:this["order-index"]},r=i.trimText(this["is-edit"]?this._title:this.title||""),o=this._resolvedAnswers(),n=this._resolvedQuestions(),l=this["is-edit"]?this._richText:this["rich-text-content"]||"",p=this["show-rich-text"]&&(this["is-edit"]?this._showRichText:!!this["rich-text-content"]);if(!r)return void e(new i.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",s));if(o.length<3||o.length>5)return void e(this._createAnswerCountError(s));for(let t=0;t<o.length;t++)if(!o[t].title)return void e(new i.SubjectError(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",s));if(0===n.length)return void e(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",s));const h={answerType:a.SubjectType.SCALE,examTypeEnum:a.SubjectType.SCALE,title:r,answers:o.map(x),scaleQuestionList:n,analysis:i.trimText(this["is-edit"]?this._analysis:this.analysis||""),examRichTextContent:p?l:"",isSetCorrectAnswer:!1};this["custom-id"]&&(h.customId=this["custom-id"]),this["exam-answer-relation-type"]&&(h.examAnswerRelationType=this["exam-answer-relation-type"]),t(h)})}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}validate(){const t=[],e={customId:this["custom-id"]||void 0,answerType:a.SubjectType.SCALE,orderIndex:this["order-index"]},s=i.trimText(this["is-edit"]?this._title:this.title||""),r=this._resolvedAnswers(),o=this._resolvedQuestions();return s||t.push(new i.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",e)),r.length<3||r.length>5?(t.push(this._createAnswerCountError(e)),t):(r.forEach((s,r)=>{s.title||t.push(new i.SubjectError(`选项${String.fromCharCode(65+r)}未填写`,"ANSWER_EMPTY","answers",e))}),0===o.length&&t.push(new i.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e)),t)}_renderPreview(){const e=this._resolvedAnswers(),s=this._resolvedQuestions(),i=Math.floor(100/((e.length||1)+1)),r=o.joinSubjectTitle(o.resolveSubjectPrefix(this["subject-prefix"],`${this["order-index"]+1}.`),this.title);return t.html`
1
+ "use strict";var t=require("lit"),e=require("lit/decorators.js"),s=require("../base/define.cjs"),i=require("../editor/toolbar.cjs"),r=require("./shared-methods.cjs"),o=require("./shared-styles.cjs"),a=require("./single.cjs"),l=require("./sorting-card.cjs"),n=require("./types.cjs"),d=Object.defineProperty,h=Object.getOwnPropertyDescriptor,c=(t,e,s,i)=>{for(var r,o=i>1?void 0:i?h(e,s):e,a=t.length-1;a>=0;a--)(r=t[a])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&d(e,s,o),o};function p(){return{title:""}}function x(){return Array.from({length:5},p)}function u(t){const e={...t,title:a.trimText(t?.title??t?.answer??"")},s=t?.answerId??t?.examAnswerId;return void 0!==s&&(e.answerId=s),delete e.answer,delete e.examAnswerId,delete e.isCorrect,e}function w(t,e){const s={...u(t),orderIndex:e+1,answer:a.trimText(t?.title??t?.answer??"")};return s.title=a.trimText(s.title??""),void 0!==s.answerId&&(s.examAnswerId=s.answerId),void 0===s.answerId&&delete s.answerId,delete s.isCorrect,s}const y=t.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,m=t.html`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;exports.QxsScale=class extends t.LitElement{constructor(){super(...arguments),this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["hide-add-rich-text"]=!1,this["show-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this.sorting=!1,this["show-analysis"]=!1,this.analysis="",this["rich-text-content"]="",this["exam-answer-relation-type"]=0,this["upload-image"]=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this._answers=x(),this._scaleQuestions=[],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this["model-value"]="",this["use-model"]=!1,this.TITLE_MAX=200}get"answer-list"(){return this._answers}set"answer-list"(t){const e=function(t){return Array.isArray(t)?t.map(u):[]}(t);this._answers=e.length?e:x(),this.requestUpdate("answer-list")}get"scale-question-list"(){return this._scaleQuestions}set"scale-question-list"(t){this._scaleQuestions=function(t){return Array.isArray(t)?t.map(t=>String(t??"").trim()).filter(Boolean):[]}(t),this.requestUpdate("scale-question-list")}get"scale-questions"(){return this._scaleQuestions}set"scale-questions"(t){this["scale-question-list"]=t,this.requestUpdate("scale-questions")}willUpdate(t){const e=t.has("title")||t.has("answer-list")||t.has("rich-text-content")||t.has("scale-question-list")||t.has("scale-questions");(t.has("is-edit")&&this["is-edit"]||!this["is-edit"]&&e)&&this._syncProps(),t.has("model-value")&&this["use-model"]&&(this._title=this["model-value"])}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"]}_emit(t,e){r.emitSubjectEvent(this,t,e)}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this["use-model"]&&r.emitSubjectModelValue(this,this._title)}_resolvedQuestions(){const t=this["is-edit"]?this._rowTitle:this._scaleQuestions.join("\n");return t.split("\n").map(t=>t.trim()).filter(Boolean)}_resolvedAnswers(){const t=this["is-edit"]?this._answers:this["answer-list"];return Array.isArray(t)?t.map(u):[]}_createAnswerCountError(t){return new a.SubjectError("量表题选项数量必须在 3-5 个之间!","ANSWER_COUNT_INVALID","answers",t)}async toJSON(){return new Promise((t,e)=>{const s={customId:this["custom-id"]||void 0,answerType:n.SubjectType.SCALE,orderIndex:this["order-index"]},i=a.trimText(this["is-edit"]?this._title:this.title||""),r=this._resolvedAnswers(),o=this._resolvedQuestions(),l=this["is-edit"]?this._richText:this["rich-text-content"]||"",d=this["show-rich-text"]&&(this["is-edit"]?this._showRichText:!!this["rich-text-content"]);if(!i)return void e(new a.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",s));if(r.length<3||r.length>5)return void e(this._createAnswerCountError(s));for(let t=0;t<r.length;t++)if(!r[t].title)return void e(new a.SubjectError(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",s));if(0===o.length)return void e(new a.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",s));const h={answerType:n.SubjectType.SCALE,examTypeEnum:n.SubjectType.SCALE,title:i,answers:r.map(w),scaleQuestionList:o,analysis:a.trimText(this["is-edit"]?this._analysis:this.analysis||""),examRichTextContent:d?l:"",isSetCorrectAnswer:!1};this["custom-id"]&&(h.customId=this["custom-id"]),this["exam-answer-relation-type"]&&(h.examAnswerRelationType=this["exam-answer-relation-type"]),t(h)})}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){r.showSubjectToast(t.message)}}validate(){const t=[],e={customId:this["custom-id"]||void 0,answerType:n.SubjectType.SCALE,orderIndex:this["order-index"]},s=a.trimText(this["is-edit"]?this._title:this.title||""),i=this._resolvedAnswers(),r=this._resolvedQuestions();return s||t.push(new a.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",e)),i.length<3||i.length>5?(t.push(this._createAnswerCountError(e)),t):(i.forEach((s,i)=>{s.title||t.push(new a.SubjectError(`选项${String.fromCharCode(65+i)}未填写`,"ANSWER_EMPTY","answers",e))}),0===r.length&&t.push(new a.SubjectError("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e)),t)}_renderPreview(){const e=this._resolvedAnswers(),s=this._resolvedQuestions(),i=Math.floor(100/((e.length||1)+1)),o=r.buildSubjectPreviewTitle(this["subject-prefix"],this["order-index"],this.title);return t.html`
2
2
  <div class="preview">
3
- <span class="title">${r}(量表题)</span>
4
- ${this["show-rich-text"]&&this["rich-text-content"]?t.html`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
3
+ <div class="preview-header">
4
+ <div class="preview-title-row">
5
+ <span class="title">${o}</span>
6
+ <span class="preview-type">量表题</span>
7
+ </div>
8
+ ${this["show-rich-text"]&&this["rich-text-content"]?t.html`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
9
+ </div>
5
10
  <div class="scale-table-wrap">
6
11
  <table class="scale-table">
7
12
  <thead>
8
13
  <tr>
9
- <th style="width:${i}%">问题 \ 选项</th>
14
+ <th style="width:${i}%">问题</th>
10
15
  ${e.map(e=>t.html`<th style="width:${i}%">${e.title}</th>`)}
11
16
  </tr>
12
17
  </thead>
@@ -22,103 +27,114 @@
22
27
  </div>
23
28
  </div>
24
29
  `}_renderEdit(){return t.html`
25
- <div class="flex-items-start">
26
- <div class="label"><span>题目:</span></div>
27
- <div style="flex:1">
28
- <div class="el-input">
29
- <textarea
30
- rows="2"
31
- .value=${this._title}
32
- maxlength=${this.TITLE_MAX}
33
- @input=${t=>this._onTitleInput(t)}
34
- placeholder="【量表题】请输入问题"
35
- ></textarea>
36
- <span class="char-counter">${this._title.length}/${this.TITLE_MAX}</span>
30
+ <div class="edit-form">
31
+ <div class="edit-row">
32
+ <div class="label"><span>题目:</span></div>
33
+ <div class="row-body">
34
+ <div class="el-input">
35
+ <textarea
36
+ rows="2"
37
+ .value=${this._title}
38
+ maxlength=${this.TITLE_MAX}
39
+ @input=${t=>this._onTitleInput(t)}
40
+ placeholder="【量表题】请输入问题"
41
+ ></textarea>
42
+ <span class="char-counter">${this._title.length}/${this.TITLE_MAX}</span>
43
+ </div>
37
44
  </div>
38
45
  </div>
39
- </div>
40
46
 
41
- <slot name="business-tag"></slot>
47
+ <slot name="business-tag"></slot>
42
48
 
43
- <div class="flex-items-start" style="margin-top:12px">
44
- <div class="label"><span>行标题:</span></div>
45
- <div class="flex" style="flex:1">
46
- <div class="el-input" style="width:160px">
47
- <textarea
48
- class="row-title-textarea"
49
- .value=${this._rowTitle}
50
- @input=${t=>{this._rowTitle=t.target.value}}
51
- @keydown=${t=>{t.stopPropagation()}}
52
- placeholder="请输入行标题"
53
- ></textarea>
54
- </div>
55
- <div style="flex:1;margin-left:12px">
56
- ${this._answers.map((e,s)=>t.html`
57
- <div class="answer-item">
58
- <span class="label">${String.fromCharCode(65+s)}.</span>
59
- <div class="input">
60
- <input
61
- type="text"
62
- .value=${e.title}
63
- maxlength="10"
64
- @input=${t=>{const e=t.target.value;this._answers=this._answers.map((t,i)=>i===s?{...t,title:e}:t)}}
65
- placeholder="选项${s+1}"
66
- />
49
+ <div class="edit-row">
50
+ <div class="label"><span>量表内容:</span></div>
51
+ <div class="row-body">
52
+ <div class="edit-grid">
53
+ <div class="edit-column">
54
+ <div class="edit-column-title">行标题</div>
55
+ <div class="el-input">
56
+ <textarea
57
+ class="row-title-textarea"
58
+ .value=${this._rowTitle}
59
+ @input=${t=>{this._rowTitle=t.target.value}}
60
+ @keydown=${t=>{t.stopPropagation()}}
61
+ placeholder="请输入行标题"
62
+ ></textarea>
67
63
  </div>
68
- <span
69
- class="icon"
70
- @click=${()=>{this._answers.length<5&&(this._answers=[...this._answers,{title:""}])}}
71
- >${u}</span>
72
- <span
73
- class="icon ${this._answers.length<3?"disabled":""}"
74
- @click=${()=>{this._answers.length>3&&(this._answers=this._answers.filter((t,e)=>e!==s))}}
75
- >${y}</span>
64
+ <div class="edit-note">一行一个标题,预览时会自动整理空白行。</div>
76
65
  </div>
77
- `)}
66
+ <div class="edit-column">
67
+ <div class="edit-column-title">评分选项</div>
68
+ ${this._answers.map((e,s)=>t.html`
69
+ <div class="answer-item">
70
+ <span class="label">${String.fromCharCode(65+s)}.</span>
71
+ <div class="input">
72
+ <input
73
+ type="text"
74
+ .value=${e.title}
75
+ maxlength="10"
76
+ @input=${t=>{const e=t.target.value;this._answers=this._answers.map((t,i)=>i===s?{...t,title:e}:t)}}
77
+ placeholder="选项${s+1}"
78
+ />
79
+ </div>
80
+ <span
81
+ class="icon"
82
+ @click=${()=>{this._answers.length<5&&(this._answers=[...this._answers,{title:""}])}}
83
+ >${y}</span>
84
+ <span
85
+ class="icon ${this._answers.length<3?"disabled":""}"
86
+ @click=${()=>{this._answers.length>3&&(this._answers=this._answers.filter((t,e)=>e!==s))}}
87
+ >${m}</span>
88
+ </div>
89
+ `)}
90
+ <div class="edit-note">量表题需保持 3-5 个选项,保存时会校验。</div>
91
+ </div>
92
+ </div>
78
93
  </div>
79
94
  </div>
80
- </div>
81
95
 
82
- ${this["show-rich-text"]&&this._showRichText?t.html`
83
- <div class="flex-items-start" style="margin-top:12px">
84
- <div class="label"><span>副文本:</span></div>
85
- <div style="flex:1">
86
- <slot name="sub-text">
87
- <qxs-blocksuite-editor
88
- .content=${this._richText}
89
- .upload-image=${this["upload-image"]}
90
- ?is-edit=${!0}
91
- @input=${t=>{this._richText=t.target.getContent()}}
92
- ></qxs-blocksuite-editor>
93
- </slot>
94
- ${this["show-action"]?"":t.html`
95
- <div class="flex-justify-end" style="margin-top:8px">
96
- <span
97
- class="el-link danger"
98
- @click=${()=>{this._showRichText=!1,this._richText=""}}
99
- >删除富文本</span>
100
- </div>
101
- `}
96
+ ${this["show-rich-text"]&&this._showRichText?t.html`
97
+ <div class="edit-row">
98
+ <div class="label"><span>副文本:</span></div>
99
+ <div class="row-body">
100
+ <slot name="sub-text">
101
+ <qxs-blocksuite-editor
102
+ .content=${this._richText}
103
+ .toolbar=${i.SUB_TEXT_EDITOR_TOOLBAR}
104
+ .upload-image=${this["upload-image"]}
105
+ ?is-edit=${!0}
106
+ @input=${t=>{this._richText=t.target.getContent()}}
107
+ ></qxs-blocksuite-editor>
108
+ </slot>
109
+ ${this["show-action"]?"":t.html`
110
+ <div class="flex-justify-end" style="margin-top:8px">
111
+ <span
112
+ class="el-link danger"
113
+ @click=${()=>{this._showRichText=!1,this._richText=""}}
114
+ >删除富文本</span>
115
+ </div>
116
+ `}
117
+ </div>
102
118
  </div>
103
- </div>
104
- `:""}
119
+ `:""}
105
120
 
106
- ${this["show-analysis"]?t.html`
107
- <div class="flex-items-start" style="margin-top:12px">
108
- <div class="label"><span>解析:</span></div>
109
- <div style="flex:1">
110
- <div class="el-input">
111
- <textarea
112
- rows="2"
113
- .value=${this._analysis}
114
- @input=${t=>{this._analysis=t.target.value}}
115
- placeholder="请输入题目解析"
116
- ></textarea>
121
+ ${this["show-analysis"]?t.html`
122
+ <div class="edit-row">
123
+ <div class="label"><span>解析:</span></div>
124
+ <div class="row-body">
125
+ <div class="el-input">
126
+ <textarea
127
+ rows="2"
128
+ .value=${this._analysis}
129
+ @input=${t=>{this._analysis=t.target.value}}
130
+ placeholder="请输入题目解析"
131
+ ></textarea>
132
+ </div>
117
133
  </div>
118
134
  </div>
119
- </div>
120
- `:""}
121
- `}_renderSorting(){const t=i.trimText(this["is-edit"]?this._title:this.title||"")||"未命名题目",e=o.joinSubjectTitle(o.resolveSubjectPrefix(this["subject-prefix"],`${this["order-index"]+1}. `),t);return r.renderSortingCard(e,a.SubjectTypeLabel[a.SubjectType.SCALE]||a.SubjectType.SCALE)}render(){if(this.sorting)return this._renderSorting();const e=this["is-edit"]?t.html`<div slot="edit">${this._renderEdit()}</div>`:t.html`<div slot="preview">${this._renderPreview()}</div>`;return t.html`
135
+ `:""}
136
+ </div>
137
+ `}_renderSorting(){const t=a.trimText(this["is-edit"]?this._title:this.title||"")||"未命名题目",e=r.buildSubjectSortingTitle(this["subject-prefix"],this["order-index"],t);return l.renderSortingCard(e,n.SubjectTypeLabel[n.SubjectType.SCALE]||n.SubjectType.SCALE)}render(){if(this.sorting)return this._renderSorting();const e=this["is-edit"]?t.html`<div slot="edit">${this._renderEdit()}</div>`:t.html`<div slot="preview">${this._renderPreview()}</div>`;return t.html`
122
138
  <qxs-subject-layout .show-edit=${this["is-edit"]}>
123
139
  ${e}
124
140
  ${this["show-action"]?t.html`
@@ -141,31 +157,21 @@
141
157
  `:""}
142
158
  <slot name="action"></slot>
143
159
  </qxs-subject-layout>
144
- `}},exports.QxsScale.styles=[r.sortingCardStyles,t.css`
145
- :host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
146
- *, ::before, ::after { box-sizing: border-box; }
147
-
148
- .preview { padding: 12px 0; }
149
- .preview .title { font-size: 14px; color: #303133; }
150
- .preview .rich-text { margin-top: 8px; }
151
- .preview .rich-text img { max-width: 100%; }
152
- .preview .rich-text img[data-align="left"] { display: block !important; margin: 0 auto 0 0 !important; }
153
- .preview .rich-text img[data-align="center"] { display: block !important; margin: 0 auto !important; }
154
- .preview .rich-text img[data-align="right"] { display: block !important; margin: 0 0 0 auto !important; }
160
+ `}},exports.QxsScale.styles=[l.sortingCardStyles,o.subjectHostStyles,o.subjectControlResetStyles,o.subjectPreviewBaseStyles,o.subjectFormBaseStyles,o.subjectTextareaStyles,t.css`
155
161
  .scale-table-wrap {
156
- margin-top: 12px;
157
- background: #fff;
162
+ margin-top: 18px;
158
163
  overflow: hidden;
159
164
  }
160
- .scale-table { width: 100%; border-collapse: collapse; font-size: 12px; }
161
- .scale-table th, .scale-table td { border: 1px solid #e4e7ed; padding: 8px 6px; text-align: center; }
162
- .scale-table th { background: #f5f7fa; color: #909399; }
165
+ .scale-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; color: #4b5563; }
166
+ .scale-table th, .scale-table td { border-bottom: 1px solid #eef2f7; padding: 10px 8px; text-align: center; vertical-align: middle; }
167
+ .scale-table thead th { font-size: 12px; font-weight: 600; color: #8b95a7; }
163
168
  .scale-table td:first-child,
164
169
  .scale-table th:first-child {
165
- background: #fbfcff;
166
- color: #606266;
170
+ color: #303133;
171
+ text-align: left;
167
172
  font-weight: 600;
168
173
  }
174
+ .scale-table tbody tr:last-child td { border-bottom: none; }
169
175
  .scale-table input[type="radio"] {
170
176
  accent-color: #3D61E3;
171
177
  }
@@ -173,33 +179,49 @@
173
179
  .flex { display: flex; }
174
180
  .flex-items-start { display: flex; align-items: flex-start; }
175
181
  .flex-justify-end { display: flex; justify-content: flex-end; }
176
- .label { min-width: 60px; font-size: 13px; color: #606266; }
177
-
178
- textarea, input[type="text"] {
179
- border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;
180
- font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;
181
- line-height: 1.5; display: block; box-sizing: border-box; white-space: pre-wrap;
182
+ .edit-grid {
183
+ display: grid;
184
+ grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
185
+ gap: 20px;
186
+ }
187
+ .edit-column {
188
+ min-width: 0;
189
+ display: flex;
190
+ flex-direction: column;
191
+ gap: 10px;
192
+ }
193
+ .edit-column-title {
194
+ font-size: 12px;
195
+ line-height: 1.4;
196
+ font-weight: 600;
197
+ color: #8b95a7;
198
+ letter-spacing: 0.02em;
199
+ }
200
+ .edit-note {
201
+ font-size: 12px;
202
+ line-height: 1.6;
203
+ color: #909399;
182
204
  }
183
- textarea:focus, input[type="text"]:focus { border-color: #3D61E3; outline: none; }
184
- textarea:disabled, input[type="text"]:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }
185
205
 
186
- .el-input { position: relative; display: block; }
187
- .el-input textarea { padding-bottom: 24px; }
188
- .el-input .char-counter {
189
- position: absolute; right: 12px; bottom: 8px;
190
- font-size: 12px; color: #909399; line-height: 1; pointer-events: none;
206
+ textarea, input[type="text"] { white-space: pre-wrap; }
207
+ input[type="text"] {
208
+ border: 1px solid #dcdfe6; border-radius: 6px; padding: 7px 11px;
209
+ font-size: 13px; font-family: inherit; width: 100%; transition: border-color .2s;
210
+ line-height: 1.5; display: block; box-sizing: border-box;
191
211
  }
212
+ input[type="text"]:focus { border-color: #3D61E3; outline: none; }
213
+ input[type="text"]:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }
192
214
 
193
215
  .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }
194
216
  .el-link.danger { color: #f56c6c; }
195
217
 
196
- .answer-item { display: flex; align-items: center; margin-top: 6px; }
197
- .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }
198
- .answer-item .input { flex: 1; max-width: 200px; }
218
+ .answer-item { display: flex; align-items: center; gap: 8px; }
219
+ .answer-item .label { min-width: 28px; font-size: 13px; font-weight: 600; color: #6b7280; letter-spacing: 0; }
220
+ .answer-item .input { flex: 1; max-width: 220px; }
199
221
  .answer-item .input input {
200
- height: 32px; padding: 0 8px;
222
+ height: 36px; padding: 0 10px;
201
223
  font-size: 13px; line-height: 32px;
202
- border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;
224
+ border: 1px solid #dcdfe6; border-radius: 6px; width: 100%;
203
225
  transition: border-color .2s; box-sizing: border-box;
204
226
  }
205
227
  .answer-item .input input:focus { border-color: #3D61E3; outline: none; }
@@ -214,6 +236,23 @@
214
236
  .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
215
237
  .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }
216
238
 
217
- .row-title-textarea { height: 200px; }
218
- `],p([e.property({type:Number,attribute:"order-index"})],exports.QxsScale.prototype,"order-index",2),p([e.property({type:String,attribute:"subject-prefix"})],exports.QxsScale.prototype,"subject-prefix",2),p([e.property({type:String})],exports.QxsScale.prototype,"title",2),p([e.property({type:String,attribute:"custom-id"})],exports.QxsScale.prototype,"custom-id",2),p([e.property({type:Boolean,attribute:"is-edit"})],exports.QxsScale.prototype,"is-edit",2),p([e.property({type:Boolean,attribute:"is-save"})],exports.QxsScale.prototype,"is-save",2),p([e.property({type:Boolean,attribute:"is-set"})],exports.QxsScale.prototype,"is-set",2),p([e.property({type:Boolean,attribute:"show-action"})],exports.QxsScale.prototype,"show-action",2),p([e.property({type:Boolean,attribute:"show-add"})],exports.QxsScale.prototype,"show-add",2),p([e.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsScale.prototype,"hide-add-rich-text",2),p([e.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsScale.prototype,"show-rich-text",2),p([e.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsScale.prototype,"show-delete-action",2),p([e.property({type:Boolean,attribute:"show-save-action"})],exports.QxsScale.prototype,"show-save-action",2),p([e.property({type:Boolean,reflect:!0})],exports.QxsScale.prototype,"sorting",2),p([e.property({type:Boolean,attribute:"show-analysis"})],exports.QxsScale.prototype,"show-analysis",2),p([e.property({type:String})],exports.QxsScale.prototype,"analysis",2),p([e.property({type:String,attribute:"rich-text-content"})],exports.QxsScale.prototype,"rich-text-content",2),p([e.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsScale.prototype,"exam-answer-relation-type",2),p([e.property({type:Object,attribute:"upload-image"})],exports.QxsScale.prototype,"upload-image",2),p([e.property({type:Array,attribute:"answer-list"})],exports.QxsScale.prototype,"answer-list",1),p([e.property({type:Array,attribute:"scale-question-list"})],exports.QxsScale.prototype,"scale-question-list",1),p([e.property({type:Array,attribute:"scale-questions"})],exports.QxsScale.prototype,"scale-questions",1),p([e.state()],exports.QxsScale.prototype,"_answers",2),p([e.state()],exports.QxsScale.prototype,"_scaleQuestions",2),p([e.state()],exports.QxsScale.prototype,"_rowTitle",2),p([e.state()],exports.QxsScale.prototype,"_title",2),p([e.state()],exports.QxsScale.prototype,"_analysis",2),p([e.state()],exports.QxsScale.prototype,"_showRichText",2),p([e.state()],exports.QxsScale.prototype,"_richText",2),p([e.property({type:String,attribute:"model-value"})],exports.QxsScale.prototype,"model-value",2),p([e.property({type:Boolean,attribute:"use-model"})],exports.QxsScale.prototype,"use-model",2),exports.QxsScale=p([s.safeCustomElement("qxs-scale")],exports.QxsScale);
239
+ .row-title-textarea { min-height: 220px; }
240
+
241
+ @media (max-width: 720px) {
242
+ .edit-row {
243
+ flex-direction: column;
244
+ gap: 8px;
245
+ }
246
+
247
+ .edit-row > .label {
248
+ min-width: 0;
249
+ padding-top: 0;
250
+ }
251
+
252
+ .edit-grid {
253
+ grid-template-columns: 1fr;
254
+ gap: 16px;
255
+ }
256
+ }
257
+ `],c([e.property({type:Number,attribute:"order-index"})],exports.QxsScale.prototype,"order-index",2),c([e.property({type:String,attribute:"subject-prefix"})],exports.QxsScale.prototype,"subject-prefix",2),c([e.property({type:String})],exports.QxsScale.prototype,"title",2),c([e.property({type:String,attribute:"custom-id"})],exports.QxsScale.prototype,"custom-id",2),c([e.property({type:Boolean,attribute:"is-edit"})],exports.QxsScale.prototype,"is-edit",2),c([e.property({type:Boolean,attribute:"is-save"})],exports.QxsScale.prototype,"is-save",2),c([e.property({type:Boolean,attribute:"is-set"})],exports.QxsScale.prototype,"is-set",2),c([e.property({type:Boolean,attribute:"show-action"})],exports.QxsScale.prototype,"show-action",2),c([e.property({type:Boolean,attribute:"show-add"})],exports.QxsScale.prototype,"show-add",2),c([e.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsScale.prototype,"hide-add-rich-text",2),c([e.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsScale.prototype,"show-rich-text",2),c([e.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsScale.prototype,"show-delete-action",2),c([e.property({type:Boolean,attribute:"show-save-action"})],exports.QxsScale.prototype,"show-save-action",2),c([e.property({type:Boolean,reflect:!0})],exports.QxsScale.prototype,"sorting",2),c([e.property({type:Boolean,attribute:"show-analysis"})],exports.QxsScale.prototype,"show-analysis",2),c([e.property({type:String})],exports.QxsScale.prototype,"analysis",2),c([e.property({type:String,attribute:"rich-text-content"})],exports.QxsScale.prototype,"rich-text-content",2),c([e.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsScale.prototype,"exam-answer-relation-type",2),c([e.property({type:Object,attribute:"upload-image"})],exports.QxsScale.prototype,"upload-image",2),c([e.property({type:Array,attribute:"answer-list"})],exports.QxsScale.prototype,"answer-list",1),c([e.property({type:Array,attribute:"scale-question-list"})],exports.QxsScale.prototype,"scale-question-list",1),c([e.property({type:Array,attribute:"scale-questions"})],exports.QxsScale.prototype,"scale-questions",1),c([e.state()],exports.QxsScale.prototype,"_answers",2),c([e.state()],exports.QxsScale.prototype,"_scaleQuestions",2),c([e.state()],exports.QxsScale.prototype,"_rowTitle",2),c([e.state()],exports.QxsScale.prototype,"_title",2),c([e.state()],exports.QxsScale.prototype,"_analysis",2),c([e.state()],exports.QxsScale.prototype,"_showRichText",2),c([e.state()],exports.QxsScale.prototype,"_richText",2),c([e.property({type:String,attribute:"model-value"})],exports.QxsScale.prototype,"model-value",2),c([e.property({type:Boolean,attribute:"use-model"})],exports.QxsScale.prototype,"use-model",2),exports.QxsScale=c([s.safeCustomElement("qxs-scale")],exports.QxsScale);
219
258
  //# sourceMappingURL=scale.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scale.cjs","sources":["../../../../packages/components-wc/src/subject/scale.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError, trimText } from './single'\nimport { renderSortingCard, sortingCardStyles } from './sorting-card'\nimport { joinSubjectTitle, resolveSubjectPrefix } from './title-prefix'\nimport { SubjectType, SubjectTypeLabel } from './types'\n\ninterface ScaleAnswer {\n title: string\n answerId?: string | number\n orderIndex?: number\n isCorrect?: boolean\n [key: string]: any\n}\n\nfunction createEmptyScaleAnswer(): ScaleAnswer {\n return { title: '' }\n}\n\nfunction createDefaultScaleAnswers(): ScaleAnswer[] {\n return Array.from({ length: 5 }, createEmptyScaleAnswer)\n}\n\nfunction normalizeScaleAnswer(answer: any): ScaleAnswer {\n const next: ScaleAnswer = {\n ...answer,\n title: trimText(answer?.title ?? answer?.answer ?? ''),\n }\n const answerId = answer?.answerId ?? answer?.examAnswerId\n if (answerId !== undefined) {\n next.answerId = answerId\n }\n delete next.answer\n delete next.examAnswerId\n delete next.isCorrect\n return next\n}\n\nfunction normalizeScaleAnswers(value: any): ScaleAnswer[] {\n return Array.isArray(value) ? value.map(normalizeScaleAnswer) : []\n}\n\nfunction normalizeScaleQuestionList(value: any): string[] {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .map(item => String(item ?? '').trim())\n .filter(Boolean)\n}\n\nfunction splitScaleQuestionLines(value: string): string[] {\n return value\n .split('\\n')\n .map(item => item.trim())\n .filter(Boolean)\n}\n\nfunction serializeScaleAnswer(answer: any, index: number): ScaleAnswer {\n const next: ScaleAnswer = {\n ...normalizeScaleAnswer(answer),\n orderIndex: index + 1,\n answer: trimText(answer?.title ?? answer?.answer ?? ''),\n }\n next.title = trimText(next.title ?? '')\n if (next.answerId !== undefined) {\n next.examAnswerId = next.answerId\n }\n if (next.answerId === undefined) {\n delete next.answerId\n }\n delete next.isCorrect\n return next\n}\n\nconst iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\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(() => {\n el.style.opacity = '0'\n setTimeout(() => el.remove(), 300)\n }, 2500)\n}\n\n@safeCustomElement('qxs-scale')\nexport class QxsScale extends LitElement {\n static styles = [sortingCardStyles, 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 .rich-text img[data-align=\"left\"] { display: block !important; margin: 0 auto 0 0 !important; }\n .preview .rich-text img[data-align=\"center\"] { display: block !important; margin: 0 auto !important; }\n .preview .rich-text img[data-align=\"right\"] { display: block !important; margin: 0 0 0 auto !important; }\n .scale-table-wrap {\n margin-top: 12px;\n background: #fff;\n overflow: hidden;\n }\n .scale-table { width: 100%; border-collapse: collapse; font-size: 12px; }\n .scale-table th, .scale-table td { border: 1px solid #e4e7ed; padding: 8px 6px; text-align: center; }\n .scale-table th { background: #f5f7fa; color: #909399; }\n .scale-table td:first-child,\n .scale-table th:first-child {\n background: #fbfcff;\n color: #606266;\n font-weight: 600;\n }\n .scale-table input[type=\"radio\"] {\n accent-color: #3D61E3;\n }\n\n .flex { display: flex; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea, input[type=\"text\"] {\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; white-space: pre-wrap;\n }\n textarea:focus, input[type=\"text\"]:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled, input[type=\"text\"]:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n\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 .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link.danger { color: #f56c6c; }\n\n .answer-item { display: flex; align-items: center; margin-top: 6px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 200px; }\n .answer-item .input input {\n height: 32px; padding: 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .row-title-textarea { height: 200px; }\n `]\n\n @property({ type: Number, attribute: 'order-index' }) 'order-index' = 0\n @property({ type: String, attribute: 'subject-prefix' }) 'subject-prefix'?: string\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: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) 'hide-add-rich-text' = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) 'show-rich-text' = false\n @property({ type: Boolean, attribute: 'show-delete-action' }) 'show-delete-action' = true\n @property({ type: Boolean, attribute: 'show-save-action' }) 'show-save-action' = true\n @property({ type: Boolean, reflect: true }) sorting = false\n @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = false\n @property({ type: String }) analysis = ''\n @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\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' })\n get 'answer-list'() { return this._answers }\n\n set 'answer-list'(value: any) {\n const answers = normalizeScaleAnswers(value)\n this._answers = answers.length ? answers : createDefaultScaleAnswers()\n this.requestUpdate('answer-list')\n }\n\n @property({ type: Array, attribute: 'scale-question-list' })\n get 'scale-question-list'() { return this._scaleQuestions }\n\n set 'scale-question-list'(value: any) {\n this._scaleQuestions = normalizeScaleQuestionList(value)\n this.requestUpdate('scale-question-list')\n }\n\n @property({ type: Array, attribute: 'scale-questions' })\n get 'scale-questions'() { return this._scaleQuestions }\n\n set 'scale-questions'(value: any) {\n this['scale-question-list'] = value\n this.requestUpdate('scale-questions')\n }\n\n @state() private _answers: ScaleAnswer[] = createDefaultScaleAnswers()\n @state() private _scaleQuestions: string[] = []\n @state() private _rowTitle = ''\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = false\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n const shouldSyncProps = changed.has('title')\n || changed.has('answer-list')\n || changed.has('rich-text-content')\n || changed.has('scale-question-list')\n || changed.has('scale-questions')\n\n if ((changed.has('is-edit') && this['is-edit']) || (!this['is-edit'] && shouldSyncProps)) {\n this._syncProps()\n }\n\n if (changed.has('model-value') && this['use-model']) {\n this._title = this['model-value']\n }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._rowTitle = this._scaleQuestions.join('\\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 _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) {\n el.value = el.value.slice(0, this.TITLE_MAX)\n }\n this._title = el.value\n if (this['use-model']) {\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: this._title,\n }))\n }\n }\n\n private _resolvedQuestions(): string[] {\n const rowTitle = this['is-edit'] ? this._rowTitle : this._scaleQuestions.join('\\n')\n return splitScaleQuestionLines(rowTitle)\n }\n\n private _resolvedAnswers(): ScaleAnswer[] {\n const answers = this['is-edit'] ? this._answers : this['answer-list']\n return Array.isArray(answers) ? answers.map(normalizeScaleAnswer) : []\n }\n\n private _createAnswerCountError(row: Record<string, unknown>) {\n return new SubjectError('量表题选项数量必须在 3-5 个之间!', 'ANSWER_COUNT_INVALID', 'answers', row)\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = {\n customId: this['custom-id'] || undefined,\n answerType: SubjectType.SCALE,\n orderIndex: this['order-index'],\n }\n\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this._resolvedAnswers()\n const questions = this._resolvedQuestions()\n const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n const showRichText = this['show-rich-text'] && (this['is-edit'] ? this._showRichText : !!this['rich-text-content'])\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n\n if (answers.length < 3 || answers.length > 5) {\n reject(this._createAnswerCountError(row))\n return\n }\n\n for (let i = 0; i < answers.length; i++) {\n if (!answers[i].title) {\n reject(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写。`, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n }\n\n if (questions.length === 0) {\n reject(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n return\n }\n\n const result: any = {\n answerType: SubjectType.SCALE,\n examTypeEnum: SubjectType.SCALE,\n title,\n answers: answers.map(serializeScaleAnswer),\n scaleQuestionList: questions,\n analysis: trimText(this['is-edit'] ? this._analysis : this.analysis || ''),\n examRichTextContent: showRichText ? richText : '',\n isSetCorrectAnswer: false,\n }\n\n if (this['custom-id']) {\n result.customId = this['custom-id']\n }\n if (this['exam-answer-relation-type']) {\n result.examAnswerRelationType = this['exam-answer-relation-type']\n }\n\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 = {\n customId: this['custom-id'] || undefined,\n answerType: SubjectType.SCALE,\n orderIndex: this['order-index'],\n }\n\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this._resolvedAnswers()\n const questions = this._resolvedQuestions()\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n\n if (answers.length < 3 || answers.length > 5) {\n errors.push(this._createAnswerCountError(row))\n return errors\n }\n\n answers.forEach((answer: ScaleAnswer, index: number) => {\n if (!answer.title) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + index)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n })\n\n if (questions.length === 0) {\n errors.push(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n }\n\n return errors\n }\n\n private _renderPreview() {\n const answers = this._resolvedAnswers()\n const questions = this._resolvedQuestions()\n const colWidth = Math.floor(100 / ((answers.length || 1) + 1))\n const previewTitle = joinSubjectTitle(\n resolveSubjectPrefix(this['subject-prefix'], `${this['order-index'] + 1}.`),\n this.title,\n )\n\n return html`\n <div class=\"preview\">\n <span class=\"title\">${previewTitle}(量表题)</span>\n ${this['show-rich-text'] && this['rich-text-content'] ? html`<div class=\"rich-text\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n <div class=\"scale-table-wrap\">\n <table class=\"scale-table\">\n <thead>\n <tr>\n <th style=\"width:${colWidth}%\">问题 \\ 选项</th>\n ${answers.map(answer => html`<th style=\"width:${colWidth}%\">${answer.title}</th>`)}\n </tr>\n </thead>\n <tbody>\n ${questions.map(question => html`\n <tr>\n <td>${question}</td>\n ${answers.map(() => html`<td><input type=\"radio\" disabled /></td>`)}\n </tr>\n `)}\n </tbody>\n </table>\n </div>\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea\n rows=\"2\"\n .value=${this._title}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【量表题】请输入问题\"\n ></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <slot name=\"business-tag\"></slot>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>行标题:</span></div>\n <div class=\"flex\" style=\"flex:1\">\n <div class=\"el-input\" style=\"width:160px\">\n <textarea\n class=\"row-title-textarea\"\n .value=${this._rowTitle}\n @input=${(e: Event) => { this._rowTitle = (e.target as HTMLTextAreaElement).value }}\n @keydown=${(e: KeyboardEvent) => { e.stopPropagation() }}\n placeholder=\"请输入行标题\"\n ></textarea>\n </div>\n <div style=\"flex:1;margin-left:12px\">\n ${this._answers.map((answer, index) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${String.fromCharCode(65 + index)}.</span>\n <div class=\"input\">\n <input\n type=\"text\"\n .value=${answer.title}\n maxlength=\"10\"\n @input=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._answers = this._answers.map((item, currentIndex) =>\n currentIndex === index ? { ...item, title: value } : item,\n )\n }}\n placeholder=\"选项${index + 1}\"\n />\n </div>\n <span\n class=\"icon\"\n @click=${() => {\n if (this._answers.length < 5) {\n this._answers = [...this._answers, createEmptyScaleAnswer()]\n }\n }}\n >${iconPlus}</span>\n <span\n class=\"icon ${this._answers.length < 3 ? 'disabled' : ''}\"\n @click=${() => {\n if (this._answers.length > 3) {\n this._answers = this._answers.filter((_, currentIndex) => currentIndex !== index)\n }\n }}\n >${iconRemove}</span>\n </div>\n `)}\n </div>\n </div>\n </div>\n\n ${this['show-rich-text'] && this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>副文本:</span></div>\n <div style=\"flex:1\">\n <slot name=\"sub-text\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .upload-image=${this['upload-image']}\n ?is-edit=${true}\n @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n ></qxs-blocksuite-editor>\n </slot>\n ${!this['show-action']\n ? html`\n <div class=\"flex-justify-end\" style=\"margin-top:8px\">\n <span\n class=\"el-link danger\"\n @click=${() => {\n this._showRichText = false\n this._richText = ''\n }}\n >删除富文本</span>\n </div>\n `\n : ''}\n </div>\n </div>\n `\n : ''}\n\n ${this['show-analysis']\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea\n rows=\"2\"\n .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"\n ></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n private _renderSorting() {\n const title = trimText(this['is-edit'] ? this._title : this.title || '') || '未命名题目'\n const orderText = joinSubjectTitle(\n resolveSubjectPrefix(this['subject-prefix'], `${this['order-index'] + 1}. `),\n title,\n )\n return renderSortingCard(orderText, SubjectTypeLabel[SubjectType.SCALE] || SubjectType.SCALE)\n }\n\n render() {\n if (this.sorting) {\n return this._renderSorting()\n }\n\n const content = this['is-edit']\n ? html`<div slot=\"edit\">${this._renderEdit()}</div>`\n : html`<div slot=\"preview\">${this._renderPreview()}</div>`\n\n return html`\n <qxs-subject-layout .show-edit=${this['is-edit']}>\n ${content}\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['show-rich-text'] && this._showRichText}\n .hide-add-rich-text=${!this['show-rich-text'] || this['hide-add-rich-text']}\n .show-delete-action=${this['show-delete-action']}\n .show-save-action=${this['show-save-action']}\n .show-other-option=${false}\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 @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 <slot name=\"action\"></slot>\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["createEmptyScaleAnswer","title","createDefaultScaleAnswers","Array","from","length","normalizeScaleAnswer","answer","next","trimText","answerId","examAnswerId","isCorrect","serializeScaleAnswer","index","orderIndex","iconPlus","html","iconRemove","QxsScale","LitElement","constructor","super","arguments","this","sorting","analysis","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","_scaleQuestions","_rowTitle","_title","_analysis","_showRichText","_richText","TITLE_MAX","value","answers","isArray","map","normalizeScaleAnswers","requestUpdate","item","String","trim","filter","Boolean","normalizeScaleQuestionList","willUpdate","changed","shouldSyncProps","has","_syncProps","join","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","slice","_resolvedQuestions","rowTitle","split","_resolvedAnswers","_createAnswerCountError","row","SubjectError","toJSON","customId","answerType","SubjectType","SCALE","questions","richText","showRichText","i","fromCharCode","examTypeEnum","scaleQuestionList","examRichTextContent","isSetCorrectAnswer","examAnswerRelationType","_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","forEach","_renderPreview","colWidth","Math","floor","previewTitle","joinSubjectTitle","resolveSubjectPrefix","question","_renderEdit","stopPropagation","currentIndex","_","getContent","_renderSorting","orderText","renderSortingCard","SubjectTypeLabel","render","content","styles","sortingCardStyles","css","__decorateClass","property","type","Number","attribute","prototype","reflect","state","safeCustomElement"],"mappings":"gZAgBA,SAASA,IACP,MAAO,CAAEC,MAAO,GAClB,CAEA,SAASC,IACP,OAAOC,MAAMC,KAAK,CAAEC,OAAQ,GAAKL,EACnC,CAEA,SAASM,EAAqBC,GAC5B,MAAMC,EAAoB,IACrBD,EACHN,MAAOQ,EAAAA,SAASF,GAAQN,OAASM,GAAQA,QAAU,KAE/CG,EAAWH,GAAQG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AAAA,SApIU9I,QAAAA,SAoIM4I,UAAA,YAAA,GACAL,EAAA,CAAhBO,EAAAA,SArIU9I,QAAAA,SAqIM4I,UAAA,SAAA,GACAL,EAAA,CAAhBO,EAAAA,SAtIU9I,QAAAA,SAsIM4I,UAAA,YAAA,GACAL,EAAA,CAAhBO,EAAAA,SAvIU9I,QAAAA,SAuIM4I,UAAA,gBAAA,GACAL,EAAA,CAAhBO,EAAAA,SAxIU9I,QAAAA,SAwIM4I,UAAA,YAAA,GAEqCL,EAAA,CAArDC,EAAAA,SAAS,CAAEC,KAAMrG,OAAQuG,UAAW,iBA1I1B3I,QAAAA,SA0I2C4I,UAAA,cAAA,GACDL,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAMlG,QAASoG,UAAW,eA3I3B3I,QAAAA,SA2I0C4I,UAAA,YAAA,GA3I1C5I,QAAAA,SAANuI,EAAA,CADNQ,EAAAA,kBAAkB,cACN/I,QAAAA"}
1
+ {"version":3,"file":"scale.cjs","sources":["../../../../packages/components-wc/src/subject/scale.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SUB_TEXT_EDITOR_TOOLBAR } from '../editor/toolbar'\nimport { buildSubjectPreviewTitle, buildSubjectSortingTitle, emitSubjectEvent, emitSubjectModelValue, showSubjectToast } from './shared-methods'\nimport { subjectControlResetStyles, subjectFormBaseStyles, subjectHostStyles, subjectPreviewBaseStyles, subjectTextareaStyles } from './shared-styles'\nimport { SubjectError, trimText } from './single'\nimport { renderSortingCard, sortingCardStyles } from './sorting-card'\nimport { SubjectType, SubjectTypeLabel } from './types'\n\ninterface ScaleAnswer {\n title: string\n answerId?: string | number\n orderIndex?: number\n isCorrect?: boolean\n [key: string]: any\n}\n\nfunction createEmptyScaleAnswer(): ScaleAnswer {\n return { title: '' }\n}\n\nfunction createDefaultScaleAnswers(): ScaleAnswer[] {\n return Array.from({ length: 5 }, createEmptyScaleAnswer)\n}\n\nfunction normalizeScaleAnswer(answer: any): ScaleAnswer {\n const next: ScaleAnswer = {\n ...answer,\n title: trimText(answer?.title ?? answer?.answer ?? ''),\n }\n const answerId = answer?.answerId ?? answer?.examAnswerId\n if (answerId !== undefined) {\n next.answerId = answerId\n }\n delete next.answer\n delete next.examAnswerId\n delete next.isCorrect\n return next\n}\n\nfunction normalizeScaleAnswers(value: any): ScaleAnswer[] {\n return Array.isArray(value) ? value.map(normalizeScaleAnswer) : []\n}\n\nfunction normalizeScaleQuestionList(value: any): string[] {\n if (!Array.isArray(value)) {\n return []\n }\n return value\n .map(item => String(item ?? '').trim())\n .filter(Boolean)\n}\n\nfunction splitScaleQuestionLines(value: string): string[] {\n return value\n .split('\\n')\n .map(item => item.trim())\n .filter(Boolean)\n}\n\nfunction serializeScaleAnswer(answer: any, index: number): ScaleAnswer {\n const next: ScaleAnswer = {\n ...normalizeScaleAnswer(answer),\n orderIndex: index + 1,\n answer: trimText(answer?.title ?? answer?.answer ?? ''),\n }\n next.title = trimText(next.title ?? '')\n if (next.answerId !== undefined) {\n next.examAnswerId = next.answerId\n }\n if (next.answerId === undefined) {\n delete next.answerId\n }\n delete next.isCorrect\n return next\n}\n\nconst iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\nconst iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n\n@safeCustomElement('qxs-scale')\nexport class QxsScale extends LitElement {\n static styles = [sortingCardStyles, subjectHostStyles, subjectControlResetStyles, subjectPreviewBaseStyles, subjectFormBaseStyles, subjectTextareaStyles, css`\n .scale-table-wrap {\n margin-top: 18px;\n overflow: hidden;\n }\n .scale-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; color: #4b5563; }\n .scale-table th, .scale-table td { border-bottom: 1px solid #eef2f7; padding: 10px 8px; text-align: center; vertical-align: middle; }\n .scale-table thead th { font-size: 12px; font-weight: 600; color: #8b95a7; }\n .scale-table td:first-child,\n .scale-table th:first-child {\n color: #303133;\n text-align: left;\n font-weight: 600;\n }\n .scale-table tbody tr:last-child td { border-bottom: none; }\n .scale-table input[type=\"radio\"] {\n accent-color: #3D61E3;\n }\n\n .flex { display: flex; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .edit-grid {\n display: grid;\n grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);\n gap: 20px;\n }\n .edit-column {\n min-width: 0;\n display: flex;\n flex-direction: column;\n gap: 10px;\n }\n .edit-column-title {\n font-size: 12px;\n line-height: 1.4;\n font-weight: 600;\n color: #8b95a7;\n letter-spacing: 0.02em;\n }\n .edit-note {\n font-size: 12px;\n line-height: 1.6;\n color: #909399;\n }\n\n textarea, input[type=\"text\"] { white-space: pre-wrap; }\n input[type=\"text\"] {\n border: 1px solid #dcdfe6; border-radius: 6px; padding: 7px 11px;\n font-size: 13px; font-family: inherit; width: 100%; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n input[type=\"text\"]:focus { border-color: #3D61E3; outline: none; }\n input[type=\"text\"]:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; }\n .el-link.danger { color: #f56c6c; }\n\n .answer-item { display: flex; align-items: center; gap: 8px; }\n .answer-item .label { min-width: 28px; font-size: 13px; font-weight: 600; color: #6b7280; letter-spacing: 0; }\n .answer-item .input { flex: 1; max-width: 220px; }\n .answer-item .input input {\n height: 36px; padding: 0 10px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 6px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .row-title-textarea { min-height: 220px; }\n\n @media (max-width: 720px) {\n .edit-row {\n flex-direction: column;\n gap: 8px;\n }\n\n .edit-row > .label {\n min-width: 0;\n padding-top: 0;\n }\n\n .edit-grid {\n grid-template-columns: 1fr;\n gap: 16px;\n }\n }\n `]\n\n @property({ type: Number, attribute: 'order-index' }) 'order-index' = 0\n @property({ type: String, attribute: 'subject-prefix' }) 'subject-prefix'?: string\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: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) 'hide-add-rich-text' = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) 'show-rich-text' = false\n @property({ type: Boolean, attribute: 'show-delete-action' }) 'show-delete-action' = true\n @property({ type: Boolean, attribute: 'show-save-action' }) 'show-save-action' = true\n @property({ type: Boolean, reflect: true }) sorting = false\n @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = false\n @property({ type: String }) analysis = ''\n @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\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' })\n get 'answer-list'() { return this._answers }\n\n set 'answer-list'(value: any) {\n const answers = normalizeScaleAnswers(value)\n this._answers = answers.length ? answers : createDefaultScaleAnswers()\n this.requestUpdate('answer-list')\n }\n\n @property({ type: Array, attribute: 'scale-question-list' })\n get 'scale-question-list'() { return this._scaleQuestions }\n\n set 'scale-question-list'(value: any) {\n this._scaleQuestions = normalizeScaleQuestionList(value)\n this.requestUpdate('scale-question-list')\n }\n\n @property({ type: Array, attribute: 'scale-questions' })\n get 'scale-questions'() { return this._scaleQuestions }\n\n set 'scale-questions'(value: any) {\n this['scale-question-list'] = value\n this.requestUpdate('scale-questions')\n }\n\n @state() private _answers: ScaleAnswer[] = createDefaultScaleAnswers()\n @state() private _scaleQuestions: string[] = []\n @state() private _rowTitle = ''\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = false\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n const shouldSyncProps = changed.has('title')\n || changed.has('answer-list')\n || changed.has('rich-text-content')\n || changed.has('scale-question-list')\n || changed.has('scale-questions')\n\n if ((changed.has('is-edit') && this['is-edit']) || (!this['is-edit'] && shouldSyncProps)) {\n this._syncProps()\n }\n\n if (changed.has('model-value') && this['use-model']) {\n this._title = this['model-value']\n }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n this._rowTitle = this._scaleQuestions.join('\\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 emitSubjectEvent(this, name, detail)\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) {\n el.value = el.value.slice(0, this.TITLE_MAX)\n }\n this._title = el.value\n if (this['use-model']) {\n emitSubjectModelValue(this, this._title)\n }\n }\n\n private _resolvedQuestions(): string[] {\n const rowTitle = this['is-edit'] ? this._rowTitle : this._scaleQuestions.join('\\n')\n return splitScaleQuestionLines(rowTitle)\n }\n\n private _resolvedAnswers(): ScaleAnswer[] {\n const answers = this['is-edit'] ? this._answers : this['answer-list']\n return Array.isArray(answers) ? answers.map(normalizeScaleAnswer) : []\n }\n\n private _createAnswerCountError(row: Record<string, unknown>) {\n return new SubjectError('量表题选项数量必须在 3-5 个之间!', 'ANSWER_COUNT_INVALID', 'answers', row)\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = {\n customId: this['custom-id'] || undefined,\n answerType: SubjectType.SCALE,\n orderIndex: this['order-index'],\n }\n\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this._resolvedAnswers()\n const questions = this._resolvedQuestions()\n const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n const showRichText = this['show-rich-text'] && (this['is-edit'] ? this._showRichText : !!this['rich-text-content'])\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n\n if (answers.length < 3 || answers.length > 5) {\n reject(this._createAnswerCountError(row))\n return\n }\n\n for (let i = 0; i < answers.length; i++) {\n if (!answers[i].title) {\n reject(new SubjectError(`选项${String.fromCharCode(65 + i)}未填写。`, 'ANSWER_EMPTY', 'answers', row))\n return\n }\n }\n\n if (questions.length === 0) {\n reject(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n return\n }\n\n const result: any = {\n answerType: SubjectType.SCALE,\n examTypeEnum: SubjectType.SCALE,\n title,\n answers: answers.map(serializeScaleAnswer),\n scaleQuestionList: questions,\n analysis: trimText(this['is-edit'] ? this._analysis : this.analysis || ''),\n examRichTextContent: showRichText ? richText : '',\n isSetCorrectAnswer: false,\n }\n\n if (this['custom-id']) {\n result.customId = this['custom-id']\n }\n if (this['exam-answer-relation-type']) {\n result.examAnswerRelationType = this['exam-answer-relation-type']\n }\n\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 showSubjectToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = {\n customId: this['custom-id'] || undefined,\n answerType: SubjectType.SCALE,\n orderIndex: this['order-index'],\n }\n\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this._resolvedAnswers()\n const questions = this._resolvedQuestions()\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n\n if (answers.length < 3 || answers.length > 5) {\n errors.push(this._createAnswerCountError(row))\n return errors\n }\n\n answers.forEach((answer: ScaleAnswer, index: number) => {\n if (!answer.title) {\n errors.push(new SubjectError(`选项${String.fromCharCode(65 + index)}未填写`, 'ANSWER_EMPTY', 'answers', row))\n }\n })\n\n if (questions.length === 0) {\n errors.push(new SubjectError('行标题不能为空!', 'EMPTY_ROW_TITLE', 'rowTitle', row))\n }\n\n return errors\n }\n\n private _renderPreview() {\n const answers = this._resolvedAnswers()\n const questions = this._resolvedQuestions()\n const colWidth = Math.floor(100 / ((answers.length || 1) + 1))\n const previewTitle = buildSubjectPreviewTitle(this['subject-prefix'], this['order-index'], this.title)\n\n return html`\n <div class=\"preview\">\n <div class=\"preview-header\">\n <div class=\"preview-title-row\">\n <span class=\"title\">${previewTitle}</span>\n <span class=\"preview-type\">量表题</span>\n </div>\n ${this['show-rich-text'] && this['rich-text-content'] ? html`<div class=\"rich-text\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n </div>\n <div class=\"scale-table-wrap\">\n <table class=\"scale-table\">\n <thead>\n <tr>\n <th style=\"width:${colWidth}%\">问题</th>\n ${answers.map(answer => html`<th style=\"width:${colWidth}%\">${answer.title}</th>`)}\n </tr>\n </thead>\n <tbody>\n ${questions.map(question => html`\n <tr>\n <td>${question}</td>\n ${answers.map(() => html`<td><input type=\"radio\" disabled /></td>`)}\n </tr>\n `)}\n </tbody>\n </table>\n </div>\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"edit-form\">\n <div class=\"edit-row\">\n <div class=\"label\"><span>题目:</span></div>\n <div class=\"row-body\">\n <div class=\"el-input\">\n <textarea\n rows=\"2\"\n .value=${this._title}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【量表题】请输入问题\"\n ></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <slot name=\"business-tag\"></slot>\n\n <div class=\"edit-row\">\n <div class=\"label\"><span>量表内容:</span></div>\n <div class=\"row-body\">\n <div class=\"edit-grid\">\n <div class=\"edit-column\">\n <div class=\"edit-column-title\">行标题</div>\n <div class=\"el-input\">\n <textarea\n class=\"row-title-textarea\"\n .value=${this._rowTitle}\n @input=${(e: Event) => { this._rowTitle = (e.target as HTMLTextAreaElement).value }}\n @keydown=${(e: KeyboardEvent) => { e.stopPropagation() }}\n placeholder=\"请输入行标题\"\n ></textarea>\n </div>\n <div class=\"edit-note\">一行一个标题,预览时会自动整理空白行。</div>\n </div>\n <div class=\"edit-column\">\n <div class=\"edit-column-title\">评分选项</div>\n ${this._answers.map((answer, index) => html`\n <div class=\"answer-item\">\n <span class=\"label\">${String.fromCharCode(65 + index)}.</span>\n <div class=\"input\">\n <input\n type=\"text\"\n .value=${answer.title}\n maxlength=\"10\"\n @input=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._answers = this._answers.map((item, currentIndex) =>\n currentIndex === index ? { ...item, title: value } : item,\n )\n }}\n placeholder=\"选项${index + 1}\"\n />\n </div>\n <span\n class=\"icon\"\n @click=${() => {\n if (this._answers.length < 5) {\n this._answers = [...this._answers, createEmptyScaleAnswer()]\n }\n }}\n >${iconPlus}</span>\n <span\n class=\"icon ${this._answers.length < 3 ? 'disabled' : ''}\"\n @click=${() => {\n if (this._answers.length > 3) {\n this._answers = this._answers.filter((_, currentIndex) => currentIndex !== index)\n }\n }}\n >${iconRemove}</span>\n </div>\n `)}\n <div class=\"edit-note\">量表题需保持 3-5 个选项,保存时会校验。</div>\n </div>\n </div>\n </div>\n </div>\n\n ${this['show-rich-text'] && this._showRichText\n ? html`\n <div class=\"edit-row\">\n <div class=\"label\"><span>副文本:</span></div>\n <div class=\"row-body\">\n <slot name=\"sub-text\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .toolbar=${SUB_TEXT_EDITOR_TOOLBAR}\n .upload-image=${this['upload-image']}\n ?is-edit=${true}\n @input=${(e: CustomEvent) => { this._richText = (e.target as any).getContent() }}\n ></qxs-blocksuite-editor>\n </slot>\n ${!this['show-action']\n ? html`\n <div class=\"flex-justify-end\" style=\"margin-top:8px\">\n <span\n class=\"el-link danger\"\n @click=${() => {\n this._showRichText = false\n this._richText = ''\n }}\n >删除富文本</span>\n </div>\n `\n : ''}\n </div>\n </div>\n `\n : ''}\n\n ${this['show-analysis']\n ? html`\n <div class=\"edit-row\">\n <div class=\"label\"><span>解析:</span></div>\n <div class=\"row-body\">\n <div class=\"el-input\">\n <textarea\n rows=\"2\"\n .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"\n ></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n </div>\n `\n }\n\n private _renderSorting() {\n const title = trimText(this['is-edit'] ? this._title : this.title || '') || '未命名题目'\n const orderText = buildSubjectSortingTitle(this['subject-prefix'], this['order-index'], title)\n return renderSortingCard(orderText, SubjectTypeLabel[SubjectType.SCALE] || SubjectType.SCALE)\n }\n\n render() {\n if (this.sorting) {\n return this._renderSorting()\n }\n\n const content = this['is-edit']\n ? html`<div slot=\"edit\">${this._renderEdit()}</div>`\n : html`<div slot=\"preview\">${this._renderPreview()}</div>`\n\n return html`\n <qxs-subject-layout .show-edit=${this['is-edit']}>\n ${content}\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['show-rich-text'] && this._showRichText}\n .hide-add-rich-text=${!this['show-rich-text'] || this['hide-add-rich-text']}\n .show-delete-action=${this['show-delete-action']}\n .show-save-action=${this['show-save-action']}\n .show-other-option=${false}\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 @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 <slot name=\"action\"></slot>\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["createEmptyScaleAnswer","title","createDefaultScaleAnswers","Array","from","length","normalizeScaleAnswer","answer","next","trimText","answerId","examAnswerId","isCorrect","serializeScaleAnswer","index","orderIndex","iconPlus","html","iconRemove","QxsScale","LitElement","constructor","super","arguments","this","sorting","analysis","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","_scaleQuestions","_rowTitle","_title","_analysis","_showRichText","_richText","TITLE_MAX","value","answers","isArray","map","normalizeScaleAnswers","requestUpdate","item","String","trim","filter","Boolean","normalizeScaleQuestionList","willUpdate","changed","shouldSyncProps","has","_syncProps","join","_emit","name","detail","emitSubjectEvent","_onTitleInput","el","slice","emitSubjectModelValue","_resolvedQuestions","rowTitle","split","_resolvedAnswers","_createAnswerCountError","row","SubjectError","toJSON","customId","answerType","SubjectType","SCALE","questions","richText","showRichText","i","fromCharCode","examTypeEnum","scaleQuestionList","examRichTextContent","isSetCorrectAnswer","examAnswerRelationType","_save","stopImmediatePropagation","data","err","showSubjectToast","message","validate","errors","push","forEach","_renderPreview","colWidth","Math","floor","previewTitle","buildSubjectPreviewTitle","question","_renderEdit","stopPropagation","currentIndex","_","SUB_TEXT_EDITOR_TOOLBAR","getContent","_renderSorting","orderText","buildSubjectSortingTitle","renderSortingCard","SubjectTypeLabel","render","content","styles","sortingCardStyles","subjectHostStyles","subjectControlResetStyles","subjectPreviewBaseStyles","subjectFormBaseStyles","subjectTextareaStyles","css","__decorateClass","property","type","Number","attribute","prototype","reflect","Object","state","safeCustomElement"],"mappings":"sdAkBA,SAASA,IACP,MAAO,CAAEC,MAAO,GAClB,CAEA,SAASC,IACP,OAAOC,MAAMC,KAAK,CAAEC,OAAQ,GAAKL,EACnC,CAEA,SAASM,EAAqBC,GAC5B,MAAMC,EAAoB,IACrBD,EACHN,MAAOQ,EAAAA,SAASF,GAAQN,OAASM,GAAQA,QAAU,KAE/CG,EAAWH,GAAQG,UAAYH,GAAQI,aAO7C,YANiB,IAAbD,IACFF,EAAKE,SAAWA,UAEXF,EAAKD,cACLC,EAAKG,oBACLH,EAAKI,UACLJ,CACT,CAsBA,SAASK,EAAqBN,EAAaO,GACzC,MAAMN,EAAoB,IACrBF,EAAqBC,GACxBQ,WAAYD,EAAQ,EACpBP,OAAQE,EAAAA,SAASF,GAAQN,OAASM,GAAQA,QAAU,KAUtD,OARAC,EAAKP,MAAQQ,EAAAA,SAASD,EAAKP,OAAS,SACd,IAAlBO,EAAKE,WACPF,EAAKG,aAAeH,EAAKE,eAEL,IAAlBF,EAAKE,iBACAF,EAAKE,gBAEPF,EAAKI,UACLJ,CACT,CAEA,MAAMQ,EAAWC,EAAAA,IAAA,2NACXC,EAAaD,EAAAA,IAAA,qLAGNE,QAAAA,SAAN,cAAuBC,EAAAA,WA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AA,CADHC,EAAAA,SAAS,CAAEC,KAAMrI,MAAOuI,UAAW,qBAjJzBvH,QAAAA,SAkJPwH,UAAA,kBAAA,GAOaL,EAAA,CAAhBQ,EAAAA,SAzJU3H,QAAAA,SAyJMwH,UAAA,WAAA,GACAL,EAAA,CAAhBQ,EAAAA,SA1JU3H,QAAAA,SA0JMwH,UAAA,kBAAA,GACAL,EAAA,CAAhBQ,EAAAA,SA3JU3H,QAAAA,SA2JMwH,UAAA,YAAA,GACAL,EAAA,CAAhBQ,EAAAA,SA5JU3H,QAAAA,SA4JMwH,UAAA,SAAA,GACAL,EAAA,CAAhBQ,EAAAA,SA7JU3H,QAAAA,SA6JMwH,UAAA,YAAA,GACAL,EAAA,CAAhBQ,EAAAA,SA9JU3H,QAAAA,SA8JMwH,UAAA,gBAAA,GACAL,EAAA,CAAhBQ,EAAAA,SA/JU3H,QAAAA,SA+JMwH,UAAA,YAAA,GAEqCL,EAAA,CAArDC,EAAAA,SAAS,CAAEC,KAAMjF,OAAQmF,UAAW,iBAjK1BvH,QAAAA,SAiK2CwH,UAAA,cAAA,GACDL,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAM9E,QAASgF,UAAW,eAlK3BvH,QAAAA,SAkK0CwH,UAAA,YAAA,GAlK1CxH,QAAAA,SAANmH,EAAA,CADNS,EAAAA,kBAAkB,cACN5H,QAAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("./title-prefix.cjs");exports.buildSubjectPreviewTitle=function(t,o,r){return e.joinSubjectTitle(e.resolveSubjectPrefix(t,`${o+1}.`),r)},exports.buildSubjectSortingTitle=function(t,o,r){return e.joinSubjectTitle(e.resolveSubjectPrefix(t,`${o+1}. `),r)},exports.emitSubjectEvent=function(e,t,o){e.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:o??null}))},exports.emitSubjectModelValue=function(e,t){e.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:t}))},exports.getSubjectImageResources=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(e=>1===e?.resourceType).map(e=>e?.resource?.middle||e?.resource?.url).filter(Boolean)},exports.getSubjectVideoResource=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return e.find(e=>2===e?.resourceType)?.resource||null},exports.resolveSubjectCategoryLabel=function(){let e=arguments.length>1?arguments[1]:void 0;const t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).find(t=>String(t?.categoryId)===String(e));return t?.title||t?.categoryName||e||"未选择分类"},exports.showSubjectToast=function(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)};
2
+ //# sourceMappingURL=shared-methods.cjs.map