@bit-sun/business-component 1.0.3 → 1.0.7
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/{DataValidation → components/DataValidation}/index.d.ts +1 -1
- package/dist/components/QueryInput/index.d.ts +3 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.esm.js +114 -6
- package/dist/index.js +112 -3
- package/package.json +1 -1
- package/src/{DataValidation → components/DataValidation}/index.less +0 -0
- package/src/components/DataValidation/index.md +36 -0
- package/src/{DataValidation → components/DataValidation}/index.tsx +12 -5
- package/src/components/QueryInput/index.less +21 -0
- package/src/components/QueryInput/index.md +31 -0
- package/src/components/QueryInput/index.tsx +109 -0
- package/src/index.ts +3 -2
- package/src/DataValidation/index.md +0 -32
|
@@ -13,7 +13,7 @@ declare class DataValidation extends React.Component {
|
|
|
13
13
|
showtoolbar: boolean;
|
|
14
14
|
hook: {
|
|
15
15
|
columnTitleCellRenderBefore: (columnAbc: any, postion: any, ctx: any) => void;
|
|
16
|
-
|
|
16
|
+
cellRenderBefore: (cell: any, postion: any, sheetFile: any, ctx: any) => void;
|
|
17
17
|
cellAllRenderBefore: (data: any, sheetFile: any, ctx: any) => void;
|
|
18
18
|
};
|
|
19
19
|
data: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { default as DataValidation } from './DataValidation';
|
|
1
|
+
export { default as DataValidation } from './components/DataValidation';
|
|
2
|
+
export { default as QueryInput } from './components/QueryInput';
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
-
import React, { createContext, useContext, useEffect, forwardRef, createElement } from 'react';
|
|
3
|
-
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox } from 'antd';
|
|
2
|
+
import React, { createContext, useContext, useEffect, forwardRef, createElement, useState } from 'react';
|
|
3
|
+
import { message, Menu, Space, Dropdown, Tooltip, Button, Checkbox, Input, Modal } from 'antd';
|
|
4
4
|
import { DragDropContext, Droppable, Draggable } from 'react-beautiful-dnd';
|
|
5
5
|
import 'antd/dist/antd.css';
|
|
6
6
|
import classNames from 'classnames';
|
|
@@ -1620,7 +1620,7 @@ var itemsTemp = []; // const mapping = [
|
|
|
1620
1620
|
// { "key": "price", "name": "单价", "rule": "price" }
|
|
1621
1621
|
// ]
|
|
1622
1622
|
|
|
1623
|
-
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价']]); // for dnd
|
|
1623
|
+
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例']]); // for dnd
|
|
1624
1624
|
|
|
1625
1625
|
|
|
1626
1626
|
var reorder = function reorder(list, startIndex, endIndex) {
|
|
@@ -1703,9 +1703,13 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1703
1703
|
}
|
|
1704
1704
|
}
|
|
1705
1705
|
},
|
|
1706
|
-
|
|
1706
|
+
cellRenderBefore: function cellRenderBefore(cell, postion, sheetFile, ctx) {
|
|
1707
1707
|
if (cell) {
|
|
1708
1708
|
cell.fs = 10;
|
|
1709
|
+
|
|
1710
|
+
if (typeof cell.v === 'string') {
|
|
1711
|
+
cell.m = cell.v = cell.m.trim();
|
|
1712
|
+
}
|
|
1709
1713
|
} // console.log(postion);
|
|
1710
1714
|
|
|
1711
1715
|
},
|
|
@@ -2015,12 +2019,14 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2015
2019
|
};
|
|
2016
2020
|
|
|
2017
2021
|
_this.menuList = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
2022
|
+
key: "1",
|
|
2018
2023
|
className: "sheet_table-menu_item_text"
|
|
2019
2024
|
}, /*#__PURE__*/React.createElement("a", {
|
|
2020
2025
|
onClick: function onClick() {
|
|
2021
2026
|
return _this.filterData('all');
|
|
2022
2027
|
}
|
|
2023
2028
|
}, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React.createElement(Menu.Divider, null), /*#__PURE__*/React.createElement(Menu.Item, {
|
|
2029
|
+
key: "2",
|
|
2024
2030
|
className: "sheet_table-menu_item_text"
|
|
2025
2031
|
}, /*#__PURE__*/React.createElement("a", {
|
|
2026
2032
|
onClick: function onClick() {
|
|
@@ -2028,6 +2034,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2028
2034
|
}
|
|
2029
2035
|
}, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
|
|
2030
2036
|
_this.leftMenu = /*#__PURE__*/React.createElement(Menu, null, /*#__PURE__*/React.createElement(Menu.Item, {
|
|
2037
|
+
key: "3",
|
|
2031
2038
|
className: "sheet_table-menu_item_text"
|
|
2032
2039
|
}, /*#__PURE__*/React.createElement("span", {
|
|
2033
2040
|
className: "sheet_table_text"
|
|
@@ -2161,14 +2168,115 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2161
2168
|
return DataValidation;
|
|
2162
2169
|
}(React.Component);
|
|
2163
2170
|
|
|
2171
|
+
var css_248z$1 = ".query_input button {\n width: '50px';\n}\n.query_input_wrapper {\n display: flex;\n}\n.query_input_wrapper_left {\n width: 100px;\n}\n.query_input_wrapper_right {\n color: #9e9e9e;\n}\n.query_input_textArea {\n margin-top: 15px;\n}\n";
|
|
2172
|
+
styleInject(css_248z$1);
|
|
2173
|
+
|
|
2174
|
+
var QueryInput = function QueryInput() {
|
|
2175
|
+
var _useState = useState(false),
|
|
2176
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2177
|
+
isModalVisible = _useState2[0],
|
|
2178
|
+
setIsModalVisible = _useState2[1];
|
|
2179
|
+
|
|
2180
|
+
var _useState3 = useState(''),
|
|
2181
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2182
|
+
value = _useState4[0],
|
|
2183
|
+
setValue = _useState4[1];
|
|
2184
|
+
|
|
2185
|
+
var showModal = function showModal() {
|
|
2186
|
+
setIsModalVisible(true);
|
|
2187
|
+
};
|
|
2188
|
+
|
|
2189
|
+
var handleOk = function handleOk() {
|
|
2190
|
+
var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
|
|
2191
|
+
return item;
|
|
2192
|
+
}).join(',');
|
|
2193
|
+
setValue(formatValue);
|
|
2194
|
+
setIsModalVisible(false);
|
|
2195
|
+
};
|
|
2196
|
+
|
|
2197
|
+
var handleCancel = function handleCancel() {
|
|
2198
|
+
setIsModalVisible(false);
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
var outerChange = function outerChange(e) {
|
|
2202
|
+
debugger;
|
|
2203
|
+
var formatValue = ToCDB(e.target.value).split(/[/\n/\s,;]/).filter(function (item) {
|
|
2204
|
+
return item;
|
|
2205
|
+
}).join(',');
|
|
2206
|
+
setValue(formatValue);
|
|
2207
|
+
};
|
|
2208
|
+
|
|
2209
|
+
var onChange = function onChange(e) {
|
|
2210
|
+
setValue(e.target.value);
|
|
2211
|
+
};
|
|
2212
|
+
|
|
2213
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2214
|
+
className: css_248z$1.query_input
|
|
2215
|
+
}, /*#__PURE__*/React.createElement(Input.Group, {
|
|
2216
|
+
compact: true
|
|
2217
|
+
}, /*#__PURE__*/React.createElement(Input, {
|
|
2218
|
+
value: value,
|
|
2219
|
+
onChange: outerChange,
|
|
2220
|
+
style: {
|
|
2221
|
+
width: 'calc(100% - 50px)'
|
|
2222
|
+
},
|
|
2223
|
+
placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
|
|
2224
|
+
}), /*#__PURE__*/React.createElement(Button, {
|
|
2225
|
+
className: css_248z$1.button,
|
|
2226
|
+
onClick: showModal,
|
|
2227
|
+
type: "primary"
|
|
2228
|
+
}, "...")), /*#__PURE__*/React.createElement(Modal, {
|
|
2229
|
+
width: 600,
|
|
2230
|
+
title: "\u591A\u503C\u5F55\u5165",
|
|
2231
|
+
visible: isModalVisible,
|
|
2232
|
+
onOk: handleOk,
|
|
2233
|
+
onCancel: handleCancel,
|
|
2234
|
+
footer: [/*#__PURE__*/React.createElement(Button, {
|
|
2235
|
+
key: "back",
|
|
2236
|
+
onClick: handleCancel
|
|
2237
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React.createElement(Button, {
|
|
2238
|
+
key: "submit",
|
|
2239
|
+
type: "primary",
|
|
2240
|
+
onClick: handleOk
|
|
2241
|
+
}, "\u5F55\u5165")]
|
|
2242
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2243
|
+
className: css_248z$1.query_input_wrapper
|
|
2244
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
2245
|
+
className: css_248z$1.query_input_wrapper_left
|
|
2246
|
+
}, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React.createElement("div", {
|
|
2247
|
+
className: css_248z$1.query_input_wrapper_right
|
|
2248
|
+
}, /*#__PURE__*/React.createElement("div", null, "\u5982\u9700\u540C\u65F6\u4F7F\u7528\u591A\u4E2A\u503C\u8FDB\u884C\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u9017\u53F7\u3001\u5206\u53F7\u3001\u7A7A\u683C\u6216\u6362\u884C\u8FDB\u884C\u503C\u7684\u5206\u9694\uFF0C\u4E2D\u82F1\u6587\u683C\u5F0F\u7684\u7B26\u53F7\u5747\u652F\u6301"), /*#__PURE__*/React.createElement("div", {
|
|
2249
|
+
className: css_248z$1.query_input_textArea
|
|
2250
|
+
}, /*#__PURE__*/React.createElement(Input.TextArea, {
|
|
2251
|
+
value: value,
|
|
2252
|
+
onChange: onChange,
|
|
2253
|
+
rows: 6,
|
|
2254
|
+
showCount: true
|
|
2255
|
+
}))))));
|
|
2256
|
+
};
|
|
2257
|
+
|
|
2258
|
+
function ToCDB(str) {
|
|
2259
|
+
var tmp = '';
|
|
2260
|
+
|
|
2261
|
+
for (var i = 0; i < str.length; i++) {
|
|
2262
|
+
if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
|
|
2263
|
+
tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
|
|
2264
|
+
} else {
|
|
2265
|
+
tmp += String.fromCharCode(str.charCodeAt(i));
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
return tmp;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2164
2272
|
/*
|
|
2165
2273
|
* @Description:
|
|
2166
2274
|
* @Author: rodchen
|
|
2167
2275
|
* @Date: 2021-11-30 22:59:39
|
|
2168
|
-
* @LastEditTime: 2021-12-
|
|
2276
|
+
* @LastEditTime: 2021-12-27 20:16:20
|
|
2169
2277
|
* @LastEditors: rodchen
|
|
2170
2278
|
*/
|
|
2171
2279
|
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
2172
2280
|
axios.defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
2173
2281
|
|
|
2174
|
-
export { DataValidation };
|
|
2282
|
+
export { DataValidation, QueryInput };
|
package/dist/index.js
CHANGED
|
@@ -1630,7 +1630,7 @@ var itemsTemp = []; // const mapping = [
|
|
|
1630
1630
|
// { "key": "price", "name": "单价", "rule": "price" }
|
|
1631
1631
|
// ]
|
|
1632
1632
|
|
|
1633
|
-
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价']]); // for dnd
|
|
1633
|
+
var mapping = new Map([['skuCode', 'SKU编码'], ['quantity', '数量'], ['price', '单价'], ['regionCode', '库区'], ['checkQuantity', '实盘数量'], ['shareRatio', '共享比例']]); // for dnd
|
|
1634
1634
|
|
|
1635
1635
|
|
|
1636
1636
|
var reorder = function reorder(list, startIndex, endIndex) {
|
|
@@ -1713,9 +1713,13 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
1713
1713
|
}
|
|
1714
1714
|
}
|
|
1715
1715
|
},
|
|
1716
|
-
|
|
1716
|
+
cellRenderBefore: function cellRenderBefore(cell, postion, sheetFile, ctx) {
|
|
1717
1717
|
if (cell) {
|
|
1718
1718
|
cell.fs = 10;
|
|
1719
|
+
|
|
1720
|
+
if (typeof cell.v === 'string') {
|
|
1721
|
+
cell.m = cell.v = cell.m.trim();
|
|
1722
|
+
}
|
|
1719
1723
|
} // console.log(postion);
|
|
1720
1724
|
|
|
1721
1725
|
},
|
|
@@ -2025,12 +2029,14 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2025
2029
|
};
|
|
2026
2030
|
|
|
2027
2031
|
_this.menuList = /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
2032
|
+
key: "1",
|
|
2028
2033
|
className: "sheet_table-menu_item_text"
|
|
2029
2034
|
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
2030
2035
|
onClick: function onClick() {
|
|
2031
2036
|
return _this.filterData('all');
|
|
2032
2037
|
}
|
|
2033
2038
|
}, "\u6E05\u7A7A\u5168\u90E8\u6570\u636E")), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Divider, null), /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
2039
|
+
key: "2",
|
|
2034
2040
|
className: "sheet_table-menu_item_text"
|
|
2035
2041
|
}, /*#__PURE__*/React__default['default'].createElement("a", {
|
|
2036
2042
|
onClick: function onClick() {
|
|
@@ -2038,6 +2044,7 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2038
2044
|
}
|
|
2039
2045
|
}, "\u4EC5\u6E05\u7A7A\u9519\u8BEF\u6570\u636E")));
|
|
2040
2046
|
_this.leftMenu = /*#__PURE__*/React__default['default'].createElement(antd.Menu, null, /*#__PURE__*/React__default['default'].createElement(antd.Menu.Item, {
|
|
2047
|
+
key: "3",
|
|
2041
2048
|
className: "sheet_table-menu_item_text"
|
|
2042
2049
|
}, /*#__PURE__*/React__default['default'].createElement("span", {
|
|
2043
2050
|
className: "sheet_table_text"
|
|
@@ -2171,14 +2178,116 @@ var DataValidation = /*#__PURE__*/function (_React$Component) {
|
|
|
2171
2178
|
return DataValidation;
|
|
2172
2179
|
}(React__default['default'].Component);
|
|
2173
2180
|
|
|
2181
|
+
var css_248z$1 = ".query_input button {\n width: '50px';\n}\n.query_input_wrapper {\n display: flex;\n}\n.query_input_wrapper_left {\n width: 100px;\n}\n.query_input_wrapper_right {\n color: #9e9e9e;\n}\n.query_input_textArea {\n margin-top: 15px;\n}\n";
|
|
2182
|
+
styleInject(css_248z$1);
|
|
2183
|
+
|
|
2184
|
+
var QueryInput = function QueryInput() {
|
|
2185
|
+
var _useState = React.useState(false),
|
|
2186
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
2187
|
+
isModalVisible = _useState2[0],
|
|
2188
|
+
setIsModalVisible = _useState2[1];
|
|
2189
|
+
|
|
2190
|
+
var _useState3 = React.useState(''),
|
|
2191
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
2192
|
+
value = _useState4[0],
|
|
2193
|
+
setValue = _useState4[1];
|
|
2194
|
+
|
|
2195
|
+
var showModal = function showModal() {
|
|
2196
|
+
setIsModalVisible(true);
|
|
2197
|
+
};
|
|
2198
|
+
|
|
2199
|
+
var handleOk = function handleOk() {
|
|
2200
|
+
var formatValue = ToCDB(value).split(/[/\n/\s,;]/).filter(function (item) {
|
|
2201
|
+
return item;
|
|
2202
|
+
}).join(',');
|
|
2203
|
+
setValue(formatValue);
|
|
2204
|
+
setIsModalVisible(false);
|
|
2205
|
+
};
|
|
2206
|
+
|
|
2207
|
+
var handleCancel = function handleCancel() {
|
|
2208
|
+
setIsModalVisible(false);
|
|
2209
|
+
};
|
|
2210
|
+
|
|
2211
|
+
var outerChange = function outerChange(e) {
|
|
2212
|
+
debugger;
|
|
2213
|
+
var formatValue = ToCDB(e.target.value).split(/[/\n/\s,;]/).filter(function (item) {
|
|
2214
|
+
return item;
|
|
2215
|
+
}).join(',');
|
|
2216
|
+
setValue(formatValue);
|
|
2217
|
+
};
|
|
2218
|
+
|
|
2219
|
+
var onChange = function onChange(e) {
|
|
2220
|
+
setValue(e.target.value);
|
|
2221
|
+
};
|
|
2222
|
+
|
|
2223
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2224
|
+
className: css_248z$1.query_input
|
|
2225
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Input.Group, {
|
|
2226
|
+
compact: true
|
|
2227
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Input, {
|
|
2228
|
+
value: value,
|
|
2229
|
+
onChange: outerChange,
|
|
2230
|
+
style: {
|
|
2231
|
+
width: 'calc(100% - 50px)'
|
|
2232
|
+
},
|
|
2233
|
+
placeholder: "\u8BF7\u8F93\u5165\uFF08\u67E5\u8BE2\u591A\u4E2A\u503C\u8BF7\u7528 ; \u6216 , \u5206\u5272\uFF09"
|
|
2234
|
+
}), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
2235
|
+
className: css_248z$1.button,
|
|
2236
|
+
onClick: showModal,
|
|
2237
|
+
type: "primary"
|
|
2238
|
+
}, "...")), /*#__PURE__*/React__default['default'].createElement(antd.Modal, {
|
|
2239
|
+
width: 600,
|
|
2240
|
+
title: "\u591A\u503C\u5F55\u5165",
|
|
2241
|
+
visible: isModalVisible,
|
|
2242
|
+
onOk: handleOk,
|
|
2243
|
+
onCancel: handleCancel,
|
|
2244
|
+
footer: [/*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
2245
|
+
key: "back",
|
|
2246
|
+
onClick: handleCancel
|
|
2247
|
+
}, "\u53D6\u6D88"), /*#__PURE__*/React__default['default'].createElement(antd.Button, {
|
|
2248
|
+
key: "submit",
|
|
2249
|
+
type: "primary",
|
|
2250
|
+
onClick: handleOk
|
|
2251
|
+
}, "\u5F55\u5165")]
|
|
2252
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2253
|
+
className: css_248z$1.query_input_wrapper
|
|
2254
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2255
|
+
className: css_248z$1.query_input_wrapper_left
|
|
2256
|
+
}, "\u5F55\u5165\u533A\uFF1A"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2257
|
+
className: css_248z$1.query_input_wrapper_right
|
|
2258
|
+
}, /*#__PURE__*/React__default['default'].createElement("div", null, "\u5982\u9700\u540C\u65F6\u4F7F\u7528\u591A\u4E2A\u503C\u8FDB\u884C\u67E5\u8BE2\uFF0C\u8BF7\u4F7F\u7528\u9017\u53F7\u3001\u5206\u53F7\u3001\u7A7A\u683C\u6216\u6362\u884C\u8FDB\u884C\u503C\u7684\u5206\u9694\uFF0C\u4E2D\u82F1\u6587\u683C\u5F0F\u7684\u7B26\u53F7\u5747\u652F\u6301"), /*#__PURE__*/React__default['default'].createElement("div", {
|
|
2259
|
+
className: css_248z$1.query_input_textArea
|
|
2260
|
+
}, /*#__PURE__*/React__default['default'].createElement(antd.Input.TextArea, {
|
|
2261
|
+
value: value,
|
|
2262
|
+
onChange: onChange,
|
|
2263
|
+
rows: 6,
|
|
2264
|
+
showCount: true
|
|
2265
|
+
}))))));
|
|
2266
|
+
};
|
|
2267
|
+
|
|
2268
|
+
function ToCDB(str) {
|
|
2269
|
+
var tmp = '';
|
|
2270
|
+
|
|
2271
|
+
for (var i = 0; i < str.length; i++) {
|
|
2272
|
+
if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
|
|
2273
|
+
tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
|
|
2274
|
+
} else {
|
|
2275
|
+
tmp += String.fromCharCode(str.charCodeAt(i));
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
return tmp;
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2174
2282
|
/*
|
|
2175
2283
|
* @Description:
|
|
2176
2284
|
* @Author: rodchen
|
|
2177
2285
|
* @Date: 2021-11-30 22:59:39
|
|
2178
|
-
* @LastEditTime: 2021-12-
|
|
2286
|
+
* @LastEditTime: 2021-12-27 20:16:20
|
|
2179
2287
|
* @LastEditors: rodchen
|
|
2180
2288
|
*/
|
|
2181
2289
|
var resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
2182
2290
|
axios__default['default'].defaults.headers.common['sso-sessionid'] = (resposne === null || resposne === void 0 ? void 0 : resposne.sessionId) || '';
|
|
2183
2291
|
|
|
2184
2292
|
exports.DataValidation = DataValidation;
|
|
2293
|
+
exports.QueryInput = QueryInput;
|
package/package.json
CHANGED
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 组件
|
|
7
|
+
order: 0
|
|
8
|
+
title: 数据校验
|
|
9
|
+
order: 1
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## DataValidation
|
|
13
|
+
|
|
14
|
+
Demo:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useRef } from 'react';
|
|
18
|
+
import { DataValidation } from '../../index';
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
let dataValidationRef: DataValidation = useRef();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<DataValidation
|
|
26
|
+
columns={['skuCode', 'quantity', 'price']}
|
|
27
|
+
onRef={(ref) => {
|
|
28
|
+
dataValidationRef = ref;
|
|
29
|
+
}}
|
|
30
|
+
/>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2021-12-01 10:52:08
|
|
5
|
-
* @LastEditTime: 2021-12-
|
|
5
|
+
* @LastEditTime: 2021-12-22 14:24:35
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
8
|
// @ts-nocheck
|
|
@@ -43,6 +43,9 @@ const mapping = new Map([
|
|
|
43
43
|
['skuCode', 'SKU编码'],
|
|
44
44
|
['quantity', '数量'],
|
|
45
45
|
['price', '单价'],
|
|
46
|
+
['regionCode', '库区'],
|
|
47
|
+
['checkQuantity', '实盘数量'],
|
|
48
|
+
['shareRatio', '共享比例'],
|
|
46
49
|
]);
|
|
47
50
|
|
|
48
51
|
// for dnd
|
|
@@ -163,9 +166,13 @@ class DataValidation extends React.Component {
|
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
},
|
|
166
|
-
|
|
169
|
+
cellRenderBefore: function (cell, postion, sheetFile, ctx) {
|
|
167
170
|
if (cell) {
|
|
168
171
|
cell.fs = 10;
|
|
172
|
+
|
|
173
|
+
if (typeof cell.v === 'string') {
|
|
174
|
+
cell.m = cell.v = cell.m.trim();
|
|
175
|
+
}
|
|
169
176
|
}
|
|
170
177
|
// console.log(postion);
|
|
171
178
|
},
|
|
@@ -469,11 +476,11 @@ class DataValidation extends React.Component {
|
|
|
469
476
|
|
|
470
477
|
menuList = (
|
|
471
478
|
<Menu>
|
|
472
|
-
<Menu.Item className="sheet_table-menu_item_text">
|
|
479
|
+
<Menu.Item key="1" className="sheet_table-menu_item_text">
|
|
473
480
|
<a onClick={() => this.filterData('all')}>清空全部数据</a>
|
|
474
481
|
</Menu.Item>
|
|
475
482
|
<Menu.Divider />
|
|
476
|
-
<Menu.Item className="sheet_table-menu_item_text">
|
|
483
|
+
<Menu.Item key="2" className="sheet_table-menu_item_text">
|
|
477
484
|
<a onClick={() => this.filterData('error')}>仅清空错误数据</a>
|
|
478
485
|
</Menu.Item>
|
|
479
486
|
</Menu>
|
|
@@ -481,7 +488,7 @@ class DataValidation extends React.Component {
|
|
|
481
488
|
|
|
482
489
|
leftMenu = (
|
|
483
490
|
<Menu>
|
|
484
|
-
<Menu.Item className="sheet_table-menu_item_text">
|
|
491
|
+
<Menu.Item key="3" className="sheet_table-menu_item_text">
|
|
485
492
|
<span className="sheet_table_text">请拖动字段来对应列</span>
|
|
486
493
|
</Menu.Item>
|
|
487
494
|
<Menu.Divider />
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
nav:
|
|
3
|
+
title: '组件'
|
|
4
|
+
order: 1
|
|
5
|
+
group:
|
|
6
|
+
title: 组件
|
|
7
|
+
order: 0
|
|
8
|
+
title: 批量查询组件
|
|
9
|
+
order: 1
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## QueryInput
|
|
13
|
+
|
|
14
|
+
Demo:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
import React, { useRef } from 'react';
|
|
18
|
+
import { QueryInput } from '../../index';
|
|
19
|
+
|
|
20
|
+
export default () => {
|
|
21
|
+
let dataValidationRef: QueryInput = useRef();
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<QueryInput />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* @Description:
|
|
3
|
+
* @Author: rodchen
|
|
4
|
+
* @Date: 2021-12-01 10:52:08
|
|
5
|
+
* @LastEditTime: 2021-12-27 21:29:23
|
|
6
|
+
* @LastEditors: rodchen
|
|
7
|
+
*/
|
|
8
|
+
// @ts-nocheck
|
|
9
|
+
import React, { useState } from 'react';
|
|
10
|
+
import { Input, Button, Modal } from 'antd';
|
|
11
|
+
import 'antd/dist/antd.css';
|
|
12
|
+
import styles from './index.less';
|
|
13
|
+
|
|
14
|
+
const QueryInput = () => {
|
|
15
|
+
const [isModalVisible, setIsModalVisible] = useState(false);
|
|
16
|
+
const [value, setValue] = useState('');
|
|
17
|
+
|
|
18
|
+
const showModal = () => {
|
|
19
|
+
setIsModalVisible(true);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const handleOk = () => {
|
|
23
|
+
let formatValue = ToCDB(value)
|
|
24
|
+
.split(/[/\n/\s,;]/)
|
|
25
|
+
.filter((item) => item)
|
|
26
|
+
.join(',');
|
|
27
|
+
setValue(formatValue);
|
|
28
|
+
setIsModalVisible(false);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleCancel = () => {
|
|
32
|
+
setIsModalVisible(false);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const outerChange = (e) => {
|
|
36
|
+
debugger;
|
|
37
|
+
let formatValue = ToCDB(e.target.value)
|
|
38
|
+
.split(/[/\n/\s,;]/)
|
|
39
|
+
.filter((item) => item)
|
|
40
|
+
.join(',');
|
|
41
|
+
setValue(formatValue);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const onChange = (e) => {
|
|
45
|
+
setValue(e.target.value);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div className={styles.query_input}>
|
|
50
|
+
<Input.Group compact>
|
|
51
|
+
<Input
|
|
52
|
+
value={value}
|
|
53
|
+
onChange={outerChange}
|
|
54
|
+
style={{ width: 'calc(100% - 50px)' }}
|
|
55
|
+
placeholder="请输入(查询多个值请用 ; 或 , 分割)"
|
|
56
|
+
/>
|
|
57
|
+
<Button className={styles.button} onClick={showModal} type="primary">
|
|
58
|
+
...
|
|
59
|
+
</Button>
|
|
60
|
+
</Input.Group>
|
|
61
|
+
<Modal
|
|
62
|
+
width={600}
|
|
63
|
+
title="多值录入"
|
|
64
|
+
visible={isModalVisible}
|
|
65
|
+
onOk={handleOk}
|
|
66
|
+
onCancel={handleCancel}
|
|
67
|
+
footer={[
|
|
68
|
+
<Button key="back" onClick={handleCancel}>
|
|
69
|
+
取消
|
|
70
|
+
</Button>,
|
|
71
|
+
<Button key="submit" type="primary" onClick={handleOk}>
|
|
72
|
+
录入
|
|
73
|
+
</Button>,
|
|
74
|
+
]}
|
|
75
|
+
>
|
|
76
|
+
<div className={styles.query_input_wrapper}>
|
|
77
|
+
<div className={styles.query_input_wrapper_left}>录入区:</div>
|
|
78
|
+
<div className={styles.query_input_wrapper_right}>
|
|
79
|
+
<div>
|
|
80
|
+
如需同时使用多个值进行查询,请使用逗号、分号、空格或换行进行值的分隔,中英文格式的符号均支持
|
|
81
|
+
</div>
|
|
82
|
+
<div className={styles.query_input_textArea}>
|
|
83
|
+
<Input.TextArea
|
|
84
|
+
value={value}
|
|
85
|
+
onChange={onChange}
|
|
86
|
+
rows={6}
|
|
87
|
+
showCount
|
|
88
|
+
/>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
</Modal>
|
|
93
|
+
</div>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function ToCDB(str) {
|
|
98
|
+
var tmp = '';
|
|
99
|
+
for (var i = 0; i < str.length; i++) {
|
|
100
|
+
if (str.charCodeAt(i) > 65248 && str.charCodeAt(i) < 65375) {
|
|
101
|
+
tmp += String.fromCharCode(str.charCodeAt(i) - 65248);
|
|
102
|
+
} else {
|
|
103
|
+
tmp += String.fromCharCode(str.charCodeAt(i));
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return tmp;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export default QueryInput;
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @Description:
|
|
3
3
|
* @Author: rodchen
|
|
4
4
|
* @Date: 2021-11-30 22:59:39
|
|
5
|
-
* @LastEditTime: 2021-12-
|
|
5
|
+
* @LastEditTime: 2021-12-27 20:16:20
|
|
6
6
|
* @LastEditors: rodchen
|
|
7
7
|
*/
|
|
8
8
|
|
|
@@ -12,4 +12,5 @@ const resposne = JSON.parse(localStorage.getItem('userInfo') || '{}');
|
|
|
12
12
|
|
|
13
13
|
axios.defaults.headers.common['sso-sessionid'] = resposne?.sessionId || '';
|
|
14
14
|
|
|
15
|
-
export { default as DataValidation } from './DataValidation';
|
|
15
|
+
export { default as DataValidation } from './components/DataValidation';
|
|
16
|
+
export { default as QueryInput } from './components/QueryInput';
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
nav:
|
|
3
|
-
title: Components
|
|
4
|
-
path: /components
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## DataValidation
|
|
8
|
-
|
|
9
|
-
Demo:
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import React from 'react';
|
|
13
|
-
import { DataValidation } from '../index';
|
|
14
|
-
|
|
15
|
-
export default () => (
|
|
16
|
-
<div>
|
|
17
|
-
<DataValidation
|
|
18
|
-
columns={[
|
|
19
|
-
['商品编码', 'skuCode'],
|
|
20
|
-
['商品名称', 'skuName'],
|
|
21
|
-
['商品名称1', 'skuName'],
|
|
22
|
-
]}
|
|
23
|
-
validDataFunction={(data, resolve) => {
|
|
24
|
-
resolve([]);
|
|
25
|
-
}}
|
|
26
|
-
title="商品录入"
|
|
27
|
-
/>
|
|
28
|
-
</div>
|
|
29
|
-
);
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
More skills for writing demo: https://d.umijs.org/guide/demo-principle
|