@cqsjjb/jjb-react-admin-component 3.3.17 → 3.3.20
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.
- package/AdaptiveTree/index.js +41 -41
- package/ControlWrapper/index.js +4 -4
- package/Editor/index.js +6 -6
- package/FileUploader/index.js +32 -32
- package/ListDataContainer/index.js +3 -2
- package/SearchForm/index.js +4 -4
- package/package.json +2 -2
package/AdaptiveTree/index.js
CHANGED
|
@@ -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";
|
package/ControlWrapper/index.js
CHANGED
|
@@ -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 {
|
package/FileUploader/index.js
CHANGED
|
@@ -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
|
|
@@ -184,9 +184,10 @@ const ListDataContainer = /*#__PURE__*/forwardRef(({
|
|
|
184
184
|
const searchFormHeight = searchFormRef.current.offsetHeight;
|
|
185
185
|
const gap = 16; // gap between searchForm and table
|
|
186
186
|
const paginationHeight = 64; // 分页器高度(包含margin)
|
|
187
|
+
const tableHeaderHeight = 55; // 表头高度
|
|
187
188
|
|
|
188
|
-
// 计算表格可用高度 = 容器高度 - 搜索表单高度 - gap - 分页器高度 - 间隔
|
|
189
|
-
const availableHeight = containerHeight - searchFormHeight - gap - paginationHeight - 12;
|
|
189
|
+
// 计算表格可用高度 = 容器高度 - 搜索表单高度 - gap - 分页器高度 - 表头高度 - 间隔
|
|
190
|
+
const availableHeight = containerHeight - searchFormHeight - gap - paginationHeight - tableHeaderHeight - 12;
|
|
190
191
|
|
|
191
192
|
// 确保最小高度为 100px
|
|
192
193
|
if (availableHeight > 100) {
|
package/SearchForm/index.js
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "3.3.20",
|
|
4
4
|
"description": "jjb-react-admin-组件库-稳定版",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "jjb-front-team",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@ant-design/pro-components": "latest",
|
|
13
13
|
"@ant-design/pro-layout": "latest",
|
|
14
14
|
"@cqsjjb-formily/renderer": "latest",
|
|
15
|
-
"@wangeditor-next/editor": "
|
|
15
|
+
"@wangeditor-next/editor": "5.6.49",
|
|
16
16
|
"cropperjs": "^1.6.2",
|
|
17
17
|
"lodash": "^4.17.21",
|
|
18
18
|
"react-cropper": "2.3.3",
|