szld-libs 0.4.24 → 0.4.25

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.
@@ -34,7 +34,7 @@ const handleGetPlaceholder = (itemWithJson, langId) => {
34
34
  return defaultMessage;
35
35
  };
36
36
  const handleSetFormItemInitialValue = (itemWithJson) => {
37
- var _a, _b, _c, _d;
37
+ var _a, _b, _c, _d, _e, _f;
38
38
  const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
39
39
  let initialValue = itemWithJson.attrvalue || ((_b = itemWithJson.json) == null ? void 0 : _b.default) || "";
40
40
  if (inputType === "label" && initialValue) {
@@ -77,6 +77,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
77
77
  initialValue = [];
78
78
  }
79
79
  }
80
+ if (inputType === "time-picker" && !initialValue && ((_e = itemWithJson.json) == null ? void 0 : _e["auto-generate"]) && ((_f = itemWithJson.json) == null ? void 0 : _f["auto-generate-type"]) === "currenttime") {
81
+ initialValue = dayjs().format("YYYY-MM-DD HH:mm:ss:ss");
82
+ }
80
83
  if (itemWithJson.attrtype === 1) {
81
84
  initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
82
85
  }
@@ -18,6 +18,8 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'auto-generate'?: boolean; // 是否自动生成
22
+ 'auto-generate-type'?: string; // 自动生成类型
21
23
  'instance-source-number'?: string; // 实例来源编号,配合instance-url使用
22
24
  'field-names'?: string; // 级联选择的自定义字段名
23
25
  'search-field'?: any; // 是否搜索字段
@@ -0,0 +1,8 @@
1
+ import { CalendarProps, CalendarType } from 'react-vant';
2
+ declare const StringCompatibleCalendar: (props: {
3
+ value?: string | string[] | undefined;
4
+ onChange?: ((date: string | string[]) => void) | undefined;
5
+ langId: string;
6
+ type?: CalendarType | undefined;
7
+ } & CalendarProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default StringCompatibleCalendar;
@@ -0,0 +1,79 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Calendar, Cell } from "react-vant";
3
+ import dayjs from "dayjs";
4
+ import { useState, useEffect } from "react";
5
+ const StringCompatibleCalendar = (props) => {
6
+ const { value, onChange, langId, type, ...restProps } = props;
7
+ const [internalValue, setInternalValue] = useState(() => {
8
+ if (!value)
9
+ return void 0;
10
+ if (Array.isArray(value)) {
11
+ return value.map((v) => {
12
+ if (typeof v === "string") {
13
+ return dayjs(v).toDate();
14
+ }
15
+ return v;
16
+ });
17
+ }
18
+ if (typeof value === "string") {
19
+ if (type === "multiple") {
20
+ return value.split(",").map((v) => {
21
+ if (typeof v === "string") {
22
+ return dayjs(v).toDate();
23
+ }
24
+ return v;
25
+ });
26
+ }
27
+ return dayjs(value).toDate();
28
+ }
29
+ return value;
30
+ });
31
+ useEffect(() => {
32
+ if (!value) {
33
+ setInternalValue(void 0);
34
+ return;
35
+ }
36
+ if (Array.isArray(value)) {
37
+ setInternalValue(value.map((v) => typeof v === "string" ? dayjs(v).toDate() : v));
38
+ } else if (typeof value === "string") {
39
+ setInternalValue(dayjs(value).toDate());
40
+ } else {
41
+ setInternalValue(value);
42
+ }
43
+ }, [value]);
44
+ const handleChange = (date) => {
45
+ if (!onChange)
46
+ return;
47
+ if (Array.isArray(date)) {
48
+ const strArr = date.map((d) => dayjs(d).format("YYYY-MM-DD"));
49
+ onChange(strArr);
50
+ } else {
51
+ const str = dayjs(date).format("YYYY-MM-DD");
52
+ onChange(str);
53
+ }
54
+ };
55
+ return /* @__PURE__ */ jsx(Calendar, { type, value: internalValue, onConfirm: handleChange, children: (val, actions) => {
56
+ const valType = typeof val;
57
+ if (valType === "string") {
58
+ val = val.split("~");
59
+ if (val.length === 1) {
60
+ val = [val[0], val[1]];
61
+ }
62
+ }
63
+ return /* @__PURE__ */ jsx(
64
+ Cell,
65
+ {
66
+ style: { padding: 0 },
67
+ value: val ? val.map(
68
+ (el) => dayjs(el).format("YYYY-MM-DD")
69
+ ).join("~") : langId === "10001" ? "请选择日期" : "Please select a date",
70
+ onClick: (e) => {
71
+ actions.open();
72
+ }
73
+ }
74
+ );
75
+ } });
76
+ };
77
+ export {
78
+ StringCompatibleCalendar as default
79
+ };
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
@@ -14,7 +14,8 @@ import MySelect from "./mySelect";
14
14
  import MyUpload from "./myUpload";
