szld-libs 0.4.38 → 0.4.40

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, _e, _f;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h;
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) {
@@ -81,6 +81,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
81
81
  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") {
82
82
  initialValue = dayjs().format("YYYY-MM-DD HH:mm:ss:ss");
83
83
  }
84
+ if (inputType === "time-picker" && !initialValue && ((_g = itemWithJson.json) == null ? void 0 : _g["auto-generate"]) && ((_h = itemWithJson.json) == null ? void 0 : _h["auto-generate-type"]) === "currenttimestamp") {
85
+ initialValue = dayjs().unix().toString();
86
+ }
84
87
  if (itemWithJson.attrtype === 1) {
85
88
  initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
86
89
  }
@@ -333,7 +333,7 @@ function useDynamicForm(props) {
333
333
  Form.Item,
334
334
  {
335
335
  label: (_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["combination-name"],
336
- required: (_e = itemWithJson.json) == null ? void 0 : _e.must,
336
+ required: ((_e = itemWithJson.json) == null ? void 0 : _e.must) && !hidden,
337
337
  children: /* @__PURE__ */ jsx(Space.Compact, { children: combinations.map((item, index) => {
338
338
  var _a2, _b2, _c2, _d2, _e2;
339
339
  let initValue = handleSetFormItemInitialValue(item);
@@ -359,7 +359,7 @@ function useDynamicForm(props) {
359
359
  noStyle: true,
360
360
  initialValue: initValue,
361
361
  rules: [
362
- ...((_c2 = item.json) == null ? void 0 : _c2.must) ? [
362
+ ...((_c2 = item.json) == null ? void 0 : _c2.must) && !hidden ? [
363
363
  {
364
364
  required: true,
365
365
  message: message2 || `${placeholder}${item.attrname}`
@@ -400,7 +400,7 @@ function useDynamicForm(props) {
400
400
  initialValue,
401
401
  hidden,
402
402
  rules: [
403
- ...((_f = itemWithJson.json) == null ? void 0 : _f.must) ? [
403
+ ...((_f = itemWithJson.json) == null ? void 0 : _f.must) && !hidden ? [
404
404
  {
405
405
  required: true,
406
406
  message: `${placeholder}${itemWithJson.attrname}`
@@ -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, _e, _f;
37
+ var _a, _b, _c, _d, _e, _f, _g, _h;
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) {
@@ -80,6 +80,9 @@ const handleSetFormItemInitialValue = (itemWithJson) => {
80
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
81
  initialValue = dayjs().format("YYYY-MM-DD HH:mm:ss:ss");
82
82
  }
83
+ if (inputType === "time-picker" && !initialValue && ((_g = itemWithJson.json) == null ? void 0 : _g["auto-generate"]) && ((_h = itemWithJson.json) == null ? void 0 : _h["auto-generate-type"]) === "currenttimestamp") {
84
+ initialValue = dayjs().unix().toString();
85
+ }
83
86
  if (itemWithJson.attrtype === 1) {
84
87
  initialValue = handleGetSingleAttrListObj(itemWithJson.children || []);
85
88
  }
@@ -52,10 +52,12 @@ const StringCompatibleCalendar = (props) => {
52
52
  onChange(str);
53
53
  }
54
54
  };
55
+ const placeholder = langId === "10001" ? "请选择日期" : "Please select a date";
55
56
  return /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Calendar, { type, value: internalValue, onConfirm: handleChange, children: (val, actions) => {
56
57
  const valType = typeof val;
58
+ const delimiter = type === "multiple" ? "," : "~";
57
59
  if (valType === "string") {
58
- val = val.split("~");
60
+ val = val.split(delimiter);
59
61
  if (val.length === 1) {
60
62
  val = [val[0], val[1]];
61
63
  }
@@ -66,7 +68,7 @@ const StringCompatibleCalendar = (props) => {
66
68
  style: { padding: 0 },
67
69
  value: val ? val.map(
68
70
  (el) => dayjs(el).format("YYYY-MM-DD")
69
- ).join("~") : langId === "10001" ? "请选择日期" : "Please select a date",
71
+ ).join(delimiter) : placeholder,
70
72
  onClick: (e) => {
71
73
  actions.open();
72
74
  }
@@ -303,14 +303,14 @@ function useDynamicForm(props) {
303
303
  flex: width,
304
304
  pointerEvents: readonly ? "none" : "auto",
305
305
  opacity: readonly ? 0.5 : 1,
306
- display: hidden ? "none" : "block"
306
+ display: hidden ? "none" : "flex"
307
307
  },
308
308
  label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
309
- required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
309
+ required: index === 0 ? ((_d2 = item.json) == null ? void 0 : _d2.must) && !hidden : false,
310
310
  name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
311
311
  initialValue: initValue,
312
312
  rules: [
313
- ...((_e2 = item.json) == null ? void 0 : _e2.must) ? [
313
+ ...((_e2 = item.json) == null ? void 0 : _e2.must) && !hidden ? [
314
314
  {
315
315
  required: true,
316
316
  message: message2 || `${placeholder}${item.attrname}`
@@ -351,10 +351,10 @@ function useDynamicForm(props) {
351
351
  style: {
352
352
  pointerEvents: readonly ? "none" : "auto",
353
353
  opacity: readonly ? 0.5 : 1,
354
- display: hidden ? "none" : "block"
354
+ display: hidden ? "none" : "flex"
355
355
  },
356
356
  rules: [
357
- ...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
357
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.must) && !hidden ? [
358
358
  {
359
359
  required: true,
360
360
  message: `${placeholder}${itemWithJson.attrname}`
package/es/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { commonRequestWidthParams, uploadFormAction, commonRequest } from "./services";
3
- import { handleAttrList } from "./utils/method";
3
+ import { handleAttrList, handleSubmitForm } from "./utils/method";
4
4
  import { BackHeader, DynamicFormMobile } from "./main";
5
5
  import { BrowserRouter } from "react-router-dom";
6
6
  import { ConfigProvider, App } from "antd";
7
- import { Form, Button } from "react-vant";
7
+ import { Form } from "react-vant";
8
8
  import { useRef, useState, useEffect } from "react";
9
9
  import ReactDOM from "react-dom/client";
10
10
  import zhCN from "antd/es/locale/zh_CN";
@@ -26,10 +26,16 @@ const Demo = () => {
26
26
  }, 2e3);
27
27
  }, []);
28
28
  const onFinish = async (values) => {
29
+ handleSubmitForm(
30
+ {
31
+ attr_list: attrList
32
+ },
33
+ values
34
+ );
29
35
  };
30
36
  return /* @__PURE__ */ jsxs("div", { style: { height: "100vh", display: "flex", flexDirection: "column", gap: 20 }, children: [
31
37
  /* @__PURE__ */ jsx(BackHeader, { title: "页头组件", isBack: true }),
32
- /* @__PURE__ */ jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, onFinish, children: [
38
+ /* @__PURE__ */ jsx("div", { style: { padding: "20px" }, children: /* @__PURE__ */ jsxs(Form, { form, onValuesChange, layout: "vertical", onFinish, children: [
33
39
  /* @__PURE__ */ jsx(
34
40
  DynamicFormMobile,
35
41
  {
@@ -47,7 +53,7 @@ const Demo = () => {
47
53
  langId
48
54
  }
49
55
  ),
50
- /* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" }, children: /* @__PURE__ */ jsx(Button, { round: true, nativeType: "submit", type: "primary", block: true, children: "提交" }) })
56
+ /* @__PURE__ */ jsx(Form.Item, { name: "submit", style: { marginLeft: "auto" } })
51
57
  ] }) }),
52
58
  /* @__PURE__ */ jsxs("div", { children: [
53
59
  "2. 测试循环滚动组件",