@cqsjjb/jjb-react-admin-component 3.3.13 → 3.3.14

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,45 +1,45 @@
1
1
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- /**
3
- * 自适应树组件
4
- * @param {Object} props - 组件属性
5
- * @param {Function} [props.titleAction] - 节点操作按钮生成函数
6
- * @param {Object} node - 当前节点数据
7
- * @returns {Array} 操作按钮配置数组,每项包含:
8
- * @property {ReactNode} content - 按钮内容(文本或元素)
9
- * @property {Function} onClick - 点击事件回调
10
- * @param {Function} [props.titleIcon] - 节点标题图标生成函数
11
- * @param {Object} node - 当前节点数据
12
- * @returns {ReactNode} 图标元素(如 img、Icon 组件等)
13
- *
14
- * @note 说明:
15
- * 1. 自动继承全局 Ant Design 前缀配置(window.process.env.app.antd['ant-prefix'])
16
- * 2. 节点容器默认占满父元素空间,支持纵向滚动
17
- * 3. 节点标题超长自动换行,且不会挤压标题图标和操作图标的空间
18
- * 4. 节点选中时,返回的节点数据为当前节点及其所有父节点id(二维数组)、选中的节点数据(一维数组)
19
- *
20
- * @example
21
- * <AdaptiveTree
22
- * treeData={[]}
23
- * fieldNames={{
24
- * title: 'name',
25
- * key: 'id'
26
- * }}
27
- * titleAction={(node) => [
28
- * {
29
- * content: '添加',
30
- * onClick: (node) => {
31
- * console.warn("添加", node)
32
- * }
33
- * },
34
- * {
35
- * content: '编辑',
36
- * onClick: (node) => {
37
- * console.warn("编辑", node)
38
- * }
39
- * }
40
- * ]}
41
- * titleIcon={(node) => <FolderOpenOutlined />}
42
- * />
2
+ /**
3
+ * 自适应树组件
4
+ * @param {Object} props - 组件属性
5
+ * @param {Function} [props.titleAction] - 节点操作按钮生成函数
6
+ * @param {Object} node - 当前节点数据
7
+ * @returns {Array} 操作按钮配置数组,每项包含:
8
+ * @property {ReactNode} content - 按钮内容(文本或元素)
9
+ * @property {Function} onClick - 点击事件回调
10
+ * @param {Function} [props.titleIcon] - 节点标题图标生成函数
11
+ * @param {Object} node - 当前节点数据
12
+ * @returns {ReactNode} 图标元素(如 img、Icon 组件等)
13
+ *
14
+ * @note 说明:
15
+ * 1. 自动继承全局 Ant Design 前缀配置(window.process.env.app.antd['ant-prefix'])
16
+ * 2. 节点容器默认占满父元素空间,支持纵向滚动
17
+ * 3. 节点标题超长自动换行,且不会挤压标题图标和操作图标的空间
18
+ * 4. 节点选中时,返回的节点数据为当前节点及其所有父节点id(二维数组)、选中的节点数据(一维数组)
19
+ *
20
+ * @example
21
+ * <AdaptiveTree
22
+ * treeData={[]}
23
+ * fieldNames={{
24
+ * title: 'name',
25
+ * key: 'id'
26
+ * }}
27
+ * titleAction={(node) => [
28
+ * {
29
+ * content: '添加',
30
+ * onClick: (node) => {
31
+ * console.warn("添加", node)
32
+ * }
33
+ * },
34
+ * {
35
+ * content: '编辑',
36
+ * onClick: (node) => {
37
+ * console.warn("编辑", node)
38
+ * }
39
+ * }
40
+ * ]}
41
+ * titleIcon={(node) => <FolderOpenOutlined />}
42
+ * />
43
43
  */
44
44
  import React, { useState } from 'react';
45
45
  import { Tree, Space } from "antd";
