ztxkui 4.2.18-89 → 4.2.18-90
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/Demo.js
CHANGED
|
@@ -137,7 +137,7 @@ function Demo() {
|
|
|
137
137
|
React.createElement(EnhanceSelect, { style: selectStyle, placeholder: i18next.t('一次性加载数据'), url: "http://base-test.zmdms.com.cn:30079/api/zmdms-system/company/list", request: request, dataKey: "id", titleKey: "name", isClickRequest: true, isPaste: true, isCatch: true, mode: "multiple", value: value3, onChange: function (value, option, fullData) {
|
|
138
138
|
console.log(value);
|
|
139
139
|
setValue3(value);
|
|
140
|
-
} }),
|
|
140
|
+
}, open: false }),
|
|
141
141
|
React.createElement("p", null, i18next.t('异步获取数据')),
|
|
142
142
|
React.createElement("button", { onClick: function () {
|
|
143
143
|
setParams1(JSON.stringify({
|
|
@@ -139,6 +139,10 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
|
|
|
139
139
|
*/
|
|
140
140
|
isPaste?: boolean;
|
|
141
141
|
pasteRule?: string[];
|
|
142
|
+
/**
|
|
143
|
+
* 是否只要输入即加入列表
|
|
144
|
+
*/
|
|
145
|
+
isPasteAddItem?: boolean;
|
|
142
146
|
}
|
|
143
147
|
export declare function clearCatchData(url: string): void;
|
|
144
148
|
/**
|
|
@@ -156,6 +160,6 @@ export declare function clearCatchData(url: string): void;
|
|
|
156
160
|
* { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
|
|
157
161
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
158
162
|
*/
|
|
159
|
-
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, ...restProps }: IProps<VT>): JSX.Element;
|
|
163
|
+
declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, isPasteAddItem, ...restProps }: IProps<VT>): JSX.Element;
|
|
160
164
|
declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
|
|
161
165
|
export default _default;
|
|
@@ -165,7 +165,7 @@ function clearNullData(arr, dataKey, titleKey) {
|
|
|
165
165
|
* 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
|
|
166
166
|
*/
|
|
167
167
|
function EnhanceSelect(_a) {
|
|
168
|
-
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 60000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, isClickRequest = _a.isClickRequest, handleRef = _a.handleRef, isPaste = _a.isPaste, _k = _a.pasteRule, pasteRule = _k === void 0 ? [',', '-', '\r\n', '\r', '\n', ' '] : _k, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule"]);
|
|
168
|
+
var list = _a.list, defaultList = _a.defaultList, params = _a.params, url = _a.url, _b = _a.method, method = _b === void 0 ? 'GET' : _b, _c = _a.timeout, timeout = _c === void 0 ? 60000 : _c, _d = _a.dataKey, dataKey = _d === void 0 ? 'id' : _d, componentKey = _a.componentKey, _e = _a.titleKey, titleKey = _e === void 0 ? 'name' : _e, showAll = _a.showAll, isCatch = _a.isCatch, onCompleted = _a.onCompleted, onChange = _a.onChange, onSearch = _a.onSearch, request = _a.request, remoteSearch = _a.remoteSearch, remoteSearchKey = _a.remoteSearchKey, remoteSearchDataKey = _a.remoteSearchDataKey, _f = _a.isRemoteSearchDataKey, isRemoteSearchDataKey = _f === void 0 ? true : _f, transformData = _a.transformData, joinKey = _a.joinKey, _g = _a.joinStr, joinStr = _g === void 0 ? '-' : _g, lineFeedKey = _a.lineFeedKey, _h = _a.lineFeedStr, lineFeedStr = _h === void 0 ? '-' : _h, mustHasParams = _a.mustHasParams, disabledValues = _a.disabledValues, searchDeleteKeys = _a.searchDeleteKeys, isHandAddItem = _a.isHandAddItem, isPage = _a.isPage, _j = _a.currentSize, currentSize = _j === void 0 ? 30 : _j, isCopy = _a.isCopy, onBlur = _a.onBlur, onFocus = _a.onFocus, isClickRequest = _a.isClickRequest, handleRef = _a.handleRef, isPaste = _a.isPaste, _k = _a.pasteRule, pasteRule = _k === void 0 ? [',', '-', '\r\n', '\r', '\n', ' '] : _k, isPasteAddItem = _a.isPasteAddItem, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule", "isPasteAddItem"]);
|
|
169
169
|
// TODO: 注释动态设置open逻辑 start
|
|
170
170
|
// const currentClick = useRef<boolean>(true);
|
|
171
171
|
// TODO: 注释动态设置open逻辑 end
|
|
@@ -280,8 +280,9 @@ function EnhanceSelect(_a) {
|
|
|
280
280
|
function pasteHandle(value) {
|
|
281
281
|
if (isPaste && restProps.mode === 'multiple') {
|
|
282
282
|
var pasteRuleIndex = pasteRule.findIndex(function (item) { return value.indexOf(item) !== -1; });
|
|
283
|
-
if (pasteRuleIndex !== -1) {
|
|
284
|
-
var splitStr = pasteRule[pasteRuleIndex];
|
|
283
|
+
if (pasteRuleIndex !== -1 || pasteRule) {
|
|
284
|
+
var splitStr = pasteRuleIndex !== -1 ? pasteRule[pasteRuleIndex] : ' ';
|
|
285
|
+
debugger;
|
|
285
286
|
var resultValue = value.split(splitStr);
|
|
286
287
|
resultValue = Array.from(new Set(resultValue));
|
|
287
288
|
if (Array.isArray(restProps.value)) {
|
|
@@ -838,7 +839,7 @@ function EnhanceSelect(_a) {
|
|
|
838
839
|
var _b, _c;
|
|
839
840
|
if (isPaste && restProps.mode === 'multiple') {
|
|
840
841
|
var pasteRuleIndex = pasteRule.findIndex(function (item) { return input.indexOf(item) !== -1; });
|
|
841
|
-
if (pasteRuleIndex !== -1) {
|
|
842
|
+
if (pasteRuleIndex !== -1 || isPasteAddItem) {
|
|
842
843
|
return true;
|
|
843
844
|
}
|
|
844
845
|
}
|