@guo514360255/antd-lib 1.4.37 → 1.5.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/dist/FormItem/index.d.ts +1 -0
- package/dist/FormItem/index.js +41 -2
- package/dist/compontent.d.ts +1 -0
- package/package.json +9 -2
package/dist/FormItem/index.d.ts
CHANGED
package/dist/FormItem/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
3
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
5
|
var _excluded = ["value", "onChange"];
|
|
4
6
|
/*
|
|
@@ -7,9 +9,12 @@ var _excluded = ["value", "onChange"];
|
|
|
7
9
|
* @Description:
|
|
8
10
|
*/
|
|
9
11
|
import { valueEnumTransform } from "../utils/util";
|
|
12
|
+
import { Editor, Toolbar } from '@wangeditor/editor-for-react';
|
|
13
|
+
import '@wangeditor/editor/dist/css/style.css';
|
|
10
14
|
import { Checkbox, ColorPicker, DatePicker, Input, InputNumber, Radio, Select, TreeSelect } from 'antd';
|
|
11
|
-
import React from 'react';
|
|
15
|
+
import React, { useState } from 'react';
|
|
12
16
|
var FormItem = function FormItem(_ref) {
|
|
17
|
+
var _rest$fieldProps, _rest$fieldProps2, _rest$fieldProps3;
|
|
13
18
|
var value = _ref.value,
|
|
14
19
|
_onChange = _ref.onChange,
|
|
15
20
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -24,9 +29,43 @@ var FormItem = function FormItem(_ref) {
|
|
|
24
29
|
color: ColorPicker,
|
|
25
30
|
date: DatePicker
|
|
26
31
|
};
|
|
32
|
+
var _useState = useState(null),
|
|
33
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
34
|
+
editor = _useState2[0],
|
|
35
|
+
setEditor = _useState2[1];
|
|
36
|
+
var _useState3 = useState(value || ''),
|
|
37
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
38
|
+
html = _useState4[0],
|
|
39
|
+
setHtml = _useState4[1];
|
|
27
40
|
var placeholder = rest.defaultPlaceholder || ['input', 'inputNumber', 'textArea'].includes(rest.type) ? '请输入' : '请选择';
|
|
28
41
|
var FieldComponent = comField[rest.type || 'input'];
|
|
29
|
-
|
|
42
|
+
var toolbarConfig = {};
|
|
43
|
+
var editorConfig = {
|
|
44
|
+
placeholder: '请输入内容...',
|
|
45
|
+
MENU_CONF: _objectSpread({}, (rest === null || rest === void 0 || (_rest$fieldProps = rest.fieldProps) === null || _rest$fieldProps === void 0 ? void 0 : _rest$fieldProps.editorConfig) || {})
|
|
46
|
+
};
|
|
47
|
+
return rest.type === 'editor' ? /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
style: {
|
|
49
|
+
border: '1px solid #cecece'
|
|
50
|
+
}
|
|
51
|
+
}, /*#__PURE__*/React.createElement(Toolbar, _extends({
|
|
52
|
+
defaultConfig: toolbarConfig,
|
|
53
|
+
mode: "default",
|
|
54
|
+
editor: editor
|
|
55
|
+
}, (rest === null || rest === void 0 || (_rest$fieldProps2 = rest.fieldProps) === null || _rest$fieldProps2 === void 0 ? void 0 : _rest$fieldProps2.toolbar) || {})), /*#__PURE__*/React.createElement(Editor, _extends({
|
|
56
|
+
defaultConfig: editorConfig,
|
|
57
|
+
onCreated: setEditor,
|
|
58
|
+
mode: "default",
|
|
59
|
+
value: html,
|
|
60
|
+
onChange: function onChange(editor) {
|
|
61
|
+
var htmlText = editor.getHtml();
|
|
62
|
+
setHtml(htmlText);
|
|
63
|
+
_onChange === null || _onChange === void 0 || _onChange(htmlText);
|
|
64
|
+
},
|
|
65
|
+
style: {
|
|
66
|
+
height: '300px'
|
|
67
|
+
}
|
|
68
|
+
}, (rest === null || rest === void 0 || (_rest$fieldProps3 = rest.fieldProps) === null || _rest$fieldProps3 === void 0 ? void 0 : _rest$fieldProps3.editor) || {}))) : /*#__PURE__*/React.createElement(FieldComponent, _extends({
|
|
30
69
|
value: value,
|
|
31
70
|
onChange: function onChange(e) {
|
|
32
71
|
return _onChange === null || _onChange === void 0 ? void 0 : _onChange(['treeSelect', 'select', 'checkbox', 'color', 'date'].includes(rest.type) ? e : !rest.type || ['input', 'inputNumber'].includes(rest.type) ? e : e.target.value);
|
package/dist/compontent.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@guo514360255/antd-lib",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "react design 5 lib",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -46,6 +46,8 @@
|
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@babel/runtime": "^7.28.4",
|
|
49
|
+
"@wangeditor/editor": "^5.1.23",
|
|
50
|
+
"@wangeditor/editor-for-react": "^1.0.6",
|
|
49
51
|
"crypto-js": "^4.2.0",
|
|
50
52
|
"js-cookie": "^3.0.5",
|
|
51
53
|
"lodash": "^4.17.21",
|
|
@@ -53,14 +55,19 @@
|
|
|
53
55
|
"zustand": "^5.0.9"
|
|
54
56
|
},
|
|
55
57
|
"devDependencies": {
|
|
58
|
+
"@ant-design/icons": "^6.1.0",
|
|
59
|
+
"@ant-design/pro-components": "^2.8.10",
|
|
60
|
+
"@ant-design/pro-table": "^3.x",
|
|
56
61
|
"@commitlint/cli": "^17.1.2",
|
|
57
62
|
"@commitlint/config-conventional": "^17.1.0",
|
|
58
63
|
"@types/crypto-js": "^4.2.2",
|
|
59
64
|
"@types/js-cookie": "^3.0.6",
|
|
60
|
-
"@types/lodash": "^4.
|
|
65
|
+
"@types/lodash": "^4.14.191",
|
|
61
66
|
"@types/react": "18.2.0",
|
|
62
67
|
"@types/react-dom": "18.2.0",
|
|
63
68
|
"@umijs/lint": "^4.0.0",
|
|
69
|
+
"antd": "^5.x",
|
|
70
|
+
"antd-img-crop": "^4.27.0",
|
|
64
71
|
"dumi": "^2.4.13",
|
|
65
72
|
"eslint": "^8.23.0",
|
|
66
73
|
"father": "^4.1.0",
|