@qxs-bns/components-wc 0.0.9 → 0.0.11

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 (47) hide show
  1. package/es/editor/blocksuite-editor.mjs +27 -18
  2. package/es/editor/blocksuite-editor.mjs.map +1 -1
  3. package/es/index.mjs +1 -1
  4. 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 +2 -0
  5. 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 +1 -0
  6. 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 +2 -0
  7. 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 +1 -0
  8. package/es/subject/action.mjs +3 -3
  9. package/es/subject/action.mjs.map +1 -1
  10. package/es/subject/blank-fill.mjs +5 -5
  11. package/es/subject/blank-fill.mjs.map +1 -1
  12. package/es/subject/layout.mjs +5 -5
  13. package/es/subject/layout.mjs.map +1 -1
  14. package/es/subject/list.mjs +14 -51
  15. package/es/subject/list.mjs.map +1 -1
  16. package/es/subject/scale.mjs +5 -5
  17. package/es/subject/scale.mjs.map +1 -1
  18. package/es/subject/single.mjs +6 -6
  19. package/es/subject/single.mjs.map +1 -1
  20. package/es/subject/text-fill.mjs +4 -4
  21. package/es/subject/text-fill.mjs.map +1 -1
  22. package/es/subject/types.mjs +2 -0
  23. package/es/subject/types.mjs.map +1 -0
  24. package/lib/editor/blocksuite-editor.cjs +17 -8
  25. package/lib/editor/blocksuite-editor.cjs.map +1 -1
  26. package/lib/index.cjs +1 -1
  27. 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 +2 -0
  28. 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 +1 -0
  29. 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 +2 -0
  30. 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 +1 -0
  31. package/lib/subject/action.cjs +1 -1
  32. package/lib/subject/action.cjs.map +1 -1
  33. package/lib/subject/blank-fill.cjs +4 -4
  34. package/lib/subject/blank-fill.cjs.map +1 -1
  35. package/lib/subject/layout.cjs +3 -3
  36. package/lib/subject/layout.cjs.map +1 -1
  37. package/lib/subject/list.cjs +13 -50
  38. package/lib/subject/list.cjs.map +1 -1
  39. package/lib/subject/scale.cjs +4 -4
  40. package/lib/subject/scale.cjs.map +1 -1
  41. package/lib/subject/single.cjs +5 -5
  42. package/lib/subject/single.cjs.map +1 -1
  43. package/lib/subject/text-fill.cjs +3 -3
  44. package/lib/subject/text-fill.cjs.map +1 -1
  45. package/lib/subject/types.cjs +2 -0
  46. package/lib/subject/types.cjs.map +1 -0
  47. package/package.json +6 -6
