matrix_components 2.0.364 → 2.0.366

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.
@@ -7207,7 +7207,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
7207
7207
  withDirectives((openBlock(), createElementBlock("span", {
7208
7208
  class: normalizeClass(["tree-node-title", { "tree-node-playing": checkTreeNodeIsPlayHandler(data) }])
7209
7209
  }, [
7210
- createTextVNode(toDisplayString(node[__props.treeOptions.label]), 1)
7210
+ createTextVNode(toDisplayString(data[__props.treeOptions.label]), 1)
7211
7211
  ], 2)), [
7212
7212
  [_directive_sline]
7213
7213
  ])
@@ -7254,7 +7254,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
7254
7254
  };
7255
7255
  }
7256
7256
  });
7257
- const NsVideo = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-675ac530"]]);
7257
+ const NsVideo = /* @__PURE__ */ _export_sfc(_sfc_main$b, [["__scopeId", "data-v-fea618e6"]]);
7258
7258
  function registerDirective(app2) {
7259
7259
  app2.directive("sline", {
7260
7260
  mounted(el2) {
@@ -54753,21 +54753,109 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
54753
54753
  },
54754
54754
  setup(__props, { expose: __expose }) {
54755
54755
  useCssVars((_ctx) => ({
54756
- "v37afa004": customBackgroundColor.value,
54757
- "v837cf940": gapV.value,
54758
- "v0b770c26": superLabelWidth.value,
54759
- "dba2e31c": subLabelWidth.value,
54760
- "v35d88047": height.value,
54761
- "v43e7535c": labelWidth.value,
54762
- "v6d879d11": _ctx.$props.labelColor
54756
+ "v52fd60ba": customBackgroundColor.value,
54757
+ "v306705e1": gapV.value,
54758
+ "v457e0ccc": superLabelWidth.value,
54759
+ "v1e1d4d11": subLabelWidth.value,
54760
+ "v96b132f0": height.value,
54761
+ "v1ae797da": labelWidth.value,
54762
+ "v5eb017a0": _ctx.$props.labelColor
54763
54763
  }));
54764
54764
  const props = __props;
54765
+ const initialValues = ref$1(/* @__PURE__ */ new Map());
54765
54766
  const customBackgroundColor = computed(() => {
54766
54767
  if (props.model === "vertical") {
54767
54768
  return props.backgroundColor || "#eef4fb";
54768
54769
  }
54769
54770
  return "transparent";
54770
54771
  });
54772
+ function deepClone(obj) {
54773
+ if (obj === null || typeof obj !== "object") {
54774
+ return obj;
54775
+ }
54776
+ if (obj instanceof Date) {
54777
+ return new Date(obj.getTime());
54778
+ }
54779
+ if (obj instanceof Array) {
54780
+ return obj.map((item) => deepClone(item));
54781
+ }
54782
+ if (typeof obj === "object") {
54783
+ const cloned = {};
54784
+ for (const key in obj) {
54785
+ if (obj.hasOwnProperty(key)) {
54786
+ cloned[key] = deepClone(obj[key]);
54787
+ }
54788
+ }
54789
+ return cloned;
54790
+ }
54791
+ return obj;
54792
+ }
54793
+ function initializeDefaultValues(rows) {
54794
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
54795
+ const row = rows[rowIndex];
54796
+ for (let colIndex = 0; colIndex < row.length; colIndex++) {
54797
+ const item = row[colIndex];
54798
+ if (item.key && item.defaultValue === void 0) {
54799
+ item.defaultValue = deepClone(item.value);
54800
+ }
54801
+ if (item.children && Array.isArray(item.children)) {
54802
+ for (let childIndex = 0; childIndex < item.children.length; childIndex++) {
54803
+ const child = item.children[childIndex];
54804
+ if (child.key && child.defaultValue === void 0) {
54805
+ child.defaultValue = deepClone(child.value);
54806
+ }
54807
+ }
54808
+ }
54809
+ }
54810
+ }
54811
+ }
54812
+ function saveInitialValues(rows) {
54813
+ initialValues.value.clear();
54814
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
54815
+ const row = rows[rowIndex];
54816
+ for (let colIndex = 0; colIndex < row.length; colIndex++) {
54817
+ const item = row[colIndex];
54818
+ if (item.key) {
54819
+ if (item.defaultValue === void 0) {
54820
+ item.defaultValue = deepClone(item.value);
54821
+ }
54822
+ initialValues.value.set(item.key, deepClone(item.value));
54823
+ if (item.delValue !== void 0) {
54824
+ initialValues.value.set(`${item.key}_delValue`, deepClone(item.delValue));
54825
+ }
54826
+ }
54827
+ if (item.children && Array.isArray(item.children)) {
54828
+ for (let childIndex = 0; childIndex < item.children.length; childIndex++) {
54829
+ const child = item.children[childIndex];
54830
+ if (child.key) {
54831
+ if (child.defaultValue === void 0) {
54832
+ child.defaultValue = deepClone(child.value);
54833
+ }
54834
+ initialValues.value.set(child.key, deepClone(child.value));
54835
+ if (child.delValue !== void 0) {
54836
+ initialValues.value.set(`${child.key}_delValue`, deepClone(child.delValue));
54837
+ }
54838
+ }
54839
+ }
54840
+ }
54841
+ }
54842
+ }
54843
+ }
54844
+ onMounted(() => {
54845
+ if (props.rows && props.rows.length > 0) {
54846
+ initializeDefaultValues(props.rows);
54847
+ }
54848
+ });
54849
+ watch(
54850
+ () => props.rows,
54851
+ (newRows) => {
54852
+ if (newRows && newRows.length > 0) {
54853
+ initializeDefaultValues(newRows);
54854
+ saveInitialValues(newRows);
54855
+ }
54856
+ },
54857
+ { immediate: true, deep: true }
54858
+ );
54771
54859
  function checkIsElempentComponent(rowInfo, name = "el") {
54772
54860
  if (rowInfo.component) {
54773
54861
  return (rowInfo.component.name + "").toLowerCase().startsWith(name);
@@ -54905,7 +54993,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
54905
54993
  { immediate: true }
54906
54994
  );
54907
54995
  function getRowItemStyle(row, rowInfo, rowInfoIndex) {
54908
- let _gapH = gapH.value;
54996
+ const _gapH = gapH.value;
54909
54997
  if (rowInfo.span && (rowInfo.span + "").indexOf("%") > -1) {
54910
54998
  return rowInfo.span;
54911
54999
  }
@@ -55013,9 +55101,66 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55013
55101
  }
55014
55102
  return result;
55015
55103
  }
55104
+ function resetForm() {
55105
+ const rows = props.rows;
55106
+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
55107
+ const row = rows[rowIndex];
55108
+ for (let colIndex = 0; colIndex < row.length; colIndex++) {
55109
+ const item = row[colIndex];
55110
+ if (item.key) {
55111
+ if (item.defaultValue !== void 0) {
55112
+ item.value = deepClone(item.defaultValue);
55113
+ } else {
55114
+ if (Array.isArray(item.value)) {
55115
+ item.value = [];
55116
+ } else if (typeof item.value === "number") {
55117
+ item.value = 0;
55118
+ } else if (typeof item.value === "boolean") {
55119
+ item.value = false;
55120
+ } else {
55121
+ item.value = "";
55122
+ }
55123
+ }
55124
+ if (item.delValue !== void 0) {
55125
+ item.delValue = [];
55126
+ }
55127
+ }
55128
+ if (item.children && Array.isArray(item.children)) {
55129
+ for (let childIndex = 0; childIndex < item.children.length; childIndex++) {
55130
+ const child = item.children[childIndex];
55131
+ if (child.key) {
55132
+ if (child.defaultValue !== void 0) {
55133
+ child.value = deepClone(child.defaultValue);
55134
+ } else {
55135
+ if (Array.isArray(child.value)) {
55136
+ child.value = [];
55137
+ } else if (typeof child.value === "number") {
55138
+ child.value = 0;
55139
+ } else if (typeof child.value === "boolean") {
55140
+ child.value = false;
55141
+ } else {
55142
+ child.value = "";
55143
+ }
55144
+ }
55145
+ if (child.delValue !== void 0) {
55146
+ child.delValue = [];
55147
+ }
55148
+ }
55149
+ }
55150
+ }
55151
+ }
55152
+ }
55153
+ }
55154
+ function initDefaultValues() {
55155
+ if (props.rows && props.rows.length > 0) {
55156
+ initializeDefaultValues(props.rows);
55157
+ }
55158
+ }
55016
55159
  __expose({
55160
+ getNodeByKey,
55017
55161
  getKeyValuePairs,
55018
- getNodeByKey
55162
+ resetForm,
55163
+ initDefaultValues
55019
55164
  });
55020
55165
  return (_ctx, _cache) => {
55021
55166
  const _component_el_tooltip = resolveComponent("el-tooltip");
@@ -55174,7 +55319,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55174
55319
  ])
55175
55320
  }, [
55176
55321
  createVNode(_component_el_form_item, {
55177
- class: normalizeClass(["component-form-item", __props.readOnly && isUploadComponent(rowInfo) ? "hidden" : ""]),
55322
+ class: normalizeClass([
55323
+ "component-form-item",
55324
+ __props.readOnly && isUploadComponent(rowInfo) ? "hidden" : ""
55325
+ ]),
55178
55326
  label: rowInfo.label,
55179
55327
  prop: `${props.formPropKey}.${index2}.${_index}.value`,
55180
55328
  rules: ((_a4 = rowInfo == null ? void 0 : rowInfo.params) == null ? void 0 : _a4.rules) || []
@@ -55293,7 +55441,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55293
55441
  };
55294
55442
  }
55295
55443
  });
55296
- const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c2469310"]]);
55444
+ const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-d2276c6a"]]);
55297
55445
  const _hoisted_1$1 = { class: "title-image-view" };
55298
55446
  const _hoisted_2 = { class: "content-model-title" };
55299
55447
  const _hoisted_3 = { class: "title-text" };