@qxs-bns/components-wc 0.0.32 → 0.0.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import{html as t,css as e,LitElement as i}from"lit";import{property as s,state as r}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";import{SUB_TEXT_EDITOR_TOOLBAR as a}from"../editor/toolbar.mjs";import{emitSubjectEvent as n,emitSubjectModelValue as l,showSubjectToast as d,buildSubjectPreviewTitle as h,buildSubjectSortingTitle as c}from"./shared-methods.mjs";import{subjectHostStyles as p,subjectControlResetStyles as u,subjectPreviewBaseStyles as w,subjectFormBaseStyles as x,subjectTextareaStyles as m}from"./shared-styles.mjs";import{SubjectError as y,trimText as v}from"./single.mjs";import{sortingCardStyles as g,renderSortingCard as _}from"./sorting-card.mjs";import{SubjectType as b,SubjectTypeLabel as f}from"./types.mjs";var T=Object.defineProperty,$=Object.getOwnPropertyDescriptor,A=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?$(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s?r(e,i,o):r(o))||o);return s&&o&&T(e,i,o),o};function E(){return{title:""}}function I(){return Array.from({length:5},E)}function j(t){const e={...t,title:v(t?.title??t?.answer??"")},i=t?.answerId??t?.examAnswerId;return void 0!==i&&(e.answerId=i),delete e.answer,delete e.examAnswerId,delete e.isCorrect,e}function S(t,e){const i={...j(t),orderIndex:e+1,answer:v(t?.title??t?.answer??"")};return i.title=v(i.title??""),void 0!==i.answerId&&(i.examAnswerId=i.answerId),void 0===i.answerId&&delete i.answerId,delete i.isCorrect,i}const q=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,C=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;let L=class extends i{constructor(){super(...arguments),this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["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,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=I(),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(j):[]}(t);this._answers=e.length?e:I(),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){n(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"]&&l(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(j):[]}_createAnswerCountError(t){return new y("量表题选项数量必须在 3-5 个之间!","ANSWER_COUNT_INVALID","answers",t)}async toJSON(){return new Promise((t,e)=>{const i={customId:this["custom-id"]||void 0,answerType:b.SCALE,orderIndex:this["order-index"]},s=v(this["is-edit"]?this._title:this.title||""),r=this._resolvedAnswers(),o=this._resolvedQuestions(),a=this["is-edit"]?this._richText:this["rich-text-content"]||"",n=this["show-rich-text"]&&(this["is-edit"]?this._showRichText:!!this["rich-text-content"]);if(!s)return void e(new y("题目标题不能为空!","EMPTY_TITLE","title",i));if(r.length<3||r.length>5)return void e(this._createAnswerCountError(i));for(let t=0;t<r.length;t++)if(!r[t].title)return void e(new y(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",i));if(0===o.length)return void e(new y("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const l={answerType:b.SCALE,examTypeEnum:b.SCALE,title:s,answers:r.map(S),scaleQuestionList:o,analysis:v(this["is-edit"]?this._analysis:this.analysis||""),examRichTextContent:n?a:"",isSetCorrectAnswer:!1};this["custom-id"]&&(l.customId=this["custom-id"]),this["exam-answer-relation-type"]&&(l.examAnswerRelationType=this["exam-answer-relation-type"]),t(l)})}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){d(t.message)}}validate(){const t=[],e={customId:this["custom-id"]||void 0,answerType:b.SCALE,orderIndex:this["order-index"]},i=v(this["is-edit"]?this._title:this.title||""),s=this._resolvedAnswers(),r=this._resolvedQuestions();return i||t.push(new y("题目标题不能为空!","EMPTY_TITLE","title",e)),s.length<3||s.length>5?(t.push(this._createAnswerCountError(e)),t):(s.forEach((i,s)=>{i.title||t.push(new y(`选项${String.fromCharCode(65+s)}未填写`,"ANSWER_EMPTY","answers",e))}),0===r.length&&t.push(new y("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e)),t)}_renderPreview(){const e=this._resolvedAnswers(),i=this._resolvedQuestions(),s=Math.floor(100/((e.length||1)+1)),r=h(this["subject-prefix"],this["order-index"],this.title);return t`
1
+ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state as r}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";import{SUB_TEXT_EDITOR_TOOLBAR as a}from"../editor/toolbar.mjs";import{emitSubjectEvent as n,emitSubjectModelValue as l,showSubjectToast as d,buildSubjectPreviewTitle as h,buildSubjectSortingTitle as c}from"./shared-methods.mjs";import{subjectHostStyles as p,subjectControlResetStyles as u,subjectPreviewBaseStyles as w,subjectFormBaseStyles as x,subjectTextareaStyles as m}from"./shared-styles.mjs";import{SubjectError as y,trimText as v}from"./single.mjs";import{sortingCardStyles as g,renderSortingCard as b}from"./sorting-card.mjs";import{SubjectType as f,SubjectTypeLabel as _}from"./types.mjs";var T=Object.defineProperty,$=Object.getOwnPropertyDescriptor,A=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?$(e,i):e,a=t.length-1;a>=0;a--)(r=t[a])&&(o=(s?r(e,i,o):r(o))||o);return s&&o&&T(e,i,o),o};function E(){return{title:""}}function I(){return Array.from({length:5},E)}function j(t){const e={...t,title:v(t?.title??t?.answer??"")},i=t?.answerId??t?.examAnswerId;return void 0!==i&&(e.answerId=i),delete e.answer,delete e.examAnswerId,delete e.isCorrect,e}function S(t,e){const i={...j(t),orderIndex:e+1,answer:v(t?.title??t?.answer??"")};return i.title=v(i.title??""),void 0!==i.answerId&&(i.examAnswerId=i.answerId),void 0===i.answerId&&delete i.answerId,delete i.isCorrect,i}const q=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,C=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;let k=class extends i{constructor(){super(...arguments),this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["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,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=I(),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(j):[]}(t);this._answers=e.length?e:I(),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){n(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"]&&l(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(j):[]}_createAnswerCountError(t){return new y("量表题选项数量必须在 3-5 个之间!","ANSWER_COUNT_INVALID","answers",t)}async toJSON(){return new Promise((t,e)=>{const i={customId:this["custom-id"]||void 0,answerType:f.SCALE,orderIndex:this["order-index"]},s=v(this["is-edit"]?this._title:this.title||""),r=this._resolvedAnswers(),o=this._resolvedQuestions(),a=this["is-edit"]?this._richText:this["rich-text-content"]||"",n=this["show-rich-text"]&&(this["is-edit"]?this._showRichText:!!this["rich-text-content"]);if(!s)return void e(new y("题目标题不能为空!","EMPTY_TITLE","title",i));if(r.length<3||r.length>5)return void e(this._createAnswerCountError(i));for(let t=0;t<r.length;t++)if(!r[t].title)return void e(new y(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",i));if(0===o.length)return void e(new y("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const l={answerType:f.SCALE,examTypeEnum:f.SCALE,title:s,answers:r.map(S),scaleQuestionList:o,analysis:v(this["is-edit"]?this._analysis:this.analysis||""),examRichTextContent:n?a:"",isSetCorrectAnswer:!1};this["custom-id"]&&(l.customId=this["custom-id"]),this["exam-answer-relation-type"]&&(l.examAnswerRelationType=this["exam-answer-relation-type"]),t(l)})}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){d(t.message)}}validate(){const t=[],e={customId:this["custom-id"]||void 0,answerType:f.SCALE,orderIndex:this["order-index"]},i=v(this["is-edit"]?this._title:this.title||""),s=this._resolvedAnswers(),r=this._resolvedQuestions();return i||t.push(new y("题目标题不能为空!","EMPTY_TITLE","title",e)),s.length<3||s.length>5?(t.push(this._createAnswerCountError(e)),t):(s.forEach((i,s)=>{i.title||t.push(new y(`选项${String.fromCharCode(65+s)}未填写`,"ANSWER_EMPTY","answers",e))}),0===r.length&&t.push(new y("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e)),t)}_renderPreview(){const e=this._resolvedAnswers(),i=this._resolvedQuestions(),s=Math.floor(100/((e.length||1)+1)),r=h(this["subject-prefix"],this["order-index"],this.title);return t`
2
2
  <div class="preview">
3
3
  <div class="preview-header">
4
4
  <div class="preview-title-row">
@@ -134,7 +134,7 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
134
134
  </div>
135
135
  `:""}
136
136
  </div>
137
- `}_renderSorting(){const t=v(this["is-edit"]?this._title:this.title||"")||"未命名题目",e=c(this["subject-prefix"],this["order-index"],t);return _(e,f[b.SCALE]||b.SCALE)}render(){if(this.sorting)return this._renderSorting();const e=this["is-edit"]?t`<div slot="edit">${this._renderEdit()}</div>`:t`<div slot="preview">${this._renderPreview()}</div>`;return t`
137
+ `}_renderSorting(){const t=v(this["is-edit"]?this._title:this.title||"")||"未命名题目",e=c(this["subject-prefix"],this["order-index"],t);return b(e,_[f.SCALE]||f.SCALE)}render(){if(this.sorting)return this._renderSorting();const e=this["is-edit"]?t`<div slot="edit">${this._renderEdit()}</div>`:t`<div slot="preview">${this._renderPreview()}</div>`;return t`
138
138
  <qxs-subject-layout .show-edit=${this["is-edit"]}>
139
139
  ${e}
140
140
  ${this["show-action"]?t`
@@ -157,16 +157,22 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
157
157
  `:""}
158
158
  <slot name="action"></slot>
159
159
  </qxs-subject-layout>
160
- `}};L.styles=[g,p,u,w,x,m,e`
160
+ `}};k.styles=[g,p,u,w,x,m,e`
161
161
  .scale-table-wrap {
162
162
  margin-top: 18px;
163
+ border: 1px solid #e5e7eb;
164
+ border-radius: 12px;
165
+ background: #fff;
163
166
  overflow: hidden;
164
167
  }
165
168
  .scale-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; color: #4b5563; }
166
169
  .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; }
168
- .scale-table td:first-child,
169
- .scale-table th:first-child {
170
+ .scale-table thead th { font-size: 12px; font-weight: 600; color: #8b95a7; background: #f8fafc; }
171
+ .scale-table thead th:first-child {
172
+ background: #f3f4f6;
173
+ }
174
+ .scale-table tbody td:first-child {
175
+ background: #fafafa;
170
176
  color: #303133;
171
177
  text-align: left;
172
178
  font-weight: 600;
@@ -254,5 +260,5 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state a
254
260
  gap: 16px;
255
261
  }
256
262
  }
257
- `],A([s({type:Number,attribute:"order-index"})],L.prototype,"order-index",2),A([s({type:String,attribute:"subject-prefix"})],L.prototype,"subject-prefix",2),A([s({type:String})],L.prototype,"title",2),A([s({type:String,attribute:"custom-id"})],L.prototype,"custom-id",2),A([s({type:Boolean,attribute:"is-edit"})],L.prototype,"is-edit",2),A([s({type:Boolean,attribute:"is-save"})],L.prototype,"is-save",2),A([s({type:Boolean,attribute:"is-set"})],L.prototype,"is-set",2),A([s({type:Boolean,attribute:"show-action"})],L.prototype,"show-action",2),A([s({type:Boolean,attribute:"show-add"})],L.prototype,"show-add",2),A([s({type:Boolean,attribute:"hide-add-rich-text"})],L.prototype,"hide-add-rich-text",2),A([s({type:Boolean,attribute:"show-rich-text"})],L.prototype,"show-rich-text",2),A([s({type:Boolean,attribute:"show-delete-action"})],L.prototype,"show-delete-action",2),A([s({type:Boolean,attribute:"show-save-action"})],L.prototype,"show-save-action",2),A([s({type:Boolean,reflect:!0})],L.prototype,"sorting",2),A([s({type:Boolean,attribute:"show-analysis"})],L.prototype,"show-analysis",2),A([s({type:String})],L.prototype,"analysis",2),A([s({type:String,attribute:"rich-text-content"})],L.prototype,"rich-text-content",2),A([s({type:Number,attribute:"exam-answer-relation-type"})],L.prototype,"exam-answer-relation-type",2),A([s({type:Object,attribute:"upload-image"})],L.prototype,"upload-image",2),A([s({type:Array,attribute:"answer-list"})],L.prototype,"answer-list",1),A([s({type:Array,attribute:"scale-question-list"})],L.prototype,"scale-question-list",1),A([s({type:Array,attribute:"scale-questions"})],L.prototype,"scale-questions",1),A([r()],L.prototype,"_answers",2),A([r()],L.prototype,"_scaleQuestions",2),A([r()],L.prototype,"_rowTitle",2),A([r()],L.prototype,"_title",2),A([r()],L.prototype,"_analysis",2),A([r()],L.prototype,"_showRichText",2),A([r()],L.prototype,"_richText",2),A([s({type:String,attribute:"model-value"})],L.prototype,"model-value",2),A([s({type:Boolean,attribute:"use-model"})],L.prototype,"use-model",2),L=A([o("qxs-scale")],L);export{L as QxsScale};
263
+ `],A([s({type:Number,attribute:"order-index"})],k.prototype,"order-index",2),A([s({type:String,attribute:"subject-prefix"})],k.prototype,"subject-prefix",2),A([s({type:String})],k.prototype,"title",2),A([s({type:String,attribute:"custom-id"})],k.prototype,"custom-id",2),A([s({type:Boolean,attribute:"is-edit"})],k.prototype,"is-edit",2),A([s({type:Boolean,attribute:"is-save"})],k.prototype,"is-save",2),A([s({type:Boolean,attribute:"is-set"})],k.prototype,"is-set",2),A([s({type:Boolean,attribute:"show-action"})],k.prototype,"show-action",2),A([s({type:Boolean,attribute:"show-add"})],k.prototype,"show-add",2),A([s({type:Boolean,attribute:"hide-add-rich-text"})],k.prototype,"hide-add-rich-text",2),A([s({type:Boolean,attribute:"show-rich-text"})],k.prototype,"show-rich-text",2),A([s({type:Boolean,attribute:"show-delete-action"})],k.prototype,"show-delete-action",2),A([s({type:Boolean,attribute:"show-save-action"})],k.prototype,"show-save-action",2),A([s({type:Boolean,reflect:!0})],k.prototype,"sorting",2),A([s({type:Boolean,attribute:"show-analysis"})],k.prototype,"show-analysis",2),A([s({type:String})],k.prototype,"analysis",2),A([s({type:String,attribute:"rich-text-content"})],k.prototype,"rich-text-content",2),A([s({type:Number,attribute:"exam-answer-relation-type"})],k.prototype,"exam-answer-relation-type",2),A([s({type:Object,attribute:"upload-image"})],k.prototype,"upload-image",2),A([s({type:Array,attribute:"answer-list"})],k.prototype,"answer-list",1),A([s({type:Array,attribute:"scale-question-list"})],k.prototype,"scale-question-list",1),A([s({type:Array,attribute:"scale-questions"})],k.prototype,"scale-questions",1),A([r()],k.prototype,"_answers",2),A([r()],k.prototype,"_scaleQuestions",2),A([r()],k.prototype,"_rowTitle",2),A([r()],k.prototype,"_title",2),A([r()],k.prototype,"_analysis",2),A([r()],k.prototype,"_showRichText",2),A([r()],k.prototype,"_richText",2),A([s({type:String,attribute:"model-value"})],k.prototype,"model-value",2),A([s({type:Boolean,attribute:"use-model"})],k.prototype,"use-model",2),k=A([o("qxs-scale")],k);export{k as QxsScale};
258
264
  //# sourceMappingURL=scale.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"scale.mjs","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":"27BAkBA,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,EAASF,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,EAASF,GAAQN,OAASM,GAAQA,QAAU,KAUtD,OARAC,EAAKP,MAAQQ,EAASD,EAAKP,OAAS,SACd,IAAlBO,EAAKE,WACPF,EAAKG,aAAeH,EAAKE,eAEL,IAAlBF,EAAKE,iBACAF,EAAKE,gBAEPF,EAAKI,UACLJ,CACT,CAEA,MAAMQ,EAAWC,CAAA,2NACXC,EAAaD,CAAA,qLAGZ,IAAME,EAAN,cAAuBC,EAAvBC,WAAAA,GAAAC,SAAAC,WAoGiDC,KAAA,eAAgB,EAE1CA,KAAAvB,MAAQ,GACgBuB,KAAA,aAAc,GACfA,KAAA,YAAY,EACZA,KAAA,YAAY,EACb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.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 border: 1px solid #e5e7eb;\n border-radius: 12px;\n background: #fff;\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; background: #f8fafc; }\n .scale-table thead th:first-child {\n background: #f3f4f6;\n }\n .scale-table tbody td:first-child {\n background: #fafafa;\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":"27BAkBA,SAASA,IACP,MAAO,CAAEC,MAAO,GAClB,CAEA,SAASC,IACP,OAAOC,MAAMC,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W,yBA/IzBvH,EAgJPwH,UAAA,sBAAA,GAQAL,EAAA,CADHC,EAAS,CAAEC,KAAMrI,MAAOuI,UAAW,qBAvJzBvH,EAwJPwH,UAAA,kBAAA,GAOaL,EAAA,CAAhBQ,KA/JU3H,EA+JMwH,UAAA,WAAA,GACAL,EAAA,CAAhBQ,KAhKU3H,EAgKMwH,UAAA,kBAAA,GACAL,EAAA,CAAhBQ,KAjKU3H,EAiKMwH,UAAA,YAAA,GACAL,EAAA,CAAhBQ,KAlKU3H,EAkKMwH,UAAA,SAAA,GACAL,EAAA,CAAhBQ,KAnKU3H,EAmKMwH,UAAA,YAAA,GACAL,EAAA,CAAhBQ,KApKU3H,EAoKMwH,UAAA,gBAAA,GACAL,EAAA,CAAhBQ,KArKU3H,EAqKMwH,UAAA,YAAA,GAEqCL,EAAA,CAArDC,EAAS,CAAEC,KAAMjF,OAAQmF,UAAW,iBAvK1BvH,EAuK2CwH,UAAA,cAAA,GACDL,EAAA,CAApDC,EAAS,CAAEC,KAAM9E,QAASgF,UAAW,eAxK3BvH,EAwK0CwH,UAAA,YAAA,GAxK1CxH,EAANmH,EAAA,CADNS,EAAkB,cACN5H"}
@@ -364,7 +364,7 @@
364
364
  text-align: center;
365
365
  }
366
366
 
367
- .editor-content .ProseMirror:empty {
367
+ .editor-wrapper:not(.preview) .ProseMirror {
368
368
  min-height: 80px;
369
369
  }
370
370