@cqsjjb/jjb-react-admin-component 3.2.0-beta.1 → 3.2.0-rc.0

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/BMap/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import React, { useEffect, useRef, useState, useCallback } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Button, Col, message, Modal, Result, Row } from 'antd';
4
3
  import './index.less';
5
4
  const _B_MAP_SEARCH_ = '_B_MAP_SEARCH_';
@@ -10,8 +9,8 @@ const _B_MAP_DEFAULT_POINT_ = {
10
9
  const BMap = ({
11
10
  lng: propLng,
12
11
  lat: propLat,
13
- title,
14
- width,
12
+ title = '百度地图',
13
+ width = 700,
15
14
  onOk,
16
15
  onCancel
17
16
  }) => {
@@ -165,21 +164,4 @@ const BMap = ({
165
164
  title: "\u52A0\u8F7D\u5730\u56FE\u5931\u8D25\uFF0C\u7F3A\u5C11\u5FC5\u8981\u7684\u6587\u4EF6\uFF01"
166
165
  }));
167
166
  };
168
- BMap.defaultProps = {
169
- lng: 0,
170
- lat: 0,
171
- title: '百度地图',
172
- width: 700
173
- };
174
- BMap.propTypes = {
175
- lng: PropTypes.number,
176
- lat: PropTypes.number,
177
- width: PropTypes.number,
178
- // 地图宽度
179
- title: PropTypes.string,
180
- // 标题
181
- onOk: PropTypes.func,
182
- // 确认事件
183
- onCancel: PropTypes.func // 取消事件
184
- };
185
167
  export default BMap;
@@ -73,17 +73,6 @@ DatePicker.WeekPicker = withLabel(OriginDatePicker.WeekPicker);
73
73
  DatePicker.MonthPicker = withLabel(OriginDatePicker.MonthPicker);
74
74
  DatePicker.QuarterPicker = withLabel(OriginDatePicker.QuarterPicker);
75
75
  DatePicker.YearPicker = withLabel(OriginDatePicker.YearPicker);
