@qxs-bns/components-wc 0.0.28 → 0.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/subject/action.mjs +5 -5
- package/es/subject/action.mjs.map +1 -1
- package/es/subject/blank-fill.mjs +12 -8
- package/es/subject/blank-fill.mjs.map +1 -1
- package/es/subject/page-end.mjs +6 -4
- package/es/subject/page-end.mjs.map +1 -1
- package/es/subject/scale.mjs +34 -14
- package/es/subject/scale.mjs.map +1 -1
- package/es/subject/single.mjs +9 -5
- package/es/subject/single.mjs.map +1 -1
- package/es/subject/text-fill.mjs +10 -6
- package/es/subject/text-fill.mjs.map +1 -1
- package/lib/subject/action.cjs +5 -5
- package/lib/subject/action.cjs.map +1 -1
- package/lib/subject/blank-fill.cjs +10 -6
- package/lib/subject/blank-fill.cjs.map +1 -1
- package/lib/subject/page-end.cjs +5 -3
- package/lib/subject/page-end.cjs.map +1 -1
- package/lib/subject/scale.cjs +30 -10
- package/lib/subject/scale.cjs.map +1 -1
- package/lib/subject/single.cjs +9 -5
- package/lib/subject/single.cjs.map +1 -1
- package/lib/subject/text-fill.cjs +9 -5
- package/lib/subject/text-fill.cjs.map +1 -1
- package/package.json +1 -1
package/es/subject/text-fill.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{css as t,LitElement as e,html as i}from"lit";import{property as s,state as r}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";import{trimCommaSeparatedText as a,SubjectError as n,trimText as l}from"./single.mjs";import{sortingCardStyles as d,renderSortingCard as h}from"./sorting-card.mjs";import{SubjectType as
|
|
1
|
+
import{css as t,LitElement as e,html as i}from"lit";import{property as s,state as r}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";import{trimCommaSeparatedText as a,SubjectError as n,trimText as l}from"./single.mjs";import{sortingCardStyles as d,renderSortingCard as h}from"./sorting-card.mjs";import{SubjectType as c,SubjectTypeLabel as p}from"./types.mjs";var g=Object.defineProperty,x=Object.getOwnPropertyDescriptor,u=(t,e,i,s)=>{for(var r,o=s>1?void 0:s?x(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&&g(e,i,o),o};const y=[{bg:"#ecf5ff",color:"#3D61E3",border:"#d9ecff"},{bg:"#f0f9eb",color:"#67c23a",border:"#c2e7b0"},{bg:"#fdf6ec",color:"#e6a23c",border:"#faecd8"},{bg:"#fef0f0",color:"#f56c6c",border:"#fde2e2"},{bg:"#f4f4f5",color:"#909399",border:"#e9e9eb"}];let w=class extends e{constructor(){super(...arguments),this._iconPlus=i`<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>`,this._iconRemove=i`<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>`,this["order-index"]=0,this.title="",this["custom-id"]="",this["is-edit"]=!1,this["is-save"]=!1,this["is-set"]=!1,this["is-key"]=!1,this["show-action"]=!0,this["show-add"]=!0,this["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-answer-setting"]=!1,this["show-analysis"]=!1,this["rich-text-content"]="",this.analysis="",this["exam-answer-relation-type"]=0,this["exam-expand"]="",this["exam-id"]=0,this["category-id"]="",this["exam-answer-setting"]={isInOrder:!1,isIgnoreCase:!0},this["upload-image"]=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this["answer-list"]=[],this["tag-list"]=[],this["category-list"]=[],this["resource-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-resource"]=!1,this["model-value"]="",this["use-model"]=!1,this._answers=[{title:"",tag:"",showInput:!1}],this._title="",this._analysis="",this._isInOrder=!1,this._isIgnoreCase=!0,this._keywordCount=null,this._correct="",this._showRichText=!1,this._richText="",this._selectedTagList=[],this._categoryId="",this.TITLE_MAX=200}willUpdate(t){t.has("is-edit")&&this["is-edit"]&&this._syncProps(),!this["is-edit"]&&(t.has("title")||t.has("answer-list")||t.has("analysis")||t.has("exam-answer-setting")||t.has("rich-text-content")||t.has("exam-expand")||t.has("tag-list")||t.has("category-id"))&&this._syncProps(),t.has("model-value")&&this["use-model"]&&(this._title=this["model-value"]),t.has("tag-list")&&(this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(t=>({...t})):[]),t.has("category-id")&&(this._categoryId=this["category-id"]?String(this["category-id"]):"")}_normalizeAnswerTitle(t){return a(t?.title??t?.answer??"")}_normalizedAnswerList(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(Array.isArray(t)?t:[]).map(t=>({...t,answerId:t?.answerId??t?.examAnswerId,title:this._normalizeAnswerTitle(t)}))}_filledAnswers(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).filter(t=>this._normalizeAnswerTitle(t))}_readKeywordCount(t){return t&&void 0!==t.keywordCount&&null!==t.keywordCount&&""!==t.keywordCount?Number(t.keywordCount):null}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this["answer-list"]?.length?this._answers=this._normalizedAnswerList(this["answer-list"]).map(t=>({title:t.title||"",tag:"",showInput:!1,answerId:t.answerId,customAnswerId:t.customAnswerId})):this._answers=[{title:"",tag:"",showInput:!1}],this._isInOrder=!!this["exam-answer-setting"]?.isInOrder,this._isIgnoreCase=this["exam-answer-setting"]?.isIgnoreCase??!0,this._keywordCount=this._readKeywordCount(this["exam-answer-setting"]),this._richText=this["rich-text-content"]||"",this._showRichText=!!this["rich-text-content"],this._correct=this["exam-expand"]||"",this._selectedTagList=Array.isArray(this["tag-list"])?this["tag-list"].map(t=>({...t})):[],this._categoryId=this["category-id"]?String(this["category-id"]):""}_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}))}_addTag(t){const e={...this._answers[t]};e.tag&&(e.title=e.title?[e.title,e.tag].join(","):e.tag,e.tag=""),e.showInput=!1,this._answers=this._answers.map((i,s)=>s===t?e:i)}_closeTag(t,e){const i={...this._answers[e]};i.title=i.title.split(",").filter(e=>e!==t).join(","),this._answers=this._answers.map((t,s)=>s===e?i:t)}_addAnswer(){this._answers=[...this._answers,{title:"",tag:"",showInput:!1}]}_deleteAnswer(t){this._answers.length<2||(this._answers=this._answers.filter((e,i)=>i!==t))}_onCategoryChange(t){this._categoryId=t,this._emit("category-change",{value:t,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_imageResources(){return(this["resource-list"]||[]).filter(t=>1===t.resourceType).map(t=>t.resource.middle||t.resource.url).filter(Boolean)}_videoResource(){return(this["resource-list"]||[]).find(t=>2===t.resourceType)?.resource||null}_categoryLabel(){const t=this["category-list"].find(t=>String(t.categoryId)===String(this._categoryId));return t?.title||t?.categoryName||this._categoryId||"未选择分类"}_validateState(t){const{row:e,title:i,answers:s,correct:r,keywordCount:o}=t;if(!i)return new n("题目标题不能为空!","EMPTY_TITLE","title",e);const a=this._filledAnswers(s);return!!r||null!==o||a.length>0?r?!o||o<1?new n("请完善答题设置!","NO_KEYWORD_COUNT","keywordCount",e):a.length?o>a.length?new n("关键词个数设置有误!","KEYWORD_COUNT_MISMATCH","answers",e):null:new n("请设置关键词","NO_KEYWORDS","answers",e):new n("请输入问题正确答案!","NO_CORRECT_ANSWER","correct",e):null}async toJSON(){return new Promise((t,e)=>{const i={customId:this["custom-id"]||void 0,answerType:"text_fill",orderIndex:this["order-index"]},s=l(this["is-edit"]?this._title:this.title||""),r=this["is-edit"]?this._answers:this._normalizedAnswerList(this["answer-list"]||[]),o=l(this["is-edit"]?this._analysis:this.analysis||""),a=l(this["is-edit"]?this._correct:this["exam-expand"]||""),n=this["is-edit"]?this._keywordCount:this._readKeywordCount(this["exam-answer-setting"]),d=this["is-edit"]?this._isInOrder:this["exam-answer-setting"]?.isInOrder??!1,h=this["is-edit"]?this._isIgnoreCase:this["exam-answer-setting"]?.isIgnoreCase??!0,p=this["is-edit"]?this._showRichText:!!this["rich-text-content"],g=this["is-edit"]?this._richText:this["rich-text-content"]||"",x=this._validateState({row:i,title:s,answers:r,correct:a,keywordCount:n});if(x)return void e(x);const u={answerType:c.TEXT_FILL,examTypeEnum:c.TEXT_FILL,title:s,answers:this._filledAnswers(r).map((t,e)=>{const i=this._normalizeAnswerTitle(t),s={title:i,answer:i,orderIndex:e+1};return t.answerId&&(s.answerId=t.answerId,s.examAnswerId=t.answerId),t.customAnswerId&&(s.customAnswerId=t.customAnswerId),s}),analysis:o,isSetCorrectAnswer:!!a,isKey:this["is-key"],examExpand:a,examAnswerSettingBO:{isIgnoreCase:h,isInOrder:d,...null!==n?{keywordCount:n}:{}},examAnswerSettingVO:{isIgnoreCase:h,isInOrder:d,...null!==n?{keywordCount:n}:{}},examRichTextContent:p?g:""};this["custom-id"]&&(u.customId=this["custom-id"]),t(u)})}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={customId:this["custom-id"]||void 0,answerType:"text_fill",orderIndex:this["order-index"]},e=l(this["is-edit"]?this._title:this.title||""),i=this["is-edit"]?this._answers:this._normalizedAnswerList(this["answer-list"]||[]),s=l(this["is-edit"]?this._correct:this["exam-expand"]||""),r=this["is-edit"]?this._keywordCount:this._readKeywordCount(this["exam-answer-setting"]),o=this._validateState({row:t,title:e,answers:i,correct:s,keywordCount:r});return o?[o]:[]}_renderPreview(){const t=this["is-edit"]?this._answers:this._normalizedAnswerList(this["answer-list"]||[]),e=this["is-edit"]?this._correct:this["exam-expand"]||"";return i`
|
|
2
2
|
<div class="preview">
|
|
3
3
|
<span class="title">${this["order-index"]+1}.${this.title}(问答题)</span>
|
|
4
|
-
${this["rich-text-content"]?i`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
|
|
4
|
+
${this["show-rich-text"]&&this["rich-text-content"]?i`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
|
|
5
5
|
${this._filledAnswers(t).length?i`
|
|
6
6
|
<div style="margin-top:8px;color:#a8abb2">
|
|
7
7
|
${this._filledAnswers(t).map((t,e)=>i`<span style="margin-right:10px">关键词${e+1}: ${this._normalizeAnswerTitle(t)}</span>`)}
|
|
@@ -12,7 +12,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
12
12
|
${this["show-category"]&&this._categoryId?i`<div class="section-row"><span class="value-text">分类:${this._categoryLabel()}</span></div>`:""}
|
|
13
13
|
${this._renderResourceSection()}
|
|
14
14
|
</div>
|
|
15
|
-
`}_renderSorting(){const t=l(this["is-edit"]?this._title:this.title||"")||"未命名题目",e=`${this["order-index"]+1}. ${t}`;return h(e,c
|
|
15
|
+
`}_renderSorting(){const t=l(this["is-edit"]?this._title:this.title||"")||"未命名题目",e=`${this["order-index"]+1}. ${t}`;return h(e,p[c.TEXT_FILL]||c.TEXT_FILL)}_renderCategorySection(){return this["show-category"]?i`
|
|
16
16
|
<div class="flex-items-start section-row">
|
|
17
17
|
<div class="label"><span>分类:</span></div>
|
|
18
18
|
<div style="flex:1">
|
|
@@ -130,7 +130,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
130
130
|
`)}
|
|
131
131
|
</div>
|
|
132
132
|
|
|
133
|
-
${this._showRichText?i`
|
|
133
|
+
${this["show-rich-text"]&&this._showRichText?i`
|
|
134
134
|
<div class="flex-items-start" style="margin-top:12px">
|
|
135
135
|
<div class="label"><span>副文本:</span></div>
|
|
136
136
|
<div style="flex:1">
|
|
@@ -167,7 +167,10 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
167
167
|
.is-edit=${this["is-edit"]}
|
|
168
168
|
.is-set=${this["is-set"]}
|
|
169
169
|
.show-add=${this["show-add"]}
|
|
170
|
-
.show-rich-text=${this._showRichText}
|
|
170
|
+
.show-rich-text=${this["show-rich-text"]&&this._showRichText}
|
|
171
|
+
.hide-add-rich-text=${!this["show-rich-text"]||this["hide-add-rich-text"]}
|
|
172
|
+
.show-delete-action=${this["show-delete-action"]}
|
|
173
|
+
.show-save-action=${this["show-save-action"]}
|
|
171
174
|
exam-answer-relation-type=${this["exam-answer-relation-type"]}
|
|
172
175
|
@delete=${()=>this._emit("delete")}
|
|
173
176
|
@save=${this._save}
|
|
@@ -177,6 +180,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
177
180
|
@on-show-rich-text=${()=>{this._showRichText=!this._showRichText,this._showRichText||(this._richText="")}}
|
|
178
181
|
></qxs-subject-action>
|
|
179
182
|
`:""}
|
|
183
|
+
<slot name="action"></slot>
|
|
180
184
|
</qxs-subject-layout>
|
|
181
185
|
`}};w.styles=[d,t`
|
|
182
186
|
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
|
|
@@ -252,5 +256,5 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
252
256
|
width: 72px; height: 72px; object-fit: cover; border-radius: 6px;
|
|
253
257
|
border: 1px solid #e4e7ed; background: #f5f7fa;
|
|
254
258
|
}
|
|
255
|
-
`],
|
|
259
|
+
`],u([s({type:Number,attribute:"order-index"})],w.prototype,"order-index",2),u([s({type:String})],w.prototype,"title",2),u([s({type:String,attribute:"custom-id"})],w.prototype,"custom-id",2),u([s({type:Boolean,attribute:"is-edit"})],w.prototype,"is-edit",2),u([s({type:Boolean,attribute:"is-save"})],w.prototype,"is-save",2),u([s({type:Boolean,attribute:"is-set"})],w.prototype,"is-set",2),u([s({type:Boolean,attribute:"is-key"})],w.prototype,"is-key",2),u([s({type:Boolean,attribute:"show-action"})],w.prototype,"show-action",2),u([s({type:Boolean,attribute:"show-add"})],w.prototype,"show-add",2),u([s({type:Boolean,attribute:"hide-add-rich-text"})],w.prototype,"hide-add-rich-text",2),u([s({type:Boolean,attribute:"show-rich-text"})],w.prototype,"show-rich-text",2),u([s({type:Boolean,attribute:"show-delete-action"})],w.prototype,"show-delete-action",2),u([s({type:Boolean,attribute:"show-save-action"})],w.prototype,"show-save-action",2),u([s({type:Boolean,reflect:!0})],w.prototype,"sorting",2),u([s({type:Boolean,attribute:"show-answer-setting"})],w.prototype,"show-answer-setting",2),u([s({type:Boolean,attribute:"show-analysis"})],w.prototype,"show-analysis",2),u([s({type:String,attribute:"rich-text-content"})],w.prototype,"rich-text-content",2),u([s({type:String})],w.prototype,"analysis",2),u([s({type:Number,attribute:"exam-answer-relation-type"})],w.prototype,"exam-answer-relation-type",2),u([s({type:String,attribute:"exam-expand"})],w.prototype,"exam-expand",2),u([s({type:Number,attribute:"exam-id"})],w.prototype,"exam-id",2),u([s({type:String,attribute:"category-id"})],w.prototype,"category-id",2),u([s({type:Object,attribute:"exam-answer-setting"})],w.prototype,"exam-answer-setting",2),u([s({type:Object,attribute:"upload-image"})],w.prototype,"upload-image",2),u([s({type:Array,attribute:"answer-list"})],w.prototype,"answer-list",2),u([s({type:Array,attribute:"tag-list"})],w.prototype,"tag-list",2),u([s({type:Array,attribute:"category-list"})],w.prototype,"category-list",2),u([s({type:Array,attribute:"resource-list"})],w.prototype,"resource-list",2),u([s({type:Boolean,attribute:"show-tag"})],w.prototype,"show-tag",2),u([s({type:Boolean,attribute:"show-category"})],w.prototype,"show-category",2),u([s({type:Boolean,attribute:"show-resource"})],w.prototype,"show-resource",2),u([s({type:Object,attribute:"search-handler"})],w.prototype,"search-handler",2),u([s({type:String,attribute:"model-value"})],w.prototype,"model-value",2),u([s({type:Boolean,attribute:"use-model"})],w.prototype,"use-model",2),u([r()],w.prototype,"_answers",2),u([r()],w.prototype,"_title",2),u([r()],w.prototype,"_analysis",2),u([r()],w.prototype,"_isInOrder",2),u([r()],w.prototype,"_isIgnoreCase",2),u([r()],w.prototype,"_keywordCount",2),u([r()],w.prototype,"_correct",2),u([r()],w.prototype,"_showRichText",2),u([r()],w.prototype,"_richText",2),u([r()],w.prototype,"_selectedTagList",2),u([r()],w.prototype,"_categoryId",2),w=u([o("qxs-text-fill")],w);export{w as QxsTextFill};
|
|
256
260
|
//# sourceMappingURL=text-fill.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-fill.mjs","sources":["../../../../packages/components-wc/src/subject/text-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { type Category, type Resource, SubjectError, type TagItem, trimCommaSeparatedText, trimText } from './single'\nimport { renderSortingCard, sortingCardStyles } from './sorting-card'\nimport { SubjectType, SubjectTypeLabel } from './types'\n\ninterface TextAnswer {\n title: string\n tag: string\n showInput: boolean\n answerId?: string | number\n customAnswerId?: string | number\n}\n\ninterface TextAnswerSetting {\n isInOrder?: boolean\n isIgnoreCase?: boolean\n keywordCount?: number\n}\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' },\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' },\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' },\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' },\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' },\n]\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-text-fill')\nexport class QxsTextFill extends LitElement {\n private readonly _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>`\n private readonly _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 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\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\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 .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .section-row { margin-top: 12px; }\n .value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }\n .tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }\n .tag-item {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 4px 8px; font-size: 12px; line-height: 1;\n color: #3D61E3; background: #ecf5ff; border: 1px solid #d9ecff; border-radius: 4px;\n }\n .tag-item .close { cursor: pointer; color: #909399; }\n .tag-item .close:hover { color: #f56c6c; }\n .tag-hint { font-size: 12px; color: #909399; }\n .el-select {\n width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n background-repeat: no-repeat; background-position: right 8px center;\n }\n .resource-summary { font-size: 12px; color: #606266; }\n .resource-thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }\n .resource-thumb {\n width: 72px; height: 72px; object-fit: cover; border-radius: 6px;\n border: 1px solid #e4e7ed; background: #f5f7fa;\n }\n `]\n\n @property({ type: Number, attribute: 'order-index' }) 'order-index' = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-save' }) 'is-save' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, reflect: true }) sorting = false\n @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = true\n @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n @property({ type: String, attribute: 'exam-expand' }) 'exam-expand' = ''\n @property({ type: Number, attribute: 'exam-id' }) 'exam-id' = 0\n @property({ type: String, attribute: 'category-id' }) 'category-id' = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n 'exam-answer-setting': TextAnswerSetting = { isInOrder: false, isIgnoreCase: true }\n\n @property({ type: Object, attribute: 'upload-image' })\n 'upload-image': (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = e => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' }) 'answer-list': any[] = []\n @property({ type: Array, attribute: 'tag-list' }) 'tag-list': TagItem[] = []\n @property({ type: Array, attribute: 'category-list' }) 'category-list': Category[] = []\n @property({ type: Array, attribute: 'resource-list' }) 'resource-list': Resource[] = []\n @property({ type: Boolean, attribute: 'show-tag' }) 'show-tag' = false\n @property({ type: Boolean, attribute: 'show-category' }) 'show-category' = false\n @property({ type: Boolean, attribute: 'show-resource' }) 'show-resource' = false\n @property({ type: Object, attribute: 'search-handler' }) 'search-handler'?: (query: string, answerType: number) => Promise<any[]>\n\n @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = false\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = false\n @state() private _isIgnoreCase = true\n @state() private _keywordCount: number | null = null\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n @state() private _selectedTagList: TagItem[] = []\n @state() private _categoryId = ''\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('is-edit') && this['is-edit']) { this._syncProps() }\n if (!this['is-edit'] && (changed.has('title') || changed.has('answer-list') || changed.has('analysis') || changed.has('exam-answer-setting') || changed.has('rich-text-content') || changed.has('exam-expand') || changed.has('tag-list') || changed.has('category-id'))) {\n this._syncProps()\n }\n if (changed.has('model-value') && this['use-model']) {\n this._title = this['model-value']\n }\n if (changed.has('tag-list')) {\n this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n }\n if (changed.has('category-id')) {\n this._categoryId = this['category-id'] ? String(this['category-id']) : ''\n }\n }\n\n private _normalizeAnswerTitle(answer: any) {\n return trimCommaSeparatedText(answer?.title ?? answer?.answer ?? '')\n }\n\n private _normalizedAnswerList(source: any[] = []) {\n return (Array.isArray(source) ? source : []).map((answer: any) => ({\n ...answer,\n answerId: answer?.answerId ?? answer?.examAnswerId,\n title: this._normalizeAnswerTitle(answer),\n }))\n }\n\n private _filledAnswers(source: any[] = []) {\n return source.filter(answer => this._normalizeAnswerTitle(answer))\n }\n\n private _readKeywordCount(setting?: TextAnswerSetting | null) {\n if (!setting || setting.keywordCount === undefined || setting.keywordCount === null || setting.keywordCount === '') {\n return null\n }\n return Number(setting.keywordCount)\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n if (this['answer-list']?.length) {\n this._answers = this._normalizedAnswerList(this['answer-list']).map((answer: any) => ({\n title: answer.title || '',\n tag: '',\n showInput: false,\n answerId: answer.answerId,\n customAnswerId: answer.customAnswerId,\n }))\n }\n else {\n this._answers = [{ title: '', tag: '', showInput: false }]\n }\n this._isInOrder = !!this['exam-answer-setting']?.isInOrder\n this._isIgnoreCase = this['exam-answer-setting']?.isIgnoreCase ?? true\n this._keywordCount = this._readKeywordCount(this['exam-answer-setting'])\n this._richText = this['rich-text-content'] || ''\n this._showRichText = !!this['rich-text-content']\n this._correct = this['exam-expand'] || ''\n this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n this._categoryId = this['category-id'] ? String(this['category-id']) : ''\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) { el.value = el.value.slice(0, this.TITLE_MAX) }\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 _addTag(index: number) {\n const answer = { ...this._answers[index] }\n if (answer.tag) {\n answer.title = answer.title ? [answer.title, answer.tag].join(',') : answer.tag\n answer.tag = ''\n }\n answer.showInput = false\n this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? answer : item)\n }\n\n private _closeTag(tag: string, index: number) {\n const answer = { ...this._answers[index] }\n answer.title = answer.title.split(',').filter(item => item !== tag).join(',')\n this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? answer : item)\n }\n\n private _addAnswer() {\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2) { return }\n this._answers = this._answers.filter((_, currentIndex) => currentIndex !== index)\n }\n\n private _onCategoryChange(value: string) {\n this._categoryId = value\n this._emit('category-change', {\n value,\n customId: this['custom-id'] || '',\n examId: this['exam-id'] || 0,\n })\n }\n\n private _imageResources() {\n return (this['resource-list'] || [])\n .filter(item => item.resourceType === 1)\n .map(item => item.resource.middle || item.resource.url)\n .filter(Boolean) as string[]\n }\n\n private _videoResource() {\n return (this['resource-list'] || []).find(item => item.resourceType === 2)?.resource || null\n }\n\n private _categoryLabel() {\n const matched = this['category-list'].find((item: any) => String(item.categoryId) === String(this._categoryId))\n return matched?.title || matched?.categoryName || this._categoryId || '未选择分类'\n }\n\n private _validateState(options: {\n row: any\n title: string\n answers: TextAnswer[]\n correct: string\n keywordCount: number | null\n }) {\n const { row, title, answers, correct, keywordCount } = options\n if (!title) {\n return new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row)\n }\n\n const filledAnswers = this._filledAnswers(answers)\n const shouldValidateAnswers = !!correct || keywordCount !== null || filledAnswers.length > 0\n\n if (!shouldValidateAnswers) { return null }\n if (!correct) {\n return new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row)\n }\n if (!keywordCount || keywordCount < 1) {\n return new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row)\n }\n if (!filledAnswers.length) {\n return new SubjectError('请设置关键词', 'NO_KEYWORDS', 'answers', row)\n }\n if (keywordCount > filledAnswers.length) {\n return new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row)\n }\n return null\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this['custom-id'] || undefined, answerType: 'text_fill', orderIndex: this['order-index'] }\n\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n const analysis = trimText(this['is-edit'] ? this._analysis : this.analysis || '')\n const correct = trimText(this['is-edit'] ? this._correct : this['exam-expand'] || '')\n const keywordCount = this['is-edit'] ? this._keywordCount : this._readKeywordCount(this['exam-answer-setting'])\n const isInOrder = this['is-edit'] ? this._isInOrder : (this['exam-answer-setting']?.isInOrder ?? false)\n const isIgnoreCase = this['is-edit'] ? this._isIgnoreCase : (this['exam-answer-setting']?.isIgnoreCase ?? true)\n const showRichText = this['is-edit'] ? this._showRichText : !!this['rich-text-content']\n const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n const validationError = this._validateState({ row, title, answers, correct, keywordCount })\n if (validationError) {\n reject(validationError)\n return\n }\n\n const result: any = {\n answerType: SubjectType.TEXT_FILL,\n examTypeEnum: SubjectType.TEXT_FILL,\n title,\n answers: this._filledAnswers(answers).map((answer: any, index: number) => {\n const title = this._normalizeAnswerTitle(answer)\n const next: any = {\n title,\n answer: title,\n orderIndex: index + 1,\n }\n if (answer.answerId) {\n next.answerId = answer.answerId\n next.examAnswerId = answer.answerId\n }\n if (answer.customAnswerId) {\n next.customAnswerId = answer.customAnswerId\n }\n return next\n }),\n analysis,\n isSetCorrectAnswer: !!correct,\n isKey: this['is-key'],\n examExpand: correct,\n examAnswerSettingBO: {\n isIgnoreCase,\n isInOrder,\n ...(keywordCount !== null ? { keywordCount } : {}),\n },\n examAnswerSettingVO: {\n isIgnoreCase,\n isInOrder,\n ...(keywordCount !== null ? { keywordCount } : {}),\n },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this['custom-id']) { result.customId = this['custom-id'] }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const row = { customId: this['custom-id'] || undefined, answerType: 'text_fill', orderIndex: this['order-index'] }\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n const correct = trimText(this['is-edit'] ? this._correct : this['exam-expand'] || '')\n const keywordCount = this['is-edit'] ? this._keywordCount : this._readKeywordCount(this['exam-answer-setting'])\n const validationError = this._validateState({ row, title, answers, correct, keywordCount })\n return validationError ? [validationError] : []\n }\n\n private _renderPreview() {\n const previewAnswers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n const previewCorrect = this['is-edit'] ? this._correct : (this['exam-expand'] || '')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this['order-index'] + 1}.${this.title}(问答题)</span>\n ${this['rich-text-content'] ? html`<div class=\"rich-text\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n ${this._filledAnswers(previewAnswers).length\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${this._filledAnswers(previewAnswers).map((answer, index) => html`<span style=\"margin-right:10px\">关键词${index + 1}: ${this._normalizeAnswerTitle(answer)}</span>`)}\n </div>\n `\n : ''}\n ${previewCorrect ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${previewCorrect}</div>` : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n ${this['show-category'] && this._categoryId\n ? html`<div class=\"section-row\"><span class=\"value-text\">分类:${this._categoryLabel()}</span></div>`\n : ''}\n ${this._renderResourceSection()}\n </div>\n `\n }\n\n private _renderSorting() {\n const title = trimText(this['is-edit'] ? this._title : this.title || '') || '未命名题目'\n const orderText = `${this['order-index'] + 1}. ${title}`\n return renderSortingCard(orderText, SubjectTypeLabel[SubjectType.TEXT_FILL] || SubjectType.TEXT_FILL)\n }\n\n private _renderCategorySection() {\n if (!this['show-category']) { return '' }\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>分类:</span></div>\n <div style=\"flex:1\">\n ${this['is-edit']\n ? html`\n <select class=\"el-select\" .value=${String(this._categoryId)}\n @change=${(e: Event) => this._onCategoryChange((e.target as HTMLSelectElement).value)}>\n <option value=\"\">选择分类</option>\n ${this['category-list'].map((item: any) => html`\n <option value=${String(item.categoryId)} ?selected=${String(item.categoryId) === String(this._categoryId)}>${item.title || item.categoryName}</option>\n `)}\n </select>\n `\n : html`<span class=\"value-text\">${this._categoryLabel()}</span>`}\n </div>\n </div>\n `\n }\n\n private _renderResourceSection() {\n if (!this['show-resource']) { return '' }\n const images = this._imageResources()\n const video = this._videoResource()\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>资源:</span></div>\n <div style=\"flex:1\">\n <div class=\"resource-summary\">图片 ${images.length} 张${video?.url ? ',含视频资源' : ''}</div>\n ${images.length\n ? html`\n <div class=\"resource-thumbs\">\n ${images.slice(0, 4).map(src => html`<img class=\"resource-thumb\" src=${src} alt=\"resource\" />`)}\n </div>\n `\n : ''}\n ${video?.url ? html`<div style=\"margin-top:8px\"><a class=\"el-link\" href=${video.url} target=\"_blank\" rel=\"noreferrer\">查看视频</a></div>` : ''}\n ${!images.length && !video?.url ? html`<div class=\"tag-hint\">暂无资源</div>` : ''}\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 rows=\"2\" .value=${this._title}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【问答题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <div style=\"flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px\">\n <span style=\"font-size:13px;color:#606266\">共答对</span>\n <input\n type=\"number\"\n style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${this._keywordCount === null ? '' : String(this._keywordCount)}\n min=\"1\"\n @change=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._keywordCount = value === '' ? null : Number(value)\n }} />\n <span style=\"font-size:13px;color:#606266\">个关键词,算是正确的</span>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n </div>\n\n <slot name=\"business-tag\"></slot>\n\n ${this._renderCategorySection()}\n\n ${this._renderResourceSection()}\n\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 rows=\"2\" .value=${this._correct}\n maxlength=\"200\"\n @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入正确答案\"></textarea>\n <span class=\"char-counter\">${this._correct.length}/200</span>\n </div>\n </div>\n </div>\n\n <div class=\"answer-list\" style=\"margin-top:12px\">\n <span style=\"padding-left:60px;font-size:12px;color:#909399\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n ${this._answers.map((answer, index) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${index + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${answer.title.split(',').filter(Boolean).map((tag) => {\n const color = TAG_COLORS[index % TAG_COLORS.length]\n return html`\n <span style=\"display:inline-flex;align-items:center;background:${color.bg};color:${color.color};border:1px solid ${color.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n <span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, index)}>×</span>\n </span>\n `\n })}\n ${html`\n ${answer.showInput\n ? html`\n <input type=\"text\" style=\"width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._addTag(index) }\n }}\n @input=${(e: Event) => { answer.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(index)} />\n <button class=\"el-link\" @click=${() => this._addTag(index)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? { ...item, showInput: true } : item); this.updateComplete.then(() => { (this.shadowRoot?.querySelector('input[style*=\\\"width:80px\\\"]') as HTMLInputElement)?.focus() }) }}>\n ${answer.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `}\n </div>\n <span class=\"icon\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(index)}>${this._iconRemove}</span>\n </div>\n `)}\n </div>\n\n ${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`<div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>`\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 rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n 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._showRichText}\n exam-answer-relation-type=${this['exam-answer-relation-type']}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => {\n this._showRichText = !this._showRichText\n if (!this._showRichText) {\n this._richText = ''\n }\n }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","title","sorting","analysis","isInOrder","isIgnoreCase","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","_selectedTagList","_categoryId","TITLE_MAX","willUpdate","changed","has","_syncProps","Array","isArray","map","item","String","_normalizeAnswerTitle","answer","trimCommaSeparatedText","_normalizedAnswerList","source","length","undefined","answerId","examAnswerId","_filledAnswers","filter","_readKeywordCount","setting","keywordCount","Number","customAnswerId","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","value","slice","_addTag","index","join","currentIndex","_closeTag","split","_addAnswer","_deleteAnswer","_","_onCategoryChange","customId","examId","_imageResources","resourceType","resource","middle","url","Boolean","_videoResource","find","_categoryLabel","matched","categoryId","categoryName","_validateState","options","row","answers","correct","SubjectError","filledAnswers","toJSON","answerType","orderIndex","trimText","showRichText","richText","validationError","SubjectType","TEXT_FILL","examTypeEnum","next","isSetCorrectAnswer","isKey","examExpand","examAnswerSettingBO","examAnswerSettingVO","examRichTextContent","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","_renderPreview","previewAnswers","previewCorrect","_renderResourceSection","_renderSorting","orderText","renderSortingCard","SubjectTypeLabel","_renderCategorySection","images","video","src","_renderEdit","checked","key","updateComplete","then","shadowRoot","querySelector","focus","getContent","render","content","styles","sortingCardStyles","css","__decorateClass","property","type","attribute","prototype","reflect","state","safeCustomElement"],"mappings":"ukBAqBA,MAAMA,EAAa,CACjB,CAAEC,GAAI,UAAWC,M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AA,cAAA,GArINzL,EAANqL,EAAA,CADNO,EAAkB,kBACN5L"}
|
|
1
|
+
{"version":3,"file":"text-fill.mjs","sources":["../../../../packages/components-wc/src/subject/text-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { type Category, type Resource, SubjectError, type TagItem, trimCommaSeparatedText, trimText } from './single'\nimport { renderSortingCard, sortingCardStyles } from './sorting-card'\nimport { SubjectType, SubjectTypeLabel } from './types'\n\ninterface TextAnswer {\n title: string\n tag: string\n showInput: boolean\n answerId?: string | number\n customAnswerId?: string | number\n}\n\ninterface TextAnswerSetting {\n isInOrder?: boolean\n isIgnoreCase?: boolean\n keywordCount?: number\n}\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' },\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' },\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' },\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' },\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' },\n]\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-text-fill')\nexport class QxsTextFill extends LitElement {\n private readonly _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>`\n private readonly _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 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\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\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 .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .section-row { margin-top: 12px; }\n .value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }\n .tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }\n .tag-item {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 4px 8px; font-size: 12px; line-height: 1;\n color: #3D61E3; background: #ecf5ff; border: 1px solid #d9ecff; border-radius: 4px;\n }\n .tag-item .close { cursor: pointer; color: #909399; }\n .tag-item .close:hover { color: #f56c6c; }\n .tag-hint { font-size: 12px; color: #909399; }\n .el-select {\n width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;\n padding: 0 8px; font-size: 13px; background: #fff; appearance: none;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c0c4cc' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E\");\n background-repeat: no-repeat; background-position: right 8px center;\n }\n .resource-summary { font-size: 12px; color: #606266; }\n .resource-thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }\n .resource-thumb {\n width: 72px; height: 72px; object-fit: cover; border-radius: 6px;\n border: 1px solid #e4e7ed; background: #f5f7fa;\n }\n `]\n\n @property({ type: Number, attribute: 'order-index' }) 'order-index' = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-save' }) 'is-save' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: '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-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-analysis' }) 'show-analysis' = false\n @property({ type: String, attribute: 'rich-text-content' }) 'rich-text-content' = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n @property({ type: String, attribute: 'exam-expand' }) 'exam-expand' = ''\n @property({ type: Number, attribute: 'exam-id' }) 'exam-id' = 0\n @property({ type: String, attribute: 'category-id' }) 'category-id' = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n 'exam-answer-setting': TextAnswerSetting = { isInOrder: false, isIgnoreCase: true }\n\n @property({ type: Object, attribute: 'upload-image' })\n 'upload-image': (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = e => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' }) 'answer-list': any[] = []\n @property({ type: Array, attribute: 'tag-list' }) 'tag-list': TagItem[] = []\n @property({ type: Array, attribute: 'category-list' }) 'category-list': Category[] = []\n @property({ type: Array, attribute: 'resource-list' }) 'resource-list': Resource[] = []\n @property({ type: Boolean, attribute: 'show-tag' }) 'show-tag' = false\n @property({ type: Boolean, attribute: 'show-category' }) 'show-category' = false\n @property({ type: Boolean, attribute: 'show-resource' }) 'show-resource' = false\n @property({ type: Object, attribute: 'search-handler' }) 'search-handler'?: (query: string, answerType: number) => Promise<any[]>\n\n @property({ type: String, attribute: 'model-value' }) 'model-value' = ''\n @property({ type: Boolean, attribute: 'use-model' }) 'use-model' = false\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = false\n @state() private _isIgnoreCase = true\n @state() private _keywordCount: number | null = null\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n @state() private _selectedTagList: TagItem[] = []\n @state() private _categoryId = ''\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('is-edit') && this['is-edit']) { this._syncProps() }\n if (!this['is-edit'] && (changed.has('title') || changed.has('answer-list') || changed.has('analysis') || changed.has('exam-answer-setting') || changed.has('rich-text-content') || changed.has('exam-expand') || changed.has('tag-list') || changed.has('category-id'))) {\n this._syncProps()\n }\n if (changed.has('model-value') && this['use-model']) {\n this._title = this['model-value']\n }\n if (changed.has('tag-list')) {\n this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n }\n if (changed.has('category-id')) {\n this._categoryId = this['category-id'] ? String(this['category-id']) : ''\n }\n }\n\n private _normalizeAnswerTitle(answer: any) {\n return trimCommaSeparatedText(answer?.title ?? answer?.answer ?? '')\n }\n\n private _normalizedAnswerList(source: any[] = []) {\n return (Array.isArray(source) ? source : []).map((answer: any) => ({\n ...answer,\n answerId: answer?.answerId ?? answer?.examAnswerId,\n title: this._normalizeAnswerTitle(answer),\n }))\n }\n\n private _filledAnswers(source: any[] = []) {\n return source.filter(answer => this._normalizeAnswerTitle(answer))\n }\n\n private _readKeywordCount(setting?: TextAnswerSetting | null) {\n if (!setting || setting.keywordCount === undefined || setting.keywordCount === null || setting.keywordCount === '') {\n return null\n }\n return Number(setting.keywordCount)\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n if (this['answer-list']?.length) {\n this._answers = this._normalizedAnswerList(this['answer-list']).map((answer: any) => ({\n title: answer.title || '',\n tag: '',\n showInput: false,\n answerId: answer.answerId,\n customAnswerId: answer.customAnswerId,\n }))\n }\n else {\n this._answers = [{ title: '', tag: '', showInput: false }]\n }\n this._isInOrder = !!this['exam-answer-setting']?.isInOrder\n this._isIgnoreCase = this['exam-answer-setting']?.isIgnoreCase ?? true\n this._keywordCount = this._readKeywordCount(this['exam-answer-setting'])\n this._richText = this['rich-text-content'] || ''\n this._showRichText = !!this['rich-text-content']\n this._correct = this['exam-expand'] || ''\n this._selectedTagList = Array.isArray(this['tag-list']) ? this['tag-list'].map(item => ({ ...item })) : []\n this._categoryId = this['category-id'] ? String(this['category-id']) : ''\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) { el.value = el.value.slice(0, this.TITLE_MAX) }\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 _addTag(index: number) {\n const answer = { ...this._answers[index] }\n if (answer.tag) {\n answer.title = answer.title ? [answer.title, answer.tag].join(',') : answer.tag\n answer.tag = ''\n }\n answer.showInput = false\n this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? answer : item)\n }\n\n private _closeTag(tag: string, index: number) {\n const answer = { ...this._answers[index] }\n answer.title = answer.title.split(',').filter(item => item !== tag).join(',')\n this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? answer : item)\n }\n\n private _addAnswer() {\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2) { return }\n this._answers = this._answers.filter((_, currentIndex) => currentIndex !== index)\n }\n\n private _onCategoryChange(value: string) {\n this._categoryId = value\n this._emit('category-change', {\n value,\n customId: this['custom-id'] || '',\n examId: this['exam-id'] || 0,\n })\n }\n\n private _imageResources() {\n return (this['resource-list'] || [])\n .filter(item => item.resourceType === 1)\n .map(item => item.resource.middle || item.resource.url)\n .filter(Boolean) as string[]\n }\n\n private _videoResource() {\n return (this['resource-list'] || []).find(item => item.resourceType === 2)?.resource || null\n }\n\n private _categoryLabel() {\n const matched = this['category-list'].find((item: any) => String(item.categoryId) === String(this._categoryId))\n return matched?.title || matched?.categoryName || this._categoryId || '未选择分类'\n }\n\n private _validateState(options: {\n row: any\n title: string\n answers: TextAnswer[]\n correct: string\n keywordCount: number | null\n }) {\n const { row, title, answers, correct, keywordCount } = options\n if (!title) {\n return new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row)\n }\n\n const filledAnswers = this._filledAnswers(answers)\n const shouldValidateAnswers = !!correct || keywordCount !== null || filledAnswers.length > 0\n\n if (!shouldValidateAnswers) { return null }\n if (!correct) {\n return new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row)\n }\n if (!keywordCount || keywordCount < 1) {\n return new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row)\n }\n if (!filledAnswers.length) {\n return new SubjectError('请设置关键词', 'NO_KEYWORDS', 'answers', row)\n }\n if (keywordCount > filledAnswers.length) {\n return new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row)\n }\n return null\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this['custom-id'] || undefined, answerType: 'text_fill', orderIndex: this['order-index'] }\n\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n const analysis = trimText(this['is-edit'] ? this._analysis : this.analysis || '')\n const correct = trimText(this['is-edit'] ? this._correct : this['exam-expand'] || '')\n const keywordCount = this['is-edit'] ? this._keywordCount : this._readKeywordCount(this['exam-answer-setting'])\n const isInOrder = this['is-edit'] ? this._isInOrder : (this['exam-answer-setting']?.isInOrder ?? false)\n const isIgnoreCase = this['is-edit'] ? this._isIgnoreCase : (this['exam-answer-setting']?.isIgnoreCase ?? true)\n const showRichText = this['is-edit'] ? this._showRichText : !!this['rich-text-content']\n const richText = this['is-edit'] ? this._richText : this['rich-text-content'] || ''\n const validationError = this._validateState({ row, title, answers, correct, keywordCount })\n if (validationError) {\n reject(validationError)\n return\n }\n\n const result: any = {\n answerType: SubjectType.TEXT_FILL,\n examTypeEnum: SubjectType.TEXT_FILL,\n title,\n answers: this._filledAnswers(answers).map((answer: any, index: number) => {\n const title = this._normalizeAnswerTitle(answer)\n const next: any = {\n title,\n answer: title,\n orderIndex: index + 1,\n }\n if (answer.answerId) {\n next.answerId = answer.answerId\n next.examAnswerId = answer.answerId\n }\n if (answer.customAnswerId) {\n next.customAnswerId = answer.customAnswerId\n }\n return next\n }),\n analysis,\n isSetCorrectAnswer: !!correct,\n isKey: this['is-key'],\n examExpand: correct,\n examAnswerSettingBO: {\n isIgnoreCase,\n isInOrder,\n ...(keywordCount !== null ? { keywordCount } : {}),\n },\n examAnswerSettingVO: {\n isIgnoreCase,\n isInOrder,\n ...(keywordCount !== null ? { keywordCount } : {}),\n },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this['custom-id']) { result.customId = this['custom-id'] }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const row = { customId: this['custom-id'] || undefined, answerType: 'text_fill', orderIndex: this['order-index'] }\n const title = trimText(this['is-edit'] ? this._title : this.title || '')\n const answers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n const correct = trimText(this['is-edit'] ? this._correct : this['exam-expand'] || '')\n const keywordCount = this['is-edit'] ? this._keywordCount : this._readKeywordCount(this['exam-answer-setting'])\n const validationError = this._validateState({ row, title, answers, correct, keywordCount })\n return validationError ? [validationError] : []\n }\n\n private _renderPreview() {\n const previewAnswers = this['is-edit'] ? this._answers : this._normalizedAnswerList(this['answer-list'] || [])\n const previewCorrect = this['is-edit'] ? this._correct : (this['exam-expand'] || '')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this['order-index'] + 1}.${this.title}(问答题)</span>\n ${this['show-rich-text'] && this['rich-text-content'] ? html`<div class=\"rich-text\" .innerHTML=${this['rich-text-content']}></div>` : ''}\n ${this._filledAnswers(previewAnswers).length\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${this._filledAnswers(previewAnswers).map((answer, index) => html`<span style=\"margin-right:10px\">关键词${index + 1}: ${this._normalizeAnswerTitle(answer)}</span>`)}\n </div>\n `\n : ''}\n ${previewCorrect ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${previewCorrect}</div>` : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n ${this['show-category'] && this._categoryId\n ? html`<div class=\"section-row\"><span class=\"value-text\">分类:${this._categoryLabel()}</span></div>`\n : ''}\n ${this._renderResourceSection()}\n </div>\n `\n }\n\n private _renderSorting() {\n const title = trimText(this['is-edit'] ? this._title : this.title || '') || '未命名题目'\n const orderText = `${this['order-index'] + 1}. ${title}`\n return renderSortingCard(orderText, SubjectTypeLabel[SubjectType.TEXT_FILL] || SubjectType.TEXT_FILL)\n }\n\n private _renderCategorySection() {\n if (!this['show-category']) { return '' }\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>分类:</span></div>\n <div style=\"flex:1\">\n ${this['is-edit']\n ? html`\n <select class=\"el-select\" .value=${String(this._categoryId)}\n @change=${(e: Event) => this._onCategoryChange((e.target as HTMLSelectElement).value)}>\n <option value=\"\">选择分类</option>\n ${this['category-list'].map((item: any) => html`\n <option value=${String(item.categoryId)} ?selected=${String(item.categoryId) === String(this._categoryId)}>${item.title || item.categoryName}</option>\n `)}\n </select>\n `\n : html`<span class=\"value-text\">${this._categoryLabel()}</span>`}\n </div>\n </div>\n `\n }\n\n private _renderResourceSection() {\n if (!this['show-resource']) { return '' }\n const images = this._imageResources()\n const video = this._videoResource()\n return html`\n <div class=\"flex-items-start section-row\">\n <div class=\"label\"><span>资源:</span></div>\n <div style=\"flex:1\">\n <div class=\"resource-summary\">图片 ${images.length} 张${video?.url ? ',含视频资源' : ''}</div>\n ${images.length\n ? html`\n <div class=\"resource-thumbs\">\n ${images.slice(0, 4).map(src => html`<img class=\"resource-thumb\" src=${src} alt=\"resource\" />`)}\n </div>\n `\n : ''}\n ${video?.url ? html`<div style=\"margin-top:8px\"><a class=\"el-link\" href=${video.url} target=\"_blank\" rel=\"noreferrer\">查看视频</a></div>` : ''}\n ${!images.length && !video?.url ? html`<div class=\"tag-hint\">暂无资源</div>` : ''}\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 rows=\"2\" .value=${this._title}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【问答题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <div style=\"flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px\">\n <span style=\"font-size:13px;color:#606266\">共答对</span>\n <input\n type=\"number\"\n style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${this._keywordCount === null ? '' : String(this._keywordCount)}\n min=\"1\"\n @change=${(e: Event) => {\n const value = (e.target as HTMLInputElement).value\n this._keywordCount = value === '' ? null : Number(value)\n }} />\n <span style=\"font-size:13px;color:#606266\">个关键词,算是正确的</span>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n </div>\n\n <slot name=\"business-tag\"></slot>\n\n ${this._renderCategorySection()}\n\n ${this._renderResourceSection()}\n\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 rows=\"2\" .value=${this._correct}\n maxlength=\"200\"\n @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入正确答案\"></textarea>\n <span class=\"char-counter\">${this._correct.length}/200</span>\n </div>\n </div>\n </div>\n\n <div class=\"answer-list\" style=\"margin-top:12px\">\n <span style=\"padding-left:60px;font-size:12px;color:#909399\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n ${this._answers.map((answer, index) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${index + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${answer.title.split(',').filter(Boolean).map((tag) => {\n const color = TAG_COLORS[index % TAG_COLORS.length]\n return html`\n <span style=\"display:inline-flex;align-items:center;background:${color.bg};color:${color.color};border:1px solid ${color.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n <span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, index)}>×</span>\n </span>\n `\n })}\n ${html`\n ${answer.showInput\n ? html`\n <input type=\"text\" style=\"width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._addTag(index) }\n }}\n @input=${(e: Event) => { answer.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(index)} />\n <button class=\"el-link\" @click=${() => this._addTag(index)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((item, currentIndex) => currentIndex === index ? { ...item, showInput: true } : item); this.updateComplete.then(() => { (this.shadowRoot?.querySelector('input[style*=\\\"width:80px\\\"]') as HTMLInputElement)?.focus() }) }}>\n ${answer.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `}\n </div>\n <span class=\"icon\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(index)}>${this._iconRemove}</span>\n </div>\n `)}\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`<div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>`\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 rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n 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 exam-answer-relation-type=${this['exam-answer-relation-type']}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => {\n this._showRichText = !this._showRichText\n if (!this._showRichText) {\n this._richText = ''\n }\n }}\n ></qxs-subject-action>\n `\n : ''}\n <slot name=\"action\"></slot>\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","title","sorting","analysis","isInOrder","isIgnoreCase","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","_selectedTagList","_categoryId","TITLE_MAX","willUpdate","changed","has","_syncProps","Array","isArray","map","item","String","_normalizeAnswerTitle","answer","trimCommaSeparatedText","_normalizedAnswerList","source","length","undefined","answerId","examAnswerId","_filledAnswers","filter","_readKeywordCount","setting","keywordCount","Number","customAnswerId","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","value","slice","_addTag","index","join","currentIndex","_closeTag","split","_addAnswer","_deleteAnswer","_","_onCategoryChange","customId","examId","_imageResources","resourceType","resource","middle","url","Boolean","_videoResource","find","_categoryLabel","matched","categoryId","categoryName","_validateState","options","row","answers","correct","SubjectError","filledAnswers","toJSON","answerType","orderIndex","trimText","showRichText","richText","validationError","SubjectType","TEXT_FILL","examTypeEnum","next","isSetCorrectAnswer","isKey","examExpand","examAnswerSettingBO","examAnswerSettingVO","examRichTextContent","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","_renderPreview","previewAnswers","previewCorrect","_renderResourceSection","_renderSorting","orderText","renderSortingCard","SubjectTypeLabel","_renderCategorySection","images","video","src","_renderEdit","checked","key","updateComplete","then","shadowRoot","querySelector","focus","getContent","render","content","styles","sortingCardStyles","css","__decorateClass","property","type","attribute","prototype","reflect","state","safeCustomElement"],"mappings":"ukBAqBA,MAAMA,EAAa,CACjB,CAAEC,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,YAiBtC,IAAMC,EAAN,cAA0BC,EAA1BC,WA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,gBAAA,GACAJ,EAAA,CAAhBM,KApIU3L,EAoIMyL,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KArIU3L,EAqIMyL,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KAtIU3L,EAsIMyL,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAvIU3L,EAuIMyL,UAAA,YAAA,GACAJ,EAAA,CAAhBM,KAxIU3L,EAwIMyL,UAAA,mBAAA,GACAJ,EAAA,CAAhBM,KAzIU3L,EAyIMyL,UAAA,cAAA,GAzINzL,EAANqL,EAAA,CADNO,EAAkB,kBACN5L"}
|
package/lib/subject/action.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var e=require("lit"),t=require("lit/decorators.js"),o=require("../base/define.cjs"),
|
|
1
|
+
"use strict";var e=require("lit"),t=require("lit/decorators.js"),o=require("../base/define.cjs"),s=Object.defineProperty,i=Object.getOwnPropertyDescriptor,n=(e,t,o,n)=>{for(var r,a=n>1?void 0:n?i(t,o):t,l=e.length-1;l>=0;l--)(r=e[l])&&(a=(n?r(t,o,a):r(a))||a);return n&&a&&s(t,o,a),a};const r=[{value:2,label:"必须全部都是支持选项,方可下一步"},{value:1,label:"无需判断是否是支持选项"},{value:3,label:"包含全部支持选项,即可下一步"}],a=[{type:"single",label:"单选题"},{type:"multiple",label:"多选题"},{type:"blank_fill",label:"填空题"},{type:"text_fill",label:"问答题"},{type:"scale",label:"量表题"},{type:"sort",label:"排序题"},{type:"page_end",label:"分页符"}];exports.QxsSubjectAction=class extends e.LitElement{constructor(){super(...arguments),this["is-edit"]=!1,this["is-set"]=!1,this["is-key"]=!1,this["answer-check-type"]=1,this["show-other-option"]=!1,this["show-answer-setting"]=!1,this["show-key"]=!1,this["show-rich-text"]=!1,this["hide-add-rich-text"]=!1,this["show-delete-action"]=!0,this["show-save-action"]=!0,this["page-end"]=!1,this["show-move"]=!1,this["show-add"]=!0,this["show-jump"]=!1,this["exam-answer-relation-type"]=0,this._modalOpen=!1,this._currentCheckType=1,this._addMenuOpen=!1,this._handleDocumentClick=e=>{const t=e.composedPath(),o=this.shadowRoot?.querySelector(".add-menu-wrap");o&&!t.includes(o)&&(this._addMenuOpen=!1)}}connectedCallback(){super.connectedCallback(),document.addEventListener("click",this._handleDocumentClick)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this._handleDocumentClick)}updated(e){e.has("answer-check-type")&&(this._currentCheckType=this["answer-check-type"])}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}get _answerText(){return r.find(e=>e.value===this["answer-check-type"])?.label??""}get _showAnswerSetting(){return this["show-other-option"]||this["show-answer-setting"]}get _showKey(){return this["show-other-option"]||this["show-key"]}_renderEditMode(){return e.html`
|
|
2
2
|
<div class="left">
|
|
3
3
|
<span class="inline-actions">
|
|
4
4
|
${this["show-add"]?e.html`
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
</span>
|
|
28
28
|
</div>
|
|
29
29
|
<div class="right">
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
${this["show-delete-action"]?e.html`<button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>`:""}
|
|
31
|
+
${this["show-save-action"]?e.html`<button class="text-btn text-btn--primary" @click=${()=>this._emit("save")}>完成编辑</button>`:""}
|
|
32
32
|
</div>
|
|
33
33
|
`}_renderViewMode(){return e.html`
|
|
34
34
|
<div class="left">
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
<button class="text-btn text-btn--default" @click=${()=>this._emit("move","up")}>上移</button>
|
|
58
58
|
<button class="text-btn text-btn--default btn-margin" @click=${()=>this._emit("move","down")}>下移</button>
|
|
59
59
|
`:""}
|
|
60
|
-
${this["is-set"]
|
|
60
|
+
${!this["is-set"]&&this["show-delete-action"]?e.html`<button class="text-btn text-btn--danger btn-margin" @click=${()=>this._emit("delete")}>删除</button>`:""}
|
|
61
61
|
${this["page-end"]||this["is-set"]?"":e.html`
|
|
62
62
|
<button class="text-btn text-btn--default" @click=${()=>this._emit("edit")}>编辑</button>
|
|
63
63
|
`}
|
|
@@ -168,5 +168,5 @@
|
|
|
168
168
|
background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;
|
|
169
169
|
}
|
|
170
170
|
.add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
|
|
171
|
-
`,n([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectAction.prototype,"is-edit",2),n([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectAction.prototype,"is-set",2),n([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectAction.prototype,"is-key",2),n([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectAction.prototype,"answer-check-type",2),n([t.property({type:Boolean,attribute:"show-other-option"})],exports.QxsSubjectAction.prototype,"show-other-option",2),n([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectAction.prototype,"show-answer-setting",2),n([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectAction.prototype,"show-key",2),n([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectAction.prototype,"show-rich-text",2),n([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectAction.prototype,"hide-add-rich-text",2),n([t.property({type:Boolean,attribute:"page-end"})],exports.QxsSubjectAction.prototype,"page-end",2),n([t.property({type:Boolean,attribute:"show-move"})],exports.QxsSubjectAction.prototype,"show-move",2),n([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectAction.prototype,"show-add",2),n([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectAction.prototype,"show-jump",2),n([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectAction.prototype,"exam-answer-relation-type",2),n([t.state()],exports.QxsSubjectAction.prototype,"_modalOpen",2),n([t.state()],exports.QxsSubjectAction.prototype,"_currentCheckType",2),n([t.state()],exports.QxsSubjectAction.prototype,"_addMenuOpen",2),exports.QxsSubjectAction=n([o.safeCustomElement("qxs-subject-action")],exports.QxsSubjectAction);
|
|
171
|
+
`,n([t.property({type:Boolean,attribute:"is-edit"})],exports.QxsSubjectAction.prototype,"is-edit",2),n([t.property({type:Boolean,attribute:"is-set"})],exports.QxsSubjectAction.prototype,"is-set",2),n([t.property({type:Boolean,attribute:"is-key"})],exports.QxsSubjectAction.prototype,"is-key",2),n([t.property({type:Number,attribute:"answer-check-type"})],exports.QxsSubjectAction.prototype,"answer-check-type",2),n([t.property({type:Boolean,attribute:"show-other-option"})],exports.QxsSubjectAction.prototype,"show-other-option",2),n([t.property({type:Boolean,attribute:"show-answer-setting"})],exports.QxsSubjectAction.prototype,"show-answer-setting",2),n([t.property({type:Boolean,attribute:"show-key"})],exports.QxsSubjectAction.prototype,"show-key",2),n([t.property({type:Boolean,attribute:"show-rich-text"})],exports.QxsSubjectAction.prototype,"show-rich-text",2),n([t.property({type:Boolean,attribute:"hide-add-rich-text"})],exports.QxsSubjectAction.prototype,"hide-add-rich-text",2),n([t.property({type:Boolean,attribute:"show-delete-action"})],exports.QxsSubjectAction.prototype,"show-delete-action",2),n([t.property({type:Boolean,attribute:"show-save-action"})],exports.QxsSubjectAction.prototype,"show-save-action",2),n([t.property({type:Boolean,attribute:"page-end"})],exports.QxsSubjectAction.prototype,"page-end",2),n([t.property({type:Boolean,attribute:"show-move"})],exports.QxsSubjectAction.prototype,"show-move",2),n([t.property({type:Boolean,attribute:"show-add"})],exports.QxsSubjectAction.prototype,"show-add",2),n([t.property({type:Boolean,attribute:"show-jump"})],exports.QxsSubjectAction.prototype,"show-jump",2),n([t.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsSubjectAction.prototype,"exam-answer-relation-type",2),n([t.state()],exports.QxsSubjectAction.prototype,"_modalOpen",2),n([t.state()],exports.QxsSubjectAction.prototype,"_currentCheckType",2),n([t.state()],exports.QxsSubjectAction.prototype,"_addMenuOpen",2),exports.QxsSubjectAction=n([o.safeCustomElement("qxs-subject-action")],exports.QxsSubjectAction);
|
|
172
172
|
//# sourceMappingURL=action.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.cjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst addSubjectOptions = [\n { type: 'single', label: '单选题' },\n { type: 'multiple', label: '多选题' },\n { type: 'blank_fill', label: '填空题' },\n { type: 'text_fill', label: '问答题' },\n { type: 'scale', label: '量表题' },\n { type: 'sort', label: '排序题' },\n { type: 'page_end', label: '分页符' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n\n .inline-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }\n .add-menu-wrap { position: relative; display: inline-flex; }\n .add-menu {\n position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;\n display: grid; grid-template-columns: repeat(2, minmax(84px, 1fr)); gap: 8px;\n min-width: 196px; padding: 10px; background: #fff; border: 1px solid #e4e7ed;\n border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12);\n }\n .add-item {\n display: inline-flex; align-items: center; justify-content: center;\n min-height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px;\n background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;\n }\n .add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n @property({ type: Number, attribute: 'answer-check-type' }) 'answer-check-type' = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) 'show-other-option' = false\n @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-key' }) 'show-key' = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) 'show-rich-text' = false\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) 'hide-add-rich-text' = false\n @property({ type: Boolean, attribute: 'page-end' }) 'page-end' = false\n @property({ type: Boolean, attribute: 'show-move' }) 'show-move' = false\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'show-jump' }) 'show-jump' = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n @state() private _addMenuOpen = false\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answer-check-type')) {\n this._currentCheckType = this['answer-check-type']\n }\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrap = this.shadowRoot?.querySelector('.add-menu-wrap')\n if (wrap && !path.includes(wrap)) {\n this._addMenuOpen = false\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this['answer-check-type'])?.label ?? ''\n }\n\n private get _showAnswerSetting() {\n return this['show-other-option'] || this['show-answer-setting']\n }\n\n private get _showKey() {\n return this['show-other-option'] || this['show-key']\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this['show-add']\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${!this['hide-add-rich-text']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>\n ${this['show-rich-text'] ? '删除题目描述(图文)' : '+添加题目描述(图文)'}\n </span>\n `\n : ''}\n ${this['show-jump']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this['is-set'] ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n `\n : ''}\n ${this._showKey\n ? html`\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this['is-key']} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this._showKey\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this['is-key']} /> 核心题\n </label>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n ${this['show-add']\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${this['show-jump']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this['is-set'] ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n ${!this['is-set'] && this['show-move']\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('move', 'up')}>上移</button>\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('move', 'down')}>下移</button>\n `\n : ''}\n ${!this['is-set']\n ? html`<button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>`\n : ''}\n ${!this['page-end'] && !this['is-set']\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private _renderAddMenu() {\n if (!this._addMenuOpen) { return '' }\n return html`\n <div class=\"add-menu\">\n ${addSubjectOptions.map(item => html`\n <button class=\"add-item\" @click=${() => {\n this._addMenuOpen = false\n this._emit('add', item.type)\n }}>${item.label}</button>\n `)}\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this['is-edit'] ? 'active' : ''}\">\n ${this['is-edit'] ? this._renderEditMode() : this._renderViewMode()}\n ${this['is-set'] ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>` : ''}\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","addSubjectOptions","type","QxsSubjectAction","LitElement","constructor","super","arguments","this","_modalOpen","_currentCheckType","_addMenuOpen","_handleDocumentClick","e","path","composedPath","wrap","shadowRoot","querySelector","includes","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_showAnswerSetting","_showKey","_renderEditMode","html","_renderAddMenu","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","Boolean","attribute","prototype","Number","state","safeCustomElement"],"mappings":"6RAIA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO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,EAAA,CAApDC,EAAAA,SAAS,CAAErD,KAAMsD,QAASC,UAAW,eAtF3BtD,QAAAA,iBAsF0CuD,UAAA,YAAA,GACeJ,EAAA,CAAnEC,EAAAA,SAAS,CAAErD,KAAMyD,OAAQF,UAAW,+BAvF1BtD,QAAAA,iBAuFyDuD,UAAA,4BAAA,GAEnDJ,EAAA,CAAhBM,EAAAA,SAzFUzD,QAAAA,iBAyFMuD,UAAA,aAAA,GACAJ,EAAA,CAAhBM,EAAAA,SA1FUzD,QAAAA,iBA0FMuD,UAAA,oBAAA,GACAJ,EAAA,CAAhBM,EAAAA,SA3FUzD,QAAAA,iBA2FMuD,UAAA,eAAA,GA3FNvD,QAAAA,iBAANmD,EAAA,CADNO,EAAAA,kBAAkB,uBACN1D,QAAAA"}
|
|
1
|
+
{"version":3,"file":"action.cjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst addSubjectOptions = [\n { type: 'single', label: '单选题' },\n { type: 'multiple', label: '多选题' },\n { type: 'blank_fill', label: '填空题' },\n { type: 'text_fill', label: '问答题' },\n { type: 'scale', label: '量表题' },\n { type: 'sort', label: '排序题' },\n { type: 'page_end', label: '分页符' },\n]\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n\n .inline-actions { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }\n .add-menu-wrap { position: relative; display: inline-flex; }\n .add-menu {\n position: absolute; top: calc(100% + 6px); left: 0; z-index: 50;\n display: grid; grid-template-columns: repeat(2, minmax(84px, 1fr)); gap: 8px;\n min-width: 196px; padding: 10px; background: #fff; border: 1px solid #e4e7ed;\n border-radius: 6px; box-shadow: 0 8px 20px rgba(0,0,0,.12);\n }\n .add-item {\n display: inline-flex; align-items: center; justify-content: center;\n min-height: 30px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px;\n background: #fff; color: #606266; font-size: 12px; cursor: pointer; transition: all .2s;\n }\n .add-item:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) 'is-edit' = false\n @property({ type: Boolean, attribute: 'is-set' }) 'is-set' = false\n @property({ type: Boolean, attribute: 'is-key' }) 'is-key' = false\n @property({ type: Number, attribute: 'answer-check-type' }) 'answer-check-type' = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) 'show-other-option' = false\n @property({ type: Boolean, attribute: 'show-answer-setting' }) 'show-answer-setting' = false\n @property({ type: Boolean, attribute: 'show-key' }) 'show-key' = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) 'show-rich-text' = false\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) 'hide-add-rich-text' = false\n @property({ type: Boolean, attribute: 'show-delete-action' }) 'show-delete-action' = true\n @property({ type: Boolean, attribute: 'show-save-action' }) 'show-save-action' = true\n @property({ type: Boolean, attribute: 'page-end' }) 'page-end' = false\n @property({ type: Boolean, attribute: 'show-move' }) 'show-move' = false\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: Boolean, attribute: 'show-jump' }) 'show-jump' = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) 'exam-answer-relation-type' = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n @state() private _addMenuOpen = false\n\n connectedCallback() {\n super.connectedCallback()\n document.addEventListener('click', this._handleDocumentClick)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n document.removeEventListener('click', this._handleDocumentClick)\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answer-check-type')) {\n this._currentCheckType = this['answer-check-type']\n }\n }\n\n private _handleDocumentClick = (e: MouseEvent) => {\n const path = e.composedPath()\n const wrap = this.shadowRoot?.querySelector('.add-menu-wrap')\n if (wrap && !path.includes(wrap)) {\n this._addMenuOpen = false\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this['answer-check-type'])?.label ?? ''\n }\n\n private get _showAnswerSetting() {\n return this['show-other-option'] || this['show-answer-setting']\n }\n\n private get _showKey() {\n return this['show-other-option'] || this['show-key']\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this['show-add']\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${!this['hide-add-rich-text']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>\n ${this['show-rich-text'] ? '删除题目描述(图文)' : '+添加题目描述(图文)'}\n </span>\n `\n : ''}\n ${this['show-jump']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this['is-set'] ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n `\n : ''}\n ${this._showKey\n ? html`\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this['is-key']} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n ${this['show-delete-action']\n ? html`<button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>`\n : ''}\n ${this['show-save-action']\n ? html`<button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>`\n : ''}\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n <span class=\"inline-actions\">\n ${this._showKey\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this['is-key']} /> 核心题\n </label>\n `\n : ''}\n ${this._showAnswerSetting\n ? html`\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n ${this['show-add']\n ? html`\n <span class=\"add-menu-wrap\">\n <span class=\"link-btn\" @click=${() => { this._addMenuOpen = !this._addMenuOpen }}>在此题后加入新题</span>\n ${this._renderAddMenu()}\n </span>\n `\n : ''}\n ${this['show-jump']\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('jump')}>${this['is-set'] ? '编辑跳题逻辑' : '设置跳题逻辑'}</span>\n `\n : ''}\n </span>\n </div>\n <div class=\"right\">\n ${!this['is-set'] && this['show-move']\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('move', 'up')}>上移</button>\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('move', 'down')}>下移</button>\n `\n : ''}\n ${!this['is-set'] && this['show-delete-action']\n ? html`<button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>`\n : ''}\n ${!this['page-end'] && !this['is-set']\n ? html`\n <button class=\"text-btn text-btn--default\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>✕</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n private _renderAddMenu() {\n if (!this._addMenuOpen) { return '' }\n return html`\n <div class=\"add-menu\">\n ${addSubjectOptions.map(item => html`\n <button class=\"add-item\" @click=${() => {\n this._addMenuOpen = false\n this._emit('add', item.type)\n }}>${item.label}</button>\n `)}\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this['is-edit'] ? 'active' : ''}\">\n ${this['is-edit'] ? this._renderEditMode() : this._renderViewMode()}\n ${this['is-set'] ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>` : ''}\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","addSubjectOptions","type","QxsSubjectAction","LitElement","constructor","super","arguments","this","_modalOpen","_currentCheckType","_addMenuOpen","_handleDocumentClick","e","path","composedPath","wrap","shadowRoot","querySelector","includes","connectedCallback","document","addEventListener","disconnectedCallback","removeEventListener","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_showAnswerSetting","_showKey","_renderEditMode","html","_renderAddMenu","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","Boolean","attribute","prototype","Number","state","safeCustomElement"],"mappings":"6RAIA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAGfC,EAAoB,CACxB,CAAEC,KAAM,SAAUF,MAAO,OACzB,CAAEE,KAAM,WAAYF,MAAO,OAC3B,CAAEE,KAAM,aAAcF,MAAO,OAC7B,CAAEE,KAAM,YAAaF,MAAO,OAC5B,CAAEE,KAAM,QAASF,MAAO,OACxB,CAAEE,KAAM,OAAQF,MAAO,OACvB,CAAEE,KAAM,WAAYF,MAAO,QAIhBG,QAAAA,iBAAN,cAA+BC,EAAAA,WAA/BC,WAAAA,GAAAC,SAAAC,WA0E8CC,KAAA,YAAY,EACbA,KAAA,WAAW,EACXA,KAAA,WAAW,EACDA,KAAA,qBAAsB,EACrBA,KAAA,sBAAsB,EACpBA,KAAA,wBAAwB,EACnCA,KAAA,aAAa,EACPA,KAAA,mBAAmB,EACfA,KAAA,uBAAuB,EACvBA,KAAA,uBAAuB,EACzBA,KAAA,qBAAqB,EAC7BA,KAAA,aAAa,EACZA,KAAA,cAAc,EACfA,KAAA,aAAa,EACZA,KAAA,cAAc,EACCA,KAAA,6BAA8B,EAEzFA,KAAQ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