15
15
  import MyRadio from "./myRadio";
16
16
  import { App, Col, Collapse, Card, Flex, Button, DatePicker, Tooltip } from "antd";
17
- import { Form, Input, Calendar, Cell, DatetimePicker } from "react-vant";
17
+ import { Form, Input, DatetimePicker } from "react-vant";
18
+ import StringCompatibleCalendar from "./myCalendar";
18
19
  dayjs.extend(isoWeek);
19
20
  function useDynamicForm(props) {
20
21
  const {
@@ -601,48 +602,27 @@ function useDynamicForm(props) {
601
602
  );
602
603
  }
603
604
  case "range-picker":
604
- return /* @__PURE__ */ jsx(Calendar, { type: "range", readOnly: readonly, children: (val, actions) => {
605
- const valType = typeof val;
606
- if (valType === "string") {
607
- val = val.split("~");
608
- if (val.length === 1) {
609
- val = [val[0], val[1]];
605
+ return /* @__PURE__ */ jsx(
606
+ StringCompatibleCalendar,
607
+ {
608
+ langId,
609
+ value: formatValue,
610
+ type: "range",
611
+ onChange: (date) => {
610
612
  }
611
613
  }
612
- return /* @__PURE__ */ jsx(
613
- Cell,
614
- {
615
- style: { padding: 0 },
616
- value: val ? val.map(
617
- (el) => dayjs(el).format("YYYY-MM-DD")
618
- ).join("~") : langId === "10001" ? "请选择日期" : "Please select a date",
619
- onClick: (e) => {
620
- actions.open();
621
- }
622
- }
623
- );
624
- } });
614
+ );
625
615
  case "multiple-date-picker":
626
- return /* @__PURE__ */ jsx(Calendar, { type: "multiple", children: (val, actions) => {
627
- const valType = typeof val;
628
- if (valType === "string") {
629
- val = val.split(",");
630
- }
631
- return /* @__PURE__ */ jsx(
632
- Cell,
633
- {
634
- style: { padding: 0 },
635
- value: val ? val.map(
636
- (el) => dayjs(el).format("YYYY-MM-DD")
637
- ).join(",") : langId === "10001" ? "请选择日期" : "Please select a date",
638
- onClick: () => {
639
- if (!readonly) {
640
- actions.open();
641
- }
642
- }
616
+ return /* @__PURE__ */ jsx(
617
+ StringCompatibleCalendar,
618
+ {
619
+ langId,
620
+ value: formatValue,
621
+ type: "multiple",
622
+ onChange: (date) => {
643
623
  }
644
- );
645
- } });
624
+ }
625
+ );
646
626
  case "radio":
647
627
  return /* @__PURE__ */ jsx(
648
628
  MyRadio,
package/es/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { commonRequestWidthParams, uploadFormAction, commonRequest } from "./services";
3
- import { BackHeader, DynamicForm } from "./main";
3
+ import { handleAttrList } from "./utils/method";
4
+ import { BackHeader, DynamicFormMobile } from "./main";
4
5
  import { BrowserRouter } from "react-router-dom";
5
- import { ConfigProvider, App, Form } from "antd";
6
+ import { ConfigProvider, App } from "antd";
7
+ import { Form } from "react-vant";
6
8
  import { useRef, useState, useEffect } from "react";
7
9
  import ReactDOM from "react-dom/client";
8
10
  import zhCN from "antd/es/locale/zh_CN";
@@ -20,14 +22,23 @@ const Demo = () => {
20
22
  const onValuesChange = async (values, allValues) => {
21
23
  };
22
24
  useEffect(() => {
23
- setList(attrList);
25
+ setList(handleAttrList(attrList));
26
+ setTimeout(() => {
27
+ form.setFieldsValue({
28
+ customFormList: [
29
+ {
30
+ "30BDE6E7977E40069B55DDE61C8795AE": ["2026-05-21", "2026-05-28"]
31
+ }
32
+ ]
33
+ });
34
+ }, 2e3);
24
35
  }, []);
25
36
  const onFinish = async (values) => {
26
37
  };
27
38
  return /* @__PURE__ */ jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
28
39
  /* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
29
40
  /* @__PURE__ */ jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsx(Form, { form, onValuesChange, onFinish, children: /* @__PURE__ */ jsx(
30
- DynamicForm,
41
+ DynamicFormMobile,
31
42
  {
32
43
  formConfig: list,
33
44
  readonly: false,
@@ -40,6 +51,7 @@ const Demo = () => {
40
51
  commonRequest,
41
52
  instructionShowMode: "icon",
42
53
  ref: formRef,
54
+ formShowType: "table",
43
55
  langId
44
56
  }
45
57
  ) }) }),
package/es/mock/index.js CHANGED
@@ -2,270 +2,78 @@ const baseAttrList = [];
2
2
  const attrList = [
3
3
  {
4
4
  xh: 1,
5
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
5
+ asid: "06C6CE201AB44B2CAAB11C753374AA40",
6
6
  astype: 0,
7
- tname: "tcdkpz_table",
8
- attrid: "452A52271CB640E8A7EBA64114E41823",
9
- attrname: "套餐编号",
7
+ tname: "tsyy_table2",
8
+ attrid: "30BDE6E7977E40069B55DDE61C8795AE",
9
+ attrname: "Dates",
10
10
  attrtype: 0,
11
- info: '{"input":"text","dataType":"string","length":100,"auto-generate":true,"auto-generate-type":"guid","hidden":true}',
11
+ info: '{"readonly":false,"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
12
12
  info_base64: 0,
13
- createtime: "2026-05-20 15:03:42",
13
+ createtime: "2026-02-11 15:12:26",
14
14
  attrvalue: "",
15
- serialnum: 0,
16
- children: [],
17
- json: {
18
- input: "text",
19
- dataType: "string",
20
- length: 100,
21
- "auto-generate": true,
22
- "auto-generate-type": "guid",
23
- hidden: true
24
- }
15
+ serialnum: 1,
16
+ children: []
25
17
  },
26
18
  {
27
19
  xh: 2,
28
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
20
+ asid: "06C6CE201AB44B2CAAB11C753374AA40",
29
21
  astype: 0,
30
- tname: "tcdkpz_table",
31
- attrid: "8B8A0AE3A5EB498982E03F4EA937A3E0",
32
- attrname: "顺序号",
22
+ tname: "tsyy_table2",
23
+ attrid: "38A7DADC6D64492D83DA607EC121A02D",
24
+ attrname: "How Many Times",
33
25
  attrtype: 0,
34
- info: '{"input":"number","dataType":"int","must":true}',
26
+ info: '{"input":"text","dataType":"string","length":10,"input-width":140,"must":true}',
35
27
  info_base64: 0,
36
- createtime: "2026-05-22 14:56:07",
28
+ createtime: "2026-02-11 15:12:26",
37
29
  attrvalue: "",
38
- serialnum: 1,
39
- children: [],
40
- json: {
41
- input: "number",
42
- dataType: "int",
43
- must: true
44
- }
30
+ serialnum: 2,
31
+ children: []
45
32
  },
46
33
  {
47
34
  xh: 3,
48
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
35
+ asid: "06C6CE201AB44B2CAAB11C753374AA40",
49
36
  astype: 0,
50
- tname: "tcdkpz_table",
51
- attrid: "A8D4CF41106F4E1F8090A767F962A744",
52
- attrname: "套餐说明",
37
+ tname: "tsyy_table2",
38
+ attrid: "7BB9BE8A96824CCF89B721C8F1AF9F38",
39
+ attrname: "Feeding Time",
53
40
  attrtype: 0,
54
- info: '{"input":"text","dataType":"string","length":200,"must":true}',
41
+ info: '{"input":"select","dataType":"string","length":100,"inputType":"local","data":["7:00am – 7:30am", "7:30am – 8:00am", "8:00am – 8:30am", "8:30am – 9:00am", "9:00am – 9:30am", "9:30am – 10:00am", "10:00am – 10:30am", "10:30am – 11:00am", "11:00am – 11:30am", "11:30am – 12:00pm", "12:00pm – 12:30pm", "12:30pm – 1:00pm", "1:00pm – 1:30pm", "1:30pm – 2:00pm", "2:00pm – 2:30pm", "2:30pm – 3:00pm", "3:00pm – 3:30pm", "3:30pm – 4:00pm", "4:00pm – 4:30pm", "4:30pm – 5:00pm", "5:00pm – 5:30pm", "5:30pm – 6:00pm", "6:00pm – 6:30pm", "6:30pm – 7:00pm", "7:00pm – 7:30pm", "7:30pm – 8:00pm"],"must":true}',
55
42
  info_base64: 0,
56
- createtime: "2026-05-20 15:03:42",
43
+ createtime: "2026-02-11 15:12:26",
57
44
  attrvalue: "",
58
- serialnum: 2,
59
- children: [],
60
- json: {
61
- input: "text",
62
- dataType: "string",
63
- length: 200,
64
- must: true
65
- }
45
+ serialnum: 3,
46
+ children: []
66
47
  },
67
48
  {
68
49
  xh: 4,
69
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
50
+ asid: "06C6CE201AB44B2CAAB11C753374AA40",
70
51
  astype: 0,
71
- tname: "tcdkpz_table",
72
- attrid: "350AF384E18C490D862A3B930A7DED8B",
73
- attrname: "关联服务编号",
52
+ tname: "tsyy_table2",
53
+ attrid: "665F59E637664037939512C9877EAD75",
54
+ attrname: "Meds Info",
74
55
  attrtype: 0,
75
- info: '{"input":"text","dataType":"string","length":100,"must":true,"hidden":true}',
56
+ info: '{"input":"text","dataType":"string","length":500,"input-width":240}',
76
57
  info_base64: 0,
77
- createtime: "2026-05-20 15:03:42",
58
+ createtime: "2026-02-11 15:12:26",
78
59
  attrvalue: "",
79
- serialnum: 3,
80
- children: [],
81
- json: {
82
- input: "text",
83
- dataType: "string",
84
- length: 100,
85
- must: true,
86
- hidden: true
87
- }
60
+ serialnum: 4,
61
+ children: []
88
62
  },
89
63
  {
90
64
  xh: 5,
91
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
92
- astype: 0,
93
- tname: "tcdkpz_table",
94
- attrid: "06DDAB9B8DC34A6FB65602238FF35DAD",
95
- attrname: "关联服务名称",
96
- attrtype: 0,
97
- info: '{"input":"select","inputType":"instance-url","dataType":"string","length":100,"instance-source-number":"5000245","key-field":{"06DDAB9B8DC34A6FB65602238FF35DAD":{"list":["003AB3221AE84161B87368F67FD7F4F4"],"delimiter":"-"},"350AF384E18C490D862A3B930A7DED8B":{"list":["B4604AEB3C3C46239958C90C98911839"],"delimiter":","}}}',
98
- info_base64: 0,
99
- createtime: "2026-05-25 16:00:07",
100
- attrvalue: "",
101
- serialnum: 4,
102
- children: [],
103
- json: {
104
- input: "select",
105
- inputType: "instance-url",
106
- dataType: "string",
107
- length: 100,
108
- "instance-source-number": "5000245",
109
- "key-field": {
110
- "06DDAB9B8DC34A6FB65602238FF35DAD": {
111
- list: ["003AB3221AE84161B87368F67FD7F4F4"],
112
- delimiter: "-"
113
- },
114
- "350AF384E18C490D862A3B930A7DED8B": {
115
- list: ["B4604AEB3C3C46239958C90C98911839"],
116
- delimiter: ","
117
- }
118
- }
119
- }
120
- },
121
- {
122
- xh: 6,
123
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
65
+ asid: "06C6CE201AB44B2CAAB11C753374AA40",
124
66
  astype: 0,
125
- tname: "tcdkpz_table",
126
- attrid: "78B7A74ECE664836917FEB4502965E14",
127
- attrname: "关联房型编号",
67
+ tname: "tsyy_table2",
68
+ attrid: "290CF33D2AAD45399987987FAB80900B",
69
+ attrname: "Feeding Instruction",
128
70
  attrtype: 0,
129
- info: '{"input":"text","dataType":"string","length":100,"hidden":true}',
71
+ info: '{"input":"text","dataType":"string","length":500,"input-width":340}',
130
72
  info_base64: 0,
131
- createtime: "2026-05-25 16:00:16",
73
+ createtime: "2026-02-11 15:12:26",
132
74
  attrvalue: "",
133
75
  serialnum: 5,
134
- children: [],
135
- json: {
136
- input: "text",
137
- dataType: "string",
138
- length: 100,
139
- hidden: true
140
- }
141
- },
142
- {
143
- xh: 7,
144
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
145
- astype: 0,
146
- tname: "tcdkpz_table",
147
- attrid: "AFFAD31706E84259B4A3FF71F0752362",
148
- attrname: "关联房型名称",
149
- attrtype: 0,
150
- info: '{"input":"text","inputType":"instance-url","dataType":"string","length":100,"instance-source-number":5000033,"key-field":{"AFFAD31706E84259B4A3FF71F0752362":{"list":["DCC3C536A7BC41A2B972CA8779FC3CAC"],"delimiter":"-"},"78B7A74ECE664836917FEB4502965E14":{"list":["1710D157CDFF46A7A4E4501095C8ACBE"],"delimiter":","}}}',
151
- info_base64: 0,
152
- createtime: "2026-05-25 16:00:36",
153
- attrvalue: "",
154
- serialnum: 6,
155
- children: [],
156
- json: {
157
- input: "text",
158
- inputType: "instance-url",
159
- dataType: "string",
160
- length: 100,
161
- "instance-source-number": 5000033,
162
- "key-field": {
163
- AFFAD31706E84259B4A3FF71F0752362: {
164
- list: ["DCC3C536A7BC41A2B972CA8779FC3CAC"],
165
- delimiter: "-"
166
- },
167
- "78B7A74ECE664836917FEB4502965E14": {
168
- list: ["1710D157CDFF46A7A4E4501095C8ACBE"],
169
- delimiter: ","
170
- }
171
- }
172
- }
173
- },
174
- {
175
- xh: 8,
176
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
177
- astype: 0,
178
- tname: "tcdkpz_table",
179
- attrid: "571CDE321CE74DA48B5FC74537551689",
180
- attrname: "可抵扣天(晚)数",
181
- attrtype: 0,
182
- info: '{"input":"number","dataType":"int","must":true}',
183
- info_base64: 0,
184
- createtime: "2026-05-20 15:03:42",
185
- attrvalue: "",
186
- serialnum: 7,
187
- children: [],
188
- json: {
189
- input: "number",
190
- dataType: "int",
191
- must: true
192
- }
193
- },
194
- {
195
- xh: 9,
196
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
197
- astype: 0,
198
- tname: "tcdkpz_table",
199
- attrid: "0EFC42CF4F9946DDA52C754F545E963A",
200
- attrname: "套餐金额",
201
- attrtype: 0,
202
- info: '{"input":"text","dataType":"string","length":"100","must":true}',
203
- info_base64: 0,
204
- createtime: "2026-05-20 15:03:42",
205
- attrvalue: "",
206
- serialnum: 8,
207
- children: [],
208
- json: {
209
- input: "text",
210
- dataType: "string",
211
- length: "100",
212
- must: true
213
- }
214
- },
215
- {
216
- xh: 10,
217
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
218
- astype: 0,
219
- tname: "tcdkpz_table",
220
- attrid: "E5560CDEC6E3467C87BB5EEBEA4A9A5B",
221
- attrname: "是否启用",
222
- attrtype: 0,
223
- info: '{"input":"select","dataType":"string","length":100,"inputType":"local","must":true,"options":[{"label":"是","value":"5000024-1"},{"label":"否","value":"5000024-2"}]}',
224
- info_base64: 0,
225
- createtime: "2026-05-21 09:51:28",
226
- attrvalue: "",
227
- serialnum: 9,
228
- children: [],
229
- json: {
230
- input: "select",
231
- dataType: "string",
232
- length: 100,
233
- inputType: "local",
234
- must: true,
235
- options: [
236
- {
237
- label: "是",
238
- value: "5000024-1"
239
- },
240
- {
241
- label: "否",
242
- value: "5000024-2"
243
- }
244
- ]
245
- }
246
- },
247
- {
248
- xh: 11,
249
- asid: "A16FC2DAFC9F4786A0BCE4842F680B21",
250
- astype: 0,
251
- tname: "tcdkpz_table",
252
- attrid: "B602827557DB4F87B760FA243FCFB581",
253
- attrname: "创建时间",
254
- attrtype: 0,
255
- info: '{"input":"time-picker","dataType":"datetime","must":true,"auto-generate":true,"auto-generate-type":"currenttime","hidden":true}',
256
- info_base64: 0,
257
- createtime: "2026-05-20 15:03:42",
258
- attrvalue: "",
259
- serialnum: 10,
260
- children: [],
261
- json: {
262
- input: "time-picker",
263
- dataType: "datetime",
264
- must: true,
265
- "auto-generate": true,
266
- "auto-generate-type": "currenttime",
267
- hidden: true
268
- }
76
+ children: []
269
77
  }
270
78
  ];
271
79
  const langConfig = [
@@ -36,7 +36,7 @@ const handleGetPlaceholder = (itemWithJson, langId) => {
36
36
  return defaultMessage;
37
37
  };
38
38
  const handleSetFormItemInitialValue = (itemWithJson) => {
39
- var _a, _b, _c, _d;
39
+ var _a, _b, _c, _d, _e, _f;
40
40
  const inputType = (_a = itemWithJson.json) == null ? void 0 : _a.input;
41
41
  let initialValue = itemWithJson.attrvalue || ((_b = itemWithJson.json) == null ? void 0 : _b.default) || "";
42
42
  if (inputType === "label" && initialValue) {
@@ -79,6 +79,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
79
79
  initialValue = [];
80
80
  }
81
81
  }
82
+ if (inputType === "time-picker" && !initialValue && ((_e = itemWithJson.json) == null ? void 0 : _e["auto-generate"]) && ((_f = itemWithJson.json) == null ? void 0 : _f["auto-generate-type"]) === "currenttime") {
83
+ initialValue = dayjs().format("YYYY-MM-DD HH:mm:ss:ss");
84
+ }
82
85
  if (itemWithJson.attrtype === 1) {
83
86
  initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
84
87
  }
@@ -18,6 +18,8 @@ export interface IformConfigItem {
18
18
  }
19
19
 
20
20
  export interface Ijson {
21
+ 'auto-generate'?: boolean; // 是否自动生成
22
+ 'auto-generate-type'?: string; // 自动生成类型
21
23
  'instance-source-number'?: string; // 实例来源编号,配合instance-url使用
22
24
  'field-names'?: string; // 级联选择的自定义字段名
23
25
  'search-field'?: any; // 是否搜索字段
@@ -0,0 +1,8 @@
1
+ import { CalendarProps, CalendarType } from 'react-vant';
2
+ declare const StringCompatibleCalendar: (props: {
3
+ value?: string | string[] | undefined;
4
+ onChange?: ((date: string | string[]) => void) | undefined;
5
+ langId: string;
6
+ type?: CalendarType | undefined;
7
+ } & CalendarProps) => import("react/jsx-runtime").JSX.Element;
8
+ export default StringCompatibleCalendar;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const reactVant = require("react-vant");
4
+ const dayjs = require("dayjs");
5
+ const react = require("react");
6
+ const StringCompatibleCalendar = (props) => {
7
+ const { value, onChange, langId, type, ...restProps } = props;
8
+ const [internalValue, setInternalValue] = react.useState(() => {
9
+ if (!value)
10
+ return void 0;
11
+ if (Array.isArray(value)) {
12
+ return value.map((v) => {
13
+ if (typeof v === "string") {
14
+ return dayjs(v).toDate();
15
+ }
16
+ return v;
17
+ });
18
+ }
19
+ if (typeof value === "string") {
20
+ if (type === "multiple") {
21
+ return value.split(",").map((v) => {
22
+ if (typeof v === "string") {
23
+ return dayjs(v).toDate();
24
+ }
25
+ return v;
26
+ });
27
+ }
28
+ return dayjs(value).toDate();
29
+ }
30
+ return value;
31
+ });
32
+ react.useEffect(() => {
33
+ if (!value) {
34
+ setInternalValue(void 0);
35
+ return;
36
+ }
37
+ if (Array.isArray(value)) {
38
+ setInternalValue(value.map((v) => typeof v === "string" ? dayjs(v).toDate() : v));
39
+ } else if (typeof value === "string") {
40
+ setInternalValue(dayjs(value).toDate());
41
+ } else {
42
+ setInternalValue(value);
43
+ }
44
+ }, [value]);
45
+ const handleChange = (date) => {
46
+ if (!onChange)
47
+ return;
48
+ if (Array.isArray(date)) {
49
+ const strArr = date.map((d) => dayjs(d).format("YYYY-MM-DD"));
50
+ onChange(strArr);
51
+ } else {
52
+ const str = dayjs(date).format("YYYY-MM-DD");
53
+ onChange(str);
54
+ }
55
+ };
56
+ return /* @__PURE__ */ jsxRuntime.jsx(reactVant.Calendar, { type, value: internalValue, onConfirm: handleChange, children: (val, actions) => {
57
+ const valType = typeof val;
58
+ if (valType === "string") {
59
+ val = val.split("~");
60
+ if (val.length === 1) {
61
+ val = [val[0], val[1]];
62
+ }
63
+ }
64
+ return /* @__PURE__ */ jsxRuntime.jsx(
65
+ reactVant.Cell,
66
+ {
67
+ style: { padding: 0 },
68
+ value: val ? val.map(
69
+ (el) => dayjs(el).format("YYYY-MM-DD")
70
+ ).join("~") : langId === "10001" ? "请选择日期" : "Please select a date",
71
+ onClick: (e) => {
72
+ actions.open();
73
+ }
74
+ }
75
+ );
76
+ } });
77
+ };
78
+ module.exports = StringCompatibleCalendar;