zy-react-library 1.0.160 → 1.0.162

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.
@@ -1,4 +1,4 @@
1
- import { Button, Col, Form, Row, Space, Spin, message } from "antd";
1
+ import { Button, Col, Form, message, Row, Space, Spin } from "antd";
2
2
  import FormItemsRenderer from "./FormItemsRenderer";
3
3
 
4
4
  /**
@@ -77,6 +77,8 @@ export interface FormOption {
77
77
  required?: boolean | ((formValues: FormValues) => boolean);
78
78
  /** 验证规则 */
79
79
  rules?: Rule | Rule[];
80
+ /** 是否使用字符验证限制 */
81
+ useConstraints?: boolean;
80
82
  /** 占位符文本,默认会根据传入的 render 类型自动判断(请选择、请输入)和 label 组合 */
81
83
  placeholder?: ReactNode;
82
84
  /** 提示信息,传入将在 label 右侧生成图标展示 tooltip */
@@ -147,17 +147,17 @@ const FormItemsRenderer = ({
147
147
  const render = option.render || FORM_ITEM_RENDER_ENUM.INPUT;
148
148
  switch (render) {
149
149
  case FORM_ITEM_RENDER_ENUM.INPUT:
150
- rules.push({ max: 50, message: "最多输入50字符" });
150
+ option.useConstraints !== false && rules.push({ max: 50, message: "最多输入50字符" });
151
151
  break;
152
152
 
153
153
  case FORM_ITEM_RENDER_ENUM.TEXTAREA:
154
- rules.push({ max: 500, message: "最多输入500字符" });
154
+ option.useConstraints !== false && rules.push({ max: 500, message: "最多输入500字符" });
155
155
  break;
156
156
 
157
157
  case FORM_ITEM_RENDER_ENUM.INPUT_NUMBER:
158
158
  case FORM_ITEM_RENDER_ENUM.NUMBER:
159
- rules.push({ pattern: /^(\d+)(\.\d{1,2})?$/, message: "请输入正确的数字,最多保留两位小数" });
160
- rules.push({
159
+ option.useConstraints !== false && rules.push({ pattern: /^(\d+)(\.\d{1,2})?$/, message: "请输入正确的数字,最多保留两位小数" });
160
+ option.useConstraints !== false && rules.push({
161
161
  validator: (_, value) => {
162
162
  if (value && Math.abs(Number.parseFloat(value)) > 999999999) {
163
163
  return Promise.reject("输入数值超出安全范围");
@@ -235,7 +235,7 @@ const FormItemsRenderer = ({
235
235
  const itemsFieldKey = getItemsFieldKey(option);
236
236
  /** @type {string | Function} */
237
237
  const render = option.render || FORM_ITEM_RENDER_ENUM.INPUT;
238
- const placeholder = option.placeholder || `请${render === FORM_ITEM_RENDER_ENUM.SELECT || render === FORM_ITEM_RENDER_ENUM.RADIO || render === FORM_ITEM_RENDER_ENUM.CHECKBOX ? "选择" : "输入"}${option.label}`;
238
+ const placeholder = option.placeholder || `请${[FORM_ITEM_RENDER_ENUM.INPUT, FORM_ITEM_RENDER_ENUM.TEXTAREA, FORM_ITEM_RENDER_ENUM.INPUT_NUMBER, FORM_ITEM_RENDER_ENUM.NUMBER].includes(render) ? "输入" : "选择"}${option.label}`;
239
239
 
240
240
  switch (render) {
241
241
  case FORM_ITEM_RENDER_ENUM.INPUT:
@@ -2,17 +2,28 @@ import { request } from "@cqsjjb/jjb-common-lib/http";
2
2
  import { Button, Descriptions, Divider, Space, Spin } from "antd";
3
3
  import dayjs from "dayjs";
4
4
  import { useEffect, useState } from "react";
5
- import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj";
6
- import { UPLOAD_FILE_TYPE_ENUM } from "../../../enum/uploadFile/gwj";
7
- import useDownloadFile from "../../../hooks/useDownloadFile";
8
- import useGetFile from "../../../hooks/useGetFile";
9
- import useGetUrlQuery from "../../../hooks/useGetUrlQuery";
10
- import { getFileName, getFileSuffix, getLabelName } from "../../../utils";
11
- import HeaderBack from "../../HeaderBack";
12
- import VideoIcon from "../../Icon/VideoIcon";
13
- import PreviewImg from "../../PreviewImg";
14
- import PreviewPdf from "../../PreviewPdf";
15
- import Video from "../../Video";
5
+ import HeaderBack from "zy-react-library/components/HeaderBack";
6
+ import VideoIcon from "zy-react-library/components/Icon/VideoIcon";
7
+ import PreviewImg from "zy-react-library/components/PreviewImg";
8
+ import PreviewPdf from "zy-react-library/components/PreviewPdf";
9
+ import Video from "zy-react-library/components/Video";
10
+ // import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "../../../enum/hidden/gwj";
11
+ // import { UPLOAD_FILE_TYPE_ENUM } from "../../../enum/uploadFile/gwj";
12
+ // import useDownloadFile from "../../../hooks/useDownloadFile";
13
+ // import useGetFile from "../../../hooks/useGetFile";
14
+ // import useGetUrlQuery from "../../../hooks/useGetUrlQuery";
15
+ // import { getFileName, getFileSuffix, getLabelName } from "../../../utils";
16
+ // import HeaderBack from "../../HeaderBack";
17
+ // import VideoIcon from "../../Icon/VideoIcon";
18
+ // import PreviewImg from "../../PreviewImg";
19
+ // import PreviewPdf from "../../PreviewPdf";
20
+ // import Video from "../../Video";
21
+ import { HIDDEN_SOURCE_ENUM, HIDDEN_STATE_ENUM } from "zy-react-library/enum/hidden/gwj";
22
+ import { UPLOAD_FILE_TYPE_ENUM } from "zy-react-library/enum/uploadFile/gwj";
23
+ import useDownloadFile from "zy-react-library/hooks/useDownloadFile";
24
+ import useGetFile from "zy-react-library/hooks/useGetFile";
25
+ import useGetUrlQuery from "zy-react-library/hooks/useGetUrlQuery";
26
+ import { getFileName, getFileSuffix, getLabelName } from "zy-react-library/utils";
16
27
 
17
28
  /**
18
29
  * 隐患查看组件(港务局版本)
@@ -72,7 +83,7 @@ function HiddenInfo(props) {
72
83
  if (info.hiddenRectifyUserCO[i].isRectificationScheme === 1 && info.hiddenRectifyUserCO[i].hiddenSchemeCO && Object.keys(info.hiddenRectifyUserCO[i].hiddenSchemeCO).length > 0) {
73
84
  const rectificationPlanImageFiles = await getFile({
74
85
  eqType: UPLOAD_FILE_TYPE_ENUM["8"],
75
- eqForeignKey: info.hiddenRectifyUserCO[i].hiddenSchemeId,
86
+ eqForeignKey: info.hiddenRectifyUserCO[i].hiddenSchemeCO.hiddenSchemeId,
76
87
  });
77
88
  setRectificationPlanImageFiles(prevState => [...prevState, rectificationPlanImageFiles]);
78
89
  }
@@ -145,7 +156,7 @@ function HiddenInfo(props) {
145
156
  },
146
157
  { label: "隐患位置描述", children: info.positionDesc },
147
158
  { label: "隐患发现人", children: info.creatorName },
148
- { label: "隐患发现时间", children: dayjs(info.hiddenFindTime).format("YYYY-MM-DD hh:mm:ss") },
159
+ { label: "隐患发现时间", children: dayjs(info.hiddenFindTime).format("YYYY-MM-DD HH:mm:ss") },
149
160
  {
150
161
  label: "整改类型",
151
162
  children: getLabelName({
@@ -156,7 +167,7 @@ function HiddenInfo(props) {
156
167
  {
157
168
  label: "是否相关方",
158
169
  children: getLabelName({
159
- list: [{ bianma: "1", name: "是" }, { bianma: "2", name: "否" }],
170
+ list: [{ bianma: "1", name: "是" }, { bianma: "0", name: "否" }],
160
171
  status: info.isRelated,
161
172
  }),
162
173
  },
@@ -389,8 +400,8 @@ function HiddenInfo(props) {
389
400
  { label: "整改人", children: item.userName },
390
401
  { label: "整改时间", children: item.rectificationTime },
391
402
  { label: "整改描述", children: item.descr },
392
- { label: "投入资金", children: item.investmentFunds },
393
- { label: "临时安全措施", children: info.tempSafeMeasure },
403
+ ...(item.investmentFunds ? [{ label: "投入资金", children: `${item.investmentFunds}元` }] : []),
404
+ ...(info.tempSafeMeasure ? [{ label: "临时安全措施", children: info.tempSafeMeasure }] : []),
394
405
  { label: "整改后图片", children: <PreviewImg files={afterRectificationImageFiles[index]} /> },
395
406
  { label: "整改方案", children: item.isRectificationScheme === 0 ? "无" : "有" },
396
407
  ...((item.isRectificationScheme === 1 && item.hiddenSchemeCO && Object.keys(item.hiddenSchemeCO).length > 0)
@@ -431,10 +442,10 @@ function HiddenInfo(props) {
431
442
  { label: "验收部门", children: item.deptName },
432
443
  { label: "验收人", children: item.userName },
433
444
  { label: "验收时间", children: item.rectificationTime },
434
- { label: "验收打回意见", children: item.repulseCause },
445
+ ...(item.repulseCause ? [{ label: "验收打回意见", children: item.repulseCause }] : []),
435
446
  { label: "是否合格", children: "合格" },
436
- { label: "验收描述", children: item.descr },
437
- { label: "验收图片", children: <PreviewImg files={acceptImageFiles[index]} /> },
447
+ ...(item.descr ? [{ label: "验收描述", children: item.descr }] : []),
448
+ ...((acceptImageFiles[index] && acceptImageFiles[index].length > 0) ? [{ label: "验收图片", children: <PreviewImg files={acceptImageFiles[index]} /> }] : []),
438
449
  ]}
439
450
  />
440
451
  ))
@@ -36,7 +36,7 @@ const MapSelector = (props) => {
36
36
  // 初始化地图
37
37
  const initMap = async () => {
38
38
  if (!window.BMapGL) {
39
- await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr");
39
+ await dynamicLoadJs("https://api.map.baidu.com/api?v=1.0&type=webgl&ak=OElqFYoKiAH8KFtph8ftLKF5NlNrbCUr&callback=initialize");
40
40
  }
41
41
 
42
42
  setLoading(true);
@@ -1,160 +1,160 @@
1
- import { useDocumentVisibility } from "ahooks";
2
- import { uniqueId } from "lodash-es";
3
- import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
4
- import { dynamicLoadCss, dynamicLoadJs } from "../../utils";
5
-
6
- /**
7
- * 视频播放组件
8
- */
9
- const AliPlayer = forwardRef(({
10
- source = "",
11
- vid = "",
12
- playAuth = "",
13
- cover = "",
14
- width = "100%",
15
- height = "600px",
16
- autoplay = true,
17
- showProgress = true,
18
- isLive = false,
19
- playTime = 0,
20
- onEnded,
21
- onTimeupdate,
22
- }, ref) => {
23
- const playerRef = useRef(null);
24
- const containerRef = useRef(null);
25
- const visibility = useDocumentVisibility();
26
- const className = useRef(uniqueId("_")).current;
27
-
28
- useImperativeHandle(ref, () => ({
29
- play: () => {
30
- playerRef.current && playerRef.current.play();
31
- },
32
- pause: () => {
33
- playerRef.current && playerRef.current.pause();
34
- },
35
- }));
36
-
37
- const onDisposeAliPlayer = () => {
38
- if (!playerRef.current)
39
- return;
40
- playerRef.current.dispose();
41
- playerRef.current = null;
42
- };
43
-
44
- const onCreateAliPlayer = async () => {
45
- if (!containerRef.current)
46
- return;
47
- if (!window.Aliplayer) {
48
- await dynamicLoadJs("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js");
49
- await dynamicLoadCss("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css");
50
- }
51
-
52
- onDisposeAliPlayer();
53
-
54
- const skinLayout = [
55
- { name: "bigPlayButton", align: "blabs", x: 30, y: 80 },
56
- { name: "H5Loading", align: "cc" },
57
- { name: "errorDisplay", align: "tlabs", x: 0, y: 0 },
58
- { name: "infoDisplay" },
59
- { name: "tooltip", align: "blabs", x: 0, y: 56 },
60
- { name: "thumbnail" },
61
- {
62
- name: "controlBar",
63
- align: "blabs",
64
- x: 0,
65
- y: 0,
66
- children: [
67
- { name: "playButton", align: "tl", x: 15, y: 12 },
68
- { name: "timeDisplay", align: "tl", x: 10, y: 7 },
69
- { name: "fullScreenButton", align: "tr", x: 10, y: 12 },
70
- { name: "setting", align: "tr", x: 15, y: 12 },
71
- { name: "volume", align: "tr", x: 5, y: 10 },
72
- ],
73
- },
74
- ];
75
-
76
- if (showProgress) {
77
- skinLayout[skinLayout.length - 1].children.unshift({
78
- name: "progress",
79
- align: "blabs",
80
- x: 0,
81
- y: 44,
82
- });
83
- }
84
-
85
- playerRef.current = new window.Aliplayer(
86
- {
87
- id: className,
88
- ...(source
89
- ? { source }
90
- : {
91
- vid,
92
- playauth: playAuth,
93
- qualitySort: "asc",
94
- format: "m3u8",
95
- encryptType: 1,
96
- mediaType: "video",
97
- isLive: true,
98
- rePlay: false,
99
- playsinline: true,
100
- controlBarVisibility: "hover",
101
- }),
102
- cover,
103
- width,
104
- height,
105
- autoplay,
106
- isLive,
107
- useH5Prism: true,
108
- skinLayout,
109
- },
110
- (player) => {
111
- if (autoplay) {
112
- player.play();
113
- }
114
-
115
- player.on("ended", () => {
116
- onEnded && onEnded();
117
- });
118
-
119
- player.on("timeupdate", () => {
120
- onTimeupdate && onTimeupdate(player.getCurrentTime());
121
- });
122
-
123
- if (playTime > 0) {
124
- player.seek(playTime);
125
- }
126
- },
127
- );
128
- };
129
-
130
- useEffect(() => {
131
- if (source || (vid && playAuth)) {
132
- onCreateAliPlayer();
133
- }
134
-
135
- return () => {
136
- onDisposeAliPlayer();
137
- };
138
- }, [source, vid, playAuth]);
139
-
140
- useEffect(() => {
141
- if (visibility === "hidden") {
142
- playerRef.current && playerRef.current.pause();
143
- }
144
- else {
145
- playerRef.current && playerRef.current.play();
146
- }
147
- }, [visibility]);
148
-
149
- return (
150
- <div
151
- ref={containerRef}
152
- id={className}
153
- style={{ width, height }}
154
- />
155
- );
156
- });
157
-
158
- AliPlayer.displayName = "AliPlayer";
159
-
160
- export default AliPlayer;
1
+ import { useDocumentVisibility } from "ahooks";
2
+ import { uniqueId } from "lodash-es";
3
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from "react";
4
+ import { dynamicLoadCss, dynamicLoadJs } from "../../utils";
5
+
6
+ /**
7
+ * 视频播放组件
8
+ */
9
+ const AliPlayer = forwardRef(({
10
+ source = "",
11
+ vid = "",
12
+ playAuth = "",
13
+ cover = "",
14
+ width = "100%",
15
+ height = "600px",
16
+ autoplay = true,
17
+ showProgress = true,
18
+ isLive = false,
19
+ playTime = 0,
20
+ onEnded,
21
+ onTimeupdate,
22
+ }, ref) => {
23
+ const playerRef = useRef(null);
24
+ const containerRef = useRef(null);
25
+ const visibility = useDocumentVisibility();
26
+ const className = useRef(uniqueId("_")).current;
27
+
28
+ useImperativeHandle(ref, () => ({
29
+ play: () => {
30
+ playerRef.current && playerRef.current.play();
31
+ },
32
+ pause: () => {
33
+ playerRef.current && playerRef.current.pause();
34
+ },
35
+ }));
36
+
37
+ const onDisposeAliPlayer = () => {
38
+ if (!playerRef.current)
39
+ return;
40
+ playerRef.current.dispose();
41
+ playerRef.current = null;
42
+ };
43
+
44
+ const onCreateAliPlayer = async () => {
45
+ if (!containerRef.current)
46
+ return;
47
+ if (!window.Aliplayer) {
48
+ await dynamicLoadJs("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/aliplayer-min.js");
49
+ await dynamicLoadCss("https://g.alicdn.com/apsara-media-box/imp-web-player/2.16.3/skins/default/aliplayer-min.css");
50
+ }
51
+
52
+ onDisposeAliPlayer();
53
+
54
+ const skinLayout = [
55
+ { name: "bigPlayButton", align: "blabs", x: 30, y: 80 },
56
+ { name: "H5Loading", align: "cc" },
57
+ { name: "errorDisplay", align: "tlabs", x: 0, y: 0 },
58
+ { name: "infoDisplay" },
59
+ { name: "tooltip", align: "blabs", x: 0, y: 56 },
60
+ { name: "thumbnail" },
61
+ {
62
+ name: "controlBar",
63
+ align: "blabs",
64
+ x: 0,
65
+ y: 0,
66
+ children: [
67
+ { name: "playButton", align: "tl", x: 15, y: 12 },
68
+ { name: "timeDisplay", align: "tl", x: 10, y: 7 },
69
+ { name: "fullScreenButton", align: "tr", x: 10, y: 12 },
70
+ { name: "setting", align: "tr", x: 15, y: 12 },
71
+ { name: "volume", align: "tr", x: 5, y: 10 },
72
+ ],
73
+ },
74
+ ];
75
+
76
+ if (showProgress) {
77
+ skinLayout[skinLayout.length - 1].children.unshift({
78
+ name: "progress",
79
+ align: "blabs",
80
+ x: 0,
81
+ y: 44,
82
+ });
83
+ }
84
+
85
+ playerRef.current = new window.Aliplayer(
86
+ {
87
+ id: className,
88
+ ...(source
89
+ ? { source }
90
+ : {
91
+ vid,
92
+ playauth: playAuth,
93
+ qualitySort: "asc",
94
+ format: "m3u8",
95
+ encryptType: 1,
96
+ mediaType: "video",
97
+ isLive: true,
98
+ rePlay: false,
99
+ playsinline: true,
100
+ controlBarVisibility: "hover",
101
+ }),
102
+ cover,
103
+ width,
104
+ height,
105
+ autoplay,
106
+ isLive,
107
+ useH5Prism: true,
108
+ skinLayout,
109
+ },
110
+ (player) => {
111
+ if (autoplay) {
112
+ player.play();
113
+ }
114
+
115
+ player.on("ended", () => {
116
+ onEnded && onEnded();
117
+ });
118
+
119
+ player.on("timeupdate", () => {
120
+ onTimeupdate && onTimeupdate(player.getCurrentTime());
121
+ });
122
+
123
+ if (playTime > 0) {
124
+ player.seek(playTime);
125
+ }
126
+ },
127
+ );
128
+ };
129
+
130
+ useEffect(() => {
131
+ if (source || (vid && playAuth)) {
132
+ onCreateAliPlayer();
133
+ }
134
+
135
+ return () => {
136
+ onDisposeAliPlayer();
137
+ };
138
+ }, [source, vid, playAuth]);
139
+
140
+ useEffect(() => {
141
+ if (visibility === "hidden") {
142
+ playerRef.current && playerRef.current.pause();
143
+ }
144
+ else {
145
+ playerRef.current && playerRef.current.play();
146
+ }
147
+ }, [visibility]);
148
+
149
+ return (
150
+ <div
151
+ ref={containerRef}
152
+ id={className}
153
+ style={{ width, height }}
154
+ />
155
+ );
156
+ });
157
+
158
+ AliPlayer.displayName = "AliPlayer";
159
+
160
+ export default AliPlayer;
@@ -27,5 +27,5 @@ export const HIDDEN_STATE_ENUM = [
27
27
  // 隐患整改类型
28
28
  export const HIDDEN_RECTIFICATION_TYPE_ENUM = [
29
29
  { bianma: 1, name: "立即整改" },
30
- { bianma: 2, name: "延期整改" },
30
+ { bianma: 2, name: "限期整改" },
31
31
  ];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.160",
4
+ "version": "1.0.162",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
package/utils/index.js CHANGED
@@ -530,7 +530,7 @@ export const validatorEndTime = (timeStart, message = "结束时间不能早于
530
530
  export const validatorTimeGTCurrentDay = (message = "需要大于当前时间") => {
531
531
  return {
532
532
  validator: (_, value) => {
533
- if (value && value <= dayjs().format("YYYY-MM-DD hh:mm:ss")) {
533
+ if (value && value <= dayjs().format("YYYY-MM-DD HH:mm:ss")) {
534
534
  return Promise.reject(message);
535
535
  }
536
536
  else {