@sheinx/hooks 3.7.0-beta.8 → 3.7.0-fix.1
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/cjs/common/use-component-memo/index.d.ts +1 -1
- package/cjs/common/use-component-memo/index.d.ts.map +1 -1
- package/cjs/common/use-component-memo/index.js +2 -9
- package/cjs/common/use-component-memo/use-memo.d.ts +1 -1
- package/cjs/common/use-component-memo/use-memo.d.ts.map +1 -1
- package/cjs/common/use-component-memo/use-memo.js +2 -2
- package/cjs/common/use-filter/index.d.ts +1 -0
- package/cjs/common/use-filter/index.d.ts.map +1 -1
- package/cjs/common/use-filter/index.js +7 -0
- package/cjs/common/use-filter/use-filter-context.d.ts +7 -0
- package/cjs/common/use-filter/use-filter-context.d.ts.map +1 -0
- package/cjs/common/use-filter/use-filter-context.js +10 -0
- package/cjs/common/use-filter/use-filter.d.ts +1 -0
- package/cjs/common/use-filter/use-filter.d.ts.map +1 -1
- package/cjs/common/use-filter/use-filter.js +2 -0
- package/cjs/common/use-input-able/use-Input-able.d.ts.map +1 -1
- package/cjs/common/use-input-able/use-Input-able.js +6 -7
- package/cjs/common/use-position-style/check-element-size.d.ts +10 -0
- package/cjs/common/use-position-style/check-element-size.d.ts.map +1 -0
- package/cjs/common/use-position-style/check-element-size.js +65 -0
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +5 -1
- package/cjs/components/use-datepicker/index.d.ts +1 -1
- package/cjs/components/use-datepicker/index.d.ts.map +1 -1
- package/cjs/components/use-datepicker/index.js +23 -2
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts +17 -0
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +15 -3
- package/cjs/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-control/use-form-control.js +9 -4
- package/cjs/components/use-form/use-form.d.ts +4 -4
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +31 -25
- package/cjs/components/use-form/use-form.type.d.ts +8 -0
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-image/use-image.d.ts +2 -0
- package/cjs/components/use-image/use-image.d.ts.map +1 -1
- package/cjs/components/use-image/use-image.js +40 -2
- package/cjs/components/use-popup/popup-context.d.ts +2 -0
- package/cjs/components/use-popup/popup-context.d.ts.map +1 -1
- package/cjs/components/use-popup/popup-context.js +2 -0
- package/cjs/components/use-popup/use-popup.d.ts +4 -0
- package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
- package/cjs/components/use-popup/use-popup.js +33 -13
- package/cjs/components/use-table/index.d.ts +1 -1
- package/cjs/components/use-table/index.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-filter.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-filter.js +2 -1
- package/cjs/components/use-table/use-table-group.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-group.js +3 -1
- package/cjs/components/use-table/use-table-layout.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-layout.js +0 -1
- package/cjs/components/use-table/use-table-virtual.js +1 -1
- package/cjs/components/use-table/use-table.type.d.ts +13 -21
- package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +25 -7
- package/cjs/components/use-tree/use-tree.type.d.ts +1 -0
- package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/cjs/components/use-upload/use-upload.d.ts.map +1 -1
- package/cjs/components/use-upload/use-upload.js +54 -34
- package/cjs/components/use-upload/use-upload.type.d.ts +7 -0
- package/cjs/components/use-upload/use-upload.type.d.ts.map +1 -1
- package/cjs/utils/clean-props.d.ts +11 -0
- package/cjs/utils/clean-props.d.ts.map +1 -0
- package/cjs/utils/clean-props.js +21 -0
- package/cjs/utils/highlight.d.ts +7 -0
- package/cjs/utils/highlight.d.ts.map +1 -0
- package/cjs/utils/highlight.js +67 -0
- package/cjs/utils/index.d.ts +2 -0
- package/cjs/utils/index.d.ts.map +1 -1
- package/cjs/utils/index.js +24 -0
- package/cjs/utils/string.d.ts +1 -0
- package/cjs/utils/string.d.ts.map +1 -1
- package/cjs/utils/string.js +13 -0
- package/esm/common/use-component-memo/index.d.ts +1 -1
- package/esm/common/use-component-memo/index.d.ts.map +1 -1
- package/esm/common/use-component-memo/index.js +1 -1
- package/esm/common/use-component-memo/use-memo.d.ts +1 -1
- package/esm/common/use-component-memo/use-memo.d.ts.map +1 -1
- package/esm/common/use-component-memo/use-memo.js +1 -1
- package/esm/common/use-filter/index.d.ts +1 -0
- package/esm/common/use-filter/index.d.ts.map +1 -1
- package/esm/common/use-filter/index.js +2 -1
- package/esm/common/use-filter/use-filter-context.d.ts +7 -0
- package/esm/common/use-filter/use-filter-context.d.ts.map +1 -0
- package/esm/common/use-filter/use-filter-context.js +3 -0
- package/esm/common/use-filter/use-filter.d.ts +1 -0
- package/esm/common/use-filter/use-filter.d.ts.map +1 -1
- package/esm/common/use-filter/use-filter.js +2 -0
- package/esm/common/use-input-able/use-Input-able.d.ts.map +1 -1
- package/esm/common/use-input-able/use-Input-able.js +7 -8
- package/esm/common/use-position-style/check-element-size.d.ts +10 -0
- package/esm/common/use-position-style/check-element-size.d.ts.map +1 -0
- package/esm/common/use-position-style/check-element-size.js +59 -0
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +5 -1
- package/esm/components/use-datepicker/index.d.ts +1 -1
- package/esm/components/use-datepicker/index.d.ts.map +1 -1
- package/esm/components/use-datepicker/index.js +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.d.ts +17 -0
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +14 -2
- package/esm/components/use-form/use-form-control/use-form-control.d.ts.map +1 -1
- package/esm/components/use-form/use-form-control/use-form-control.js +9 -4
- package/esm/components/use-form/use-form.d.ts +4 -4
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +31 -25
- package/esm/components/use-form/use-form.type.d.ts +8 -0
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-image/use-image.d.ts +2 -0
- package/esm/components/use-image/use-image.d.ts.map +1 -1
- package/esm/components/use-image/use-image.js +40 -2
- package/esm/components/use-popup/popup-context.d.ts +2 -0
- package/esm/components/use-popup/popup-context.d.ts.map +1 -1
- package/esm/components/use-popup/popup-context.js +2 -0
- package/esm/components/use-popup/use-popup.d.ts +4 -0
- package/esm/components/use-popup/use-popup.d.ts.map +1 -1
- package/esm/components/use-popup/use-popup.js +34 -14
- package/esm/components/use-table/index.d.ts +1 -1
- package/esm/components/use-table/index.d.ts.map +1 -1
- package/esm/components/use-table/use-table-filter.d.ts.map +1 -1
- package/esm/components/use-table/use-table-filter.js +2 -1
- package/esm/components/use-table/use-table-group.d.ts.map +1 -1
- package/esm/components/use-table/use-table-group.js +3 -1
- package/esm/components/use-table/use-table-layout.d.ts.map +1 -1
- package/esm/components/use-table/use-table-layout.js +0 -1
- package/esm/components/use-table/use-table-virtual.js +1 -1
- package/esm/components/use-table/use-table.type.d.ts +13 -21
- package/esm/components/use-table/use-table.type.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +26 -8
- package/esm/components/use-tree/use-tree.type.d.ts +1 -0
- package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/esm/components/use-upload/use-upload.d.ts.map +1 -1
- package/esm/components/use-upload/use-upload.js +54 -34
- package/esm/components/use-upload/use-upload.type.d.ts +7 -0
- package/esm/components/use-upload/use-upload.type.d.ts.map +1 -1
- package/esm/utils/clean-props.d.ts +11 -0
- package/esm/utils/clean-props.d.ts.map +1 -0
- package/esm/utils/clean-props.js +15 -0
- package/esm/utils/highlight.d.ts +7 -0
- package/esm/utils/highlight.d.ts.map +1 -0
- package/esm/utils/highlight.js +59 -0
- package/esm/utils/index.d.ts +2 -0
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +3 -1
- package/esm/utils/string.d.ts +1 -0
- package/esm/utils/string.d.ts.map +1 -1
- package/esm/utils/string.js +12 -0
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import { useContext,
|
|
7
|
+
import { useContext, useLayoutEffect, useEffect, useRef, useState, useMemo } from 'react';
|
|
8
8
|
import useClickAway from "../../common/use-click-away";
|
|
9
9
|
import { getPosition } from "../../utils/position";
|
|
10
10
|
import usePersistFn from "../../common/use-persist-fn";
|
|
@@ -27,21 +27,32 @@ var usePopup = function usePopup(props) {
|
|
|
27
27
|
setOpenState = _useState2[1];
|
|
28
28
|
var _useContext = useContext(popupContext),
|
|
29
29
|
bindChild = _useContext.bindChild,
|
|
30
|
-
removeChild = _useContext.removeChild
|
|
30
|
+
removeChild = _useContext.removeChild,
|
|
31
|
+
addParent = _useContext.addParent,
|
|
32
|
+
removeParent = _useContext.removeParent;
|
|
31
33
|
var targetRef = useRef(null);
|
|
32
34
|
var popupRef = useRef(null);
|
|
33
|
-
useEffect(function () {
|
|
34
|
-
bindChild(popupRef);
|
|
35
|
-
return function () {
|
|
36
|
-
removeChild(popupRef);
|
|
37
|
-
};
|
|
38
|
-
}, []);
|
|
39
35
|
var _useRef = useRef({
|
|
40
36
|
triggerTimer: null,
|
|
41
37
|
// 记录所有的子popup 点击子 popup 不关闭弹窗
|
|
42
38
|
chain: [targetRef, popupRef]
|
|
43
39
|
}),
|
|
44
40
|
context = _useRef.current;
|
|
41
|
+
var handleAddParent = function handleAddParent(elRef) {
|
|
42
|
+
context.chain.push(elRef);
|
|
43
|
+
|
|
44
|
+
// 继续向上添加当前的 popupRef 到父级
|
|
45
|
+
addParent(elRef);
|
|
46
|
+
};
|
|
47
|
+
var handleRemoveParent = function handleRemoveParent(elRef) {
|
|
48
|
+
var index = context.chain.findIndex(function (item) {
|
|
49
|
+
return item === elRef;
|
|
50
|
+
});
|
|
51
|
+
if (index > -1) {
|
|
52
|
+
context.chain.splice(index, 1);
|
|
53
|
+
removeParent(elRef);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
45
56
|
var open = openState;
|
|
46
57
|
var changeOpen = function changeOpen(openIn, delay) {
|
|
47
58
|
if (context.triggerTimer) clearTimeout(context.triggerTimer);
|
|
@@ -71,11 +82,6 @@ var usePopup = function usePopup(props) {
|
|
|
71
82
|
updatePosition();
|
|
72
83
|
}
|
|
73
84
|
setOpenState(!!props.open);
|
|
74
|
-
|
|
75
|
-
// 外部传了open时,需要正常的触发onCollapse;触发了onCollapse才能让组件内部的edit状态正确,否则可能会出现弹出层打开了但是用户却无法选择的情况
|
|
76
|
-
if (props.open !== undefined) {
|
|
77
|
-
changeOpen(!!props.open);
|
|
78
|
-
}
|
|
79
85
|
}, [props.open]);
|
|
80
86
|
|
|
81
87
|
// const getPopUpHeight = () => {
|
|
@@ -180,8 +186,13 @@ var usePopup = function usePopup(props) {
|
|
|
180
186
|
});
|
|
181
187
|
var providerValue = useMemo(function () {
|
|
182
188
|
return {
|
|
189
|
+
addParent: handleAddParent,
|
|
190
|
+
removeParent: handleRemoveParent,
|
|
183
191
|
bindChild: function bindChild(elRef) {
|
|
184
|
-
|
|
192
|
+
if (elRef.current) {
|
|
193
|
+
addParent(elRef);
|
|
194
|
+
context.chain.push(elRef);
|
|
195
|
+
}
|
|
185
196
|
},
|
|
186
197
|
removeChild: function removeChild(elRef) {
|
|
187
198
|
var index = context.chain.findIndex(function (item) {
|
|
@@ -189,10 +200,19 @@ var usePopup = function usePopup(props) {
|
|
|
189
200
|
});
|
|
190
201
|
if (index > -1) {
|
|
191
202
|
context.chain.splice(index, 1);
|
|
203
|
+
removeParent(elRef);
|
|
192
204
|
}
|
|
193
205
|
}
|
|
194
206
|
};
|
|
195
207
|
}, []);
|
|
208
|
+
useLayoutEffect(function () {
|
|
209
|
+
if (open) {
|
|
210
|
+
bindChild(popupRef);
|
|
211
|
+
}
|
|
212
|
+
return function () {
|
|
213
|
+
removeChild(popupRef);
|
|
214
|
+
};
|
|
215
|
+
}, [open]);
|
|
196
216
|
return {
|
|
197
217
|
open: open,
|
|
198
218
|
position: position,
|
|
@@ -7,5 +7,5 @@ export { default as useTableRow } from './use-table-row';
|
|
|
7
7
|
export { default as useTableExpand } from './use-table-expand';
|
|
8
8
|
export { default as useTableTree } from './use-table-tree';
|
|
9
9
|
export { default as useTableVirtual } from './use-table-virtual';
|
|
10
|
-
export type { TableFormatColumn, TableColumnItem, TableHeadColumn, TableGroupColumn, TableSorterInfo, BaseTableProps, TableColumnFilter, TableFilterData,
|
|
10
|
+
export type { TableFormatColumn, TableColumnItem, TableHeadColumn, TableGroupColumn, TableSorterInfo, BaseTableProps, TableColumnFilter, TableFilterData, } from './use-table.type';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EA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MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEjE,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-table-filter.d.ts","sourceRoot":"","sources":["use-table-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;CACnC;AACD,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;CAC5C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,QAAA,MAAM,cAAc;;;;
|
|
1
|
+
{"version":3,"file":"use-table-filter.d.ts","sourceRoot":"","sources":["use-table-filter.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,WAAW,mBAAmB,CAAC,IAAI,GAAG,GAAG,CAC7C,SAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,cAAc,GAAG,QAAQ,GAAG,MAAM,CAAC;IACtE,OAAO,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;CACnC;AACD,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,KAAK,CAAC,EAAE,GAAG,CAAA;IACX,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK,OAAO,CAAC;CAC5C;AAED,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;AAE5D,QAAA,MAAM,cAAc;;;;gCA8BH,YAAY,SAAS,GAAG;CAyDxC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -26,7 +26,8 @@ var useTableFilter = function useTableFilter(props) {
|
|
|
26
26
|
}, [filterInfo]);
|
|
27
27
|
var filteredData = useMemo(function () {
|
|
28
28
|
var _props$data;
|
|
29
|
-
|
|
29
|
+
// why use slice: props.data引用不改变会导致后续的useMemo无法重新计算
|
|
30
|
+
if (activeFilters.length === 0) return (props.data || []).slice();
|
|
30
31
|
return (_props$data = props.data) === null || _props$data === void 0 ? void 0 : _props$data.filter(function (item) {
|
|
31
32
|
return activeFilters.every(function (key) {
|
|
32
33
|
var filter = filterInfo.get(key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-table-group.d.ts","sourceRoot":"","sources":["use-table-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,QAAA,MAAM,aAAa,UAAW,kBAAkB;;;
|
|
1
|
+
{"version":3,"file":"use-table-group.d.ts","sourceRoot":"","sources":["use-table-group.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxF,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AACD,QAAA,MAAM,aAAa,UAAW,kBAAkB;;;CAwE/C,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -27,6 +27,7 @@ var useTableGroup = function useTableGroup(props) {
|
|
|
27
27
|
last.colSpan += colSpan;
|
|
28
28
|
if (col.fixed) last.fixed = col.fixed;
|
|
29
29
|
if (col.lastFixed) last.lastFixed = true;
|
|
30
|
+
if (col.groupProps) last.groupProps = col.groupProps;
|
|
30
31
|
} else {
|
|
31
32
|
var sub = [];
|
|
32
33
|
colSpan = setColumns(sub, col, level + 1, index);
|
|
@@ -39,7 +40,8 @@ var useTableGroup = function useTableGroup(props) {
|
|
|
39
40
|
fixed: col.fixed,
|
|
40
41
|
firstFixed: col.firstFixed,
|
|
41
42
|
index: index,
|
|
42
|
-
columns: sub
|
|
43
|
+
columns: sub,
|
|
44
|
+
groupProps: col.groupProps
|
|
43
45
|
};
|
|
44
46
|
columns.push(groupCol);
|
|
45
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA0CrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-table-layout.d.ts","sourceRoot":"","sources":["use-table-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAKlE,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AA0CrE,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,cAAc,CAAC,GAAG,CAAC,EACnB,MAAM,GAAG,kBAAkB,GAAG,iBAAiB,GAAG,gBAAgB,GAAG,OAAO,CAC7E;IACD,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAAE,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACvC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IACxC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED,QAAA,MAAM,cAAc,UAAW,mBAAmB;;;;;;;;;;;yBA+CX,MAAM,UAAU,MAAM;;;;;;;CA8O5D,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -387,7 +387,6 @@ var useTableLayout = function useTableLayout(props) {
|
|
|
387
387
|
width: tableWidth,
|
|
388
388
|
shouldLastColAuto: props.columnResizable && !adjust,
|
|
389
389
|
scrollWidth: scrollWidth,
|
|
390
|
-
// maxScrollLeft: scrollWidth - context.clientWidth,
|
|
391
390
|
resizeFlag: resizeFlag
|
|
392
391
|
};
|
|
393
392
|
};
|
|
@@ -358,7 +358,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
358
358
|
var renderData = useMemo(function () {
|
|
359
359
|
if (props.disabled) return props.data;
|
|
360
360
|
return _toConsumableArray(props.data).slice(startIndex, startIndex + finalRowsInView);
|
|
361
|
-
}, [props.data, startIndex, finalRowsInView]);
|
|
361
|
+
}, [props.data, props.disabled, startIndex, finalRowsInView]);
|
|
362
362
|
var translateStyle = useMemo(function () {
|
|
363
363
|
var t = innerTop + offsetY;
|
|
364
364
|
if (t < 0) {
|
|
@@ -116,12 +116,6 @@ export interface BaseTableProps<Item> {
|
|
|
116
116
|
* When it is a string,ues the value of the string.For example, 'id' is the same thing as (d) => d.id .
|
|
117
117
|
*/
|
|
118
118
|
keygen: StructKeygenType<Item>;
|
|
119
|
-
/**
|
|
120
|
-
* @en The function to determine whether a cell needs to be updated. The return value should be a boolean indicating whether the cell should re-render.
|
|
121
|
-
* @cn 控制单元格是否需要更新的函数。返回值应为布尔值,指示单元格是否需要重新渲染
|
|
122
|
-
* @version 3.7.0
|
|
123
|
-
*/
|
|
124
|
-
shouldCellUpdate?: shouldCellUpdate<Item>;
|
|
125
119
|
}
|
|
126
120
|
export interface TableSorterInfo {
|
|
127
121
|
order: TableColumnOrder;
|
|
@@ -203,11 +197,6 @@ export interface SelectModeColumnFilter<DataItem> extends TableColumnFilterBase<
|
|
|
203
197
|
* @en Whether to open the top search box
|
|
204
198
|
*/
|
|
205
199
|
search?: boolean;
|
|
206
|
-
/**
|
|
207
|
-
* @cn 是否高亮命中的关键词,仅当 search 为 true 时有效
|
|
208
|
-
* @en Whether to highlight the hit keywords
|
|
209
|
-
*/
|
|
210
|
-
highlight?: boolean;
|
|
211
200
|
};
|
|
212
201
|
/**
|
|
213
202
|
* @cn 筛选数据的函数
|
|
@@ -263,6 +252,15 @@ export interface TableColumnItem<DataItem> {
|
|
|
263
252
|
* @cn 表头分组,相邻的相同 group 会生成一个新的表头
|
|
264
253
|
*/
|
|
265
254
|
group?: string | React.ReactNode | Array<string | React.ReactNode>;
|
|
255
|
+
/**
|
|
256
|
+
* @en The group of header column, the extra props
|
|
257
|
+
* @cn 表头分组的额外属性
|
|
258
|
+
* @version 3.7.0
|
|
259
|
+
*/
|
|
260
|
+
groupProps?: {
|
|
261
|
+
className?: string;
|
|
262
|
+
style?: React.CSSProperties;
|
|
263
|
+
};
|
|
266
264
|
/**
|
|
267
265
|
* @en hide the column, only work on row-expand column
|
|
268
266
|
* @cn 只针对行展开列有效,表示是否隐藏该列
|
|
@@ -379,17 +377,7 @@ export interface TableColumnItem<DataItem> {
|
|
|
379
377
|
* @en Separately set a column not to be draggable
|
|
380
378
|
*/
|
|
381
379
|
columnResizable?: false;
|
|
382
|
-
/**
|
|
383
|
-
* @cn 是否需要更新单元格,dependencies是外部更新依赖项
|
|
384
|
-
* @en Whether the cell needs to be updated, the third parameter is the external dependency
|
|
385
|
-
* @version 3.7.0
|
|
386
|
-
*/
|
|
387
|
-
shouldCellUpdate?: shouldCellUpdate<DataItem>;
|
|
388
380
|
}
|
|
389
|
-
export type shouldCellUpdate<T> = ((prev: T, next: T) => boolean) | {
|
|
390
|
-
update: (prev: T, next: T) => boolean;
|
|
391
|
-
dependencies: any[];
|
|
392
|
-
};
|
|
393
381
|
export interface TableFormatColumn<DataItem> extends TableColumnItem<DataItem> {
|
|
394
382
|
index: number;
|
|
395
383
|
key: string | number;
|
|
@@ -406,6 +394,10 @@ export interface TableGroupColumn {
|
|
|
406
394
|
columns: TableHeadColumn[];
|
|
407
395
|
lastFixed?: boolean;
|
|
408
396
|
index: number;
|
|
397
|
+
groupProps?: {
|
|
398
|
+
className?: string;
|
|
399
|
+
style?: React.CSSProperties;
|
|
400
|
+
};
|
|
409
401
|
}
|
|
410
402
|
export type TableHeadColumn = TableGroupColumn | TableFormatColumn<any>;
|
|
411
403
|
//# sourceMappingURL=use-table.type.d.ts.map
|
|
@@ -1 +1 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H;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;
|
|
1
|
+
{"version":3,"file":"use-tree.d.ts","sourceRoot":"","sources":["use-tree.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,aAAa,EAKb,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiBjD,eAAO,MAAM,IAAI;IACf;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEJ,CAAC;AAEF,QAAA,MAAM,OAAO;;;;;CA4sBZ,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -20,7 +20,7 @@ import { useInputAble } from "../../common/use-input-able";
|
|
|
20
20
|
import { getExpandVirtualData } from "../use-table/use-table-tree";
|
|
21
21
|
import { usePersistFn } from "../../common/use-persist-fn";
|
|
22
22
|
import { isFunc, isString, isNumber, isArray, isUnMatchedData, isOptionalDisabled } from "../../utils/is";
|
|
23
|
-
import { devUseWarning, produce } from "../../utils";
|
|
23
|
+
import { devUseWarning, produce, shallowEqual } from "../../utils";
|
|
24
24
|
function toArray(value) {
|
|
25
25
|
if (!value) return [];
|
|
26
26
|
if (!Array.isArray(value)) return [value];
|
|
@@ -125,9 +125,10 @@ var useTree = function useTree(props) {
|
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
127
|
if (virtual) {
|
|
128
|
+
var _context$dataFlatStat;
|
|
128
129
|
return {
|
|
129
130
|
active: isActive,
|
|
130
|
-
expanded: context.dataFlatStatusMap.get(id).expanded
|
|
131
|
+
expanded: !!((_context$dataFlatStat = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat !== void 0 && _context$dataFlatStat.expanded)
|
|
131
132
|
};
|
|
132
133
|
}
|
|
133
134
|
return {
|
|
@@ -138,11 +139,12 @@ var useTree = function useTree(props) {
|
|
|
138
139
|
|
|
139
140
|
// 注册节点
|
|
140
141
|
var bindVirtualNode = function bindVirtualNode(id, update) {
|
|
142
|
+
var _context$dataFlatStat2;
|
|
141
143
|
context.updateMap.set(id, update);
|
|
142
144
|
var isActive = activeProp === id;
|
|
143
145
|
return {
|
|
144
146
|
active: isActive,
|
|
145
|
-
expanded: context.dataFlatStatusMap.get(id).expanded
|
|
147
|
+
expanded: !!((_context$dataFlatStat2 = context.dataFlatStatusMap.get(id)) !== null && _context$dataFlatStat2 !== void 0 && _context$dataFlatStat2.expanded)
|
|
146
148
|
};
|
|
147
149
|
};
|
|
148
150
|
var get = function get(id) {
|
|
@@ -514,7 +516,7 @@ var useTree = function useTree(props) {
|
|
|
514
516
|
var appendChildrenExpanded = function appendChildrenExpanded(child, level, pid, insertData) {
|
|
515
517
|
if (!child) return;
|
|
516
518
|
child.forEach(function (item, i) {
|
|
517
|
-
var _context$
|
|
519
|
+
var _context$dataFlatStat3;
|
|
518
520
|
var childId = getKey(item, pid, i);
|
|
519
521
|
var node = {
|
|
520
522
|
id: childId,
|
|
@@ -523,7 +525,7 @@ var useTree = function useTree(props) {
|
|
|
523
525
|
pid: pid
|
|
524
526
|
};
|
|
525
527
|
insertData.push(node);
|
|
526
|
-
if ((_context$
|
|
528
|
+
if ((_context$dataFlatStat3 = context.dataFlatStatusMap.get(childId)) !== null && _context$dataFlatStat3 !== void 0 && _context$dataFlatStat3.expanded && item[childrenKey]) {
|
|
527
529
|
appendChildrenExpanded(item[childrenKey], level + 1, childId, insertData);
|
|
528
530
|
}
|
|
529
531
|
});
|
|
@@ -606,6 +608,16 @@ var useTree = function useTree(props) {
|
|
|
606
608
|
var getFlatData = function getFlatData() {
|
|
607
609
|
return context.dataFlat;
|
|
608
610
|
};
|
|
611
|
+
var updateExpanded = usePersistFn(function (expanded) {
|
|
612
|
+
var tempExpandMap = new Set(expanded);
|
|
613
|
+
if (!expanded) return;
|
|
614
|
+
if (virtual) {
|
|
615
|
+
expandedFlat(expanded);
|
|
616
|
+
}
|
|
617
|
+
context.updateMap.forEach(function (update, id) {
|
|
618
|
+
update('expanded', tempExpandMap.has(id));
|
|
619
|
+
});
|
|
620
|
+
});
|
|
609
621
|
useEffect(function () {
|
|
610
622
|
if (defaultExpandAll) {
|
|
611
623
|
var nextExpanded = [];
|
|
@@ -621,8 +633,13 @@ var useTree = function useTree(props) {
|
|
|
621
633
|
if (props.datum) return;
|
|
622
634
|
if (!dataUpdate) return;
|
|
623
635
|
setData(data);
|
|
636
|
+
var nextExpanded = props.expanded || props.defaultExpanded || [];
|
|
637
|
+
if (!shallowEqual(nextExpanded, expanded)) {
|
|
638
|
+
onExpand(nextExpanded);
|
|
639
|
+
updateExpanded(nextExpanded);
|
|
640
|
+
}
|
|
624
641
|
updateInnerCheckStatus();
|
|
625
|
-
}, [data]);
|
|
642
|
+
}, [props.data]);
|
|
626
643
|
useEffect(function () {
|
|
627
644
|
if (props.datum) return;
|
|
628
645
|
setValue(value);
|
|
@@ -647,16 +664,17 @@ var useTree = function useTree(props) {
|
|
|
647
664
|
getChecked: getChecked,
|
|
648
665
|
getKey: getKey,
|
|
649
666
|
getFlatData: getFlatData,
|
|
667
|
+
getDataById: getDataById,
|
|
650
668
|
getDataByValues: getDataByValues,
|
|
651
669
|
setValue: setValue,
|
|
652
670
|
setData: setData,
|
|
653
671
|
isDisabled: isDisabled,
|
|
672
|
+
isUnMatched: isUnMatched,
|
|
654
673
|
bindNode: bindNode,
|
|
655
674
|
bindVirtualNode: bindVirtualNode,
|
|
656
|
-
getDataById: getDataById,
|
|
657
675
|
bindUpdate: bindUpdate,
|
|
658
676
|
unBindUpdate: unBindUpdate,
|
|
659
|
-
|
|
677
|
+
updateExpanded: updateExpanded,
|
|
660
678
|
childrenKey: childrenKey,
|
|
661
679
|
data: data,
|
|
662
680
|
dataFlat: dataFlat,
|
|
@@ -169,5 +169,6 @@ export interface TreeDatum<DataItem> {
|
|
|
169
169
|
dataMap: Map<KeygenResult, DataItem>;
|
|
170
170
|
valueMap: Map<KeygenResult, CheckedStatusType>;
|
|
171
171
|
dataFlatStatusMap: Map<KeygenResult, FlatMapType>;
|
|
172
|
+
updateExpanded: (expanded?: KeygenResult[]) => void;
|
|
172
173
|
}
|
|
173
174
|
//# sourceMappingURL=use-tree.type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-tree.type.d.ts","sourceRoot":"","sources":["use-tree.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEpF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE1C,MAAM,MAAM,YAAY,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAE7C,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjE,MAAM,MAAM,YAAY,CAAC,QAAQ,IAAI;IACnC,EAAE,EAAE,YAAY,CAAC;IACjB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,WAAW,WAAW,CAAC,QAAQ;IACnC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACzC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrC,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,iBAAiB,EAAE,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAClD,QA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;IAC5C,WAAW,EAAE,CACX,EAAE,EAAE,YAAY,KACb,QAAQ,GAAG;QAAE,oBAAoB,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;IACrF,UAAU,EAAE,CAAC,EAAE,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAC3D,YAAY,EAAE,CAAC,EAAE,EAAE,YAAY,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC;IACpC,SAAS,EAAE,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IACzC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC;IACzC,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;IACrC,QAAQ,EAAE,GAAG,CAAC,YAAY,EAAE,iBAAiB,CAAC,CAAC;IAC/C,iBAAiB,EAAE,GAAG,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;IAClD,cAAc,EAAE,CAAC,QAAQ,CAAC,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;CACrD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-upload.d.ts","sourceRoot":"","sources":["use-upload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"use-upload.d.ts","sourceRoot":"","sources":["use-upload.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAa,MAAM,mBAAmB,CAAC;AAiC1E,QAAA,MAAM,SAAS;;;;;;0BAgM+B,IAAI,EAAE;yBAoFb,MAAM;6BAqBF,MAAM;8BAqBL,MAAM;;CA2BjD,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -58,11 +58,12 @@ var promised = function promised(action) {
|
|
|
58
58
|
resolve(true);
|
|
59
59
|
});
|
|
60
60
|
};
|
|
61
|
+
var defaultValue = [];
|
|
61
62
|
var useUpload = function useUpload(props) {
|
|
62
63
|
var _props$limit = props.limit,
|
|
63
64
|
limit = _props$limit === void 0 ? 100 : _props$limit,
|
|
64
65
|
_props$value = props.value,
|
|
65
|
-
value = _props$value === void 0 ?
|
|
66
|
+
value = _props$value === void 0 ? defaultValue : _props$value;
|
|
66
67
|
var accept = props.forceAccept || props.accept;
|
|
67
68
|
var forceAccept = !!props.forceAccept;
|
|
68
69
|
var _useState = useState({}),
|
|
@@ -182,21 +183,22 @@ var useUpload = function useUpload(props) {
|
|
|
182
183
|
responseType: props.responseType,
|
|
183
184
|
onStart: props.onStart,
|
|
184
185
|
onProgress: function onProgress(e, msg) {
|
|
185
|
-
|
|
186
|
+
var percent = typeof e.percent === 'number' ? e.percent : e.loaded / e.total * 100;
|
|
187
|
+
if (throttle && percent !== 100) return;
|
|
186
188
|
throttle = true;
|
|
187
189
|
setTimeout(function () {
|
|
188
190
|
throttle = false;
|
|
189
191
|
}, 16);
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
192
|
+
setFiles(function (files) {
|
|
193
|
+
return produce(files, function (draft) {
|
|
194
|
+
if (!draft[id]) return draft;
|
|
195
|
+
draft[id].process = percent;
|
|
196
|
+
if (msg) draft[id].message = msg;
|
|
197
|
+
if (typeof props.onProgress === 'function') {
|
|
198
|
+
props.onProgress(draft[id]);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
});
|
|
200
202
|
},
|
|
201
203
|
onLoad: function onLoad(xhr) {
|
|
202
204
|
if (!/^2|1223/.test("".concat(xhr.status))) {
|
|
@@ -224,11 +226,17 @@ var useUpload = function useUpload(props) {
|
|
|
224
226
|
delete draft[id];
|
|
225
227
|
});
|
|
226
228
|
});
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
229
|
+
if (props.functionalOnChange) {
|
|
230
|
+
// 回调型 setState不会丢值
|
|
231
|
+
props.onChange(function (prev) {
|
|
232
|
+
return [].concat(_toConsumableArray(prev || []), [result]);
|
|
233
|
+
});
|
|
234
|
+
} else {
|
|
235
|
+
var latestValue = latestState.value;
|
|
236
|
+
var newValue = _toConsumableArray(latestValue);
|
|
237
|
+
newValue.push(result);
|
|
238
|
+
props.onChange(newValue);
|
|
239
|
+
}
|
|
232
240
|
}
|
|
233
241
|
},
|
|
234
242
|
onError: function onError(xhr) {
|
|
@@ -346,48 +354,60 @@ var useUpload = function useUpload(props) {
|
|
|
346
354
|
error = _context2.sent;
|
|
347
355
|
case 21:
|
|
348
356
|
if (!(error instanceof Error)) {
|
|
349
|
-
_context2.next =
|
|
357
|
+
_context2.next = 29;
|
|
350
358
|
break;
|
|
351
359
|
}
|
|
352
360
|
if (validatorHandle(error, blob)) {
|
|
353
|
-
_context2.next =
|
|
361
|
+
_context2.next = 25;
|
|
354
362
|
break;
|
|
355
363
|
}
|
|
356
|
-
|
|
357
|
-
|
|
364
|
+
setFiles(function (prev) {
|
|
365
|
+
return produce(prev, function (draft) {
|
|
366
|
+
delete draft[id];
|
|
367
|
+
});
|
|
368
|
+
});
|
|
358
369
|
return _context2.abrupt("return", 0);
|
|
359
|
-
case
|
|
370
|
+
case 25:
|
|
360
371
|
fileRecord.message = error.message;
|
|
361
372
|
fileRecord.status = 3;
|
|
362
|
-
setFiles(
|
|
373
|
+
setFiles(function (prev) {
|
|
374
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, id, fileRecord));
|
|
375
|
+
});
|
|
363
376
|
return _context2.abrupt("return", 0);
|
|
364
|
-
case
|
|
377
|
+
case 29:
|
|
365
378
|
if (!props.beforeUpload) {
|
|
366
|
-
_context2.next =
|
|
379
|
+
_context2.next = 36;
|
|
367
380
|
break;
|
|
368
381
|
}
|
|
369
382
|
beforeUploadResult = props.beforeUpload(blob); // @ts-ignoreq
|
|
370
383
|
if (!(beforeUploadResult && beforeUploadResult.then)) {
|
|
371
|
-
_context2.next =
|
|
384
|
+
_context2.next = 34;
|
|
372
385
|
break;
|
|
373
386
|
}
|
|
374
387
|
props.beforeUpload(blob).then(function (args) {
|
|
375
388
|
if (args.status !== 'error') {
|
|
376
389
|
newFiles[id].xhr = uploadFile(id, blob, fileRecord.src);
|
|
377
|
-
setFiles(
|
|
390
|
+
setFiles(function (prev) {
|
|
391
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, id, fileRecord));
|
|
392
|
+
});
|
|
378
393
|
}
|
|
379
394
|
}).catch(function () {
|
|
380
|
-
|
|
381
|
-
|
|
395
|
+
setFiles(function (prev) {
|
|
396
|
+
return produce(prev, function (draft) {
|
|
397
|
+
delete draft[id];
|
|
398
|
+
});
|
|
399
|
+
});
|
|
382
400
|
});
|
|
383
401
|
return _context2.abrupt("return", 0);
|
|
384
|
-
case
|
|
385
|
-
_context2.next =
|
|
402
|
+
case 34:
|
|
403
|
+
_context2.next = 38;
|
|
386
404
|
break;
|
|
387
|
-
case
|
|
405
|
+
case 36:
|
|
388
406
|
fileRecord.xhr = uploadFile(id, blob, fileRecord.src);
|
|
389
|
-
setFiles(
|
|
390
|
-
|
|
407
|
+
setFiles(function (prev) {
|
|
408
|
+
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, id, fileRecord));
|
|
409
|
+
});
|
|
410
|
+
case 38:
|
|
391
411
|
case "end":
|
|
392
412
|
return _context2.stop();
|
|
393
413
|
}
|
|
@@ -166,6 +166,13 @@ export interface UseUploadProps<ValueItem = any> {
|
|
|
166
166
|
forceAcceptErrorMsg: string;
|
|
167
167
|
invalidImage: string;
|
|
168
168
|
};
|
|
169
|
+
/**
|
|
170
|
+
* @cn 设置为true后,组件的onChange参数会返回函数,即回调函数方式的setState
|
|
171
|
+
* @en After setting to true, the onChange parameter of the component will return a function, that is, the setState of the callback function
|
|
172
|
+
* @default false
|
|
173
|
+
* @version 3.6.5
|
|
174
|
+
*/
|
|
175
|
+
functionalOnChange?: boolean;
|
|
169
176
|
}
|
|
170
177
|
export interface Validator {
|
|
171
178
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-upload.type.d.ts","sourceRoot":"","sources":["use-upload.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,MAAM,WAAW,SAAS;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,0BAA0B,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,GAAG,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AACD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAClB,IAAI,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,cAAc,CAAC,SAAS,GAAG,GAAG;IAC7C;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAA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E,aAAa,EAAE,GAAG,CAAC,EAAE,MAAM,KAAK,GAAG,CAAC;IACxD;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,SAAS,KAAK,CAAC,GAAG,KAAK,CAAC;IAClF;;;;OAIG;IACH,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* delete some props if needed, will not modify the pass argument
|
|
3
|
+
* @param props
|
|
4
|
+
* @returns {Produced<*, *>}
|
|
5
|
+
*/
|
|
6
|
+
export declare function cleanProps(props: {
|
|
7
|
+
[x: string]: any;
|
|
8
|
+
}): {
|
|
9
|
+
[x: string]: any;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=clean-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clean-props.d.ts","sourceRoot":"","sources":["clean-props.ts"],"names":[],"mappings":"AAwBA;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE;;EAIrD"}
|