76
-
77
- // ============ PropTypes 公共扩展 ============
78
- const commonPropTypes = {
79
- label: PropTypes.string,
80
- labelSpan: PropTypes.number,
81
- style: PropTypes.object,
82
- onChange: PropTypes.func
83
- };
84
- [Input, Select, Cascader, TreeSelect, DatePicker, DatePicker.RangePicker, DatePicker.TimePicker, DatePicker.WeekPicker, DatePicker.MonthPicker, DatePicker.QuarterPicker, DatePicker.YearPicker].forEach(cmp => {
85
- cmp.propTypes = commonPropTypes;
86
- });
87
76
  export default {
88
77
  Input,
89
78
  Select,
@@ -18,6 +18,8 @@ interface EditorProps {
18
18
  mode?: 'default' | 'simple';
19
19
  // 高度 默认-300px
20
20
  height?: number;
21
+ // 层级 默认-1000
22
+ zIndex?: number;
21
23
  // 是否禁用 默认-false
22
24
  disabled?: boolean;
23
25
  // 上传地址 默认-${window.process.env.app.API_HOST}/attachment/files/upload-speed-simple
package/Editor/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import PropTypes from 'prop-types';
2
1
  import '@wangeditor-next/editor/dist/css/style.css';
3
2
  import React, { forwardRef, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
4
3
  import { message } from 'antd';
@@ -99,7 +98,8 @@ const RCEditor = /*#__PURE__*/forwardRef(function RCEditor(props, ref) {
99
98
  bordered = true,
100
99
  mode = 'default',
101
100
  height = 300,
102
- disabled,
101
+ disabled = false,
102
+ zIndex = 1000,
103
103
  uploadUrl = `${window.process.env.app.API_HOST}/attachment/files/upload-speed-simple`,
104
104
  uploadFileName = 'file',
105
105
  uploadHeaders = {},
@@ -111,9 +111,9 @@ const RCEditor = /*#__PURE__*/forwardRef(function RCEditor(props, ref) {
111
111
  borderColor = '#e8e8e8',
112
112
  borderWidth = 1,
113
113
  borderRadius = 2,
114
- onBlur,
115
- onFocus,
116
- onChange
114
+ onBlur = tools.noop,
115
+ onFocus = tools.noop,
116
+ onChange = tools.noop
117
117
  } = props;
118
118
 
119
119
  // 编辑器
@@ -289,6 +289,7 @@ const RCEditor = /*#__PURE__*/forwardRef(function RCEditor(props, ref) {
289
289
  }));
290
290
  return /*#__PURE__*/React.createElement("div", {
291
291
  style: {
292
+ zIndex,
292
293
  border: bordered ? `${borderWidth}px ${borderStyle} ${borderColor}` : 'none',
293
294
  overflow: 'hidden',
294
295
  borderRadius
@@ -306,25 +307,4 @@ const RCEditor = /*#__PURE__*/forwardRef(function RCEditor(props, ref) {
306
307
  }
307
308
  }));
308
309
  });
309
- RCEditor.propTypes = {
310
- bordered: PropTypes.bool,
311
- borderStyle: PropTypes.string,
312
- borderColor: PropTypes.string,
313
- borderWidth: PropTypes.number,
314
- borderRadius: PropTypes.number,
315
- mode: PropTypes.string,
316
- value: PropTypes.string,
317
- height: PropTypes.number,
318
- disabled: PropTypes.bool,
319
- uploadUrl: PropTypes.string,
320
- uploadFileName: PropTypes.string,
321
- uploadImageFileSize: PropTypes.number,
322
- uploadVideoFileSize: PropTypes.number,
323
- uploadHeaders: PropTypes.object,
324
- uploadCustomRequest: PropTypes.func,
325
- placeholder: PropTypes.string,
326
- onBlur: PropTypes.func,
327
- onFocus: PropTypes.func,
328
- onChange: PropTypes.func
329
- };
330
310
  export default RCEditor;
@@ -1,7 +1,6 @@
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
2
  import MD5 from 'spark-md5';
3
3
  import React from 'react';
4
- import PropTypes from 'prop-types';
5
4
  import { Tooltip, Button, message } from 'antd';
6
5
  import { DeleteOutlined, PaperClipOutlined } from '@ant-design/icons';
7
6
  import { getAppKey, getToken, isHttpUrl, isVersion1, isVersion2 } from '../tools/index.js';
@@ -26,10 +25,10 @@ class FileUploader extends React.Component {
26
25
  */
27
26
  get httpConfig() {
28
27
  const {
29
- data,
28
+ data = {},
30
29
  action,
31
- headers,
32
- fieldName
30
+ headers = {},
31
+ fieldName = 'file'
33
32
  } = this.props;
34
33
  const {
35
34
  API_HOST
@@ -39,7 +38,7 @@ class FileUploader extends React.Component {
39
38
  data,
40
39
  action,
41
40
  headers: {
42
- ...headers,
41
+ ...tools.toObject(headers),
43
42
  token: getToken(),
44
43
  appKey: getAppKey()
45
44
  },
@@ -64,9 +63,9 @@ class FileUploader extends React.Component {
64
63
  */
65
64
  get disabled() {
66
65
  const {
67
- multiple,
68
- maxCount,
69
- disabled
66
+ multiple = false,
67
+ maxCount = 99,
68
+ disabled = false
70
69
  } = this.props;
71
70
  if (disabled) {
72
71
  return disabled;
@@ -143,7 +142,7 @@ class FileUploader extends React.Component {
143
142
  * @return {string}
144
143
  */
145
144
  get version() {
146
- return this.props.version;
145
+ return this.props.version || 'v2';
147
146
  }
148
147
 
149
148
  /**
@@ -241,9 +240,9 @@ class FileUploader extends React.Component {
241
240
  type: fileType
242
241
  } = file;
243
242
  const {
244
- accept,
245
- multiple,
246
- size: maxSize
243
+ accept = '*',
244
+ multiple = false,
245
+ size: maxSize = 5120
247
246
  } = this.props;
248
247
  this.verifyFileAccept(fileType, accept).then(() => this.verifyFileSize(fileSize, maxSize).then(() => this.onFormRequest(file).then(res => {
249
248
  const data = isVersion1(this.version) ? res.url : {
@@ -256,10 +255,10 @@ class FileUploader extends React.Component {
256
255
  }
257
256
  render() {
258
257
  const {
259
- accept,
260
- preview,
261
- showDelete,
262
- buttonProps,
258
+ accept = '*',
259
+ preview = false,
260
+ showDelete = true,
261
+ buttonProps = {},
263
262
  // ---------
264
263
  children
265
264
  } = this.props;
@@ -268,7 +267,7 @@ class FileUploader extends React.Component {
268
267
  } = this.state;
269
268
  return /*#__PURE__*/React.createElement("div", {
270
269
  className: `${prefixCls}_file-uploader_`
271
- }, /*#__PURE__*/React.createElement(Button, _extends({}, buttonProps, {
270
+ }, /*#__PURE__*/React.createElement(Button, _extends({}, tools.toObject(buttonProps), {
272
271
  loading: loading,
273
272
  disabled: this.disabled,
274
273
  className: `${prefixCls}_file-uploader-select_`,
@@ -314,66 +313,6 @@ class FileUploader extends React.Component {
314
313
  }));
315
314
  }
316
315
  }
317
- FileUploader.defaultProps = {
318
- size: 5120,
319
- data: {},
320
- accept: '*',
321
- headers: {},
322
- version: 'v2',
323
- preview: false,
324
- maxCount: 99,
325
- buttonProps: {
326
- icon: undefined,
327
- size: 'middle',
328
- type: 'default',
329
- block: false,
330
- shape: 'default',
331
- ghost: false,
332
- danger: false
333
- },
334
- disabled: false,
335
- multiple: false,
336
- fieldName: 'file',
337
- showDelete: true
338
- };
339
- FileUploader.propTypes = {
340
- // 版本 v1旧版 / v2新版
341
- version: PropTypes.string,
342
- // 上传资源文件大小 默认5MB
343
- size: PropTypes.number,
344
- // 按钮图标
345
- buttonProps: PropTypes.object,
346
- // http上传携带的其他数据 默认{}
347
- data: PropTypes.object,
348
- // 填充值 默认undefined
349
- value: PropTypes.any,
350
- // 上传资源类型
351
- accept: PropTypes.string,
352
- // http上传接口
353
- action: PropTypes.string.isRequired,
354
- // 预览 默认false
355
- preview: PropTypes.bool,
356
- // http请求头配置 默认{}
357
- headers: PropTypes.object,
358
- // 最大上传数 multiple模式下有效 默认最大上传数99
359
- maxCount: PropTypes.any,
360
- // 开启多个文件上传 默认false
361
- multiple: PropTypes.bool,
362
- // 是否禁用上传 默认false
363
- disabled: PropTypes.bool,
364
- // 上传字段 默认ossFile
365
- fieldName: PropTypes.string,
366
- // 显示删除按钮 默认true
367
- showDelete: PropTypes.bool,
368
- // 数据回调
369
- onChange: PropTypes.func,
370
- // 上传之前验证资源大小回调
371
- onBeforeUploadVerifySize: PropTypes.func,
372
- // 上传之前验证资源类型回调
373
- onBeforeUploadVerifyAccept: PropTypes.func,
374
- // 可以自定义自己的上传实现
375
- customRequest: PropTypes.func
376
- };
377
316
  export default FileUploader;
378
317
  export const getValueProps = value => ({
379
318
  value: value ? {
@@ -24,7 +24,6 @@ export default function FormilyDescriptions({
24
24
  const dataSource = tools.getDynamicFormilyFields(schema, values, {
25
25
  regions
26
26
  });
27
- console.log(schema, values);
28
27
  if (!dataSource.length) return /*#__PURE__*/React.createElement(Empty, {
29
28
  image: Empty.PRESENTED_IMAGE_SIMPLE
30
29
  });
@@ -1,22 +1,20 @@
1
1
  import MD5 from 'spark-md5';
2
2
  import React, { useEffect, useRef, useState, forwardRef, useImperativeHandle } from 'react';
3
3
  import Cropper from 'react-cropper';
4
- import PropTypes from 'prop-types';
5
4
  import 'cropperjs/dist/cropper.css';
6
5
  import { Empty } from 'antd';
7
6
  import { tools } from '@cqsjjb/jjb-common-lib';
8
7
  import { isHttpUrl } from '../tools/index.js';
9
8
  const ImageCropper = /*#__PURE__*/forwardRef((props, ref) => {
10
9
  const {
11
- width,
12
- height,
13
- aspect,
14
- locked,
10
+ width = 400,
11
+ height = 400,
12
+ aspect = 16 / 9,
13
+ locked = false,
15
14
  resource
16
15
  } = props;
17
16
  const cropRef = useRef(null);
18
17
  const [src, setSrc] = useState(undefined);
19
- console.log('props', locked);
20
18
 
21
19
  // 更新 src
22
20
  const onUpdateSrc = () => {
@@ -115,17 +113,4 @@ const ImageCropper = /*#__PURE__*/forwardRef((props, ref) => {
115
113
  description: "\u672A\u5BFC\u5165\u56FE\u7247\u8D44\u6E90\uFF0C\u65E0\u6CD5\u88C1\u526A"
116
114
  }));
117
115
  });
118
- ImageCropper.defaultProps = {
119
- width: 400,
120
- height: 400,
121
- aspect: 16 / 9,
122
- locked: false
123
- };
124
- ImageCropper.propTypes = {
125
- width: PropTypes.number,
126
- height: PropTypes.number,
127
- locked: PropTypes.bool,
128
- aspect: PropTypes.number,
129
- resource: PropTypes.any.isRequired
130
- };
131
116
  export default ImageCropper;
@@ -23,7 +23,7 @@ const ImageUploader = props => {
23
23
  const [resource, setResource] = useState(undefined);
24
24
  const cropperRef = useRef(null);
25
25
  const fileInputRef = useRef(null);
26
- const version = props.version;
26
+ const version = props.version || 'v2';
27
27
  const algorithm = (() => {
28
28
  const value = document.documentElement.style.getPropertyValue('--saas-algorithm');
29
29
  return value ? value === '#FFF' ? 'default' : 'dark' : 'default';
@@ -31,7 +31,7 @@ const ImageUploader = props => {
31
31
  const onLoadFile = useCallback(file => {
32
32
  const md5 = new MD5();
33
33
  const {
34
- svg
34
+ svg = false
35
35
  } = props;
36
36
  return new Promise(resolve => {
37
37
  const reader = new FileReader();
@@ -110,12 +110,12 @@ const ImageUploader = props => {
110
110
  API_HOST
111
111
  } = window.process.env.app;
112
112
  const {
113
- data,
113
+ data = {},
114
114
  action,
115
- headers: $headers,
116
- needToken,
115
+ headers: $headers = {},
116
+ needToken = true,
117
117
  customRequest,
118
- fieldName,
118
+ fieldName = 'file',
119
119
  onChange
120
120
  } = props;
121
121
  const requestURL = isHttpUrl(action) ? action : `${API_HOST}${action}`;
@@ -165,11 +165,11 @@ const ImageUploader = props => {
165
165
  const files = target.files;
166
166
  const file = files[0];
167
167
  const {
168
- wh,
169
- svg,
170
- size,
171
- cropper,
172
- compression
168
+ wh = '50*50',
169
+ svg = false,
170
+ size = 5120,
171
+ cropper = false,
172
+ compression = false
173
173
  } = props;
174
174
  onLoadFile(file).then(load => {
175
175
  const [w, h] = getViewAsp(wh);
@@ -205,19 +205,20 @@ const ImageUploader = props => {
205
205
  });
206
206
  }, [props, onLoadFile, onCompression, onUploadHttp]);
207
207
  const {
208
- tip,
209
- svg,
208
+ tip = '点击上传',
209
+ svg = false,
210
210
  value,
211
- disabled,
212
- width,
213
- height,
214
- cropper,
215
- borderStyle,
216
- borderColor,
217
- borderWidth,
218
- borderRadius,
219
- backgroundColor,
220
- cropperConfig: $cropperConfig,
211
+ disabled = false,
212
+ width = 120,
213
+ height = 120,
214
+ preview: _preview = true,
215
+ cropper = false,
216
+ borderStyle = 'dashed',
217
+ borderColor = '#d9d9d9',
218
+ borderWidth = 1,
219
+ borderRadius = 2,
220
+ backgroundColor = '#fafafa',
221
+ cropperConfig: $cropperConfig = {},
221
222
  onChange
222
223
  } = props;
223
224
  const cropperConfig = toObject($cropperConfig);
@@ -242,7 +243,7 @@ const ImageUploader = props => {
242
243
  } : true
243
244
  }), !disabled && /*#__PURE__*/React.createElement("div", {
244
245
  className: `${prefixCls}_image-file-uploader-preview-control_`
245
- }, props.preview && /*#__PURE__*/React.createElement(EyeOutlined, {
246
+ }, _preview && /*#__PURE__*/React.createElement(EyeOutlined, {
246
247
  title: "\u9884\u89C8",
247
248
  onClick: () => setPreview(true)
248
249
  }), /*#__PURE__*/React.createElement(DeleteOutlined, {
@@ -296,61 +297,6 @@ const ImageUploader = props => {
296
297
  resource: resource
297
298
  })));
298
299
  };
299
- ImageUploader.defaultProps = {
300
- wh: '50*50',
301
- tip: '点击上传',
302
- svg: false,
303
- size: 5120,
304
- data: {},
305
- width: 120,
306
- height: 120,
307
- headers: {},
308
- preview: true,
309
- cropper: false,
310
- version: 'v2',
311
- disabled: false,
312
- fieldName: 'file',
313
- borderColor: '#d9d9d9',
314
- borderWidth: 1,
315
- borderStyle: 'dashed',
316
- borderRadius: 2,
317
- cropperConfig: {},
318
- backgroundColor: '#fafafa',
319
- compression: false,
320
- compressionConfig: {
321
- quality: 0.6,
322
- backType: 'file'
323
- },
324
- needToken: true
325
- };
326
- ImageUploader.propTypes = {
327
- version: PropTypes.string,
328
- wh: PropTypes.string,
329
- svg: PropTypes.bool,
330
- tip: PropTypes.string,
331
- size: PropTypes.number,
332
- data: PropTypes.object,
333
- value: PropTypes.any,
334
- width: PropTypes.number,
335
- height: PropTypes.number,
336
- action: PropTypes.string.isRequired,
337
- preview: PropTypes.bool,
338
- cropper: PropTypes.bool,
339
- headers: PropTypes.object,
340
- disabled: PropTypes.bool,
341
- fieldName: PropTypes.string,
342
- borderStyle: PropTypes.string,
343
- borderColor: PropTypes.string,
344
- borderWidth: PropTypes.number,
345
- borderRadius: PropTypes.number,
346
- cropperConfig: PropTypes.object,
347
- backgroundColor: PropTypes.string,
348
- customRequest: PropTypes.func,
349
- onChange: PropTypes.func,
350
- compression: PropTypes.bool,
351
- compressionConfig: PropTypes.object,
352
- needToken: PropTypes.bool
353
- };
354
300
  export default ImageUploader;
355
301
  export const getValueProps = value => ({
356
302
  value: value ? {
@@ -1,4 +1,3 @@
1
- import PropTypes from 'prop-types';
2
1
  import React, { memo, useCallback } from 'react';
3
2
  import { PageHeader } from '@ant-design/pro-layout';
4
3
  import './index.less';
@@ -58,28 +57,4 @@ const PageLayout = /*#__PURE__*/memo(props => {
58
57
  style: footerStyle
59
58
  }, footer));
60
59
  });
61
- PageLayout.propTypes = {
62
- style: PropTypes.object,
63
- title: PropTypes.string,
64
- extra: PropTypes.node,
65
- header: PropTypes.node,
66
- footer: PropTypes.any,
67
- history: PropTypes.object,
68
- noStyle: PropTypes.bool,
69
- noBorder: PropTypes.bool,
70
- formLine: PropTypes.node,
71
- previous: PropTypes.bool,
72
- transparent: PropTypes.bool,
73
- formLineStyle: PropTypes.object,
74
- contentStyle: PropTypes.object,
75
- footerStyle: PropTypes.object,
76
- pageHeaderStyle: PropTypes.object,
77
- onBack: PropTypes.func
78
- };
79
- PageLayout.defaultProps = {
80
- style: {},
81
- history: {},
82
- noBorder: false,
83
- previous: false
84
- };
85
60
  export default PageLayout;
@@ -1,5 +1,4 @@
1
1
  import React, { useState, useRef, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
2
  import { Form, Button, Space, Row, Col } from 'antd';
4
3
  import { SearchOutlined, DoubleRightOutlined, UndoOutlined } from '@ant-design/icons';
5
4
  const SearchForm = ({
@@ -93,20 +92,4 @@ const SearchForm = ({
93
92
  noStyle: true
94
93
  }, getButtons()))));
95
94
  };
96
- SearchForm.propTypes = {
97
- form: PropTypes.object,
98
- style: PropTypes.object,
99
- expand: PropTypes.bool,
100
- // 受控
101
- defaultExpand: PropTypes.bool,
102
- // 内部默认展开
103
- colSize: PropTypes.number,
104
- loading: PropTypes.bool,
105
- formLine: PropTypes.array,
106
- initialValues: PropTypes.object,
107
- onRef: PropTypes.func,
108
- onReset: PropTypes.func,
109
- onFinish: PropTypes.func,
110
- onExpand: PropTypes.func
111
- };
112
95
  export default SearchForm;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cqsjjb/jjb-react-admin-component",
3
- "version": "3.2.0-beta.1",
3
+ "version": "3.2.0-rc.0",
4
4
  "description": "jjb-react-admin-组件库@new",
5
5
  "main": "index.js",
6
6
  "author": "jjb-front-team",