@@ -162,22 +162,21 @@ export default props => {
162
162
  key: node[key]
163
163
  }, /*#__PURE__*/React.createElement("div", {
164
164
  className: "title-left"
165
- }, titleIcon ? /*#__PURE__*/React.createElement("div", {
165
+ }, titleIcon && /*#__PURE__*/React.createElement("div", {
166
166
  className: "icon"
167
- }, titleIcon(node)) : '', /*#__PURE__*/React.createElement("span", {
167
+ }, titleIcon(node)), /*#__PURE__*/React.createElement("span", {
168
168
  style: {
169
169
  marginLeft: 6
170
170
  }
171
- }, node[title])), /*#__PURE__*/React.createElement(Space, null, titleAction ? (titleAction(node) || []).map(item => {
172
- return /*#__PURE__*/React.createElement("div", {
173
- onClick: e => {
174
- e.stopPropagation();
175
- e.preventDefault();
176
- item.onClick && item.onClick(node);
177
- },
178
- className: "operation"
179
- }, item?.content || '');
180
- }) : ''));
171
+ }, node[title])), /*#__PURE__*/React.createElement(Space, null, titleAction && (titleAction(node) || []).map((item, index) => /*#__PURE__*/React.createElement("div", {
172
+ key: index,
173
+ onClick: e => {
174
+ e.stopPropagation();
175
+ e.preventDefault();
176
+ item.onClick && item.onClick(node);
177
+ },
178
+ className: "operation"
179
+ }, item?.content || ''))));
181
180
  };
