matrix_components 2.0.385 → 2.0.387

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
- "v559d034a": customBackgroundColor.value,
54772
- "v0bb2d35a": gapV.value,
54773
- "v3c916c9a": superLabelWidth.value,
54774
- "v0d7e97b8": subLabelWidth.value,
54775
- "v27948c7e": height.value,
54776
- "v47dc42cc": labelWidth.value,
54777
- "v43859357": _ctx.$props.labelColor
54771
+ "d86e963a": customBackgroundColor.value,
54772
+ "v29bb78a1": gapV.value,
54773
+ "v5eeb3be8": superLabelWidth.value,
54774
+ "v4ebdf251": subLabelWidth.value,
54775
+ "aaabad70": height.value,
54776
+ "v6020d25a": labelWidth.value,
54777
+ "v6c180d20": _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
  }
@@ -55184,11 +55210,110 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55184
55210
  initializeDefaultValues(props.rows);
55185
55211
  }
55186
55212
  }
55213
+ function getReadOnlyDisplayValue(rowInfo) {
55214
+ var _a3, _b, _c2, _d, _e, _f;
55215
+ if (!props.readOnly) {
55216
+ return rowInfo.value;
55217
+ }
55218
+ if (rowInfo.component && ((_a3 = rowInfo.params) == null ? void 0 : _a3.options)) {
55219
+ const componentName = (rowInfo.component.name + "").replace("-", "").toLowerCase();
55220
+ if (componentName.indexOf("cascader") !== -1) {
55221
+ return getCascaderDisplayValue(rowInfo);
55222
+ }
55223
+ const isSelectComponent = componentName.indexOf("select") !== -1 || componentName.indexOf("radio") !== -1 || componentName.indexOf("checkbox") !== -1;
55224
+ if (isSelectComponent) {
55225
+ const options = rowInfo.params.options;
55226
+ const valueKey = ((_b = rowInfo.params.props) == null ? void 0 : _b.value) || "value";
55227
+ const labelKey = ((_c2 = rowInfo.params.props) == null ? void 0 : _c2.label) || "label";
55228
+ if (Array.isArray(rowInfo.value)) {
55229
+ const selectedLabels = rowInfo.value.map((val) => {
55230
+ const option = options.find((opt) => opt[valueKey] === val);
55231
+ return option ? option[labelKey] : val;
55232
+ });
55233
+ return selectedLabels.join(",");
55234
+ }
55235
+ const selectedOption = options.find((opt) => opt[valueKey] === rowInfo.value);
55236
+ return selectedOption ? selectedOption[labelKey] : rowInfo.value;
55237
+ }
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
+ }
55259
+ return rowInfo.value;
55260
+ }
55261
+ const getComponentValue = computed(() => {
55262
+ return (rowInfo) => {
55263
+ const value = getReadOnlyDisplayValue(rowInfo);
55264
+ return value ?? props.valueEmptyTag ?? "";
55265
+ };
55266
+ });
55267
+ function getCascaderDisplayValue(rowInfo) {
55268
+ var _a3, _b, _c2, _d;
55269
+ if (!rowInfo.value || !((_a3 = rowInfo.params) == null ? void 0 : _a3.options)) {
55270
+ return rowInfo.value;
55271
+ }
55272
+ const options = rowInfo.params.options;
55273
+ const valueKey = ((_b = rowInfo.params.props) == null ? void 0 : _b.value) || "value";
55274
+ const labelKey = ((_c2 = rowInfo.params.props) == null ? void 0 : _c2.label) || "label";
55275
+ const childrenKey = ((_d = rowInfo.params.props) == null ? void 0 : _d.children) || "children";
55276
+ const separator = rowInfo.params.separator || " / ";
55277
+ if (Array.isArray(rowInfo.value)) {
55278
+ const labels = [];
55279
+ let currentOptions = options;
55280
+ for (const value of rowInfo.value) {
55281
+ const currentOption = currentOptions.find((opt) => opt[valueKey] === value);
55282
+ if (!currentOption) {
55283
+ return rowInfo.value.join(separator);
55284
+ }
55285
+ labels.push(currentOption[labelKey]);
55286
+ if (currentOption[childrenKey] && Array.isArray(currentOption[childrenKey])) {
55287
+ currentOptions = currentOption[childrenKey];
55288
+ } else {
55289
+ break;
55290
+ }
55291
+ }
55292
+ return labels.join(separator);
55293
+ }
55294
+ const findOptionInTree = (opts, targetValue) => {
55295
+ for (const option of opts) {
55296
+ if (option[valueKey] === targetValue) {
55297
+ return option[labelKey];
55298
+ }
55299
+ if (option[childrenKey] && Array.isArray(option[childrenKey])) {
55300
+ const result = findOptionInTree(option[childrenKey], targetValue);
55301
+ if (result) {
55302
+ return option[labelKey] + separator + result;
55303
+ }
55304
+ }
55305
+ }
55306
+ return null;
55307
+ };
55308
+ const label = findOptionInTree(options, rowInfo.value);
55309
+ return label || rowInfo.value;
55310
+ }
55187
55311
  __expose({
55188
55312
  getFormNodeByKey,
55189
55313
  getFormKvData,
55190
55314
  resetForm,
55191
- initDefaultValues
55315
+ initDefaultValues,
55316
+ getReadOnlyDisplayValue
55192
55317
  });
55193
55318
  return (_ctx, _cache) => {
55194
55319
  const _component_el_tooltip = resolveComponent("el-tooltip");
@@ -55324,8 +55449,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55324
55449
  createVNode(_component_el_tooltip, {
55325
55450
  "hide-after": 0,
55326
55451
  "show-after": 500,
55327
- disabled: !(__props.readOnly && !rowInfo.readOnlyUseComponent && typeof rowInfo.value === "string"),
55328
- content: rowInfo.value || "",
55452
+ disabled: !(__props.readOnly && !rowInfo.readOnlyUseComponent),
55453
+ content: getComponentValue.value(rowInfo),
55329
55454
  placement: "top-start",
55330
55455
  "popper-class": "detail-view-tooltip"
55331
55456
  }, {
@@ -55339,7 +55464,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55339
55464
  props.model.indexOf("table") > -1 ? "model-table" : "",
55340
55465
  props.model.indexOf("vertical") > -1 ? "vertical" : "horizontal"
55341
55466
  ])
55342
- }, toDisplayString(rowInfo.value ?? __props.valueEmptyTag ?? ""), 3)) : (openBlock(), createElementBlock("span", {
55467
+ }, toDisplayString(getComponentValue.value(rowInfo)), 3)) : (openBlock(), createElementBlock("span", {
55343
55468
  key: 1,
55344
55469
  class: normalizeClass([
55345
55470
  "detial-row-item-value",
@@ -55469,7 +55594,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
55469
55594
  };
55470
55595
  }
55471
55596
  });
55472
- const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e7f01e1e"]]);
55597
+ const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-99d9d615"]]);
55473
55598
  const _hoisted_1$1 = { class: "title-image-view" };
55474
55599
  const _hoisted_2 = { class: "content-model-title" };
55475
55600
  const _hoisted_3 = { class: "title-text" };