@qxs-bns/components-wc 0.0.21 → 0.0.23

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 (163) hide show
  1. package/es/base/define.mjs +1 -1
  2. package/es/base/define.mjs.map +1 -1
  3. package/es/editor/blocksuite-editor.mjs +3 -3
  4. package/es/editor/blocksuite-editor.mjs.map +1 -1
  5. package/es/editor/index.mjs +1 -1
  6. package/es/editor/index.mjs.map +1 -1
  7. package/es/entry-editor.mjs +2 -0
  8. package/es/entry-editor.mjs.map +1 -0
  9. package/es/entry-subject.mjs +2 -0
  10. package/es/entry-subject.mjs.map +1 -0
  11. package/es/index.mjs +1 -1
  12. package/es/subject/action.mjs +5 -5
  13. package/es/subject/action.mjs.map +1 -1
  14. package/es/subject/blank-fill.mjs +8 -8
  15. package/es/subject/blank-fill.mjs.map +1 -1
  16. package/es/subject/layout.mjs +4 -4
  17. package/es/subject/layout.mjs.map +1 -1
  18. package/es/subject/list.mjs +77 -77
  19. package/es/subject/list.mjs.map +1 -1
  20. package/es/subject/page-end.mjs +7 -7
  21. package/es/subject/page-end.mjs.map +1 -1
  22. package/es/subject/scale.mjs +7 -7
  23. package/es/subject/scale.mjs.map +1 -1
  24. package/es/subject/single.mjs +11 -11
  25. package/es/subject/single.mjs.map +1 -1
  26. package/es/subject/text-fill.mjs +32 -32
  27. package/es/subject/text-fill.mjs.map +1 -1
  28. package/lib/base/define.cjs +1 -1
  29. package/lib/base/define.cjs.map +1 -1
  30. package/lib/editor/blocksuite-editor.cjs +2 -2
  31. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  32. package/lib/editor/index.cjs +1 -1
  33. package/lib/editor/index.cjs.map +1 -1
  34. package/lib/entry-editor.cjs +2 -0
  35. package/lib/entry-editor.cjs.map +1 -0
  36. package/lib/entry-subject.cjs +2 -0
  37. package/lib/entry-subject.cjs.map +1 -0
  38. package/lib/index.cjs +1 -1
  39. package/lib/subject/action.cjs +2 -2
  40. package/lib/subject/action.cjs.map +1 -1
  41. package/lib/subject/blank-fill.cjs +9 -9
  42. package/lib/subject/blank-fill.cjs.map +1 -1
  43. package/lib/subject/layout.cjs +4 -4
  44. package/lib/subject/layout.cjs.map +1 -1
  45. package/lib/subject/list.cjs +32 -32
  46. package/lib/subject/list.cjs.map +1 -1
  47. package/lib/subject/page-end.cjs +5 -5
  48. package/lib/subject/page-end.cjs.map +1 -1
  49. package/lib/subject/scale.cjs +10 -10
  50. package/lib/subject/scale.cjs.map +1 -1
  51. package/lib/subject/single.cjs +14 -14
  52. package/lib/subject/single.cjs.map +1 -1
  53. package/lib/subject/text-fill.cjs +40 -40
  54. package/lib/subject/text-fill.cjs.map +1 -1
  55. package/package.json +16 -1
  56. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.mjs +0 -7
  57. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.mjs.map +0 -1
  58. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs +0 -7
  59. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs.map +0 -1
  60. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs +0 -7
  61. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs.map +0 -1
  62. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.mjs +0 -7
  63. package/es/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.mjs.map +0 -1
  64. 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
  65. 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
  66. 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
  67. 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
  68. 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
  69. 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
  70. 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
  71. 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
  72. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.mjs +0 -7
  73. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.mjs.map +0 -1
  74. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.mjs +0 -7
  75. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.mjs.map +0 -1
  76. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs +0 -7
  77. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.mjs.map +0 -1
  78. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.mjs +0 -7
  79. package/es/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.mjs.map +0 -1
  80. package/es/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.mjs +0 -2
  81. package/es/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.mjs.map +0 -1
  82. package/es/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.mjs +0 -2
  83. package/es/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.mjs.map +0 -1
  84. package/es/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.mjs +0 -2
  85. package/es/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.mjs.map +0 -1
  86. package/es/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.mjs +0 -2
  87. package/es/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.mjs.map +0 -1
  88. package/es/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.mjs +0 -2
  89. package/es/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.mjs.map +0 -1
  90. package/es/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.mjs +0 -2
  91. package/es/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.mjs.map +0 -1
  92. package/es/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.mjs +0 -2
  93. package/es/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.mjs.map +0 -1
  94. package/es/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.mjs +0 -2
  95. package/es/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.mjs.map +0 -1
  96. package/es/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.mjs +0 -2
  97. package/es/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.mjs.map +0 -1
  98. package/es/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.mjs +0 -2
  99. package/es/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.mjs.map +0 -1
  100. package/es/subject/rich-text.mjs +0 -27
  101. package/es/subject/rich-text.mjs.map +0 -1
  102. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.cjs +0 -7
  103. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/css-tag.cjs.map +0 -1
  104. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs +0 -7
  105. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs.map +0 -1
  106. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs +0 -7
  107. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs.map +0 -1
  108. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.cjs +0 -7
  109. package/lib/node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/reactive-element.cjs.map +0 -1
  110. 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
  111. 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
  112. 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
  113. 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
  114. 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
  115. 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
  116. 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
  117. 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
  118. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.cjs +0 -7
  119. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive-helpers.cjs.map +0 -1
  120. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.cjs +0 -7
  121. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directive.cjs.map +0 -1
  122. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs +0 -8
  123. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs.map +0 -1
  124. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.cjs +0 -7
  125. package/lib/node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/lit-html.cjs.map +0 -1
  126. package/lib/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs +0 -2
  127. package/lib/node_modules/.pnpm/prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs.map +0 -1
  128. package/lib/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs +0 -2
  129. package/lib/node_modules/.pnpm/prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs.map +0 -1
  130. package/lib/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs +0 -2
  131. package/lib/node_modules/.pnpm/prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs.map +0 -1
  132. package/lib/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.cjs +0 -2
  133. package/lib/node_modules/.pnpm/prosemirror-keymap@1.2.3/node_modules/prosemirror-keymap/dist/index.cjs.map +0 -1
  134. package/lib/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.cjs +0 -2
  135. package/lib/node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.cjs.map +0 -1
  136. package/lib/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs +0 -2
  137. package/lib/node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs.map +0 -1
  138. package/lib/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.cjs +0 -2
  139. package/lib/node_modules/.pnpm/prosemirror-transform@1.11.0/node_modules/prosemirror-transform/dist/index.cjs.map +0 -1
  140. package/lib/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs +0 -2
  141. package/lib/node_modules/.pnpm/prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs.map +0 -1
  142. package/lib/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.cjs +0 -2
  143. package/lib/node_modules/.pnpm/rope-sequence@1.3.4/node_modules/rope-sequence/dist/index.cjs.map +0 -1
  144. package/lib/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.cjs +0 -2
  145. package/lib/node_modules/.pnpm/w3c-keyname@2.2.8/node_modules/w3c-keyname/index.cjs.map +0 -1
  146. package/lib/subject/rich-text.cjs +0 -27
  147. package/lib/subject/rich-text.cjs.map +0 -1
  148. package/types/base/define.d.ts +0 -1
  149. package/types/base/uid.d.ts +0 -1
  150. package/types/editor/blocksuite-editor.d.ts +0 -84
  151. package/types/editor/index.d.ts +0 -3
  152. package/types/index.d.ts +0 -4
  153. package/types/subject/action.d.ts +0 -23
  154. package/types/subject/blank-fill.d.ts +0 -49
  155. package/types/subject/index.d.ts +0 -20
  156. package/types/subject/layout.d.ts +0 -7
  157. package/types/subject/list.d.ts +0 -43
  158. package/types/subject/page-end.d.ts +0 -10
  159. package/types/subject/rich-text.d.ts +0 -30
  160. package/types/subject/scale.d.ts +0 -42
  161. package/types/subject/single.d.ts +0 -79
  162. package/types/subject/text-fill.d.ts +0 -54
  163. package/types/subject/type.d.ts +0 -7
