@qxs-bns/components-wc 0.0.22 → 0.0.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/es/editor/blocksuite-editor.mjs +14 -14
  2. package/es/editor/blocksuite-editor.mjs.map +1 -1
  3. package/es/entry-subject.mjs +1 -1
  4. package/es/index.mjs +1 -1
  5. package/es/subject/action.mjs +18 -18
  6. package/es/subject/action.mjs.map +1 -1
  7. package/es/subject/blank-fill.mjs +21 -21
  8. package/es/subject/blank-fill.mjs.map +1 -1
  9. package/es/subject/layout.mjs +3 -3
  10. package/es/subject/layout.mjs.map +1 -1
  11. package/es/subject/list.mjs +43 -43
  12. package/es/subject/list.mjs.map +1 -1
  13. package/es/subject/page-end.mjs +8 -8
  14. package/es/subject/page-end.mjs.map +1 -1
  15. package/es/subject/scale.mjs +19 -19
  16. package/es/subject/scale.mjs.map +1 -1
  17. package/es/subject/single.mjs +48 -48
  18. package/es/subject/single.mjs.map +1 -1
  19. package/es/subject/text-fill.mjs +21 -21
  20. package/es/subject/text-fill.mjs.map +1 -1
  21. package/lib/editor/blocksuite-editor.cjs +4 -4
  22. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  23. package/lib/entry-subject.cjs +1 -1
  24. package/lib/index.cjs +1 -1
  25. package/lib/subject/action.cjs +20 -20
  26. package/lib/subject/action.cjs.map +1 -1
  27. package/lib/subject/blank-fill.cjs +22 -22
  28. package/lib/subject/blank-fill.cjs.map +1 -1
  29. package/lib/subject/layout.cjs +4 -4
  30. package/lib/subject/layout.cjs.map +1 -1
  31. package/lib/subject/list.cjs +51 -51
  32. package/lib/subject/list.cjs.map +1 -1
  33. package/lib/subject/page-end.cjs +8 -8
  34. package/lib/subject/page-end.cjs.map +1 -1
  35. package/lib/subject/scale.cjs +21 -21
  36. package/lib/subject/scale.cjs.map +1 -1
  37. package/lib/subject/single.cjs +50 -50
  38. package/lib/subject/single.cjs.map +1 -1
  39. package/lib/subject/text-fill.cjs +22 -22
  40. package/lib/subject/text-fill.cjs.map +1 -1
  41. package/package.json +3 -3
  42. package/es/entry-all.mjs +0 -2
  43. package/es/entry-all.mjs.map +0 -1
  44. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.mjs +0 -7
  45. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.mjs.map +0 -1
  46. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs +0 -7
  47. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs.map +0 -1
  48. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs +0 -7
  49. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs.map +0 -1
  50. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.mjs +0 -7
  51. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.mjs.map +0 -1
  52. package/es/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.mjs +0 -2
  53. package/es/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.mjs.map +0 -1
  54. 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 +0 -2
  55. 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 +0 -1
  56. package/es/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.mjs +0 -2
  57. package/es/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.mjs.map +0 -1
  58. 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 +0 -2
  59. 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 +0 -1
  60. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.mjs +0 -7
  61. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.mjs.map +0 -1
  62. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.mjs +0 -7
  63. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.mjs.map +0 -1
  64. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs +0 -7
  65. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs.map +0 -1
  66. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.mjs +0 -7
  67. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.mjs.map +0 -1
  68. package/es/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.mjs +0 -2
  69. package/es/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.mjs.map +0 -1
  70. package/es/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.mjs +0 -2
  71. package/es/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.mjs.map +0 -1
  72. package/es/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.mjs +0 -2
  73. package/es/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.mjs.map +0 -1
  74. package/es/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.mjs +0 -2
  75. package/es/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.mjs.map +0 -1
  76. package/es/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.mjs +0 -2
  77. package/es/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.mjs.map +0 -1
  78. package/es/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.mjs +0 -2
  79. package/es/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.mjs.map +0 -1
  80. package/es/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.mjs +0 -2
  81. package/es/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.mjs.map +0 -1
  82. package/es/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.mjs +0 -2
  83. package/es/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.mjs.map +0 -1
  84. package/es/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.mjs +0 -2
  85. package/es/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.mjs.map +0 -1
  86. package/es/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.mjs +0 -2
  87. package/es/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.mjs.map +0 -1
  88. package/es/subject/rich-text.mjs +0 -27
  89. package/es/subject/rich-text.mjs.map +0 -1
  90. package/lib/entry-all.cjs +0 -2
  91. package/lib/entry-all.cjs.map +0 -1
  92. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.cjs +0 -7
  93. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.cjs.map +0 -1
  94. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs +0 -7
  95. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs.map +0 -1
  96. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs +0 -7
  97. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs.map +0 -1
  98. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.cjs +0 -7
  99. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.cjs.map +0 -1
  100. package/lib/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs +0 -2
  101. package/lib/node_modules/.pnpm/@tiptap_extension-placeholder@3.19.0_@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs.map +0 -1
  102. 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 +0 -2
  103. 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 +0 -1
  104. package/lib/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.cjs +0 -2
  105. package/lib/node_modules/.pnpm/@tiptap_extensions@3.19.0_@tiptap_core@3.19.0_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5/node_modules/@tiptap/extensions/dist/index.cjs.map +0 -1
  106. 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 +0 -2
  107. 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 +0 -1
  108. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.cjs +0 -7
  109. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.cjs.map +0 -1
  110. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.cjs +0 -7
  111. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.cjs.map +0 -1
  112. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs +0 -8
  113. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs.map +0 -1
  114. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.cjs +0 -7
  115. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.cjs.map +0 -1
  116. package/lib/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs +0 -2
  117. package/lib/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs.map +0 -1
  118. package/lib/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs +0 -2
  119. package/lib/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs.map +0 -1
  120. package/lib/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs +0 -2
  121. package/lib/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs.map +0 -1
  122. package/lib/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.cjs +0 -2
  123. package/lib/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.cjs.map +0 -1
  124. package/lib/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.cjs +0 -2
  125. package/lib/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.cjs.map +0 -1
  126. package/lib/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs +0 -2
  127. package/lib/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs.map +0 -1
  128. package/lib/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.cjs +0 -2
  129. package/lib/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.cjs.map +0 -1
  130. package/lib/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs +0 -2
  131. package/lib/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs.map +0 -1
  132. package/lib/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.cjs +0 -2
  133. package/lib/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.cjs.map +0 -1
  134. package/lib/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.cjs +0 -2
  135. package/lib/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.cjs.map +0 -1
  136. package/lib/subject/rich-text.cjs +0 -27
  137. package/lib/subject/rich-text.cjs.map +0 -1
  138. package/types/base/define.d.ts +0 -1
  139. package/types/base/uid.d.ts +0 -1
  140. package/types/editor/blocksuite-editor.d.ts +0 -84
  141. package/types/editor/index.d.ts +0 -3
  142. package/types/index.d.ts +0 -4
  143. package/types/subject/action.d.ts +0 -23
  144. package/types/subject/blank-fill.d.ts +0 -49
  145. package/types/subject/index.d.ts +0 -20
  146. package/types/subject/layout.d.ts +0 -7
  147. package/types/subject/list.d.ts +0 -43
  148. package/types/subject/page-end.d.ts +0 -10
  149. package/types/subject/rich-text.d.ts +0 -30
  150. package/types/subject/scale.d.ts +0 -42
  151. package/types/subject/single.d.ts +0 -79
  152. package/types/subject/text-fill.d.ts +0 -54
  153. package/types/subject/type.d.ts +0 -7
