@qxs-bns/components-wc 0.0.2
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/base/define.mjs +2 -0
- package/es/base/define.mjs.map +1 -0
- package/es/base/uid.mjs +2 -0
- package/es/base/uid.mjs.map +1 -0
- package/es/editor/blocksuite-editor.mjs +931 -0
- package/es/editor/blocksuite-editor.mjs.map +1 -0
- package/es/editor/index.mjs +2 -0
- package/es/editor/index.mjs.map +1 -0
- package/es/index.mjs +2 -0
- package/es/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.mjs +7 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.mjs.map +1 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs +7 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs.map +1 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs +7 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs.map +1 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.mjs +7 -0
- package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.mjs.map +1 -0
- package/es/node_modules/.pnpm/@tiptap_extension-placeholder@3.20.5_@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/@tiptap_extension-placeholder@3.20.5_@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.mjs +7 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.mjs.map +1 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.mjs +7 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.mjs.map +1 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs +7 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs.map +1 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.mjs +7 -0
- package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.mjs +2 -0
- package/es/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.mjs.map +1 -0
- package/es/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.mjs +2 -0
- package/es/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.mjs.map +1 -0
- package/es/subject/action.mjs +118 -0
- package/es/subject/action.mjs.map +1 -0
- package/es/subject/blank-fill.mjs +204 -0
- package/es/subject/blank-fill.mjs.map +1 -0
- package/es/subject/layout.mjs +18 -0
- package/es/subject/layout.mjs.map +1 -0
- package/es/subject/list.mjs +128 -0
- package/es/subject/list.mjs.map +1 -0
- package/es/subject/page-end.mjs +25 -0
- package/es/subject/page-end.mjs.map +1 -0
- package/es/subject/rich-text.mjs +27 -0
- package/es/subject/rich-text.mjs.map +1 -0
- package/es/subject/scale.mjs +162 -0
- package/es/subject/scale.mjs.map +1 -0
- package/es/subject/single.mjs +318 -0
- package/es/subject/single.mjs.map +1 -0
- package/es/subject/text-fill.mjs +229 -0
- package/es/subject/text-fill.mjs.map +1 -0
- package/es/subject/type.mjs +42 -0
- package/es/subject/type.mjs.map +1 -0
- package/lib/base/define.cjs +2 -0
- package/lib/base/define.cjs.map +1 -0
- package/lib/base/uid.cjs +2 -0
- package/lib/base/uid.cjs.map +1 -0
- package/lib/editor/blocksuite-editor.cjs +931 -0
- package/lib/editor/blocksuite-editor.cjs.map +1 -0
- package/lib/editor/index.cjs +2 -0
- package/lib/editor/index.cjs.map +1 -0
- package/lib/index.cjs +2 -0
- package/lib/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.cjs +7 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs +7 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs +7 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.cjs +7 -0
- package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@tiptap_extension-placeholder@3.20.5_@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/@tiptap_extension-placeholder@3.20.5_@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.cjs +7 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.cjs.map +1 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.cjs +7 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.cjs.map +1 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs +8 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs.map +1 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.cjs +7 -0
- package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.cjs +2 -0
- package/lib/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.cjs.map +1 -0
- package/lib/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.cjs +2 -0
- package/lib/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.cjs.map +1 -0
- package/lib/subject/action.cjs +118 -0
- package/lib/subject/action.cjs.map +1 -0
- package/lib/subject/blank-fill.cjs +204 -0
- package/lib/subject/blank-fill.cjs.map +1 -0
- package/lib/subject/layout.cjs +18 -0
- package/lib/subject/layout.cjs.map +1 -0
- package/lib/subject/list.cjs +128 -0
- package/lib/subject/list.cjs.map +1 -0
- package/lib/subject/page-end.cjs +25 -0
- package/lib/subject/page-end.cjs.map +1 -0
- package/lib/subject/rich-text.cjs +27 -0
- package/lib/subject/rich-text.cjs.map +1 -0
- package/lib/subject/scale.cjs +162 -0
- package/lib/subject/scale.cjs.map +1 -0
- package/lib/subject/single.cjs +318 -0
- package/lib/subject/single.cjs.map +1 -0
- package/lib/subject/text-fill.cjs +229 -0
- package/lib/subject/text-fill.cjs.map +1 -0
- package/lib/subject/type.cjs +42 -0
- package/lib/subject/type.cjs.map +1 -0
- package/package.json +77 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import{css as e,LitElement as t,html as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as r}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as o}from"../base/define.mjs";var n=Object.defineProperty,a=Object.getOwnPropertyDescriptor,l=(e,t,i,s)=>{for(var r,o=s>1?void 0:s?a(t,i):t,l=e.length-1;l>=0;l--)(r=e[l])&&(o=(s?r(t,i,o):r(o))||o);return s&&o&&n(t,i,o),o};const p=[{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"}];function d(e){const t=document.createElement("div");t.textContent=e,Object.assign(t.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(t),setTimeout(()=>{t.style.opacity="0",setTimeout(()=>t.remove(),300)},2500)}let c=class extends t{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.orderIndex=0,this.title="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!1,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!0,isIgnoreCase:!0,keywordCount:1},this.answerList=[],this._answers=[{title:"",tag:"",showInput:!1}],this._title="",this._analysis="",this._isInOrder=!0,this._isIgnoreCase=!0,this._keywordCount=1,this._correct="",this._showRichText=!1,this._richText="",this.TITLE_MAX=200}updated(e){e.has("isEdit")&&this.isEdit&&this._syncProps()}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this.answerList?.length&&(this._answers=this.answerList.map(e=>({title:e.title||"",tag:"",showInput:!1}))),this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase,this._keywordCount=this.examAnswerSetting.keywordCount||1),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0),this.examExpand&&(this._correct=this.examExpand)}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_onTitleInput(e){const t=e.target;t.value.length>this.TITLE_MAX&&(t.value=t.value.slice(0,this.TITLE_MAX)),this._title=t.value}_addTag(e){const t={...this._answers[e]};t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),t.showInput=!1,this._answers=this._answers.map((i,s)=>s===e?t:i)}_closeTag(e,t){const i={...this._answers[t]};i.title=i.title.split(",").filter(t=>t!==e).join(","),this._answers=this._answers.map((e,s)=>s===t?i:e)}_addAnswer(){this.isSave||(this._answers=[...this._answers,{title:"",tag:"",showInput:!1}])}_deleteAnswer(e){this._answers.length<2||this.isSave||(this._answers=this._answers.filter((t,i)=>i!==e))}_save(e){if(e?.stopImmediatePropagation(),this._title){if(this._keywordCount||this._correct){if(!this._keywordCount)return void d("请完善答题设置!");if(!this._correct)return void d("请输入问题正确答案!");if(this._answers.length!==this._keywordCount)return void d("关键词个数设置有误!");const e=[];if(this._answers.forEach((t,i)=>{t.title||e.push(`关键词${i+1}未设置`)}),e.length)return void d(e.join(","))}this._emit("save",{title:this._title,answers:this._answers.filter(e=>e.title).map(e=>({title:e.title})),analysis:this._analysis,isSetCorrectAnswer:!!this._correct,isKey:this.isKey,examExpand:this._correct,examAnswerSettingBO:{isIgnoreCase:this._isIgnoreCase,isInOrder:this._isInOrder,keywordCount:this._keywordCount},examRichTextContent:this._showRichText?this._richText:""})}else d("题目标题不能为空!")}_renderPreview(){return i`
|
|
2
|
+
<div class="preview">
|
|
3
|
+
<span class="title">${this.orderIndex+1}.${this.title}(问答题)</span>
|
|
4
|
+
${this.richTextContent?i`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
|
|
5
|
+
${this._answers.some(e=>e.title)?i`
|
|
6
|
+
<div style="margin-top:8px;color:#a8abb2">
|
|
7
|
+
${this._answers.map((e,t)=>e.title?i`
|
|
8
|
+
<span style="margin-right:10px">关键词${t+1}: ${e.title}</span>
|
|
9
|
+
`:"")}
|
|
10
|
+
</div>
|
|
11
|
+
`:""}
|
|
12
|
+
${this._correct?i`<div style="margin-top:8px;color:#a8abb2">正确答案:${this._correct}</div>`:""}
|
|
13
|
+
${this.analysis?i`<div style="color:#909399;font-size:12px;margin-top:8px">解析: ${this.analysis}</div>`:""}
|
|
14
|
+
</div>
|
|
15
|
+
`}_renderEdit(){return i`
|
|
16
|
+
<div class="flex-items-start">
|
|
17
|
+
<div class="label"><span>题目:</span></div>
|
|
18
|
+
<div style="flex:1">
|
|
19
|
+
<div class="el-input">
|
|
20
|
+
<textarea rows="2" .value=${this._title} ?disabled=${this.isSave}
|
|
21
|
+
maxlength=${this.TITLE_MAX}
|
|
22
|
+
@input=${e=>this._onTitleInput(e)}
|
|
23
|
+
placeholder="【问答题】请输入问题"></textarea>
|
|
24
|
+
<span class="char-counter">${this._title.length}/${this.TITLE_MAX}</span>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<div class="flex-items-start" style="margin-top:12px">
|
|
30
|
+
<div class="label"><span>答题设置:</span></div>
|
|
31
|
+
<div style="flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px">
|
|
32
|
+
<span style="font-size:13px;color:#606266">共答对</span>
|
|
33
|
+
<input type="number" style="width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px"
|
|
34
|
+
.value=${String(this._keywordCount)} min="1"
|
|
35
|
+
@change=${e=>{this._keywordCount=Number(e.target.value)}} />
|
|
36
|
+
<span style="font-size:13px;color:#606266">个关键词,算是正确的</span>
|
|
37
|
+
<label style="display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266">
|
|
38
|
+
<input type="checkbox" .checked=${this._isInOrder}
|
|
39
|
+
@change=${e=>{this._isInOrder=e.target.checked}} />
|
|
40
|
+
答案不分顺序
|
|
41
|
+
</label>
|
|
42
|
+
<label style="display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266">
|
|
43
|
+
<input type="checkbox" .checked=${this._isIgnoreCase}
|
|
44
|
+
@change=${e=>{this._isIgnoreCase=e.target.checked}} />
|
|
45
|
+
忽略大小写
|
|
46
|
+
</label>
|
|
47
|
+
</div>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div class="flex-items-start" style="margin-top:12px">
|
|
51
|
+
<div class="label"><span>答案:</span></div>
|
|
52
|
+
<div style="flex:1">
|
|
53
|
+
<div class="el-input">
|
|
54
|
+
<textarea rows="2" .value=${this._correct} ?disabled=${this.isSave}
|
|
55
|
+
maxlength="200"
|
|
56
|
+
@input=${e=>{this._correct=e.target.value}}
|
|
57
|
+
placeholder="请输入正确答案"></textarea>
|
|
58
|
+
<span class="char-counter">${this._correct.length}/200</span>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<div class="answer-list" style="margin-top:12px">
|
|
64
|
+
<span style="padding-left:60px;font-size:12px;color:#909399">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>
|
|
65
|
+
${this._answers.map((e,t)=>i`
|
|
66
|
+
<div class="answer-item">
|
|
67
|
+
<span class="label">关键词${t+1}:</span>
|
|
68
|
+
<div class="answer-tags" style="display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px">
|
|
69
|
+
${e.title.split(",").filter(Boolean).map(e=>{const s=p[t%p.length];return i`
|
|
70
|
+
<span style="display:inline-flex;align-items:center;background:${s.bg};color:${s.color};border:1px solid ${s.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px">
|
|
71
|
+
${e}
|
|
72
|
+
${this.isSave?"":i`<span style="cursor:pointer;margin-left:4px;color:#909399" @click=${()=>this._closeTag(e,t)}>×</span>`}
|
|
73
|
+
</span>
|
|
74
|
+
`})}
|
|
75
|
+
${this.isSave?"":i`
|
|
76
|
+
${e.showInput?i`
|
|
77
|
+
<input type="text" style="width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px"
|
|
78
|
+
@keydown=${e=>{"Enter"===e.key&&this._addTag(t)}}
|
|
79
|
+
@input=${t=>{e.tag=t.target.value}}
|
|
80
|
+
@blur=${()=>this._addTag(t)} />
|
|
81
|
+
<button class="el-link" @click=${()=>this._addTag(t)}>确认</button>
|
|
82
|
+
`:i`
|
|
83
|
+
<button class="link" @click=${()=>{this._answers=this._answers.map((e,i)=>i===t?{...e,showInput:!0}:e),this.updateComplete.then(()=>{this.shadowRoot?.querySelector('input[style*="width:80px"]')?.focus()})}}>
|
|
84
|
+
${e.title?"添加同义词":"添加关键词"}
|
|
85
|
+
</button>
|
|
86
|
+
`}
|
|
87
|
+
`}
|
|
88
|
+
</div>
|
|
89
|
+
<span class="icon ${this.isSave?"disabled":""}" @click=${()=>this._addAnswer()}>${this._iconPlus}</span>
|
|
90
|
+
<span class="icon ${this.isSave||this._answers.length<2?"disabled":""}" @click=${()=>this._deleteAnswer(t)}>${this._iconRemove}</span>
|
|
91
|
+
</div>
|
|
92
|
+
`)}
|
|
93
|
+
</div>
|
|
94
|
+
|
|
95
|
+
${this._showRichText?i`
|
|
96
|
+
<div class="flex-items-start" style="margin-top:12px">
|
|
97
|
+
<div class="label"><span>富文本:</span></div>
|
|
98
|
+
<div style="flex:1">
|
|
99
|
+
<qxs-blocksuite-editor
|
|
100
|
+
content=${this._richText}
|
|
101
|
+
?is-edit=${!0}
|
|
102
|
+
></qxs-blocksuite-editor>
|
|
103
|
+
<div class="flex-justify-end" style="margin-top:8px"><span class="el-link danger" @click=${()=>{this._showRichText=!1,this._richText=""}}>删除富文本</span></div>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
`:""}
|
|
107
|
+
|
|
108
|
+
${this.showAnalysis?i`
|
|
109
|
+
<div class="flex-items-start" style="margin-top:12px">
|
|
110
|
+
<div class="label"><span>解析:</span></div>
|
|
111
|
+
<div style="flex:1">
|
|
112
|
+
<div class="el-input">
|
|
113
|
+
<textarea rows="2" .value=${this._analysis}
|
|
114
|
+
@input=${e=>{this._analysis=e.target.value}}
|
|
115
|
+
placeholder="请输入题目解析"></textarea>
|
|
116
|
+
</div>
|
|
117
|
+
</div>
|
|
118
|
+
</div>
|
|
119
|
+
`:""}
|
|
120
|
+
`}render(){return i`
|
|
121
|
+
<qxs-subject-layout ?show-edit=${this.isEdit}>
|
|
122
|
+
<div slot="preview">${this._renderPreview()}</div>
|
|
123
|
+
<div slot="edit">${this._renderEdit()}</div>
|
|
124
|
+
${this.showAction?i`
|
|
125
|
+
<qxs-subject-action
|
|
126
|
+
?is-edit=${this.isEdit}
|
|
127
|
+
?is-set=${this.isSet}
|
|
128
|
+
?show-other-option=${!1}
|
|
129
|
+
exam-answer-relation-type=${this.examAnswerRelationType}
|
|
130
|
+
@delete=${()=>this._emit("delete")}
|
|
131
|
+
@save=${this._save}
|
|
132
|
+
@edit=${()=>this._emit("edit")}
|
|
133
|
+
@add=${e=>this._emit("add",e.detail)}
|
|
134
|
+
@set-key=${e=>{this._emit("set-key",e.detail)}}
|
|
135
|
+
@on-show-rich-text=${()=>{this._showRichText=!0}}
|
|
136
|
+
></qxs-subject-action>
|
|
137
|
+
`:""}
|
|
138
|
+
</qxs-subject-layout>
|
|
139
|
+
`}};c.styles=e`
|
|
140
|
+
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
|
|
141
|
+
*, ::before, ::after { box-sizing: border-box; }
|
|
142
|
+
|
|
143
|
+
.preview { padding: 12px 0; }
|
|
144
|
+
.preview .title { font-size: 14px; color: #303133; }
|
|
145
|
+
.preview .rich-text { margin-top: 8px; }
|
|
146
|
+
.preview .rich-text img { max-width: 100%; }
|
|
147
|
+
.preview-answer { display: flex; flex-direction: column; margin-top: 12px; }
|
|
148
|
+
.preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }
|
|
149
|
+
.preview-answer .order { color: #909399; }
|
|
150
|
+
.preview-answer .correct { color: #67c23a; }
|
|
151
|
+
.preview-answer .result-info { color: #909399; }
|
|
152
|
+
|
|
153
|
+
.flex { display: flex; }
|
|
154
|
+
.flex-items-center { display: flex; align-items: center; }
|
|
155
|
+
.flex-items-start { display: flex; align-items: flex-start; }
|
|
156
|
+
.flex-justify-end { display: flex; justify-content: flex-end; }
|
|
157
|
+
.label { min-width: 60px; font-size: 13px; color: #606266; }
|
|
158
|
+
|
|
159
|
+
textarea {
|
|
160
|
+
border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;
|
|
161
|
+
font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;
|
|
162
|
+
line-height: 1.5; display: block; box-sizing: border-box;
|
|
163
|
+
}
|
|
164
|
+
textarea:focus { border-color: #3D61E3; outline: none; }
|
|
165
|
+
textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }
|
|
166
|
+
.el-input { position: relative; display: block; }
|
|
167
|
+
.el-input textarea { padding-bottom: 24px; }
|
|
168
|
+
.el-input .char-counter {
|
|
169
|
+
position: absolute; right: 12px; bottom: 8px;
|
|
170
|
+
font-size: 12px; color: #909399; line-height: 1; pointer-events: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.answer-list { margin-top: 12px; }
|
|
174
|
+
.answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }
|
|
175
|
+
.answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }
|
|
176
|
+
.answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }
|
|
177
|
+
.answer-item .input input {
|
|
178
|
+
height: 32px; padding: 0 50px 0 8px;
|
|
179
|
+
font-size: 13px; line-height: 32px;
|
|
180
|
+
border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;
|
|
181
|
+
transition: border-color .2s; box-sizing: border-box;
|
|
182
|
+
}
|
|
183
|
+
.answer-item .input input:focus { border-color: #3D61E3; outline: none; }
|
|
184
|
+
.answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }
|
|
185
|
+
.answer-item .input .char-counter {
|
|
186
|
+
position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
|
|
187
|
+
font-size: 12px; color: #909399; line-height: 1; pointer-events: none;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
|
|
191
|
+
.answer-item .correct:hover { color: #3D61E3; }
|
|
192
|
+
.answer-item .correct.is-correct { color: #67c23a; }
|
|
193
|
+
.answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }
|
|
194
|
+
|
|
195
|
+
.answer-item .icon {
|
|
196
|
+
margin-left: 6px; cursor: pointer; display: inline-flex;
|
|
197
|
+
align-items: center; justify-content: center;
|
|
198
|
+
width: 24px; height: 24px; border-radius: 4px;
|
|
199
|
+
border: 1px solid #dcdfe6; background: #fff; color: #909399;
|
|
200
|
+
transition: all 0.2s;
|
|
201
|
+
}
|
|
202
|
+
.answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
|
|
203
|
+
.answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }
|
|
204
|
+
|
|
205
|
+
.answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }
|
|
206
|
+
.answer-item .link:hover { color: #2D4CB8; }
|
|
207
|
+
|
|
208
|
+
.answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }
|
|
209
|
+
.answer-item .link:hover { color: #2D4CB8; }
|
|
210
|
+
|
|
211
|
+
.el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }
|
|
212
|
+
.el-link:hover { color: #2D4CB8; }
|
|
213
|
+
.el-link.danger { color: #f56c6c; }
|
|
214
|
+
|
|
215
|
+
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }
|
|
216
|
+
.modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }
|
|
217
|
+
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }
|
|
218
|
+
.modal-title { font-size: 14px; font-weight: 600; color: #303133; }
|
|
219
|
+
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }
|
|
220
|
+
.modal-close:hover { color: #3D61E3; }
|
|
221
|
+
.modal-body { padding: 20px; }
|
|
222
|
+
.modal-body textarea { min-height: 120px; }
|
|
223
|
+
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }
|
|
224
|
+
.modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }
|
|
225
|
+
.modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }
|
|
226
|
+
.modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
|
|
227
|
+
.modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }
|
|
228
|
+
`,l([s({type:Number,attribute:"order-index"})],c.prototype,"orderIndex",2),l([s({type:String})],c.prototype,"title",2),l([s({type:Boolean,attribute:"is-edit"})],c.prototype,"isEdit",2),l([s({type:Boolean,attribute:"is-save"})],c.prototype,"isSave",2),l([s({type:Boolean,attribute:"is-set"})],c.prototype,"isSet",2),l([s({type:Boolean,attribute:"is-key"})],c.prototype,"isKey",2),l([s({type:Boolean,attribute:"show-action"})],c.prototype,"showAction",2),l([s({type:Boolean,attribute:"show-analysis"})],c.prototype,"showAnalysis",2),l([s({type:String,attribute:"rich-text-content"})],c.prototype,"richTextContent",2),l([s({type:String})],c.prototype,"analysis",2),l([s({type:Number,attribute:"exam-answer-relation-type"})],c.prototype,"examAnswerRelationType",2),l([s({type:String,attribute:"exam-expand"})],c.prototype,"examExpand",2),l([s({type:Object,attribute:"exam-answer-setting"})],c.prototype,"examAnswerSetting",2),l([s({type:Array,attribute:"answer-list"})],c.prototype,"answerList",2),l([r()],c.prototype,"_answers",2),l([r()],c.prototype,"_title",2),l([r()],c.prototype,"_analysis",2),l([r()],c.prototype,"_isInOrder",2),l([r()],c.prototype,"_isIgnoreCase",2),l([r()],c.prototype,"_keywordCount",2),l([r()],c.prototype,"_correct",2),l([r()],c.prototype,"_showRichText",2),l([r()],c.prototype,"_richText",2),c=l([o("qxs-text-fill")],c);export{c as QxsTextFill};
|
|
229
|
+
//# sourceMappingURL=text-fill.mjs.map
|
|
@@ -0,0 +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'\n\ninterface TextAnswer { title: string, tag: string, showInput: boolean }\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' }, // primary\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' }, // success\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' }, // warning\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' }, // danger\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' }, // info\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 = 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-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\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 .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\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 .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\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: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\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\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = false\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean, keywordCount: number } = { isInOrder: true, isIgnoreCase: true, keywordCount: 1 }\n\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = true\n @state() private _isIgnoreCase = true\n @state() private _keywordCount = 1\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 200\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n this._keywordCount = this.examAnswerSetting.keywordCount || 1\n }\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\n if (this.examExpand) {\n this._correct = this.examExpand\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 _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 }\n\n private _addTag(i: number) {\n const a = { ...this._answers[i] }\n if (a.tag) {\n a.title = a.title ? [a.title, a.tag].join(',') : a.tag\n a.tag = ''\n }\n a.showInput = false\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _closeTag(tag: string, i: number) {\n const a = { ...this._answers[i] }\n a.title = a.title.split(',').filter(t => t !== tag).join(',')\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private _save(e?: Event) {\n e?.stopImmediatePropagation()\n if (!this._title) { showToast('题目标题不能为空!'); return }\n if (this._keywordCount || this._correct) {\n if (!this._keywordCount) { showToast('请完善答题设置!'); return }\n if (!this._correct) { showToast('请输入问题正确答案!'); return }\n if (this._answers.length !== this._keywordCount) { showToast('关键词个数设置有误!'); return }\n const msg: string[] = []\n this._answers.forEach((item, i) => {\n if (!item.title) { msg.push(`关键词${i + 1}未设置`) }\n })\n if (msg.length) { showToast(msg.join(',')); return }\n }\n this._emit('save', {\n title: this._title,\n answers: this._answers.filter(a => a.title).map(a => ({ title: a.title })),\n analysis: this._analysis,\n isSetCorrectAnswer: !!this._correct,\n isKey: this.isKey,\n examExpand: this._correct,\n examAnswerSettingBO: { isIgnoreCase: this._isIgnoreCase, isInOrder: this._isInOrder, keywordCount: this._keywordCount },\n examRichTextContent: this._showRichText ? this._richText : '',\n })\n }\n\n private _renderPreview() {\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(问答题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">关键词${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this._correct ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${this._correct}</div>` : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</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} ?disabled=${this.isSave}\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 type=\"number\" style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${String(this._keywordCount)} min=\"1\"\n @change=${(e: Event) => { this._keywordCount = Number((e.target as HTMLInputElement).value) }} />\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 <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} ?disabled=${this.isSave}\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((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${i + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${a.title.split(',').filter(Boolean).map((tag) => {\n const c = TAG_COLORS[i % TAG_COLORS.length]; return html`\n <span style=\"display:inline-flex;align-items:center;background:${c.bg};color:${c.color};border:1px solid ${c.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n ${!this.isSave ? html`<span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, i)}>×</span>` : ''}\n </span>\n `\n })}\n ${!this.isSave\n ? html`\n ${a.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(i) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(i)} />\n <button class=\"el-link\" @click=${() => this._addTag(i)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((x, j) => j === i ? { ...x, showInput: true } : x); this.updateComplete.then(() => { (this.shadowRoot?.querySelector(`input[style*=\"width:80px\"]`) as HTMLInputElement)?.focus() }) }}>\n ${a.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `\n : ''}\n </div>\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this.isSave || this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(i)}>${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 <qxs-blocksuite-editor\n content=${this._richText}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\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 return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\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=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","showToast","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","orderIndex","title","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","keywordCount","answerList","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","TITLE_MAX","updated","changed","has","_syncProps","length","map","a","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","e","target","value","slice","_addTag","i","join","x","j","_closeTag","split","filter","t","_addAnswer","_deleteAnswer","index","_","_save","stopImmediatePropagation","forEach","item","push","answers","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_renderPreview","some","_renderEdit","String","Number","checked","Boolean","c","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","attribute","prototype","Array","state","safeCustomElement"],"mappings":"qjBAMA,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,YAG7C,SAASC,EAAUC,GACjB,MAAMC,EAAKC,SAASC,cAAc,OAClCF,EAAGG,YAAcJ,EACjBK,OAAOC,OAAOL,EAAGM,MAAO,CACtBC,SAAU,QAASC,IAAK,OAAQC,KAAM,MAAOC,UAAW,mBACxDC,QAAS,YAAaC,aAAc,MAAOC,SAAU,OAAQjB,MAAO,OACpEkB,WAAY,UAAWC,OAAQ,QAASC,UAAW,6BACnDC,WAAY,cAAeC,QAAS,MAEtCjB,SAASkB,KAAKC,YAAYpB,GAC1BqB,WAAW,KAAQrB,EAAGM,MAAMY,QAAU,IAAKG,WAAW,IAAMrB,EAAGsB,SAAU,MAAQ,KACnF,CAGO,IAAMC,EAAN,cAA0BC,EAA1BC,WAAAA,GAAA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AA,GACAJ,EAAA,CAAhBM,KAjHUtG,EAiHMoG,UAAA,SAAA,GACAJ,EAAA,CAAhBM,KAlHUtG,EAkHMoG,UAAA,YAAA,GACAJ,EAAA,CAAhBM,KAnHUtG,EAmHMoG,UAAA,aAAA,GACAJ,EAAA,CAAhBM,KApHUtG,EAoHMoG,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KArHUtG,EAqHMoG,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAtHUtG,EAsHMoG,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KAvHUtG,EAuHMoG,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAxHUtG,EAwHMoG,UAAA,YAAA,GAxHNpG,EAANgG,EAAA,CADNO,EAAkB,kBACNvG"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import{css as e,LitElement as t,html as i}from"lit";import{safeCustomElement as s}from"../base/define.mjs";var l=Object.getOwnPropertyDescriptor;const a=[{type:"single",label:"单选题"},{type:"multiple",label:"多选题"},{type:"blank_fill",label:"填空题"},{type:"text_fill",label:"问答题"},{type:"scale",label:"量表题"},{type:"sort",label:"排序题"}],p=[{type:"rich_text",label:"富文本"},{type:"page_end",label:"分页器"}],n=[{type:"single",label:"单选题"},{type:"multiple",label:"多选题"}];let c=class extends t{emit(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.dispatchEvent(new CustomEvent("select",{bubbles:!0,composed:!0,detail:{type:e,canSet:t}}))}render(){return i`
|
|
2
|
+
<div class="container">
|
|
3
|
+
<div class="type-item">
|
|
4
|
+
<div class="section-title">普通题目类型</div>
|
|
5
|
+
<div class="base-subject">
|
|
6
|
+
${a.map(e=>i`
|
|
7
|
+
<span class="item" @click=${()=>this.emit(e.type)}>${e.label}</span>
|
|
8
|
+
`)}
|
|
9
|
+
</div>
|
|
10
|
+
</div>
|
|
11
|
+
<div class="type-item">
|
|
12
|
+
<div class="section-title">其他</div>
|
|
13
|
+
<div class="base-subject">
|
|
14
|
+
${p.map(e=>i`
|
|
15
|
+
<span class="item" @click=${()=>this.emit(e.type)}>${e.label}</span>
|
|
16
|
+
`)}
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="type-item">
|
|
20
|
+
<div class="section-title">互动问答类型(支持设置结果项)</div>
|
|
21
|
+
<div class="base-subject">
|
|
22
|
+
${n.map(e=>i`
|
|
23
|
+
<span class="item" @click=${()=>this.emit(e.type,!0)}>${e.label}</span>
|
|
24
|
+
`)}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</div>
|
|
28
|
+
`}};c.styles=e`
|
|
29
|
+
:host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 13px; }
|
|
30
|
+
.container { padding: 16px; }
|
|
31
|
+
.type-item { margin-bottom: 20px; }
|
|
32
|
+
.section-title { margin-bottom: 10px; font-size: 13px; color: #909399; }
|
|
33
|
+
.base-subject { display: flex; flex-wrap: wrap; gap: 8px; }
|
|
34
|
+
.item {
|
|
35
|
+
display: inline-flex; align-items: center; justify-content: center;
|
|
36
|
+
min-width: 64px; height: 28px; padding: 0 12px; font-size: 13px;
|
|
37
|
+
color: #606266; cursor: pointer; background: #fff;
|
|
38
|
+
border: 1px solid #dcdfe6; border-radius: 4px; transition: all 0.15s;
|
|
39
|
+
}
|
|
40
|
+
.item:hover { color: #409eff; border-color: #409eff; }
|
|
41
|
+
`,c=((e,t,i,s)=>{for(var a,p=s>1?void 0:s?l(t,i):t,n=e.length-1;n>=0;n--)(a=e[n])&&(p=a(p)||p);return p})([s("qxs-subject-type")],c);export{c as QxsSubjectType};
|
|
42
|
+
//# sourceMappingURL=type.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.mjs","sources":["../../../../packages/components-wc/src/subject/type.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\nconst subjectOptions = [\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]\n\nconst otherOptions = [\n { type: 'rich_text', label: '富文本' },\n { type: 'page_end', label: '分页器' },\n]\n\nconst interactionOptions = [\n { type: 'single', label: '单选题' },\n { type: 'multiple', label: '多选题' },\n]\n\n@safeCustomElement('qxs-subject-type')\nexport class QxsSubjectType extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 13px; }\n .container { padding: 16px; }\n .type-item { margin-bottom: 20px; }\n .section-title { margin-bottom: 10px; font-size: 13px; color: #909399; }\n .base-subject { display: flex; flex-wrap: wrap; gap: 8px; }\n .item {\n display: inline-flex; align-items: center; justify-content: center;\n min-width: 64px; height: 28px; padding: 0 12px; font-size: 13px;\n color: #606266; cursor: pointer; background: #fff;\n border: 1px solid #dcdfe6; border-radius: 4px; transition: all 0.15s;\n }\n .item:hover { color: #409eff; border-color: #409eff; }\n `\n\n private emit(type: string, canSet = false) {\n this.dispatchEvent(new CustomEvent('select', {\n bubbles: true, composed: true,\n detail: { type, canSet },\n }))\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"type-item\">\n <div class=\"section-title\">普通题目类型</div>\n <div class=\"base-subject\">\n ${subjectOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type)}>${item.label}</span>\n `)}\n </div>\n </div>\n <div class=\"type-item\">\n <div class=\"section-title\">其他</div>\n <div class=\"base-subject\">\n ${otherOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type)}>${item.label}</span>\n `)}\n </div>\n </div>\n <div class=\"type-item\">\n <div class=\"section-title\">互动问答类型(支持设置结果项)</div>\n <div class=\"base-subject\">\n ${interactionOptions.map(item => html`\n <span class=\"item\" @click=${() => this.emit(item.type, true)}>${item.label}</span>\n `)}\n </div>\n </div>\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["subjectOptions","type","label","otherOptions","interactionOptions","QxsSubjectType","LitElement","emit","canSet","arguments","length","undefined","this","dispatchEvent","CustomEvent","bubbles","composed","detail","render","html","map","item","styles","css","__decorateClass","safeCustomElement"],"mappings":"iJAIA,MAAMA,EAAiB,CACrB,CAAEC,KAAM,SAAUC,MAAO,OACzB,CAAED,KAAM,WAAYC,MAAO,OAC3B,CAAED,KAAM,aAAcC,MAAO,OAC7B,CAAED,KAAM,YAAaC,MAAO,OAC5B,CAAED,KAAM,QAASC,MAAO,OACxB,CAAED,KAAM,OAAQC,MAAO,QAGnBC,EAAe,CACnB,CAAEF,KAAM,YAAaC,MAAO,OAC5B,CAAED,KAAM,WAAYC,MAAO,QAGvBE,EAAqB,CACzB,CAAEH,KAAM,SAAUC,MAAO,OACzB,CAAED,KAAM,WAAYC,MAAO,QAItB,IAAMG,EAAN,cAA6BC,EAgB1BC,IAAAA,CAAKN,GAA8B,IAAhBO,EAAAC,UAAAC,OAAA,QAAAC,IAAAF,UAAA,IAAAA,UAAA,GACzBG,KAAKC,cAAc,IAAIC,YAAY,SAAU,CAC3CC,SAAS,EAAMC,UAAU,EACzBC,OAAQ,CAAEhB,OAAMO,YAEpB,CAEAU,MAAAA,GACE,OAAOC,CAAA;;;;;cAKGnB,EAAeoB,IAAIC,GAAQF,CAAA;0CACC,IAAMP,KAAKL,KAAKc,EAAKpB,SAASoB,EAAKnB;;;;;;;cAO/DC,EAAaiB,IAAIC,GAAQF,CAAA;0CACG,IAAMP,KAAKL,KAAKc,EAAKpB,SAASoB,EAAKnB;;;;;;;cAO/DE,EAAmBgB,IAAIC,GAAQF,CAAA;0CACH,IAAMP,KAAKL,KAAKc,EAAKpB,MAAM,MAASoB,EAAKnB;;;;;KAMjF,GApDWG,EACJiB,OAASC,CAAA;;;;;;;;;;;;;IADLlB,uGAANmB,CAAA,CADNC,EAAkB,qBACNpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.cjs","sources":["../../../../packages/components-wc/src/base/define.ts"],"sourcesContent":["export function safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n"],"names":["tagName","target","customElements","get","define"],"mappings":"uCAAO,SAA2BA,GAChC,OAAO,SAAUC,GAIf,OAHKC,eAAeC,IAAIH,IACtBE,eAAeE,OAAOJ,EAASC,GAE1BA,CACT,CACF"}
|
package/lib/base/uid.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uid.cjs","sources":["../../../../packages/components-wc/src/base/uid.ts"],"sourcesContent":["let counter = 0\nlet lastTimestamp = 0\n\nexport function uid(): string {\n const now = Date.now()\n if (now <= lastTimestamp) {\n counter++\n }\n else {\n counter = 0\n lastTimestamp = now\n }\n return `qxs-${now.toString(36)}-${counter.toString(36)}-${Math.random().toString(36).slice(2, 6)}`\n}\n"],"names":["counter","lastTimestamp","now","Date","toString","Math","random","slice"],"mappings":"aAAA,IAAIA,EAAU,EACVC,EAAgB,cAEb,WACL,MAAMC,EAAMC,KAAKD,MAQjB,OAPIA,GAAOD,EACTD,KAGAA,EAAU,EACVC,EAAgBC,GAEX,OAAOA,EAAIE,SAAS,OAAOJ,EAAQI,SAAS,OAAOC,KAAKC,SAASF,SAAS,IAAIG,MAAM,EAAG,IAChG"}
|