matrix_components 2.0.390 → 2.0.392

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,13 +54768,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
54768
54768
  },
54769
54769
  setup(__props, { expose: __expose }) {
54770
54770
  useCssVars((_ctx) => ({
54771
- "v43a69490": customBackgroundColor.value,
54772
- "ffa39558": gapV.value,
54773
- "v3580c779": superLabelWidth.value,
54774
- "v520e6204": subLabelWidth.value,
54775
- "v2f60853b": height.value,
54776
- "v1960c146": labelWidth.value,
54777
- "v6a3290c6": _ctx.$props.labelColor
54771
+ "v664889ea": customBackgroundColor.value,
54772
+ "v7360850e": gapV.value,
54773
+ "v0571b398": superLabelWidth.value,
54774
+ "v38ada079": subLabelWidth.value,
54775
+ "v73409820": height.value,
54776
+ "v7782d9ab": labelWidth.value,
54777
+ "v8adf58d0": _ctx.$props.labelColor
54778
54778
  }));
54779
54779
  const props = __props;
54780
54780
  const initialValues = ref$1(/* @__PURE__ */ new Map());
@@ -55136,6 +55136,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55136
55136
  for (let colIndex = 0; colIndex < row.length; colIndex++) {
55137
55137
  const item = row[colIndex];
55138
55138
  if (item.key) {
55139
+ const oldValue = deepClone(item.value);
55139
55140
  if (item.defaultValue !== void 0) {
55140
55141
  item.value = deepClone(item.defaultValue);
55141
55142
  } else {
@@ -55152,11 +55153,24 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55152
55153
  if (item.delValue !== void 0) {
55153
55154
  item.delValue = [];
55154
55155
  }
55156
+ if (JSON.stringify(oldValue) !== JSON.stringify(item.value) && item.events) {
55157
+ if (item.events.change && typeof item.events.change === "function") {
55158
+ setTimeout(() => {
55159
+ item.events.change(item.value);
55160
+ }, 0);
55161
+ }
55162
+ if (item.events.input && typeof item.events.input === "function") {
55163
+ setTimeout(() => {
55164
+ item.events.input(item.value);
55165
+ }, 0);
55166
+ }
55167
+ }
55155
55168
  }
55156
55169
  if (item.children && Array.isArray(item.children)) {
55157
55170
  for (let childIndex = 0; childIndex < item.children.length; childIndex++) {
55158
55171
  const child = item.children[childIndex];
55159
55172
  if (child.key) {
55173
+ const oldChildValue = deepClone(child.value);
55160
55174
  if (child.defaultValue !== void 0) {
55161
55175
  child.value = deepClone(child.defaultValue);
55162
55176
  } else {
@@ -55173,6 +55187,18 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55173
55187
  if (child.delValue !== void 0) {
55174
55188
  child.delValue = [];
55175
55189
  }
55190
+ if (JSON.stringify(oldChildValue) !== JSON.stringify(child.value) && child.events) {
55191
+ if (child.events.change && typeof child.events.change === "function") {
55192
+ setTimeout(() => {
55193
+ child.events.change(child.value);
55194
+ }, 0);
55195
+ }
55196
+ if (child.events.input && typeof child.events.input === "function") {
55197
+ setTimeout(() => {
55198
+ child.events.input(child.value);
55199
+ }, 0);
55200
+ }
55201
+ }
55176
55202
  }
55177
55203
  }
55178
55204
  }
@@ -55185,7 +55211,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55185
55211
  }
55186
55212
  }
55187
55213
  function getReadOnlyDisplayValue(rowInfo) {
55188
- var _a3, _b, _c2;
55214
+ var _a3, _b, _c2, _d, _e, _f;
55189
55215
  if (!props.readOnly) {
55190
55216
  return rowInfo.value;
55191
55217
  }
@@ -55210,6 +55236,26 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55210
55236
  return selectedOption ? selectedOption[labelKey] : rowInfo.value;
55211
55237
  }
55212
55238
  }
55239
+ if (rowInfo.component && rowInfo.component.name && (rowInfo.component.name + "").toLowerCase().indexOf("switch") !== -1) {
55240
+ if (rowInfo.value) {
55241
+ return ((_d = rowInfo.params) == null ? void 0 : _d["active-text"]) || "启用";
55242
+ } else {
55243
+ return ((_e = rowInfo.params) == null ? void 0 : _e["inactive-text"]) || "禁用";
55244
+ }
55245
+ }
55246
+ if (rowInfo.component && rowInfo.component.name && (rowInfo.component.name + "").toLowerCase().indexOf("rate") !== -1) {
55247
+ const max2 = ((_f = rowInfo.params) == null ? void 0 : _f.max) || 5;
55248
+ return `${rowInfo.value || 0}/${max2}`;
55249
+ }
55250
+ if (rowInfo.component && rowInfo.component.name && (rowInfo.component.name + "").toLowerCase().indexOf("slider") !== -1) {
55251
+ if (Array.isArray(rowInfo.value)) {
55252
+ return `${rowInfo.value[0]} - ${rowInfo.value[1]}`;
55253
+ }
55254
+ return rowInfo.value || 0;
55255
+ }
55256
+ if (rowInfo.component && rowInfo.component.name && (rowInfo.component.name + "").toLowerCase().indexOf("colorpicker") !== -1) {
55257
+ return rowInfo.value || "";
55258
+ }
55213
55259
  return rowInfo.value;
55214
55260
  }
