matrix_components 2.0.382 → 2.0.386
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.
- package/README.md +7 -0
- package/dist/api/types.d.ts +117 -0
- package/dist/matrix-components.d.ts +229 -0
- package/dist/matrix_components.css +1 -1
- package/dist/matrix_components.js +123 -16
- package/dist/matrix_components.umd.cjs +1 -1
- package/package.json +5 -1
|
@@ -54768,13 +54768,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
54768
54768
|
},
|
|
54769
54769
|
setup(__props, { expose: __expose }) {
|
|
54770
54770
|
useCssVars((_ctx) => ({
|
|
54771
|
-
"
|
|
54772
|
-
"
|
|
54773
|
-
"
|
|
54774
|
-
"
|
|
54775
|
-
"
|
|
54776
|
-
"
|
|
54777
|
-
"
|
|
54771
|
+
"v68e72f26": customBackgroundColor.value,
|
|
54772
|
+
"v5e1757d7": gapV.value,
|
|
54773
|
+
"v43d60516": superLabelWidth.value,
|
|
54774
|
+
"v51cacfdb": subLabelWidth.value,
|
|
54775
|
+
"v378b12fe": height.value,
|
|
54776
|
+
"v6b8e94ee": labelWidth.value,
|
|
54777
|
+
"ce39fc0c": _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,90 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
55184
55210
|
initializeDefaultValues(props.rows);
|
|
55185
55211
|
}
|
|
55186
55212
|
}
|
|
55213
|
+
function getReadOnlyDisplayValue(rowInfo) {
|
|
55214
|
+
var _a3, _b, _c2;
|
|
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
|
+
return rowInfo.value;
|
|
55240
|
+
}
|
|
55241
|
+
const getComponentValue = computed(() => {
|
|
55242
|
+
return (rowInfo) => {
|
|
55243
|
+
const value = getReadOnlyDisplayValue(rowInfo);
|
|
55244
|
+
return value ?? props.valueEmptyTag ?? "";
|
|
55245
|
+
};
|
|
55246
|
+
});
|
|
55247
|
+
function getCascaderDisplayValue(rowInfo) {
|
|
55248
|
+
var _a3, _b, _c2, _d;
|
|
55249
|
+
if (!rowInfo.value || !((_a3 = rowInfo.params) == null ? void 0 : _a3.options)) {
|
|
55250
|
+
return rowInfo.value;
|
|
55251
|
+
}
|
|
55252
|
+
const options = rowInfo.params.options;
|
|
55253
|
+
const valueKey = ((_b = rowInfo.params.props) == null ? void 0 : _b.value) || "value";
|
|
55254
|
+
const labelKey = ((_c2 = rowInfo.params.props) == null ? void 0 : _c2.label) || "label";
|
|
55255
|
+
const childrenKey = ((_d = rowInfo.params.props) == null ? void 0 : _d.children) || "children";
|
|
55256
|
+
const separator = rowInfo.params.separator || " / ";
|
|
55257
|
+
if (Array.isArray(rowInfo.value)) {
|
|
55258
|
+
const labels = [];
|
|
55259
|
+
let currentOptions = options;
|
|
55260
|
+
for (const value of rowInfo.value) {
|
|
55261
|
+
const currentOption = currentOptions.find((opt) => opt[valueKey] === value);
|
|
55262
|
+
if (!currentOption) {
|
|
55263
|
+
return rowInfo.value.join(separator);
|
|
55264
|
+
}
|
|
55265
|
+
labels.push(currentOption[labelKey]);
|
|
55266
|
+
if (currentOption[childrenKey] && Array.isArray(currentOption[childrenKey])) {
|
|
55267
|
+
currentOptions = currentOption[childrenKey];
|
|
55268
|
+
} else {
|
|
55269
|
+
break;
|
|
55270
|
+
}
|
|
55271
|
+
}
|
|
55272
|
+
return labels.join(separator);
|
|
55273
|
+
}
|
|
55274
|
+
const findOptionInTree = (opts, targetValue) => {
|
|
55275
|
+
for (const option of opts) {
|
|
55276
|
+
if (option[valueKey] === targetValue) {
|
|
55277
|
+
return option[labelKey];
|
|
55278
|
+
}
|
|
55279
|
+
if (option[childrenKey] && Array.isArray(option[childrenKey])) {
|
|
55280
|
+
const result = findOptionInTree(option[childrenKey], targetValue);
|
|
55281
|
+
if (result) {
|
|
55282
|
+
return option[labelKey] + separator + result;
|
|
55283
|
+
}
|
|
55284
|
+
}
|
|
55285
|
+
}
|
|
55286
|
+
return null;
|
|
55287
|
+
};
|
|
55288
|
+
const label = findOptionInTree(options, rowInfo.value);
|
|
55289
|
+
return label || rowInfo.value;
|
|
55290
|
+
}
|
|
55187
55291
|
__expose({
|
|
55188
55292
|
getFormNodeByKey,
|
|
55189
55293
|
getFormKvData,
|
|
55190
55294
|
resetForm,
|
|
55191
|
-
initDefaultValues
|
|
55295
|
+
initDefaultValues,
|
|
55296
|
+
getReadOnlyDisplayValue
|
|
55192
55297
|
});
|
|
55193
55298
|
return (_ctx, _cache) => {
|
|
55194
55299
|
const _component_el_tooltip = resolveComponent("el-tooltip");
|
|
@@ -55324,8 +55429,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
55324
55429
|
createVNode(_component_el_tooltip, {
|
|
55325
55430
|
"hide-after": 0,
|
|
55326
55431
|
"show-after": 500,
|
|
55327
|
-
disabled: !(__props.readOnly && !rowInfo.readOnlyUseComponent
|
|
55328
|
-
content:
|
|
55432
|
+
disabled: !(__props.readOnly && !rowInfo.readOnlyUseComponent),
|
|
55433
|
+
content: getComponentValue.value(rowInfo),
|
|
55329
55434
|
placement: "top-start",
|
|
55330
55435
|
"popper-class": "detail-view-tooltip"
|
|
55331
55436
|
}, {
|
|
@@ -55339,7 +55444,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
55339
55444
|
props.model.indexOf("table") > -1 ? "model-table" : "",
|
|
55340
55445
|
props.model.indexOf("vertical") > -1 ? "vertical" : "horizontal"
|
|
55341
55446
|
])
|
|
55342
|
-
}, toDisplayString(
|
|
55447
|
+
}, toDisplayString(getComponentValue.value(rowInfo)), 3)) : (openBlock(), createElementBlock("span", {
|
|
55343
55448
|
key: 1,
|
|
55344
55449
|
class: normalizeClass([
|
|
55345
55450
|
"detial-row-item-value",
|
|
@@ -55469,7 +55574,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
55469
55574
|
};
|
|
55470
55575
|
}
|
|
55471
55576
|
});
|
|
55472
|
-
const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-
|
|
55577
|
+
const NsForm = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-e87f3ad5"]]);
|
|
55473
55578
|
const _hoisted_1$1 = { class: "title-image-view" };
|
|
55474
55579
|
const _hoisted_2 = { class: "content-model-title" };
|
|
55475
55580
|
const _hoisted_3 = { class: "title-text" };
|
|
@@ -77352,7 +77457,7 @@ const get = async (url, params, base = "", customConfig = {}, errorCallback = nu
|
|
|
77352
77457
|
// 支持timeout等配置
|
|
77353
77458
|
});
|
|
77354
77459
|
};
|
|
77355
|
-
const post = (url, data = {},
|
|
77460
|
+
const post = (url, data = {}, base = "", customConfig = {}, errorCallback = null) => {
|
|
77356
77461
|
const baseUrl = base || getBaseUrl();
|
|
77357
77462
|
if (baseUrl.endsWith("/") || url.startsWith("/")) {
|
|
77358
77463
|
if (baseUrl.endsWith("/") && url.startsWith("/")) {
|
|
@@ -77363,6 +77468,7 @@ const post = (url, data = {}, contentType = null, base = "", customConfig = {},
|
|
|
77363
77468
|
} else {
|
|
77364
77469
|
url = baseUrl + "/" + url;
|
|
77365
77470
|
}
|
|
77471
|
+
const contentType = (customConfig == null ? void 0 : customConfig.contentType) || ContentTypeEnum.JSON;
|
|
77366
77472
|
return createAxiosInstance(customConfig, errorCallback)({
|
|
77367
77473
|
url,
|
|
77368
77474
|
// url: import.meta.env.VITE_BASE_URL + url,
|
|
@@ -77370,13 +77476,13 @@ const post = (url, data = {}, contentType = null, base = "", customConfig = {},
|
|
|
77370
77476
|
data: contentType == ContentTypeEnum.FORM_URLENCODED ? qs.stringify(data) : data,
|
|
77371
77477
|
headers: {
|
|
77372
77478
|
// 如果没有指定 headersType,则默认使用 JSON 类型
|
|
77373
|
-
"Content-Type": contentType
|
|
77479
|
+
"Content-Type": contentType
|
|
77374
77480
|
},
|
|
77375
77481
|
...customConfig
|
|
77376
77482
|
// 支持timeout等配置
|
|
77377
77483
|
});
|
|
77378
77484
|
};
|
|
77379
|
-
const put = (url, data = {},
|
|
77485
|
+
const put = (url, data = {}, base = "", customConfig = {}, errorCallback = null) => {
|
|
77380
77486
|
const baseUrl = base || getBaseUrl();
|
|
77381
77487
|
if (baseUrl.endsWith("/") || url.startsWith("/")) {
|
|
77382
77488
|
if (baseUrl.endsWith("/") && url.startsWith("/")) {
|
|
@@ -77387,10 +77493,11 @@ const put = (url, data = {}, headersType = null, base = "", customConfig = {}, e
|
|
|
77387
77493
|
} else {
|
|
77388
77494
|
url = baseUrl + "/" + url;
|
|
77389
77495
|
}
|
|
77496
|
+
const contentType = (customConfig == null ? void 0 : customConfig.contentType) || ContentTypeEnum.JSON;
|
|
77390
77497
|
return createAxiosInstance(customConfig, errorCallback).put(url, data, {
|
|
77391
77498
|
headers: {
|
|
77392
77499
|
// 如果没有指定 headersType,则默认使用 JSON 类型
|
|
77393
|
-
"Content-Type":
|
|
77500
|
+
"Content-Type": contentType
|
|
77394
77501
|
},
|
|
77395
77502
|
...customConfig
|
|
77396
77503
|
// 支持timeout等配置
|