@qxs-bns/components-wc 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/editor/blocksuite-editor.mjs +14 -14
- package/es/editor/blocksuite-editor.mjs.map +1 -1
- package/es/subject/action.mjs +18 -18
- package/es/subject/action.mjs.map +1 -1
- package/es/subject/blank-fill.mjs +128 -49
- package/es/subject/blank-fill.mjs.map +1 -1
- package/es/subject/layout.mjs +3 -3
- package/es/subject/layout.mjs.map +1 -1
- package/es/subject/list.mjs +80 -46
- package/es/subject/list.mjs.map +1 -1
- package/es/subject/page-end.mjs +8 -8
- package/es/subject/page-end.mjs.map +1 -1
- package/es/subject/scale.mjs +110 -29
- package/es/subject/scale.mjs.map +1 -1
- package/es/subject/single.mjs +48 -48
- package/es/subject/single.mjs.map +1 -1
- package/es/subject/text-fill.mjs +139 -98
- package/es/subject/text-fill.mjs.map +1 -1
- package/lib/editor/blocksuite-editor.cjs +4 -4
- package/lib/editor/blocksuite-editor.cjs.map +1 -1
- package/lib/subject/action.cjs +18 -18
- package/lib/subject/action.cjs.map +1 -1
- package/lib/subject/blank-fill.cjs +123 -44
- package/lib/subject/blank-fill.cjs.map +1 -1
- package/lib/subject/layout.cjs +2 -2
- package/lib/subject/layout.cjs.map +1 -1
- package/lib/subject/list.cjs +83 -49
- package/lib/subject/list.cjs.map +1 -1
- package/lib/subject/page-end.cjs +8 -8
- package/lib/subject/page-end.cjs.map +1 -1
- package/lib/subject/scale.cjs +103 -22
- package/lib/subject/scale.cjs.map +1 -1
- package/lib/subject/single.cjs +48 -48
- package/lib/subject/single.cjs.map +1 -1
- package/lib/subject/text-fill.cjs +128 -87
- package/lib/subject/text-fill.cjs.map +1 -1
- package/package.json +1 -1
package/es/subject/text-fill.mjs
CHANGED
|
@@ -1,23 +1,75 @@
|
|
|
1
|
-
import{css as t,LitElement as e,html as
|
|
1
|
+
import{css as t,LitElement as e,html as s}from"lit";import{property as i,state as r}from"lit/decorators.js";import{safeCustomElement as a}from"../base/define.mjs";import{SubjectError as o}from"./single.mjs";import{SubjectType as n}from"./types.mjs";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(t,e,s,i)=>{for(var r,a=i>1?void 0:i?d(e,s):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(i?r(e,s,a):r(a))||a);return i&&a&&l(e,s,a),a};const c=[{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 p=class extends e{constructor(){super(...arguments),this._iconPlus=s`<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=s`<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["show-answer-setting"]=!1,this["show-analysis"]=!0,this["rich-text-content"]="",this.analysis="",this["exam-answer-relation-type"]=0,this["exam-expand"]="",this["exam-id"]=0,this["category-id"]="",this["exam-answer-setting"]={isInOrder:!1,isIgnoreCase:!0},this["upload-image"]=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),this["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 String(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((s,i)=>i===t?e:s)}_closeTag(t,e){const s={...this._answers[e]};s.title=s.title.split(",").filter(e=>e!==t).join(","),this._answers=this._answers.map((t,i)=>i===e?s:t)}_addAnswer(){this["is-save"]||(this._answers=[...this._answers,{title:"",tag:"",showInput:!1}])}_deleteAnswer(t){this._answers.length<2||this["is-save"]||(this._answers=this._answers.filter((e,s)=>s!==t))}_removeTag(t){this._selectedTagList=this._selectedTagList.filter(e=>String(e.tagId)!==String(t)),this._emit("tag-change",{value:this._selectedTagList,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_chooseTag(){this._emit("choose-tag",{value:this._selectedTagList,customId:this["custom-id"]||"",examId:this["exam-id"]||0})}_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:s,answers:i,correct:r,keywordCount:a}=t;if(!s)return new o("题目标题不能为空!","EMPTY_TITLE","title",e);const n=this._filledAnswers(i);return!!r||null!==a||n.length>0?r?!a||a<1?new o("请完善答题设置!","NO_KEYWORD_COUNT","keywordCount",e):n.length?a>n.length?new o("关键词个数设置有误!","KEYWORD_COUNT_MISMATCH","answers",e):null:new o("请设置关键词","NO_KEYWORDS","answers",e):new o("请输入问题正确答案!","NO_CORRECT_ANSWER","correct",e):null}async toJSON(){return new Promise((t,e)=>{const s={customId:this["custom-id"]||void 0,answerType:"text_fill",orderIndex:this["order-index"]},i=this["is-edit"]?this._title:this.title||"",r=this["is-edit"]?this._answers:this._normalizedAnswerList(this["answer-list"]||[]),a=this["is-edit"]?this._analysis:this.analysis||"",o=this["is-edit"]?this._correct:this["exam-expand"]||"",l=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,c=this["is-edit"]?this._showRichText:!!this["rich-text-content"],p=this["is-edit"]?this._richText:this["rich-text-content"]||"",g=this._selectedTagList||[],u=this._validateState({row:s,title:i,answers:r,correct:o,keywordCount:l});if(u)return void e(u);const x={answerType:n.TEXT_FILL,title:i,answers:this._filledAnswers(r).map(t=>({title:this._normalizeAnswerTitle(t),...t.answerId?{answerId:t.answerId}:{},...t.customAnswerId?{customAnswerId:t.customAnswerId}:{}})),analysis:a,isSetCorrectAnswer:!!o,isKey:this["is-key"],examExpand:o,examAnswerSettingBO:{isIgnoreCase:h,isInOrder:d,...null!==l?{keywordCount:l}:{}},examRichTextContent:c?p:"",categoryId:this._categoryId||"",memberTagInfo:g,tagInfos:g,resourceList:this["resource-list"]||[],examResourceBOList:this["resource-list"]||[]};this["custom-id"]&&(x.customId=this["custom-id"]),t(x)})}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=this["is-edit"]?this._title:this.title||"",s=this["is-edit"]?this._answers:this._normalizedAnswerList(this["answer-list"]||[]),i=this["is-edit"]?this._correct:this["exam-expand"]||"",r=this["is-edit"]?this._keywordCount:this._readKeywordCount(this["exam-answer-setting"]),a=this._validateState({row:t,title:e,answers:s,correct:i,keywordCount:r});return a?[a]:[]}_renderPreview(){const t=this["is-edit"]?this._answers:this._normalizedAnswerList(this["answer-list"]||[]),e=this["is-edit"]?this._correct:this["exam-expand"]||"";return s`
|
|
2
2
|
<div class="preview">
|
|
3
|
-
<span class="title">${this
|
|
4
|
-
${this
|
|
5
|
-
${
|
|
3
|
+
<span class="title">${this["order-index"]+1}.${this.title}(问答题)</span>
|
|
4
|
+
${this["rich-text-content"]?s`<div class="rich-text" .innerHTML=${this["rich-text-content"]}></div>`:""}
|
|
5
|
+
${this._filledAnswers(t).length?s`
|
|
6
6
|
<div style="margin-top:8px;color:#a8abb2">
|
|
7
|
-
${t.map((t,e)=>t
|
|
8
|
-
<span style="margin-right:10px">关键词${e+1}: ${t.title}</span>
|
|
9
|
-
`:"")}
|
|
7
|
+
${this._filledAnswers(t).map((t,e)=>s`<span style="margin-right:10px">关键词${e+1}: ${this._normalizeAnswerTitle(t)}</span>`)}
|
|
10
8
|
</div>
|
|
11
9
|
`:""}
|
|
12
|
-
${e?
|
|
13
|
-
${this.analysis?
|
|
10
|
+
${e?s`<div style="margin-top:8px;color:#a8abb2">正确答案:${e}</div>`:""}
|
|
11
|
+
${this.analysis?s`<div style="color:#909399;font-size:12px;margin-top:8px">解析: ${this.analysis}</div>`:""}
|
|
12
|
+
${this["show-category"]&&this._categoryId?s`<div class="section-row"><span class="value-text">分类:${this._categoryLabel()}</span></div>`:""}
|
|
13
|
+
${this["show-tag"]&&this._selectedTagList.length?s`
|
|
14
|
+
<div class="section-row">
|
|
15
|
+
<span class="value-text">标签/关键信息:</span>
|
|
16
|
+
<div class="tag-list" style="margin-top:6px">
|
|
17
|
+
${this._selectedTagList.map(t=>s`<span class="tag-item">${t.tagName}</span>`)}
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
`:""}
|
|
21
|
+
${this._renderResourceSection()}
|
|
14
22
|
</div>
|
|
15
|
-
`}
|
|
23
|
+
`}_renderTagSection(){return this["show-tag"]?s`
|
|
24
|
+
<div class="flex-items-start section-row">
|
|
25
|
+
<div class="label"><span>标签:</span></div>
|
|
26
|
+
<div style="flex:1">
|
|
27
|
+
<div class="tag-list">
|
|
28
|
+
${this._selectedTagList.length?this._selectedTagList.map(t=>s`
|
|
29
|
+
<span class="tag-item">
|
|
30
|
+
${t.tagName}
|
|
31
|
+
${this["is-save"]?"":s`<span class="close" @click=${()=>this._removeTag(t.tagId)}>×</span>`}
|
|
32
|
+
</span>
|
|
33
|
+
`):s`<span class="tag-hint">暂无标签/关键信息</span>`}
|
|
34
|
+
</div>
|
|
35
|
+
${this["is-edit"]&&!this["is-save"]?s`<div style="margin-top:8px"><span class="el-link" @click=${()=>this._chooseTag()}>选择</span></div>`:""}
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
`:""}_renderCategorySection(){return this["show-category"]?s`
|
|
39
|
+
<div class="flex-items-start section-row">
|
|
40
|
+
<div class="label"><span>分类:</span></div>
|
|
41
|
+
<div style="flex:1">
|
|
42
|
+
${this["is-edit"]?s`
|
|
43
|
+
<select class="el-select" .value=${String(this._categoryId)} ?disabled=${this["is-save"]}
|
|
44
|
+
@change=${t=>this._onCategoryChange(t.target.value)}>
|
|
45
|
+
<option value="">选择分类</option>
|
|
46
|
+
${this["category-list"].map(t=>s`
|
|
47
|
+
<option value=${String(t.categoryId)} ?selected=${String(t.categoryId)===String(this._categoryId)}>${t.title||t.categoryName}</option>
|
|
48
|
+
`)}
|
|
49
|
+
</select>
|
|
50
|
+
`:s`<span class="value-text">${this._categoryLabel()}</span>`}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
`:""}_renderResourceSection(){if(!this["show-resource"])return"";const t=this._imageResources(),e=this._videoResource();return s`
|
|
54
|
+
<div class="flex-items-start section-row">
|
|
55
|
+
<div class="label"><span>资源:</span></div>
|
|
56
|
+
<div style="flex:1">
|
|
57
|
+
<div class="resource-summary">图片 ${t.length} 张${e?.url?",含视频资源":""}</div>
|
|
58
|
+
${t.length?s`
|
|
59
|
+
<div class="resource-thumbs">
|
|
60
|
+
${t.slice(0,4).map(t=>s`<img class="resource-thumb" src=${t} alt="resource" />`)}
|
|
61
|
+
</div>
|
|
62
|
+
`:""}
|
|
63
|
+
${e?.url?s`<div style="margin-top:8px"><a class="el-link" href=${e.url} target="_blank" rel="noreferrer">查看视频</a></div>`:""}
|
|
64
|
+
${t.length||e?.url?"":s`<div class="tag-hint">暂无资源</div>`}
|
|
65
|
+
</div>
|
|
66
|
+
</div>
|
|
67
|
+
`}_renderEdit(){return s`
|
|
16
68
|
<div class="flex-items-start">
|
|
17
69
|
<div class="label"><span>题目:</span></div>
|
|
18
70
|
<div style="flex:1">
|
|
19
71
|
<div class="el-input">
|
|
20
|
-
<textarea rows="2" .value=${this._title} ?disabled=${this
|
|
72
|
+
<textarea rows="2" .value=${this._title} ?disabled=${this["is-save"]}
|
|
21
73
|
maxlength=${this.TITLE_MAX}
|
|
22
74
|
@input=${t=>this._onTitleInput(t)}
|
|
23
75
|
placeholder="【问答题】请输入问题"></textarea>
|
|
@@ -26,34 +78,41 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
26
78
|
</div>
|
|
27
79
|
</div>
|
|
28
80
|
|
|
29
|
-
|
|
30
|
-
<div class="
|
|
31
|
-
|
|
32
|
-
<
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
81
|
+
<div class="flex-items-start" style="margin-top:12px">
|
|
82
|
+
<div class="label"><span>答题设置:</span></div>
|
|
83
|
+
<div style="flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px">
|
|
84
|
+
<span style="font-size:13px;color:#606266">共答对</span>
|
|
85
|
+
<input
|
|
86
|
+
type="number"
|
|
87
|
+
style="width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px"
|
|
88
|
+
.value=${null===this._keywordCount?"":String(this._keywordCount)}
|
|
89
|
+
min="1"
|
|
90
|
+
@change=${t=>{const e=t.target.value;this._keywordCount=""===e?null:Number(e)}} />
|
|
91
|
+
<span style="font-size:13px;color:#606266">个关键词,算是正确的</span>
|
|
92
|
+
<label style="display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266">
|
|
93
|
+
<input type="checkbox" .checked=${this._isInOrder}
|
|
94
|
+
@change=${t=>{this._isInOrder=t.target.checked}} />
|
|
95
|
+
答案不分顺序
|
|
96
|
+
</label>
|
|
97
|
+
<label style="display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266">
|
|
98
|
+
<input type="checkbox" .checked=${this._isIgnoreCase}
|
|
99
|
+
@change=${t=>{this._isIgnoreCase=t.target.checked}} />
|
|
100
|
+
忽略大小写
|
|
101
|
+
</label>
|
|
49
102
|
</div>
|
|
50
|
-
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
${this._renderTagSection()}
|
|
106
|
+
|
|
107
|
+
${this._renderCategorySection()}
|
|
108
|
+
|
|
109
|
+
${this._renderResourceSection()}
|
|
51
110
|
|
|
52
111
|
<div class="flex-items-start" style="margin-top:12px">
|
|
53
112
|
<div class="label"><span>答案:</span></div>
|
|
54
113
|
<div style="flex:1">
|
|
55
114
|
<div class="el-input">
|
|
56
|
-
<textarea rows="2" .value=${this._correct} ?disabled=${this
|
|
115
|
+
<textarea rows="2" .value=${this._correct} ?disabled=${this["is-save"]}
|
|
57
116
|
maxlength="200"
|
|
58
117
|
@input=${t=>{this._correct=t.target.value}}
|
|
59
118
|
placeholder="请输入正确答案"></textarea>
|
|
@@ -64,51 +123,51 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
64
123
|
|
|
65
124
|
<div class="answer-list" style="margin-top:12px">
|
|
66
125
|
<span style="padding-left:60px;font-size:12px;color:#909399">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>
|
|
67
|
-
${this._answers.map((t,e)=>
|
|
126
|
+
${this._answers.map((t,e)=>s`
|
|
68
127
|
<div class="answer-item">
|
|
69
128
|
<span class="label">关键词${e+1}:</span>
|
|
70
129
|
<div class="answer-tags" style="display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px">
|
|
71
|
-
${t.title.split(",").filter(Boolean).map(t=>{const
|
|
72
|
-
<span style="display:inline-flex;align-items:center;background:${
|
|
130
|
+
${t.title.split(",").filter(Boolean).map(t=>{const i=c[e%c.length];return s`
|
|
131
|
+
<span style="display:inline-flex;align-items:center;background:${i.bg};color:${i.color};border:1px solid ${i.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px">
|
|
73
132
|
${t}
|
|
74
|
-
${this
|
|
133
|
+
${this["is-save"]?"":s`<span style="cursor:pointer;margin-left:4px;color:#909399" @click=${()=>this._closeTag(t,e)}>×</span>`}
|
|
75
134
|
</span>
|
|
76
135
|
`})}
|
|
77
|
-
${this
|
|
78
|
-
${t.showInput?
|
|
136
|
+
${this["is-save"]?"":s`
|
|
137
|
+
${t.showInput?s`
|
|
79
138
|
<input type="text" style="width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px"
|
|
80
139
|
@keydown=${t=>{"Enter"===t.key&&this._addTag(e)}}
|
|
81
140
|
@input=${e=>{t.tag=e.target.value}}
|
|
82
141
|
@blur=${()=>this._addTag(e)} />
|
|
83
142
|
<button class="el-link" @click=${()=>this._addTag(e)}>确认</button>
|
|
84
|
-
`:
|
|
85
|
-
<button class="link" @click=${()=>{this._answers=this._answers.map((t,
|
|
143
|
+
`:s`
|
|
144
|
+
<button class="link" @click=${()=>{this._answers=this._answers.map((t,s)=>s===e?{...t,showInput:!0}:t),this.updateComplete.then(()=>{this.shadowRoot?.querySelector('input[style*="width:80px"]')?.focus()})}}>
|
|
86
145
|
${t.title?"添加同义词":"添加关键词"}
|
|
87
146
|
</button>
|
|
88
147
|
`}
|
|
89
148
|
`}
|
|
90
149
|
</div>
|
|
91
|
-
<span class="icon ${this
|
|
92
|
-
<span class="icon ${this
|
|
150
|
+
<span class="icon ${this["is-save"]?"disabled":""}" @click=${()=>this._addAnswer()}>${this._iconPlus}</span>
|
|
151
|
+
<span class="icon ${this["is-save"]||this._answers.length<2?"disabled":""}" @click=${()=>this._deleteAnswer(e)}>${this._iconRemove}</span>
|
|
93
152
|
</div>
|
|
94
153
|
`)}
|
|
95
154
|
</div>
|
|
96
155
|
|
|
97
|
-
${this._showRichText?
|
|
156
|
+
${this._showRichText?s`
|
|
98
157
|
<div class="flex-items-start" style="margin-top:12px">
|
|
99
158
|
<div class="label"><span>富文本:</span></div>
|
|
100
159
|
<div style="flex:1">
|
|
101
160
|
<qxs-blocksuite-editor
|
|
102
161
|
.content=${this._richText}
|
|
103
|
-
.
|
|
162
|
+
.upload-image=${this["upload-image"]}
|
|
104
163
|
?is-edit=${!0}
|
|
105
164
|
></qxs-blocksuite-editor>
|
|
106
|
-
${this
|
|
165
|
+
${this["show-action"]?"":s`<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>`}
|
|
107
166
|
</div>
|
|
108
167
|
</div>
|
|
109
168
|
`:""}
|
|
110
169
|
|
|
111
|
-
${this
|
|
170
|
+
${this["show-analysis"]?s`
|
|
112
171
|
<div class="flex-items-start" style="margin-top:12px">
|
|
113
172
|
<div class="label"><span>解析:</span></div>
|
|
114
173
|
<div style="flex:1">
|
|
@@ -120,17 +179,17 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
120
179
|
</div>
|
|
121
180
|
</div>
|
|
122
181
|
`:""}
|
|
123
|
-
`}render(){return
|
|
124
|
-
<qxs-subject-layout .
|
|
182
|
+
`}render(){return s`
|
|
183
|
+
<qxs-subject-layout .show-edit=${this["is-edit"]}>
|
|
125
184
|
<div slot="preview">${this._renderPreview()}</div>
|
|
126
185
|
<div slot="edit">${this._renderEdit()}</div>
|
|
127
|
-
${this
|
|
186
|
+
${this["show-action"]?s`
|
|
128
187
|
<qxs-subject-action
|
|
129
|
-
.
|
|
130
|
-
.
|
|
131
|
-
.
|
|
132
|
-
.
|
|
133
|
-
exam-answer-relation-type=${this
|
|
188
|
+
.is-edit=${this["is-edit"]}
|
|
189
|
+
.is-set=${this["is-set"]}
|
|
190
|
+
.show-add=${this["show-add"]}
|
|
191
|
+
.show-rich-text=${this._showRichText}
|
|
192
|
+
exam-answer-relation-type=${this["exam-answer-relation-type"]}
|
|
134
193
|
@delete=${()=>this._emit("delete")}
|
|
135
194
|
@save=${this._save}
|
|
136
195
|
@edit=${()=>this._emit("edit")}
|
|
@@ -140,7 +199,7 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
140
199
|
></qxs-subject-action>
|
|
141
200
|
`:""}
|
|
142
201
|
</qxs-subject-layout>
|
|
143
|
-
`}};
|
|
202
|
+
`}};p.styles=t`
|
|
144
203
|
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
|
|
145
204
|
*, ::before, ::after { box-sizing: border-box; }
|
|
146
205
|
|
|
@@ -148,11 +207,6 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
148
207
|
.preview .title { font-size: 14px; color: #303133; }
|
|
149
208
|
.preview .rich-text { margin-top: 8px; }
|
|
150
209
|
.preview .rich-text img { max-width: 100%; }
|
|
151
|
-
.preview-answer { display: flex; flex-direction: column; margin-top: 12px; }
|
|
152
|
-
.preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }
|
|
153
|
-
.preview-answer .order { color: #909399; }
|
|
154
|
-
.preview-answer .correct { color: #67c23a; }
|
|
155
|
-
.preview-answer .result-info { color: #909399; }
|
|
156
210
|
|
|
157
211
|
.flex { display: flex; }
|
|
158
212
|
.flex-items-center { display: flex; align-items: center; }
|
|
@@ -177,25 +231,6 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
177
231
|
.answer-list { margin-top: 12px; }
|
|
178
232
|
.answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }
|
|
179
233
|
.answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }
|
|
180
|
-
.answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }
|
|
181
|
-
.answer-item .input input {
|
|
182
|
-
height: 32px; padding: 0 50px 0 8px;
|
|
183
|
-
font-size: 13px; line-height: 32px;
|
|
184
|
-
border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;
|
|
185
|
-
transition: border-color .2s; box-sizing: border-box;
|
|
186
|
-
}
|
|
187
|
-
.answer-item .input input:focus { border-color: #3D61E3; outline: none; }
|
|
188
|
-
.answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }
|
|
189
|
-
.answer-item .input .char-counter {
|
|
190
|
-
position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
|
|
191
|
-
font-size: 12px; color: #909399; line-height: 1; pointer-events: none;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
|
|
195
|
-
.answer-item .correct:hover { color: #3D61E3; }
|
|
196
|
-
.answer-item .correct.is-correct { color: #67c23a; }
|
|
197
|
-
.answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }
|
|
198
|
-
|
|
199
234
|
.answer-item .icon {
|
|
200
235
|
margin-left: 6px; cursor: pointer; display: inline-flex;
|
|
201
236
|
align-items: center; justify-content: center;
|
|
@@ -205,10 +240,6 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
205
240
|
}
|
|
206
241
|
.answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
|
|
207
242
|
.answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }
|
|
208
|
-
|
|
209
|
-
.answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }
|
|
210
|
-
.answer-item .link:hover { color: #2D4CB8; }
|
|
211
|
-
|
|
212
243
|
.answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }
|
|
213
244
|
.answer-item .link:hover { color: #2D4CB8; }
|
|
214
245
|
|
|
@@ -216,18 +247,28 @@ import{css as t,LitElement as e,html as i}from"lit";import{property as s,state a
|
|
|
216
247
|
.el-link:hover { color: #2D4CB8; }
|
|
217
248
|
.el-link.danger { color: #f56c6c; }
|
|
218
249
|
|
|
219
|
-
.
|
|
220
|
-
.
|
|
221
|
-
.
|
|
222
|
-
.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
.
|
|
228
|
-
.
|
|
229
|
-
.
|
|
230
|
-
.
|
|
231
|
-
|
|
232
|
-
|
|
250
|
+
.section-row { margin-top: 12px; }
|
|
251
|
+
.value-text { font-size: 13px; color: #606266; white-space: pre-wrap; }
|
|
252
|
+
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 32px; }
|
|
253
|
+
.tag-item {
|
|
254
|
+
display: inline-flex; align-items: center; gap: 4px;
|
|
255
|
+
padding: 4px 8px; font-size: 12px; line-height: 1;
|
|
256
|
+
color: #3D61E3; background: #ecf5ff; border: 1px solid #d9ecff; border-radius: 4px;
|
|
257
|
+
}
|
|
258
|
+
.tag-item .close { cursor: pointer; color: #909399; }
|
|
259
|
+
.tag-item .close:hover { color: #f56c6c; }
|
|
260
|
+
.tag-hint { font-size: 12px; color: #909399; }
|
|
261
|
+
.el-select {
|
|
262
|
+
width: 150px; height: 32px; border: 1px solid #dcdfe6; border-radius: 3px;
|
|
263
|
+
padding: 0 8px; font-size: 13px; background: #fff; appearance: none;
|
|
264
|
+
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");
|
|
265
|
+
background-repeat: no-repeat; background-position: right 8px center;
|
|
266
|
+
}
|
|
267
|
+
.resource-summary { font-size: 12px; color: #606266; }
|
|
268
|
+
.resource-thumbs { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
|
|
269
|
+
.resource-thumb {
|
|
270
|
+
width: 72px; height: 72px; object-fit: cover; border-radius: 6px;
|
|
271
|
+
border: 1px solid #e4e7ed; background: #f5f7fa;
|
|
272
|
+
}
|
|
273
|
+
`,h([i({type:Number,attribute:"order-index"})],p.prototype,"order-index",2),h([i({type:String})],p.prototype,"title",2),h([i({type:String,attribute:"custom-id"})],p.prototype,"custom-id",2),h([i({type:Boolean,attribute:"is-edit"})],p.prototype,"is-edit",2),h([i({type:Boolean,attribute:"is-save"})],p.prototype,"is-save",2),h([i({type:Boolean,attribute:"is-set"})],p.prototype,"is-set",2),h([i({type:Boolean,attribute:"is-key"})],p.prototype,"is-key",2),h([i({type:Boolean,attribute:"show-action"})],p.prototype,"show-action",2),h([i({type:Boolean,attribute:"show-add"})],p.prototype,"show-add",2),h([i({type:Boolean,attribute:"show-answer-setting"})],p.prototype,"show-answer-setting",2),h([i({type:Boolean,attribute:"show-analysis"})],p.prototype,"show-analysis",2),h([i({type:String,attribute:"rich-text-content"})],p.prototype,"rich-text-content",2),h([i({type:String})],p.prototype,"analysis",2),h([i({type:Number,attribute:"exam-answer-relation-type"})],p.prototype,"exam-answer-relation-type",2),h([i({type:String,attribute:"exam-expand"})],p.prototype,"exam-expand",2),h([i({type:Number,attribute:"exam-id"})],p.prototype,"exam-id",2),h([i({type:String,attribute:"category-id"})],p.prototype,"category-id",2),h([i({type:Object,attribute:"exam-answer-setting"})],p.prototype,"exam-answer-setting",2),h([i({type:Object,attribute:"upload-image"})],p.prototype,"upload-image",2),h([i({type:Array,attribute:"answer-list"})],p.prototype,"answer-list",2),h([i({type:Array,attribute:"tag-list"})],p.prototype,"tag-list",2),h([i({type:Array,attribute:"category-list"})],p.prototype,"category-list",2),h([i({type:Array,attribute:"resource-list"})],p.prototype,"resource-list",2),h([i({type:Boolean,attribute:"show-tag"})],p.prototype,"show-tag",2),h([i({type:Boolean,attribute:"show-category"})],p.prototype,"show-category",2),h([i({type:Boolean,attribute:"show-resource"})],p.prototype,"show-resource",2),h([i({type:Object,attribute:"search-handler"})],p.prototype,"search-handler",2),h([i({type:String,attribute:"model-value"})],p.prototype,"model-value",2),h([i({type:Boolean,attribute:"use-model"})],p.prototype,"use-model",2),h([r()],p.prototype,"_answers",2),h([r()],p.prototype,"_title",2),h([r()],p.prototype,"_analysis",2),h([r()],p.prototype,"_isInOrder",2),h([r()],p.prototype,"_isIgnoreCase",2),h([r()],p.prototype,"_keywordCount",2),h([r()],p.prototype,"_correct",2),h([r()],p.prototype,"_showRichText",2),h([r()],p.prototype,"_richText",2),h([r()],p.prototype,"_selectedTagList",2),h([r()],p.prototype,"_categoryId",2),p=h([a("qxs-text-fill")],p);export{p as QxsTextFill};
|
|
233
274
|
//# sourceMappingURL=text-fill.mjs.map
|