@guo514360255/antd-lib 1.4.27 → 1.4.29

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.
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ import type { CustomScrollProps } from "./scroll";
3
+ import './index.less';
4
+ declare const CustomScroll: {
5
+ (props: CustomScrollProps): JSX.Element;
6
+ Item: (props: import("./scrollItem").CustomScrollItemProps) => JSX.Element;
7
+ };
8
+ export default CustomScroll;
@@ -0,0 +1,51 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
+ /*
3
+ * @Author: 郭郭
4
+ * @Date: 2026/1/9
5
+ * @Description:
6
+ */
7
+
8
+ import React, { useEffect } from 'react';
9
+ import "./index.less";
10
+ import Item from "./item";
11
+ var CustomScroll = function CustomScroll(props) {
12
+ var children = props.children,
13
+ _props$autoplay = props.autoplay,
14
+ autoplay = _props$autoplay === void 0 ? true : _props$autoplay,
15
+ className = props.className,
16
+ _props$duration = props.duration,
17
+ duration = _props$duration === void 0 ? 3000 : _props$duration,
18
+ _props$infinite = props.infinite,
19
+ infinite = _props$infinite === void 0 ? false : _props$infinite,
20
+ _props$direction = props.direction,
21
+ direction = _props$direction === void 0 ? 'vertical' : _props$direction,
22
+ _props$style = props.style,
23
+ style = _props$style === void 0 ? {} : _props$style,
24
+ height = props.height;
25
+ var timerRef = React.useRef(null);
26
+ var scrollRef = React.useRef(null);
27
+ var handleScroll = function handleScroll() {
28
+ timerRef.current = setTimeout(function () {
29
+ console.log(true);
30
+ console.log(scrollRef.current);
31
+ handleScroll();
32
+ }, duration);
33
+ };
34
+ useEffect(function () {
35
+ if (autoplay) {
36
+ handleScroll();
37
+ }
38
+ return function () {
39
+ clearTimeout(timerRef.current);
40
+ };
41
+ }, []);
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ ref: scrollRef,
44
+ className: "custom-scroll-container ".concat(direction === 'horizontal' ? 'horizontal' : '', " ").concat(className !== null && className !== void 0 ? className : ''),
45
+ style: _objectSpread({
46
+ height: height
47
+ }, style)
48
+ }, /*#__PURE__*/React.createElement("div", null, children));
49
+ };
50
+ CustomScroll.Item = Item;
51
+ export default CustomScroll;
@@ -0,0 +1,8 @@
1
+ .custom-scroll-container{
2
+ overflow: hidden;
3
+ display: flex;
4
+ flex-direction: column;
5
+ &.horizontal{
6
+ flex-direction: row;
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ /// <reference types="react" />
2
+ import type { CustomScrollItemProps } from "./scrollItem";
3
+ declare const Item: (props: CustomScrollItemProps) => JSX.Element;
4
+ export default Item;
@@ -0,0 +1,18 @@
1
+ /*
2
+ * @Author: 郭郭
3
+ * @Date: 2026/1/9
4
+ * @Description:
5
+ */
6
+
7
+ import React from 'react';
8
+ var Item = function Item(props) {
9
+ var children = props.children,
10
+ className = props.className,
11
+ _props$style = props.style,
12
+ style = _props$style === void 0 ? {} : _props$style;
13
+ return /*#__PURE__*/React.createElement("div", {
14
+ className: className,
15
+ style: style
16
+ }, children);
17
+ };
18
+ export default Item;
@@ -0,0 +1,46 @@
1
+ /*
2
+ * @Author: 郭郭
3
+ * @Date: 2026/1/9
4
+ * @Description:
5
+ */
6
+
7
+ import React from 'react';
8
+
9
+ export interface CustomScrollProps {
10
+ /**
11
+ * 是否自动滚动
12
+ * @default true
13
+ */
14
+ autoplay?: boolean;
15
+ /**
16
+ * 滚动时间间隔(毫秒)
17
+ * @default 3000
18
+ */
19
+ duration?: number;
20
+ /**
21
+ * 是否无限滚动
22
+ * @default true
23
+ */
24
+ infinite?: boolean;
25
+ /**
26
+ * 滚动方向
27
+ * @default vertical
28
+ */
29
+ direction?: 'horizontal' | 'vertical';
30
+ /**
31
+ * 滚动内容
32
+ */
33
+ children?: React.ReactNode;
34
+ /**
35
+ * 样式类
36
+ */
37
+ className?: string;
38
+ /**
39
+ * 滚动内容样式
40
+ */
41
+ style?: React.CSSProperties;
42
+ /**
43
+ * 容器内容高度
44
+ */
45
+ height?: number | string;
46
+ }
@@ -0,0 +1,22 @@
1
+ /*
2
+ * @Author: 郭郭
3
+ * @Date: 2026/1/9
4
+ * @Description:
5
+ */
6
+
7
+ import React from 'react';
8
+
9
+ export interface CustomScrollItemProps {
10
+ /**
11
+ * 滚动内容
12
+ */
13
+ children?: React.ReactNode;
14
+ /**
15
+ * 滚动内容样式
16
+ */
17
+ style?: React.CSSProperties;
18
+ /**
19
+ * 滚动内容类名
20
+ */
21
+ className?: string;
22
+ }
@@ -191,6 +191,14 @@ var CustomTable = /*#__PURE__*/forwardRef(function (props, ref) {
191
191
  var _formModalRef$current2;
192
192
  // @ts-ignore
193
193
  return formModalRef === null || formModalRef === void 0 || (_formModalRef$current2 = formModalRef.current) === null || _formModalRef$current2 === void 0 ? void 0 : _formModalRef$current2.getFormRef();
194
+ },
195
+ // pro components table action ref
196
+ tableActionRef: function tableActionRef() {
197
+ return actionRef.current;
198
+ },
199
+ // pro components form ref
200
+ tableFormRef: function tableFormRef() {
201
+ return formRef.current;
194
202
  }
195
203
  };
196
204
  });
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import type { CustomTagProps } from "./tag";
3
- declare const CustomTag: ({ value, valueEnum, options }: CustomTagProps) => JSX.Element | JSX.Element[];
2
+ declare const CustomTag: ({ value, valueEnum, options }: CustomTagProps) => any;
4
3
  export default CustomTag;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,8 @@ export { default as CustomModal } from './CustomFormModal';