182
181
  const onExpand = keys => {
183
182
  setExpandedKeys(keys);
@@ -2,10 +2,10 @@ function _extends() { return _extends = Object.assign ? Object.assign.bind() : f
2
2
  import React from 'react';
3
3
  import { Input as OriginInput, Select as OriginSelect, Cascader as OriginCascader, DatePicker as OriginDatePicker, TreeSelect as OriginTreeSelect } from 'antd';
4
4
 
5
- /**
6
- * 通用包裹组件
7
- * @param {*} WrappedComponent antd 原生组件
8
- * @param {*} extraProps 额外的透传配置
5
+ /**
6
+ * 通用包裹组件
7
+ * @param {*} WrappedComponent antd 原生组件
8
+ * @param {*} extraProps 额外的透传配置
9
9
  */
10
10
  function withLabel(WrappedComponent, extraProps = {}) {
11
11
  return function Wrapper(props) {
package/Editor/index.js CHANGED
@@ -4,8 +4,8 @@ import { message } from 'antd';
4
4
  import { http, tools } from '@cqsjjb/jjb-common-lib';
5
5
  import { createEditor, createToolbar } from '@wangeditor-next/editor';
6
6
 
7
- /**
8
- * 工具函数:标准化 HTML 内容为空值
7
+ /**
8
+ * 工具函数:标准化 HTML 内容为空值
9
9
  */
10
10
  function normalizeEmptyHtml(html) {
11
11
  if (!html) return '';
@@ -13,8 +13,8 @@ function normalizeEmptyHtml(html) {
13
13
  return cleaned === '<p><br></p>' || cleaned === '<p></p>' || cleaned === '' ? '' : html;
14
14
  }
15
15
 
16
- /**
17
- * 校验上传文件类型和大小
16
+ /**
17
+ * 校验上传文件类型和大小
18
18
  */
19
19
  function validateFile(file, {
20
20
  validTypes,
@@ -34,8 +34,8 @@ function validateFile(file, {
34
34
  return true;
35
35
  }
36
36
 
37
- /**
38
- * 通用上传函数
37
+ /**
38
+ * 通用上传函数
39
39
  */
40
40
  async function handleUpload(file, insertFn, options) {
41
41
  const {
@@ -19,9 +19,9 @@ class FileUploader extends React.Component {
19
19
  };
20
20
  inputFile = /*#__PURE__*/React.createRef();
21
21
 
22
- /**
23
- * @description http配置
24
- * @returns {{headers: object, fieldName: string, data: object, action: string, url: string}}
22
+ /**
23
+ * @description http配置
24
+ * @returns {{headers: object, fieldName: string, data: object, action: string, url: string}}
25
25
  */
26
26
  get httpConfig() {
27
27
  const {
@@ -46,9 +46,9 @@ class FileUploader extends React.Component {
46
46
  };
47
47
  }
48
48
 
49
- /**
50
- * @description 填充值
51
- * @returns {string[]}
49
+ /**
50
+ * @description 填充值
51
+ * @returns {string[]}
52
52
  */
53
53
  get value() {
54
54
  const {
@@ -57,9 +57,9 @@ class FileUploader extends React.Component {
57
57
  return Array.isArray(value) ? value : value ? [value] : [];
58
58
  }
59
59
 
60
- /**
61
- * @description 获取禁用状态
62
- * @return {boolean}
60
+ /**
61
+ * @description 获取禁用状态
62
+ * @return {boolean}
63
63
  */
64
64
  get disabled() {
65
65
  const {
@@ -78,11 +78,11 @@ class FileUploader extends React.Component {
78
78
  }
79
79
  }
80
80
 
81
- /**
82
- * @description 验证文件类型
83
- * @param fileType {string}
84
- * @param accept {string}
85
- * @returns {Promise<never>|Promise<void>}
81
+ /**
82
+ * @description 验证文件类型
83
+ * @param fileType {string}
84
+ * @param accept {string}
85
+ * @returns {Promise<never>|Promise<void>}
86
86
  */
87
87
  verifyFileAccept(fileType, accept) {
88
88
  const {
@@ -110,11 +110,11 @@ class FileUploader extends React.Component {
110
110
  }
111
111
  }
112
112
 
113
- /**
114
- * @description 验证文件大小
115
- * @param fileSize {number}
116
- * @param maxSize {number}
117
- * @returns {Promise<never>|Promise<void>}
113
+ /**
114
+ * @description 验证文件大小
115
+ * @param fileSize {number}
116
+ * @param maxSize {number}
117
+ * @returns {Promise<never>|Promise<void>}
118
118
  */
119
119
  verifyFileSize(fileSize, maxSize) {
120
120
  const {
@@ -137,10 +137,10 @@ class FileUploader extends React.Component {
137
137
  }
138
138
  }
139
139
 
140
- /**
141
- * @description 发起上传请求
142
- * @param file {File}
143
- * @returns {Promise<{url: string, fileName: string, respDesc: string}>}
140
+ /**
141
+ * @description 发起上传请求
142
+ * @param file {File}
143
+ * @returns {Promise<{url: string, fileName: string, respDesc: string}>}
144
144
  */
145
145
  onFormRequest(file) {
146
146
  const {
@@ -196,9 +196,9 @@ class FileUploader extends React.Component {
196
196
  });
197
197
  }
198
198
 
199
- /**
200
- * @description 回调
201
- * @param value {string}
199
+ /**
200
+ * @description 回调
201
+ * @param value {string}
202
202
  */
203
203
  onChange(value) {
204
204
  const {
@@ -207,17 +207,17 @@ class FileUploader extends React.Component {
207
207
  onChange && onChange(value || undefined);
208
208
  }
209
209
 
210
- /**
211
- * @description 删除
212
- * @param sup {number}
210
+ /**
211
+ * @description 删除
212
+ * @param sup {number}
213
213
  */
214
214
  onDelete(sup) {
215
215
  this.onChange(this.props.multiple ? this.value.filter((_, sub) => sub !== sup) : undefined);
216
216
  }
217
217
 
218
- /**
219
- * @description 上传
220
- * @param target {{files: FileList, value: any}}
218
+ /**
219
+ * @description 上传
220
+ * @param target {{files: FileList, value: any}}
221
221
  */
222
222
  onUpload({
223
223
  target
@@ -5,45 +5,45 @@ import { isEqual } from 'lodash';
5
5
  import SearchForm from '@cqsjjb/jjb-react-admin-component/SearchForm';
6
6
  import ProTable from '@cqsjjb/jjb-react-admin-component/Table';
7
7
 
8
- /**
9
- * @component ListDataContainer
10
- * @description 通用列表数据容器组件,提供搜索表单、数据表格、分页等功能的完整列表页面解决方案
11
- *
12
- * @props {Array} columns - 表格列配置,遵循Ant Design Table组件的columns规范
13
- * @props {Function} fetchDataApi - 数据获取API函数,接收分页和搜索参数,返回包含list和total的对象
14
- * @props {Array} searchFormConfig - 搜索表单配置数组
15
- * @param {React.Component} searchFormConfig[].field - 表单项组件(如ControlWrapper.Select)
16
- * @param {string} searchFormConfig[].name - 表单项字段名
17
- * @param {string} searchFormConfig[].label - 表单项标签
18
- * @param {Object} searchFormConfig[].fieldProps - 传递给字段组件的属性
19
- * @param {Object} searchFormConfig[].itemProps - 传递给Form.Item的属性
20
- * @param {React.ReactNode} searchFormConfig[].content - 字段组件的子元素(如Select.Option列表)
21
- * @param {boolean} searchFormConfig[].required - 是否必填
22
- * @props {string} rowKey - 表格行键值,默认为'id'
23
- * @props {Object} initialPagination - 初始分页配置,包含current、pageSize等分页属性
24
- * @props {Object} tableProps - 传递给Table组件的属性
25
- * @props {Object} searchFormProps - 传递给SearchForm组件的属性
26
- * @props {boolean} proTable - 是否使用ProTable组件,默认为false
27
- * @example
28
- * // 基础用法
29
- * <ListDataContainer
30
- * columns={tableColumns}
31
- * fetchDataApi={getCourseList}
32
- * searchFormConfig={[
33
- * {
34
- * field: Select,
35
- * name: 'status',
36
- * label: '状态',
37
- * }
38
- * {
39
- * field: Input,
40
- * name: 'name',
41
- * label: '名称',
42
- * required: true,
43
- * }
44
- * ]}
45
- * />
46
- *
8
+ /**
9
+ * @component ListDataContainer
10
+ * @description 通用列表数据容器组件,提供搜索表单、数据表格、分页等功能的完整列表页面解决方案
11
+ *
12
+ * @props {Array} columns - 表格列配置,遵循Ant Design Table组件的columns规范
13
+ * @props {Function} fetchDataApi - 数据获取API函数,接收分页和搜索参数,返回包含list和total的对象
14
+ * @props {Array} searchFormConfig - 搜索表单配置数组
15
+ * @param {React.Component} searchFormConfig[].field - 表单项组件(如ControlWrapper.Select)
16
+ * @param {string} searchFormConfig[].name - 表单项字段名
17
+ * @param {string} searchFormConfig[].label - 表单项标签
18
+ * @param {Object} searchFormConfig[].fieldProps - 传递给字段组件的属性
19
+ * @param {Object} searchFormConfig[].itemProps - 传递给Form.Item的属性
20
+ * @param {React.ReactNode} searchFormConfig[].content - 字段组件的子元素(如Select.Option列表)
21
+ * @param {boolean} searchFormConfig[].required - 是否必填
22
+ * @props {string} rowKey - 表格行键值,默认为'id'
23
+ * @props {Object} initialPagination - 初始分页配置,包含current、pageSize等分页属性
24
+ * @props {Object} tableProps - 传递给Table组件的属性
25
+ * @props {Object} searchFormProps - 传递给SearchForm组件的属性
26
+ * @props {boolean} proTable - 是否使用ProTable组件,默认为false
27
+ * @example
28
+ * // 基础用法
29
+ * <ListDataContainer
30
+ * columns={tableColumns}
31
+ * fetchDataApi={getCourseList}
32
+ * searchFormConfig={[
33
+ * {
34
+ * field: Select,
35
+ * name: 'status',
36
+ * label: '状态',
37
+ * }
38
+ * {
39
+ * field: Input,
40
+ * name: 'name',
41
+ * label: '名称',
42
+ * required: true,
43
+ * }
44
+ * ]}
45
+ * />
46
+ *
47
47
  */
48
48
 
49
49
  const SELECT_COMPONENTS = ['Select', 'TreeSelect', 'Cascader', 'DatePicker', 'TimePicker', 'Checkbox', 'Radio', 'Switch', 'Slider', 'Upload'];
@@ -76,10 +76,10 @@ const ListDataContainer = /*#__PURE__*/forwardRef(({
76
76
  return Component.displayName || Component.constructor.name;
77
77
  };
78
78
 
79
- /**
80
- * 数据加载与刷新方法
81
- * @param {Object} [overrideParams={}] - 可选,用于覆盖内部参数的键值对
82
- * 若传入,会覆盖同名的表单参数和分页参数(如page、pageSize或搜索字段)
79
+ /**
80
+ * 数据加载与刷新方法
81
+ * @param {Object} [overrideParams={}] - 可选,用于覆盖内部参数的键值对
82
+ * 若传入,会覆盖同名的表单参数和分页参数(如page、pageSize或搜索字段)
83
83
  */
84
84
  const loadDataSource = useCallback(async (overrideParams = {}) => {
85
85
  if (!fetchDataApi) return;
@@ -250,6 +250,10 @@ const ListDataContainer = /*#__PURE__*/forwardRef(({
250
250
  }).filter(Boolean);
251
251
  };
252
252
  const TableComponent = proTable ? ProTable : Table;
253
+ const {
254
+ scroll,
255
+ ...restTableProps
256
+ } = tableProps;
253
257
  return /*#__PURE__*/React.createElement("div", {
254
258
  ref: containerRef,
255
259
  style: {
@@ -288,12 +292,6 @@ const ListDataContainer = /*#__PURE__*/forwardRef(({
288
292
  y: tableScrollY !== undefined ? tableScrollY : tableProps.scroll?.y || undefined
289
293
  },
290
294
  bordered: true
291
- }, (() => {
292
- const {
293
- scroll,
294
- ...restTableProps
295
- } = tableProps;
296
- return restTableProps;
297
- })()))));
295
+ }, restTableProps))));
298
296
  });
299
297
  export default ListDataContainer;
package/PhoneBox/index.js CHANGED
@@ -173,9 +173,9 @@ export default props => {
173
173
  className: "qrcode-preview-container"
174
174
  }, /*#__PURE__*/React.createElement(QRCode, {
175
175
  value: qrcodeUrl
176
- }), isQrcodeExpire ? /*#__PURE__*/React.createElement("div", {
176
+ }), isQrcodeExpire && /*#__PURE__*/React.createElement("div", {
177
177
  className: "qrcode-preview-container-expire-mask"
178
- }, "\u4E8C\u7EF4\u7801\u8FC7\u671F") : '', /*#__PURE__*/React.createElement("div", {
178
+ }, "\u4E8C\u7EF4\u7801\u8FC7\u671F"), /*#__PURE__*/React.createElement("div", {
179
179
  className: "qrcode-preview-container-text"
180
180
  }, "\u4E34\u65F6\u9884\u89C8\uFF0C", qrcodeExpireTime ? `${qrcodeExpireTime}分钟后失效` : '已失效'), /*#__PURE__*/React.createElement("a", {
181
181
  onClick: () => {
@@ -91,10 +91,10 @@ const SearchForm = ({
91
91
  onClick: handleToggle
92
92
  }, isOpen ? '收起' : '展开'));
93
93
 
94
- /**
95
- * 处理 formLine,确保所有 Form.Item 都有 noStyle 属性
96
- * @param {ReactNode[]} nodes - 表单节点数组
97
- * @returns {ReactNode[]} - 处理后的节点数组
94
+ /**
95
+ * 处理 formLine,确保所有 Form.Item 都有 noStyle 属性
96
+ * @param {ReactNode[]} nodes - 表单节点数组
97
+ * @returns {ReactNode[]} - 处理后的节点数组
98
98
  */
99
99
  const processFormLine = nodes => {
100
100
  return nodes.map(node => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqsjjb/jjb-react-admin-component",
3
- "version": "3.3.13",
3
+ "version": "3.3.14",
4
4
  "description": "jjb-react-admin-组件库-稳定版",
5
5
  "main": "index.js",
6
6
  "author": "jjb-front-team",