starfish-form-custom 1.0.46 → 1.0.48
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/dist/{formAction-b76664af.mjs → formAction-8f689053.mjs} +1 -1
- package/dist/{index-d1c1ba4b.mjs → index-3c21357b.mjs} +2 -2
- package/dist/index-5ee7ae61.mjs +240 -0
- package/dist/{index-7fc8db96.mjs → index-ec5813e3.mjs} +1 -1
- package/dist/{main-d99755be.mjs → main-aab412b3.mjs} +111 -55
- package/dist/{starfish-form-0baee1df.mjs → starfish-form-a750924c.mjs} +1 -1
- package/dist/starfish-form.mjs +1 -1
- package/dist/style.css +5 -5
- package/package.json +1 -1
- package/src/components/CheckBox/index.vue +35 -2
- package/src/components/Radio/index.vue +22 -10
- package/src/components/RichText/index.vue +194 -42
- package/src/components/Rule/rules.js +9 -4
- package/src/components/Selected/index.vue +26 -2
- package/src/components/Selecteds/index.vue +23 -23
- package/src/components/Switch/index.vue +22 -3
- package/stats.html +1 -1
- package/dist/index-0aa74f91.mjs +0 -133
|
@@ -1109,7 +1109,7 @@ const _hoisted_1$p = {
|
|
|
1109
1109
|
key: 0,
|
|
1110
1110
|
class: "item_require"
|
|
1111
1111
|
};
|
|
1112
|
-
const _hoisted_2$
|
|
1112
|
+
const _hoisted_2$f = { class: "keyValueSelect" };
|
|
1113
1113
|
const _hoisted_3$3 = { class: "keyValueInput" };
|
|
1114
1114
|
const _hoisted_4$1 = { class: "inputItem" };
|
|
1115
1115
|
const _hoisted_5$1 = { class: "inputItem" };
|
|
@@ -1157,7 +1157,7 @@ function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1157
1157
|
class: "starfish-keyValueItem",
|
|
1158
1158
|
key: index
|
|
1159
1159
|
}, [
|
|
1160
|
-
createElementVNode("div", _hoisted_2$
|
|
1160
|
+
createElementVNode("div", _hoisted_2$f, [
|
|
1161
1161
|
createVNode(_component_el_checkbox, {
|
|
1162
1162
|
modelValue: items.select,
|
|
1163
1163
|
"onUpdate:modelValue": ($event) => items.select = $event,
|
|
@@ -1338,7 +1338,7 @@ const _hoisted_1$o = {
|
|
|
1338
1338
|
key: 0,
|
|
1339
1339
|
class: "item_require"
|
|
1340
1340
|
};
|
|
1341
|
-
const _hoisted_2$
|
|
1341
|
+
const _hoisted_2$e = { class: "keyValueSelect" };
|
|
1342
1342
|
const _hoisted_3$2 = { class: "keyValueInput" };
|
|
1343
1343
|
const _hoisted_4 = { class: "inputItem" };
|
|
1344
1344
|
const _hoisted_5 = { class: "inputItem" };
|
|
@@ -1386,7 +1386,7 @@ function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1386
1386
|
class: "starfish-keyValueItem",
|
|
1387
1387
|
key: index
|
|
1388
1388
|
}, [
|
|
1389
|
-
createElementVNode("div", _hoisted_2$
|
|
1389
|
+
createElementVNode("div", _hoisted_2$e, [
|
|
1390
1390
|
createVNode(_component_el_checkbox, {
|
|
1391
1391
|
modelValue: items.select,
|
|
1392
1392
|
"onUpdate:modelValue": ($event) => items.select = $event,
|
|
@@ -1981,7 +1981,7 @@ const _sfc_main$l = defineComponent({
|
|
|
1981
1981
|
}
|
|
1982
1982
|
});
|
|
1983
1983
|
const _hoisted_1$l = { class: "label" };
|
|
1984
|
-
const _hoisted_2$
|
|
1984
|
+
const _hoisted_2$d = {
|
|
1985
1985
|
key: 0,
|
|
1986
1986
|
class: "item_require"
|
|
1987
1987
|
};
|
|
@@ -1995,7 +1995,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1995
1995
|
}, [
|
|
1996
1996
|
createElementVNode("div", _hoisted_1$l, [
|
|
1997
1997
|
createElementVNode("label", null, toDisplayString(_ctx.item.data.label), 1),
|
|
1998
|
-
_ctx.item.data.required ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
1998
|
+
_ctx.item.data.required ? (openBlock(), createElementBlock("span", _hoisted_2$d, "*")) : createCommentVNode("", true),
|
|
1999
1999
|
_ctx.item.data.tip ? (openBlock(), createBlock(_component_el_tooltip, {
|
|
2000
2000
|
key: 1,
|
|
2001
2001
|
class: "item",
|
|
@@ -2051,13 +2051,34 @@ const _sfc_main$k = defineComponent({
|
|
|
2051
2051
|
actionType: ["onChange"],
|
|
2052
2052
|
setup(props) {
|
|
2053
2053
|
useWatch(props);
|
|
2054
|
+
},
|
|
2055
|
+
methods: {
|
|
2056
|
+
getDisplayText() {
|
|
2057
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
2058
|
+
const items = this.item.data.itemConfig?.items || [];
|
|
2059
|
+
if (!fieldValue && fieldValue !== 0 && fieldValue !== false) {
|
|
2060
|
+
return "--";
|
|
2061
|
+
}
|
|
2062
|
+
if (Array.isArray(fieldValue)) {
|
|
2063
|
+
if (fieldValue.length === 0)
|
|
2064
|
+
return "--";
|
|
2065
|
+
const selectedLabels = fieldValue.map((value) => {
|
|
2066
|
+
const item = items.find((item2) => item2.value === value);
|
|
2067
|
+
return item ? item.label : value;
|
|
2068
|
+
});
|
|
2069
|
+
return selectedLabels.join(", ");
|
|
2070
|
+
} else {
|
|
2071
|
+
const item = items.find((item2) => item2.value === fieldValue);
|
|
2072
|
+
return item ? item.label : fieldValue;
|
|
2073
|
+
}
|
|
2074
|
+
}
|
|
2054
2075
|
}
|
|
2055
2076
|
});
|
|
2056
2077
|
const _hoisted_1$k = {
|
|
2057
2078
|
key: 0,
|
|
2058
2079
|
class: "item_require"
|
|
2059
2080
|
};
|
|
2060
|
-
const _hoisted_2$
|
|
2081
|
+
const _hoisted_2$c = { key: 0 };
|
|
2061
2082
|
function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2062
2083
|
const _component_el_tooltip = ElTooltip;
|
|
2063
2084
|
const _component_el_checkbox = ElCheckbox;
|
|
@@ -2088,7 +2109,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2088
2109
|
class: "control",
|
|
2089
2110
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
2090
2111
|
}, [
|
|
2091
|
-
!_ctx.drag &&
|
|
2112
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$c, toDisplayString(_ctx.getDisplayText()), 1)) : !_ctx.drag && _ctx.data[_ctx.item.data.fieldName] ? (openBlock(), createBlock(_component_el_checkbox_group, {
|
|
2092
2113
|
key: 1,
|
|
2093
2114
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2094
2115
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -2164,7 +2185,7 @@ const _hoisted_1$j = {
|
|
|
2164
2185
|
key: 0,
|
|
2165
2186
|
class: "item_require"
|
|
2166
2187
|
};
|
|
2167
|
-
const _hoisted_2$
|
|
2188
|
+
const _hoisted_2$b = { key: 0 };
|
|
2168
2189
|
const _hoisted_3 = { key: 1 };
|
|
2169
2190
|
function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2170
2191
|
const _component_el_tooltip = ElTooltip;
|
|
@@ -2196,7 +2217,7 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2196
2217
|
class: "control",
|
|
2197
2218
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
2198
2219
|
}, [
|
|
2199
|
-
_ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_2$
|
|
2220
|
+
_ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_2$b, [
|
|
2200
2221
|
createVNode(_component_el_input, {
|
|
2201
2222
|
modelValue: _ctx.item.data.default,
|
|
2202
2223
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.item.data.default = $event),
|
|
@@ -2301,7 +2322,7 @@ const _hoisted_1$i = {
|
|
|
2301
2322
|
key: 0,
|
|
2302
2323
|
class: "item_require"
|
|
2303
2324
|
};
|
|
2304
|
-
const _hoisted_2$
|
|
2325
|
+
const _hoisted_2$a = { key: 1 };
|
|
2305
2326
|
function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2306
2327
|
const _component_el_tooltip = ElTooltip;
|
|
2307
2328
|
const _component_el_date_picker = ElDatePicker;
|
|
@@ -2344,7 +2365,7 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2344
2365
|
disabled: _ctx.item.data.state === "disabled",
|
|
2345
2366
|
readonly: _ctx.item.data.state === "readonly"
|
|
2346
2367
|
}, null, 8, ["modelValue", "type", "format", "value-format", "placeholder", "size", "disabled", "readonly"])) : createCommentVNode("", true),
|
|
2347
|
-
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
2368
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$a, toDisplayString(_ctx.formatReadonlyDate(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.format)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
2348
2369
|
key: 2,
|
|
2349
2370
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2350
2371
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -2418,7 +2439,7 @@ const _hoisted_1$h = {
|
|
|
2418
2439
|
key: 0,
|
|
2419
2440
|
class: "item_require"
|
|
2420
2441
|
};
|
|
2421
|
-
const _hoisted_2$
|
|
2442
|
+
const _hoisted_2$9 = { key: 1 };
|
|
2422
2443
|
function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2423
2444
|
const _component_el_tooltip = ElTooltip;
|
|
2424
2445
|
const _component_el_date_picker = ElDatePicker;
|
|
@@ -2458,7 +2479,7 @@ function _sfc_render$h(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2458
2479
|
disabled: _ctx.item.data.state === "disabled",
|
|
2459
2480
|
readonly: _ctx.item.data.state === "readonly"
|
|
2460
2481
|
}, null, 8, ["modelValue", "placeholder", "size", "disabled", "readonly"])) : createCommentVNode("", true),
|
|
2461
|
-
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
2482
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(_ctx.formatReadonlyDate(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.format)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
2462
2483
|
key: 2,
|
|
2463
2484
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2464
2485
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -2526,7 +2547,7 @@ const _hoisted_1$g = {
|
|
|
2526
2547
|
key: 0,
|
|
2527
2548
|
class: "item_require"
|
|
2528
2549
|
};
|
|
2529
|
-
const _hoisted_2$
|
|
2550
|
+
const _hoisted_2$8 = { key: 1 };
|
|
2530
2551
|
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2531
2552
|
const _component_el_tooltip = ElTooltip;
|
|
2532
2553
|
const _component_el_input_number = ElInputNumber;
|
|
@@ -2570,7 +2591,7 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2570
2591
|
precision: _ctx.item.data.precision,
|
|
2571
2592
|
disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly"
|
|
2572
2593
|
}, null, 8, ["modelValue", "controls-position", "size", "precision", "disabled"])) : createCommentVNode("", true),
|
|
2573
|
-
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
2594
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$8, toDisplayString(_ctx.formatReadonlyNumber(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.precision)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input_number, {
|
|
2574
2595
|
key: 2,
|
|
2575
2596
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2576
2597
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -2608,13 +2629,24 @@ const _sfc_main$f = defineComponent({
|
|
|
2608
2629
|
actionType: ["onChange"],
|
|
2609
2630
|
setup(props) {
|
|
2610
2631
|
useWatch(props);
|
|
2632
|
+
},
|
|
2633
|
+
methods: {
|
|
2634
|
+
getDisplayText() {
|
|
2635
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
2636
|
+
const items = this.item.data.itemConfig?.items || [];
|
|
2637
|
+
if (fieldValue === void 0 || fieldValue === null || fieldValue === "") {
|
|
2638
|
+
return "--";
|
|
2639
|
+
}
|
|
2640
|
+
const selectedItem = items.find((item) => item.value === fieldValue);
|
|
2641
|
+
return selectedItem ? selectedItem.label : fieldValue;
|
|
2642
|
+
}
|
|
2611
2643
|
}
|
|
2612
2644
|
});
|
|
2613
2645
|
const _hoisted_1$f = {
|
|
2614
2646
|
key: 0,
|
|
2615
2647
|
class: "item_require"
|
|
2616
2648
|
};
|
|
2617
|
-
const _hoisted_2$
|
|
2649
|
+
const _hoisted_2$7 = { key: 0 };
|
|
2618
2650
|
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2619
2651
|
const _component_el_tooltip = ElTooltip;
|
|
2620
2652
|
const _component_el_radio = ElRadio;
|
|
@@ -2649,7 +2681,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2649
2681
|
class: "control",
|
|
2650
2682
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
2651
2683
|
}, [
|
|
2652
|
-
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
2684
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$7, toDisplayString(_ctx.getDisplayText()), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
|
|
2653
2685
|
key: 1,
|
|
2654
2686
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2655
2687
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -3059,9 +3091,14 @@ const validateNumberD2 = `(rule, value, callback) => {
|
|
|
3059
3091
|
// 电话号码校验规则
|
|
3060
3092
|
const validatePhone = `(rule, value, callback) => {
|
|
3061
3093
|
if (value === "" || value == null) {
|
|
3062
|
-
callback(new Error("
|
|
3063
|
-
|
|
3064
|
-
|
|
3094
|
+
callback(new Error("请输入电话号码"));
|
|
3095
|
+
return;
|
|
3096
|
+
}
|
|
3097
|
+
var re = /^1[3,4,5,6,7,8,9][0-9]{9}$/;
|
|
3098
|
+
|
|
3099
|
+
if (!re.test(value)) {
|
|
3100
|
+
callback(new Error("请输入正确的11位手机号码"));
|
|
3101
|
+
return;
|
|
3065
3102
|
}
|
|
3066
3103
|
callback();
|
|
3067
3104
|
}`;
|
|
@@ -3070,7 +3107,7 @@ const validatePhone = `(rule, value, callback) => {
|
|
|
3070
3107
|
const validateIdCard = `(rule, value, callback) => {
|
|
3071
3108
|
if (value === "" || value == null) {
|
|
3072
3109
|
callback(new Error("请输入"));
|
|
3073
|
-
} else if (!/^[1-9]
|
|
3110
|
+
} else if (!/^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$/.test(value)) {
|
|
3074
3111
|
callback(new Error("请输入正确的身份证号"));
|
|
3075
3112
|
}
|
|
3076
3113
|
callback();
|
|
@@ -3156,13 +3193,24 @@ const _sfc_main$e = defineComponent({
|
|
|
3156
3193
|
}
|
|
3157
3194
|
}
|
|
3158
3195
|
};
|
|
3196
|
+
},
|
|
3197
|
+
methods: {
|
|
3198
|
+
getDisplayText() {
|
|
3199
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
3200
|
+
const items = this.item.data.itemConfig?.items || [];
|
|
3201
|
+
if (fieldValue === void 0 || fieldValue === null || fieldValue === "") {
|
|
3202
|
+
return this.item.data.placeholder || "--";
|
|
3203
|
+
}
|
|
3204
|
+
const selectedItem = items.find((item) => item.value === fieldValue);
|
|
3205
|
+
return selectedItem ? selectedItem.label : fieldValue;
|
|
3206
|
+
}
|
|
3159
3207
|
}
|
|
3160
3208
|
});
|
|
3161
3209
|
const _hoisted_1$e = {
|
|
3162
3210
|
key: 0,
|
|
3163
3211
|
class: "item_require"
|
|
3164
3212
|
};
|
|
3165
|
-
const _hoisted_2$
|
|
3213
|
+
const _hoisted_2$6 = { key: 1 };
|
|
3166
3214
|
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3167
3215
|
const _component_el_tooltip = ElTooltip;
|
|
3168
3216
|
const _component_el_option = ElOption;
|
|
@@ -3203,6 +3251,7 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3203
3251
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.item.data.itemConfig.value = $event),
|
|
3204
3252
|
style: { "width": "320px" },
|
|
3205
3253
|
placeholder: _ctx.item.data.placeholder,
|
|
3254
|
+
clearable: "",
|
|
3206
3255
|
size: _ctx.size,
|
|
3207
3256
|
disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly"
|
|
3208
3257
|
}, {
|
|
@@ -3217,13 +3266,14 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3217
3266
|
]),
|
|
3218
3267
|
_: 1
|
|
3219
3268
|
}, 8, ["modelValue", "placeholder", "size", "disabled"])) : createCommentVNode("", true),
|
|
3220
|
-
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
3269
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$6, toDisplayString(_ctx.getDisplayText()), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
|
|
3221
3270
|
key: 2,
|
|
3222
3271
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3223
3272
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
3224
3273
|
style: { "width": "320px" },
|
|
3225
3274
|
placeholder: _ctx.item.data.placeholder,
|
|
3226
3275
|
size: _ctx.size,
|
|
3276
|
+
clearable: "",
|
|
3227
3277
|
disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly",
|
|
3228
3278
|
onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.execFunc("onFocus")),
|
|
3229
3279
|
onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.execFunc("onBlur"))
|
|
@@ -3266,22 +3316,6 @@ const _sfc_main$d = defineComponent({
|
|
|
3266
3316
|
setup(props) {
|
|
3267
3317
|
const vm = getCurrentInstance();
|
|
3268
3318
|
useWatch(props);
|
|
3269
|
-
const getReadonlyDisplayValue = () => {
|
|
3270
|
-
try {
|
|
3271
|
-
const fieldValue = props.data[props.item.data.fieldName];
|
|
3272
|
-
if (Array.isArray(fieldValue)) {
|
|
3273
|
-
return fieldValue.length > 0 ? fieldValue.join(",") : "--";
|
|
3274
|
-
}
|
|
3275
|
-
const configValue = props.item.data.itemConfig?.value;
|
|
3276
|
-
if (Array.isArray(configValue)) {
|
|
3277
|
-
return configValue.length > 0 ? configValue.join(",") : "--";
|
|
3278
|
-
}
|
|
3279
|
-
return "--";
|
|
3280
|
-
} catch (error) {
|
|
3281
|
-
console.error("Error getting readonly display value:", error);
|
|
3282
|
-
return "--";
|
|
3283
|
-
}
|
|
3284
|
-
};
|
|
3285
3319
|
return {
|
|
3286
3320
|
execFunc(type) {
|
|
3287
3321
|
if (props.item.data.action && props.item.data.action[type]) {
|
|
@@ -3289,16 +3323,29 @@ const _sfc_main$d = defineComponent({
|
|
|
3289
3323
|
props.item.data.fieldName
|
|
3290
3324
|
]);
|
|
3291
3325
|
}
|
|
3292
|
-
}
|
|
3293
|
-
getReadonlyDisplayValue
|
|
3326
|
+
}
|
|
3294
3327
|
};
|
|
3328
|
+
},
|
|
3329
|
+
methods: {
|
|
3330
|
+
getDisplayText() {
|
|
3331
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
3332
|
+
const items = this.item.data.itemConfig?.items || [];
|
|
3333
|
+
if (!fieldValue || !Array.isArray(fieldValue) || fieldValue.length === 0) {
|
|
3334
|
+
return this.item.data.placeholder || "--";
|
|
3335
|
+
}
|
|
3336
|
+
const selectedLabels = fieldValue.map((value) => {
|
|
3337
|
+
const item = items.find((item2) => item2.value === value);
|
|
3338
|
+
return item ? item.label : value;
|
|
3339
|
+
});
|
|
3340
|
+
return selectedLabels.join(", ");
|
|
3341
|
+
}
|
|
3295
3342
|
}
|
|
3296
3343
|
});
|
|
3297
3344
|
const _hoisted_1$d = {
|
|
3298
3345
|
key: 0,
|
|
3299
3346
|
class: "item_require"
|
|
3300
3347
|
};
|
|
3301
|
-
const _hoisted_2$
|
|
3348
|
+
const _hoisted_2$5 = { key: 1 };
|
|
3302
3349
|
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3303
3350
|
const _component_el_tooltip = ElTooltip;
|
|
3304
3351
|
const _component_el_option = ElOption;
|
|
@@ -3353,7 +3400,7 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3353
3400
|
}), 128))
|
|
3354
3401
|
]),
|
|
3355
3402
|
_: 1
|
|
3356
|
-
}, 8, ["modelValue", "placeholder", "disabled", "size"])) : !_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$
|
|
3403
|
+
}, 8, ["modelValue", "placeholder", "disabled", "size"])) : !_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$5, toDisplayString(_ctx.getDisplayText()), 1)) : (openBlock(), createBlock(_component_el_select, {
|
|
3357
3404
|
key: 2,
|
|
3358
3405
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3359
3406
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -3603,12 +3650,22 @@ const _sfc_main$a = defineComponent({
|
|
|
3603
3650
|
actionType: ["onChange"],
|
|
3604
3651
|
setup(props) {
|
|
3605
3652
|
useWatch(props);
|
|
3653
|
+
},
|
|
3654
|
+
methods: {
|
|
3655
|
+
getDisplayText() {
|
|
3656
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
3657
|
+
if (fieldValue === void 0 || fieldValue === null) {
|
|
3658
|
+
return "--";
|
|
3659
|
+
}
|
|
3660
|
+
return fieldValue ? "\u662F" : "\u5426";
|
|
3661
|
+
}
|
|
3606
3662
|
}
|
|
3607
3663
|
});
|
|
3608
3664
|
const _hoisted_1$a = {
|
|
3609
3665
|
key: 0,
|
|
3610
3666
|
class: "item_require"
|
|
3611
3667
|
};
|
|
3668
|
+
const _hoisted_2$4 = { key: 0 };
|
|
3612
3669
|
function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3613
3670
|
const _component_el_tooltip = ElTooltip;
|
|
3614
3671
|
const _component_el_switch = ElSwitch;
|
|
@@ -3642,20 +3699,19 @@ function _sfc_render$a(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3642
3699
|
class: "control",
|
|
3643
3700
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
3644
3701
|
}, [
|
|
3645
|
-
_ctx.drag ? (openBlock(), createBlock(_component_el_switch, {
|
|
3646
|
-
key:
|
|
3702
|
+
!_ctx.drag && (_ctx.item.data.state === "readonly" || _ctx.readonly) ? (openBlock(), createElementBlock("span", _hoisted_2$4, toDisplayString(_ctx.getDisplayText()), 1)) : _ctx.drag ? (openBlock(), createBlock(_component_el_switch, {
|
|
3703
|
+
key: 1,
|
|
3647
3704
|
modelValue: _ctx.item.data.default,
|
|
3648
3705
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.item.data.default = $event),
|
|
3649
3706
|
size: _ctx.size,
|
|
3650
3707
|
disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly"
|
|
3651
|
-
}, null, 8, ["modelValue", "size", "disabled"])) :
|
|
3652
|
-
|
|
3653
|
-
key: 1,
|
|
3708
|
+
}, null, 8, ["modelValue", "size", "disabled"])) : (openBlock(), createBlock(_component_el_switch, {
|
|
3709
|
+
key: 2,
|
|
3654
3710
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3655
3711
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
3656
3712
|
size: _ctx.size,
|
|
3657
3713
|
disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly"
|
|
3658
|
-
}, null, 8, ["modelValue", "size", "disabled"]))
|
|
3714
|
+
}, null, 8, ["modelValue", "size", "disabled"]))
|
|
3659
3715
|
], 4)
|
|
3660
3716
|
], 2);
|
|
3661
3717
|
}
|
|
@@ -5339,7 +5395,7 @@ Object.keys(files).forEach((fileName) => {
|
|
|
5339
5395
|
}
|
|
5340
5396
|
});
|
|
5341
5397
|
const RichText = defineAsyncComponent({
|
|
5342
|
-
loader: () => import('./index-
|
|
5398
|
+
loader: () => import('./index-5ee7ae61.mjs'),
|
|
5343
5399
|
loadingComponent: Loading
|
|
5344
5400
|
});
|
|
5345
5401
|
RichText.ControlType = "RichText";
|
|
@@ -5348,7 +5404,7 @@ RichText.icon = "icon-textEdit";
|
|
|
5348
5404
|
RichText.formConfig = getFormConfig("RichText");
|
|
5349
5405
|
utilFuns[RichText.ControlType] = RichText;
|
|
5350
5406
|
const jsonEditor = defineAsyncComponent({
|
|
5351
|
-
loader: () => import('./index-
|
|
5407
|
+
loader: () => import('./index-ec5813e3.mjs'),
|
|
5352
5408
|
loadingComponent: Loading
|
|
5353
5409
|
});
|
|
5354
5410
|
jsonEditor.ControlType = "JsonEditor";
|
|
@@ -5358,14 +5414,14 @@ jsonEditor.formConfig = getFormConfig("JsonEditor", [{ fieldName: "default", com
|
|
|
5358
5414
|
jsonEditor.rule = _.getJsonValidate();
|
|
5359
5415
|
utilFuns[jsonEditor.ControlType] = jsonEditor;
|
|
5360
5416
|
const formAction = defineAsyncComponent({
|
|
5361
|
-
loader: () => import('./formAction-
|
|
5417
|
+
loader: () => import('./formAction-8f689053.mjs'),
|
|
5362
5418
|
loadingComponent: Loading
|
|
5363
5419
|
});
|
|
5364
5420
|
formAction.ControlType = "FormAction";
|
|
5365
5421
|
formAction.isHide = true;
|
|
5366
5422
|
utilFuns[formAction.ControlType] = formAction;
|
|
5367
5423
|
const Rule = defineAsyncComponent({
|
|
5368
|
-
loader: () => import('./index-
|
|
5424
|
+
loader: () => import('./index-3c21357b.mjs'),
|
|
5369
5425
|
loadingComponent: Loading
|
|
5370
5426
|
});
|
|
5371
5427
|
Rule.ControlType = "Rule";
|
|
@@ -5374,7 +5430,7 @@ utilFuns[Rule.ControlType] = Rule;
|
|
|
5374
5430
|
const install = (app) => {
|
|
5375
5431
|
app.config.globalProperties.$formcomponents = utilFuns;
|
|
5376
5432
|
};
|
|
5377
|
-
const Dynamicform = defineAsyncComponent(() => import('./starfish-form-
|
|
5433
|
+
const Dynamicform = defineAsyncComponent(() => import('./starfish-form-a750924c.mjs'));
|
|
5378
5434
|
const main = {
|
|
5379
5435
|
install
|
|
5380
5436
|
};
|
|
@@ -3,7 +3,7 @@ import 'element-plus/es/components/base/style/css';
|
|
|
3
3
|
import 'element-plus/es/components/form/style/css';
|
|
4
4
|
import 'element-plus/es/components/form-item/style/css';
|
|
5
5
|
import { defineComponent, getCurrentInstance, ref, onMounted, openBlock, createElementBlock, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, resolveDynamicComponent, createCommentVNode, toRaw } from 'vue';
|
|
6
|
-
import { _ as _export_sfc } from './main-
|
|
6
|
+
import { _ as _export_sfc } from './main-aab412b3.mjs';
|
|
7
7
|
import 'element-plus/es/components/icon/style/css';
|
|
8
8
|
import 'element-plus/es/components/input/style/css';
|
|
9
9
|
import 'element-plus/es/components/checkbox/style/css';
|
package/dist/starfish-form.mjs
CHANGED
package/dist/style.css
CHANGED
|
@@ -424,15 +424,15 @@
|
|
|
424
424
|
width: 100%;
|
|
425
425
|
min-height: 60px;
|
|
426
426
|
height: 100%;
|
|
427
|
-
}.rich-text-editor[data-v-
|
|
427
|
+
}.rich-text-editor[data-v-77a8db1a] {
|
|
428
428
|
min-height: 200px;
|
|
429
429
|
position: relative;
|
|
430
430
|
z-index: 1;
|
|
431
431
|
}
|
|
432
|
-
[data-v-
|
|
432
|
+
[data-v-77a8db1a] .editor-content {
|
|
433
433
|
min-height: 200px;
|
|
434
434
|
}
|
|
435
|
-
[data-v-
|
|
435
|
+
[data-v-77a8db1a] .editor-content .ql-toolbar {
|
|
436
436
|
z-index: 100;
|
|
437
437
|
background: white;
|
|
438
438
|
border: 1px solid #ccc;
|
|
@@ -440,7 +440,7 @@
|
|
|
440
440
|
border-top-right-radius: 4px;
|
|
441
441
|
position: relative;
|
|
442
442
|
}
|
|
443
|
-
[data-v-
|
|
443
|
+
[data-v-77a8db1a] .editor-content .ql-container {
|
|
444
444
|
border: 1px solid #ccc;
|
|
445
445
|
border-top: none;
|
|
446
446
|
border-bottom-left-radius: 4px;
|
|
@@ -448,7 +448,7 @@
|
|
|
448
448
|
min-height: 200px;
|
|
449
449
|
z-index: 99;
|
|
450
450
|
}
|
|
451
|
-
[data-v-
|
|
451
|
+
[data-v-77a8db1a] .shape .rich-text-editor {
|
|
452
452
|
pointer-events: auto !important;
|
|
453
453
|
}.cm-gutters.cm-gutters-before {
|
|
454
454
|
background: #133F63;
|
package/package.json
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
11
|
<!-- 只读的时候就只展示文本 -->
|
|
12
|
-
<span v-if="!drag &&
|
|
12
|
+
<span v-if="!drag && (item.data.state === 'readonly' || readonly)">
|
|
13
|
+
{{ getDisplayText() }}
|
|
14
|
+
</span>
|
|
13
15
|
<el-checkbox-group v-model="data[item.data.fieldName]" :class="{'vertical-group': item.data.arrangeMent === 'vertical'}" v-else-if="!drag && data[item.data.fieldName]" :size="size" :disabled="item.data.state === 'disabled' || item.data.state === 'readonly'">
|
|
14
16
|
<el-checkbox v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value">{{ sitem.label }}</el-checkbox>
|
|
15
17
|
</el-checkbox-group>
|
|
@@ -19,11 +21,13 @@
|
|
|
19
21
|
</div>
|
|
20
22
|
</div>
|
|
21
23
|
</template>
|
|
24
|
+
|
|
22
25
|
<script lang="ts">
|
|
23
26
|
import { defineComponent } from "vue";
|
|
24
27
|
import { getFormConfig } from "../../utils/fieldConfig";
|
|
25
28
|
import fieldProps from "../../utils/fieldProps";
|
|
26
29
|
import { useWatch } from "../../utils/customHooks";
|
|
30
|
+
|
|
27
31
|
export default defineComponent({
|
|
28
32
|
ControlType: "CheckBox", // 必须与文件名匹配
|
|
29
33
|
nameCn: "复选框",
|
|
@@ -40,5 +44,34 @@
|
|
|
40
44
|
setup(props) {
|
|
41
45
|
useWatch(props);
|
|
42
46
|
},
|
|
47
|
+
methods: {
|
|
48
|
+
getDisplayText() {
|
|
49
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
50
|
+
const items = this.item.data.itemConfig?.items || [];
|
|
51
|
+
|
|
52
|
+
// 如果没有值,显示默认的 "--"
|
|
53
|
+
if (!fieldValue && fieldValue !== 0 && fieldValue !== false) {
|
|
54
|
+
return '--';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// 如果是数组(多选)
|
|
58
|
+
if (Array.isArray(fieldValue)) {
|
|
59
|
+
if (fieldValue.length === 0) return '--';
|
|
60
|
+
|
|
61
|
+
// 根据选中的 value 查找对应的 label
|
|
62
|
+
const selectedLabels = fieldValue.map(value => {
|
|
63
|
+
const item = items.find(item => item.value === value);
|
|
64
|
+
return item ? item.label : value;
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
return selectedLabels.join(', ');
|
|
68
|
+
}
|
|
69
|
+
// 如果是单个值(单选模式)
|
|
70
|
+
else {
|
|
71
|
+
const item = items.find(item => item.value === fieldValue);
|
|
72
|
+
return item ? item.label : fieldValue;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
43
76
|
});
|
|
44
|
-
</script>
|
|
77
|
+
</script>
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
* @Author: chenwen chenwen@jiton.com
|
|
3
|
-
* @Date: 2025-07-25 15:26:40
|
|
4
|
-
* @LastEditors: chenwen chenwen@jiton.com
|
|
5
|
-
* @LastEditTime: 2025-12-24 16:07:50
|
|
6
|
-
* @FilePath: \vue-form-design\packages\form\src\components\Radio\index.vue
|
|
7
|
-
* @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
8
|
-
-->
|
|
9
1
|
<template>
|
|
10
2
|
<div
|
|
11
3
|
class="starfish-formitem"
|
|
@@ -37,7 +29,10 @@
|
|
|
37
29
|
class="control"
|
|
38
30
|
:style="{ marginLeft: labelalign != 'top' ? labelWidth + 'px' : '' }"
|
|
39
31
|
>
|
|
40
|
-
|
|
32
|
+
<!-- 只读状态显示对应的 label -->
|
|
33
|
+
<span v-if="!drag && (item.data.state === 'readonly' || readonly)">
|
|
34
|
+
{{ getDisplayText() }}
|
|
35
|
+
</span>
|
|
41
36
|
<el-radio-group
|
|
42
37
|
v-else-if="!drag"
|
|
43
38
|
v-model="data[item.data.fieldName]"
|
|
@@ -90,5 +85,22 @@ export default defineComponent({
|
|
|
90
85
|
setup(props) {
|
|
91
86
|
useWatch(props);
|
|
92
87
|
},
|
|
88
|
+
methods: {
|
|
89
|
+
getDisplayText() {
|
|
90
|
+
const fieldValue = this.data[this.item.data.fieldName];
|
|
91
|
+
const items = this.item.data.itemConfig?.items || [];
|
|
92
|
+
|
|
93
|
+
// 如果没有值,显示默认的 "--"
|
|
94
|
+
if (fieldValue === undefined || fieldValue === null || fieldValue === '') {
|
|
95
|
+
return '--';
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// 查找对应的 label
|
|
99
|
+
const selectedItem = items.find(item => item.value === fieldValue);
|
|
100
|
+
|
|
101
|
+
// 如果找到对应的 label,显示 label,否则显示原始值
|
|
102
|
+
return selectedItem ? selectedItem.label : fieldValue;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
93
105
|
});
|
|
94
|
-
</script>
|
|
106
|
+
</script>
|