@@ -0,0 +1,2 @@
1
+ "use strict";var e=require("@tiptap/core"),t=require("../../../../../prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.cjs"),o=require("../../../../../prosemirror-dropcursor@1.8.2/node_modules/prosemirror-dropcursor/dist/index.cjs"),r=require("../../../../../prosemirror-view@1.41.7/node_modules/prosemirror-view/dist/index.cjs"),n=require("../../../../../prosemirror-gapcursor@1.4.1/node_modules/prosemirror-gapcursor/dist/index.cjs"),s=require("../../../../../prosemirror-history@1.5.0/node_modules/prosemirror-history/dist/index.cjs");e.Extension.create({name:"characterCount",addOptions:()=>({limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,o=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(o)}},addProseMirrorPlugins(){let e=!1;return[new t.Plugin({key:new t.PluginKey("characterCount"),appendTransaction:(t,o,r)=>{if(e)return;const n=this.options.limit;if(null==n||0===n)return void(e=!0);const s=this.storage.characters({node:r.doc});if(s>n){const t=0,o=s-n,i=r.tr.deleteRange(t,o);return e=!0,i}e=!0},filterTransaction:(e,t)=>{const o=this.options.limit;if(!e.docChanged||0===o||null==o)return!0;const r=this.storage.characters({node:t.doc}),n=this.storage.characters({node:e.doc});if(n<=o)return!0;if(r>o&&n>o&&n<=r)return!0;if(r>o&&n>o&&n>r)return!1;if(!e.getMeta("paste"))return!1;const s=e.selection.$head.pos,i=s-(n-o),d=s;e.deleteRange(i,d);return!(this.storage.characters({node:e.doc})>o)}})]}}),e.Extension.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[o.dropCursor(this.options)]}}),e.Extension.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new t.Plugin({key:new t.PluginKey("focus"),props:{decorations:e=>{let{doc:t,selection:o}=e;const{isEditable:n,isFocused:s}=this.editor,{anchor:i}=o,d=[];if(!n||!s)return r.DecorationSet.create(t,[]);let a=0;"deepest"===this.options.mode&&t.descendants((e,t)=>{if(e.isText)return;if(!(i>=t&&i<=t+e.nodeSize-1))return!1;a+=1});let c=0;return t.descendants((e,t)=>{if(e.isText)return!1;if(!(i>=t&&i<=t+e.nodeSize-1))return!1;c+=1;if("deepest"===this.options.mode&&a-c>0||"shallowest"===this.options.mode&&c>1)return"deepest"===this.options.mode;d.push(r.Decoration.node(t,t+e.nodeSize,{class:this.options.className}))}),r.DecorationSet.create(t,d)}}})]}}),e.Extension.create({name:"gapCursor",addProseMirrorPlugins:()=>[n.gapCursor()],extendNodeSchema(t){var o;const r={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:null!=(o=e.callOrReturn(e.getExtensionField(t,"allowGapCursor",r)))?o:null}}});var i="placeholder";function d(e){return e.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var a=e.Extension.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:i,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){const o=this.options.dataAttribute?`data-${d(this.options.dataAttribute)}`:`data-${i}`;return[new t.Plugin({key:new t.PluginKey("placeholder"),props:{decorations:t=>{let{doc:n,selection:s}=t;const i=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:d}=s,a=[];if(!i)return null;const c=this.editor.isEmpty;return n.descendants((t,n)=>{const s=d>=n&&d<=n+t.nodeSize,i=!t.isLeaf&&e.isNodeEmpty(t);if((s||!this.options.showOnlyCurrent)&&i){const e=[this.options.emptyNodeClass];c&&e.push(this.options.emptyEditorClass);const i=r.Decoration.node(n,n+t.nodeSize,{class:e.join(" "),[o]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:s}):this.options.placeholder});a.push(i)}return this.options.includeChildren}),r.DecorationSet.create(n,a)}}})]}});function c(e){let{types:t,node:o}=e;return o&&Array.isArray(t)&&t.includes(o.type)||(null==o?void 0:o.type)===t}e.Extension.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){const{editor:o,options:n}=this;return[new t.Plugin({key:new t.PluginKey("selection"),props:{decorations:t=>t.selection.empty||o.isFocused||!o.isEditable||e.isNodeSelection(t.selection)||o.view.dragging?null:r.DecorationSet.create(t.doc,[r.Decoration.inline(t.selection.from,t.selection.to,{class:n.className})])}})]}}),e.Extension.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;const o=new t.PluginKey(this.name),r=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",n=Object.entries(this.editor.schema.nodes).map(e=>{let[,t]=e;return t}).filter(e=>(this.options.notAfter||[]).concat(r).includes(e.name));return[new t.Plugin({key:o,appendTransaction:(e,t,n)=>{const{doc:s,tr:i,schema:d}=n,a=o.getState(n),c=s.content.size,l=d.nodes[r];if(a)return i.insert(c,l.create())},state:{init:(e,t)=>!c({node:t.tr.doc.lastChild,types:n}),apply:(e,t)=>{if(!e.docChanged)return t;if(e.getMeta("__uniqueIDTransaction"))return t;return!c({node:e.doc.lastChild,types:n})}}})]}}),e.Extension.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>e=>{let{state:t,dispatch:o}=e;return s.undo(t,o)},redo:()=>e=>{let{state:t,dispatch:o}=e;return s.redo(t,o)}}),addProseMirrorPlugins(){return[s.history(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),exports.Placeholder=a,exports.preparePlaceholderAttribute=d;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../../../../../../../../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.js"],"sourcesContent":["// src/character-count/character-count.ts\nimport { Extension } from \"@tiptap/core\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nvar CharacterCount = Extension.create({\n name: \"characterCount\",\n addOptions() {\n return {\n limit: null,\n mode: \"textSize\",\n textCounter: (text) => text.length,\n wordCounter: (text) => text.split(\" \").filter((word) => word !== \"\").length\n };\n },\n addStorage() {\n return {\n characters: () => 0,\n words: () => 0\n };\n },\n onBeforeCreate() {\n this.storage.characters = (options) => {\n const node = (options == null ? void 0 : options.node) || this.editor.state.doc;\n const mode = (options == null ? void 0 : options.mode) || this.options.mode;\n if (mode === \"textSize\") {\n const text = node.textBetween(0, node.content.size, void 0, \" \");\n return this.options.textCounter(text);\n }\n return node.nodeSize;\n };\n this.storage.words = (options) => {\n const node = (options == null ? void 0 : options.node) || this.editor.state.doc;\n const text = node.textBetween(0, node.content.size, \" \", \" \");\n return this.options.wordCounter(text);\n };\n },\n addProseMirrorPlugins() {\n let initialEvaluationDone = false;\n return [\n new Plugin({\n key: new PluginKey(\"characterCount\"),\n appendTransaction: (transactions, oldState, newState) => {\n if (initialEvaluationDone) {\n return;\n }\n const limit = this.options.limit;\n if (limit === null || limit === void 0 || limit === 0) {\n initialEvaluationDone = true;\n return;\n }\n const initialContentSize = this.storage.characters({ node: newState.doc });\n if (initialContentSize > limit) {\n const over = initialContentSize - limit;\n const from = 0;\n const to = over;\n console.warn(\n `[CharacterCount] Initial content exceeded limit of ${limit} characters. Content was automatically trimmed.`\n );\n const tr = newState.tr.deleteRange(from, to);\n initialEvaluationDone = true;\n return tr;\n }\n initialEvaluationDone = true;\n },\n filterTransaction: (transaction, state) => {\n const limit = this.options.limit;\n if (!transaction.docChanged || limit === 0 || limit === null || limit === void 0) {\n return true;\n }\n const oldSize = this.storage.characters({ node: state.doc });\n const newSize = this.storage.characters({ node: transaction.doc });\n if (newSize <= limit) {\n return true;\n }\n if (oldSize > limit && newSize > limit && newSize <= oldSize) {\n return true;\n }\n if (oldSize > limit && newSize > limit && newSize > oldSize) {\n return false;\n }\n const isPaste = transaction.getMeta(\"paste\");\n if (!isPaste) {\n return false;\n }\n const pos = transaction.selection.$head.pos;\n const over = newSize - limit;\n const from = pos - over;\n const to = pos;\n transaction.deleteRange(from, to);\n const updatedSize = this.storage.characters({ node: transaction.doc });\n if (updatedSize > limit) {\n return false;\n }\n return true;\n }\n })\n ];\n }\n});\n\n// src/drop-cursor/drop-cursor.ts\nimport { Extension as Extension2 } from \"@tiptap/core\";\nimport { dropCursor } from \"@tiptap/pm/dropcursor\";\nvar Dropcursor = Extension2.create({\n name: \"dropCursor\",\n addOptions() {\n return {\n color: \"currentColor\",\n width: 1,\n class: void 0\n };\n },\n addProseMirrorPlugins() {\n return [dropCursor(this.options)];\n }\n});\n\n// src/focus/focus.ts\nimport { Extension as Extension3 } from \"@tiptap/core\";\nimport { Plugin as Plugin2, PluginKey as PluginKey2 } from \"@tiptap/pm/state\";\nimport { Decoration, DecorationSet } from \"@tiptap/pm/view\";\nvar Focus = Extension3.create({\n name: \"focus\",\n addOptions() {\n return {\n className: \"has-focus\",\n mode: \"all\"\n };\n },\n addProseMirrorPlugins() {\n return [\n new Plugin2({\n key: new PluginKey2(\"focus\"),\n props: {\n decorations: ({ doc, selection }) => {\n const { isEditable, isFocused } = this.editor;\n const { anchor } = selection;\n const decorations = [];\n if (!isEditable || !isFocused) {\n return DecorationSet.create(doc, []);\n }\n let maxLevels = 0;\n if (this.options.mode === \"deepest\") {\n doc.descendants((node, pos) => {\n if (node.isText) {\n return;\n }\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1;\n if (!isCurrent) {\n return false;\n }\n maxLevels += 1;\n });\n }\n let currentLevel = 0;\n doc.descendants((node, pos) => {\n if (node.isText) {\n return false;\n }\n const isCurrent = anchor >= pos && anchor <= pos + node.nodeSize - 1;\n if (!isCurrent) {\n return false;\n }\n currentLevel += 1;\n const outOfScope = this.options.mode === \"deepest\" && maxLevels - currentLevel > 0 || this.options.mode === \"shallowest\" && currentLevel > 1;\n if (outOfScope) {\n return this.options.mode === \"deepest\";\n }\n decorations.push(\n Decoration.node(pos, pos + node.nodeSize, {\n class: this.options.className\n })\n );\n });\n return DecorationSet.create(doc, decorations);\n }\n }\n })\n ];\n }\n});\n\n// src/gap-cursor/gap-cursor.ts\nimport { callOrReturn, Extension as Extension4, getExtensionField } from \"@tiptap/core\";\nimport { gapCursor } from \"@tiptap/pm/gapcursor\";\nvar Gapcursor = Extension4.create({\n name: \"gapCursor\",\n addProseMirrorPlugins() {\n return [gapCursor()];\n },\n extendNodeSchema(extension) {\n var _a;\n const context = {\n name: extension.name,\n options: extension.options,\n storage: extension.storage\n };\n return {\n allowGapCursor: (_a = callOrReturn(getExtensionField(extension, \"allowGapCursor\", context))) != null ? _a : null\n };\n }\n});\n\n// src/placeholder/placeholder.ts\nimport { Extension as Extension5, isNodeEmpty } from \"@tiptap/core\";\nimport { Plugin as Plugin3, PluginKey as PluginKey3 } from \"@tiptap/pm/state\";\nimport { Decoration as Decoration2, DecorationSet as DecorationSet2 } from \"@tiptap/pm/view\";\nvar DEFAULT_DATA_ATTRIBUTE = \"placeholder\";\nfunction preparePlaceholderAttribute(attr) {\n return attr.replace(/\\s+/g, \"-\").replace(/[^a-zA-Z0-9-]/g, \"\").replace(/^[0-9-]+/, \"\").replace(/^-+/, \"\").toLowerCase();\n}\nvar Placeholder = Extension5.create({\n name: \"placeholder\",\n addOptions() {\n return {\n emptyEditorClass: \"is-editor-empty\",\n emptyNodeClass: \"is-empty\",\n dataAttribute: DEFAULT_DATA_ATTRIBUTE,\n placeholder: \"Write something \\u2026\",\n showOnlyWhenEditable: true,\n showOnlyCurrent: true,\n includeChildren: false\n };\n },\n addProseMirrorPlugins() {\n const dataAttribute = this.options.dataAttribute ? `data-${preparePlaceholderAttribute(this.options.dataAttribute)}` : `data-${DEFAULT_DATA_ATTRIBUTE}`;\n return [\n new Plugin3({\n key: new PluginKey3(\"placeholder\"),\n props: {\n decorations: ({ doc, selection }) => {\n const active = this.editor.isEditable || !this.options.showOnlyWhenEditable;\n const { anchor } = selection;\n const decorations = [];\n if (!active) {\n return null;\n }\n const isEmptyDoc = this.editor.isEmpty;\n doc.descendants((node, pos) => {\n const hasAnchor = anchor >= pos && anchor <= pos + node.nodeSize;\n const isEmpty = !node.isLeaf && isNodeEmpty(node);\n if ((hasAnchor || !this.options.showOnlyCurrent) && isEmpty) {\n const classes = [this.options.emptyNodeClass];\n if (isEmptyDoc) {\n classes.push(this.options.emptyEditorClass);\n }\n const decoration = Decoration2.node(pos, pos + node.nodeSize, {\n class: classes.join(\" \"),\n [dataAttribute]: typeof this.options.placeholder === \"function\" ? this.options.placeholder({\n editor: this.editor,\n node,\n pos,\n hasAnchor\n }) : this.options.placeholder\n });\n decorations.push(decoration);\n }\n return this.options.includeChildren;\n });\n return DecorationSet2.create(doc, decorations);\n }\n }\n })\n ];\n }\n});\n\n// src/selection/selection.ts\nimport { Extension as Extension6, isNodeSelection } from \"@tiptap/core\";\nimport { Plugin as Plugin4, PluginKey as PluginKey4 } from \"@tiptap/pm/state\";\nimport { Decoration as Decoration3, DecorationSet as DecorationSet3 } from \"@tiptap/pm/view\";\nvar Selection = Extension6.create({\n name: \"selection\",\n addOptions() {\n return {\n className: \"selection\"\n };\n },\n addProseMirrorPlugins() {\n const { editor, options } = this;\n return [\n new Plugin4({\n key: new PluginKey4(\"selection\"),\n props: {\n decorations(state) {\n if (state.selection.empty || editor.isFocused || !editor.isEditable || isNodeSelection(state.selection) || editor.view.dragging) {\n return null;\n }\n return DecorationSet3.create(state.doc, [\n Decoration3.inline(state.selection.from, state.selection.to, {\n class: options.className\n })\n ]);\n }\n }\n })\n ];\n }\n});\n\n// src/trailing-node/trailing-node.ts\nimport { Extension as Extension7 } from \"@tiptap/core\";\nimport { Plugin as Plugin5, PluginKey as PluginKey5 } from \"@tiptap/pm/state\";\nfunction nodeEqualsType({ types, node }) {\n return node && Array.isArray(types) && types.includes(node.type) || (node == null ? void 0 : node.type) === types;\n}\nvar TrailingNode = Extension7.create({\n name: \"trailingNode\",\n addOptions() {\n return {\n node: void 0,\n notAfter: []\n };\n },\n addProseMirrorPlugins() {\n var _a;\n const plugin = new PluginKey5(this.name);\n const defaultNode = this.options.node || ((_a = this.editor.schema.topNodeType.contentMatch.defaultType) == null ? void 0 : _a.name) || \"paragraph\";\n const disabledNodes = Object.entries(this.editor.schema.nodes).map(([, value]) => value).filter((node) => (this.options.notAfter || []).concat(defaultNode).includes(node.name));\n return [\n new Plugin5({\n key: plugin,\n appendTransaction: (_, __, state) => {\n const { doc, tr, schema } = state;\n const shouldInsertNodeAtEnd = plugin.getState(state);\n const endPosition = doc.content.size;\n const type = schema.nodes[defaultNode];\n if (!shouldInsertNodeAtEnd) {\n return;\n }\n return tr.insert(endPosition, type.create());\n },\n state: {\n init: (_, state) => {\n const lastNode = state.tr.doc.lastChild;\n return !nodeEqualsType({ node: lastNode, types: disabledNodes });\n },\n apply: (tr, value) => {\n if (!tr.docChanged) {\n return value;\n }\n if (tr.getMeta(\"__uniqueIDTransaction\")) {\n return value;\n }\n const lastNode = tr.doc.lastChild;\n return !nodeEqualsType({ node: lastNode, types: disabledNodes });\n }\n }\n })\n ];\n }\n});\n\n// src/undo-redo/undo-redo.ts\nimport { Extension as Extension8 } from \"@tiptap/core\";\nimport { history, redo, undo } from \"@tiptap/pm/history\";\nvar UndoRedo = Extension8.create({\n name: \"undoRedo\",\n addOptions() {\n return {\n depth: 100,\n newGroupDelay: 500\n };\n },\n addCommands() {\n return {\n undo: () => ({ state, dispatch }) => {\n return undo(state, dispatch);\n },\n redo: () => ({ state, dispatch }) => {\n return redo(state, dispatch);\n }\n };\n },\n addProseMirrorPlugins() {\n return [history(this.options)];\n },\n addKeyboardShortcuts() {\n return {\n \"Mod-z\": () => this.editor.commands.undo(),\n \"Shift-Mod-z\": () => this.editor.commands.redo(),\n \"Mod-y\": () => this.editor.commands.redo(),\n // Russian keyboard layouts\n \"Mod-\\u044F\": () => this.editor.commands.undo(),\n \"Shift-Mod-\\u044F\": () => this.editor.commands.redo()\n };\n }\n});\nexport {\n CharacterCount,\n Dropcursor,\n Focus,\n Gapcursor,\n Placeholder,\n Selection,\n TrailingNode,\n UndoRedo,\n preparePlaceholderAttribute\n};\n//# sourceMappingURL=index.js.map"],"names":["Extension","create","name","addOptions","limit","mode","textCounter","text","length","wordCounter","split","filter","word","addStorage","characters","words","onBeforeCreate","this","storage","options","node","editor","state","doc","textBetween","content","size","nodeSize","addProseMirrorPlugins","initialEvaluationDone","Plugin","key","PluginKey","appendTransaction","transactions","oldState","newState","initialContentSize","from","to","tr","deleteRange","filterTransaction","transaction","docChanged","oldSize","newSize","getMeta","pos","selection","$head"],"mappings":"0iBA2D8BA,EAAAA,UAAUC,OAAqD,CAC3FC,KAAM,iBAENC,WAAAA,KACS,CACLC,MAAO,KACPC,KAAM,WACNC,YAAaC,GAAQA,EAAKC,OAC1BC,YAAaF,GAAQA,EAAKG,MAAM,KAAKC,OAAOC,GAAiB,KAATA,GAAaJ,SAIrEK,WAAAA,KACS,CACLC,WAAYA,IAAM,EAClBC,MAAOA,IAAM,IAIjBC,cAAAA,GACEC,KAAKC,QAAQJ,WAAaK,IACxB,MAAMC,GAAO,MAAAD,OAAA,EAAAA,EAASC,OAAQH,KAAKI,OAAOC,MAAMC,IAGhD,GAAa,eAFA,MAAAJ,OAAA,EAAAA,EAASd,OAAQY,KAAKE,QAAQd,MAElB,CACvB,MAAME,EAAOa,EAAKI,YAAY,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T,IAHgBF,EAAYI,QAAQ,SAIlC,OAAO,EAIT,MAAMC,EAAML,EAAYM,UAAUC,MAAMF,IAElCV,EAAOU,GADAF,EAAU1C,GAEjBmC,EAAKS,EAIXL,EAAYF,YAAYH,EAAMC,GAQ9B,QAFoBtB,KAAKC,QAAQJ,WAAW,CAAEM,KAAMuB,EAAYpB,MAE9CnB,MAQ1B","x_google_ignoreList":[0]}
@@ -63,7 +63,7 @@
63
63
  *, ::before, ::after { box-sizing: border-box; }
64
64
 
65
65
  .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
66
- .action.active { }
66
+ .action.active { background: transparent; }
67
67
  .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
68
68
  .right { display: flex; align-items: center; gap: 4px; }
69
69
 
