starfish-form-custom 1.0.18 → 1.0.20
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-f8e6d2c0.mjs → formAction-922332c1.mjs} +1 -1
- package/dist/{index-1246b8e1.mjs → index-015ed509.mjs} +1 -1
- package/dist/{index-4830f3c2.mjs → index-115b67c5.mjs} +1 -1
- package/dist/{index-de1a59fb.mjs → index-afbcc030.mjs} +76 -79
- package/dist/{main-5c7bd9ea.mjs → main-c0754020.mjs} +131 -46
- package/dist/{starfish-form-2cde30c5.mjs → starfish-form-9cc90058.mjs} +1 -1
- package/dist/starfish-form.mjs +1 -1
- package/dist/style.css +17 -2
- package/dist/types/form/src/utils/fieldConfig.d.ts +2 -0
- package/package.json +1 -1
- package/src/components/CheckBox/index.vue +3 -1
- package/src/components/Date/index.vue +39 -3
- package/src/components/InputNumber/index.vue +26 -1
- package/src/components/Radio/index.vue +2 -1
- package/src/components/Rule/index.vue +15 -21
- package/src/components/Selected/index.vue +2 -1
- package/src/components/Selecteds/index.vue +2 -1
- package/src/components/Text/index.vue +8 -3
- package/src/components/TextArea/index.vue +2 -1
- package/src/styles/formedit.scss +17 -2
- package/src/utils/fieldConfig.ts +39 -3
- package/stats.html +1 -1
|
@@ -140,8 +140,9 @@ const fieldsMap = {
|
|
|
140
140
|
default: "",
|
|
141
141
|
maxLength: 100,
|
|
142
142
|
minLength: 0,
|
|
143
|
-
state: "normal"
|
|
143
|
+
state: "normal",
|
|
144
144
|
// 状态:normal, disabled, readonly
|
|
145
|
+
align: "left"
|
|
145
146
|
},
|
|
146
147
|
Info: {
|
|
147
148
|
fieldName: "",
|
|
@@ -513,6 +514,18 @@ function getMoren(fieldName, component, label) {
|
|
|
513
514
|
rule: "[]"
|
|
514
515
|
}
|
|
515
516
|
},
|
|
517
|
+
rule: {
|
|
518
|
+
ControlType: "Rule",
|
|
519
|
+
data: {
|
|
520
|
+
fieldName: "rule",
|
|
521
|
+
tip: "",
|
|
522
|
+
label: "校验规则",
|
|
523
|
+
showRule: "{}",
|
|
524
|
+
required: false,
|
|
525
|
+
rule: "[]",
|
|
526
|
+
default: "[]"
|
|
527
|
+
}
|
|
528
|
+
},
|
|
516
529
|
precision: {
|
|
517
530
|
ControlType: "InputNumber",
|
|
518
531
|
data: {
|
|
@@ -572,6 +585,26 @@ function getMoren(fieldName, component, label) {
|
|
|
572
585
|
}
|
|
573
586
|
}
|
|
574
587
|
},
|
|
588
|
+
align: {
|
|
589
|
+
ControlType: "Radio",
|
|
590
|
+
data: {
|
|
591
|
+
fieldName: "align",
|
|
592
|
+
tip: "",
|
|
593
|
+
label: "对齐方式",
|
|
594
|
+
placeholder: "",
|
|
595
|
+
showRule: "{}",
|
|
596
|
+
required: false,
|
|
597
|
+
rule: "[]",
|
|
598
|
+
itemConfig: {
|
|
599
|
+
value: "left",
|
|
600
|
+
items: [
|
|
601
|
+
{ label: "左", value: "left" },
|
|
602
|
+
{ label: "中", value: "center" },
|
|
603
|
+
{ label: "右", value: "right" }
|
|
604
|
+
]
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
},
|
|
575
608
|
arrangeMent: {
|
|
576
609
|
ControlType: "Radio",
|
|
577
610
|
data: {
|
|
@@ -1069,7 +1102,7 @@ const _hoisted_1$r = {
|
|
|
1069
1102
|
class: "item_require"
|
|
1070
1103
|
};
|
|
1071
1104
|
const _hoisted_2$k = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
1072
|
-
const _hoisted_3$
|
|
1105
|
+
const _hoisted_3$f = { class: "keyValueSelect" };
|
|
1073
1106
|
const _hoisted_4$4 = { class: "keyValueInput" };
|
|
1074
1107
|
const _hoisted_5$2 = { class: "inputItem" };
|
|
1075
1108
|
const _hoisted_6$2 = /* @__PURE__ */ createElementVNode("span", null, "\u6587\u672C\uFF1A", -1);
|
|
@@ -1123,7 +1156,7 @@ function _sfc_render$r(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1123
1156
|
class: "starfish-keyValueItem",
|
|
1124
1157
|
key: index
|
|
1125
1158
|
}, [
|
|
1126
|
-
createElementVNode("div", _hoisted_3$
|
|
1159
|
+
createElementVNode("div", _hoisted_3$f, [
|
|
1127
1160
|
createVNode(_component_el_checkbox, {
|
|
1128
1161
|
modelValue: items.select,
|
|
1129
1162
|
"onUpdate:modelValue": ($event) => items.select = $event,
|
|
@@ -1303,7 +1336,7 @@ const _hoisted_1$q = {
|
|
|
1303
1336
|
class: "item_require"
|
|
1304
1337
|
};
|
|
1305
1338
|
const _hoisted_2$j = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
1306
|
-
const _hoisted_3$
|
|
1339
|
+
const _hoisted_3$e = { class: "keyValueSelect" };
|
|
1307
1340
|
const _hoisted_4$3 = { class: "keyValueInput" };
|
|
1308
1341
|
const _hoisted_5$1 = { class: "inputItem" };
|
|
1309
1342
|
const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("span", null, "\u6587\u672C\uFF1A", -1);
|
|
@@ -1357,7 +1390,7 @@ function _sfc_render$q(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1357
1390
|
class: "starfish-keyValueItem",
|
|
1358
1391
|
key: index
|
|
1359
1392
|
}, [
|
|
1360
|
-
createElementVNode("div", _hoisted_3$
|
|
1393
|
+
createElementVNode("div", _hoisted_3$e, [
|
|
1361
1394
|
createVNode(_component_el_checkbox, {
|
|
1362
1395
|
modelValue: items.select,
|
|
1363
1396
|
"onUpdate:modelValue": ($event) => items.select = $event,
|
|
@@ -1497,7 +1530,7 @@ const _hoisted_1$o = {
|
|
|
1497
1530
|
class: "item_require"
|
|
1498
1531
|
};
|
|
1499
1532
|
const _hoisted_2$i = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
1500
|
-
const _hoisted_3$
|
|
1533
|
+
const _hoisted_3$d = /* @__PURE__ */ createTextVNode(" \u65B0\u5EFA\u52A8\u4F5C+ ");
|
|
1501
1534
|
function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1502
1535
|
const _component_el_tooltip = ElTooltip;
|
|
1503
1536
|
const _component_el_option = ElOption;
|
|
@@ -1654,7 +1687,7 @@ function _sfc_render$o(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1654
1687
|
size: _ctx.size
|
|
1655
1688
|
}, {
|
|
1656
1689
|
default: withCtx(() => [
|
|
1657
|
-
_hoisted_3$
|
|
1690
|
+
_hoisted_3$d
|
|
1658
1691
|
]),
|
|
1659
1692
|
_: 1
|
|
1660
1693
|
}, 8, ["size"])
|
|
@@ -1803,7 +1836,7 @@ const _sfc_main$m = defineComponent({
|
|
|
1803
1836
|
});
|
|
1804
1837
|
const _hoisted_1$m = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
1805
1838
|
const _hoisted_2$h = /* @__PURE__ */ createElementVNode("i", { class: "iconfontui icon-bars handle" }, null, -1);
|
|
1806
|
-
const _hoisted_3$
|
|
1839
|
+
const _hoisted_3$c = /* @__PURE__ */ createTextVNode("\u6DFB\u52A0\u9762\u677F");
|
|
1807
1840
|
function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1808
1841
|
const _component_el_tooltip = ElTooltip;
|
|
1809
1842
|
const _component_el_col = ElCol;
|
|
@@ -1908,7 +1941,7 @@ function _sfc_render$m(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1908
1941
|
size: "default"
|
|
1909
1942
|
}, {
|
|
1910
1943
|
default: withCtx(() => [
|
|
1911
|
-
_hoisted_3$
|
|
1944
|
+
_hoisted_3$c
|
|
1912
1945
|
]),
|
|
1913
1946
|
_: 1
|
|
1914
1947
|
}, 8, ["onClick"])
|
|
@@ -1959,7 +1992,7 @@ const _hoisted_2$g = {
|
|
|
1959
1992
|
key: 0,
|
|
1960
1993
|
class: "item_require"
|
|
1961
1994
|
};
|
|
1962
|
-
const _hoisted_3$
|
|
1995
|
+
const _hoisted_3$b = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
1963
1996
|
const _hoisted_4$2 = { class: "control" };
|
|
1964
1997
|
function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1965
1998
|
const _component_el_tooltip = ElTooltip;
|
|
@@ -1979,7 +2012,7 @@ function _sfc_render$l(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1979
2012
|
placement: "top"
|
|
1980
2013
|
}, {
|
|
1981
2014
|
default: withCtx(() => [
|
|
1982
|
-
_hoisted_3$
|
|
2015
|
+
_hoisted_3$b
|
|
1983
2016
|
]),
|
|
1984
2017
|
_: 1
|
|
1985
2018
|
}, 8, ["content"])) : createCommentVNode("", true)
|
|
@@ -2033,6 +2066,7 @@ const _hoisted_1$k = {
|
|
|
2033
2066
|
class: "item_require"
|
|
2034
2067
|
};
|
|
2035
2068
|
const _hoisted_2$f = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
2069
|
+
const _hoisted_3$a = { key: 0 };
|
|
2036
2070
|
function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2037
2071
|
const _component_el_tooltip = ElTooltip;
|
|
2038
2072
|
const _component_el_checkbox = ElCheckbox;
|
|
@@ -2063,8 +2097,8 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2063
2097
|
class: "control",
|
|
2064
2098
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
2065
2099
|
}, [
|
|
2066
|
-
!_ctx.drag && _ctx.data[_ctx.item.data.fieldName] ? (openBlock(), createBlock(_component_el_checkbox_group, {
|
|
2067
|
-
key:
|
|
2100
|
+
!_ctx.drag && _ctx.data[_ctx.item.data.fieldName] && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$a, toDisplayString(_ctx.data[_ctx.item.data.fieldName].join(",") || "--"), 1)) : !_ctx.drag && _ctx.data[_ctx.item.data.fieldName] ? (openBlock(), createBlock(_component_el_checkbox_group, {
|
|
2101
|
+
key: 1,
|
|
2068
2102
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2069
2103
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
2070
2104
|
class: normalizeClass({ "vertical-group": _ctx.item.data.arrangeMent === "vertical" }),
|
|
@@ -2087,7 +2121,7 @@ function _sfc_render$k(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2087
2121
|
_: 1
|
|
2088
2122
|
}, 8, ["modelValue", "class", "size", "disabled"])) : createCommentVNode("", true),
|
|
2089
2123
|
_ctx.drag ? (openBlock(), createBlock(_component_el_checkbox_group, {
|
|
2090
|
-
key:
|
|
2124
|
+
key: 2,
|
|
2091
2125
|
modelValue: _ctx.item.data.itemConfig.value,
|
|
2092
2126
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.item.data.itemConfig.value = $event),
|
|
2093
2127
|
class: normalizeClass({ "vertical-group": _ctx.item.data.arrangeMent === "vertical" }),
|
|
@@ -2141,7 +2175,7 @@ const _hoisted_1$j = {
|
|
|
2141
2175
|
class: "item_require"
|
|
2142
2176
|
};
|
|
2143
2177
|
const _hoisted_2$e = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1));
|
|
2144
|
-
const _hoisted_3$
|
|
2178
|
+
const _hoisted_3$9 = { key: 0 };
|
|
2145
2179
|
const _hoisted_4$1 = { key: 1 };
|
|
2146
2180
|
function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2147
2181
|
const _component_el_tooltip = ElTooltip;
|
|
@@ -2173,7 +2207,7 @@ function _sfc_render$j(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2173
2207
|
class: "control",
|
|
2174
2208
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
2175
2209
|
}, [
|
|
2176
|
-
_ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_3$
|
|
2210
|
+
_ctx.drag ? (openBlock(), createElementBlock("div", _hoisted_3$9, [
|
|
2177
2211
|
createVNode(_component_el_input, {
|
|
2178
2212
|
modelValue: _ctx.item.data.default,
|
|
2179
2213
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.item.data.default = $event),
|
|
@@ -2219,7 +2253,7 @@ const _sfc_main$i = defineComponent({
|
|
|
2219
2253
|
nameCn: "\u65E5\u671F",
|
|
2220
2254
|
icon: "icon-24gl-calendar",
|
|
2221
2255
|
formConfig: getFormConfig("Date", [
|
|
2222
|
-
{ fieldName: "default", component: "
|
|
2256
|
+
{ fieldName: "default", component: "DateTime" },
|
|
2223
2257
|
{ fieldName: "placeholder", component: "Text" },
|
|
2224
2258
|
{ fieldName: "format", component: "Selected" },
|
|
2225
2259
|
{ fieldName: "state", component: "Radio" }
|
|
@@ -2243,8 +2277,34 @@ const _sfc_main$i = defineComponent({
|
|
|
2243
2277
|
};
|
|
2244
2278
|
return formatTypeMap[format] || "date";
|
|
2245
2279
|
};
|
|
2280
|
+
const formatReadonlyDate = (dateValue, format) => {
|
|
2281
|
+
if (!dateValue)
|
|
2282
|
+
return "--";
|
|
2283
|
+
if (typeof dateValue === "string") {
|
|
2284
|
+
return dateValue;
|
|
2285
|
+
}
|
|
2286
|
+
if (dateValue instanceof Date) {
|
|
2287
|
+
const year = dateValue.getFullYear();
|
|
2288
|
+
const month = String(dateValue.getMonth() + 1).padStart(2, "0");
|
|
2289
|
+
const day = String(dateValue.getDate()).padStart(2, "0");
|
|
2290
|
+
const hours = String(dateValue.getHours()).padStart(2, "0");
|
|
2291
|
+
const minutes = String(dateValue.getMinutes()).padStart(2, "0");
|
|
2292
|
+
const seconds = String(dateValue.getSeconds()).padStart(2, "0");
|
|
2293
|
+
const formatMap = {
|
|
2294
|
+
"YYYY": `${year}`,
|
|
2295
|
+
"YYYY-MM": `${year}-${month}`,
|
|
2296
|
+
"YYYY-MM-DD": `${year}-${month}-${day}`,
|
|
2297
|
+
"YYYY-MM-DD HH": `${year}-${month}-${day} ${hours}`,
|
|
2298
|
+
"YYYY-MM-DD HH:mm": `${year}-${month}-${day} ${hours}:${minutes}`,
|
|
2299
|
+
"YYYY-MM-DD HH:mm:ss": `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
2300
|
+
};
|
|
2301
|
+
return formatMap[format] || `${year}-${month}-${day}`;
|
|
2302
|
+
}
|
|
2303
|
+
return String(dateValue);
|
|
2304
|
+
};
|
|
2246
2305
|
return {
|
|
2247
|
-
getPickerType
|
|
2306
|
+
getPickerType,
|
|
2307
|
+
formatReadonlyDate
|
|
2248
2308
|
};
|
|
2249
2309
|
}
|
|
2250
2310
|
});
|
|
@@ -2253,6 +2313,7 @@ const _hoisted_1$i = {
|
|
|
2253
2313
|
class: "item_require"
|
|
2254
2314
|
};
|
|
2255
2315
|
const _hoisted_2$d = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
2316
|
+
const _hoisted_3$8 = { key: 1 };
|
|
2256
2317
|
function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2257
2318
|
const _component_el_tooltip = ElTooltip;
|
|
2258
2319
|
const _component_el_date_picker = ElDatePicker;
|
|
@@ -2295,8 +2356,8 @@ function _sfc_render$i(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2295
2356
|
disabled: _ctx.item.data.state === "disabled",
|
|
2296
2357
|
readonly: _ctx.item.data.state === "readonly"
|
|
2297
2358
|
}, null, 8, ["modelValue", "type", "format", "value-format", "placeholder", "size", "disabled", "readonly"])) : createCommentVNode("", true),
|
|
2298
|
-
!_ctx.drag ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
2299
|
-
key:
|
|
2359
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$8, toDisplayString(_ctx.formatReadonlyDate(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.format)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_date_picker, {
|
|
2360
|
+
key: 2,
|
|
2300
2361
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2301
2362
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
2302
2363
|
width: "240px",
|
|
@@ -2420,7 +2481,21 @@ const _sfc_main$g = defineComponent({
|
|
|
2420
2481
|
setup(props) {
|
|
2421
2482
|
const vm = getCurrentInstance();
|
|
2422
2483
|
useWatch(props);
|
|
2484
|
+
const formatReadonlyNumber = (value, precision) => {
|
|
2485
|
+
if (value === null || value === void 0 || value === "") {
|
|
2486
|
+
return "-";
|
|
2487
|
+
}
|
|
2488
|
+
const numValue = Number(value);
|
|
2489
|
+
if (isNaN(numValue)) {
|
|
2490
|
+
return String(value);
|
|
2491
|
+
}
|
|
2492
|
+
if (precision !== void 0 && precision !== null) {
|
|
2493
|
+
return numValue.toFixed(precision);
|
|
2494
|
+
}
|
|
2495
|
+
return String(numValue);
|
|
2496
|
+
};
|
|
2423
2497
|
return {
|
|
2498
|
+
formatReadonlyNumber,
|
|
2424
2499
|
execFunc(type) {
|
|
2425
2500
|
if (props.item.data.action && props.item.data.action[type]) {
|
|
2426
2501
|
window.VApp.$Flex.funcExec(props.item.data.action[type], vm.proxy, [
|
|
@@ -2436,6 +2511,7 @@ const _hoisted_1$g = {
|
|
|
2436
2511
|
class: "item_require"
|
|
2437
2512
|
};
|
|
2438
2513
|
const _hoisted_2$b = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
2514
|
+
const _hoisted_3$7 = { key: 1 };
|
|
2439
2515
|
function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2440
2516
|
const _component_el_tooltip = ElTooltip;
|
|
2441
2517
|
const _component_el_input_number = ElInputNumber;
|
|
@@ -2479,8 +2555,8 @@ function _sfc_render$g(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2479
2555
|
precision: _ctx.item.data.precision,
|
|
2480
2556
|
disabled: _ctx.item.data.state === "disabled" || _ctx.item.data.state === "readonly"
|
|
2481
2557
|
}, null, 8, ["modelValue", "controls-position", "size", "precision", "disabled"])) : createCommentVNode("", true),
|
|
2482
|
-
!_ctx.drag ? (openBlock(), createBlock(_component_el_input_number, {
|
|
2483
|
-
key:
|
|
2558
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$7, toDisplayString(_ctx.formatReadonlyNumber(_ctx.data[_ctx.item.data.fieldName], _ctx.item.data.precision)), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input_number, {
|
|
2559
|
+
key: 2,
|
|
2484
2560
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2485
2561
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
2486
2562
|
width: "240px",
|
|
@@ -2524,6 +2600,7 @@ const _hoisted_1$f = {
|
|
|
2524
2600
|
class: "item_require"
|
|
2525
2601
|
};
|
|
2526
2602
|
const _hoisted_2$a = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
2603
|
+
const _hoisted_3$6 = { key: 0 };
|
|
2527
2604
|
function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2528
2605
|
const _component_el_tooltip = ElTooltip;
|
|
2529
2606
|
const _component_el_radio = ElRadio;
|
|
@@ -2558,8 +2635,8 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2558
2635
|
class: "control",
|
|
2559
2636
|
style: normalizeStyle({ marginLeft: _ctx.labelalign != "top" ? _ctx.labelWidth + "px" : "" })
|
|
2560
2637
|
}, [
|
|
2561
|
-
!_ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
|
|
2562
|
-
key:
|
|
2638
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$6, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
|
|
2639
|
+
key: 1,
|
|
2563
2640
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
2564
2641
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
2565
2642
|
size: _ctx.size,
|
|
@@ -2582,7 +2659,7 @@ function _sfc_render$f(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2582
2659
|
_: 1
|
|
2583
2660
|
}, 8, ["modelValue", "size", "class"])) : createCommentVNode("", true),
|
|
2584
2661
|
_ctx.drag ? (openBlock(), createBlock(_component_el_radio_group, {
|
|
2585
|
-
key:
|
|
2662
|
+
key: 2,
|
|
2586
2663
|
modelValue: _ctx.item.data.itemConfig.value,
|
|
2587
2664
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.item.data.itemConfig.value = $event),
|
|
2588
2665
|
size: _ctx.size,
|
|
@@ -3072,6 +3149,7 @@ const _hoisted_1$e = {
|
|
|
3072
3149
|
class: "item_require"
|
|
3073
3150
|
};
|
|
3074
3151
|
const _hoisted_2$9 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
3152
|
+
const _hoisted_3$5 = { key: 1 };
|
|
3075
3153
|
function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3076
3154
|
const _component_el_tooltip = ElTooltip;
|
|
3077
3155
|
const _component_el_option = ElOption;
|
|
@@ -3126,8 +3204,8 @@ function _sfc_render$e(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3126
3204
|
]),
|
|
3127
3205
|
_: 1
|
|
3128
3206
|
}, 8, ["modelValue", "placeholder", "size", "disabled"])) : createCommentVNode("", true),
|
|
3129
|
-
!_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
|
|
3130
|
-
key:
|
|
3207
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$5, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
|
|
3208
|
+
key: 2,
|
|
3131
3209
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3132
3210
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
3133
3211
|
width: "240px",
|
|
@@ -3191,6 +3269,7 @@ const _hoisted_1$d = {
|
|
|
3191
3269
|
class: "item_require"
|
|
3192
3270
|
};
|
|
3193
3271
|
const _hoisted_2$8 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
3272
|
+
const _hoisted_3$4 = { key: 1 };
|
|
3194
3273
|
function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3195
3274
|
const _component_el_tooltip = ElTooltip;
|
|
3196
3275
|
const _component_el_option = ElOption;
|
|
@@ -3246,8 +3325,8 @@ function _sfc_render$d(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3246
3325
|
]),
|
|
3247
3326
|
_: 1
|
|
3248
3327
|
}, 8, ["modelValue", "placeholder", "disabled", "size"])) : createCommentVNode("", true),
|
|
3249
|
-
!_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
|
|
3250
|
-
key:
|
|
3328
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$4, toDisplayString(_ctx.data[_ctx.item.data.fieldName].join(",") || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_select, {
|
|
3329
|
+
key: 2,
|
|
3251
3330
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3252
3331
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
3253
3332
|
width: "240px",
|
|
@@ -3309,7 +3388,7 @@ const _hoisted_1$c = {
|
|
|
3309
3388
|
class: "item_require"
|
|
3310
3389
|
};
|
|
3311
3390
|
const _hoisted_2$7 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
3312
|
-
const _hoisted_3$
|
|
3391
|
+
const _hoisted_3$3 = /* @__PURE__ */ createTextVNode("\u5DF2\u8BBE\u7F6E");
|
|
3313
3392
|
const _hoisted_4 = /* @__PURE__ */ createTextVNode("\u672A\u8BBE\u7F6E");
|
|
3314
3393
|
const _hoisted_5 = /* @__PURE__ */ createTextVNode("\u666E\u901A\u8BBE\u7F6E");
|
|
3315
3394
|
const _hoisted_6 = /* @__PURE__ */ createTextVNode("\u9AD8\u7EA7\u8BBE\u7F6E");
|
|
@@ -3351,7 +3430,7 @@ function _sfc_render$c(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3351
3430
|
size: _ctx.size
|
|
3352
3431
|
}, {
|
|
3353
3432
|
default: withCtx(() => [
|
|
3354
|
-
_hoisted_3$
|
|
3433
|
+
_hoisted_3$3
|
|
3355
3434
|
]),
|
|
3356
3435
|
_: 1
|
|
3357
3436
|
}, 8, ["size"])) : (openBlock(), createBlock(_component_el_button, {
|
|
@@ -3576,7 +3655,9 @@ const _sfc_main$9 = defineComponent({
|
|
|
3576
3655
|
{ fieldName: "placeholder", component: "Text" },
|
|
3577
3656
|
{ fieldName: "maxLength", component: "InputNumber" },
|
|
3578
3657
|
{ fieldName: "minLength", component: "InputNumber" },
|
|
3579
|
-
{ fieldName: "state", component: "Radio" }
|
|
3658
|
+
{ fieldName: "state", component: "Radio" },
|
|
3659
|
+
{ fieldName: "align", component: "Radio" },
|
|
3660
|
+
{ fieldName: "rule", component: "Rule" }
|
|
3580
3661
|
]),
|
|
3581
3662
|
actionType: ["onChange", "onFocus", "onBlur"],
|
|
3582
3663
|
props: {
|
|
@@ -3601,6 +3682,7 @@ const _hoisted_1$9 = {
|
|
|
3601
3682
|
class: "item_require"
|
|
3602
3683
|
};
|
|
3603
3684
|
const _hoisted_2$4 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
3685
|
+
const _hoisted_3$2 = { key: 1 };
|
|
3604
3686
|
function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3605
3687
|
const _component_el_tooltip = ElTooltip;
|
|
3606
3688
|
const _component_el_input = ElInput;
|
|
@@ -3638,30 +3720,32 @@ function _sfc_render$9(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3638
3720
|
key: 0,
|
|
3639
3721
|
modelValue: _ctx.item.data.default,
|
|
3640
3722
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.item.data.default = $event),
|
|
3641
|
-
width: "
|
|
3723
|
+
width: "200px",
|
|
3642
3724
|
placeholder: _ctx.item.data.placeholder,
|
|
3643
3725
|
size: _ctx.size,
|
|
3644
3726
|
clearable: "",
|
|
3645
3727
|
disabled: _ctx.item.data.state === "disabled",
|
|
3646
3728
|
readonly: _ctx.item.data.state === "readonly",
|
|
3647
3729
|
maxlength: _ctx.item.data.maxLength,
|
|
3648
|
-
minlength: _ctx.item.data.minLength
|
|
3649
|
-
|
|
3650
|
-
|
|
3651
|
-
|
|
3730
|
+
minlength: _ctx.item.data.minLength,
|
|
3731
|
+
class: normalizeClass("input-" + _ctx.item.data.align)
|
|
3732
|
+
}, null, 8, ["modelValue", "placeholder", "size", "disabled", "readonly", "maxlength", "minlength", "class"])) : createCommentVNode("", true),
|
|
3733
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$2, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
|
|
3734
|
+
key: 2,
|
|
3652
3735
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3653
3736
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
3654
|
-
width: "
|
|
3737
|
+
width: "200px",
|
|
3655
3738
|
placeholder: _ctx.item.data.placeholder,
|
|
3656
3739
|
size: _ctx.size,
|
|
3657
3740
|
disabled: _ctx.item.data.state === "disabled",
|
|
3658
3741
|
readonly: _ctx.item.data.state === "readonly",
|
|
3659
3742
|
maxlength: _ctx.item.data.maxLength,
|
|
3660
3743
|
minlength: _ctx.item.data.minLength,
|
|
3744
|
+
class: normalizeClass("input-" + _ctx.item.data.align),
|
|
3661
3745
|
clearable: "",
|
|
3662
3746
|
onFocus: _cache[2] || (_cache[2] = ($event) => _ctx.execFunc("onFocus")),
|
|
3663
3747
|
onBlur: _cache[3] || (_cache[3] = ($event) => _ctx.execFunc("onBlur"))
|
|
3664
|
-
}, null, 8, ["modelValue", "placeholder", "size", "disabled", "readonly", "maxlength", "minlength"])) : createCommentVNode("", true)
|
|
3748
|
+
}, null, 8, ["modelValue", "placeholder", "size", "disabled", "readonly", "maxlength", "minlength", "class"])) : createCommentVNode("", true)
|
|
3665
3749
|
], 4)
|
|
3666
3750
|
], 2);
|
|
3667
3751
|
}
|
|
@@ -3708,6 +3792,7 @@ const _hoisted_1$8 = {
|
|
|
3708
3792
|
class: "item_require"
|
|
3709
3793
|
};
|
|
3710
3794
|
const _hoisted_2$3 = /* @__PURE__ */ createElementVNode("span", { class: "tip iconfontui icon-tishi" }, null, -1);
|
|
3795
|
+
const _hoisted_3$1 = { key: 1 };
|
|
3711
3796
|
function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3712
3797
|
const _component_el_tooltip = ElTooltip;
|
|
3713
3798
|
const _component_el_input = ElInput;
|
|
@@ -3754,8 +3839,8 @@ function _sfc_render$8(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
3754
3839
|
autosize: _ctx.item.data.autoHeight,
|
|
3755
3840
|
size: _ctx.size
|
|
3756
3841
|
}, null, 8, ["modelValue", "placeholder", "disabled", "readonly", "maxlength", "minlength", "autosize", "size"])) : createCommentVNode("", true),
|
|
3757
|
-
!_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
|
|
3758
|
-
key:
|
|
3842
|
+
!_ctx.drag && _ctx.item.data.state === "readonly" ? (openBlock(), createElementBlock("span", _hoisted_3$1, toDisplayString(_ctx.data[_ctx.item.data.fieldName] || "--"), 1)) : !_ctx.drag ? (openBlock(), createBlock(_component_el_input, {
|
|
3843
|
+
key: 2,
|
|
3759
3844
|
type: "textarea",
|
|
3760
3845
|
modelValue: _ctx.data[_ctx.item.data.fieldName],
|
|
3761
3846
|
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => _ctx.data[_ctx.item.data.fieldName] = $event),
|
|
@@ -5181,7 +5266,7 @@ Object.keys(files).forEach((fileName) => {
|
|
|
5181
5266
|
}
|
|
5182
5267
|
});
|
|
5183
5268
|
const RichText = defineAsyncComponent({
|
|
5184
|
-
loader: () => import('./index-
|
|
5269
|
+
loader: () => import('./index-015ed509.mjs'),
|
|
5185
5270
|
loadingComponent: Loading
|
|
5186
5271
|
});
|
|
5187
5272
|
RichText.ControlType = "RichText";
|
|
@@ -5190,7 +5275,7 @@ RichText.icon = "icon-textEdit";
|
|
|
5190
5275
|
RichText.formConfig = getFormConfig("RichText");
|
|
5191
5276
|
utilFuns[RichText.ControlType] = RichText;
|
|
5192
5277
|
const jsonEditor = defineAsyncComponent({
|
|
5193
|
-
loader: () => import('./index-
|
|
5278
|
+
loader: () => import('./index-115b67c5.mjs'),
|
|
5194
5279
|
loadingComponent: Loading
|
|
5195
5280
|
});
|
|
5196
5281
|
jsonEditor.ControlType = "JsonEditor";
|
|
@@ -5200,14 +5285,14 @@ jsonEditor.formConfig = getFormConfig("JsonEditor", [{ fieldName: "default", com
|
|
|
5200
5285
|
jsonEditor.rule = _.getJsonValidate();
|
|
5201
5286
|
utilFuns[jsonEditor.ControlType] = jsonEditor;
|
|
5202
5287
|
const formAction = defineAsyncComponent({
|
|
5203
|
-
loader: () => import('./formAction-
|
|
5288
|
+
loader: () => import('./formAction-922332c1.mjs'),
|
|
5204
5289
|
loadingComponent: Loading
|
|
5205
5290
|
});
|
|
5206
5291
|
formAction.ControlType = "FormAction";
|
|
5207
5292
|
formAction.isHide = true;
|
|
5208
5293
|
utilFuns[formAction.ControlType] = formAction;
|
|
5209
5294
|
const Rule = defineAsyncComponent({
|
|
5210
|
-
loader: () => import('./index-
|
|
5295
|
+
loader: () => import('./index-afbcc030.mjs'),
|
|
5211
5296
|
loadingComponent: Loading
|
|
5212
5297
|
});
|
|
5213
5298
|
Rule.ControlType = "Rule";
|
|
@@ -5216,7 +5301,7 @@ utilFuns[Rule.ControlType] = Rule;
|
|
|
5216
5301
|
const install = (app) => {
|
|
5217
5302
|
app.config.globalProperties.$formcomponents = utilFuns;
|
|
5218
5303
|
};
|
|
5219
|
-
const Dynamicform = defineAsyncComponent(() => import('./starfish-form-
|
|
5304
|
+
const Dynamicform = defineAsyncComponent(() => import('./starfish-form-9cc90058.mjs'));
|
|
5220
5305
|
const main = {
|
|
5221
5306
|
install
|
|
5222
5307
|
};
|
|
@@ -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-c0754020.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
|
@@ -84,6 +84,21 @@
|
|
|
84
84
|
flex-direction: column;
|
|
85
85
|
align-items: flex-start;
|
|
86
86
|
}
|
|
87
|
+
.starfish-editor .starfish-formitem.starfish-vertical .control .input-left .el-input__inner,
|
|
88
|
+
.starfish-form .starfish-formitem.starfish-vertical .control .input-left .el-input__inner,
|
|
89
|
+
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .input-left .el-input__inner {
|
|
90
|
+
text-align: left;
|
|
91
|
+
}
|
|
92
|
+
.starfish-editor .starfish-formitem.starfish-vertical .control .input-right .el-input__inner,
|
|
93
|
+
.starfish-form .starfish-formitem.starfish-vertical .control .input-right .el-input__inner,
|
|
94
|
+
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .input-right .el-input__inner {
|
|
95
|
+
text-align: right;
|
|
96
|
+
}
|
|
97
|
+
.starfish-editor .starfish-formitem.starfish-vertical .control .input-center .el-input__inner,
|
|
98
|
+
.starfish-form .starfish-formitem.starfish-vertical .control .input-center .el-input__inner,
|
|
99
|
+
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .input-center .el-input__inner {
|
|
100
|
+
text-align: center;
|
|
101
|
+
}
|
|
87
102
|
.starfish-editor .starfish-formitem.starfish-vertical .control .el-input.el-input--default.el-input--suffix,
|
|
88
103
|
.starfish-editor .starfish-formitem.starfish-vertical .control .el-select.el-select--default,
|
|
89
104
|
.starfish-editor .starfish-formitem.starfish-vertical .control .el-input-number.el-input-number--default,
|
|
@@ -96,12 +111,12 @@
|
|
|
96
111
|
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .el-select.el-select--default,
|
|
97
112
|
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .el-input-number.el-input-number--default,
|
|
98
113
|
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .el-input.el-input--default.el-date-editor.el-date-editor--date {
|
|
99
|
-
width:
|
|
114
|
+
width: 200px;
|
|
100
115
|
}
|
|
101
116
|
.starfish-editor .starfish-formitem.starfish-vertical .control .el-input__wrapper,
|
|
102
117
|
.starfish-form .starfish-formitem.starfish-vertical .control .el-input__wrapper,
|
|
103
118
|
.starfish-dynamicform .starfish-formitem.starfish-vertical .control .el-input__wrapper {
|
|
104
|
-
width:
|
|
119
|
+
width: 200px;
|
|
105
120
|
}
|
|
106
121
|
.starfish-editor .starfish-formitem.formCover,
|
|
107
122
|
.starfish-form .starfish-formitem.formCover,
|
|
@@ -27,6 +27,7 @@ export interface fields {
|
|
|
27
27
|
/**
|
|
28
28
|
* 校验规则
|
|
29
29
|
*/
|
|
30
|
+
rule?: string;
|
|
30
31
|
/**
|
|
31
32
|
* 默认内容
|
|
32
33
|
*/
|
|
@@ -61,6 +62,7 @@ interface Config {
|
|
|
61
62
|
fieldName: string;
|
|
62
63
|
component: string;
|
|
63
64
|
label?: string;
|
|
65
|
+
format?: string;
|
|
64
66
|
}
|
|
65
67
|
interface FormConfigReturn {
|
|
66
68
|
data: () => fields;
|
package/package.json
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
</el-tooltip>
|
|
9
9
|
</div>
|
|
10
10
|
<div class="control" :style="{marginLeft: labelalign != 'top'?labelWidth + 'px': ''}">
|
|
11
|
-
|
|
11
|
+
<!-- 只读的时候就只展示文本 -->
|
|
12
|
+
<span v-if="!drag && data[item.data.fieldName] && item.data.state === 'readonly'">{{ data[item.data.fieldName].join(',') || '--' }}</span>
|
|
13
|
+
<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'">
|
|
12
14
|
<el-checkbox v-for="(sitem, sindex) in item.data.itemConfig.items" :key="sindex" :label="sitem.value">{{ sitem.label }}</el-checkbox>
|
|
13
15
|
</el-checkbox-group>
|
|
14
16
|
<el-checkbox-group v-model="item.data.itemConfig.value" :class="{'vertical-group': item.data.arrangeMent === 'vertical'}" v-if="drag" :size="size" :disabled="item.data.state === 'disabled' || item.data.state === 'readonly'">
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
></el-date-picker>
|
|
24
24
|
|
|
25
25
|
<!-- 实际运行时的组件 -->
|
|
26
|
+
<!-- 只读的时候就展示文字 -->
|
|
27
|
+
<span v-if="!drag && item.data.state === 'readonly'">{{ formatReadonlyDate(data[item.data.fieldName], item.data.format) }}</span>
|
|
26
28
|
<el-date-picker
|
|
27
29
|
v-model="data[item.data.fieldName]"
|
|
28
30
|
width="240px"
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
:format="item.data.format"
|
|
31
33
|
:value-format="item.data.format"
|
|
32
34
|
:placeholder="item.data.placeholder"
|
|
33
|
-
v-if="!drag"
|
|
35
|
+
v-else-if="!drag"
|
|
34
36
|
:size="size"
|
|
35
37
|
:disabled="item.data.state === 'disabled'"
|
|
36
38
|
:readonly="item.data.state === 'readonly'"
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
nameCn: "日期",
|
|
49
51
|
icon: "icon-24gl-calendar",
|
|
50
52
|
formConfig: getFormConfig("Date", [
|
|
51
|
-
{ fieldName: "default", component: "
|
|
53
|
+
{ fieldName: "default", component: "DateTime" },
|
|
52
54
|
{ fieldName: "placeholder", component: "Text" },
|
|
53
55
|
{ fieldName: "format", component: "Selected" },
|
|
54
56
|
{ fieldName: "state", component: "Radio" },
|
|
@@ -73,9 +75,43 @@
|
|
|
73
75
|
};
|
|
74
76
|
|
|
75
77
|
return formatTypeMap[format] || 'date';
|
|
78
|
+
};
|
|
79
|
+
// 格式化只读日期显示
|
|
80
|
+
const formatReadonlyDate = (dateValue: any, format: string) => {
|
|
81
|
+
if (!dateValue) return '--';
|
|
82
|
+
|
|
83
|
+
// 如果已经是格式化好的字符串,直接返回
|
|
84
|
+
if (typeof dateValue === 'string') {
|
|
85
|
+
return dateValue;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 如果是日期对象,进行格式化
|
|
89
|
+
if (dateValue instanceof Date) {
|
|
90
|
+
const year = dateValue.getFullYear();
|
|
91
|
+
const month = String(dateValue.getMonth() + 1).padStart(2, '0');
|
|
92
|
+
const day = String(dateValue.getDate()).padStart(2, '0');
|
|
93
|
+
const hours = String(dateValue.getHours()).padStart(2, '0');
|
|
94
|
+
const minutes = String(dateValue.getMinutes()).padStart(2, '0');
|
|
95
|
+
const seconds = String(dateValue.getSeconds()).padStart(2, '0');
|
|
96
|
+
|
|
97
|
+
const formatMap: Record<string, string> = {
|
|
98
|
+
'YYYY': `${year}`,
|
|
99
|
+
'YYYY-MM': `${year}-${month}`,
|
|
100
|
+
'YYYY-MM-DD': `${year}-${month}-${day}`,
|
|
101
|
+
'YYYY-MM-DD HH': `${year}-${month}-${day} ${hours}`,
|
|
102
|
+
'YYYY-MM-DD HH:mm': `${year}-${month}-${day} ${hours}:${minutes}`,
|
|
103
|
+
'YYYY-MM-DD HH:mm:ss': `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
return formatMap[format] || `${year}-${month}-${day}`;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 其他情况返回原始值
|
|
110
|
+
return String(dateValue);
|
|
76
111
|
};
|
|
77
112
|
return {
|
|
78
|
-
getPickerType
|
|
113
|
+
getPickerType,
|
|
114
|
+
formatReadonlyDate
|
|
79
115
|
};
|
|
80
116
|
},
|
|
81
117
|
});
|