zy-react-library 1.1.0 → 1.1.2

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.
Files changed (76) hide show
  1. package/README.md +5 -1
  2. package/components/Cascader/Area/index.js +11 -11
  3. package/components/Cascader/Basic/index.js +23 -30
  4. package/components/Cascader/Dictionary/index.js +42 -42
  5. package/components/Cascader/Industry/index.js +12 -11
  6. package/components/Editor/index.js +43 -63
  7. package/components/FormBuilder/FormBuilder.js +97 -87
  8. package/components/FormBuilder/FormItemsRenderer.js +579 -581
  9. package/components/FormBuilder/index.js +5 -3
  10. package/components/HeaderBack/index.js +39 -32
  11. package/components/HiddenInfo/gwj/index.js +507 -439
  12. package/components/Icon/AddIcon/index.js +6 -6
  13. package/components/Icon/BackIcon/index.js +6 -6
  14. package/components/Icon/DeleteIcon/index.js +6 -6
  15. package/components/Icon/DownloadIcon/index.js +6 -6
  16. package/components/Icon/EditIcon/index.js +6 -6
  17. package/components/Icon/ExportIcon/index.js +6 -6
  18. package/components/Icon/ImportIcon/index.js +6 -6
  19. package/components/Icon/LocationIcon/index.js +6 -6
  20. package/components/Icon/PrintIcon/index.js +6 -6
  21. package/components/Icon/ResetIcon/index.js +6 -6
  22. package/components/Icon/SearchIcon/index.js +6 -6
  23. package/components/Icon/VideoIcon/index.js +6 -6
  24. package/components/Icon/ViewIcon/index.js +6 -6
  25. package/components/ImportFile/index.js +94 -91
  26. package/components/LeftTree/Area/index.js +15 -15
  27. package/components/LeftTree/Basic/index.js +54 -65
  28. package/components/LeftTree/Department/Gwj/index.js +29 -32
  29. package/components/LeftTree/Dictionary/index.js +42 -42
  30. package/components/Map/MapSelector.js +280 -254
  31. package/components/Map/index.js +90 -77
  32. package/components/Page/index.d.ts +2 -0
  33. package/components/Page/index.js +44 -34
  34. package/components/Pdf/index.js +92 -90
  35. package/components/PreviewImg/index.js +26 -32
  36. package/components/PreviewPdf/index.js +78 -86
  37. package/components/Search/index.js +147 -141
  38. package/components/Select/Basic/index.js +70 -76
  39. package/components/Select/Dictionary/index.js +42 -42
  40. package/components/Select/Personnel/Gwj/index.js +45 -49
  41. package/components/SelectCreate/index.js +33 -40
  42. package/components/SelectTree/Area/index.js +11 -17
  43. package/components/SelectTree/Basic/index.js +105 -102
  44. package/components/SelectTree/Department/Gwj/index.js +40 -46
  45. package/components/SelectTree/Dictionary/index.js +42 -42
  46. package/components/SelectTree/HiddenLevel/Gwj/index.js +33 -35
  47. package/components/SelectTree/HiddenPart/Gwj/index.js +16 -19
  48. package/components/SelectTree/Industry/index.js +12 -18
  49. package/components/Signature/index.js +68 -62
  50. package/components/Table/index.js +77 -73
  51. package/components/Table/index.less +7 -1
  52. package/components/TooltipPreviewImg/index.js +28 -27
  53. package/components/Upload/index.js +229 -275
  54. package/components/Video/AliPlayer.js +182 -160
  55. package/components/Video/index.js +71 -90
  56. package/css/common.less +4 -0
  57. package/enum/dictionary/index.js +5 -3
  58. package/enum/formItemRender/index.js +37 -35
  59. package/enum/hidden/gwj/index.js +65 -26
  60. package/enum/uploadFile/gwj/index.js +166 -84
  61. package/hooks/useDeleteFile/index.js +24 -30
  62. package/hooks/useDictionary/index.js +28 -30
  63. package/hooks/useDownloadBlob/index.js +78 -77
  64. package/hooks/useDownloadFile/index.js +76 -79
  65. package/hooks/useGetFile/index.js +32 -32
  66. package/hooks/useGetUrlQuery/index.js +1 -2
  67. package/hooks/useGetUserInfo/index.js +19 -26
  68. package/hooks/useIdle/index.js +9 -11
  69. package/hooks/useImportFile/index.js +30 -28
  70. package/hooks/useIsExistenceDuplicateSelection/index.js +25 -18
  71. package/hooks/useTable/index.js +49 -38
  72. package/hooks/useUploadFile/index.js +142 -147
  73. package/hooks/useUrlQueryCriteria/index.js +20 -13
  74. package/package.json +14 -1
  75. package/regular/index.js +34 -39
  76. package/utils/index.js +515 -511
