element-less 0.0.61 → 0.0.63

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.
@@ -1163,7 +1163,7 @@ class NodeRange {
1163
1163
  }
1164
1164
  }
1165
1165
  const emptyAttrs = /* @__PURE__ */ Object.create(null);
1166
- class Node {
1166
+ let Node$1 = class Node2 {
1167
1167
  /**
1168
1168
  @internal
1169
1169
  */
@@ -1293,14 +1293,14 @@ class Node {
1293
1293
  copy(content = null) {
1294
1294
  if (content == this.content)
1295
1295
  return this;
1296
- return new Node(this.type, this.attrs, content, this.marks);
1296
+ return new Node2(this.type, this.attrs, content, this.marks);
1297
1297
  }
1298
1298
  /**
1299
1299
  Create a copy of this node, with the given set of marks instead
1300
1300
  of the node's own marks.
1301
1301
  */
1302
1302
  mark(marks) {
1303
- return marks == this.marks ? this : new Node(this.type, this.attrs, this.content, marks);
1303
+ return marks == this.marks ? this : new Node2(this.type, this.attrs, this.content, marks);
1304
1304
  }
1305
1305
  /**
1306
1306
  Create a copy of this node with only the content between the
@@ -1563,9 +1563,9 @@ class Node {
1563
1563
  node.type.checkAttrs(node.attrs);
1564
1564
  return node;
1565
1565
  }
1566
- }
1567
- Node.prototype.text = void 0;
1568
- class TextNode extends Node {
1566
+ };
1567
+ Node$1.prototype.text = void 0;
1568
+ class TextNode extends Node$1 {
1569
1569
  /**
1570
1570
  @internal
1571
1571
  */
@@ -2152,7 +2152,7 @@ let NodeType$1 = class NodeType {
2152
2152
  create(attrs = null, content, marks) {
2153
2153
  if (this.isText)
2154
2154
  throw new Error("NodeType.create can't construct text nodes");
2155
- return new Node(this, this.computeAttrs(attrs), Fragment.from(content), Mark$1.setFrom(marks));
2155
+ return new Node$1(this, this.computeAttrs(attrs), Fragment.from(content), Mark$1.setFrom(marks));
2156
2156
  }
2157
2157
  /**
2158
2158
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but check the given content
@@ -2162,7 +2162,7 @@ let NodeType$1 = class NodeType {
2162
2162
  createChecked(attrs = null, content, marks) {
2163
2163
  content = Fragment.from(content);
2164
2164
  this.checkContent(content);
2165
- return new Node(this, this.computeAttrs(attrs), content, Mark$1.setFrom(marks));
2165
+ return new Node$1(this, this.computeAttrs(attrs), content, Mark$1.setFrom(marks));
2166
2166
  }
2167
2167
  /**
2168
2168
  Like [`create`](https://prosemirror.net/docs/ref/#model.NodeType.create), but see if it is
@@ -2185,7 +2185,7 @@ let NodeType$1 = class NodeType {
2185
2185
  let after = matched && matched.fillBefore(Fragment.empty, true);
2186
2186
  if (!after)
2187
2187
  return null;
2188
- return new Node(this, attrs, content.append(after), Mark$1.setFrom(marks));
2188
+ return new Node$1(this, attrs, content.append(after), Mark$1.setFrom(marks));
2189
2189
  }
2190
2190
  /**
2191
2191
  Returns true if the given fragment is valid content for this node
@@ -2381,7 +2381,7 @@ class Schema {
2381
2381
  let type = this.marks[prop], excl = type.spec.excludes;
2382
2382
  type.excluded = excl == null ? [type] : excl == "" ? [] : gatherMarks(this, excl.split(" "));
2383
2383
  }
2384
- this.nodeFromJSON = (json) => Node.fromJSON(this, json);
2384
+ this.nodeFromJSON = (json) => Node$1.fromJSON(this, json);
2385
2385
  this.markFromJSON = (json) => Mark$1.fromJSON(this, json);
2386
2386
  this.topNodeType = this.nodes[this.spec.topNode || "doc"];
2387
2387
  this.cached.wrappings = /* @__PURE__ */ Object.create(null);
@@ -2451,7 +2451,7 @@ function isTagRule(rule) {
2451
2451
  function isStyleRule(rule) {
2452
2452
  return rule.style != null;
2453
2453
  }
2454
- class DOMParser {
2454
+ let DOMParser$1 = class DOMParser2 {
2455
2455
  /**
2456
2456
  Create a parser that targets the given schema, using the given
2457
2457
  parsing rules.
@@ -2577,9 +2577,9 @@ class DOMParser {
2577
2577
  [priority](https://prosemirror.net/docs/ref/#model.GenericParseRule.priority).
2578
2578
  */
2579
2579
  static fromSchema(schema2) {
2580
- return schema2.cached.domParser || (schema2.cached.domParser = new DOMParser(schema2, DOMParser.schemaRules(schema2)));
2580
+ return schema2.cached.domParser || (schema2.cached.domParser = new DOMParser2(schema2, DOMParser2.schemaRules(schema2)));
2581
2581
  }
2582
- }
2582
+ };
2583
2583
  const blockTags = {
2584
2584
  address: true,
2585
2585
  article: true,
@@ -6023,7 +6023,7 @@ class EditorState {
6023
6023
  let instance2 = new EditorState($config);
6024
6024
  $config.fields.forEach((field) => {
6025
6025
  if (field.name == "doc") {
6026
- instance2.doc = Node.fromJSON(config.schema, json.doc);
6026
+ instance2.doc = Node$1.fromJSON(config.schema, json.doc);
6027
6027
  } else if (field.name == "selection") {
6028
6028
  instance2.selection = Selection.fromJSON(instance2.doc, json.selection);
6029
6029
  } else if (field.name == "storedMarks") {
@@ -9285,7 +9285,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
9285
9285
  dom = child;
9286
9286
  }
9287
9287
  if (!slice2) {
9288
- let parser = view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
9288
+ let parser = view.someProp("clipboardParser") || view.someProp("domParser") || DOMParser$1.fromSchema(view.state.schema);
9289
9289
  slice2 = parser.parseSlice(dom, {
9290
9290
  preserveWhitespace: !!(asText || sliceData),
9291
9291
  context: $context,
@@ -11157,7 +11157,7 @@ function parseBetween(view, from_, to_) {
11157
11157
  }
11158
11158
  }
11159
11159
  let startDoc = view.state.doc;
11160
- let parser = view.someProp("domParser") || DOMParser.fromSchema(view.state.schema);
11160
+ let parser = view.someProp("domParser") || DOMParser$1.fromSchema(view.state.schema);
11161
11161
  let $from = startDoc.resolve(from2);
11162
11162
  let sel = null, doc2 = parser.parse(parent, {
11163
11163
  topNode: $from.parent,
@@ -12649,7 +12649,7 @@ function elementFromString(value) {
12649
12649
  return removeWhitespaces(html);
12650
12650
  }
12651
12651
  function createNodeFromContent(content, schema2, options2) {
12652
- if (content instanceof Node || content instanceof Fragment) {
12652
+ if (content instanceof Node$1 || content instanceof Fragment) {
12653
12653
  return content;
12654
12654
  }
12655
12655
  options2 = {
@@ -12705,9 +12705,9 @@ function createNodeFromContent(content, schema2, options2) {
12705
12705
  })
12706
12706
  });
12707
12707
  if (options2.slice) {
12708
- DOMParser.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options2.parseOptions);
12708
+ DOMParser$1.fromSchema(contentCheckSchema).parseSlice(elementFromString(content), options2.parseOptions);
12709
12709
  } else {
12710
- DOMParser.fromSchema(contentCheckSchema).parse(elementFromString(content), options2.parseOptions);
12710
+ DOMParser$1.fromSchema(contentCheckSchema).parse(elementFromString(content), options2.parseOptions);
12711
12711
  }
12712
12712
  if (options2.errorOnInvalidContent && hasInvalidContent) {
12713
12713
  throw new Error("[tiptap error]: Invalid HTML content", {
@@ -12715,7 +12715,7 @@ function createNodeFromContent(content, schema2, options2) {
12715
12715
  });
12716
12716
  }
12717
12717
  }
12718
- const parser = DOMParser.fromSchema(schema2);
12718
+ const parser = DOMParser$1.fromSchema(schema2);
12719
12719
  if (options2.slice) {
12720
12720
  return parser.parseSlice(elementFromString(content), options2.parseOptions).content;
12721
12721
  }
@@ -23280,7 +23280,7 @@ var Mention = Node3.create({
23280
23280
  if (!empty2) {
23281
23281
  return false;
23282
23282
  }
23283
- let mentionNode = new Node();
23283
+ let mentionNode = new Node$1();
23284
23284
  let mentionPos = 0;
23285
23285
  state.doc.nodesBetween(anchor - 1, anchor, (node, pos) => {
23286
23286
  if (node.type.name === this.name) {
@@ -26861,6 +26861,76 @@ const _sfc_main$2q = /* @__PURE__ */ Object.assign({ name: "ElsTiptapEditor" },
26861
26861
  getPlainText: () => getPlainTextWithMentions(),
26862
26862
  getMentions: () => currentMentions.value
26863
26863
  });
26864
+ const INLINE_TAG_MAP = {
26865
+ div: "span",
26866
+ p: "span"
26867
+ };
26868
+ const htmlNodeToSpec = (node) => {
26869
+ if (node.nodeType === Node.TEXT_NODE) return node.textContent || "";
26870
+ if (node.nodeType !== Node.ELEMENT_NODE) return "";
26871
+ const tag = INLINE_TAG_MAP[node.tagName.toLowerCase()] || node.tagName.toLowerCase();
26872
+ const attrs = {};
26873
+ Array.from(node.attributes).forEach((attr) => {
26874
+ const name2 = attr.name.toLowerCase();
26875
+ const value = attr.value;
26876
+ if (name2.startsWith("on")) return;
26877
+ if ((name2 === "src" || name2 === "href") && /^javascript:/i.test(value.trim())) return;
26878
+ attrs[attr.name] = value;
26879
+ });
26880
+ return [
26881
+ tag,
26882
+ attrs,
26883
+ ...Array.from(node.childNodes).map(htmlNodeToSpec).filter((child) => child !== "")
26884
+ ];
26885
+ };
26886
+ const htmlStringToMentionSpec = (html, HTMLAttributes) => {
26887
+ if (typeof window === "undefined" || typeof DOMParser === "undefined") {
26888
+ return [
26889
+ "span",
26890
+ { ...HTMLAttributes, contenteditable: "false" },
26891
+ html
26892
+ ];
26893
+ }
26894
+ const doc2 = new DOMParser().parseFromString(html, "text/html");
26895
+ const children = Array.from(doc2.body.childNodes).map(htmlNodeToSpec).filter((child) => child !== "");
26896
+ return [
26897
+ "span",
26898
+ { ...HTMLAttributes, contenteditable: "false" },
26899
+ ...children
26900
+ ];
26901
+ };
26902
+ const sanitizeHtmlElement = (element) => {
26903
+ Array.from(element.attributes).forEach((attr) => {
26904
+ const name2 = attr.name.toLowerCase();
26905
+ const value = attr.value;
26906
+ if (name2.startsWith("on")) {
26907
+ element.removeAttribute(attr.name);
26908
+ return;
26909
+ }
26910
+ if ((name2 === "src" || name2 === "href") && /^javascript:/i.test(value.trim())) {
26911
+ element.removeAttribute(attr.name);
26912
+ }
26913
+ });
26914
+ Array.from(element.children).forEach(sanitizeHtmlElement);
26915
+ };
26916
+ const appendHtmlString = (container, html) => {
26917
+ if (typeof window === "undefined" || typeof DOMParser === "undefined") {
26918
+ container.textContent = html;
26919
+ return;
26920
+ }
26921
+ const doc2 = new DOMParser().parseFromString(html, "text/html");
26922
+ Array.from(doc2.body.children).forEach(sanitizeHtmlElement);
26923
+ container.append(...Array.from(doc2.body.childNodes));
26924
+ };
26925
+ const appendRenderOptionContent = (container, option) => {
26926
+ const result = props2.renderOption ? props2.renderOption(option) : option[props2.labelField];
26927
+ const content = result && typeof result === "object" && "html" in result ? result.html : result;
26928
+ if (typeof content === "string") {
26929
+ appendHtmlString(container, content);
26930
+ return;
26931
+ }
26932
+ container.textContent = String(content ?? "");
26933
+ };
26864
26934
  const CustomMention = index_default.extend({
26865
26935
  draggable: true,
26866
26936
  addOptions() {
@@ -26884,7 +26954,9 @@ const _sfc_main$2q = /* @__PURE__ */ Object.assign({ name: "ElsTiptapEditor" },
26884
26954
  try {
26885
26955
  const result = renderMention(mentionData);
26886
26956
  if (result) {
26957
+ if (typeof result === "string") return htmlStringToMentionSpec(result, HTMLAttributes);
26887
26958
  if (Array.isArray(result)) return result;
26959
+ if (result.html && typeof result.html === "string") return htmlStringToMentionSpec(result.html, HTMLAttributes);
26888
26960
  if (result.html && Array.isArray(result.html)) return result.html;
26889
26961
  }
26890
26962
  } catch (error) {
@@ -27143,7 +27215,7 @@ const _sfc_main$2q = /* @__PURE__ */ Object.assign({ name: "ElsTiptapEditor" },
27143
27215
  div2.appendChild(badge);
27144
27216
  }
27145
27217
  const labelSpan = document.createElement("span");
27146
- labelSpan.textContent = props2.renderOption ? props2.renderOption(item) : item[props2.labelField];
27218
+ appendRenderOptionContent(labelSpan, item);
27147
27219
  div2.appendChild(labelSpan);
27148
27220
  if (item.type === "container") {
27149
27221
  const drillArrow = document.createElement("span");
@@ -27247,7 +27319,7 @@ const _sfc_main$2q = /* @__PURE__ */ Object.assign({ name: "ElsTiptapEditor" },
27247
27319
  };
27248
27320
  }
27249
27321
  });
27250
- const TipTapEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2q, [["__scopeId", "data-v-7bfd3d3b"]]);
27322
+ const TipTapEditor = /* @__PURE__ */ _export_sfc$1(_sfc_main$2q, [["__scopeId", "data-v-329f0d4d"]]);
27251
27323
  const { saveAs } = pkg;
27252
27324
  function _toConsumableArray(e) {
27253
27325
  if (Array.isArray(e)) {
@@ -33281,8 +33353,21 @@ const _sfc_main$2o = /* @__PURE__ */ defineComponent({
33281
33353
  }
33282
33354
  return `currNode['${s}']?.value`;
33283
33355
  };
33356
+ function findOptionLabelByValue(options2, value) {
33357
+ var _a;
33358
+ for (const opt of options2) {
33359
+ if (opt.value === value) return opt.label ?? null;
33360
+ if ((_a = opt.children) == null ? void 0 : _a.length) {
33361
+ const childLabel = findOptionLabelByValue(opt.children, value);
33362
+ if (childLabel) return childLabel;
33363
+ }
33364
+ }
33365
+ return null;
33366
+ }
33284
33367
  const mentionDisplayLabel = (id) => {
33285
33368
  if (!id) return id;
33369
+ const optionLabel = findOptionLabelByValue(fieldOptions.value, id);
33370
+ if (optionLabel) return optionLabel;
33286
33371
  if (id === "__rootNode__") return "rootNode";
33287
33372
  if (id.startsWith("globalData:")) return `globalData.${id.slice(11)}`;
33288
33373
  if (id.startsWith("root:")) return `root.${id.slice(5)}`;
@@ -33660,7 +33745,7 @@ const _sfc_main$2o = /* @__PURE__ */ defineComponent({
33660
33745
  };
33661
33746
  }
33662
33747
  });
33663
- const ConditionBuilderVue = /* @__PURE__ */ _export_sfc$1(_sfc_main$2o, [["__scopeId", "data-v-826c2474"]]);
33748
+ const ConditionBuilderVue = /* @__PURE__ */ _export_sfc$1(_sfc_main$2o, [["__scopeId", "data-v-5d6e49d3"]]);
33664
33749
  const _hoisted_1$1o = { class: "expr-input-wrapper" };
33665
33750
  const _hoisted_2$x = {
33666
33751
  key: 0,
@@ -33886,8 +33971,21 @@ const _sfc_main$2n = /* @__PURE__ */ defineComponent({
33886
33971
  ...flattenLeaves(rootContainerOpts)
33887
33972
  ];
33888
33973
  });
33974
+ function findOptionLabelByValue(options2, value) {
33975
+ var _a;
33976
+ for (const opt of options2) {
33977
+ if (opt.value === value) return opt.label ?? null;
33978
+ if ((_a = opt.children) == null ? void 0 : _a.length) {
33979
+ const childLabel = findOptionLabelByValue(opt.children, value);
33980
+ if (childLabel) return childLabel;
33981
+ }
33982
+ }
33983
+ return null;
33984
+ }
33889
33985
  const mentionDisplayLabel = (id) => {
33890
33986
  if (!id) return id;
33987
+ const optionLabel = findOptionLabelByValue(fieldOptions.value, id);
33988
+ if (optionLabel) return optionLabel;
33891
33989
  if (id === "__rootNode__") return "rootNode";
33892
33990
  if (id.startsWith("globalData:")) return `globalData.${id.slice(11)}`;
33893
33991
  if (id.startsWith("root:")) return `root.${id.slice(5)}`;
@@ -34103,7 +34201,7 @@ const _sfc_main$2n = /* @__PURE__ */ defineComponent({
34103
34201
  };
34104
34202
  }
34105
34203
  });
34106
- const ExpressionInputVue = /* @__PURE__ */ _export_sfc$1(_sfc_main$2n, [["__scopeId", "data-v-af929bec"]]);
34204
+ const ExpressionInputVue = /* @__PURE__ */ _export_sfc$1(_sfc_main$2n, [["__scopeId", "data-v-657f4962"]]);
34107
34205
  Number.prototype.toFixedNumber = function toFixedNumber(digits = 2) {
34108
34206
  return parseFloat(this.toFixed(digits));
34109
34207
  };
@@ -40010,6 +40108,7 @@ const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
40010
40108
  let currSpanMethod;
40011
40109
  let currSummaryMethod;
40012
40110
  let currSortChange;
40111
+ let rowSortableInstance = null;
40013
40112
  let columnEditData = reactive([]);
40014
40113
  let columnSortData = reactive({});
40015
40114
  let columnMergeData = reactive([]);
@@ -40024,6 +40123,7 @@ const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
40024
40123
  let mobilePageLayout = "total, prev, next, jumper";
40025
40124
  const bottomScroll = ref();
40026
40125
  const dataTable = ref();
40126
+ const tableRenderKey = ref(0);
40027
40127
  const tableForm = ref();
40028
40128
  const tableGlobalData = ref({
40029
40129
  isEdit: props2.isEdit
@@ -40198,13 +40298,15 @@ const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
40198
40298
  group: props2.tagId,
40199
40299
  animation: 300,
40200
40300
  onAdd: (evt) => {
40201
- if (props2.dragCol.onAdd) {
40202
- props2.dragCol.onAdd(evt);
40301
+ const dragColOptions = props2.dragCol;
40302
+ if (dragColOptions == null ? void 0 : dragColOptions.onAdd) {
40303
+ dragColOptions.onAdd(evt);
40203
40304
  }
40204
40305
  },
40205
40306
  onEnd: (evt) => {
40206
- if (props2.dragCol.onEnd) {
40207
- props2.dragCol.onEnd(evt);
40307
+ const dragColOptions = props2.dragCol;
40308
+ if (dragColOptions == null ? void 0 : dragColOptions.onEnd) {
40309
+ dragColOptions.onEnd(evt);
40208
40310
  } else {
40209
40311
  const { oldIndex, newIndex } = evt;
40210
40312
  const [movedColumn] = tableColumns.value.splice(oldIndex, 1);
@@ -40217,33 +40319,276 @@ const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
40217
40319
  }
40218
40320
  }
40219
40321
  function setRowDragSortable() {
40220
- if (props2.dragRow) {
40221
- new Sortable(dataTable.value.$el.querySelector(".el-table__body-wrapper tbody"), {
40222
- handle: ".els-table-drag",
40223
- draggable: ".el-table__row",
40224
- // 允许拖拽的项目类名
40225
- // 拖拽中 回调函数
40226
- onMove(customEvent) {
40322
+ if (!props2.dragRow) return;
40323
+ if (rowSortableInstance) {
40324
+ rowSortableInstance.destroy();
40325
+ rowSortableInstance = null;
40326
+ }
40327
+ const parentKeyMap = /* @__PURE__ */ new Map();
40328
+ const rowDataMap = /* @__PURE__ */ new Map();
40329
+ const getRowKey = (row) => String(row[dataKey.value]);
40330
+ const buildMaps = () => {
40331
+ parentKeyMap.clear();
40332
+ rowDataMap.clear();
40333
+ if (!dataKey.value) return;
40334
+ const traverse = (rows, parentKey) => {
40335
+ rows.forEach((row) => {
40336
+ var _a;
40337
+ const key = getRowKey(row);
40338
+ rowDataMap.set(key, row);
40339
+ if (parentKey !== void 0) parentKeyMap.set(key, parentKey);
40340
+ if ((_a = row.children) == null ? void 0 : _a.length) traverse(row.children, key);
40341
+ });
40342
+ };
40343
+ traverse(tableData);
40344
+ };
40345
+ buildMaps();
40346
+ const tbody = dataTable.value.$el.querySelector(".el-table__body-wrapper tbody");
40347
+ let hiddenRows = [];
40348
+ let rowDragStarted = false;
40349
+ const resetRowDragTable = () => {
40350
+ tableRenderKey.value++;
40351
+ nextTick(() => setRowDragSortable());
40352
+ };
40353
+ const getRowLevel = (tr2) => {
40354
+ var _a;
40355
+ const levelClass = Array.from(tr2.classList).find((className) => className.includes("el-table__row--level-"));
40356
+ const level = (_a = levelClass == null ? void 0 : levelClass.match(/el-table__row--level-(\d+)/)) == null ? void 0 : _a[1];
40357
+ return level ? Number(level) : 0;
40358
+ };
40359
+ const syncDomRowKeys = () => {
40360
+ if (!dataKey.value) return;
40361
+ const rows = Array.from(tbody.querySelectorAll("tr.el-table__row"));
40362
+ const levelRows = [];
40363
+ const levelChildIndex = [];
40364
+ let rootIndex = 0;
40365
+ rows.forEach((tr2) => {
40366
+ var _a;
40367
+ const level = getRowLevel(tr2);
40368
+ let row;
40369
+ if (level === 0) {
40370
+ row = tableData[rootIndex];
40371
+ rootIndex++;
40372
+ } else {
40373
+ const parent = levelRows[level - 1];
40374
+ const childIndex = levelChildIndex[level] ?? 0;
40375
+ row = (_a = parent == null ? void 0 : parent.children) == null ? void 0 : _a[childIndex];
40376
+ levelChildIndex[level] = childIndex + 1;
40377
+ }
40378
+ if (row) {
40379
+ tr2.dataset.rowKey = getRowKey(row);
40380
+ levelRows[level] = row;
40381
+ levelChildIndex[level + 1] = 0;
40382
+ }
40383
+ });
40384
+ rowDragLog("sync-dom-row-keys", {
40385
+ domKeys: rows.map((tr2) => tr2.dataset.rowKey),
40386
+ rootDataKeys: getRootDataKeys()
40387
+ });
40388
+ };
40389
+ const getDomRowKeys = () => Array.from(tbody.querySelectorAll("tr.el-table__row")).map((tr2) => tr2.dataset.rowKey);
40390
+ const getRootDataKeys = () => tableData.map((row) => dataKey.value ? getRowKey(row) : "");
40391
+ const rowDragLog = (step, data = {}) => {
40392
+ console.log("[ElsTable row-drag]", step, data);
40393
+ };
40394
+ const isDescendantOf = (key, parentKey) => {
40395
+ let currParentKey = parentKeyMap.get(key);
40396
+ while (currParentKey !== void 0) {
40397
+ if (currParentKey === parentKey) return true;
40398
+ currParentKey = parentKeyMap.get(currParentKey);
40399
+ }
40400
+ return false;
40401
+ };
40402
+ const hideDescendantRows = (rowKey) => {
40403
+ clearHiddenRows();
40404
+ const rows = Array.from(tbody.querySelectorAll("tr.el-table__row"));
40405
+ hiddenRows = rows.filter((tr2) => {
40406
+ const key = tr2.dataset.rowKey;
40407
+ return key && isDescendantOf(key, rowKey);
40408
+ });
40409
+ hiddenRows.forEach((tr2) => {
40410
+ tr2.style.display = "none";
40411
+ });
40412
+ rowDragLog("hide-descendants", {
40413
+ rowKey,
40414
+ hiddenKeys: hiddenRows.map((tr2) => tr2.dataset.rowKey),
40415
+ domKeys: getDomRowKeys(),
40416
+ parentKeyMap: Array.from(parentKeyMap.entries())
40417
+ });
40418
+ };
40419
+ const clearHiddenRows = () => {
40420
+ const restoreKeys = hiddenRows.map((tr2) => tr2.dataset.rowKey);
40421
+ hiddenRows.forEach((tr2) => {
40422
+ tr2.style.display = "";
40423
+ });
40424
+ hiddenRows = [];
40425
+ if (restoreKeys.length) rowDragLog("restore-hidden-rows", { restoreKeys });
40426
+ };
40427
+ rowSortableInstance = new Sortable(tbody, {
40428
+ handle: ".els-table-drag",
40429
+ draggable: ".el-table__row",
40430
+ animation: 150,
40431
+ onChoose(dragEvent) {
40432
+ var _a, _b, _c;
40433
+ rowDragStarted = false;
40434
+ syncDomRowKeys();
40435
+ if (!dataKey.value) {
40436
+ rowDragLog("choose-no-row-key", { domKeys: getDomRowKeys() });
40437
+ return;
40438
+ }
40439
+ buildMaps();
40440
+ const draggedKey = dragEvent.item.dataset.rowKey;
40441
+ const row = draggedKey ? rowDataMap.get(draggedKey) : void 0;
40442
+ rowDragLog("choose", {
40443
+ draggedKey,
40444
+ hasRow: !!row,
40445
+ hasChildren: !!((_a = row == null ? void 0 : row.children) == null ? void 0 : _a.length),
40446
+ childrenKeys: (_b = row == null ? void 0 : row.children) == null ? void 0 : _b.map((child) => getRowKey(child)),
40447
+ rootDataKeys: getRootDataKeys(),
40448
+ domKeys: getDomRowKeys(),
40449
+ parentKeyMap: Array.from(parentKeyMap.entries())
40450
+ });
40451
+ if (!draggedKey) return;
40452
+ if (!((_c = row == null ? void 0 : row.children) == null ? void 0 : _c.length)) return;
40453
+ hideDescendantRows(draggedKey);
40454
+ },
40455
+ onUnchoose() {
40456
+ rowDragLog("unchoose", { rowDragStarted, domKeys: getDomRowKeys(), rootDataKeys: getRootDataKeys() });
40457
+ if (!rowDragStarted) clearHiddenRows();
40458
+ },
40459
+ onStart() {
40460
+ rowDragStarted = true;
40461
+ rowDragLog("start", { domKeys: getDomRowKeys(), rootDataKeys: getRootDataKeys() });
40462
+ },
40463
+ onMove(customEvent) {
40464
+ var _a, _b;
40465
+ if (!dataKey.value) {
40227
40466
  emits2("dragMove", customEvent);
40228
- },
40229
- onStart() {
40230
- },
40231
- // 拖拽结束,调整位置
40232
- onEnd(dragEvent) {
40233
- const newIndex = dragEvent.newIndex;
40234
- const oldIndex = dragEvent.oldIndex;
40235
- if (newIndex !== void 0 && oldIndex !== void 0) {
40236
- if (oldIndex > -1 && newIndex > -1) {
40237
- const startRow = tableData[oldIndex];
40238
- const endRow = tableData[newIndex];
40239
- const currRow = tableData.splice(oldIndex, 1)[0];
40240
- tableData.splice(newIndex, 0, currRow);
40241
- emits2("dragEnd", { startRow, endRow });
40467
+ return;
40468
+ }
40469
+ buildMaps();
40470
+ const draggedKey = customEvent.dragged.dataset.rowKey;
40471
+ const relatedKey = (_b = (_a = customEvent.related) == null ? void 0 : _a.dataset) == null ? void 0 : _b.rowKey;
40472
+ rowDragLog("move", {
40473
+ draggedKey,
40474
+ relatedKey,
40475
+ draggedIsChild: draggedKey ? parentKeyMap.has(draggedKey) : void 0,
40476
+ relatedIsChild: relatedKey ? parentKeyMap.has(relatedKey) : void 0,
40477
+ relatedIsDescendantOfDragged: draggedKey && relatedKey ? isDescendantOf(relatedKey, draggedKey) : void 0
40478
+ });
40479
+ if (!draggedKey || !relatedKey) {
40480
+ emits2("dragMove", customEvent);
40481
+ return;
40482
+ }
40483
+ if (isDescendantOf(relatedKey, draggedKey)) {
40484
+ rowDragLog("move-block-descendant", { draggedKey, relatedKey });
40485
+ return false;
40486
+ }
40487
+ emits2("dragMove", customEvent);
40488
+ },
40489
+ onEnd(dragEvent) {
40490
+ rowDragStarted = true;
40491
+ buildMaps();
40492
+ const draggedKey = dragEvent.item.dataset.rowKey;
40493
+ const restoreHiddenRows = () => resetRowDragTable();
40494
+ rowDragLog("end-start", {
40495
+ draggedKey,
40496
+ oldIndex: dragEvent.oldIndex,
40497
+ newIndex: dragEvent.newIndex,
40498
+ oldDraggableIndex: dragEvent.oldDraggableIndex,
40499
+ newDraggableIndex: dragEvent.newDraggableIndex,
40500
+ domKeys: getDomRowKeys(),
40501
+ rootDataKeys: getRootDataKeys(),
40502
+ parentKeyMap: Array.from(parentKeyMap.entries())
40503
+ });
40504
+ if (!draggedKey || !dataKey.value) {
40505
+ const oi = dragEvent.oldDraggableIndex;
40506
+ const ni = dragEvent.newDraggableIndex;
40507
+ if (oi > -1 && ni > -1 && oi !== ni) {
40508
+ const startRow = tableData[oi];
40509
+ const endRow = tableData[ni];
40510
+ tableData.splice(ni, 0, tableData.splice(oi, 1)[0]);
40511
+ emits2("dragEnd", { startRow, endRow });
40512
+ }
40513
+ restoreHiddenRows();
40514
+ return;
40515
+ }
40516
+ const allRows = Array.from(tbody.querySelectorAll("tr[data-row-key]"));
40517
+ const originalParentKey = parentKeyMap.get(draggedKey);
40518
+ if (originalParentKey === void 0) {
40519
+ const rootKeys = allRows.map((tr2) => tr2.dataset.rowKey).filter((k) => !parentKeyMap.has(k));
40520
+ const startRow = rowDataMap.get(draggedKey);
40521
+ const reordered = rootKeys.map((k) => rowDataMap.get(k)).filter(Boolean);
40522
+ rowDragLog("end-root", {
40523
+ draggedKey,
40524
+ rootKeys,
40525
+ reorderedKeys: reordered.map((row) => getRowKey(row)),
40526
+ tableDataLength: tableData.length,
40527
+ canSplice: reordered.length === tableData.length
40528
+ });
40529
+ if (reordered.length === tableData.length) {
40530
+ tableData.splice(0, tableData.length, ...reordered);
40531
+ rowDragLog("end-root-after-splice", { rootDataKeys: getRootDataKeys() });
40532
+ emits2("dragEnd", { startRow, endRow: reordered[rootKeys.indexOf(draggedKey)] });
40533
+ }
40534
+ restoreHiddenRows();
40535
+ return;
40536
+ }
40537
+ const originalParent = rowDataMap.get(originalParentKey);
40538
+ const siblings = originalParent == null ? void 0 : originalParent.children;
40539
+ if (!siblings) {
40540
+ restoreHiddenRows();
40541
+ return;
40542
+ }
40543
+ const sibKeySet = new Set(siblings.map((c) => getRowKey(c)));
40544
+ const parentDomPos = allRows.findIndex((tr2) => tr2.dataset.rowKey === originalParentKey);
40545
+ const consecutiveSibKeys = [];
40546
+ for (let i = parentDomPos + 1; i < allRows.length; i++) {
40547
+ const k = allRows[i].dataset.rowKey;
40548
+ if (!sibKeySet.has(k)) break;
40549
+ consecutiveSibKeys.push(k);
40550
+ }
40551
+ const movedToRoot = !consecutiveSibKeys.includes(draggedKey);
40552
+ rowDragLog("end-child", {
40553
+ draggedKey,
40554
+ originalParentKey,
40555
+ siblingsKeys: Array.from(sibKeySet),
40556
+ parentDomPos,
40557
+ consecutiveSibKeys,
40558
+ movedToRoot,
40559
+ domKeys: allRows.map((tr2) => tr2.dataset.rowKey)
40560
+ });
40561
+ if (!movedToRoot) {
40562
+ const childKeys = allRows.map((tr2) => tr2.dataset.rowKey).filter((k) => sibKeySet.has(k));
40563
+ const startRow = rowDataMap.get(draggedKey);
40564
+ const reordered = childKeys.map((k) => rowDataMap.get(k)).filter(Boolean);
40565
+ if (reordered.length === siblings.length) {
40566
+ siblings.splice(0, siblings.length, ...reordered);
40567
+ emits2("dragEnd", { startRow, endRow: reordered[childKeys.indexOf(draggedKey)] });
40568
+ }
40569
+ } else {
40570
+ const childRow = rowDataMap.get(draggedKey);
40571
+ const draggedDomPos = allRows.findIndex((tr2) => tr2.dataset.rowKey === draggedKey);
40572
+ const childIdx = siblings.findIndex((c) => getRowKey(c) === draggedKey);
40573
+ if (childIdx > -1) {
40574
+ siblings.splice(childIdx, 1);
40575
+ if (siblings.length === 0) originalParent.children = [];
40576
+ }
40577
+ let insertAfterTableIdx = -1;
40578
+ for (let i = draggedDomPos - 1; i >= 0; i--) {
40579
+ const k = allRows[i].dataset.rowKey;
40580
+ if (!parentKeyMap.has(k)) {
40581
+ insertAfterTableIdx = tableData.findIndex((r) => getRowKey(r) === k);
40582
+ break;
40242
40583
  }
40243
40584
  }
40585
+ tableData.splice(insertAfterTableIdx + 1, 0, childRow);
40586
+ buildMaps();
40587
+ emits2("dragEnd", { startRow: childRow, endRow: childRow });
40244
40588
  }
40245
- });
40246
- }
40589
+ restoreHiddenRows();
40590
+ }
40591
+ });
40247
40592
  }
40248
40593
  function setEditData(fields, isEdit) {
40249
40594
  if (!fields) {
@@ -41453,7 +41798,7 @@ const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
41453
41798
  ref: tableForm
41454
41799
  }, {
41455
41800
  default: withCtx(() => [
41456
- withDirectives((openBlock(), createBlock(_component_el_table, mergeProps(unref(attrProps), {
41801
+ withDirectives((openBlock(), createBlock(_component_el_table, mergeProps({ key: tableRenderKey.value }, unref(attrProps), {
41457
41802
  data: tableData,
41458
41803
  "header-sticky-top": unref(currHeaderStickyTop),
41459
41804
  class: [!unref(isMobile) && _ctx.hasBottomFixdScroll ? unref(tagID) + " els-table-noScroll" : unref(tagID), { "els-drag-col": _ctx.dragCol }],
@@ -41651,7 +41996,7 @@ const _sfc_main$1Z = /* @__PURE__ */ defineComponent({
41651
41996
  };
41652
41997
  }
41653
41998
  });
41654
- const Table$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1Z, [["__scopeId", "data-v-2628571f"]]);
41999
+ const Table$1 = /* @__PURE__ */ _export_sfc$1(_sfc_main$1Z, [["__scopeId", "data-v-d9cadba2"]]);
41655
42000
  const ElsTable = withInstall$1(Table$1);
41656
42001
  const treeProps = buildProps({
41657
42002
  ...formItemProps$1,
@@ -72877,7 +73222,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
72877
73222
  emits: /* @__PURE__ */ mergeModels(["removeItem"], ["update:children"]),
72878
73223
  setup(__props, { emit: __emit }) {
72879
73224
  const DynamicDesignerInnerItem = defineAsyncComponent(() => {
72880
- return import("./innerItem-BLwsIdXS.js");
73225
+ return import("./innerItem-DFSxgDlT.js");
72881
73226
  });
72882
73227
  const { getValue: getValue2 } = useProps();
72883
73228
  const tagID = getValue2("tagID");
@@ -73616,7 +73961,8 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
73616
73961
  }
73617
73962
  }
73618
73963
  collect(designerObj.value);
73619
- return result;
73964
+ const seen = /* @__PURE__ */ new Set();
73965
+ return result.filter((f) => !seen.has(f.keyCode) && !!seen.add(f.keyCode));
73620
73966
  });
73621
73967
  function findItemContextDesigner(targetKeyID) {
73622
73968
  function traverse(items) {
@@ -73732,7 +74078,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
73732
74078
  };
73733
74079
  }
73734
74080
  });
73735
- const Designer = /* @__PURE__ */ _export_sfc$1(_sfc_main$1k, [["__scopeId", "data-v-abd9a30e"]]);
74081
+ const Designer = /* @__PURE__ */ _export_sfc$1(_sfc_main$1k, [["__scopeId", "data-v-e20fc7da"]]);
73736
74082
  const ElsDynamicDesigner = withInstall$1(Designer);
73737
74083
  const renderProps = buildProps({
73738
74084
  ...formItemProps$1,
@@ -73831,10 +74177,10 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
73831
74177
  emits: ["update:modelValue"],
73832
74178
  setup(__props, { expose: __expose, emit: __emit }) {
73833
74179
  const DynamicRenderInner = defineAsyncComponent(() => {
73834
- return import("./inner-DDu1WQSi.js").then((n) => n.i);
74180
+ return import("./inner-B9Zn0_B2.js").then((n) => n.i);
73835
74181
  });
73836
74182
  const DynamicRenderForm = defineAsyncComponent(() => {
73837
- return import("./inner-DDu1WQSi.js").then((n) => n.f);
74183
+ return import("./inner-B9Zn0_B2.js").then((n) => n.f);
73838
74184
  });
73839
74185
  const props2 = __props;
73840
74186
  const { getValue: getValue2, setValue, formNodeProps } = useProps(props2);
@@ -74064,10 +74410,10 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
74064
74410
  emits: ["update:modelValue"],
74065
74411
  setup(__props, { expose: __expose, emit: __emit }) {
74066
74412
  const DynamicRenderInnerAsync = defineAsyncComponent(() => {
74067
- return import("./inner-DDu1WQSi.js").then((n) => n.i);
74413
+ return import("./inner-B9Zn0_B2.js").then((n) => n.i);
74068
74414
  });
74069
74415
  const DynamicRenderFormAsync = defineAsyncComponent(() => {
74070
- return import("./inner-DDu1WQSi.js").then((n) => n.f);
74416
+ return import("./inner-B9Zn0_B2.js").then((n) => n.f);
74071
74417
  });
74072
74418
  const props2 = __props;
74073
74419
  const { getValue: getValue2, setValue, formNodeProps } = useProps(props2);
@@ -77341,7 +77687,8 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
77341
77687
  }
77342
77688
  }
77343
77689
  collect(renderData.value);
77344
- return result;
77690
+ const seen = /* @__PURE__ */ new Set();
77691
+ return result.filter((f) => !seen.has(f.keyCode) && !!seen.add(f.keyCode));
77345
77692
  });
77346
77693
  function findItemContext(targetKeyID) {
77347
77694
  function traverse(items) {
@@ -78456,7 +78803,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
78456
78803
  };
78457
78804
  }
78458
78805
  });
78459
- const DesignerView = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__scopeId", "data-v-27c3a153"]]);
78806
+ const DesignerView = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__scopeId", "data-v-a9af3092"]]);
78460
78807
  const ElsDesignerView = withInstall$1(DesignerView);
78461
78808
  (function(Prism2) {
78462
78809
  var string = /(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;
@@ -79195,31 +79542,31 @@ let AceEditor$1 = class AceEditor extends TBaseFormItem {
79195
79542
  __publicField(this, "editor", ref());
79196
79543
  onMounted(() => {
79197
79544
  if (props2.language === "json") {
79198
- const currModule = import("./mode-json-CMZrLYva.js").then((n) => n.m);
79545
+ const currModule = import("./mode-json-Cb8ZjoeD.js").then((n) => n.m);
79199
79546
  currModule.then((res) => {
79200
79547
  ace.config.setModuleUrl("ace/mode/json", res);
79201
79548
  this.init();
79202
79549
  });
79203
79550
  } else if (props2.language === "javascript") {
79204
- const currModule = import("./mode-javascript-UYl8TiHR.js").then((n) => n.m);
79551
+ const currModule = import("./mode-javascript-Ce6--MVa.js").then((n) => n.m);
79205
79552
  currModule.then((res) => {
79206
79553
  ace.config.setModuleUrl("ace/mode/javascript", res);
79207
79554
  this.init();
79208
79555
  });
79209
79556
  } else if (props2.language === "csharp") {
79210
- const currModule = import("./mode-csharp-BENJof50.js").then((n) => n.m);
79557
+ const currModule = import("./mode-csharp-UBVoLKPG.js").then((n) => n.m);
79211
79558
  currModule.then((res) => {
79212
79559
  ace.config.setModuleUrl("ace/mode/csharp", res);
79213
79560
  this.init();
79214
79561
  });
79215
79562
  } else if (props2.language === "mysql") {
79216
- const currModule = import("./mode-mysql-CyyRKgQ3.js").then((n) => n.m);
79563
+ const currModule = import("./mode-mysql-s3eaatna.js").then((n) => n.m);
79217
79564
  currModule.then((res) => {
79218
79565
  ace.config.setModuleUrl("ace/mode/mysql", res);
79219
79566
  this.init();
79220
79567
  });
79221
79568
  } else if (props2.language === "css") {
79222
- const currModule = import("./mode-css-BJJAjdkv.js").then((n) => n.m);
79569
+ const currModule = import("./mode-css-DgUCp6_8.js").then((n) => n.m);
79223
79570
  currModule.then((res) => {
79224
79571
  ace.config.setModuleUrl("ace/mode/css", res);
79225
79572
  this.init();