@@ -1,98 +1,98 @@
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
2
- .title=${e.title||""}
3
- .answerList=${e.answers||[]}
4
- .tagList=${e.tagInfos||e.memberTagInfo||[]}
1
+ import{css as t,LitElement as e,html as s}from"lit";import{property as i,state as r}from"lit/decorators.js";import 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=(t,e,s,i)=>{for(var r,a=i>1?void 0:i?c(e,s):e,o=t.length-1;o>=0;o--)(r=t[o])&&(a=(i?r(e,s,a):r(a))||a);return i&&a&&d(e,s,a),a};h.SINGLE,h.MULTIPLE,h.SORT,h.BLANK_FILL,h.TEXT_FILL,h.SCALE;let u=class extends e{constructor(){super(...arguments),this.isPreview=!1,this.useModelAttr=null,this._modelValueAttr="",this.uploadImage=async t=>new Promise((e,s)=>{const i=new FileReader;i.onload=t=>e(t.target?.result),i.onerror=s,i.readAsDataURL(t)}),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(t){if(t&&t!==this._modelValueAttr){this._modelValueAttr=t;try{const e=JSON.parse(t);Array.isArray(e)&&(this._list=this._normalizeIncomingList(e),this.requestUpdate())}catch{}}}get _useModel(){return"true"===this.useModelAttr||""===this.useModelAttr||this.hasAttribute("use-model")}get subjectList(){return this._list}set subjectList(t){if(t){if("string"==typeof t)try{t=JSON.parse(t)}catch{return this._list=[],void this.requestUpdate()}if(!Array.isArray(t))return this._list=[],void this.requestUpdate();this._list=this._normalizeIncomingList(t),this.requestUpdate()}else this._list=[]}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),"subject-list"===t&&s&&!this._list.length){if(s.includes("[object Object]"))return;try{const t=JSON.parse(s);Array.isArray(t)&&(this._list=this._normalizeIncomingList(t),this.requestUpdate())}catch{}}}get _isPreviewValue(){const t=this.isPreview;return"string"==typeof t?"false"!==t:!!t}connectedCallback(){super.connectedCallback(),this._initialDataProcessed||(this._initialDataProcessed=!0,Promise.resolve().then(()=>{0===this._list.length&&this._processAttributeList()}))}_processAttributeList(){const t=this.getAttribute("subject-list");if(t&&"[]"!==t&&!t.includes("[object Object]"))try{const e=JSON.parse(t);Array.isArray(e)&&e.length>0&&(this._list=this._normalizeIncomingList(e),this.requestUpdate())}catch{}}_normalizeAnswer(t){return{...t,title:String(t?.title??t?.answer??""),answerId:t?.answerId??t?.examAnswerId}}_normalizeItem(t){const e=t?.answerType||(t?.richTextContent?t?.answerType:t?.examTypeEnum),s=Array.isArray(t?.answers)?t.answers.map(t=>this._normalizeAnswer(t)):[];return{...t,customId:t?.customId||n(),...e?{answerType:e}:{},...s.length||Array.isArray(t?.answers)?{answers:s}:{}}}_rebuildPageEndMarkers(t){if(!t.length)return t;if(t.some(t=>"page_end"===t?.answerType))return t;if(!t.some(t=>Number(t?.pageIndex)>1))return t;let e=1;const s=[];return t.forEach(t=>{const i=Number(t?.pageIndex)||1;if(i>e)if(s.length>0)for(;e<i;)s.push({customId:n(),answerType:"page_end"}),e++;else e=i;s.push(t)}),s}_normalizeIncomingList(t){const e=t.map(t=>this._normalizeItem(t));return this._rebuildPageEndMarkers(e)}firstUpdated(){this.updateComplete.then(()=>this._initSortable())}updated(t){t.has("_sortMode")&&(this._sortable?.destroy(),this._sortable=null,this.updateComplete.then(()=>this._initSortable())),t.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 t=this.renderRoot.querySelector(".sort-list");t&&!this._sortable&&(this._sortable=a.create(t,{handle:".sort-handle",animation:200,ghostClass:"sort-ghost",chosenClass:"sort-chosen",onEnd:t=>{const{oldIndex:e,newIndex:s}=t;if(void 0===e||void 0===s||e===s)return;const i=[...this._list],[r]=i.splice(e,1);i.splice(s,0,r),this._list=i,this._emitListChange()}}))}))}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_emitListChange(){this._emit("change",this._list),this._useModel&&(this._modelValueAttr=JSON.stringify(this._list),this._emit("list-change",this._list))}_withPageIndex(t){const e=[];let s=1,i=!1;return t.forEach(t=>{t&&("page_end"!==t.answerType?(i&&(s+=1,i=!1),e.push({...t,pageIndex:s})):e.length>0&&(i=!0))}),e}async toJSON(){const t=this.renderRoot.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end, qxs-subject-rich-text");if(!t||0===t.length)return[];const e=[],s=[];for(const i of t)if("function"==typeof i.toJSON)try{const t=await i.toJSON();e.push(t)}catch(t){t instanceof l?s.push(t):s.push(new l(t.message||"未知错误","UNKNOWN","unknown"))}if(s.length>0)throw s;return this._withPageIndex(e)}async validate(){const t=this.renderRoot.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-page-end");if(!t||0===t.length)return{valid:!0,errors:[]};const e=[];for(const s of t)if("function"==typeof s.validate){const t=s.validate();t?.length&&e.push(...t)}return{valid:0===e.length,errors:e}}get currentList(){return this._list}addSubject(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if("page_end"===t){const t={customId:n(),answerType:"page_end"},s=[...this._list];return"number"==typeof e&&e>=0?s.splice(e+1,0,t):s.push(t),this._list=s,this.requestUpdate(),void this._emitListChange()}const i={customId:n(),answerType:t,title:"",answers:[],analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,isKey:!1,answerCheckType:1,examAnswerRelationType:s??0},r=[...this._list];"number"==typeof e&&e>=0?r.splice(e+1,0,i):r.push(i),this._list=r,this.requestUpdate(),this._emitListChange()}addExam(t){const e=this._normalizeIncomingList(t).map(t=>({...t,isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1}));this._list=[...this._list,...e],this._emitListChange()}uploadExcel(t){this._list=[...this._list,...this._normalizeIncomingList(t).map(t=>({...t,isRealCanDel:!0}))],this._emitListChange()}setAnswerRelation(t,e,s){const i=this._list.find(t=>t.customId===e);if(i){const e=i.answers?.find(t=>t.customAnswerId===s);e&&(e.answerRelations=t)}this.requestUpdate(),this._emitListChange()}setTagList(t,e){const s=this._list.find(t=>t.customId===e);if(s)return s.tagInfos=Array.isArray(t)?t:[],s.memberTagInfo=Array.isArray(t)?t:[],this._list=[...this._list],void this._emitListChange();this.requestUpdate()}_orderIndex(t){let e=0,s=0;return this._list.forEach(i=>{e++,i.customId===t&&(s=e)}),s-1}_move(t,e){const s=[...this._list];"up"===e&&t>0?[s[t-1],s[t]]=[s[t],s[t-1]]:"down"===e&&t<s.length-1&&([s[t],s[t+1]]=[s[t+1],s[t]]),this._list=s,this._emitListChange()}_save(t,e){this._list=this._list.map((s,i)=>i===t?{...s,...e.detail,isEdit:!1,isSave:!0}:s),this._emitListChange()}_deleteByCustomId(t){this._list=this._list.filter(e=>e.customId!==t),this._emitListChange()}_delete(t){const e=[...this._list];e.splice(t,1),this._list=e,this._emitListChange()}_setEdit(t,e){this._list=this._list.map((s,i)=>i===t?{...s,isEdit:e}:s)}_pageEndTotal(){return this._list.filter(t=>"page_end"===t.answerType).length+1}_pageEndIndex(t){return this._list.slice(0,t+1).filter(t=>"page_end"===t.answerType).length}_syncRelationAnswer(t,e){const s=this._list[t];if(!s||!Array.isArray(s.answers)||!e?.answer)return;const i=[...s.answers],r=e.answer;let a="number"==typeof e.answerIndex?e.answerIndex:-1;(a<0||a>=i.length)&&(a=i.findIndex((t,e)=>String(t.customAnswerId||"")===String(r.customAnswerId||"")||String(t.answerId||"")===String(r.answerId||"")||String(t.orderIndex||e+1)===String(r.orderIndex||""))),a<0||(i[a]={...i[a],customAnswerId:r.customAnswerId||i[a].customAnswerId||r.answerId},this._list[t]={...s,answers:i},this._list=[...this._list])}_renderItem(t,e){const i=this._orderIndex(t.customId),r=(t.isEdit,t.hasSet,t.isRealCanDel,this._isPreviewValue,t.examAnswerRelationType,t=>this._move(e,t.detail)),a=()=>this._deleteByCustomId(t.customId),o=t=>this._save(e,t),n=()=>this._setEdit(e,!0),l=t=>this.addSubject(t.detail?.type??t.detail,e);return[h.SINGLE,h.MULTIPLE,h.SORT].includes(t.answerType)?s`<qxs-subject-single
2
+ .title=${t.title||""}
3
+ .answerList=${t.answers||[]}
4
+ .tagList=${t.tagInfos||t.memberTagInfo||[]}
5
5
  .categoryList=${this.categoryList}
6
- .resourceList=${e.examResourceBOList||e.resourceList||[]}
6
+ .resourceList=${t.examResourceBOList||t.resourceList||[]}
7
7
  .searchHandler=${this.searchHandler}
8
8
  .uploadImage=${this.uploadImage}
9
9
  order-index=${i}
10
- ?is-edit=${e.isEdit}
11
- ?is-set=${e.hasSet}
12
- ?is-save=${!e.isRealCanDel}
13
- ?show-action=${!this._isPreviewValue}
14
- ?show-add=${this.showAdd}
15
- ?show-answer-setting=${this.showAnswerSetting}
16
- ?show-key=${this.showKey}
17
- ?show-tag=${this.showTag}
18
- ?show-category=${this.showCategory}
19
- ?show-ai=${this.showAi}
20
- ?show-resource=${this.showResource}
21
- ?show-jump=${this.showJump}
22
- ?is-key=${e.isKey}
23
- question-type=${String(e.answerType)}
24
- answer-check-type=${e.answerCheckType??1}
25
- exam-answer-relation-type=${e.examAnswerRelationType??0}
26
- rich-text-content=${e.examRichTextContent||""}
27
- analysis=${e.analysis||""}
28
- .leastAnswerCount=${Number(e.leastAnswerCount)||0}
29
- exam-expand=${e.examExpand||""}
30
- category-id=${e.categoryId||e.category?.categoryId||""}
31
- ai-answer=${e.aiAnswer||""}
10
+ .isEdit=${!!t.isEdit}
11
+ .isSet=${!!t.hasSet}
12
+ .isSave=${!t.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=${!!t.isKey}
23
+ question-type=${String(t.answerType)}
24
+ answer-check-type=${t.answerCheckType??1}
25
+ exam-answer-relation-type=${t.examAnswerRelationType??0}
26
+ rich-text-content=${t.examRichTextContent||""}
27
+ analysis=${t.analysis||""}
28
+ .leastAnswerCount=${Number(t.leastAnswerCount)||0}
29
+ exam-expand=${t.examExpand||""}
30
+ category-id=${t.categoryId||t.category?.categoryId||""}
31
+ ai-answer=${t.aiAnswer||""}
32
32
  search-api=${this.searchApi}
33
- custom-id=${e.customId||""}
34
- exam-id=${e.examId??0}
33
+ custom-id=${t.customId||""}
34
+ exam-id=${t.examId??0}
35
35
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
36
- @set-key=${e=>{this._list[t].isKey=e.detail.value,this.requestUpdate()}}
37
- @title-select=${e=>this._emit("title-select",e.detail)}
38
- @choose-tag=${e=>this._emit("choose-tag",{...e.detail,item:this._list[t]})}
39
- @tag-change=${e=>{this._list[t].tagInfos=e.detail.value,this._list[t].memberTagInfo=e.detail.value,this.requestUpdate()}}
40
- @category-change=${e=>{this._list[t].categoryId=e.detail.value,this.requestUpdate()}}
41
- @jump=${e=>this._emit("jump",{...e.detail,item:this._list[t]})}
42
- @set-relation=${e=>{this._syncRelationAnswer(t,e.detail),this._emit("set-relation",{...e.detail,item:this._list[t]})}}
43
- ></qxs-subject-single>`:e.answerType===h.BLANK_FILL?s`<qxs-blank-fill
44
- .title=${e.title||""}
45
- .answerList=${e.answers||[]}
46
- .examAnswerSetting=${e.examAnswerSettingBO||e.examAnswerSettingVO||{}}
36
+ @set-key=${t=>{this._list[e].isKey=t.detail.value,this.requestUpdate()}}
37
+ @title-select=${t=>this._emit("title-select",t.detail)}
38
+ @choose-tag=${t=>this._emit("choose-tag",{...t.detail,item:this._list[e]})}
39
+ @tag-change=${t=>{this._list[e].tagInfos=t.detail.value,this._list[e].memberTagInfo=t.detail.value,this.requestUpdate()}}
40
+ @category-change=${t=>{this._list[e].categoryId=t.detail.value,this.requestUpdate()}}
41
+ @jump=${t=>this._emit("jump",{...t.detail,item:this._list[e]})}
42
+ @set-relation=${t=>{this._syncRelationAnswer(e,t.detail),this._emit("set-relation",{...t.detail,item:this._list[e]})}}
43
+ ></qxs-subject-single>`:t.answerType===h.BLANK_FILL?s`<qxs-blank-fill
44
+ .title=${t.title||""}
45
+ .answerList=${t.answers||[]}
46
+ .examAnswerSetting=${t.examAnswerSettingBO||t.examAnswerSettingVO||{}}
47
47
  .uploadImage=${this.uploadImage}
48
48
  order-index=${i}
49
- ?is-edit=${e.isEdit} ?is-set=${e.hasSet} ?is-save=${!e.isRealCanDel} ?show-action=${!this._isPreviewValue} ?show-add=${this.showAdd}
50
- ?show-answer-setting=${this.showAnswerSetting}
51
- exam-answer-relation-type=${e.examAnswerRelationType??0}
52
- exam-expand=${e.examExpand||""}
53
- rich-text-content=${e.examRichTextContent||""}
54
- analysis=${e.analysis||""}
55
- custom-id=${e.customId||""}
49
+ .isEdit=${!!t.isEdit} .isSet=${!!t.hasSet} .isSave=${!t.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}
50
+ .showAnswerSetting=${this.showAnswerSetting}
51
+ exam-answer-relation-type=${t.examAnswerRelationType??0}
52
+ exam-expand=${t.examExpand||""}
53
+ rich-text-content=${t.examRichTextContent||""}
54
+ analysis=${t.analysis||""}
55
+ custom-id=${t.customId||""}
56
56
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
57
- ></qxs-blank-fill>`:e.answerType===h.TEXT_FILL?s`<qxs-text-fill
58
- .title=${e.title||""}
59
- .answerList=${e.answers||[]}
60
- .examAnswerSetting=${e.examAnswerSettingBO||e.examAnswerSettingVO||{}}
57
+ ></qxs-blank-fill>`:t.answerType===h.TEXT_FILL?s`<qxs-text-fill
58
+ .title=${t.title||""}
59
+ .answerList=${t.answers||[]}
60
+ .examAnswerSetting=${t.examAnswerSettingBO||t.examAnswerSettingVO||{}}
61
61
  .uploadImage=${this.uploadImage}
62
62
  order-index=${i}
63
- ?is-edit=${e.isEdit} ?is-set=${e.hasSet} ?is-save=${!e.isRealCanDel} ?show-action=${!this._isPreviewValue} ?show-add=${this.showAdd}
64
- ?show-answer-setting=${this.showAnswerSetting}
65
- exam-answer-relation-type=${e.examAnswerRelationType??0}
66
- exam-expand=${e.examExpand||""}
67
- rich-text-content=${e.examRichTextContent||""}
68
- analysis=${e.analysis||""}
69
- custom-id=${e.customId||""}
63
+ .isEdit=${!!t.isEdit} .isSet=${!!t.hasSet} .isSave=${!t.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}
64
+ .showAnswerSetting=${this.showAnswerSetting}
65
+ exam-answer-relation-type=${t.examAnswerRelationType??0}
66
+ exam-expand=${t.examExpand||""}
67
+ rich-text-content=${t.examRichTextContent||""}
68
+ analysis=${t.analysis||""}
69
+ custom-id=${t.customId||""}
70
70
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
71
- ></qxs-text-fill>`:e.answerType===h.SCALE?s`<qxs-scale
72
- .title=${e.title||""}
73
- .answerList=${e.answers||[]}
74
- .scaleQuestions=${e.scaleQuestionList||[]}
71
+ ></qxs-text-fill>`:t.answerType===h.SCALE?s`<qxs-scale
72
+ .title=${t.title||""}
73
+ .answerList=${t.answers||[]}
74
+ .scaleQuestions=${t.scaleQuestionList||[]}
75
75
  .uploadImage=${this.uploadImage}
76
76
  order-index=${i}
77
- ?is-edit=${e.isEdit} ?is-set=${e.hasSet} ?is-save=${!e.isRealCanDel} ?show-action=${!this._isPreviewValue} ?show-add=${this.showAdd}
78
- exam-answer-relation-type=${e.examAnswerRelationType??0}
79
- rich-text-content=${e.examRichTextContent||""}
80
- analysis=${e.analysis||""}
81
- custom-id=${e.customId||""}
77
+ .isEdit=${!!t.isEdit} .isSet=${!!t.hasSet} .isSave=${!t.isRealCanDel} .showAction=${!this._isPreviewValue} .showAdd=${this.showAdd}
78
+ exam-answer-relation-type=${t.examAnswerRelationType??0}
79
+ rich-text-content=${t.examRichTextContent||""}
80
+ analysis=${t.analysis||""}
81
+ custom-id=${t.customId||""}
82
82
  @move=${r} @delete=${a} @save=${o} @edit=${n} @add=${l}
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
- ?show-action=${!this._isPreviewValue}
87
- ?show-add=${this.showAdd}
88
- custom-id=${e.customId||""}
83
+ ></qxs-scale>`:"page_end"===t.answerType?s`<qxs-page-end
84
+ current-page-index=${t.currentPageIndex||this._pageEndIndex(e)}
85
+ total-page=${t.totalPage||this._pageEndTotal()}
86
+ .showAction=${!this._isPreviewValue}
87
+ .showAdd=${this.showAdd}
88
+ custom-id=${t.customId||""}
89
89
  @delete=${a}
90
90
  @add=${l}
91
- ></qxs-page-end>`:s`<div style="color:#909399;padding:8px">未知题型: ${e.answerType}</div>`}render(){return s`
91
+ ></qxs-page-end>`:s`<div style="color:#909399;padding:8px">未知题型: ${t.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((t,e)=>this._renderItem(t,e))}
94
94
  </div>
95
- `}};m.styles=e`
95
+ `}};u.styles=t`
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,"isPreview",2),p([i({attribute:"use-model"})],u.prototype,"useModelAttr",2),p([i({attribute:"model-value"})],u.prototype,"modelValue",1),p([i({type:Object})],u.prototype,"uploadImage",2),p([i({type:Array,attribute:"category-list"})],u.prototype,"categoryList",2),p([i({type:Boolean,attribute:"show-tag"})],u.prototype,"showTag",2),p([i({type:Boolean,attribute:"show-category"})],u.prototype,"showCategory",2),p([i({type:Boolean,attribute:"show-ai"})],u.prototype,"showAi",2),p([i({type:Boolean,attribute:"show-resource"})],u.prototype,"showResource",2),p([i({type:Boolean,attribute:"show-jump"})],u.prototype,"showJump",2),p([i({type:Boolean,attribute:"show-add"})],u.prototype,"showAdd",2),p([i({type:Boolean,attribute:"show-answer-setting"})],u.prototype,"showAnswerSetting",2),p([i({type:Boolean,attribute:"show-key"})],u.prototype,"showKey",2),p([i({type:String,attribute:"search-api"})],u.prototype,"searchApi",2),p([i({type:Object})],u.prototype,"searchHandler",2),p([i({type:Array})],u.prototype,"subjectList",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 ?is-edit=${item.isEdit}\n ?is-set=${item.hasSet}\n ?is-save=${!item.isRealCanDel}\n ?show-action=${!this._isPreviewValue}\n ?show-add=${this.showAdd}\n ?show-answer-setting=${this.showAnswerSetting}\n ?show-key=${this.showKey}\n ?show-tag=${this.showTag}\n ?show-category=${this.showCategory}\n ?show-ai=${this.showAi}\n ?show-resource=${this.showResource}\n ?show-jump=${this.showJump}\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 .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 ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue} ?show-add=${this.showAdd}\n ?show-answer-setting=${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 ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue} ?show-add=${this.showAdd}\n ?show-answer-setting=${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 ?is-edit=${item.isEdit} ?is-set=${item.hasSet} ?is-save=${!item.isRealCanDel} ?show-action=${!this._isPreviewValue} ?show-add=${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 ?show-action=${!this._isPreviewValue}\n ?show-add=${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,UA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,UAAA,GACKH,EAAA,CAAxDC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,mBA/D3BrN,EA+D8CsN,UAAA,eAAA,GACNH,EAAA,CAAlDC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,aAhE3BrN,EAgEwCsN,UAAA,SAAA,GACMH,EAAA,CAAxDC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,mBAjE3BrN,EAiE8CsN,UAAA,eAAA,GACJH,EAAA,CAApDC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,eAlE3BrN,EAkE0CsN,UAAA,WAAA,GACDH,EAAA,CAAnDC,EAAS,CAAE1E,KAAM8E,QAASH,UAAW,cAnE3BrN,EAmEyCsN,UAAA,UAAA,GACWH,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\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 ${this._list.map((item, index) => this._renderItem(item, index))}\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","styles","css","__decorateClass","property","attribute","prototype","Object","Boolean","state","safeCustomElement"],"mappings":"kpBAkBGA,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,KA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AA,CAA9DC,EAAS,CAAEzE,KAAM6E,QAASH,UAAW,yBApE3BpN,EAoEoDqN,UAAA,oBAAA,GACXH,EAAA,CAAnDC,EAAS,CAAEzE,KAAM6E,QAASH,UAAW,cArE3BpN,EAqEyCqN,UAAA,UAAA,GACCH,EAAA,CAApDC,EAAS,CAAEzE,KAAMxE,OAAQkJ,UAAW,gBAtE1BpN,EAsE0CqN,UAAA,YAAA,GACzBH,EAAA,CAA3BC,EAAS,CAAEzE,KAAM4E,UAvEPtN,EAuEiBqN,UAAA,gBAAA,GAGxBH,EAAA,CADHC,EAAS,CAAEzE,KAAM/F,SAzEP3C,EA0EPqN,UAAA,cAAA,GA6CaH,EAAA,CAAhBM,KAvHUxN,EAuHMqN,UAAA,QAAA,GACAH,EAAA,CAAhBM,KAxHUxN,EAwHMqN,UAAA,YAAA,GAxHNrN,EAANkN,EAAA,CADNO,EAAkB,qBACNzN"}
@@ -1,16 +1,16 @@
1
- import{css as t,LitElement as e,html as o}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{safeCustomElement as i}from"../base/define.mjs";var r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,d=(t,e,o,s)=>{for(var i,d=s>1?void 0:s?a(e,o):e,n=t.length-1;n>=0;n--)(i=t[n])&&(d=(s?i(e,o,d):i(d))||d);return s&&d&&r(e,o,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 o`
1
+ import{css as t,LitElement as e,html as s}from"lit";import{property as i}from"lit/decorators.js";import{safeCustomElement as o}from"../base/define.mjs";var r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var o,d=i>1?void 0:i?a(e,s):e,n=t.length-1;n>=0;n--)(o=t[n])&&(d=(i?o(e,s,d):o(d))||d);return i&&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`
2
2
  <div class="container">
3
3
  <div class="divider">
4
4
  <div class="line"></div>
5
5
  <span class="label">第${this.currentPageIndex} / ${this.totalPage}页</span>
6
6
  <div class="line"></div>
7
7
  </div>
8
- ${this.showAction?o`
8
+ ${this.showAction?s`
9
9
  <qxs-subject-action
10
- page-end
11
- ?show-add=${this.showAdd}
12
- ?show-other-option=${!1}
13
- ?show-rich-text=${!1}
10
+ .pageEnd=${!0}
11
+ .showAdd=${this.showAdd}
12
+ .showOtherOption=${!1}
13
+ .showRichText=${!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 o}from"lit";import{property as s}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([s({type:Number,attribute:"current-page-index"})],n.prototype,"currentPageIndex",2),d([s({type:Number,attribute:"total-page"})],n.prototype,"totalPage",2),d([s({type:Boolean,attribute:"show-action"})],n.prototype,"showAction",2),d([s({type:Boolean,attribute:"show-add"})],n.prototype,"showAdd",2),d([s({type:String,attribute:"custom-id"})],n.prototype,"customId",2),n=d([i("qxs-page-end")],n);export{n as QxsPageEnd};
25
+ `,d([i({type:Number,attribute:"current-page-index"})],n.prototype,"currentPageIndex",2),d([i({type:Number,attribute:"total-page"})],n.prototype,"totalPage",2),d([i({type:Boolean,attribute:"show-action"})],n.prototype,"showAction",2),d([i({type:Boolean,attribute:"show-add"})],n.prototype,"showAdd",2),d([i({type:String,attribute:"custom-id"})],n.prototype,"customId",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 page-end\n ?show-add=${this.showAdd}\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","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;;;sBAGUlB,KAAKI;gCACI;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' }) 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":"wVAKO,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,4 +1,4 @@
1
- import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.mjs";import{state as o}from"../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.mjs";import{safeCustomElement as a}from"../base/define.mjs";import{SubjectError as r}from"./single.mjs";import{SubjectType as n}from"./types.mjs";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?d(e,i):e,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&l(e,i,a),a};const p=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,c=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;let x=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAdd=!0,this.showAnalysis=!0,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.modelValue="",this.useModel=!1,this.TITLE_MAX=200}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answerList")}get scaleQuestions(){return this._scaleQuestions}set scaleQuestions(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scaleQuestions")}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),!this.isEdit&&(t.has("title")||t.has("answerList")||t.has("analysis")||t.has("richTextContent")||t.has("scaleQuestions"))&&this._syncProps(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this._richText=this.richTextContent||"",this._showRichText=!!this.richTextContent}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",o=this.isEdit?this._answers:this.answerList||[],a=this.isEdit?this._analysis:this.analysis||"",l=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"",d=this.isEdit?this._showRichText:!!this.richTextContent,h=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void e(new r("题目标题不能为空!","EMPTY_TITLE","title",i));for(let t=0;t<o.length;t++)if(!o[t].title)return void e(new r(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",i));if(!l)return void e(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const p=l.split("\n").filter(t=>t.trim());if(0===p.length)return void e(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const c={answerType:n.SCALE,title:s,analysis:a,answers:o,scaleQuestionList:p,examRichTextContent:d?h:"",examAnswerRelationType:this.examAnswerRelationType};this.customId&&(c.customId=this.customId),t(c)})}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}validate(){const t=[],e={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title||"",s=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"";if(i||t.push(new r("题目标题不能为空!","EMPTY_TITLE","title",e)),s.forEach((i,s)=>{i.title||t.push(new r(`选项${String.fromCharCode(65+s)}未填写`,"ANSWER_EMPTY","answers",e))}),o){0===o.split("\n").filter(t=>t.trim()).length&&t.push(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e))}else t.push(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e));return t}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t`
1
+ import{html as t,css as e,LitElement as i}from"lit";import{property as s,state as o}from"lit/decorators.js";import{safeCustomElement as a}from"../base/define.mjs";import{SubjectError as r}from"./single.mjs";import{SubjectType as n}from"./types.mjs";var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,h=(t,e,i,s)=>{for(var o,a=s>1?void 0:s?d(e,i):e,r=t.length-1;r>=0;r--)(o=t[r])&&(a=(s?o(e,i,a):o(a))||a);return s&&a&&l(e,i,a),a};const p=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>`,c=t`<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="5" y1="12" x2="19" y2="12"/></svg>`;let x=class extends i{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.showAction=!0,this.showAdd=!0,this.showAnalysis=!0,this.analysis="",this.richTextContent="",this.examAnswerRelationType=0,this.uploadImage=async t=>new Promise((e,i)=>{const s=new FileReader;s.onload=t=>e(t.target?.result),s.onerror=i,s.readAsDataURL(t)}),this._answers=[{title:""},{title:""},{title:""},{title:""},{title:""}],this._scaleQuestions=["问题1"],this._rowTitle="",this._title="",this._analysis="",this._showRichText=!1,this._richText="",this.modelValue="",this.useModel=!1,this.TITLE_MAX=200}get answerList(){return this._answers}set answerList(t){const e=Array.isArray(t)?t:[];this._answers=e.length?e.slice(0,5):[{title:""},{title:""},{title:""},{title:""},{title:""}],this.requestUpdate("answerList")}get scaleQuestions(){return this._scaleQuestions}set scaleQuestions(t){this._scaleQuestions=Array.isArray(t)&&t.length?t:["问题1"],this.requestUpdate("scaleQuestions")}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),!this.isEdit&&(t.has("title")||t.has("answerList")||t.has("analysis")||t.has("richTextContent")||t.has("scaleQuestions"))&&this._syncProps(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue)}_syncProps(){this._title=this.title||"",this._analysis=this.analysis||"",this._rowTitle=this._scaleQuestions.join("\n"),this._richText=this.richTextContent||"",this._showRichText=!!this.richTextContent}async toJSON(){return new Promise((t,e)=>{const i={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title||"",o=this.isEdit?this._answers:this.answerList||[],a=this.isEdit?this._analysis:this.analysis||"",l=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"",d=this.isEdit?this._showRichText:!!this.richTextContent,h=this.isEdit?this._richText:this.richTextContent||"";if(!s)return void e(new r("题目标题不能为空!","EMPTY_TITLE","title",i));for(let t=0;t<o.length;t++)if(!o[t].title)return void e(new r(`选项${String.fromCharCode(65+t)}未填写。`,"ANSWER_EMPTY","answers",i));if(!l)return void e(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const p=l.split("\n").filter(t=>t.trim());if(0===p.length)return void e(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",i));const c={answerType:n.SCALE,title:s,analysis:a,answers:o,scaleQuestionList:p,examRichTextContent:d?h:"",examAnswerRelationType:this.examAnswerRelationType};this.customId&&(c.customId=this.customId),t(c)})}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_onTitleInput(t){const e=t.target;e.value.length>this.TITLE_MAX&&(e.value=e.value.slice(0,this.TITLE_MAX)),this._title=e.value,this.useModel&&this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:this._title}))}async _save(t){t?.stopImmediatePropagation();try{const t=await this.toJSON();this._emit("save",t)}catch(t){!function(t){const e=document.createElement("div");e.textContent=t,Object.assign(e.style,{position:"fixed",top:"20px",left:"50%",transform:"translateX(-50%)",padding:"10px 20px",borderRadius:"4px",fontSize:"13px",color:"#fff",background:"#f56c6c",zIndex:"99999",boxShadow:"0 4px 12px rgba(0,0,0,.15)",transition:"opacity .3s",opacity:"1"}),document.body.appendChild(e),setTimeout(()=>{e.style.opacity="0",setTimeout(()=>e.remove(),300)},2500)}(t.message)}}validate(){const t=[],e={customId:this.customId||void 0,answerType:"scale",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title||"",s=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._rowTitle:this.scaleQuestions?.join("\n")||"";if(i||t.push(new r("题目标题不能为空!","EMPTY_TITLE","title",e)),s.forEach((i,s)=>{i.title||t.push(new r(`选项${String.fromCharCode(65+s)}未填写`,"ANSWER_EMPTY","answers",e))}),o){0===o.split("\n").filter(t=>t.trim()).length&&t.push(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e))}else t.push(new r("行标题不能为空!","EMPTY_ROW_TITLE","rowTitle",e));return t}_renderPreview(){const e=Math.floor(100/(this._answers.length+1));return t`
2
2
  <div class="preview">
3
3
  <span class="title">${this.orderIndex+1}.${this.title}(量表题)</span>
4
4
  ${this.richTextContent?t`<div style="margin-top:8px" .innerHTML=${this.richTextContent}></div>`:""}
@@ -83,16 +83,16 @@ import{html as t,css as e,LitElement as i}from"lit";import{property as s}from"..
83
83
  </div>
84
84
  `:""}
85
85
  `}render(){return t`
86
- <qxs-subject-layout ?show-edit=${this.isEdit}>
86
+ <qxs-subject-layout .showEdit=${this.isEdit}>
87
87
  <div slot="preview">${this._renderPreview()}</div>
88
88
  <div slot="edit">${this._renderEdit()}</div>
89
89
  ${this.showAction?t`
90
90
  <qxs-subject-action
91
- ?is-edit=${this.isEdit}
92
- ?is-set=${this.isSet}
93
- ?show-add=${this.showAdd}
94
- ?show-rich-text=${this._showRichText}
95
- ?show-other-option=${!1}
91
+ .isEdit=${this.isEdit}
92
+ .isSet=${this.isSet}
93
+ .showAdd=${this.showAdd}
94
+ .showRichText=${this._showRichText}
95
+ .showOtherOption=${!1}
96
96
  exam-answer-relation-type=${this.examAnswerRelationType}
97
97
  @delete=${()=>this._emit("delete")}
98
98
  @save=${this._save}