@@ -1,20 +1,27 @@
1
- import { message as antdMessage } from "antd";
2
- import { uniqBy } from "lodash-es";
3
-
1
+ import { message } from 'antd';
2
+ import { uniqBy } from 'lodash-es';
3
+
4
4
  /**
5
5
  * 检查数组中是否存在重复项
6
- */
7
- export default function useIsExistenceDuplicateSelection() {
8
- const isExistenceDuplicateSelection = (options) => {
9
- const { data, key, message = "存在重复项,请勿重复选择" } = options;
10
- return new Promise((resolve) => {
11
- if (uniqBy(data, key).length !== data.length) {
12
- antdMessage.error(message);
13
- }
14
- else {
15
- resolve();
16
- }
17
- });
18
- };
19
- return { isExistenceDuplicateSelection };
20
- }
6
+ */
7
+ function useIsExistenceDuplicateSelection() {
8
+ const isExistenceDuplicateSelection = options => {
9
+ const {
10
+ data,
11
+ key,
12
+ message: message$1 = "存在重复项,请勿重复选择"
13
+ } = options;
14
+ return new Promise(resolve => {
15
+ if (uniqBy(data, key).length !== data.length) {
16
+ message.error(message$1);
17
+ } else {
18
+ resolve();
19
+ }
20
+ });
21
+ };
22
+ return {
23
+ isExistenceDuplicateSelection
24
+ };
25
+ }
26
+
27
+ export { useIsExistenceDuplicateSelection as default };
@@ -1,5 +1,5 @@
1
- import { useAntdTable } from "ahooks";
2
- import useUrlQueryCriteria from "../useUrlQueryCriteria";
1
+ import { useAntdTable } from 'ahooks';
2
+ import useUrlQueryCriteria from '../useUrlQueryCriteria/index.js';
3
3
 
4
4
  /**
5
5
  * 获取数据
@@ -8,26 +8,29 @@ function getService(service, getExtraParams = {}, transform, usePermission) {
8
8
  // 获取额外的参数
9
9
  const extraParams = (typeof getExtraParams === "function" ? getExtraParams() : getExtraParams) || {};
10
10
  // 获取数据
11
- return async ({ current, pageSize }, formData = {}) => {
11
+ return async ({
12
+ current,
13
+ pageSize
14
+ }, formData = {}) => {
12
15
  // 如果提供了 transform 函数,则在请求之前调用它
13
16
  let transformedFormData = formData;
14
17
  if (typeof transform === "function") {
15
18
  const transformResult = transform(formData);
16
19
  // 如果 transform 函数有返回值,则将其与原始表单数据合并,transform 的优先级更高
17
20
  if (transformResult && typeof transformResult === "object") {
18
- transformedFormData = { ...formData, ...transformResult };
21
+ transformedFormData = {
22
+ ...formData,
23
+ ...transformResult
24
+ };
19
25
  }
20
26
  }
21
-
22
27
  const params = {
23
28
  pageIndex: current,
24
29
  pageSize,
25
30
  ...transformedFormData,
26
- ...extraParams,
27
- }
28
-
29
- if (usePermission)
30
- params.menuPath = window.location.pathname;
31
+ ...extraParams
32
+ };
33
+ if (usePermission) params.menuPath = window.location.pathname;
31
34
 
32
35
  // 发起请求
33
36
  const res = await service(params);
@@ -35,7 +38,7 @@ function getService(service, getExtraParams = {}, transform, usePermission) {
35
38
  return {
36
39
  list: res.data || [],
37
40
  total: res.totalCount || 0,
38
- ...res,
41
+ ...res
39
42
  };
40
43
  };
41
44
  }
@@ -45,12 +48,16 @@ function getService(service, getExtraParams = {}, transform, usePermission) {
45
48
  */