55215
55261
  const getComponentValue = computed(() => {
@@ -55262,10 +55308,37 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55262
55308
  const label = findOptionInTree(options, rowInfo.value);
55263
55309
  return label || rowInfo.value;
55264
55310
  }
55311
+ function setFormData(data, triggerEvents = false) {
55312
+ if (!data || typeof data !== "object") {
55313
+ console.warn("setFormData: 参数必须是一个对象");
55314
+ return;
55315
+ }
55316
+ for (const [key, value] of Object.entries(data)) {
55317
+ const node = getFormNodeByKey(key);
55318
+ if (node) {
55319
+ node.value = value;
55320
+ if (triggerEvents && node.events) {
55321
+ if (node.events.change && typeof node.events.change === "function") {
55322
+ setTimeout(() => {
55323
+ node.events.change(value);
55324
+ }, 0);
55325
+ }
55326
+ if (node.events.input && typeof node.events.input === "function") {
55327
+ setTimeout(() => {
55328
+ node.events.input(value);
55329
+ }, 0);
55330
+ }
55331
+ }
55332
+ }
55333
+ }
55334
+ }
55265
55335
  __expose({
55336
+ // 核心功能
55266
55337
  getFormNodeByKey,
55267
55338
  getFormKvData,
55339
+ setFormData,
55268
55340
  resetForm,
55341
+ // 可选
55269
55342
  initDefaultValues,
55270
55343
  getReadOnlyDisplayValue
55271
55344
  });
@@ -55403,7 +55476,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55403
55476
  createVNode(_component_el_tooltip, {
55404
55477
  "hide-after": 0,
55405
55478
  "show-after": 500,
55406
- disabled: !(__props.readOnly && !rowInfo.readOnlyUseComponent),
55479
+ disabled: !(__props.readOnly && (!isUploadComponent(rowInfo) && !rowInfo.readOnlyUseComponent)),
55407
55480
  content: getComponentValue.value(rowInfo),
55408
55481
  placement: "top-start",
55409
55482
  "popper-class": "detail-view-tooltip"
@@ -55548,7 +55621,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55548
55621
  };
55549
55622
  }
55550
55623
  });
55551
- const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-28d91da1"]]);
55624
+ const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-8283b143"]]);
55552
55625
  const _hoisted_1$1 = { class: "title-image-view" };
55553
55626
  const _hoisted_2 = { class: "content-model-title" };
55554
55627
  const _hoisted_3 = { class: "title-text" };