zmdms-webui 1.2.1 → 1.2.3
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/es/table/utils.js
CHANGED
|
@@ -123,7 +123,7 @@ function copyColData(key, dataSource) {
|
|
|
123
123
|
try {
|
|
124
124
|
if ((navigator === null || navigator === void 0 ? void 0 : navigator.clipboard) && window.isSecureContext) {
|
|
125
125
|
(_b = (_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(str)) === null || _b === void 0 ? void 0 : _b.then(function () {
|
|
126
|
-
message.
|
|
126
|
+
message.success("复制成功!");
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
else {
|
|
@@ -132,7 +132,7 @@ function copyColData(key, dataSource) {
|
|
|
132
132
|
document.body.appendChild(textarea);
|
|
133
133
|
textarea.select();
|
|
134
134
|
if (document.execCommand) {
|
|
135
|
-
message.
|
|
135
|
+
message.success("复制成功!");
|
|
136
136
|
document.execCommand("copy");
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
@@ -7,15 +7,13 @@ import { ZtTransferContext } from './context.js';
|
|
|
7
7
|
|
|
8
8
|
var Container = function (props) {
|
|
9
9
|
var _a = props.mode, mode = _a === void 0 ? "multiple" : _a, value = props.value, completeValue = props.completeValue, onChange = props.onChange, onSearch = props.onSearch, parseCheckedItem = props.parseCheckedItem, parseSearchItem = props.parseSearchItem, children = props.children;
|
|
10
|
-
var
|
|
10
|
+
var _b = useContext(ZtTransferContext).fieldNames, key = _b.key, title = _b.title;
|
|
11
11
|
// 删除已选中
|
|
12
12
|
var onClearIndex = useCallback(function (index, item) {
|
|
13
|
-
var newValue = value.
|
|
14
|
-
var newCompleteValue = completeValue.
|
|
15
|
-
newValue.splice(index, 1);
|
|
16
|
-
newCompleteValue.splice(index, 1);
|
|
13
|
+
var newValue = value.filter(function (i) { return (item === null || item === void 0 ? void 0 : item[key]) !== i; });
|
|
14
|
+
var newCompleteValue = completeValue.filter(function (i) { return (item === null || item === void 0 ? void 0 : item[key]) !== (i === null || i === void 0 ? void 0 : i[key]); });
|
|
17
15
|
onChange && onChange(newValue, newCompleteValue);
|
|
18
|
-
}, [onChange, value, completeValue]);
|
|
16
|
+
}, [onChange, value, completeValue, key]);
|
|
19
17
|
//
|
|
20
18
|
var onSearchChange = useCallback(function (searchValue, searchCompleteValue, deleteValue) {
|
|
21
19
|
if (searchValue) {
|
|
@@ -35,9 +33,19 @@ var Container = function (props) {
|
|
|
35
33
|
onChange && onChange(newValue, newCompleteValue);
|
|
36
34
|
}
|
|
37
35
|
}, [mode, value, completeValue, onChange, key]);
|
|
38
|
-
|
|
36
|
+
// 已选过滤
|
|
37
|
+
var onCheckedFilter = useCallback(function (value) {
|
|
38
|
+
return ((completeValue === null || completeValue === void 0 ? void 0 : completeValue.filter(function (itemValue, index) {
|
|
39
|
+
var _a, _b;
|
|
40
|
+
var newItem = parseCheckedItem
|
|
41
|
+
? parseCheckedItem(itemValue, index)
|
|
42
|
+
: itemValue;
|
|
43
|
+
return ((_b = (_a = newItem === null || newItem === void 0 ? void 0 : newItem[title]) === null || _a === void 0 ? void 0 : _a.indexOf) === null || _b === void 0 ? void 0 : _b.call(_a, value)) !== -1;
|
|
44
|
+
})) || []);
|
|
45
|
+
}, [completeValue, parseCheckedItem, title]);
|
|
46
|
+
return (jsx("div", __assign({ className: "container" }, { children: mode === "multiple" ? (jsxs(Fragment, { children: [jsx(SelectContainer, __assign({ title: "\u53EF\u9009", onSearch: onSearch, parseSearchItem: parseSearchItem, value: value, onChange: onSearchChange, mode: mode }, { children: children ? (children({ value: value, completeValue: completeValue, onChange: onChange })) : (jsx("div", { children: "1" })) })), jsx(SelectContainer, __assign({ title: "\u5DF2\u9009", onSearch: onCheckedFilter, checkedLength: (value === null || value === void 0 ? void 0 : value.length) || 0, allowClear: true, onClear: function () {
|
|
39
47
|
onChange && onChange([], []);
|
|
40
|
-
} }, { children: jsx(CheckedResult, { dataList: completeValue, parseCheckedItem: parseCheckedItem, onClearIndex: onClearIndex }) }))] })) : (jsx(SelectContainer, __assign({ onSearch: onSearch, parseSearchItem: parseSearchItem, value: value, onChange: onSearchChange, mode: mode }, { children: children ? (children({ value: value, completeValue: completeValue, onChange: onChange })) : (jsx("div", { children: "1" })) }))) })));
|
|
48
|
+
}, isShow: true, parseCheckedItem: parseCheckedItem, onClearIndex: onClearIndex }, { children: jsx(CheckedResult, { dataList: completeValue, parseCheckedItem: parseCheckedItem, onClearIndex: onClearIndex }) }))] })) : (jsx(SelectContainer, __assign({ onSearch: onSearch, parseSearchItem: parseSearchItem, value: value, onChange: onSearchChange, mode: mode }, { children: children ? (children({ value: value, completeValue: completeValue, onChange: onChange })) : (jsx("div", { children: "1" })) }))) })));
|
|
41
49
|
};
|
|
42
50
|
var Container$1 = memo(Container);
|
|
43
51
|
|
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { memo, useState } from 'react';
|
|
3
|
+
import { memo, useState, useContext, useCallback } from 'react';
|
|
4
4
|
import SearchResult from './SearchResult.js';
|
|
5
|
+
import CheckedResult from './CheckedResult.js';
|
|
6
|
+
import { ZtTransferContext } from './context.js';
|
|
5
7
|
import ButtonCom from '../button/button.js';
|
|
6
8
|
import MemoInput from '../input/input.js';
|
|
7
9
|
import { Spin } from 'antd';
|
|
8
10
|
|
|
9
11
|
var SelectContainer = function (props) {
|
|
10
|
-
var title = props.title, checkedLength = props.checkedLength, allowClear = props.allowClear, onClear = props.onClear, onSearch = props.onSearch, contentPadding = props.contentPadding, children = props.children, value = props.value, onChange = props.onChange, mode = props.mode;
|
|
12
|
+
var title = props.title, checkedLength = props.checkedLength, allowClear = props.allowClear, onClear = props.onClear, onSearch = props.onSearch, contentPadding = props.contentPadding, children = props.children, value = props.value, onChange = props.onChange, mode = props.mode, isShow = props.isShow, parseCheckedItem = props.parseCheckedItem, onClearIndex = props.onClearIndex;
|
|
11
13
|
var _a = useState(), searchValue = _a[0], setSearchValue = _a[1];
|
|
12
14
|
var _b = useState(false), spinning = _b[0], setSpinning = _b[1];
|
|
13
15
|
var _c = useState(), searchResult = _c[0], setSearchResult = _c[1];
|
|
16
|
+
var key = useContext(ZtTransferContext).fieldNames.key;
|
|
17
|
+
var myOnClearIndex = useCallback(function (index, item) {
|
|
18
|
+
setSearchResult(function (searchResult) {
|
|
19
|
+
return searchResult.filter(function (sRItem) {
|
|
20
|
+
return (item === null || item === void 0 ? void 0 : item[key]) !== (sRItem === null || sRItem === void 0 ? void 0 : sRItem[key]);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
onClearIndex && onClearIndex(index, item);
|
|
24
|
+
}, [onClearIndex, key]);
|
|
14
25
|
return (jsx("div", __assign({ className: "zt-transfer--container" }, { children: jsxs(Spin, __assign({ spinning: spinning }, { children: [title && (jsxs("div", __assign({ className: "title" }, { children: [jsxs("span", { children: [title, checkedLength ? " (".concat(checkedLength, ")") : null] }), allowClear && (jsx(ButtonCom, __assign({ type: "link", onClick: onClear }, { children: "\u6E05\u7A7A" })))] }))), jsxs("div", __assign({ className: "wrap" }, { children: [jsx(MemoInput.Search, { className: "search", placeholder: "\u8BF7\u8F93\u5165\u5173\u952E\u5B57\u641C\u7D22", onSearch: function (v) { return __awaiter(void 0, void 0, void 0, function () {
|
|
15
26
|
var data;
|
|
16
27
|
return __generator(this, function (_a) {
|
|
@@ -40,7 +51,7 @@ var SelectContainer = function (props) {
|
|
|
40
51
|
case 5: return [2 /*return*/];
|
|
41
52
|
}
|
|
42
53
|
});
|
|
43
|
-
}); }, allowClear: true }), jsxs("div", __assign({ className: "content", style: { padding: contentPadding ? 10 : 0 } }, { children: [jsx("div", __assign({ style: { display: searchValue ? "none" : "block" } }, { children: children })), searchValue
|
|
54
|
+
}); }, allowClear: true }), jsxs("div", __assign({ className: "content", style: { padding: contentPadding ? 10 : 0 } }, { children: [jsx("div", __assign({ style: { display: searchValue ? "none" : "block" } }, { children: children })), searchValue ? (isShow ? (jsx(CheckedResult, { dataList: searchResult, parseCheckedItem: parseCheckedItem, onClearIndex: myOnClearIndex })) : (jsx(SearchResult, { value: value, onChange: onChange, dataList: searchResult, mode: mode }))) : null] }))] }))] })) })));
|
|
44
55
|
};
|
|
45
56
|
var SelectContainer$1 = memo(SelectContainer);
|
|
46
57
|
|