ztxkui 10.0.93 → 10.0.94

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.
@@ -66,6 +66,12 @@ export interface IProps<T> extends Omit<SelectProps<T>, 'onChange'> {
66
66
  * 更新只能通过刷新页面来实现,或者查询条件发生改变
67
67
  */
68
68
  isCatch?: boolean;
69
+ /**
70
+ * 通过request做接口缓存的时候 isCatch 还会有一些条件过滤
71
+ * 比如page结尾的接口不会缓存 需要传入 mustCatch 才会必须缓存
72
+ * 因为不是所有的接口都是page结尾就不缓存的 所以这里默认使用缓存
73
+ */
74
+ mustCatch?: boolean;
69
75
  /**
70
76
  * 数据加载完毕触发
71
77
  */
@@ -170,6 +176,6 @@ export declare function clearCatchData(url: string): void;
170
176
  * { code: 200, data: { records: [] } } || { status: 200, data: { code: 200, data: { records: [] } } }
171
177
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
172
178
  */
173
- 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, transformRenderData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, dropdownRenderBtns, dropdownMatchSelectWidth, onContextMenuCapture, isPinyinSearch, ...restProps }: IProps<VT>): JSX.Element;
179
+ declare function EnhanceSelect<VT extends SelectValue = SelectValue>({ list, defaultList, params, url, method, timeout, dataKey, componentKey, titleKey, showAll, isCatch, mustCatch, onCompleted, onChange, onSearch, request, remoteSearch, remoteSearchKey, remoteSearchDataKey, isRemoteSearchDataKey, transformData, transformRenderData, joinKey, joinStr, lineFeedKey, lineFeedStr, mustHasParams, disabledValues, searchDeleteKeys, isHandAddItem, isPage, currentSize, isCopy, onBlur, onFocus, isClickRequest, handleRef, isPaste, pasteRule, dropdownRenderBtns, dropdownMatchSelectWidth, onContextMenuCapture, isPinyinSearch, ...restProps }: IProps<VT>): JSX.Element;
174
180
  declare const _default: React.MemoExoticComponent<typeof EnhanceSelect>;
175
181
  export default _default;
@@ -168,7 +168,7 @@ function clearNullData(arr, dataKey, titleKey) {
168
168
  * 如果数据不能在接口层面满足以上形式,那么组件提供transformData属性,转换接口数据格式
169
169
  */
170
170
  function EnhanceSelect(_a) {
171
- 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, transformRenderData = _a.transformRenderData, 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, dropdownRenderBtns = _a.dropdownRenderBtns, _l = _a.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _l === void 0 ? 150 : _l, onContextMenuCapture = _a.onContextMenuCapture, _m = _a.isPinyinSearch, isPinyinSearch = _m === void 0 ? true : _m, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "transformRenderData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule", "dropdownRenderBtns", "dropdownMatchSelectWidth", "onContextMenuCapture", "isPinyinSearch"]);
171
+ 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, mustCatch = _a.mustCatch, 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, transformRenderData = _a.transformRenderData, 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, dropdownRenderBtns = _a.dropdownRenderBtns, _l = _a.dropdownMatchSelectWidth, dropdownMatchSelectWidth = _l === void 0 ? 150 : _l, onContextMenuCapture = _a.onContextMenuCapture, _m = _a.isPinyinSearch, isPinyinSearch = _m === void 0 ? true : _m, restProps = __rest(_a, ["list", "defaultList", "params", "url", "method", "timeout", "dataKey", "componentKey", "titleKey", "showAll", "isCatch", "mustCatch", "onCompleted", "onChange", "onSearch", "request", "remoteSearch", "remoteSearchKey", "remoteSearchDataKey", "isRemoteSearchDataKey", "transformData", "transformRenderData", "joinKey", "joinStr", "lineFeedKey", "lineFeedStr", "mustHasParams", "disabledValues", "searchDeleteKeys", "isHandAddItem", "isPage", "currentSize", "isCopy", "onBlur", "onFocus", "isClickRequest", "handleRef", "isPaste", "pasteRule", "dropdownRenderBtns", "dropdownMatchSelectWidth", "onContextMenuCapture", "isPinyinSearch"]);
172
172
  // TODO: 注释动态设置open逻辑 start
173
173
  // const currentClick = useRef<boolean>(true);
174
174
  // TODO: 注释动态设置open逻辑 end
@@ -250,7 +250,7 @@ function EnhanceSelect(_a) {
250
250
  // 利用闭包,存到当前请求的id
251
251
  fetchId.current++;
252
252
  var fetchIdClosure = fetchId.current;
253
- getData(request, options)
253
+ getData(request, __assign(__assign({}, options), { mustCatch: mustCatch }))
254
254
  .then(function (resData) {
255
255
  var _a, _b;
256
256
  (_a = otherObj === null || otherObj === void 0 ? void 0 : otherObj.successCallback) === null || _a === void 0 ? void 0 : _a.call(otherObj);
@@ -291,7 +291,7 @@ function EnhanceSelect(_a) {
291
291
  },
292
292
  // 去掉 transformData 作为依赖,这个会触发副作用
293
293
  // eslint-disable-next-line react-hooks/exhaustive-deps
294
- [setSelectList, setLoading, mustHasParams]);
294
+ [setSelectList, setLoading, mustHasParams, mustCatch]);
295
295
  // 分词粘贴
296
296
  function pasteHandle(value) {
297
297
  if (isPaste && restProps.mode === 'multiple') {
@@ -361,7 +361,8 @@ function EnhanceSelect(_a) {
361
361
  searchParams[searchDataKey] = dataKeyValue + '';
362
362
  }
363
363
  getData(request, __assign({ url: url,
364
- method: method, params: __assign(__assign({ size: Array.isArray(dataKeyValue) && dataKeyValue.length > currentSize
364
+ method: method,
365
+ mustCatch: mustCatch, params: __assign(__assign({ size: Array.isArray(dataKeyValue) && dataKeyValue.length > currentSize
365
366
  ? dataKeyValue.length
366
367
  : currentSize, current: (otherObj === null || otherObj === void 0 ? void 0 : otherObj.currentPage) ? otherObj === null || otherObj === void 0 ? void 0 : otherObj.currentPage : 1 }, outParams), searchParams) }, ((otherObj === null || otherObj === void 0 ? void 0 : otherObj.options) || {})))
367
368
  .then(function (resData) {
@@ -427,6 +428,7 @@ function EnhanceSelect(_a) {
427
428
  setMultipleList,
428
429
  searchDeleteKeys,
429
430
  currentSize,
431
+ mustCatch,
430
432
  ]);
431
433
  var searchHandle = function (value) {
432
434
  var _a;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztxkui",
3
- "version": "10.0.93",
3
+ "version": "10.0.94",
4
4
  "private": false,
5
5
  "description": "React components library",
6
6
  "author": "zt-front-end",