@@ -1 +1 @@
1
- {"version":3,"file":"action.cjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst iconEdit = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>`\nconst iconDelete = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>`\nconst iconCheck = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg>`\nconst iconSort = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z\"/></svg>`\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n <button class=\"text-btn text-btn--danger\" @click=${() => this._emit('delete')}>删除</button>\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>&#x2715;</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","tagName","html","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"+cAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAZrB,IAA2BC,EAeVC,EAAAA,IAAA,uUACEA,EAAAA,IAAA,yTACDA,EAAAA,IAAA,iOACDA,EAAAA,IAAA,wKAGJC,QAAAA,iBAAN,cAA+BC,EAAAA,WAA/BC,WAAAA,GAAAC,SAAAC,WA2D8CC,KAAAC,QAAS,EACVD,KAAAE,OAAQ,EACRF,KAAAG,OAAQ,EACEH,KAAAI,gBAAkB,EACjBJ,KAAAK,iBAAkB,EACrBL,KAAAM,cAAe,EACXN,KAAAO,iBAAkB,EAC5BP,KAAAQ,SAAU,EACMR,KAAAS,uBAAyB,EAEpFT,KAAQU,YAAa,EACrBV,KAAQW,kBAAoB,CAAA,CAErCC,OAAAA,CAAQC,GACFA,EAAQC,IAAI,qBACdd,KAAKW,kBAAoBX,KAAKI,gBAElC,CAEQW,KAAAA,CAAMC,EAAcC,GAC1BjB,KAAKkB,cAAc,IAAIC,YAAYH,EAAM,CAAEI,SAAS,EAAMC,UAAU,EAAMJ,OAAQA,GAAU,OAC9F,CAEA,eAAYK,GACV,OAAOhC,EAAeiC,KAAKC,GAAKA,EAAEjC,QAAUS,KAAKI,kBAAkBZ,OAAS,EAC9E,CAEQiC,eAAAA,GACN,OAAO/B,EAAAA,IAAA;;UAEAM,KAAKO,gBAIJ,GAHAb,EAAAA,IAAA;0CAC8B,IAAMM,KAAKe,MAAM;;UAGjDf,KAAKK,gBACHX,EAAAA,IAAA;0CAC8B,KAAQM,KAAKU,YAAa;;8CAEtBV,KAA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,EAAA,CAAjDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,YA5D3B/C,QAAAA,iBA4DuCgD,UAAA,QAAA,GACAL,EAAA,CAAjDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,YA7D3B/C,QAAAA,iBA6DuCgD,UAAA,QAAA,GACUL,EAAA,CAA3DC,EAAAA,SAAS,CAAEC,KAAMI,OAAQF,UAAW,uBA9D1B/C,QAAAA,iBA8DiDgD,UAAA,kBAAA,GACCL,EAAA,CAA5DC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,uBA/D3B/C,QAAAA,iBA+DkDgD,UAAA,kBAAA,GACHL,EAAA,CAAzDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,oBAhE3B/C,QAAAA,iBAgE+CgD,UAAA,eAAA,GACIL,EAAA,CAA7DC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,wBAjE3B/C,QAAAA,iBAiEmDgD,UAAA,kBAAA,GACVL,EAAA,CAAnDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,cAlE3B/C,QAAAA,iBAkEyCgD,UAAA,UAAA,GACgBL,EAAA,CAAnEC,EAAAA,SAAS,CAAEC,KAAMI,OAAQF,UAAW,+BAnE1B/C,QAAAA,iBAmEyDgD,UAAA,yBAAA,GAEnDL,EAAA,CAAhBO,EAAAA,SArEUlD,QAAAA,iBAqEMgD,UAAA,aAAA,GACAL,EAAA,CAAhBO,EAAAA,SAtEUlD,QAAAA,iBAsEMgD,UAAA,oBAAA,GAtENhD,QAAAA,iBAAN2C,EAAA,EArBoB7C,EAoBR,qBAnBV,SAAUkC,GAIf,OAHKmB,eAAeC,IAAItD,IACtBqD,eAAeE,OAAOvD,EAASkC,GAE1BA,CACT,IAeWhC,QAAAA"}
1
+ {"version":3,"file":"action.cjs","sources":["../../../../packages/components-wc/src/subject/action.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\n\nfunction safeCustomElement(tagName: string) {\n return function (target: any) {\n if (!customElements.get(tagName)) {\n customElements.define(tagName, target)\n }\n return target\n }\n}\n\nconst answerTextList = [\n { value: 2, label: '必须全部都是支持选项,方可下一步' },\n { value: 1, label: '无需判断是否是支持选项' },\n { value: 3, label: '包含全部支持选项,即可下一步' },\n]\n\nconst iconEdit = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7\"/><path d=\"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z\"/></svg>`\nconst iconDelete = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>`\nconst iconCheck = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"20 6 9 17 4 12\"/></svg>`\nconst iconSort = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"currentColor\"><path d=\"M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z\"/></svg>`\n\n@safeCustomElement('qxs-subject-action')\nexport class QxsSubjectAction extends LitElement {\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .action { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; flex-wrap: wrap; gap: 8px; }\n .action.active { background: transparent; }\n .left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }\n .right { display: flex; align-items: center; gap: 4px; }\n\n .action-icon {\n display: inline-flex; align-items: center; justify-content: center;\n width: 32px; height: 32px; font-size: 18px; color: #303133;\n cursor: pointer; border-radius: 6px; border: 1px solid #dcdfe6;\n background: #fff; transition: all 0.2s;\n }\n .action-icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .action-icon--danger:hover { color: #f56c6c; border-color: #f56c6c; background: #fef0f0; }\n .action-icon:disabled { color: #c0c4cc; cursor: not-allowed; opacity: 0.6; }\n\n .text-btn {\n display: inline-flex; align-items: center; gap: 4px;\n padding: 6px 12px; font-size: 12px; border-radius: 3px;\n cursor: pointer; border: 1px solid; transition: all 0.2s;\n }\n .text-btn--primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .text-btn--primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n .text-btn--default { background: #fff; border-color: #dcdfe6; color: #606266; }\n .text-btn--default:hover { color: #3D61E3; border-color: #a0cfff; }\n .text-btn--danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }\n .text-btn--danger:hover { background: #e05252; border-color: #e05252; }\n\n .link-btn { background: none; border: none; color: #3D61E3; cursor: pointer; font-size: 12px; }\n .link-btn:hover { color: #2D4CB8; }\n\n .checkbox-label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; color: #606266; user-select: none; font-size: 12px; }\n .checkbox-label.disabled { cursor: not-allowed; opacity: 0.6; }\n .has-set { display: flex; align-items: center; font-size: 12px; color: #bbb; }\n .answer-text { font-size: 11px; color: #909399; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }\n\n .btn-margin { margin-right: 10px; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 4px; min-width: 360px; max-width: 460px; box-shadow: 0 12px 32px rgba(0,0,0,.1); }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 16px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n\n .radio-item { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; cursor: pointer; font-size: 13px; color: #606266; }\n .radio-item:last-child { margin-bottom: 0; }\n `\n\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Number, attribute: 'answer-check-type' }) answerCheckType = 1\n @property({ type: Boolean, attribute: 'show-other-option' }) showOtherOption = false\n @property({ type: Boolean, attribute: 'show-rich-text' }) showRichText = true\n @property({ type: Boolean, attribute: 'hide-add-rich-text' }) hideAddRichText = false\n @property({ type: Boolean, attribute: 'page-end' }) pageEnd = false\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n\n @state() private _modalOpen = false\n @state() private _currentCheckType = 1\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('answerCheckType')) {\n this._currentCheckType = this.answerCheckType\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private get _answerText() {\n return answerTextList.find(i => i.value === this.answerCheckType)?.label ?? ''\n }\n\n private _renderEditMode() {\n return html`\n <div class=\"left\">\n ${!this.hideAddRichText\n ? html`\n <span class=\"link-btn\" @click=${() => this._emit('on-show-rich-text')}>+添加题目描述(图文)</span>\n `\n : ''}\n ${this.showOtherOption\n ? html`\n <span class=\"link-btn\" @click=${() => { this._modalOpen = true }}>答题设置</span>\n <label class=\"checkbox-label\">\n <input type=\"checkbox\" .checked=${this.isKey} @change=${(e: Event) => this._emit('set-key', { value: (e.target as HTMLInputElement).checked })} />\n 核心题\n </label>\n `\n : ''}\n </div>\n <div class=\"right\">\n <button class=\"text-btn text-btn--danger btn-margin\" @click=${() => this._emit('delete')}>删除</button>\n <button class=\"text-btn text-btn--primary\" @click=${() => this._emit('save')}>完成编辑</button>\n </div>\n `\n }\n\n private _renderViewMode() {\n return html`\n <div class=\"left\">\n ${this.showOtherOption\n ? html`\n <label class=\"checkbox-label disabled\">\n <input type=\"checkbox\" disabled .checked=${this.isKey} /> 核心题\n </label>\n <span class=\"answer-text\">${this._answerText}</span>\n `\n : ''}\n </div>\n <div class=\"right\">\n ${!this.pageEnd\n ? html`\n <button class=\"text-btn text-btn--default btn-margin\" @click=${() => this._emit('edit')}>编辑</button>\n `\n : ''}\n <button class=\"text-btn text-btn--danger\" @click=${() => this._emit('delete')}>删除</button>\n </div>\n `\n }\n\n private _renderModal() {\n if (!this._modalOpen) { return '' }\n return html`\n <div class=\"modal-backdrop\" @click=${() => { this._modalOpen = false }}>\n <div class=\"modal\" @click=${(e: Event) => e.stopPropagation()}>\n <div class=\"modal-header\">\n <span class=\"modal-title\">答题设置</span>\n <button class=\"modal-close\" @click=${() => { this._modalOpen = false }}>&#x2715;</button>\n </div>\n <div class=\"modal-body\">\n ${answerTextList.map(item => html`\n <label class=\"radio-item\">\n <input type=\"radio\" name=\"answer-check-type\" .value=${String(item.value)}\n .checked=${this._currentCheckType === item.value}\n @change=${() => { this._currentCheckType = item.value }} />\n ${item.label}\n </label>\n `)}\n </div>\n <div class=\"modal-footer\">\n <button @click=${() => { this._modalOpen = false }}>取消</button>\n <button class=\"primary\" @click=${() => {\n this._emit('set-answer-setting', { value: this._currentCheckType })\n this._modalOpen = false\n }}>保存</button>\n </div>\n </div>\n </div>\n `\n }\n\n render() {\n return html`\n <div class=\"action ${this.isEdit ? 'active' : ''}\">\n ${this.isSet\n ? html`<div class=\"has-set\">*此题设置了跳题逻辑</div>`\n : (this.isEdit ? this._renderEditMode() : this._renderViewMode())\n }\n </div>\n ${this._renderModal()}\n `\n }\n}\n\nexport function register() {}\n"],"names":["answerTextList","value","label","tagName","html","QxsSubjectAction","LitElement","constructor","super","arguments","this","isEdit","isSet","isKey","answerCheckType","showOtherOption","showRichText","hideAddRichText","pageEnd","examAnswerRelationType","_modalOpen","_currentCheckType","updated","changed","has","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_answerText","find","i","_renderEditMode","e","target","checked","_renderViewMode","_renderModal","stopPropagation","map","item","String","render","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","Number","state","customElements","get","define"],"mappings":"+cAYA,MAAMA,EAAiB,CACrB,CAAEC,MAAO,EAAGC,MAAO,oBACnB,CAAED,MAAO,EAAGC,MAAO,eACnB,CAAED,MAAO,EAAGC,MAAO,mBAZrB,IAA2BC,EAeVC,EAAAA,IAAA,uUACEA,EAAAA,IAAA,yTACDA,EAAAA,IAAA,iOACDA,EAAAA,IAAA,wKAGJC,QAAAA,iBAAN,cAA+BC,EAAAA,WAA/BC,WAAAA,GAAAC,SAAAC,WA2D8CC,KAAAC,QAAS,EACVD,KAAAE,OAAQ,EACRF,KAAAG,OAAQ,EACEH,KAAAI,gBAAkB,EACjBJ,KAAAK,iBAAkB,EACrBL,KAAAM,cAAe,EACXN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ACVL,EAAA,CAAnDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,cAlE3B/C,QAAAA,iBAkEyCgD,UAAA,UAAA,GACgBL,EAAA,CAAnEC,EAAAA,SAAS,CAAEC,KAAMI,OAAQF,UAAW,+BAnE1B/C,QAAAA,iBAmEyDgD,UAAA,yBAAA,GAEnDL,EAAA,CAAhBO,EAAAA,SArEUlD,QAAAA,iBAqEMgD,UAAA,aAAA,GACAL,EAAA,CAAhBO,EAAAA,SAtEUlD,QAAAA,iBAsEMgD,UAAA,oBAAA,GAtENhD,QAAAA,iBAAN2C,EAAA,EArBoB7C,EAoBR,qBAnBV,SAAUkC,GAIf,OAHKmB,eAAeC,IAAItD,IACtBqD,eAAeE,OAAOvD,EAASkC,GAE1BA,CACT,IAeWhC,QAAAA"}
@@ -1,8 +1,8 @@
1
- "use strict";var t=require("lit"),e=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),s=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),i=require("../base/define.cjs"),l=require("./single.cjs"),r=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=(t,e,s,i)=>{for(var l,o=i>1?void 0:i?a(e,s):e,n=t.length-1;n>=0;n--)(l=t[n])&&(o=(i?l(e,s,o):l(o))||o);return i&&o&&r(e,s,o),o};const n=t.html`
1
+ "use strict";var t=require("lit"),e=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),s=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),i=require("../base/define.cjs"),l=require("./single.cjs"),r=require("./types.cjs"),a=Object.defineProperty,o=Object.getOwnPropertyDescriptor,n=(t,e,s,i)=>{for(var l,r=i>1?void 0:i?o(e,s):e,n=t.length-1;n>=0;n--)(l=t[n])&&(r=(i?l(e,s,r):l(r))||r);return i&&r&&a(e,s,r),r};const p=t.html`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none"
3
3
  stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