@@ -1,35 +1,35 @@
1
- import{css as e,LitElement as t,html as s}from"lit";import{property as i}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{repeat as a}from"../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs";import o from"sortablejs";import{safeCustomElement as n}from"../base/define.mjs";import{uid as l}from"../base/uid.mjs";import{SubjectError as d}from"./single.mjs";import{SubjectType as h}from"./types.mjs";import"./action.mjs";import"./blank-fill.mjs";import"./layout.mjs";import"./text-fill.mjs";import"./scale.mjs";import"./page-end.mjs";import"./type.mjs";var c=Object.defineProperty,p=Object.getOwnPropertyDescriptor,u=(e,t,s,i)=>{for(var r,a=i>1?void 0:i?p(t,s):t,o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i?r(t,s,a):r(a))||a);return i&&a&&c(t,s,a),a};h.SINGLE,h.MULTIPLE,h.SORT,h.BLANK_FILL,h.TEXT_FILL,h.SCALE;let m=class extends t{constructor(){super(...arguments),this.isPreview=!1,this.useModelAttr=null,this._modelValueAttr="",this.uploadImage=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this.categoryList=[],this.showTag=!1,this.showCategory=!1,this.showAi=!1,this.showResource=!1,this.showJump=!1,this.showAdd=!0,this.showAnswerSetting=!1,this.showKey=!1,this.searchApi="",this._list=[],this._sortMode=!1,this._sortable=null,this._initialDataProcessed=!1}get modelValue(){return JSON.stringify(this._list)}set modelValue(e){if(e&&e!==this._modelValueAttr){this._modelValueAttr=e;try{const t=JSON.parse(e);Array.isArray(t)&&(this._list=this._normalizeIncomingList(t),this.requestUpdate())}catch{}}}get _useModel(){return"true"===this.useModelAttr||""===this.useModelAttr||this.hasAttribute("use-model")}get subjectList(){return this._list}set subjectList(e){if(e){if("string"==typeof e)try{e=JSON.parse(e)}catch{return this._list=[],void this.requestUpdate()}if(!Array.isArray(e))return this._list=[],void this.requestUpdate();this._list=this._normalizeIncomingList(e),this.requestUpdate()}else this._list=[]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),"subject-list"===e&&s&&!this._list.length){if(s.includes("[object Object]"))return;try{const e=JSON.parse(s);Array.isArray(e)&&(this._list=this._normalizeIncomingList(e),this.requestUpdate())}catch{}}}get _isPreviewValue(){const e=this.isPreview;return"string"==typeof e?"false"!==e:!!e}connectedCallback(){super.connectedCallback(),this._initialDataProcessed||(this._initialDataProcessed=!0,Promise.resolve().then(()=>{0===this._list.length&&this._processAttributeList()}))}_processAttributeList(){const e=this.getAttribute("subject-list");if(e&&"[]"!==e&&!e.includes("[object Object]"))try{const t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(this._list=this._normalizeIncomingList(t),this.requestUpdate())}catch{}}_normalizeAnswer(e){return{...e,title:String(e?.title??e?.answer??""),answerId:e?.answerId??e?.examAnswerId}}_normalizeItem(e){const t=e?.answerType||(e?.richTextContent?e?.answerType:e?.examTypeEnum),s=Array.isArray(e?.answers)?e.answers.map(e=>this._normalizeAnswer(e)):[];return{...e,customId:e?.customId||l(),...t?{answerType:t}:{},...s.length||Array.isArray(e?.answers)?{answers:s}:{}}}_rebuildPageEndMarkers(e){if(!e.length)return e;if(e.some(e=>"page_end"===e?.answerType))return e;if(!e.some(e=>Number(e?.pageIndex)>1))return e;let t=1;const s=[];return e.forEach(e=>{const i=Number(e?.pageIndex)||1;if(i>t)if(s.length>0)for(;t<i;)s.push({customId:l(),answerType:"page_end"}),t++;else t=i;s.push(e)}),s}_normalizeIncomingList(e){const t=e.map(e=>this._normalizeItem(e));return this._rebuildPageEndMarkers(t)}firstUpdated(){this.updateComplete.then(()=>this._initSortable())}updated(e){e.has("_sortMode")&&(this._sortable?.destroy(),this._sortable=null,this.updateComplete.then(()=>this._initSortable())),e.has("_list")&&this._sortMode&&setTimeout(()=>{this._sortable&&(this._sortable.destroy(),this._sortable=null),this._initSortable()},50)}disconnectedCallback(){super.disconnectedCallback(),this._sortable?.destroy(),this._sortable=null}_initSortable(){if(!this._sortMode)return;this.renderRoot.querySelector(".sort-list")&&(this._sortable&&(this._sortable.destroy(),this._sortable=null),requestAnimationFrame(()=>{const e=this.renderRoot.querySelector(".sort-list");e&&!this._sortable&&(this._sortable=o.create(e,{handle:".sort-handle",animation:200,ghostClass:"sort-ghost",chosenClass:"sort-chosen",onEnd:e=>{const{oldIndex:t,newIndex:s}=e;if(void 0===t||void 0===s||t===s)return;const i=[...this._list],[r]=i.splice(t,1);i.splice(s,0,r),this._list=i,this._emitListChange()}}))}))}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_emitListChange(){this._emit("change",this._list),this._useModel&&(this._modelValueAttr=JSON.stringify(this._list),this._emit("list-change",this._list))}_withPageIndex(e){const t=[];let s=1,i=!1;return e.forEach(e=>{e&&("page_end"!==e.answerType?(i&&(s+=1,i=!1),t.push({...e,pageIndex:s})):t.length>0&&(i=!0))}),t}async toJSON(){const e=this.renderRoot.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text");if(!e||0===e.length)return[];const t=[],s=[];for(const i of e)if("function"==typeof i.toJSON)try{const e=await i.toJSON();t.push(e)}catch(e){e instanceof d?s.push(e):s.push(new d(e.message||"未知错误","UNKNOWN","unknown"))}if(s.length>0)throw s;return this._withPageIndex(t)}async validate(){const e=this.renderRoot.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end");if(!e||0===e.length)return{valid:!0,errors:[]};const t=[];for(const s of e)if("function"==typeof s.validate){const e=s.validate();e?.length&&t.push(...e)}return{valid:0===t.length,errors:t}}get currentList(){return this._list}addSubject(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("page_end"===e){const e={customId:l(),answerType:"page_end"},s=[...this._list];return"number"==typeof t&&t>=0?s.splice(t+1,0,e):s.push(e),this._list=s,this.requestUpdate(),void this._emitListChange()}const i={customId:l(),answerType:e,title:"",answers:[],analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,isKey:!1,answerCheckType:1,examAnswerRelationType:s??0},r=[...this._list];"number"==typeof t&&t>=0?r.splice(t+1,0,i):r.push(i),this._list=r,this.requestUpdate(),this._emitListChange()}addExam(e){const t=this._normalizeIncomingList(e).map(e=>({...e,isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1}));this._list=[...this._list,...t],this._emitListChange()}uploadExcel(e){this._list=[...this._list,...this._normalizeIncomingList(e).map(e=>({...e,isRealCanDel:!0}))],this._emitListChange()}setAnswerRelation(e,t,s){const i=this._list.find(e=>e.customId===t);if(i){const t=i.answers?.find(e=>e.customAnswerId===s);t&&(t.answerRelations=e)}this.requestUpdate(),this._emitListChange()}setTagList(e,t){const s=this._list.find(e=>e.customId===t);if(s)return s.tagInfos=Array.isArray(e)?e:[],s.memberTagInfo=Array.isArray(e)?e:[],this._list=[...this._list],void this._emitListChange();this.requestUpdate()}_orderIndex(e){let t=0,s=0;return this._list.forEach(i=>{t++,i.customId===e&&(s=t)}),s-1}_move(e,t){const s=[...this._list];"up"===t&&e>0?[s[e-1],s[e]]=[s[e],s[e-1]]:"down"===t&&e<s.length-1&&([s[e],s[e+1]]=[s[e+1],s[e]]),this._list=s,this._emitListChange()}_save(e,t){this._list=this._list.map((s,i)=>i===e?{...s,...t.detail,isEdit:!1,isSave:!0}:s),this._emitListChange()}_deleteByCustomId(e){this._list=this._list.filter(t=>t.customId!==e),this._emitListChange()}_delete(e){const t=[...this._list];t.splice(e,1),this._list=t,this._emitListChange()}_setEdit(e,t){this._list=this._list.map((s,i)=>i===e?{...s,isEdit:t}:s)}_pageEndTotal(){return this._list.filter(e=>"page_end"===e.answerType).length+1}_pageEndIndex(e){return this._list.slice(0,e+1).filter(e=>"page_end"===e.answerType).length}_syncRelationAnswer(e,t){const s=this._list[e];if(!s||!Array.isArray(s.answers)||!t?.answer)return;const i=[...s.answers],r=t.answer;let a="number"==typeof t.answerIndex?t.answerIndex:-1;(a<0||a>=i.length)&&(a=i.findIndex((e,t)=>String(e.customAnswerId||"")===String(r.customAnswerId||"")||String(e.answerId||"")===String(r.answerId||"")||String(e.orderIndex||t+1)===String(r.orderIndex||""))),a<0||(i[a]={...i[a],customAnswerId:r.customAnswerId||i[a].customAnswerId||r.answerId},this._list[e]={...s,answers:i},this._list=[...this._list])}_renderItem(e,t){const i=this._orderIndex(e.customId),r=(e.isEdit,e.hasSet,e.isRealCanDel,this._isPreviewValue,e.examAnswerRelationType,e=>this._move(t,e.detail)),a=()=>this._deleteByCustomId(e.customId),o=e=>this._save(t,e),n=()=>this._setEdit(t,!0),l=e=>this.addSubject(e.detail?.type??e.detail,t);return[h.SINGLE,h.MULTIPLE,h.SORT].includes(e.answerType)?s`<qxs-subject-single
1
+ import{css as e,LitElement as t,html as s}from"lit";import{property as i,state as r}from"lit/decorators.js";import a from"sortablejs";import{safeCustomElement as o}from"../base/define.mjs";import{uid as n}from"../base/uid.mjs";import{SubjectError as l}from"./single.mjs";import{SubjectType as h}from"./types.mjs";import"./action.mjs";import"./blank-fill.mjs";import"./layout.mjs";import"./text-fill.mjs";import"./scale.mjs";import"./page-end.mjs";import"./type.mjs";var d=Object.defineProperty,c=Object.getOwnPropertyDescriptor,p=(e,t,s,i)=>{for(var r,a=i>1?void 0:i?c(t,s):t,o=e.length-1;o>=0;o--)(r=e[o])&&(a=(i?r(t,s,a):r(a))||a);return i&&a&&d(t,s,a),a};let u=class extends t{constructor(){super(...arguments),this["is-preview"]=!1,this["use-model"]=null,this._modelValueAttr="",this["upload-image"]=async e=>new Promise((t,s)=>{const i=new FileReader;i.onload=e=>t(e.target?.result),i.onerror=s,i.readAsDataURL(e)}),this["category-list"]=[],this["show-tag"]=!1,this["show-category"]=!1,this["show-ai"]=!1,this["show-resource"]=!1,this["show-jump"]=!1,this["show-add"]=!0,this["show-answer-setting"]=!1,this["show-key"]=!1,this["search-api"]="",this._list=[],this._sortMode=!1,this._sortable=null,this._initialDataProcessed=!1}get"model-value"(){return JSON.stringify(this._list)}set"model-value"(e){if(e&&e!==this._modelValueAttr){this._modelValueAttr=e;try{const t=JSON.parse(e);Array.isArray(t)&&(this._list=this._normalizeIncomingList(t),this.requestUpdate())}catch{}}}get _useModel(){return"true"===this["use-model"]||""===this["use-model"]||this.hasAttribute("use-model")}get"subject-list"(){return this._list}set"subject-list"(e){if(e){if("string"==typeof e)try{e=JSON.parse(e)}catch{return this._list=[],void this.requestUpdate()}if(!Array.isArray(e))return this._list=[],void this.requestUpdate();this._list=this._normalizeIncomingList(e),this.requestUpdate()}else this._list=[]}attributeChangedCallback(e,t,s){if(super.attributeChangedCallback(e,t,s),"subject-list"===e&&s&&!this._list.length){if(s.includes("[object Object]"))return;try{const e=JSON.parse(s);Array.isArray(e)&&(this._list=this._normalizeIncomingList(e),this.requestUpdate())}catch{}}}get _isPreviewValue(){const e=this["is-preview"];return"string"==typeof e?"false"!==e:!!e}connectedCallback(){super.connectedCallback(),this._initialDataProcessed||(this._initialDataProcessed=!0,Promise.resolve().then(()=>{0===this._list.length&&this._processAttributeList()}))}_processAttributeList(){const e=this.getAttribute("subject-list");if(e&&"[]"!==e&&!e.includes("[object Object]"))try{const t=JSON.parse(e);Array.isArray(t)&&t.length>0&&(this._list=this._normalizeIncomingList(t),this.requestUpdate())}catch{}}_normalizeAnswer(e){return{...e,title:String(e?.title??e?.answer??""),answerId:e?.answerId??e?.examAnswerId}}_normalizeItem(e){const t=e?.answerType||(e?.richTextContent?e?.answerType:e?.examTypeEnum),s=Array.isArray(e?.answers)?e.answers.map(e=>this._normalizeAnswer(e)):[];return{...e,customId:e?.customId||n(),...t?{answerType:t}:{},...s.length||Array.isArray(e?.answers)?{answers:s}:{}}}_rebuildPageEndMarkers(e){if(!e.length)return e;if(e.some(e=>"page_end"===e?.answerType))return e;if(!e.some(e=>Number(e?.pageIndex)>1))return e;let t=1;const s=[];return e.forEach(e=>{const i=Number(e?.pageIndex)||1;if(i>t)if(s.length>0)for(;t<i;)s.push({customId:n(),answerType:"page_end"}),t++;else t=i;s.push(e)}),s}_normalizeIncomingList(e){const t=e.map(e=>this._normalizeItem(e));return this._rebuildPageEndMarkers(t)}firstUpdated(){this.updateComplete.then(()=>this._initSortable())}updated(e){e.has("_sortMode")&&(this._sortable?.destroy(),this._sortable=null,this.updateComplete.then(()=>this._initSortable())),e.has("_list")&&this._sortMode&&setTimeout(()=>{this._sortable&&(this._sortable.destroy(),this._sortable=null),this._initSortable()},50)}disconnectedCallback(){super.disconnectedCallback(),this._sortable?.destroy(),this._sortable=null}_initSortable(){if(!this._sortMode)return;this.renderRoot.querySelector(".sort-list")&&(this._sortable&&(this._sortable.destroy(),this._sortable=null),requestAnimationFrame(()=>{const e=this.renderRoot.querySelector(".sort-list");e&&!this._sortable&&(this._sortable=a.create(e,{handle:".sort-handle",animation:200,ghostClass:"sort-ghost",chosenClass:"sort-chosen",onEnd:e=>{const{oldIndex:t,newIndex:s}=e;if(void 0===t||void 0===s||t===s)return;const i=[...this._list],[r]=i.splice(t,1);i.splice(s,0,r),this._list=i,this._emitListChange()}}))}))}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}_emitListChange(){this._emit("change",this._list),this._useModel&&(this._modelValueAttr=JSON.stringify(this._list),this._emit("list-change",this._list))}_withPageIndex(e){const t=[];let s=1,i=!1;return e.forEach(e=>{e&&("page_end"!==e.answerType?(i&&(s+=1,i=!1),t.push({...e,pageIndex:s})):t.length>0&&(i=!0))}),t}async toJSON(){const e=this.renderRoot.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text");if(!e||0===e.length)return[];const t=[],s=[];for(const i of e)if("function"==typeof i.toJSON)try{const e=await i.toJSON();t.push(e)}catch(e){e instanceof l?s.push(e):s.push(new l(e.message||"未知错误","UNKNOWN","unknown"))}if(s.length>0)throw s;return this._withPageIndex(t)}async validate(){const e=this.renderRoot.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end");if(!e||0===e.length)return{valid:!0,errors:[]};const t=[];for(const s of e)if("function"==typeof s.validate){const e=s.validate();e?.length&&t.push(...e)}return{valid:0===t.length,errors:t}}get currentList(){return this._list}addSubject(e,t){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("page_end"===e){const e={customId:n(),answerType:"page_end"},s=[...this._list];return"number"==typeof t&&t>=0?s.splice(t+1,0,e):s.push(e),this._list=s,this.requestUpdate(),void this._emitListChange()}const i={customId:n(),answerType:e,title:"",answers:[],analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,isKey:!1,answerCheckType:1,examAnswerRelationType:s??0},r=[...this._list];"number"==typeof t&&t>=0?r.splice(t+1,0,i):r.push(i),this._list=r,this.requestUpdate(),this._emitListChange()}addExam(e){const t=this._normalizeIncomingList(e).map(e=>({...e,isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1}));this._list=[...this._list,...t],this._emitListChange()}uploadExcel(e){this._list=[...this._list,...this._normalizeIncomingList(e).map(e=>({...e,isRealCanDel:!0}))],this._emitListChange()}setAnswerRelation(e,t,s){const i=this._list.find(e=>e.customId===t);if(i){const t=i.answers?.find(e=>e.customAnswerId===s);t&&(t.answerRelations=e)}this.requestUpdate(),this._emitListChange()}setTagList(e,t){const s=this._list.find(e=>e.customId===t);if(s)return s.tagInfos=Array.isArray(e)?e:[],s.memberTagInfo=Array.isArray(e)?e:[],this._list=[...this._list],void this._emitListChange();this.requestUpdate()}_orderIndex(e){let t=0,s=0;return this._list.forEach(i=>{t++,i.customId===e&&(s=t)}),s-1}_move(e,t){const s=[...this._list];"up"===t&&e>0?[s[e-1],s[e]]=[s[e],s[e-1]]:"down"===t&&e<s.length-1&&([s[e],s[e+1]]=[s[e+1],s[e]]),this._list=s,this._emitListChange()}_save(e,t){this._list=this._list.map((s,i)=>i===e?{...s,...t.detail,isEdit:!1,isSave:!0}:s),this._emitListChange()}_deleteByCustomId(e){this._list=this._list.filter(t=>t.customId!==e),this._emitListChange()}_delete(e){const t=[...this._list];t.splice(e,1),this._list=t,this._emitListChange()}_setEdit(e,t){this._list=this._list.map((s,i)=>i===e?{...s,isEdit:t}:s)}_pageEndTotal(){return this._list.filter(e=>"page_end"===e.answerType).length+1}_pageEndIndex(e){return this._list.slice(0,e+1).filter(e=>"page_end"===e.answerType).length}_syncRelationAnswer(e,t){const s=this._list[e];if(!s||!Array.isArray(s.answers)||!t?.answer)return;const i=[...s.answers],r=t.answer;let a="number"==typeof t.answerIndex?t.answerIndex:-1;(a<0||a>=i.length)&&(a=i.findIndex((e,t)=>String(e.customAnswerId||"")===String(r.customAnswerId||"")||String(e.answerId||"")===String(r.answerId||"")||String(e.orderIndex||t+1)===String(r.orderIndex||""))),a<0||(i[a]={...i[a],customAnswerId:r.customAnswerId||i[a].customAnswerId||r.answerId},this._list[e]={...s,answers:i},this._list=[...this._list])}_renderItem(e,t){const i=this._orderIndex(e.customId),r=(e.isEdit,e.hasSet,e.isRealCanDel,this._isPreviewValue,e.examAnswerRelationType,e=>this._move(t,e.detail)),a=()=>this._deleteByCustomId(e.customId),o=e=>this._save(t,e),n=()=>this._setEdit(t,!0),l=e=>this.addSubject(e.detail?.type??e.detail,t);return[h.SINGLE,h.MULTIPLE,h.SORT].includes(e.answerType)?s`<qxs-subject-single
2
2
  .title=${e.title||""}
3
- .answerList=${e.answers||[]}
4
- .tagList=${e.tagInfos||e.memberTagInfo||[]}
5
- .categoryList=${this.categoryList}
6
- .resourceList=${e.examResourceBOList||e.resourceList||[]}
7
- .searchHandler=${this.searchHandler}
8
- .uploadImage=${this.uploadImage}
3
+ .answer-list=${e.answers||[]}
4
+ .tag-list=${e.tagInfos||e.memberTagInfo||[]}
5
+ .category-list=${this["category-list"]}
6
+ .resource-list=${e.examResourceBOList||e.resourceList||[]}
7
+ .search-handler=${this["search-handler"]}
8
+ .upload-image=${this["upload-image"]}
9
9
  order-index=${i}
10
- .isEdit=${!!e.isEdit}
11
- .isSet=${!!e.hasSet}
12
- .isSave=${!e.isRealCanDel}
13
- .showAction=${!this._isPreviewValue}
14
- .showAdd=${this.showAdd}
15
- .showAnswerSetting=${this.showAnswerSetting}
16
- .showKey=${this.showKey}
17
- .showTag=${this.showTag}
18
- .showCategory=${this.showCategory}
19
- .showAi=${this.showAi}
20
- .showResource=${this.showResource}
21
- .showJump=${this.showJump}
22
- .isKey=${!!e.isKey}
10
+ .is-edit=${!!e.isEdit}
11
+ .is-set=${!!e.hasSet}
12
+ .is-save=${!e.isRealCanDel}
13
+ .show-action=${!this._isPreviewValue}
14
+ .show-add=${this["show-add"]}
15
+ .show-answer-setting=${this["show-answer-setting"]}
16
+ .show-key=${this["show-key"]}
17
+ .show-tag=${this["show-tag"]}
18
+ .show-category=${this["show-category"]}
19
+ .show-ai=${this["show-ai"]}
20
+ .show-resource=${this["show-resource"]}
21
+ .show-jump=${this["show-jump"]}
22
+ .is-key=${!!e.isKey}
23
23
  question-type=${String(e.answerType)}
24
24
  answer-check-type=${e.answerCheckType??1}
25
25
  exam-answer-relation-type=${e.examAnswerRelationType??0}
26
26
  rich-text-content=${e.examRichTextContent||""}
27
27
  analysis=${e.analysis||""}
28
- .leastAnswerCount=${Number(e.leastAnswerCount)||0}
28
+ .least-answer-count=${Number(e.leastAnswerCount)||0}
29
29
  exam-expand=${e.examExpand||""}
30
30
  category-id=${e.categoryId||e.category?.categoryId||""}
31
31
  ai-answer=${e.aiAnswer||""}
32
- search-api=${this.searchApi}
32
+ search-api=${this["search-api"]}
33
33
  custom-id=${e.customId||""}
34
34
  exam-id=${e.examId??0}
35
35
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
@@ -42,12 +42,12 @@ import{css as e,LitElement as t,html as s}from"lit";import{property as i}from"..
42
42
  @set-relation=${e=>{this._syncRelationAnswer(t,e.detail),this._emit("set-relation",{...e.detail,item:this._list[t]})}}
43
43
  ></qxs-subject-single>`:e.answerType===h.BLANK_FILL?s`<qxs-blank-fill
44
44
  .title=${e.title||""}
45
- .answerList=${e.answers||[]}
46
- .examAnswerSetting=${e.examAnswerSettingBO||e.examAnswerSettingVO||{}}
47
- .uploadImage=${this.uploadImage}
45
+ .answer-list=${e.answers||[]}
46
+ .exam-answer-setting=${e.examAnswerSettingBO||e.examAnswerSettingVO||{}}
47
+ .upload-image=${this["upload-image"]}
48
48
  order-index=${i}
49
- .isEdit=${!!e.isEdit} .isSet=${!!e.hasSet} .isSave=${!e.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}
50
- .showAnswerSetting=${this.showAnswerSetting}
49
+ .is-edit=${!!e.isEdit} .is-set=${!!e.hasSet} .is-save=${!e.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this["show-add"]}
50
+ .show-answer-setting=${this["show-answer-setting"]}
51
51
  exam-answer-relation-type=${e.examAnswerRelationType??0}
52
52
  exam-expand=${e.examExpand||""}
53
53
  rich-text-content=${e.examRichTextContent||""}
@@ -56,12 +56,12 @@ import{css as e,LitElement as t,html as s}from"lit";import{property as i}from"..
56
56
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
57
57
  ></qxs-blank-fill>`:e.answerType===h.TEXT_FILL?s`<qxs-text-fill
58
58
  .title=${e.title||""}
59
- .answerList=${e.answers||[]}
60
- .examAnswerSetting=${e.examAnswerSettingBO||e.examAnswerSettingVO||{}}
61
- .uploadImage=${this.uploadImage}
59
+ .answer-list=${e.answers||[]}
60
+ .exam-answer-setting=${e.examAnswerSettingBO||e.examAnswerSettingVO||{}}
61
+ .upload-image=${this["upload-image"]}
62
62
  order-index=${i}
63
- .isEdit=${!!e.isEdit} .isSet=${!!e.hasSet} .isSave=${!e.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}
64
- .showAnswerSetting=${this.showAnswerSetting}
63
+ .is-edit=${!!e.isEdit} .is-set=${!!e.hasSet} .is-save=${!e.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this["show-add"]}
64
+ .show-answer-setting=${this["show-answer-setting"]}
65
65
  exam-answer-relation-type=${e.examAnswerRelationType??0}
66
66
  exam-expand=${e.examExpand||""}
67
67
  rich-text-content=${e.examRichTextContent||""}
@@ -70,29 +70,29 @@ import{css as e,LitElement as t,html as s}from"lit";import{property as i}from"..
70
70
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
71
71
  ></qxs-text-fill>`:e.answerType===h.SCALE?s`<qxs-scale
72
72
  .title=${e.title||""}
73
- .answerList=${e.answers||[]}
74
- .scaleQuestions=${e.scaleQuestionList||[]}
75
- .uploadImage=${this.uploadImage}
73
+ .answer-list=${e.answers||[]}
74
+ .scale-questions=${e.scaleQuestionList||[]}
75
+ .upload-image=${this["upload-image"]}
76
76
  order-index=${i}
77
- .isEdit=${!!e.isEdit} .isSet=${!!e.hasSet} .isSave=${!e.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}
77
+ .is-edit=${!!e.isEdit} .is-set=${!!e.hasSet} .is-save=${!e.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this["show-add"]}
78
78
  exam-answer-relation-type=${e.examAnswerRelationType??0}
79
79
  rich-text-content=${e.examRichTextContent||""}
80
80
  analysis=${e.analysis||""}
81
81
  custom-id=${e.customId||""}
82
82
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
83
83
  ></qxs-scale>`:"page_end"===e.answerType?s`<qxs-page-end
84
- current-page-index=${e.currentPageIndex||this._pageEndIndex(t)}
85
- total-page=${e.totalPage||this._pageEndTotal()}
86
- .showAction=${!this._isPreviewValue}
87
- .showAdd=${this.showAdd}
84
+ .current-page-index=${e.currentPageIndex||this._pageEndIndex(t)}
85
+ .total-page=${e.totalPage||this._pageEndTotal()}
86
+ .show-action=${!this._isPreviewValue}
87
+ .show-add=${this["show-add"]}
88
88
  custom-id=${e.customId||""}
89
89
  @delete=${a}
90
90
  @add=${l}
91
91
  ></qxs-page-end>`:s`<div style="color:#909399;padding:8px">未知题型: ${e.answerType}</div>`}render(){return s`
92
92
  <div class="subject-list">
93
- ${a(this._list,e=>e.customId||`${e.answerType}-${e.examId||e.orderIndex||""}`,(e,t)=>this._renderItem(e,t))}
93
+ ${this._list.map((e,t)=>this._renderItem(e,t))}
94
94
  </div>
95
- `}};m.styles=e`
95
+ `}};u.styles=e`
96
96
  :host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 13px; }