5
5
  export type { CustomFormModalProps } from './CustomFormModal/formModal';
6
6
  export { default as CustomTable } from './CustomTable';
7
7
  export type { CustomTableProps } from './CustomTable/table';
8
+ export { default as CustomScroll } from './CustomScroll';
9
+ export type { CustomScrollProps } from './CustomScroll/scroll';
8
10
  export { default as CustomTag } from './CustomTag';
9
11
  export { default as CustomUpload } from './CustomUpload';
10
12
  export { default as DynamicIcon } from './DynamicIcon';
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as CustomDetailModal } from "./CustomDetailModal";
2
2
  export { default as CustomModal } from "./CustomFormModal";
3
3
  export { default as CustomTable } from "./CustomTable";
4
+ export { default as CustomScroll } from "./CustomScroll";
4
5
  export { default as CustomTag } from "./CustomTag";
5
6
  export { default as CustomUpload } from "./CustomUpload";
6
7
  export { default as DynamicIcon } from "./DynamicIcon";
@@ -1,4 +1,4 @@
1
1
  import { buildTree } from './buildTree';
2
2
  import RememberPwd from './rememberPwd';
3
- import { capitalizeFirstLetter, capitalizeFirstLetters, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, valueEnumTransform } from './util';
4
- export { buildTree, capitalizeFirstLetter, capitalizeFirstLetters, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, RememberPwd, valueEnumTransform, };
3
+ import { capitalizeFirstLetter, capitalizeFirstLetters, downloadFile, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, valueEnumTransform } from './util';
4
+ export { buildTree, capitalizeFirstLetter, capitalizeFirstLetters, downloadFile, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, RememberPwd, valueEnumTransform, };
@@ -5,5 +5,5 @@
5
5
  */
6
6
  import { buildTree } from "./buildTree";
7
7
  import RememberPwd from "./rememberPwd";
8
- import { capitalizeFirstLetter, capitalizeFirstLetters, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, valueEnumTransform } from "./util";
9
- export { buildTree, capitalizeFirstLetter, capitalizeFirstLetters, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, RememberPwd, valueEnumTransform };
8
+ import { capitalizeFirstLetter, capitalizeFirstLetters, downloadFile, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, valueEnumTransform } from "./util";
9
+ export { buildTree, capitalizeFirstLetter, capitalizeFirstLetters, downloadFile, fileTransformBase64, findTreeNodeByKey, handleColumnFieldProps, isEmptyValue, randomInt, RememberPwd, valueEnumTransform };
@@ -52,3 +52,10 @@ export declare const capitalizeFirstLetters: (strings: string[]) => string[];
52
52
  * @param fn
53
53
  */
54
54
  export declare const handleColumnFieldProps: (setColumns: any, code: string, fn: (data: any) => void) => void;
55
+ /**
56
+ * blob 文件刘处理
57
+ * @param response 响应结果
58
+ * @param fileName 文件名
59
+ * @returns
60
+ */
61
+ export declare function downloadFile(response: any, fileName: string): void;
@@ -118,4 +118,39 @@ export var handleColumnFieldProps = function handleColumnFieldProps(setColumns,
118
118
  }
119
119
  return s;
120
120
  });
121
- };
121
+ };
122
+
123
+ /**
124
+ * blob 文件刘处理
125
+ * @param response 响应结果
126
+ * @param fileName 文件名
127
+ * @returns
128
+ */
129
+ export function downloadFile(response, fileName) {
130
+ var _document;
131
+ // 处理返回的文件流
132
+ var blob = response;
133
+ if (blob && blob.size === 0) {
134
+ alert('内容为空,无法下载');
135
+ return;
136
+ }
137
+ // @ts-ignore
138
+ var link = (_document = document) === null || _document === void 0 ? void 0 : _document.createElement('a');
139
+
140
+ // 兼容一下 入参不是 File Blob 类型情况
141
+ var binaryData = [];
142
+ binaryData.push(response);
143
+ // @ts-ignore
144
+ link.href = window.URL.createObjectURL(new Blob(binaryData));
145
+ link.download = fileName;
146
+ // @ts-ignore
147
+ document.body.appendChild(link);
148
+ link.click();
149
+ // @ts-ignore
150
+ window.setTimeout(function () {
151
+ // @ts-ignore
152
+ URL.revokeObjectURL(blob);
153
+ // @ts-ignore
154
+ document.body.removeChild(link);
155
+ }, 0);
156
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guo514360255/antd-lib",
3
- "version": "1.4.27",
3
+ "version": "1.4.29",
4
4
  "description": "react design 5 lib",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",