4
4
  <line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/>
5
- </svg>`;exports.QxsBlankFill=class extends t.LitElement{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!1,isIgnoreCase:!0},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.answerList=[],this.modelValue="",this.useModel=!1,this._title="",this._analysis="",this._answers=[{title:"",tag:"",showInput:!1}],this._isInOrder=!1,this._isIgnoreCase=!0,this._showRichText=!1,this._richText="",this.TITLE_MAX=400}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue.replaceAll(/<filter><\/filter>/g," ______"))}_syncProps(){if(this._title=(this.title||"").replaceAll(/<filter><\/filter>/g," ______"),this._analysis=this.analysis||"",this.answerList?.length)this._answers=this.answerList.map(t=>({title:t.title||"",tag:"",showInput:!1}));else{const t=(this._title.match(/ ______/g)||[]).length||1;this._answers=Array.from({length:t},()=>({title:"",tag:"",showInput:!1}))}this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_addBlank(){this._title+=" ______",this._answers=[...this._answers,{title:"",tag:"",showInput:!1}],this.requestUpdate(),this._emitModelUpdate()}_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;const s=(this._title.match(/ ______/g)||[]).length;if(s!==this._answers.length)if(s>this._answers.length)for(let t=this._answers.length;t<s;t++)this._answers=[...this._answers,{title:"",tag:"",showInput:!1}];else this._answers=this._answers.slice(0,s);this._emitModelUpdate()}_emitModelUpdate(){if(this.useModel){const t=this._title.replaceAll(/ ______/g,"<filter></filter>");this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:t}))}}_handleAddTag(t){t.showInput=!1,t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),this.requestUpdate()}_closeTag(t,e){if(t){const s=e.title.split(","),i=s.findIndex(e=>e===t);i>-1&&(s.splice(i,1),e.title=s.join(",")),this.requestUpdate()}}async toJSON(){return new Promise((t,e)=>{const s={customId:this.customId||void 0,answerType:"blank_fill",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",r=this.isEdit?this._answers:this.answerList||[],a=this.isEdit?this._analysis:this.analysis||"",o=this.isEdit?this._isInOrder:this.examAnswerSetting?.isInOrder??!1,n=this.isEdit?this._isIgnoreCase:this.examAnswerSetting?.isIgnoreCase??!0,p=this.isEdit?this._showRichText:!!this.richTextContent,h=this.isEdit?this._richText:this.richTextContent||"";if(!i)return void e(new l.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",s));if(r.length<1)return void e(new l.SubjectError("至少添加一个填空符!","NO_BLANK","answers",s));const d={answerType:"blank_fill",title:i.replaceAll(/ ______/g,"<filter></filter>"),answers:r.map(t=>({title:t.title,isCorrect:!0})),analysis:a,isSetCorrectAnswer:!0,isKey:this.isKey,examAnswerSettingBO:{isIgnoreCase:n,isInOrder:o},examRichTextContent:p?h:""};this.customId&&(d.customId=this.customId),t(d)})}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:"blank_fill",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",i=this.isEdit?this._answers:this.answerList||[];return s||t.push(new l.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",e)),i.length<1&&t.push(new l.SubjectError("至少添加一个填空符!","NO_BLANK","answers",e)),t}_renderPreview(){const e=this.title.replaceAll(/<filter><\/filter>/g," ______");return t.html`
5
+ </svg>`;exports.QxsBlankFill=class extends t.LitElement{constructor(){super(...arguments),this.orderIndex=0,this.title="",this.customId="",this.isEdit=!1,this.isSave=!1,this.isSet=!1,this.isKey=!1,this.showAction=!0,this.showAnalysis=!0,this.richTextContent="",this.analysis="",this.examAnswerRelationType=0,this.examExpand="",this.examAnswerSetting={isInOrder:!1,isIgnoreCase:!0},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.answerList=[],this.modelValue="",this.useModel=!1,this._title="",this._analysis="",this._answers=[{title:"",tag:"",showInput:!1}],this._isInOrder=!1,this._isIgnoreCase=!0,this._showRichText=!1,this._richText="",this.TITLE_MAX=400}willUpdate(t){t.has("isEdit")&&this.isEdit&&this._syncProps(),t.has("modelValue")&&this.useModel&&(this._title=this.modelValue.replaceAll(/<filter><\/filter>/g," ______"))}_syncProps(){if(this._title=(this.title||"").replaceAll(/<filter><\/filter>/g," ______"),this._analysis=this.analysis||"",this.answerList?.length)this._answers=this.answerList.map(t=>({title:t.title||"",tag:"",showInput:!1}));else{const t=(this._title.match(/ ______/g)||[]).length||1;this._answers=Array.from({length:t},()=>({title:"",tag:"",showInput:!1}))}this.examAnswerSetting&&(this._isInOrder=!!this.examAnswerSetting.isInOrder,this._isIgnoreCase=!!this.examAnswerSetting.isIgnoreCase),this.richTextContent&&(this._richText=this.richTextContent,this._showRichText=!0)}_emit(t,e){this.dispatchEvent(new CustomEvent(t,{bubbles:!0,composed:!0,detail:e??null}))}_addBlank(){this._title+=" ______",this._answers=[...this._answers,{title:"",tag:"",showInput:!1}],this.requestUpdate(),this._emitModelUpdate()}_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;const s=(this._title.match(/ ______/g)||[]).length;if(s!==this._answers.length)if(s>this._answers.length)for(let t=this._answers.length;t<s;t++)this._answers=[...this._answers,{title:"",tag:"",showInput:!1}];else this._answers=this._answers.slice(0,s);this._emitModelUpdate()}_emitModelUpdate(){if(this.useModel){const t=this._title.replaceAll(/ ______/g,"<filter></filter>");this.dispatchEvent(new CustomEvent("update:modelValue",{bubbles:!0,composed:!0,detail:t}))}}_handleAddTag(t){t.showInput=!1,t.tag&&(t.title=t.title?[t.title,t.tag].join(","):t.tag,t.tag=""),this.requestUpdate()}_closeTag(t,e){if(t){const s=e.title.split(","),i=s.findIndex(e=>e===t);i>-1&&(s.splice(i,1),e.title=s.join(",")),this.requestUpdate()}}async toJSON(){return new Promise((t,e)=>{const s={customId:this.customId||void 0,answerType:"blank_fill",orderIndex:this.orderIndex},i=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",a=this.isEdit?this._answers:this.answerList||[],o=this.isEdit?this._analysis:this.analysis||"",n=this.isEdit?this._isInOrder:this.examAnswerSetting?.isInOrder??!1,p=this.isEdit?this._isIgnoreCase:this.examAnswerSetting?.isIgnoreCase??!0,h=this.isEdit?this._showRichText:!!this.richTextContent,d=this.isEdit?this._richText:this.richTextContent||"";if(!i)return void e(new l.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",s));if(a.length<1)return void e(new l.SubjectError("至少添加一个填空符!","NO_BLANK","answers",s));const c={answerType:r.ExamType.BLANK_FILL,title:i.replaceAll(/ ______/g,"<filter></filter>"),answers:a.map(t=>({title:t.title,isCorrect:!0})),analysis:o,isSetCorrectAnswer:!0,isKey:this.isKey,examAnswerSettingBO:{isIgnoreCase:p,isInOrder:n},examRichTextContent:h?d:""};this.customId&&(c.customId=this.customId),t(c)})}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:"blank_fill",orderIndex:this.orderIndex},s=this.isEdit?this._title:this.title?.replaceAll(/<filter><\/filter>/g," ______")||"",i=this.isEdit?this._answers:this.answerList||[];return s||t.push(new l.SubjectError("题目标题不能为空!","EMPTY_TITLE","title",e)),i.length<1&&t.push(new l.SubjectError("至少添加一个填空符!","NO_BLANK","answers",e)),t}_renderPreview(){const e=this.title.replaceAll(/<filter><\/filter>/g," ______");return t.html`
6
6
  <div class="preview">
7
7
  <span class="title">${this.orderIndex+1}.${e}(填空题)</span>
8
8
  ${this.richTextContent?t.html`<div class="rich-text" .innerHTML=${this.richTextContent}></div>`:""}
@@ -67,7 +67,7 @@
67
67
  @blur=${()=>this._handleAddTag(e)} />
68
68
  `:t.html`
69
69
  <span class="el-button--small" @click=${()=>{e.showInput=!0,this.requestUpdate(),this.updateComplete.then(()=>{this.shadowRoot?.querySelector(".el-input--small")?.focus()})}}>
70
- ${n}
70
+ ${p}
71
71
  <span>${e.title?"添加同义词":"添加答案"}</span>
72
72
  </span>