97
97
  *, ::before, ::after { box-sizing: border-box; }
98
98
  .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }
@@ -114,5 +114,5 @@ import{css as e,LitElement as t,html as s}from"lit";import{property as i}from"..
114
114
  .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }
115
115
  .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
116
116
  .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }
117
- `,u([i({attribute:"is-preview"})],m.prototype,"isPreview",2),u([i({attribute:"use-model"})],m.prototype,"useModelAttr",2),u([i({attribute:"model-value"})],m.prototype,"modelValue",1),u([i({type:Object})],m.prototype,"uploadImage",2),u([i({type:Array,attribute:"category-list"})],m.prototype,"categoryList",2),u([i({type:Boolean,attribute:"show-tag"})],m.prototype,"showTag",2),u([i({type:Boolean,attribute:"show-category"})],m.prototype,"showCategory",2),u([i({type:Boolean,attribute:"show-ai"})],m.prototype,"showAi",2),u([i({type:Boolean,attribute:"show-resource"})],m.prototype,"showResource",2),u([i({type:Boolean,attribute:"show-jump"})],m.prototype,"showJump",2),u([i({type:Boolean,attribute:"show-add"})],m.prototype,"showAdd",2),u([i({type:Boolean,attribute:"show-answer-setting"})],m.prototype,"showAnswerSetting",2),u([i({type:Boolean,attribute:"show-key"})],m.prototype,"showKey",2),u([i({type:String,attribute:"search-api"})],m.prototype,"searchApi",2),u([i({type:Object})],m.prototype,"searchHandler",2),u([i({type:Array})],m.prototype,"subjectList",1),u([r()],m.prototype,"_list",2),u([r()],m.prototype,"_sortMode",2),m=u([n("qxs-subject-list")],m);export{m as QxsSubjectList};
117
+ `,p([i({attribute:"is-preview"})],u.prototype,"is-preview",2),p([i({attribute:"use-model"})],u.prototype,"use-model",2),p([i({attribute:"model-value"})],u.prototype,"model-value",1),p([i({type:Object,attribute:"upload-image"})],u.prototype,"upload-image",2),p([i({type:Array,attribute:"category-list"})],u.prototype,"category-list",2),p([i({type:Boolean,attribute:"show-tag"})],u.prototype,"show-tag",2),p([i({type:Boolean,attribute:"show-category"})],u.prototype,"show-category",2),p([i({type:Boolean,attribute:"show-ai"})],u.prototype,"show-ai",2),p([i({type:Boolean,attribute:"show-resource"})],u.prototype,"show-resource",2),p([i({type:Boolean,attribute:"show-jump"})],u.prototype,"show-jump",2),p([i({type:Boolean,attribute:"show-add"})],u.prototype,"show-add",2),p([i({type:Boolean,attribute:"show-answer-setting"})],u.prototype,"show-answer-setting",2),p([i({type:Boolean,attribute:"show-key"})],u.prototype,"show-key",2),p([i({type:String,attribute:"search-api"})],u.prototype,"search-api",2),p([i({type:Object,attribute:"search-handler"})],u.prototype,"search-handler",2),p([i({type:Array,attribute:"subject-list"})],u.prototype,"subject-list",1),p([r()],u.prototype,"_list",2),p([r()],u.prototype,"_sortMode",2),u=p([o("qxs-subject-list")],u);export{u as QxsSubjectList};
118
118
  //# sourceMappingURL=list.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"list.mjs","sources":["../../../../packages/components-wc/src/subject/list.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { repeat } from 'lit/directives/repeat.js'\nimport Sortable from 'sortablejs'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\n\n// 导入子组件以确保它们被注册为 Custom Elements\nimport './action'\nimport './blank-fill'\nimport './layout'\nimport './text-fill'\nimport './scale'\nimport './page-end'\nimport './type'\n\nconst TYPE_LABEL: Record<string, string> = {\n [SubjectType.SINGLE]: '单选题', [SubjectType.MULTIPLE]: '多选题', [SubjectType.SORT]: '排序题',\n [SubjectType.BLANK_FILL]: '填空题', [SubjectType.TEXT_FILL]: '问答题', [SubjectType.SCALE]: '量表题',\n page_end: '分页符',\n}\n\n@safeCustomElement('qxs-subject-list')\nexport class QxsSubjectList 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 *, ::before, ::after { box-sizing: border-box; }\n .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }\n .btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 12px; border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266; cursor: pointer; transition: all 0.2s; }\n .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }\n .subject-list { display: flex; flex-direction: column; }\n .subject-content { flex: 1; min-width: 0; }\n .ghost { opacity: 0.5; background: #ecf5ff; }\n .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }\n .sort-list { display: flex; flex-direction: column; gap: 8px; }\n .sort-item { display: flex; align-items: center; padding: 12px 16px; background: #f8f9fa; border: 1px solid #e4e7ed; border-radius: 6px; cursor: grab; transition: all 0.3s ease; }\n .sort-item:hover { background: #ecf5ff; border-color: #c6e2ff; }\n .sort-item:active { cursor: grabbing; }\n .sort-item.sort-ghost { opacity: 0.5; background: #ecf5ff; border: 2px dashed #409eff; }\n .sort-item.sort-chosen { background: #ecf5ff; border-color: #409eff; box-shadow: 0 4px 16px rgba(64,158,255,.3); transform: scale(1.02); }\n .sort-handle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 12px; color: #909399; flex-shrink: 0; }\n .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }\n .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }\n `\n\n @property({ attribute: 'is-preview' }) isPreview = false\n\n // use-model: enables two-way binding via model-value attribute + list-change event\n @property({ attribute: 'use-model' }) useModelAttr: string | null = null\n @property({ attribute: 'model-value' })\n get modelValue(): string { return JSON.stringify(this._list) }\n\n set modelValue(v: string) {\n if (!v || v === this._modelValueAttr) { return }\n this._modelValueAttr = v\n try {\n const parsed = JSON.parse(v)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch { /* invalid JSON, ignore */ }\n }\n\n private get _useModel(): boolean {\n return this.useModelAttr === 'true' || this.useModelAttr === '' || this.hasAttribute('use-model')\n }\n\n private _modelValueAttr = ''\n\n @property({ type: Object })\n uploadImage: (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: 'category-list' }) categoryList: any[] = []\n @property({ type: Boolean, attribute: 'show-tag' }) showTag = false\n @property({ type: Boolean, attribute: 'show-category' }) showCategory = false\n @property({ type: Boolean, attribute: 'show-ai' }) showAi = false\n @property({ type: Boolean, attribute: 'show-resource' }) showResource = false\n @property({ type: Boolean, attribute: 'show-jump' }) showJump = false\n @property({ type: Boolean, attribute: 'show-add' }) showAdd = true\n @property({ type: Boolean, attribute: 'show-answer-setting' }) showAnswerSetting = false\n @property({ type: Boolean, attribute: 'show-key' }) showKey = false\n @property({ type: String, attribute: 'search-api' }) searchApi = ''\n @property({ type: Object }) searchHandler?: (query: string, answerType: number) => Promise<any[]>\n\n @property({ type: Array })\n get subjectList() { return this._list }\n\n set subjectList(v: any) {\n if (!v) {\n this._list = []\n return\n }\n if (typeof v === 'string') {\n try {\n v = JSON.parse(v)\n }\n catch {\n this._list = []\n this.requestUpdate()\n return\n }\n }\n if (!Array.isArray(v)) {\n this._list = []\n this.requestUpdate()\n return\n }\n this._list = this._normalizeIncomingList(v)\n this.requestUpdate()\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n super.attributeChangedCallback(name, oldVal, newVal)\n if (name === 'subject-list' && newVal && !this._list.length) {\n if (newVal.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(newVal)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n }\n\n @state() private _list: any[] = []\n @state() private _sortMode = false\n private _sortable: Sortable | null = null\n\n private get _isPreviewValue(): boolean {\n const val = (this as any).isPreview\n return typeof val === 'string' ? val !== 'false' : !!val\n }\n\n private _initialDataProcessed = false\n\n connectedCallback() {\n super.connectedCallback()\n if (!this._initialDataProcessed) {\n this._initialDataProcessed = true\n Promise.resolve().then(() => {\n if (this._list.length === 0) {\n this._processAttributeList()\n }\n })\n }\n }\n\n private _processAttributeList() {\n const attr = this.getAttribute('subject-list')\n if (!attr || attr === '[]') { return }\n if (attr.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(attr)\n if (Array.isArray(parsed) && parsed.length > 0) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n\n private _normalizeAnswer(answer: any) {\n return {\n ...answer,\n title: String(answer?.title ?? answer?.answer ?? ''),\n answerId: answer?.answerId ?? answer?.examAnswerId,\n }\n }\n\n private _normalizeItem(item: any) {\n const answerType = item?.answerType || (!item?.richTextContent ? item?.examTypeEnum : item?.answerType)\n const answers = Array.isArray(item?.answers) ? item.answers.map((answer: any) => this._normalizeAnswer(answer)) : []\n return {\n ...item,\n customId: item?.customId || uid(),\n ...(answerType ? { answerType } : {}),\n ...(answers.length || Array.isArray(item?.answers) ? { answers } : {}),\n }\n }\n\n private _rebuildPageEndMarkers(items: any[]) {\n if (!items.length) { return items }\n if (items.some(item => item?.answerType === 'page_end')) { return items }\n if (!items.some(item => Number(item?.pageIndex) > 1)) { return items }\n\n let currentPageIndex = 1\n const rebuilt: any[] = []\n\n items.forEach((item) => {\n const pageIndex = Number(item?.pageIndex) || 1\n if (pageIndex > currentPageIndex) {\n if (rebuilt.length > 0) {\n while (currentPageIndex < pageIndex) {\n rebuilt.push({ customId: uid(), answerType: 'page_end' })\n currentPageIndex++\n }\n }\n else {\n currentPageIndex = pageIndex\n }\n }\n rebuilt.push(item)\n })\n\n return rebuilt\n }\n\n private _normalizeIncomingList(items: any[]) {\n const normalized = items.map((item: any) => this._normalizeItem(item))\n return this._rebuildPageEndMarkers(normalized)\n }\n\n firstUpdated() {\n this.updateComplete.then(() => this._initSortable())\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('_sortMode')) {\n this._sortable?.destroy()\n this._sortable = null\n this.updateComplete.then(() => this._initSortable())\n }\n // Reinitialize Sortable when list changes in sort mode\n if (changed.has('_list') && this._sortMode) {\n // Small delay to let Lit finish DOM updates\n setTimeout(() => {\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n this._initSortable()\n }, 50)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._sortable?.destroy()\n this._sortable = null\n }\n\n private _initSortable() {\n if (!this._sortMode) { return }\n const el = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!el) { return }\n\n // Destroy existing instance first\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n\n // Small delay to ensure DOM is ready after previous destroy\n requestAnimationFrame(() => {\n const currentEl = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!currentEl || this._sortable) { return }\n\n this._sortable = Sortable.create(currentEl, {\n handle: '.sort-handle',\n animation: 200,\n ghostClass: 'sort-ghost',\n chosenClass: 'sort-chosen',\n onEnd: (evt) => {\n const { oldIndex, newIndex } = evt\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) { return }\n const arr = [...this._list]\n const [item] = arr.splice(oldIndex, 1)\n arr.splice(newIndex, 0, item)\n this._list = arr\n this._emitListChange()\n },\n })\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 _emitListChange() {\n this._emit('change', this._list)\n if (this._useModel) {\n this._modelValueAttr = JSON.stringify(this._list)\n this._emit('list-change', this._list)\n }\n }\n\n private _withPageIndex(items: any[]) {\n const serialized: any[] = []\n let pageIndex = 1\n let pendingBoundary = false\n\n items.forEach((item) => {\n if (!item) { return }\n if (item.answerType === 'page_end') {\n if (serialized.length > 0) {\n pendingBoundary = true\n }\n return\n }\n if (pendingBoundary) {\n pageIndex += 1\n pendingBoundary = false\n }\n serialized.push({\n ...item,\n pageIndex,\n })\n })\n\n return serialized\n }\n\n async toJSON(): Promise<any[]> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return []\n }\n\n const results: any[] = []\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.toJSON === 'function') {\n try {\n const data = await el.toJSON()\n results.push(data)\n }\n catch (err: any) {\n if (err instanceof SubjectError) {\n errors.push(err)\n }\n else {\n errors.push(new SubjectError(err.message || '未知错误', 'UNKNOWN', 'unknown'))\n }\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors\n }\n\n return this._withPageIndex(results)\n }\n\n async validate(): Promise<{ valid: boolean, errors: SubjectError[] }> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return { valid: true, errors: [] }\n }\n\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.validate === 'function') {\n const errs = el.validate()\n if (errs?.length) {\n errors.push(...errs)\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n }\n\n // ── public API ────────────────────────────────────────────────\n get currentList() { return this._list }\n\n addSubject(type: string, index?: number, examAnswerRelationType: number | null = null) {\n // 分页符只需要最少的必要字段\n if (type === 'page_end') {\n const pageEndItem = {\n customId: uid(),\n answerType: 'page_end',\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, pageEndItem)\n }\n else {\n arr.push(pageEndItem)\n }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n return\n }\n\n const item = {\n customId: uid(), answerType: type, title: '',\n answers: [], analysis: '', scaleQuestionList: [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n isKey: false, answerCheckType: 1,\n examAnswerRelationType: examAnswerRelationType ?? 0,\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, item)\n }\n else { arr.push(item) }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n }\n\n addExam(items: any[]) {\n const newItems = this._normalizeIncomingList(items).map((item: any) => ({\n ...item,\n isEdit: true,\n isSave: false,\n isRealCanDel: true,\n hasSet: false,\n }))\n this._list = [...this._list, ...newItems]\n this._emitListChange()\n }\n\n uploadExcel(list: any[]) {\n this._list = [\n ...this._list,\n ...this._normalizeIncomingList(list).map((item: any) => ({ ...item, isRealCanDel: true })),\n ]\n this._emitListChange()\n }\n\n setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n const ans = item.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (ans) { ans.answerRelations = answerRelations }\n }\n this.requestUpdate()\n this._emitListChange()\n }\n\n setTagList(tagList: any[], customId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n item.tagInfos = Array.isArray(tagList) ? tagList : []\n item.memberTagInfo = Array.isArray(tagList) ? tagList : []\n this._list = [...this._list]\n this._emitListChange()\n return\n }\n this.requestUpdate()\n }\n\n // ── private helpers ───────────────────────────────────────────\n private _orderIndex(customId: string) {\n let n = 0; let out = 0\n this._list.forEach((v: any) => {\n n++; if (v.customId === customId) { out = n }\n })\n return out - 1\n }\n\n private _move(index: number, dir: 'up' | 'down') {\n const arr = [...this._list]\n if (dir === 'up' && index > 0) { [arr[index - 1], arr[index]] = [arr[index], arr[index - 1]] }\n else if (dir === 'down' && index < arr.length - 1) { [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]] }\n this._list = arr\n this._emitListChange()\n }\n\n private _save(index: number, e: CustomEvent) {\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, ...e.detail, isEdit: false, isSave: true } : item,\n )\n this._emitListChange()\n }\n\n private _deleteByCustomId(customId: string) {\n this._list = this._list.filter(item => item.customId !== customId)\n this._emitListChange()\n }\n\n private _delete(index: number) {\n const arr = [...this._list]\n arr.splice(index, 1)\n this._list = arr\n this._emitListChange()\n }\n\n private _setEdit(index: number, val: boolean) {\n this._list = this._list.map((item, i) => i === index ? { ...item, isEdit: val } : item)\n }\n\n private _pageEndTotal() {\n return this._list.filter(item => item.answerType === 'page_end').length + 1\n }\n\n private _pageEndIndex(index: number) {\n return this._list.slice(0, index + 1).filter(item => item.answerType === 'page_end').length\n }\n\n private _syncRelationAnswer(index: number, detail: any) {\n const item = this._list[index]\n if (!item || !Array.isArray(item.answers) || !detail?.answer) { return }\n const answers = [...item.answers]\n const currentAnswer = detail.answer\n let answerIndex = typeof detail.answerIndex === 'number' ? detail.answerIndex : -1\n\n if (answerIndex < 0 || answerIndex >= answers.length) {\n answerIndex = answers.findIndex((answer: any, currentIndex: number) => {\n return String(answer.customAnswerId || '') === String(currentAnswer.customAnswerId || '')\n || String(answer.answerId || '') === String(currentAnswer.answerId || '')\n || String(answer.orderIndex || currentIndex + 1) === String(currentAnswer.orderIndex || '')\n })\n }\n\n if (answerIndex < 0) { return }\n answers[answerIndex] = {\n ...answers[answerIndex],\n customAnswerId: currentAnswer.customAnswerId || answers[answerIndex].customAnswerId || currentAnswer.answerId,\n }\n this._list[index] = {\n ...item,\n answers,\n }\n this._list = [...this._list]\n }\n\n private _renderItem(item: any, index: number) {\n const common = {\n 'order-index': this._orderIndex(item.customId),\n '?is-edit': item.isEdit || false,\n '?is-set': item.hasSet || false,\n '?is-save': !item.isRealCanDel,\n '?show-action': !this._isPreviewValue,\n 'exam-answer-relation-type': item.examAnswerRelationType ?? 0,\n }\n const onMove = (e: CustomEvent) => this._move(index, e.detail as 'up' | 'down')\n const onDelete = () => this._deleteByCustomId(item.customId)\n const onSave = (e: CustomEvent) => this._save(index, e)\n const onEdit = () => this._setEdit(index, true)\n const onAdd = (e: CustomEvent) => this.addSubject(e.detail?.type ?? e.detail, index)\n\n if ([SubjectType.SINGLE, SubjectType.MULTIPLE, SubjectType.SORT].includes(item.answerType)) {\n return html`<qxs-subject-single\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .tagList=${item.tagInfos || item.memberTagInfo || []}\n .categoryList=${this.categoryList}\n .resourceList=${item.examResourceBOList || item.resourceList || []}\n .searchHandler=${this.searchHandler}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit}\n .isSet=${!!item.hasSet}\n .isSave=${!item.isRealCanDel}\n .showAction=${!this._isPreviewValue}\n .showAdd=${this.showAdd}\n .showAnswerSetting=${this.showAnswerSetting}\n .showKey=${this.showKey}\n .showTag=${this.showTag}\n .showCategory=${this.showCategory}\n .showAi=${this.showAi}\n .showResource=${this.showResource}\n .showJump=${this.showJump}\n .isKey=${!!item.isKey}\n question-type=${String(item.answerType)}\n answer-check-type=${item.answerCheckType ?? 1}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n .leastAnswerCount=${Number(item.leastAnswerCount) || 0}\n exam-expand=${item.examExpand || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n ai-answer=${item.aiAnswer || ''}\n search-api=${this.searchApi}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @set-key=${(e: CustomEvent) => {\n this._list[index].isKey = e.detail.value\n this.requestUpdate()\n }}\n @title-select=${(e: CustomEvent) => this._emit('title-select', e.detail)}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n @jump=${(e: CustomEvent) => this._emit('jump', { ...e.detail, item: this._list[index] })}\n @set-relation=${(e: CustomEvent) => {\n this._syncRelationAnswer(index, e.detail)\n this._emit('set-relation', { ...e.detail, item: this._list[index] })\n }}\n ></qxs-subject-single>`\n }\n if (item.answerType === SubjectType.BLANK_FILL) {\n return html`<qxs-blank-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit} .isSet=${!!item.hasSet} .isSave=${!item.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}\n .showAnswerSetting=${this.showAnswerSetting}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-blank-fill>`\n }\n if (item.answerType === SubjectType.TEXT_FILL) {\n return html`<qxs-text-fill\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .examAnswerSetting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit} .isSet=${!!item.hasSet} .isSave=${!item.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}\n .showAnswerSetting=${this.showAnswerSetting}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-text-fill>`\n }\n if (item.answerType === SubjectType.SCALE) {\n return html`<qxs-scale\n .title=${item.title || ''}\n .answerList=${item.answers || []}\n .scaleQuestions=${item.scaleQuestionList || []}\n .uploadImage=${this.uploadImage}\n order-index=${common['order-index']}\n .isEdit=${!!item.isEdit} .isSet=${!!item.hasSet} .isSave=${!item.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-scale>`\n }\n if (item.answerType === 'page_end') {\n return html`<qxs-page-end\n current-page-index=${item.currentPageIndex || this._pageEndIndex(index)}\n total-page=${item.totalPage || this._pageEndTotal()}\n .showAction=${!this._isPreviewValue}\n .showAdd=${this.showAdd}\n custom-id=${item.customId || ''}\n @delete=${onDelete}\n @add=${onAdd}\n ></qxs-page-end>`\n }\n return html`<div style=\"color:#909399;padding:8px\">未知题型: ${item.answerType}</div>`\n }\n\n render() {\n return html`\n <div class=\"subject-list\">\n ${repeat(\n this._list,\n item => item.customId || `${item.answerType}-${item.examId || item.orderIndex || ''}`,\n (item, index) => this._renderItem(item, index),\n )}\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["SubjectType","SINGLE","MULTIPLE","SORT","BLANK_FILL","TEXT_FILL","SCALE","QxsSubjectList","LitElement","constructor","super","arguments","this","isPreview","useModelAttr","_modelValueAttr","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","categoryList","showTag","showCategory","showAi","showResource","showJump","showAdd","showAnswerSetting","showKey","searchApi","_list","_sortMode","_sortable","_initialDataProcessed","modelValue","JSON","stringify","v","parsed","parse","Array","isArray","_normalizeIncomingList","requestUpdate","_useModel","hasAttribute","subjectList","attributeChangedCallback","name","oldVal","newVal","length","includes","_isPreviewValue","val","connectedCallback","then","_processAttributeList","attr","getAttribute","_normalizeAnswer","answer","title","String","answerId","examAnswerId","_normalizeItem","item","answerType","richTextContent","examTypeEnum","answers","map","customId","uid","_rebuildPageEndMarkers","items","some","Number","pageIndex","currentPageIndex","rebuilt","forEach","push","normalized","firstUpdated","updateComplete","_initSortable","updated","changed","has","destroy","setTimeout","disconnectedCallback","renderRoot","querySelector","requestAnimationFrame","currentEl","Sortable","create","handle","animation","ghostClass","chosenClass","onEnd","evt","oldIndex","newIndex","arr","splice","_emitListChange","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_withPageIndex","serialized","pendingBoundary","toJSON","subjectEls","querySelectorAll","results","errors","el","data","err","SubjectError","message","validate","valid","errs","currentList","addSubject","type","index","examAnswerRelationType","undefined","pageEndItem","analysis","scaleQuestionList","isEdit","isSave","isRealCanDel","hasSet","isKey","answerCheckType","addExam","newItems","uploadExcel","list","setAnswerRelation","answerRelations","customAnswerId","find","ans","c","setTagList","tagList","tagInfos","memberTagInfo","_orderIndex","n","out","_move","dir","_save","i","_deleteByCustomId","filter","_delete","_setEdit","_pageEndTotal","_pageEndIndex","slice","_syncRelationAnswer","currentAnswer","answerIndex","findIndex","currentIndex","orderIndex","_renderItem","common","onMove","onDelete","onSave","onEdit","onAdd","html","examResourceBOList","resourceList","searchHandler","examRichTextContent","leastAnswerCount","examExpand","categoryId","category","aiAnswer","examId","value","examAnswerSettingBO","examAnswerSettingVO","totalPage","render","repeat","styles","css","__decorateClass","property","attribute","prototype","Object","Boolean","state","safeCustomElement"],"mappings":"88BAmBGA,EAAYC,OAAiBD,EAAYE,SAAmBF,EAAYG,KACxEH,EAAYI,WAAqBJ,EAAYK,UAAoBL,EAAYM,MAKzE,IAAMC,EAAN,cAA6BC,EAA7BC,WAAAA,GAAAC,SAAAC,WAyBkCC,KAAAC,WAAY,EAGbD,KAAAE,aAA8B,KAqBpEF,KAAQG,gBAAkB,GAG1BH,KAAAI,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAASC,GAAKL,EAAQK,EAAEC,QAAQC,QACvCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAI8BjB,KAAAkB,aAAsB,GACzBlB,KAAAmB,SAAU,EACLnB,KAAAoB,cAAe,EACrBpB,KAAAqB,QAAS,EACHrB,KAAAsB,cAAe,EACnBtB,KAAAuB,UAAW,EACZvB,KAAAwB,SAAU,EACCxB,KAAAyB,mBAAoB,EAC/BzB,KAAA0B,SAAU,EACT1B,KAAA2B,UAAY,GAiDxD3B,KAAQ4B,MAAe,GACvB5B,KAAQ6B,WAAY,EAC7B7B,KAAQ8B,UAA6B,KAOrC9B,KAAQ+B,uBAAwB,CAAA,CAlGhC,cAAIC,GAAuB,OAAOC,KAAKC,UAAUlC,KAAK4B,MAAO,CAE7D,cAAII,CAAWG,GACb,GAAKA,GAAKA,IAAMnC,KAAKG,gBAArB,CACAH,KAAKG,gBAAkBgC,EACvB,IACE,MAAMC,EAASH,KAAKI,MAAMF,GACtBG,MAAMC,QAAQH,KAChBpC,KAAK4B,MAAQ5B,KAAKwC,uBAAu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ACWH,EAAA,CAA9DC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,yBApE3BrN,EAoEoDsN,UAAA,oBAAA,GACXH,EAAA,CAAnDC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,cArE3BrN,EAqEyCsN,UAAA,UAAA,GACCH,EAAA,CAApDC,EAAS,CAAE1E,KAAMxE,OAAQmJ,UAAW,gBAtE1BrN,EAsE0CsN,UAAA,YAAA,GACzBH,EAAA,CAA3BC,EAAS,CAAE1E,KAAM6E,UAvEPvN,EAuEiBsN,UAAA,gBAAA,GAGxBH,EAAA,CADHC,EAAS,CAAE1E,KAAM/F,SAzEP3C,EA0EPsN,UAAA,cAAA,GA6CaH,EAAA,CAAhBM,KAvHUzN,EAuHMsN,UAAA,QAAA,GACAH,EAAA,CAAhBM,KAxHUzN,EAwHMsN,UAAA,YAAA,GAxHNtN,EAANmN,EAAA,CADNO,EAAkB,qBACN1N"}