46
49
  function useTable(service, options) {
47
50
  if (!service) {
48
- console.error("请传入 service")
51
+ console.error("请传入 service");
49
52
  return;
50
53
  }
51
54
 
52
55
  // 获取额外参数和转换函数
53
- const { params: extraParams, transform, ...restOptions } = options || {};
56
+ const {
57
+ params: extraParams,
58
+ transform,
59
+ ...restOptions
60
+ } = options || {};
54
61
 
55
62
  // 获取配置项
56
63
  const {
@@ -60,11 +67,16 @@ function useTable(service, options) {
60
67
  defaultType = "advance",
61
68
  defaultCurrent = 1,
62
69
  defaultPageSize = 20,
63
- defaultPagination = { current: defaultCurrent, pageSize: defaultPageSize },
70
+ defaultPagination = {
71
+ current: defaultCurrent,
72
+ pageSize: defaultPageSize
73
+ },
64
74
  ...restRestOptions
65
75
  } = restOptions;
66
-
67
- const { setUrlCriteriaQuery, getUrlCriteriaQuery } = useUrlQueryCriteria();
76
+ const {
77
+ setUrlCriteriaQuery,
78
+ getUrlCriteriaQuery
79
+ } = useUrlQueryCriteria();
68
80
 
69
81
  // 获取存储的查询条件
70
82
  const storageQueryCriteriaSearchForm = useStorageQueryCriteria ? getUrlCriteriaQuery("searchFormKeys", "searchFormValues") : {};
@@ -76,25 +88,20 @@ function useTable(service, options) {
76
88
  const actualPagination = usePagination ? Object.keys(storageQueryCriteriaPagination).length > 0 ? storageQueryCriteriaPagination : defaultPagination : {};
77
89
 
78
90
  // 调用 ahooks 的 useAntdTable
79
- const res = useAntdTable(
80
- getService(service, extraParams, transform, usePermission),
81
- {
82
- ...restRestOptions,
83
- defaultParams: [actualPagination, actualSearchForm],
84
- defaultType,
85
- onSuccess: (data, params) => {
86
- // 执行成功回调,为了保留 ahooks 的 onSuccess 回调
87
- restOptions.onSuccess && restOptions.onSuccess(data, params);
88
- // 存储查询条件和分页到 URL
89
- useStorageQueryCriteria && setUrlCriteriaQuery(
90
- params[1] ?? {},
91
- usePagination
92
- ? { current: res.tableProps.pagination.current, pageSize: res.tableProps.pagination.pageSize }
93
- : {},
94
- );
95
- },
96
- },
97
- );
91
+ const res = useAntdTable(getService(service, extraParams, transform, usePermission), {
92
+ ...restRestOptions,
93
+ defaultParams: [actualPagination, actualSearchForm],
94
+ defaultType,
95
+ onSuccess: (data, params) => {
96
+ // 执行成功回调,为了保留 ahooks 的 onSuccess 回调
97
+ restOptions.onSuccess && restOptions.onSuccess(data, params);
98
+ // 存储查询条件和分页到 URL
99
+ useStorageQueryCriteria && setUrlCriteriaQuery(params[1] ?? {}, usePagination ? {
100
+ current: res.tableProps.pagination.current,
101
+ pageSize: res.tableProps.pagination.pageSize
102
+ } : {});
103
+ }
104
+ });
98
105
 
99
106
  // 执行回调函数
100
107
  restOptions.callback && restOptions.callback(res?.data?.list || [], res?.data || {});
@@ -104,10 +111,14 @@ function useTable(service, options) {
104
111
  ...res,
105
112
  tableProps: {
106
113
  ...res.tableProps,
107
- pagination: usePagination ? { ...res.tableProps.pagination, showQuickJumper: true, showSizeChanger: true } : false,
114
+ pagination: usePagination ? {
115
+ ...res.tableProps.pagination,
116
+ showQuickJumper: true,
117
+ showSizeChanger: true
118
+ } : false
108
119
  },
109
- getData: res.search.submit,
120
+ getData: res.search.submit
110
121
  };
111
122
  }
112
123
 
113
- export default useTable;
124
+ export { useTable as default };
@@ -1,149 +1,144 @@
1
- import { request } from "@cqsjjb/jjb-common-lib/http";
2
- import { useState } from "react";
3
- import { UPLOAD_FILE_PATH_ENUM, UPLOAD_FILE_TYPE_ENUM } from "../../enum/uploadFile/gwj";
4
-
1
+ import { request } from '@cqsjjb/jjb-common-lib/http';
2
+ import { useState } from 'react';
3
+ import { UPLOAD_FILE_TYPE_ENUM, UPLOAD_FILE_PATH_ENUM } from '../../enum/uploadFile/gwj/index.js';
4
+
5
5
  /**
6
6
  * 上传文件
7
- */
8
- function useUploadFile(returnType = "object") {
9
- // loading状态
10
- const [loading, setLoading] = useState(false);
11
- // 用于跟踪进行中的请求数量(不暴露给外部)
12
- let requestCount = 0;
13
-
14
- // 上传文件
15
- const uploadFile = (options) => {
16
- if (!options) {
17
- console.error("请传入 options");
18
- return;
19
- }
20
-
21
- // 增加请求数量并设置loading状态
22
- requestCount++;
23
- if (requestCount > 0) {
24
- setLoading(true);
25
- }
26
-
27
- return new Promise((resolve, reject) => {
28
- const { files = [], single = true, params } = options;
29
-
30
- if (!files) {
31
- console.error("请传入 files");
32
- return;
33
- }
34
- if (!Array.isArray(files)) {
35
- console.error("请传入有效的 files");
36
- return;
37
- }
38
- if (!params) {
39
- console.error("请传入 options.params");
40
- return;
41
- }
42
- if (!params.type) {
43
- console.error("请传入 options.params.type");
44
- return;
45
- }
46
-
47
- // 检查type是否在UPLOAD_FILE_TYPE_ENUM中
48
- if (!Object.values(UPLOAD_FILE_TYPE_ENUM).includes(params.type)) {
49
- console.error("传入的 type 不在 UPLOAD_FILE_TYPE_ENUM ");
50
- return;
51
- }
52
-
53
- // 根据type获取对应的path
54
- const path = UPLOAD_FILE_PATH_ENUM[params.type];
55
- if (!path) {
56
- console.error(`未找到 type ${params.type} 对应的 path `);
57
- return;
58
- }
59
-
60
- // 当single为false时,foreignKey是必需的
61
- if (!single) {
62
- if (!params.hasOwnProperty("foreignKey")) {
63
- console.error("请传入 options.params.foreignKey");
64
- return;
65
- }
66
- // 如果 foreignKey 是 undefined,设置默认值为空字符串
67
- if (params.foreignKey === undefined || params.foreignKey === null)
68
- params.foreignKey = "";
69
- }
70
-
71
- // 如果没有文件则直接返回
72
- if (files.length === 0) {
73
- requestCount--;
74
- if (requestCount <= 0) {
75
- setLoading(false);
76
- }
77
- resolve(
78
- single
79
- ? { filePath: "" }
80
- : { id: params.foreignKey },
81
- );
82
- return;
83
- }
84
-
85
- const formData = new FormData();
86
-
87
- // 将文件添加到formData中
88
- files.forEach((f) => {
89
- f.originFileObj && formData.append("files", f.originFileObj);
90
- });
91
-
92
- // 将额外携带的参数添加到formData中
93
- Object.keys(params).forEach((key) => {
94
- formData.append(key, params[key]);
95
- });
96
-
97
- // 添加path参数
98
- formData.append("path", path);
99
-
100
- // 获取待上传的文件
101
- const filesLength = formData.getAll("files").length;
102
-
103
- // 如果没有文件则返回老文件
104
- if (filesLength === 0) {
105
- requestCount--;
106
- if (requestCount <= 0) {
107
- setLoading(false);
108
- }
109
- resolve(
110
- single
111
- ? { filePath: files[0].filePath }
112
- : { id: params.foreignKey },
113
- );
114
- return;
115
- }
116
-
117
- // 发送请求
118
- request(
119
- single ? "/basicInfo/imgFiles/save" : "/basicInfo/imgFiles/batchSave",
120
- "post",
121
- formData,
122
- { "Content-Type": "multipart/form-data" },
123
- )
124
- .then((res) => {
125
- resolve(
126
- single
127
- ? { filePath: res.data.filePath }
128
- : { id: res.data.foreignKey },
129
- );
130
- })
131
- .catch((err) => {
132
- reject(err);
133
- })
134
- .finally(() => {
135
- // 减少请求数量并在没有进行中的请求时设置loading为false
136
- requestCount--;
137
- if (requestCount <= 0) {
138
- setLoading(false);
139
- }
140
- });
141
- });
142
- };
143
-
144
- if (returnType === "array")
145
- return [loading, uploadFile];
146
- return { loading, uploadFile };
147
- }
148
-
149
- export default useUploadFile;
7
+ */
8
+ function useUploadFile(returnType = "object") {
9
+ // loading状态
10
+ const [loading, setLoading] = useState(false);
11
+ // 用于跟踪进行中的请求数量(不暴露给外部)
12
+ let requestCount = 0;
13
+
14
+ // 上传文件
15
+ const uploadFile = options => {
16
+ if (!options) {
17
+ console.error("请传入 options");
18
+ return;
19
+ }
20
+
21
+ // 增加请求数量并设置loading状态
22
+ requestCount++;
23
+ if (requestCount > 0) {
24
+ setLoading(true);
25
+ }
26
+ return new Promise((resolve, reject) => {
27
+ const {
28
+ files = [],
29
+ single = true,
30
+ params
31
+ } = options;
32
+ if (!files) {
33
+ console.error("请传入 files");
34
+ return;
35
+ }
36
+ if (!Array.isArray(files)) {
37
+ console.error("请传入有效的 files");
38
+ return;
39
+ }
40
+ if (!params) {
41
+ console.error("请传入 options.params");
42
+ return;
43
+ }
44
+ if (!params.type) {
45
+ console.error("请传入 options.params.type");
46
+ return;
47
+ }
48
+
49
+ // 检查type是否在UPLOAD_FILE_TYPE_ENUM中
50
+ if (!Object.values(UPLOAD_FILE_TYPE_ENUM).includes(params.type)) {
51
+ console.error("传入的 type 不在 UPLOAD_FILE_TYPE_ENUM 中");
52
+ return;
53
+ }
54
+
55
+ // 根据type获取对应的path
56
+ const path = UPLOAD_FILE_PATH_ENUM[params.type];
57
+ if (!path) {
58
+ console.error(`未找到 type ${params.type} 对应的 path `);
59
+ return;
60
+ }
61
+
62
+ // 当single为false时,foreignKey是必需的
63
+ if (!single) {
64
+ if (!params.hasOwnProperty("foreignKey")) {
65
+ console.error("请传入 options.params.foreignKey");
66
+ return;
67
+ }
68
+ // 如果 foreignKey undefined,设置默认值为空字符串
69
+ if (params.foreignKey === undefined || params.foreignKey === null) params.foreignKey = "";
70
+ }
71
+
72
+ // 如果没有文件则直接返回
73
+ if (files.length === 0) {
74
+ requestCount--;
75
+ if (requestCount <= 0) {
76
+ setLoading(false);
77
+ }
78
+ resolve(single ? {
79
+ filePath: ""
80
+ } : {
81
+ id: params.foreignKey
82
+ });
83
+ return;
84
+ }
85
+ const formData = new FormData();
86
+
87
+ // 将文件添加到formData中
88
+ files.forEach(f => {
89
+ f.originFileObj && formData.append("files", f.originFileObj);
90
+ });
91
+
92
+ // 将额外携带的参数添加到formData中
93
+ Object.keys(params).forEach(key => {
94
+ formData.append(key, params[key]);
95
+ });
96
+
97
+ // 添加path参数
98
+ formData.append("path", path);
99
+
100
+ // 获取待上传的文件
101
+ const filesLength = formData.getAll("files").length;
102
+
103
+ // 如果没有文件则返回老文件
104
+ if (filesLength === 0) {
105
+ requestCount--;
106
+ if (requestCount <= 0) {
107
+ setLoading(false);
108
+ }
109
+ resolve(single ? {
110
+ filePath: files[0].filePath
111
+ } : {
112
+ id: params.foreignKey
113
+ });
114
+ return;
115
+ }
116
+
117
+ // 发送请求
118
+ request(single ? "/basicInfo/imgFiles/save" : "/basicInfo/imgFiles/batchSave", "post", formData, {
119
+ "Content-Type": "multipart/form-data"
120
+ }).then(res => {
121
+ resolve(single ? {
122
+ filePath: res.data.filePath
123
+ } : {
124
+ id: res.data.foreignKey
125
+ });
126
+ }).catch(err => {
127
+ reject(err);
128
+ }).finally(() => {
129
+ // 减少请求数量并在没有进行中的请求时设置loading为false
130
+ requestCount--;
131
+ if (requestCount <= 0) {
132
+ setLoading(false);
133
+ }
134
+ });
135
+ });
136
+ };
137
+ if (returnType === "array") return [loading, uploadFile];
138
+ return {
139
+ loading,
140
+ uploadFile
141
+ };
142
+ }
143
+
144
+ export { useUploadFile as default };
@@ -1,22 +1,24 @@
1
- import useUrlState from "@ahooksjs/use-url-state";
1
+ import useUrlState from '@ahooksjs/use-url-state';
2
2
 
3
3
  /**
4
4
  * 处理搜索条件缓存到 URL
5
5
  */
6
- export default function useUrlQueryCriteria() {
6
+ function useUrlQueryCriteria() {
7
7
  const [state, setState] = useUrlState({
8
8
  searchFormKeys: "",
9
9
  searchFormValues: "",
10
10
  paginationKeys: "",
11
- paginationValues: "",
12
- }, { navigateMode: "replace" });
11
+ paginationValues: ""
12
+ }, {
13
+ navigateMode: "replace"
14
+ });
13
15
 
14
16
  /**
15
17
  * 将搜索表单项和分页参数缓存到 URL 中
16
18
  */
17
19
  function setUrlCriteriaQuery(searchForm, pagination) {
18
20
  // 将对象转换为键值对字符串格式
19
- const getJoinString = (data) => {
21
+ const getJoinString = data => {
20
22
  const keys = [];
21
23
  const values = [];
22
24
  Object.entries(data).forEach(([key, value]) => {
@@ -25,13 +27,15 @@ export default function useUrlQueryCriteria() {
25
27
  if (Array.isArray(value)) {
26
28
  // 数组值使用方括号包裹,并用竖线分隔
27
29
  values.push(`[${value.join("|")}]`);
28
- }
29
- else {
30
+ } else {
30
31
  values.push(value);
31
32
  }
32
33
  }
33
34
  });
34
- return { keys: keys.join(","), values: values.join(",") };
35
+ return {
36
+ keys: keys.join(","),
37
+ values: values.join(",")
38
+ };
35
39
  };
36
40
 
37
41
  // 获取搜索表单和分页数据的键值对字符串
@@ -43,7 +47,7 @@ export default function useUrlQueryCriteria() {
43
47
  searchFormKeys: searchFormData.keys || undefined,
44
48
  searchFormValues: searchFormData.values || undefined,
45
49
  paginationKeys: paginationData.keys || undefined,
46
- paginationValues: paginationData.values || undefined,
50
+ paginationValues: paginationData.values || undefined
47
51
  });
48
52
  }
49
53
 
@@ -63,8 +67,7 @@ export default function useUrlQueryCriteria() {
63
67
  if (values[index].startsWith("[") && values[index].endsWith("]")) {
64
68
  const arrayContent = values[index].substring(1, values[index].length - 1);
65
69
  resultMap[key] = arrayContent ? arrayContent.split("|") : [];
66
- }
67
- else {
70
+ } else {
68
71
  // 处理普通值
69
72
  resultMap[key] = values[index];
70
73
  }
@@ -72,6 +75,10 @@ export default function useUrlQueryCriteria() {
72
75
  });
73
76
  return resultMap;
74
77
  }
75
-
76
- return { setUrlCriteriaQuery, getUrlCriteriaQuery };
78
+ return {
79
+ setUrlCriteriaQuery,
80
+ getUrlCriteriaQuery
81
+ };
77
82
  }
83
+
84
+ export { useUrlQueryCriteria as default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.1.0",
4
+ "version": "1.1.2",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",
@@ -20,6 +20,9 @@
20
20
  "node": ">=18.0.0"
21
21
  },
22
22
  "scripts": {
23
+ "build": "rollup -c",
24
+ "build:watch": "rollup -c -w",
25
+ "prepublishOnly": "npm run build",
23
26
  "postinstall": "echo 'Thanks for using our component library!'"
24
27
  },
25
28
  "dependencies": {
@@ -37,5 +40,15 @@
37
40
  "react": "^18.3.1",
38
41
  "react-pdf": "^10.2.0",
39
42
  "react-signature-canvas": "^1.1.0-alpha.2"
43
+ },
44
+ "devDependencies": {
45
+ "@babel/core": "^7.28.5",
46
+ "@babel/preset-react": "^7.28.5",
47
+ "@rollup/plugin-babel": "^6.1.0",
48
+ "@rollup/plugin-commonjs": "^29.0.0",
49
+ "@rollup/plugin-json": "^6.1.0",
50
+ "@rollup/plugin-node-resolve": "^16.0.3",
51
+ "glob": "^13.0.0",
52
+ "rollup": "^4.54.0"
40
53
  }
41
54
  }