73
73
  `}
@@ -201,5 +201,5 @@
201
201
  .answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
202
202
  .answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }
203
203
  .answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
204
- `,o([e.property({type:Number,attribute:"order-index"})],exports.QxsBlankFill.prototype,"orderIndex",2),o([e.property({type:String})],exports.QxsBlankFill.prototype,"title",2),o([e.property({type:String,attribute:"custom-id"})],exports.QxsBlankFill.prototype,"customId",2),o([e.property({type:Boolean,attribute:"is-edit"})],exports.QxsBlankFill.prototype,"isEdit",2),o([e.property({type:Boolean,attribute:"is-save"})],exports.QxsBlankFill.prototype,"isSave",2),o([e.property({type:Boolean,attribute:"is-set"})],exports.QxsBlankFill.prototype,"isSet",2),o([e.property({type:Boolean,attribute:"is-key"})],exports.QxsBlankFill.prototype,"isKey",2),o([e.property({type:Boolean,attribute:"show-action"})],exports.QxsBlankFill.prototype,"showAction",2),o([e.property({type:Boolean,attribute:"show-analysis"})],exports.QxsBlankFill.prototype,"showAnalysis",2),o([e.property({type:String,attribute:"rich-text-content"})],exports.QxsBlankFill.prototype,"richTextContent",2),o([e.property({type:String})],exports.QxsBlankFill.prototype,"analysis",2),o([e.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsBlankFill.prototype,"examAnswerRelationType",2),o([e.property({type:String,attribute:"exam-expand"})],exports.QxsBlankFill.prototype,"examExpand",2),o([e.property({type:Object,attribute:"exam-answer-setting"})],exports.QxsBlankFill.prototype,"examAnswerSetting",2),o([e.property({type:Object})],exports.QxsBlankFill.prototype,"uploadImage",2),o([e.property({type:Array,attribute:"answer-list"})],exports.QxsBlankFill.prototype,"answerList",2),o([e.property({type:String,attribute:"model-value"})],exports.QxsBlankFill.prototype,"modelValue",2),o([e.property({type:Boolean,attribute:"use-model"})],exports.QxsBlankFill.prototype,"useModel",2),o([s.state()],exports.QxsBlankFill.prototype,"_title",2),o([s.state()],exports.QxsBlankFill.prototype,"_analysis",2),o([s.state()],exports.QxsBlankFill.prototype,"_answers",2),o([s.state()],exports.QxsBlankFill.prototype,"_isInOrder",2),o([s.state()],exports.QxsBlankFill.prototype,"_isIgnoreCase",2),o([s.state()],exports.QxsBlankFill.prototype,"_showRichText",2),o([s.state()],exports.QxsBlankFill.prototype,"_richText",2),exports.QxsBlankFill=o([i.safeCustomElement("qxs-blank-fill")],exports.QxsBlankFill);
204
+ `,n([e.property({type:Number,attribute:"order-index"})],exports.QxsBlankFill.prototype,"orderIndex",2),n([e.property({type:String})],exports.QxsBlankFill.prototype,"title",2),n([e.property({type:String,attribute:"custom-id"})],exports.QxsBlankFill.prototype,"customId",2),n([e.property({type:Boolean,attribute:"is-edit"})],exports.QxsBlankFill.prototype,"isEdit",2),n([e.property({type:Boolean,attribute:"is-save"})],exports.QxsBlankFill.prototype,"isSave",2),n([e.property({type:Boolean,attribute:"is-set"})],exports.QxsBlankFill.prototype,"isSet",2),n([e.property({type:Boolean,attribute:"is-key"})],exports.QxsBlankFill.prototype,"isKey",2),n([e.property({type:Boolean,attribute:"show-action"})],exports.QxsBlankFill.prototype,"showAction",2),n([e.property({type:Boolean,attribute:"show-analysis"})],exports.QxsBlankFill.prototype,"showAnalysis",2),n([e.property({type:String,attribute:"rich-text-content"})],exports.QxsBlankFill.prototype,"richTextContent",2),n([e.property({type:String})],exports.QxsBlankFill.prototype,"analysis",2),n([e.property({type:Number,attribute:"exam-answer-relation-type"})],exports.QxsBlankFill.prototype,"examAnswerRelationType",2),n([e.property({type:String,attribute:"exam-expand"})],exports.QxsBlankFill.prototype,"examExpand",2),n([e.property({type:Object,attribute:"exam-answer-setting"})],exports.QxsBlankFill.prototype,"examAnswerSetting",2),n([e.property({type:Object})],exports.QxsBlankFill.prototype,"uploadImage",2),n([e.property({type:Array,attribute:"answer-list"})],exports.QxsBlankFill.prototype,"answerList",2),n([e.property({type:String,attribute:"model-value"})],exports.QxsBlankFill.prototype,"modelValue",2),n([e.property({type:Boolean,attribute:"use-model"})],exports.QxsBlankFill.prototype,"useModel",2),n([s.state()],exports.QxsBlankFill.prototype,"_title",2),n([s.state()],exports.QxsBlankFill.prototype,"_analysis",2),n([s.state()],exports.QxsBlankFill.prototype,"_answers",2),n([s.state()],exports.QxsBlankFill.prototype,"_isInOrder",2),n([s.state()],exports.QxsBlankFill.prototype,"_isIgnoreCase",2),n([s.state()],exports.QxsBlankFill.prototype,"_showRichText",2),n([s.state()],exports.QxsBlankFill.prototype,"_richText",2),exports.QxsBlankFill=n([i.safeCustomElement("qxs-blank-fill")],exports.QxsBlankFill);
205
205
  //# sourceMappingURL=blank-fill.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"blank-fill.cjs","sources":["../../../../packages/components-wc/src/subject/blank-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\n\ninterface BlankAnswer { title: string, tag: string, showInput: boolean }\n\nconst iconPlus = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n </svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-blank-fill')\nexport class QxsBlankFill 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; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview .content { color: #a8abb2; margin-top: 10px; }\n\n .flex { display: flex; }\n .flex-wrap { flex-wrap: wrap; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 70px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n /* Tag style */\n .el-tag {\n display: inline-flex; align-items: center; height: 24px; padding: 0 9px;\n font-size: 12px; line-height: 1; color: #3D61E3; background: #ecf5ff;\n border: 1px solid #d9ecff; border-radius: 4px; white-space: nowrap;\n }\n .el-tag .el-tag__close {\n display: inline-flex; align-items: center; justify-content: center;\n margin-left: 4px; width: 16px; height: 16px; border-radius: 50%;\n font-size: 12px; color: #909399; cursor: pointer; transition: all .2s;\n }\n .el-tag .el-tag__close:hover { background: #909399; color: #fff; }\n\n /* Button small style */\n .el-button--small {\n display: inline-flex; align-items: center; gap: 4px;\n height: 24px; padding: 0 10px; font-size: 12px; line-height: 1;\n border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266;\n cursor: pointer; transition: all .2s; white-space: nowrap;\n }\n .el-button--small:hover { color: #3D61E3; border-color: #c6e2ff; background-color: #ecf5ff; }\n\n /* Link style */\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; text-decoration: none; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.is-disabled { color: #c0c4cc; cursor: not-allowed; }\n\n /* Input small for tag */\n .el-input--small { width: 80px; }\n .el-input--small input {\n height: 24px; padding: 0 8px; font-size: 12px; line-height: 24px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n }\n .el-input--small input:focus { border-color: #3D61E3; outline: none; }\n\n /* Checkbox style */\n .el-checkbox {\n display: inline-flex; align-items: center; gap: 6px; cursor: pointer;\n font-size: 13px; color: #606266; user-select: none; margin-right: 16px;\n }\n .el-checkbox input[type=\"checkbox\"] {\n width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3;\n }\n\n .answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }\n .answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }\n .answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean } = { isInOrder: false, isIgnoreCase: true }\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: 'answer-list' }) answerList: any[] = []\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _answers: BlankAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _isInOrder = false\n @state() private _isIgnoreCase = true\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 400\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue.replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n }\n\n private _syncProps() {\n this._title = (this.title || '').replaceAll(/<filter><\\/filter>/g, ' ______')\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n else {\n const blankCount = (this._title.match(/ ______/g) || []).length || 1\n this._answers = Array.from({ length: blankCount }, () => ({ title: '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n }\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\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 _addBlank() {\n this._title += ' ______'\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n this.requestUpdate()\n this._emitModelUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n const blankCount = (this._title.match(/ ______/g) || []).length\n if (blankCount !== this._answers.length) {\n if (blankCount > this._answers.length) {\n for (let i = this._answers.length; i < blankCount; i++) {\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n }\n else {\n this._answers = this._answers.slice(0, blankCount)\n }\n }\n this._emitModelUpdate()\n }\n\n // 双向绑定:通知外部更新\n private _emitModelUpdate() {\n if (this.useModel) {\n const modelValue = this._title.replaceAll(/ ______/g, '<filter></filter>')\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: modelValue,\n }))\n }\n }\n\n private _handleAddTag(item: BlankAnswer) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n this.requestUpdate()\n }\n\n private _closeTag(tag: string, item: BlankAnswer) {\n if (tag) {\n const tags = item.title.split(',')\n const idx = tags.findIndex((t: string) => t === tag)\n if (idx > -1) { tags.splice(idx, 1); item.title = tags.join(',') }\n this.requestUpdate()\n }\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? false\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\n const showRichText = this.isEdit ? this._showRichText : !!this.richTextContent\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (answers.length < 1) {\n reject(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n return\n }\n const result: any = {\n answerType: 'blank_fill',\n title: title.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.map((a: any) => ({ title: a.title, isCorrect: true })),\n analysis,\n isSetCorrectAnswer: true,\n isKey: this.isKey,\n examAnswerSettingBO: { isIgnoreCase, isInOrder },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (answers.length < 1) {\n errors.push(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n }\n\n return errors\n }\n\n private _renderPreview() {\n const displayTitle = this.title.replaceAll(/<filter><\\/filter>/g, ' ______')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${displayTitle}(填空题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div class=\"content flex flex-wrap\">\n <span>正确答案:</span>\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">填空${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"3\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【填空题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex flex-justify-end\">\n <span class=\"el-link ${this.isSave ? 'is-disabled' : ''}\"\n @click=${() => {\n if (!this.isSave) { this._addBlank() }\n }}>插入填空符</span>\n </div>\n\n <div class=\"flex flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\" style=\"margin-top:12px\">\n <div class=\"label\"><span>第${i + 1}空答案:</span></div>\n <div class=\"answer-tags\">\n ${a.title.split(',').filter(Boolean).map(tag => html`\n <span class=\"el-tag\">\n ${tag}\n ${!this.isSave ? html`<span class=\"el-tag__close\" @click=${() => this._closeTag(tag, a)}>×</span>` : ''}\n </span>\n `)}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" class=\"el-input--small\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._handleAddTag(a) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._handleAddTag(a)} />\n `\n : html`\n <span class=\"el-button--small\" @click=${() => { a.showInput = true; this.requestUpdate(); this.updateComplete.then(() => { (this.shadowRoot?.querySelector('.el-input--small') as HTMLInputElement)?.focus() }) }}>\n ${iconPlus}\n <span>${a.title ? '添加同义词' : '添加答案'}</span>\n </span>\n `}\n `\n : ''}\n </div>\n </div>\n `)}\n\n ${this._showRichText\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex flex-justify-end\" style=\"margin-top:8px\">\n <span class=\"el-link\" style=\"color:#f56c6c\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span>\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","QxsBlankFill","LitElement","constructor","super","arguments","this","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","modelValue","useModel","_title","_analysis","_answers","tag","showInput","_isInOrder","_isIgnoreCase","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","replaceAll","length","map","a","blankCount","match","Array","from","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_addBlank","requestUpdate","_emitModelUpdate","_onTitleInput","el","value","slice","i","_handleAddTag","item","join","_closeTag","tags","split","idx","findIndex","t","splice","toJSON","row","answerType","answers","showRichText","richText","SubjectError","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","_renderPreview","displayTitle","some","_renderEdit","checked","filter","Boolean","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","String","state","safeCustomElement"],"mappings":"ygBAOA,MAAMA,EAAWC,EAAAA,IAAA;;;;UAoBJC,QAAAA,aAAN,cAA2BC,EAAAA,WAA3BC,WAAAA,GAAAC,SAAAC,WAiFiDC,KAAAC,WAAa,EACvCD,KAAAE,MAAQ,GACgBF,KAAAG,SAAW,GACZH,KAAAI,QAAS,EACTJ,KAAAK,QAAS,EACVL,KAAAM,OAAQ,EACRN,KAAAO,OAAQ,EACHP,KAAAQ,YAAa,EACXR,KAAAS,cAAe,EACZT,KAAAU,gBAAkB,GAClDV,KAAAW,SAAW,GAC6BX,KAAAY,u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J,UAAA,aAAA,GAEtDL,EAAA,CADCC,EAAAA,SAAS,CAAEC,KAAM3C,OAAQ6C,UAAW,yBA9F1BtJ,QAAAA,aA+FXuJ,UAAA,oBAAA,GAEAL,EAAA,CADCC,EAAAA,SAAS,CAAEC,KAAM3C,UAhGPzG,QAAAA,aAiGXuJ,UAAA,cAAA,GASqDL,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAMzF,MAAO2F,UAAW,iBA1GzBtJ,QAAAA,aA0G0CuJ,UAAA,aAAA,GAGCL,EAAA,CAArDC,EAAAA,SAAS,CAAEC,KAAMI,OAAQF,UAAW,iBA7G1BtJ,QAAAA,aA6G2CuJ,UAAA,aAAA,GACDL,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAMZ,QAASc,UAAW,eA9G3BtJ,QAAAA,aA8G0CuJ,UAAA,WAAA,GAEpCL,EAAA,CAAhBO,EAAAA,SAhHUzJ,QAAAA,aAgHMuJ,UAAA,SAAA,GACAL,EAAA,CAAhBO,EAAAA,SAjHUzJ,QAAAA,aAiHMuJ,UAAA,YAAA,GACAL,EAAA,CAAhBO,EAAAA,SAlHUzJ,QAAAA,aAkHMuJ,UAAA,WAAA,GACAL,EAAA,CAAhBO,EAAAA,SAnHUzJ,QAAAA,aAmHMuJ,UAAA,aAAA,GACAL,EAAA,CAAhBO,EAAAA,SApHUzJ,QAAAA,aAoHMuJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,EAAAA,SArHUzJ,QAAAA,aAqHMuJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,EAAAA,SAtHUzJ,QAAAA,aAsHMuJ,UAAA,YAAA,GAtHNvJ,QAAAA,aAANkJ,EAAA,CADNQ,EAAAA,kBAAkB,mBACN1J,QAAAA"}