1
+ {"version":3,"file":"list.mjs","sources":["../../../../packages/components-wc/src/subject/list.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport Sortable from 'sortablejs'\nimport { safeCustomElement } from '../base/define'\nimport { uid } from '../base/uid'\nimport { SubjectError } from './single'\nimport { SubjectType } from './types'\n\n// 导入子组件以确保它们被注册为 Custom Elements\nimport './action'\nimport './blank-fill'\nimport './layout'\nimport './text-fill'\nimport './scale'\nimport './page-end'\nimport './type'\n\n@safeCustomElement('qxs-subject-list')\nexport class QxsSubjectList 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 *, ::before, ::after { box-sizing: border-box; }\n .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }\n .btn { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 12px; font-size: 12px; border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266; cursor: pointer; transition: all 0.2s; }\n .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }\n .subject-list { display: flex; flex-direction: column; }\n .subject-content { flex: 1; min-width: 0; }\n .ghost { opacity: 0.5; background: #ecf5ff; }\n .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }\n .sort-list { display: flex; flex-direction: column; gap: 8px; }\n .sort-item { display: flex; align-items: center; padding: 12px 16px; background: #f8f9fa; border: 1px solid #e4e7ed; border-radius: 6px; cursor: grab; transition: all 0.3s ease; }\n .sort-item:hover { background: #ecf5ff; border-color: #c6e2ff; }\n .sort-item:active { cursor: grabbing; }\n .sort-item.sort-ghost { opacity: 0.5; background: #ecf5ff; border: 2px dashed #409eff; }\n .sort-item.sort-chosen { background: #ecf5ff; border-color: #409eff; box-shadow: 0 4px 16px rgba(64,158,255,.3); transform: scale(1.02); }\n .sort-handle { display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 12px; color: #909399; flex-shrink: 0; }\n .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }\n .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }\n `\n\n @property({ attribute: 'is-preview' }) 'is-preview' = false\n\n // use-model: enables two-way binding via model-value attribute + list-change event\n @property({ attribute: 'use-model' }) 'use-model': string | null = null\n @property({ attribute: 'model-value' })\n get 'model-value'(): string { return JSON.stringify(this._list) }\n\n set 'model-value'(v: string) {\n if (!v || v === this._modelValueAttr) { return }\n this._modelValueAttr = v\n try {\n const parsed = JSON.parse(v)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch { /* invalid JSON, ignore */ }\n }\n\n private get _useModel(): boolean {\n return this['use-model'] === 'true' || this['use-model'] === '' || this.hasAttribute('use-model')\n }\n\n private _modelValueAttr = ''\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: 'category-list' }) 'category-list': any[] = []\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-ai' }) 'show-ai' = false\n @property({ type: Boolean, attribute: 'show-resource' }) 'show-resource' = false\n @property({ type: Boolean, attribute: 'show-jump' }) 'show-jump' = false\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\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: String, attribute: 'search-api' }) 'search-api' = ''\n @property({ type: Object, attribute: 'search-handler' }) 'search-handler'?: (query: string, answerType: number) => Promise<any[]>\n\n @property({ type: Array, attribute: 'subject-list' })\n get 'subject-list'() { return this._list }\n\n set 'subject-list'(v: any) {\n if (!v) {\n this._list = []\n return\n }\n if (typeof v === 'string') {\n try {\n v = JSON.parse(v)\n }\n catch {\n this._list = []\n this.requestUpdate()\n return\n }\n }\n if (!Array.isArray(v)) {\n this._list = []\n this.requestUpdate()\n return\n }\n this._list = this._normalizeIncomingList(v)\n this.requestUpdate()\n }\n\n attributeChangedCallback(name: string, oldVal: string | null, newVal: string | null) {\n super.attributeChangedCallback(name, oldVal, newVal)\n if (name === 'subject-list' && newVal && !this._list.length) {\n if (newVal.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(newVal)\n if (Array.isArray(parsed)) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n }\n\n @state() private _list: any[] = []\n @state() private _sortMode = false\n private _sortable: Sortable | null = null\n\n private get _isPreviewValue(): boolean {\n const val = this['is-preview']\n return typeof val === 'string' ? val !== 'false' : !!val\n }\n\n private _initialDataProcessed = false\n\n connectedCallback() {\n super.connectedCallback()\n if (!this._initialDataProcessed) {\n this._initialDataProcessed = true\n Promise.resolve().then(() => {\n if (this._list.length === 0) {\n this._processAttributeList()\n }\n })\n }\n }\n\n private _processAttributeList() {\n const attr = this.getAttribute('subject-list')\n if (!attr || attr === '[]') { return }\n if (attr.includes('[object Object]')) {\n return\n }\n try {\n const parsed = JSON.parse(attr)\n if (Array.isArray(parsed) && parsed.length > 0) {\n this._list = this._normalizeIncomingList(parsed)\n this.requestUpdate()\n }\n }\n catch {\n // Not valid JSON, ignore\n }\n }\n\n private _normalizeAnswer(answer: any) {\n return {\n ...answer,\n title: String(answer?.title ?? answer?.answer ?? ''),\n answerId: answer?.answerId ?? answer?.examAnswerId,\n }\n }\n\n private _normalizeItem(item: any) {\n const answerType = item?.answerType || (!item?.richTextContent ? item?.examTypeEnum : item?.answerType)\n const answers = Array.isArray(item?.answers) ? item.answers.map((answer: any) => this._normalizeAnswer(answer)) : []\n return {\n ...item,\n customId: item?.customId || uid(),\n ...(answerType ? { answerType } : {}),\n ...(answers.length || Array.isArray(item?.answers) ? { answers } : {}),\n }\n }\n\n private _rebuildPageEndMarkers(items: any[]) {\n if (!items.length) { return items }\n if (items.some(item => item?.answerType === 'page_end')) { return items }\n if (!items.some(item => Number(item?.pageIndex) > 1)) { return items }\n\n let currentPageIndex = 1\n const rebuilt: any[] = []\n\n items.forEach((item) => {\n const pageIndex = Number(item?.pageIndex) || 1\n if (pageIndex > currentPageIndex) {\n if (rebuilt.length > 0) {\n while (currentPageIndex < pageIndex) {\n rebuilt.push({ customId: uid(), answerType: 'page_end' })\n currentPageIndex++\n }\n }\n else {\n currentPageIndex = pageIndex\n }\n }\n rebuilt.push(item)\n })\n\n return rebuilt\n }\n\n private _normalizeIncomingList(items: any[]) {\n const normalized = items.map((item: any) => this._normalizeItem(item))\n return this._rebuildPageEndMarkers(normalized)\n }\n\n firstUpdated() {\n this.updateComplete.then(() => this._initSortable())\n }\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('_sortMode')) {\n this._sortable?.destroy()\n this._sortable = null\n this.updateComplete.then(() => this._initSortable())\n }\n // Reinitialize Sortable when list changes in sort mode\n if (changed.has('_list') && this._sortMode) {\n // Small delay to let Lit finish DOM updates\n setTimeout(() => {\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n this._initSortable()\n }, 50)\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n this._sortable?.destroy()\n this._sortable = null\n }\n\n private _initSortable() {\n if (!this._sortMode) { return }\n const el = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!el) { return }\n\n // Destroy existing instance first\n if (this._sortable) {\n this._sortable.destroy()\n this._sortable = null\n }\n\n // Small delay to ensure DOM is ready after previous destroy\n requestAnimationFrame(() => {\n const currentEl = this.renderRoot.querySelector<HTMLElement>('.sort-list')\n if (!currentEl || this._sortable) { return }\n\n this._sortable = Sortable.create(currentEl, {\n handle: '.sort-handle',\n animation: 200,\n ghostClass: 'sort-ghost',\n chosenClass: 'sort-chosen',\n onEnd: (evt) => {\n const { oldIndex, newIndex } = evt\n if (oldIndex === undefined || newIndex === undefined || oldIndex === newIndex) { return }\n const arr = [...this._list]\n const [item] = arr.splice(oldIndex, 1)\n arr.splice(newIndex, 0, item)\n this._list = arr\n this._emitListChange()\n },\n })\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 _emitListChange() {\n this._emit('change', this._list)\n if (this._useModel) {\n this._modelValueAttr = JSON.stringify(this._list)\n this._emit('list-change', this._list)\n }\n }\n\n private _withPageIndex(items: any[]) {\n const serialized: any[] = []\n let pageIndex = 1\n let pendingBoundary = false\n\n items.forEach((item) => {\n if (!item) { return }\n if (item.answerType === 'page_end') {\n if (serialized.length > 0) {\n pendingBoundary = true\n }\n return\n }\n if (pendingBoundary) {\n pageIndex += 1\n pendingBoundary = false\n }\n serialized.push({\n ...item,\n pageIndex,\n })\n })\n\n return serialized\n }\n\n async toJSON(): Promise<any[]> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return []\n }\n\n const results: any[] = []\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.toJSON === 'function') {\n try {\n const data = await el.toJSON()\n results.push(data)\n }\n catch (err: any) {\n if (err instanceof SubjectError) {\n errors.push(err)\n }\n else {\n errors.push(new SubjectError(err.message || '未知错误', 'UNKNOWN', 'unknown'))\n }\n }\n }\n }\n\n if (errors.length > 0) {\n throw errors\n }\n\n return this._withPageIndex(results)\n }\n\n async validate(): Promise<{ valid: boolean, errors: SubjectError[] }> {\n const subjectEls = this.renderRoot.querySelectorAll<any>(\n 'qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end',\n )\n if (!subjectEls || subjectEls.length === 0) {\n return { valid: true, errors: [] }\n }\n\n const errors: SubjectError[] = []\n\n for (const el of subjectEls) {\n if (typeof el.validate === 'function') {\n const errs = el.validate()\n if (errs?.length) {\n errors.push(...errs)\n }\n }\n }\n\n return {\n valid: errors.length === 0,\n errors,\n }\n }\n\n // ── public API ────────────────────────────────────────────────\n get currentList() { return this._list }\n\n addSubject(type: string, index?: number, examAnswerRelationType: number | null = null) {\n // 分页符只需要最少的必要字段\n if (type === 'page_end') {\n const pageEndItem = {\n customId: uid(),\n answerType: 'page_end',\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, pageEndItem)\n }\n else {\n arr.push(pageEndItem)\n }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n return\n }\n\n const item = {\n customId: uid(), answerType: type, title: '',\n answers: [], analysis: '', scaleQuestionList: [],\n isEdit: true, isSave: false, isRealCanDel: true, hasSet: false,\n isKey: false, answerCheckType: 1,\n examAnswerRelationType: examAnswerRelationType ?? 0,\n }\n const arr = [...this._list]\n if (typeof index === 'number' && index >= 0) {\n arr.splice(index + 1, 0, item)\n }\n else { arr.push(item) }\n this._list = arr\n this.requestUpdate()\n this._emitListChange()\n }\n\n addExam(items: any[]) {\n const newItems = this._normalizeIncomingList(items).map((item: any) => ({\n ...item,\n isEdit: true,\n isSave: false,\n isRealCanDel: true,\n hasSet: false,\n }))\n this._list = [...this._list, ...newItems]\n this._emitListChange()\n }\n\n uploadExcel(list: any[]) {\n this._list = [\n ...this._list,\n ...this._normalizeIncomingList(list).map((item: any) => ({ ...item, isRealCanDel: true })),\n ]\n this._emitListChange()\n }\n\n setAnswerRelation(answerRelations: any, customId: string, customAnswerId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n const ans = item.answers?.find((c: any) => c.customAnswerId === customAnswerId)\n if (ans) { ans.answerRelations = answerRelations }\n }\n this.requestUpdate()\n this._emitListChange()\n }\n\n setTagList(tagList: any[], customId: string) {\n const item = this._list.find((v: any) => v.customId === customId)\n if (item) {\n item.tagInfos = Array.isArray(tagList) ? tagList : []\n item.memberTagInfo = Array.isArray(tagList) ? tagList : []\n this._list = [...this._list]\n this._emitListChange()\n return\n }\n this.requestUpdate()\n }\n\n // ── private helpers ───────────────────────────────────────────\n private _orderIndex(customId: string) {\n let n = 0; let out = 0\n this._list.forEach((v: any) => {\n n++; if (v.customId === customId) { out = n }\n })\n return out - 1\n }\n\n private _move(index: number, dir: 'up' | 'down') {\n const arr = [...this._list]\n if (dir === 'up' && index > 0) { [arr[index - 1], arr[index]] = [arr[index], arr[index - 1]] }\n else if (dir === 'down' && index < arr.length - 1) { [arr[index], arr[index + 1]] = [arr[index + 1], arr[index]] }\n this._list = arr\n this._emitListChange()\n }\n\n private _save(index: number, e: CustomEvent) {\n this._list = this._list.map((item, i) =>\n i === index ? { ...item, ...e.detail, isEdit: false, isSave: true } : item,\n )\n this._emitListChange()\n }\n\n private _deleteByCustomId(customId: string) {\n this._list = this._list.filter(item => item.customId !== customId)\n this._emitListChange()\n }\n\n private _delete(index: number) {\n const arr = [...this._list]\n arr.splice(index, 1)\n this._list = arr\n this._emitListChange()\n }\n\n private _setEdit(index: number, val: boolean) {\n this._list = this._list.map((item, i) => i === index ? { ...item, isEdit: val } : item)\n }\n\n private _pageEndTotal() {\n return this._list.filter(item => item.answerType === 'page_end').length + 1\n }\n\n private _pageEndIndex(index: number) {\n return this._list.slice(0, index + 1).filter(item => item.answerType === 'page_end').length\n }\n\n private _syncRelationAnswer(index: number, detail: any) {\n const item = this._list[index]\n if (!item || !Array.isArray(item.answers) || !detail?.answer) { return }\n const answers = [...item.answers]\n const currentAnswer = detail.answer\n let answerIndex = typeof detail.answerIndex === 'number' ? detail.answerIndex : -1\n\n if (answerIndex < 0 || answerIndex >= answers.length) {\n answerIndex = answers.findIndex((answer: any, currentIndex: number) => {\n return String(answer.customAnswerId || '') === String(currentAnswer.customAnswerId || '')\n || String(answer.answerId || '') === String(currentAnswer.answerId || '')\n || String(answer.orderIndex || currentIndex + 1) === String(currentAnswer.orderIndex || '')\n })\n }\n\n if (answerIndex < 0) { return }\n answers[answerIndex] = {\n ...answers[answerIndex],\n customAnswerId: currentAnswer.customAnswerId || answers[answerIndex].customAnswerId || currentAnswer.answerId,\n }\n this._list[index] = {\n ...item,\n answers,\n }\n this._list = [...this._list]\n }\n\n private _renderItem(item: any, index: number) {\n const common = {\n 'order-index': this._orderIndex(item.customId),\n '?is-edit': item.isEdit || false,\n '?is-set': item.hasSet || false,\n '?is-save': !item.isRealCanDel,\n '?show-action': !this._isPreviewValue,\n 'exam-answer-relation-type': item.examAnswerRelationType ?? 0,\n }\n const onMove = (e: CustomEvent) => this._move(index, e.detail as 'up' | 'down')\n const onDelete = () => this._deleteByCustomId(item.customId)\n const onSave = (e: CustomEvent) => this._save(index, e)\n const onEdit = () => this._setEdit(index, true)\n const onAdd = (e: CustomEvent) => this.addSubject(e.detail?.type ?? e.detail, index)\n\n if ([SubjectType.SINGLE, SubjectType.MULTIPLE, SubjectType.SORT].includes(item.answerType)) {\n return html`<qxs-subject-single\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .tag-list=${item.tagInfos || item.memberTagInfo || []}\n .category-list=${this['category-list']}\n .resource-list=${item.examResourceBOList || item.resourceList || []}\n .search-handler=${this['search-handler']}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit}\n .is-set=${!!item.hasSet}\n .is-save=${!item.isRealCanDel}\n .show-action=${!this._isPreviewValue}\n .show-add=${this['show-add']}\n .show-answer-setting=${this['show-answer-setting']}\n .show-key=${this['show-key']}\n .show-tag=${this['show-tag']}\n .show-category=${this['show-category']}\n .show-ai=${this['show-ai']}\n .show-resource=${this['show-resource']}\n .show-jump=${this['show-jump']}\n .is-key=${!!item.isKey}\n question-type=${String(item.answerType)}\n answer-check-type=${item.answerCheckType ?? 1}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n .least-answer-count=${Number(item.leastAnswerCount) || 0}\n exam-expand=${item.examExpand || ''}\n category-id=${item.categoryId || item.category?.categoryId || ''}\n ai-answer=${item.aiAnswer || ''}\n search-api=${this['search-api']}\n custom-id=${item.customId || ''}\n exam-id=${item.examId ?? 0}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n @set-key=${(e: CustomEvent) => {\n this._list[index].isKey = e.detail.value\n this.requestUpdate()\n }}\n @title-select=${(e: CustomEvent) => this._emit('title-select', e.detail)}\n @choose-tag=${(e: CustomEvent) => this._emit('choose-tag', { ...e.detail, item: this._list[index] })}\n @tag-change=${(e: CustomEvent) => {\n this._list[index].tagInfos = e.detail.value\n this._list[index].memberTagInfo = e.detail.value\n this.requestUpdate()\n }}\n @category-change=${(e: CustomEvent) => {\n this._list[index].categoryId = e.detail.value\n this.requestUpdate()\n }}\n @jump=${(e: CustomEvent) => this._emit('jump', { ...e.detail, item: this._list[index] })}\n @set-relation=${(e: CustomEvent) => {\n this._syncRelationAnswer(index, e.detail)\n this._emit('set-relation', { ...e.detail, item: this._list[index] })\n }}\n ></qxs-subject-single>`\n }\n if (item.answerType === SubjectType.BLANK_FILL) {\n return html`<qxs-blank-fill\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .exam-answer-setting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit} .is-set=${!!item.hasSet} .is-save=${!item.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this['show-add']}\n .show-answer-setting=${this['show-answer-setting']}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-blank-fill>`\n }\n if (item.answerType === SubjectType.TEXT_FILL) {\n return html`<qxs-text-fill\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .exam-answer-setting=${item.examAnswerSettingBO || item.examAnswerSettingVO || {}}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit} .is-set=${!!item.hasSet} .is-save=${!item.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this['show-add']}\n .show-answer-setting=${this['show-answer-setting']}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n exam-expand=${item.examExpand || ''}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-text-fill>`\n }\n if (item.answerType === SubjectType.SCALE) {\n return html`<qxs-scale\n .title=${item.title || ''}\n .answer-list=${item.answers || []}\n .scale-questions=${item.scaleQuestionList || []}\n .upload-image=${this['upload-image']}\n order-index=${common['order-index']}\n .is-edit=${!!item.isEdit} .is-set=${!!item.hasSet} .is-save=${!item.isRealCanDel} .show-action=${!this._isPreviewValue} .show-add=${this['show-add']}\n exam-answer-relation-type=${item.examAnswerRelationType ?? 0}\n rich-text-content=${item.examRichTextContent || ''}\n analysis=${item.analysis || ''}\n custom-id=${item.customId || ''}\n @move=${onMove} @delete=${onDelete} @save=${onSave} @edit=${onEdit} @add=${onAdd}\n ></qxs-scale>`\n }\n if (item.answerType === 'page_end') {\n return html`<qxs-page-end\n .current-page-index=${item.currentPageIndex || this._pageEndIndex(index)}\n .total-page=${item.totalPage || this._pageEndTotal()}\n .show-action=${!this._isPreviewValue}\n .show-add=${this['show-add']}\n custom-id=${item.customId || ''}\n @delete=${onDelete}\n @add=${onAdd}\n ></qxs-page-end>`\n }\n return html`<div style=\"color:#909399;padding:8px\">未知题型: ${item.answerType}</div>`\n }\n\n render() {\n return html`\n <div class=\"subject-list\">\n ${this._list.map((item, index) => this._renderItem(item, index))}\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["QxsSubjectList","LitElement","constructor","super","arguments","this","_modelValueAttr","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","_list","_sortMode","_sortable","_initialDataProcessed","JSON","stringify","v","parsed","parse","Array","isArray","_normalizeIncomingList","requestUpdate","_useModel","hasAttribute","attributeChangedCallback","name","oldVal","newVal","length","includes","_isPreviewValue","val","connectedCallback","then","_processAttributeList","attr","getAttribute","_normalizeAnswer","answer","title","String","answerId","examAnswerId","_normalizeItem","item","answerType","richTextContent","examTypeEnum","answers","map","customId","uid","_rebuildPageEndMarkers","items","some","Number","pageIndex","currentPageIndex","rebuilt","forEach","push","normalized","firstUpdated","updateComplete","_initSortable","updated","changed","has","destroy","setTimeout","disconnectedCallback","renderRoot","querySelector","requestAnimationFrame","currentEl","Sortable","create","handle","animation","ghostClass","chosenClass","onEnd","evt","oldIndex","newIndex","arr","splice","_emitListChange","_emit","detail","dispatchEvent","CustomEvent","bubbles","composed","_withPageIndex","serialized","pendingBoundary","toJSON","subjectEls","querySelectorAll","results","errors","el","data","err","SubjectError","message","validate","valid","errs","currentList","addSubject","type","index","examAnswerRelationType","undefined","pageEndItem","analysis","scaleQuestionList","isEdit","isSave","isRealCanDel","hasSet","isKey","answerCheckType","addExam","newItems","uploadExcel","list","setAnswerRelation","answerRelations","customAnswerId","find","ans","c","setTagList","tagList","tagInfos","memberTagInfo","_orderIndex","n","out","_move","dir","_save","i","_deleteByCustomId","filter","_delete","_setEdit","_pageEndTotal","_pageEndIndex","slice","_syncRelationAnswer","currentAnswer","answerIndex","findIndex","currentIndex","orderIndex","_renderItem","common","onMove","onDelete","onSave","onEdit","onAdd","SubjectType","SINGLE","MULTIPLE","SORT","html","examResourceBOList","resourceList","examRichTextContent","leastAnswerCount","examExpand","categoryId","category","aiAnswer","examId","value","BLANK_FILL","examAnswerSettingBO","examAnswerSettingVO","TEXT_FILL","SCALE","totalPage","render","styles","css","__decorateClass","property","attribute","prototype","Object","Boolean","state","safeCustomElement"],"mappings":"kpBAkBO,IAAMA,EAAN,cAA6BC,EAA7BC,WAAAA,GAAAC,SAAAC,WAyBkCC,KAAA,eAAe,EAGhBA,KAAA,aAA6B,KAqBnEA,KAAQC,gBAAkB,GAG1BD,KAAA,gBAAkDE,SACzC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAASC,GAAKL,EAAQK,EAAEC,QAAQC,QACvCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAI8Bd,KAAA,iBAAyB,GAC5BA,K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A,UAAA,GACMH,EAAA,CAAxDC,EAAS,CAAE/E,KAAMmF,QAASH,UAAW,mBAjE3B3M,EAiE8C4M,UAAA,gBAAA,GACJH,EAAA,CAApDC,EAAS,CAAE/E,KAAMmF,QAASH,UAAW,eAlE3B3M,EAkE0C4M,UAAA,YAAA,GACDH,EAAA,CAAnDC,EAAS,CAAE/E,KAAMmF,QAASH,UAAW,cAnE3B3M,EAmEyC4M,UAAA,WAAA,GACWH,EAAA,CAA9DC,EAAS,CAAE/E,KAAMmF,QAASH,UAAW,yBApE3B3M,EAoEoD4M,UAAA,sBAAA,GACXH,EAAA,CAAnDC,EAAS,CAAE/E,KAAMmF,QAASH,UAAW,cArE3B3M,EAqEyC4M,UAAA,WAAA,GACCH,EAAA,CAApDC,EAAS,CAAE/E,KAAMxE,OAAQwJ,UAAW,gBAtE1B3M,EAsE0C4M,UAAA,aAAA,GACIH,EAAA,CAAxDC,EAAS,CAAE/E,KAAMkF,OAAQF,UAAW,oBAvE1B3M,EAuE8C4M,UAAA,iBAAA,GAGrDH,EAAA,CADHC,EAAS,CAAE/E,KAAM9F,MAAO8K,UAAW,kBAzEzB3M,EA0EP4M,UAAA,eAAA,GA6CaH,EAAA,CAAhBM,KAvHU/M,EAuHM4M,UAAA,QAAA,GACAH,EAAA,CAAhBM,KAxHU/M,EAwHM4M,UAAA,YAAA,GAxHN5M,EAANyM,EAAA,CADNO,EAAkB,qBACNhN"}
@@ -1,16 +1,16 @@
1
- import{css as t,LitElement as e,html as s}from"lit";import{property as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{safeCustomElement as i}from"../base/define.mjs";var r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,d=(t,e,s,o)=>{for(var i,d=o>1?void 0:o?a(e,s):e,n=t.length-1;n>=0;n--)(i=t[n])&&(d=(o?i(e,s,d):i(d))||d);return o&&d&&r(e,s,d),d};let n=class extends e{constructor(){super(...arguments),this.currentPageIndex=1,this.totalPage=1,this.showAction=!0,this.showAdd=!0,this.customId=""}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}async toJSON(){const t={answerType:"page_end"};return this.customId&&(t.customId=this.customId),t}validate(){return[]}render(){return s`
1
+ import{css as t,LitElement as e,html as i}from"lit";import{property as s}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";var a=Object.defineProperty,r=Object.getOwnPropertyDescriptor,d=(t,e,i,s)=>{for(var o,d=s>1?void 0:s?r(e,i):e,n=t.length-1;n>=0;n--)(o=t[n])&&(d=(s?o(e,i,d):o(d))||d);return s&&d&&a(e,i,d),d};let n=class extends e{constructor(){super(...arguments),this["current-page-index"]=1,this["total-page"]=1,this["show-action"]=!0,this["show-add"]=!0,this["custom-id"]=""}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}async toJSON(){const t={answerType:"page_end"};return this["custom-id"]&&(t.customId=this["custom-id"]),t}validate(){return[]}render(){return i`
2
2
  <div class="container">
3
3
  <div class="divider">
4
4
  <div class="line"></div>
5
- <span class="label">第${this.currentPageIndex} / ${this.totalPage}页</span>
5
+ <span class="label">第${this["current-page-index"]} / ${this["total-page"]}页</span>
6
6
  <div class="line"></div>
7
7
  </div>
8
- ${this.showAction?s`
8
+ ${this["show-action"]?i`
9
9
  <qxs-subject-action
10
- .pageEnd=${!0}
11
- .showAdd=${this.showAdd}
12
- .showOtherOption=${!1}
13
- .showRichText=${!1}
10
+ .page-end=${!0}
11
+ .show-add=${this["show-add"]}
12
+ .show-other-option=${!1}
13
+ .show-rich-text=${!1}
14
14
  @delete=${()=>this._emit("delete")}
15
15
  @add=${t=>this._emit("add",t.detail)}
16
16
  ></qxs-subject-action>
@@ -22,5 +22,5 @@ import{css as t,LitElement as e,html as s}from"lit";import{property as o}from"..
22
22
  .divider { display: flex; align-items: center; padding: 12px 0; }
23
23
  .line { flex: 1; height: 1px; background-color: #e4e7ed; }
24
24
  .label { padding: 0 12px; font-size: 12px; color: #8c8c8c; }
25
- `,d([o({type:Number,attribute:"current-page-index"})],n.prototype,"currentPageIndex",2),d([o({type:Number,attribute:"total-page"})],n.prototype,"totalPage",2),d([o({type:Boolean,attribute:"show-action"})],n.prototype,"showAction",2),d([o({type:Boolean,attribute:"show-add"})],n.prototype,"showAdd",2),d([o({type:String,attribute:"custom-id"})],n.prototype,"customId",2),n=d([i("qxs-page-end")],n);export{n as QxsPageEnd};
25
+ `,d([s({type:Number,attribute:"current-page-index"})],n.prototype,"current-page-index",2),d([s({type:Number,attribute:"total-page"})],n.prototype,"total-page",2),d([s({type:Boolean,attribute:"show-action"})],n.prototype,"show-action",2),d([s({type:Boolean,attribute:"show-add"})],n.prototype,"show-add",2),d([s({type:String,attribute:"custom-id"})],n.prototype,"custom-id",2),n=d([o("qxs-page-end")],n);export{n as QxsPageEnd};
26
26
  //# sourceMappingURL=page-end.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"page-end.mjs","sources":["../../../../packages/components-wc/src/subject/page-end.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-page-end')\nexport class QxsPageEnd 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 .container { width: 100%; }\n .divider { display: flex; align-items: center; padding: 12px 0; }\n .line { flex: 1; height: 1px; background-color: #e4e7ed; }\n .label { padding: 0 12px; font-size: 12px; color: #8c8c8c; }\n `\n\n @property({ type: Number, attribute: 'current-page-index' }) currentPageIndex = 1\n @property({ type: Number, attribute: 'total-page' }) totalPage = 1\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-add' }) showAdd = true\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n async toJSON(): Promise<any> {\n const result: any = {\n answerType: 'page_end',\n }\n if (this.customId) {\n result.customId = this.customId\n }\n return result\n }\n\n validate() {\n return []\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"divider\">\n <div class=\"line\"></div>\n <span class=\"label\">第${this.currentPageIndex} / ${this.totalPage}页</span>\n <div class=\"line\"></div>\n </div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n .pageEnd=${true}\n .showAdd=${this.showAdd}\n .showOtherOption=${false}\n .showRichText=${false}\n @delete=${() => this._emit('delete')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n ></qxs-subject-action>\n `\n : ''}\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["QxsPageEnd","LitElement","constructor","super","arguments","this","currentPageIndex","totalPage","showAction","showAdd","customId","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","toJSON","result","answerType","validate","render","html","e","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","String","safeCustomElement"],"mappings":"mbAKO,IAAMA,EAAN,cAAyBC,EAAzBC,WAAAA,GAAAC,SAAAC,WASwDC,KAAAC,iBAAmB,EAC3BD,KAAAE,UAAY,EACVF,KAAAG,YAAa,EAChBH,KAAAI,SAAU,EACVJ,KAAAK,SAAW,EAAA,CAEvDC,KAAAA,CAAMC,EAAcC,GAC1BR,KAAKS,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,YAAMK,GACJ,MAAMC,EAAc,CAClBC,WAAY,YAKd,OAHIf,KAAKK,WACPS,EAAOT,SAAWL,KAAKK,UAElBS,CACT,CAEAE,QAAAA,GACE,MAAO,EACT,CAEAC,MAAAA,GACE,OAAOC,CAAA;;;;iCAIsBlB,KAAKC,sBAAsBD,KAAKE;;;UAGvDF,KAAKG,WACHe,CAAA;;wBAEW;uBACAlB,KAAKI;gCACG;6BACH;sBACN,IAAMJ,KAAKM,MAAM;mBACnBa,GAAmBnB,KAAKM,MAAM,MAAOa,EAAEX;;UAG/C;;KAGV,GAvDWb,EACJyB,OAASC,CAAA;;;;;;IAQ6CC,EAAA,CAA5DC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,wBAT1B/B,EASkDgC,UAAA,mBAAA,GACRL,EAAA,CAApDC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,gBAV1B/B,EAU0CgC,UAAA,YAAA,GACEL,EAAA,CAAtDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,iBAX3B/B,EAW4CgC,UAAA,aAAA,GACHL,EAAA,CAAnDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,cAZ3B/B,EAYyCgC,UAAA,UAAA,GACAL,EAAA,CAAnDC,EAAS,CAAEC,KAAMK,OAAQH,UAAW,eAb1B/B,EAayCgC,UAAA,WAAA,GAbzChC,EAAN2B,EAAA,CADNQ,EAAkB,iBACNnC"}
1
+ {"version":3,"file":"page-end.mjs","sources":["../../../../packages/components-wc/src/subject/page-end.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-page-end')\nexport class QxsPageEnd 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 .container { width: 100%; }\n .divider { display: flex; align-items: center; padding: 12px 0; }\n .line { flex: 1; height: 1px; background-color: #e4e7ed; }\n .label { padding: 0 12px; font-size: 12px; color: #8c8c8c; }\n `\n\n @property({ type: Number, attribute: 'current-page-index' }) 'current-page-index' = 1\n @property({ type: Number, attribute: 'total-page' }) 'total-page' = 1\n @property({ type: Boolean, attribute: 'show-action' }) 'show-action' = true\n @property({ type: Boolean, attribute: 'show-add' }) 'show-add' = true\n @property({ type: String, attribute: 'custom-id' }) 'custom-id' = ''\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n async toJSON(): Promise<any> {\n const result: any = {\n answerType: 'page_end',\n }\n if (this['custom-id']) {\n result.customId = this['custom-id']\n }\n return result\n }\n\n validate() {\n return []\n }\n\n render() {\n return html`\n <div class=\"container\">\n <div class=\"divider\">\n <div class=\"line\"></div>\n <span class=\"label\">第${this['current-page-index']} / ${this['total-page']}页</span>\n <div class=\"line\"></div>\n </div>\n ${this['show-action']\n ? html`\n <qxs-subject-action\n .page-end=${true}\n .show-add=${this['show-add']}\n .show-other-option=${false}\n .show-rich-text=${false}\n @delete=${() => this._emit('delete')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n ></qxs-subject-action>\n `\n : ''}\n </div>\n `\n }\n}\n\nexport function register() {\n // auto-registered via @safeCustomElement\n}\n"],"names":["QxsPageEnd","LitElement","constructor","super","arguments","this","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","toJSON","result","answerType","customId","validate","render","html","e","styles","css","__decorateClass","property","type","Number","attribute","prototype","Boolean","String","safeCustomElement"],"mappings":"wVAKO,IAAMA,EAAN,cAAyBC,EAAzBC,WAAAA,GAAAC,SAAAC,WASwDC,KAAA,sBAAuB,EAC/BA,KAAA,cAAe,EACbA,KAAA,gBAAgB,EACnBA,KAAA,aAAa,EACbA,KAAA,aAAc,EAAA,CAE1DC,KAAAA,CAAMC,EAAcC,GAC1BH,KAAKI,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,YAAMK,GACJ,MAAMC,EAAc,CAClBC,WAAY,YAKd,OAHIV,KAAK,eACPS,EAAOE,SAAWX,KAAK,cAElBS,CACT,CAEAG,QAAAA,GACE,MAAO,EACT,CAEAC,MAAAA,GACE,OAAOC,CAAA;;;;iCAIsBd,KAAK,2BAA2BA,KAAK;;;UAG5DA,KAAK,eACHc,CAAA;;yBAEY;wBACAd,KAAK;kCACI;+BACH;sBACR,IAAMA,KAAKC,MAAM;mBACnBc,GAAmBf,KAAKC,MAAM,MAAOc,EAAEZ;;UAG/C;;KAGV,GAvDWR,EACJqB,OAASC,CAAA;;;;;;IAQ6CC,EAAA,CAA5DC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,wBAT1B3B,EASkD4B,UAAA,qBAAA,GACRL,EAAA,CAApDC,EAAS,CAAEC,KAAMC,OAAQC,UAAW,gBAV1B3B,EAU0C4B,UAAA,aAAA,GACEL,EAAA,CAAtDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,iBAX3B3B,EAW4C4B,UAAA,cAAA,GACHL,EAAA,CAAnDC,EAAS,CAAEC,KAAMI,QAASF,UAAW,cAZ3B3B,EAYyC4B,UAAA,WAAA,GACAL,EAAA,CAAnDC,EAAS,CAAEC,KAAMK,OAAQH,UAAW,eAb1B3B,EAayC4B,UAAA,YAAA,GAbzC5B,EAANuB,EAAA,CADNQ,EAAkB,iBACN/B"}