matrix_components 2.0.402 → 2.0.404

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.
@@ -54768,16 +54768,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
54768
54768
  },
54769
54769
  setup(__props, { expose: __expose }) {
54770
54770
  useCssVars((_ctx) => ({
54771
- "v699488de": customBackgroundColor.value,
54772
- "v44f94833": gapV.value,
54773
- "v4535833a": superLabelWidth.value,
54774
- "v3c7b86ff": subLabelWidth.value,
54775
- "v249b474c": height.value,
54776
- "v1ea3f0e5": labelWidth.value,
54777
- "v7f48f1c4": _ctx.$props.labelColor
54771
+ "a4ad2066": customBackgroundColor.value,
54772
+ "v25792477": gapV.value,
54773
+ "v24a41476": superLabelWidth.value,
54774
+ "v7b95373b": subLabelWidth.value,
54775
+ "a4a790c4": height.value,
54776
+ "v4bf68a29": labelWidth.value,
54777
+ "v7e6ab95a": _ctx.$props.labelColor
54778
54778
  }));
54779
54779
  const props = __props;
54780
54780
  const initialValues = ref$1(/* @__PURE__ */ new Map());
54781
+ const componentRefs = ref$1(/* @__PURE__ */ new Map());
54781
54782
  const customBackgroundColor = computed(() => {
54782
54783
  if (props.model === "vertical") {
54783
54784
  return props.backgroundColor || "#eef4fb";
@@ -54856,6 +54857,21 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
54856
54857
  }
54857
54858
  }
54858
54859
  }
54860
+ function setComponentRef(el2, rowInfo, rowIndex, colIndex) {
54861
+ if (el2 && rowInfo.key) {
54862
+ rowInfo.ref = el2;
54863
+ componentRefs.value.set(rowInfo.key, el2);
54864
+ }
54865
+ }
54866
+ function setSubComponentRef(el2, subRowInfo, rowIndex, colIndex, subIndex) {
54867
+ if (el2 && subRowInfo.key) {
54868
+ subRowInfo.ref = el2;
54869
+ componentRefs.value.set(subRowInfo.key, el2);
54870
+ }
54871
+ }
54872
+ function getFormNodeRefByKey(key) {
54873
+ return componentRefs.value.get(key) || null;
54874
+ }
54859
54875
  onMounted(() => {
54860
54876
  var _a3;
54861
54877
  if (props.rows && props.rows.length > 0) {
@@ -55333,11 +55349,16 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55333
55349
  }
55334
55350
  }
55335
55351
  __expose({
55336
- // 核心功能
55352
+ // 核心功能:获取表单实例ref
55337
55353
  getFormNodeByKey,
55354
+ // 核心功能:获取表单KV数据
55338
55355
  getFormKvData,
55356
+ // 核心功能:设置表单详情数据
55339
55357
  setFormData,
55358
+ // 核心功能:重置表单
55340
55359
  resetForm,
55360
+ // 核心功能:获取组件实例
55361
+ getFormNodeRefByKey,
55341
55362
  // 可选
55342
55363
  initDefaultValues,
55343
55364
  getReadOnlyDisplayValue
@@ -55431,7 +55452,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55431
55452
  props.model.indexOf("table") > -1 ? "model-table" : ""
55432
55453
  ])
55433
55454
  }, [
55434
- (openBlock(), createBlock(resolveDynamicComponent(subRowInfo.component), mergeProps({ ref_for: true }, subRowInfo.params, { rowData: subRowInfo }), createSlots({ _: 2 }, [
55455
+ (openBlock(), createBlock(resolveDynamicComponent(subRowInfo.component), mergeProps({ ref_for: true }, subRowInfo.params, {
55456
+ rowData: subRowInfo,
55457
+ ref_for: true,
55458
+ ref: (el2) => setSubComponentRef(el2, subRowInfo)
55459
+ }), createSlots({ _: 2 }, [
55435
55460
  renderList(subRowInfo.slots || {}, (slot, slotName) => {
55436
55461
  return {
55437
55462
  name: slotName,
@@ -55516,6 +55541,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55516
55541
  "onUpdate:modelValue": ($event) => rowInfo.value = $event
55517
55542
  }, toHandlers(rowInfo.events), {
55518
55543
  rowData: rowInfo,
55544
+ ref_for: true,
55545
+ ref: (el2) => setComponentRef(el2, rowInfo),
55519
55546
  class: "elementplus-component-item"
55520
55547
  }), createSlots({ _: 2 }, [
55521
55548
  renderList(rowInfo.slots || {}, (slot, slotName) => {
@@ -55541,6 +55568,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55541
55568
  "onUpdate:modelValue": ($event) => rowInfo.value = $event
55542
55569
  }, toHandlers(rowInfo.events), {
55543
55570
  rowData: rowInfo,
55571
+ ref_for: true,
55572
+ ref: (el2) => setComponentRef(el2, rowInfo),
55544
55573
  class: "elementplus-component-item"
55545
55574
  }), createSlots({ _: 2 }, [
55546
55575
  renderList(rowInfo.slots || {}, (slot, slotName) => {
@@ -55566,6 +55595,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55566
55595
  "onUpdate:modelValue": ($event) => rowInfo.value = $event
55567
55596
  }, toHandlers(rowInfo.events), {
55568
55597
  rowData: rowInfo,
55598
+ ref_for: true,
55599
+ ref: (el2) => setComponentRef(el2, rowInfo),
55569
55600
  class: "elementplus-component-item"
55570
55601
  }), createSlots({ _: 2 }, [
55571
55602
  renderList(rowInfo.slots || {}, (slot, slotName) => {
@@ -55591,6 +55622,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55591
55622
  "onUpdate:modelValue": ($event) => rowInfo.value = $event
55592
55623
  }, toHandlers(rowInfo.events), {
55593
55624
  rowData: rowInfo,
55625
+ ref_for: true,
55626
+ ref: (el2) => setComponentRef(el2, rowInfo),
55594
55627
  class: "elementplus-component-item"
55595
55628
  }), createSlots({ _: 2 }, [
55596
55629
  renderList(rowInfo.slots || {}, (slot, slotName) => {
@@ -55621,7 +55654,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55621
55654
  };
55622
55655
  }
55623
55656
  });
55624
- const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1cbe3748"]]);
55657
+ const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-fbb893d9"]]);
55625
55658
  const _hoisted_1$1 = { class: "title-image-view" };
55626
55659
  const _hoisted_2 = { class: "content-model-title" };
55627
55660
  const _hoisted_3 = { class: "title-text" };
@@ -55711,6 +55744,27 @@ function getAllFormNodeByKey(rows, key) {
55711
55744
  }
55712
55745
  return null;
55713
55746
  }
55747
+ function getAllFormNodeRefByKey(rows, key) {
55748
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
55749
+ const row = rows[rowIndex];
55750
+ for (let colIndex = 0; colIndex < row.length; colIndex++) {
55751
+ const item = row[colIndex];
55752
+ if (item.key === key) {
55753
+ return item.ref || null;
55754
+ }
55755
+ if (item.children && Array.isArray(item.children)) {
55756
+ for (let childIndex = 0; childIndex < item.children.length; childIndex++) {
55757
+ const child = item.children[childIndex];
55758
+ if (child.key === key) {
55759
+ return child.ref || null;
55760
+ }
55761
+ }
55762
+ }
55763
+ }
55764
+ }
55765
+ return null;
55766
+ }
55767
+ globalThis.getAllFormNodeRefByKey = getAllFormNodeRefByKey;
55714
55768
  globalThis.getAllFormNodeByKey = getAllFormNodeByKey;
55715
55769
  globalThis.getAllFormKvData = getAllFormKvData;
55716
55770
  const ir = Math.min, L0 = Math.max, Rr = Math.round, Ot = (e6) => ({