1
+ {"version":3,"file":"blank-fill.cjs","sources":["../../../../packages/components-wc/src/subject/blank-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\nimport { ExamType } from './types'\n\ninterface BlankAnswer { title: string, tag: string, showInput: boolean }\n\nconst iconPlus = html`\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" viewBox=\"0 0 24 24\" fill=\"none\"\n stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/>\n </svg>`\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-blank-fill')\nexport class QxsBlankFill 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; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview .content { color: #a8abb2; margin-top: 10px; }\n\n .flex { display: flex; }\n .flex-wrap { flex-wrap: wrap; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 70px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n /* Tag style */\n .el-tag {\n display: inline-flex; align-items: center; height: 24px; padding: 0 9px;\n font-size: 12px; line-height: 1; color: #3D61E3; background: #ecf5ff;\n border: 1px solid #d9ecff; border-radius: 4px; white-space: nowrap;\n }\n .el-tag .el-tag__close {\n display: inline-flex; align-items: center; justify-content: center;\n margin-left: 4px; width: 16px; height: 16px; border-radius: 50%;\n font-size: 12px; color: #909399; cursor: pointer; transition: all .2s;\n }\n .el-tag .el-tag__close:hover { background: #909399; color: #fff; }\n\n /* Button small style */\n .el-button--small {\n display: inline-flex; align-items: center; gap: 4px;\n height: 24px; padding: 0 10px; font-size: 12px; line-height: 1;\n border: 1px solid #dcdfe6; border-radius: 3px; background: #fff; color: #606266;\n cursor: pointer; transition: all .2s; white-space: nowrap;\n }\n .el-button--small:hover { color: #3D61E3; border-color: #c6e2ff; background-color: #ecf5ff; }\n\n /* Link style */\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; text-decoration: none; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.is-disabled { color: #c0c4cc; cursor: not-allowed; }\n\n /* Input small for tag */\n .el-input--small { width: 80px; }\n .el-input--small input {\n height: 24px; padding: 0 8px; font-size: 12px; line-height: 24px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n }\n .el-input--small input:focus { border-color: #3D61E3; outline: none; }\n\n /* Checkbox style */\n .el-checkbox {\n display: inline-flex; align-items: center; gap: 6px; cursor: pointer;\n font-size: 13px; color: #606266; user-select: none; margin-right: 16px;\n }\n .el-checkbox input[type=\"checkbox\"] {\n width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3;\n }\n\n .answer-item { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }\n .answer-item .label { min-width: 70px; padding-top: 0; color: #909399; }\n .answer-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean } = { isInOrder: false, isIgnoreCase: true }\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: 'answer-list' }) answerList: any[] = []\n\n // 双向绑定支持\n @property({ type: String, attribute: 'model-value' }) modelValue = ''\n @property({ type: Boolean, attribute: 'use-model' }) useModel = false\n\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _answers: BlankAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _isInOrder = false\n @state() private _isIgnoreCase = true\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 400\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n // 当外部 modelValue 变化时同步内部状态\n if (changed.has('modelValue') && this.useModel) {\n this._title = this.modelValue.replaceAll(/<filter><\\/filter>/g, ' ______')\n }\n }\n\n private _syncProps() {\n this._title = (this.title || '').replaceAll(/<filter><\\/filter>/g, ' ______')\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n else {\n const blankCount = (this._title.match(/ ______/g) || []).length || 1\n this._answers = Array.from({ length: blankCount }, () => ({ title: '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n }\n if (this.richTextContent) { this._richText = this.richTextContent; this._showRichText = true }\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 _addBlank() {\n this._title += ' ______'\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n this.requestUpdate()\n this._emitModelUpdate()\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n const blankCount = (this._title.match(/ ______/g) || []).length\n if (blankCount !== this._answers.length) {\n if (blankCount > this._answers.length) {\n for (let i = this._answers.length; i < blankCount; i++) {\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n }\n else {\n this._answers = this._answers.slice(0, blankCount)\n }\n }\n this._emitModelUpdate()\n }\n\n // 双向绑定:通知外部更新\n private _emitModelUpdate() {\n if (this.useModel) {\n const modelValue = this._title.replaceAll(/ ______/g, '<filter></filter>')\n this.dispatchEvent(new CustomEvent('update:modelValue', {\n bubbles: true,\n composed: true,\n detail: modelValue,\n }))\n }\n }\n\n private _handleAddTag(item: BlankAnswer) {\n item.showInput = false\n if (item.tag) {\n item.title = item.title ? [item.title, item.tag].join(',') : item.tag\n item.tag = ''\n }\n this.requestUpdate()\n }\n\n private _closeTag(tag: string, item: BlankAnswer) {\n if (tag) {\n const tags = item.title.split(',')\n const idx = tags.findIndex((t: string) => t === tag)\n if (idx > -1) { tags.splice(idx, 1); item.title = tags.join(',') }\n this.requestUpdate()\n }\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? false\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\n const showRichText = this.isEdit ? this._showRichText : !!this.richTextContent\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (answers.length < 1) {\n reject(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n return\n }\n const result: any = {\n answerType: ExamType.BLANK_FILL,\n title: title.replaceAll(/ ______/g, '<filter></filter>'),\n answers: answers.map((a: any) => ({ title: a.title, isCorrect: true })),\n analysis,\n isSetCorrectAnswer: true,\n isKey: this.isKey,\n examAnswerSettingBO: { isIgnoreCase, isInOrder },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'blank_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title?.replaceAll(/<filter><\\/filter>/g, ' ______') || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (answers.length < 1) {\n errors.push(new SubjectError('至少添加一个填空符!', 'NO_BLANK', 'answers', row))\n }\n\n return errors\n }\n\n private _renderPreview() {\n const displayTitle = this.title.replaceAll(/<filter><\\/filter>/g, ' ______')\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${displayTitle}(填空题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div class=\"content flex flex-wrap\">\n <span>正确答案:</span>\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">填空${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"3\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【填空题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex flex-justify-end\">\n <span class=\"el-link ${this.isSave ? 'is-disabled' : ''}\"\n @click=${() => {\n if (!this.isSave) { this._addBlank() }\n }}>插入填空符</span>\n </div>\n\n <div class=\"flex flex-items-center\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label class=\"el-checkbox\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\" style=\"margin-top:12px\">\n <div class=\"label\"><span>第${i + 1}空答案:</span></div>\n <div class=\"answer-tags\">\n ${a.title.split(',').filter(Boolean).map(tag => html`\n <span class=\"el-tag\">\n ${tag}\n ${!this.isSave ? html`<span class=\"el-tag__close\" @click=${() => this._closeTag(tag, a)}>×</span>` : ''}\n </span>\n `)}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" class=\"el-input--small\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._handleAddTag(a) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._handleAddTag(a)} />\n `\n : html`\n <span class=\"el-button--small\" @click=${() => { a.showInput = true; this.requestUpdate(); this.updateComplete.then(() => { (this.shadowRoot?.querySelector('.el-input--small') as HTMLInputElement)?.focus() }) }}>\n ${iconPlus}\n <span>${a.title ? '添加同义词' : '添加答案'}</span>\n </span>\n `}\n `\n : ''}\n </div>\n </div>\n `)}\n\n ${this._showRichText\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex flex-justify-end\" style=\"margin-top:8px\">\n <span class=\"el-link\" style=\"color:#f56c6c\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span>\n </div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["iconPlus","html","QxsBlankFill","LitElement","constructor","super","arguments","this","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","modelValue","useModel","_title","_analysis","_answers","tag","showInput","_isInOrder","_isIgnoreCase","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","replaceAll","length","map","a","blankCount","match","Array","from","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_addBlank","requestUpdate","_emitModelUpdate","_onTitleInput","el","value","slice","i","_handleAddTag","item","join","_closeTag","tags","split","idx","findIndex","t","splice","toJSON","row","answerType","answers","showRichText","richText","SubjectError","ExamType","BLANK_FILL","isCorrect","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_save","stopImmediatePropagation","data","err","msg","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","color","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","push","_renderPreview","displayTitle","some","_renderEdit","checked","filter","Boolean","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","Number","attribute","prototype","String","state","safeCustomElement"],"mappings":"kiBAQA,MAAMA,EAAWC,EAAAA,IAAA;;;;UAoBJC,QAAAA,aAAN,cAA2BC,EAAAA,WAA3BC,WAAAA,GAAAC,SAAAC,WAiFiDC,KAAAC,WAAa,EACvCD,KAAAE,MAAQ,GACgBF,KAAAG,SAAW,GACZH,KAAAI,QAAS,EACTJ,KAAAK,QAAS,EACVL,KAAAM,OAAQ,EACRN,KAAAO,OAAQ,EACHP,KAAAQ,YAAa,EACXR,KAAAS,cAAe,EACZT,KAAAU,gBAAkB,GAClDV,KAAAW,SAAW,GAC6BX,KAAAY,uBAAyB,EACvCZ,KAAAa,WAAa,GAEnEb,KAAAc,kBAAmE,CAAEC,WAAW,EAAOC,cAAc,GAErGhB,KAAAiB,YAA+CC,SACtC,IAAIC,QAAQ,CAACC,EAASC,KAC3B,MAAMC,EAAS,IAAIC,WACnBD,EAAOE,OAAUC,GAAML,EAAQK,EAAEC,QAAQC,QACzCL,EAAOM,QAAUP,EACjBC,EAAOO,cAAcC,KAI4B9B,KAAA+B,WAAoB,GAGnB/B,KAAAgC,WAAa,GACdhC,KAAAiC,UAAW,EAEvDjC,KAAQkC,OAAS,GACjBlC,KAAQmC,UAAY,GACpBnC,KAAQoC,SAA0B,CAAC,CAAElC,MAAO,GAAImC,IAAK,GAAIC,WAAW,IACpEtC,KAAQuC,YAAa,EACrBvC,KAAQwC,eAAgB,EACxBxC,KAAQyC,eAAgB,EACxBzC,KAAQ0C,UAAY,GAE7B1C,KAAiB2C,UAAY,GAAA,CAE7BC,UAAAA,CAAWC,GACLA,EAAQC,IAAI,WAAa9C,KA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AhBO,EAAAA,SAjHU3J,QAAAA,aAiHMyJ,UAAA,YAAA,GACAL,EAAA,CAAhBO,EAAAA,SAlHU3J,QAAAA,aAkHMyJ,UAAA,WAAA,GACAL,EAAA,CAAhBO,EAAAA,SAnHU3J,QAAAA,aAmHMyJ,UAAA,aAAA,GACAL,EAAA,CAAhBO,EAAAA,SApHU3J,QAAAA,aAoHMyJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,EAAAA,SArHU3J,QAAAA,aAqHMyJ,UAAA,gBAAA,GACAL,EAAA,CAAhBO,EAAAA,SAtHU3J,QAAAA,aAsHMyJ,UAAA,YAAA,GAtHNzJ,QAAAA,aAANoJ,EAAA,CADNQ,EAAAA,kBAAkB,mBACN5J,QAAAA"}
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("lit"),t=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),s=require("../base/define.cjs"),o=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=(e,t,s,i)=>{for(var a,p=i>1?void 0:i?r(t,s):t,d=e.length-1;d>=0;d--)(a=e[d])&&(p=(i?a(t,s,p):a(p))||p);return i&&p&&o(t,s,p),p};exports.QxsSubjectLayout=class extends e.LitElement{constructor(){super(...arguments),this.showEdit=!1}render(){return this.showEdit?e.html`
1
+ "use strict";var e=require("lit"),t=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),s=require("../base/define.cjs"),o=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=(e,t,s,i)=>{for(var a,l=i>1?void 0:i?r(t,s):t,p=e.length-1;p>=0;p--)(a=e[p])&&(l=(i?a(t,s,l):a(l))||l);return i&&l&&o(t,s,l),l};exports.QxsSubjectLayout=class extends e.LitElement{constructor(){super(...arguments),this.showEdit=!1}render(){return this.showEdit?e.html`
2
2
  <div class="layout">
3
3
  <div class="edit">
4
4
  <slot name="edit"></slot>
@@ -14,8 +14,8 @@
14
14
  </div>
15
15
  `}},exports.QxsSubjectLayout.styles=e.css`
16
16
  :host { display: block; width: 100%; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 12px; color: #5a5a5a; }
17
- .layout { padding: 10px; border-radius: 8px; }
17
+ .layout { }
18
18
  .preview { padding: 12px 10px 10px; }
19
- .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
19
+ .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; }
20
20
  `,i([t.property({type:Boolean,attribute:"show-edit"})],exports.QxsSubjectLayout.prototype,"showEdit",2),exports.QxsSubjectLayout=i([s.safeCustomElement("qxs-subject-layout")],exports.QxsSubjectLayout);
21
21
  //# sourceMappingURL=layout.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.cjs","sources":["../../../../packages/components-wc/src/subject/layout.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-subject-layout')\nexport class QxsSubjectLayout extends LitElement {\n static styles = css`\n :host { display: block; width: 100%; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n .layout { padding: 10px; border-radius: 8px; }\n .preview { padding: 12px 10px 10px; }\n .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }\n `\n\n @property({ type: Boolean, attribute: 'show-edit' }) showEdit = false\n\n render() {\n if (this.showEdit) {\n return html`\n <div class=\"layout\">\n <div class=\"edit\">\n <slot name=\"edit\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n return html`\n <div class=\"layout\">\n <div class=\"preview\">\n <slot name=\"preview\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["QxsSubjectLayout","LitElement","constructor","super","arguments","this","showEdit","render","html","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","safeCustomElement"],"mappings":"wXAKaA,QAAAA,iBAAN,cAA+BC,EAAAA,WAA/BC,WAAAA,GAAAC,SAAAC,WAQgDC,KAAAC,UAAW,CAAA,CAEhEC,MAAAA,GACE,OAAIF,KAAKC,SACAE,EAAAA,IAAA;;;;;;;QASFA,EAAAA,IAAA;;;;;;;KAQT,GA7BWR,QAAAA,iBACJS,OAASC,EAAAA,GAAA;;;;;IAOqCC,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,eAR3Bf,QAAAA,iBAQ0CgB,UAAA,WAAA,GAR1ChB,QAAAA,iBAANW,EAAA,CADNM,EAAAA,kBAAkB,uBACNjB,QAAAA"}
1
+ {"version":3,"file":"layout.cjs","sources":["../../../../packages/components-wc/src/subject/layout.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\n@safeCustomElement('qxs-subject-layout')\nexport class QxsSubjectLayout extends LitElement {\n static styles = css`\n :host { display: block; width: 100%; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n .layout { }\n .preview { padding: 12px 10px 10px; }\n .edit { position: relative; padding: 12px 10px 10px; background-color: #fff; border-radius: 6px; }\n `\n\n @property({ type: Boolean, attribute: 'show-edit' }) showEdit = false\n\n render() {\n if (this.showEdit) {\n return html`\n <div class=\"layout\">\n <div class=\"edit\">\n <slot name=\"edit\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n return html`\n <div class=\"layout\">\n <div class=\"preview\">\n <slot name=\"preview\"></slot>\n <slot></slot>\n </div>\n </div>\n `\n }\n}\n\nexport function register() {}\n"],"names":["QxsSubjectLayout","LitElement","constructor","super","arguments","this","showEdit","render","html","styles","css","__decorateClass","property","type","Boolean","attribute","prototype","safeCustomElement"],"mappings":"wXAKaA,QAAAA,iBAAN,cAA+BC,EAAAA,WAA/BC,WAAAA,GAAAC,SAAAC,WAQgDC,KAAAC,UAAW,CAAA,CAEhEC,MAAAA,GACE,OAAIF,KAAKC,SACAE,EAAAA,IAAA;;;;;;;QASFA,EAAAA,IAAA;;;;;;;KAQT,GA7BWR,QAAAA,iBACJS,OAASC,EAAAA,GAAA;;;;;IAOqCC,EAAA,CAApDC,EAAAA,SAAS,CAAEC,KAAMC,QAASC,UAAW,eAR3Bf,QAAAA,iBAQ0CgB,UAAA,WAAA,GAR1ChB,QAAAA,iBAANW,EAAA,CADNM,EAAAA,kBAAkB,uBACNjB,QAAAA"}
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("lit"),t=require("../node_modules/.pnpm/lit-html@3.3.2/node_modules/lit-html/directives/repeat.cjs"),s=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),i=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),a=require("sortablejs"),r=require("../base/define.cjs"),o=require("../base/uid.cjs"),l=require("./single.cjs"),n=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(e,t,s,i)=>{for(var a,r=i>1?void 0:i?d(t,s):t,o=e.length-1;o>=0;o--)(a=e[o])&&(r=(i?a(t,s,r):a(r))||r);return i&&r&&n(t,s,r),r};const h={single:"单选题",multiple:"多选题",sort:"排序题",blank_fill:"填空题",text_fill:"问答题",scale:"量表题",rich_text:"富文本",page_end:"分页符"};exports.QxsSubjectList=class extends e.LitElement{constructor(){super(...arguments),this.isPreview=!1,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._list=[],this._sortMode=!1,this._sortable=null,this._initialDataProcessed=!1}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=e.map(e=>({...e,customId:e.customId||o.uid()})),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=e.map(e=>({...e,customId:e.customId||o.uid()})),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=t.map(e=>({...e,customId:e.customId||o.uid()})),this.requestUpdate())}catch{}}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;const e=this.shadowRoot?.querySelector(".sort-list");e&&(this._sortable&&(this._sortable.destroy(),this._sortable=null),requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".sort-list");e&&!this._sortable&&(this._sortable=a.create(e,{handle:".sort-handle",animation:200,ghostClass:"sort-ghost",chosenClass:"sort-chosen",onEnd:e=>{const{oldIndex:t,newIndex:s}=e;if(void 0===t||void 0===s||t===s)return;const i=[...this._list],[a]=i.splice(t,1);i.splice(s,0,a),this._list=i,this._emit("change",this._list)}}))}))}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}async toJSON(){const e=this.shadowRoot?.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-subject-rich-text");if(!e||0===e.length)return[];const t=[],s=[];for(const i of e)if("function"==typeof i.toJSON)try{const e=await i.toJSON();t.push(e)}catch(e){e instanceof l.SubjectError?s.push(e):s.push(new l.SubjectError(e.message||"未知错误","UNKNOWN","unknown"))}if(s.length>0)throw s;return t}async validate(){const e=this.shadowRoot?.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-subject-rich-text");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;const i={customId:o.uid(),answerType:e,title:"",answers:[],analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,isKey:!1,answerCheckType:1,examAnswerRelationType:s??0},a=[...this._list];"number"==typeof t&&t>=0?a.splice(t+1,0,i):a.push(i),this._list=a,this._emit("change",this._list)}addExam(e){let t=1;const s=[];e.forEach(e=>{const i={...e,customId:e.customId||o.uid(),answers:e.answers?.map(e=>({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect}))||[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1};e.richTextContent||(i.answerType=e.examTypeEnum),i.pageIndex>t&&(s.push({customId:o.uid(),answerType:"page_end",analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:0}),t=i.pageIndex),s.push(i)}),this._list=[...this._list,...s],this._emit("change",this._list)}uploadExcel(e){this._list=[...this._list,...e.map(e=>({...e,customId:e.customId||o.uid(),isRealCanDel:!0}))],this._emit("change",this._list)}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._emit("change",this._list)}_orderIndex(e){let t=0,s=0;return this._list.forEach(i=>{"page_end"!==i.answerType&&(t++,i.customId===e&&(s=t))}),s-1}_pageIndex(e){return this._list.filter(e=>"page_end"===e.answerType).findIndex(t=>t.customId===e)+1}_totalPages(){return this._list.filter(e=>"page_end"===e.answerType).length}_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._emit("change",this._list)}_save(e,t){this._list=this._list.map((s,i)=>i===e?{...s,...t.detail,isEdit:!1,isSave:!0}:s),this._emit("change",this._list)}_deleteByCustomId(e){this._list=this._list.filter(t=>t.customId!==e),this._emit("change",this._list)}_delete(e){const t=[...this._list];t.splice(e,1),this._list=t,this._emit("change",this._list)}_setEdit(e,t){this._list=this._list.map((s,i)=>i===e?{...s,isEdit:t}:s)}_renderItem(t,s){const i=this._orderIndex(t.customId),a=(t.isEdit,t.hasSet,t.isRealCanDel,this._isPreviewValue,t.examAnswerRelationType,e=>this._move(s,e.detail)),r=()=>this._deleteByCustomId(t.customId),o=e=>this._save(s,e),l=()=>this._setEdit(s,!0),n=e=>this.addSubject(e.detail?.type??e.detail,s);return["single","multiple","sort"].includes(t.answerType)?e.html`<qxs-subject-single
1
+ "use strict";var e=require("lit"),t=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),s=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),i=require("sortablejs"),a=require("../base/define.cjs"),r=require("../base/uid.cjs"),n=require("./single.cjs"),o=require("./types.cjs");require("./action.cjs"),require("./blank-fill.cjs"),require("./layout.cjs"),require("./text-fill.cjs"),require("./scale.cjs"),require("./page-end.cjs"),require("./rich-text.cjs"),require("./type.cjs");var l=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c=(e,t,s,i)=>{for(var a,r=i>1?void 0:i?d(t,s):t,n=e.length-1;n>=0;n--)(a=e[n])&&(r=(i?a(t,s,r):a(r))||r);return i&&r&&l(t,s,r),r};exports.QxsSubjectList=class extends e.LitElement{constructor(){super(...arguments),this.isPreview=!1,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._list=[],this._sortMode=!1,this._sortable=null,this._initialDataProcessed=!1}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=e.map(e=>({...e,customId:e.customId||r.uid()})),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=e.map(e=>({...e,customId:e.customId||r.uid()})),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=t.map(e=>({...e,customId:e.customId||r.uid()})),this.requestUpdate())}catch{}}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.querySelector(".sort-list")&&(this._sortable&&(this._sortable.destroy(),this._sortable=null),requestAnimationFrame(()=>{const e=this.querySelector(".sort-list");e&&!this._sortable&&(this._sortable=i.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],[a]=i.splice(t,1);i.splice(s,0,a),this._list=i,this._emit("change",this._list)}}))}))}_emit(e,t){this.dispatchEvent(new CustomEvent(e,{bubbles:!0,composed:!0,detail:t??null}))}async toJSON(){const e=this.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, 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 n.SubjectError?s.push(e):s.push(new n.SubjectError(e.message||"未知错误","UNKNOWN","unknown"))}if(s.length>0)throw s;return t}async validate(){const e=this.querySelectorAll("qxs-subject-single, qxs-blank-fill, qxs-text-fill, qxs-scale, qxs-subject-rich-text");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;const i={customId:r.uid(),answerType:e,title:"",answers:[],analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,isKey:!1,answerCheckType:1,examAnswerRelationType:s??0},a=[...this._list];"number"==typeof t&&t>=0?a.splice(t+1,0,i):a.push(i),this._list=a,this.requestUpdate(),this._emit("change",this._list)}addExam(e){let t=1;const s=[];e.forEach(e=>{const i={...e,customId:e.customId||r.uid(),answers:e.answers?.map(e=>({...e,title:e.answer,answerId:e.examAnswerId,isCorrect:e.isCorrect}))||[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1};e.richTextContent||(i.answerType=o.getSubjectType(e.examTypeEnum)),i.pageIndex>t&&(s.push({customId:r.uid(),answerType:"page_end",analysis:"",scaleQuestionList:[],isEdit:!0,isSave:!1,isRealCanDel:!0,hasSet:!1,examAnswerRelationType:0}),t=i.pageIndex),s.push(i)}),this._list=[...this._list,...s],this._emit("change",this._list)}uploadExcel(e){this._list=[...this._list,...e.map(e=>({...e,customId:e.customId||r.uid(),isRealCanDel:!0}))],this._emit("change",this._list)}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._emit("change",this._list)}_orderIndex(e){let t=0,s=0;return this._list.forEach(i=>{"page_end"!==i.answerType&&(t++,i.customId===e&&(s=t))}),s-1}_pageIndex(e){return this._list.filter(e=>"page_end"===e.answerType).findIndex(t=>t.customId===e)+1}_totalPages(){return this._list.filter(e=>"page_end"===e.answerType).length}_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._emit("change",this._list)}_save(e,t){this._list=this._list.map((s,i)=>i===e?{...s,...t.detail,isEdit:!1,isSave:!0}:s),this._emit("change",this._list)}_deleteByCustomId(e){this._list=this._list.filter(t=>t.customId!==e),this._emit("change",this._list)}_delete(e){const t=[...this._list];t.splice(e,1),this._list=t,this._emit("change",this._list)}_setEdit(e,t){this._list=this._list.map((s,i)=>i===e?{...s,isEdit:t}:s)}_renderItem(t,s){const i=this._orderIndex(t.customId),a=(t.isEdit,t.hasSet,t.isRealCanDel,this._isPreviewValue,t.examAnswerRelationType,e=>this._move(s,e.detail)),r=()=>this._deleteByCustomId(t.customId),n=e=>this._save(s,e),o=()=>this._setEdit(s,!0),l=e=>this.addSubject(e.detail?.type??e.detail,s);return["single","multiple","sort"].includes(t.answerType)?e.html`<qxs-subject-single
2
2
  .title=${t.title||""}
3
3
  .answerList=${t.answers||[]}
4
4
  .uploadImage=${this.uploadImage}
@@ -17,7 +17,7 @@
17
17
  exam-expand=${t.examExpand||""}
18
18
  custom-id=${t.customId||""}
19
19
  exam-id=${t.examId??0}
20
- @move=${a} @delete=${r} @save=${o} @edit=${l} @add=${n}
20
+ @move=${a} @delete=${r} @save=${n} @edit=${o} @add=${l}
21
21
  @set-relation=${e=>this._emit("set-relation",e.detail)}
22
22
  ></qxs-subject-single>`:"blank_fill"===t.answerType?e.html`<qxs-blank-fill
23
23
  .title=${t.title||""}
@@ -31,7 +31,7 @@
31
31
  rich-text-content=${t.examRichTextContent||""}
32
32
  analysis=${t.analysis||""}
33
33
  custom-id=${t.customId||""}
34
- @move=${a} @delete=${r} @save=${o} @edit=${l} @add=${n}
34
+ @move=${a} @delete=${r} @save=${n} @edit=${o} @add=${l}
35
35
  ></qxs-blank-fill>`:"text_fill"===t.answerType?e.html`<qxs-text-fill
36
36
  .title=${t.title||""}
37
37
  .answerList=${t.answers||[]}
@@ -44,7 +44,7 @@
44
44
  rich-text-content=${t.examRichTextContent||""}
45
45
  analysis=${t.analysis||""}
46
46
  custom-id=${t.customId||""}
47
- @move=${a} @delete=${r} @save=${o} @edit=${l} @add=${n}
47
+ @move=${a} @delete=${r} @save=${n} @edit=${o} @add=${l}
48
48
  ></qxs-text-fill>`:"scale"===t.answerType?e.html`<qxs-scale
49
49
  .title=${t.title||""}
50
50
  .answerList=${t.answers||[]}
@@ -56,7 +56,7 @@
56
56
  rich-text-content=${t.examRichTextContent||""}
57
57
  analysis=${t.analysis||""}
58
58
  custom-id=${t.customId||""}
59
- @move=${a} @delete=${r} @save=${o} @edit=${l} @add=${n}
59
+ @move=${a} @delete=${r} @save=${n} @edit=${o} @add=${l}
60
60
  ></qxs-scale>`:"rich_text"===t.answerType?e.html`<qxs-subject-rich-text
61
61
  .uploadImage=${this.uploadImage}
62
62
  order-index=${i}
@@ -64,62 +64,25 @@
64
64
  exam-answer-relation-type=${t.examAnswerRelationType??0}
65
65
  rich-text-content=${t.richTextContent||t.examRichTextContent||""}
66
66
  custom-id=${t.customId||""}
67
- @move=${a} @delete=${r} @save=${o} @edit=${l} @add=${n}
67
+ @move=${a} @delete=${r} @save=${n} @edit=${o} @add=${l}
68
68
  ></qxs-subject-rich-text>`:"page_end"===t.answerType?e.html`<qxs-page-end
69
69
  current-page-index=${this._pageIndex(t.customId)}
70
70
  total-page=${this._totalPages()}
71
71
  ?show-action=${!this._isPreviewValue}
72
- @move=${a} @delete=${r} @add=${n}
72
+ @move=${a} @delete=${r} @add=${l}
73
73
  ></qxs-page-end>`:e.html`<div style="color:#909399;padding:8px">未知题型: ${t.answerType}</div>`}render(){return e.html`
74
- <div class="wrapper">
75
- ${!this._isPreviewValue&&this._list.length>1?e.html`
76
- <div class="sort-mode-toggle">
77
- <button class="btn ${this._sortMode?"primary":""}" @click=${()=>{this._sortMode=!this._sortMode}}>
78
- ${this._sortMode?"":e.html`
79
- <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="currentColor">
80
- <path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/>
81
- </svg>
82
- `}
83
- ${this._sortMode?"完成排序":"排序"}
84
- </button>
85
- </div>
86
- `:""}
87
- ${this._sortMode?e.html`
88
- <div class="sort-list">
89
- ${t.repeat(this._list,e=>e.customId,(t,s)=>e.html`
90
- <div class="sort-item" data-id=${t.customId}>
91
- <span class="sort-handle">
92
- <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
93
- <path d="M11 18c0 1.1-.9 2-2 2s-2-.9-2-2 .9-2 2-2 2 .9 2 2zm-2-8c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0-6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm6 4c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/>
94
- </svg>
95
- </span>
96
- <span class="sort-index">${s+1}.</span>
97
- <span class="sort-title">${t.title||"未命名题目"}</span>
98
- <span class="sort-type">${h[t.answerType]||t.answerType}</span>
99
- </div>
100
- `)}
101
- </div>
102
- `:e.html`
103
- <div class="subject-list">
104
- ${this._list.map((t,s)=>e.html`
105
- <div class="subject-item ${this._isPreviewValue?"is-preview":""}" key=${t.customId}>
106
- <div class="subject-content">${this._renderItem(t,s)}</div>
107
- </div>
108
- `)}
109
- </div>
110
- `}
74
+ <div class="subject-list">
75
+ ${this._list.map((e,t)=>this._renderItem(e,t))}
111
76
  </div>
112
77
  `}},exports.QxsSubjectList.styles=e.css`
113
78
  :host { display: block; font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; font-size: 13px; }
114
79
  *, ::before, ::after { box-sizing: border-box; }
115
- .wrapper { width: 100%; padding: 16px; margin-bottom: 16px; background: #fff; border: 1px solid #ebeef5; border-radius: 4px; }
116
80
  .sort-mode-toggle { display: flex; justify-content: flex-end; margin-bottom: 12px; }
117
81
  .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; }
118
- .btn:hover { color: #409eff; border-color: #c6e2ff; background: #ecf5ff; }
119
- .btn.primary { background: #409eff; border-color: #409eff; color: #fff; }
120
- .btn.primary:hover { background: #337ecc; border-color: #337ecc; }
82
+ .btn:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }
83
+ .btn.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }
84
+ .btn.primary:hover { background: #3D61E3; border-color: #3D61E3; }
121
85
  .subject-list { display: flex; flex-direction: column; }
122
- .subject-item { position: relative; display: flex; align-items: flex-start; transition: background-color 0.3s ease; }
123
86
  .subject-content { flex: 1; min-width: 0; }
124
87
  .ghost { opacity: 0.5; background: #ecf5ff; }
125
88
  .chosen { box-shadow: 0 4px 16px rgba(64,158,255,.3); }
@@ -133,5 +96,5 @@
133
96
  .sort-index { font-size: 13px; color: #606266; font-weight: 500; margin-right: 8px; min-width: 24px; flex-shrink: 0; }
134
97
  .sort-title { flex: 1; font-size: 14px; color: #303133; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
135
98
  .sort-type { font-size: 12px; color: #909399; margin-left: 12px; padding: 2px 8px; background: #f0f0f0; border-radius: 4px; flex-shrink: 0; }
136
- `,c([s.property({attribute:"is-preview"})],exports.QxsSubjectList.prototype,"isPreview",2),c([s.property({type:Object})],exports.QxsSubjectList.prototype,"uploadImage",2),c([s.property({type:Array})],exports.QxsSubjectList.prototype,"subjectList",1),c([i.state()],exports.QxsSubjectList.prototype,"_list",2),c([i.state()],exports.QxsSubjectList.prototype,"_sortMode",2),exports.QxsSubjectList=c([r.safeCustomElement("qxs-subject-list")],exports.QxsSubjectList);
99
+ `,c([t.property({attribute:"is-preview"})],exports.QxsSubjectList.prototype,"isPreview",2),c([t.property({type:Object})],exports.QxsSubjectList.prototype,"uploadImage",2),c([t.property({type:Array})],exports.QxsSubjectList.prototype,"subjectList",1),c([s.state()],exports.QxsSubjectList.prototype,"_list",2),c([s.state()],exports.QxsSubjectList.prototype,"_sortMode",2),exports.QxsSubjectList=c([a.safeCustomElement("qxs-subject-list")],exports.QxsSubjectList);
137
100
  //# sourceMappingURL=list.cjs.map