@sheinx/hooks 3.5.8-beta.8 → 3.5.8-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-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-border.d.ts +6 -0
- package/cjs/common/use-position-style/check-border.d.ts.map +1 -0
- package/cjs/common/use-position-style/check-border.js +35 -0
- package/cjs/common/use-position-style/get-position-style.d.ts +1 -0
- package/cjs/common/use-position-style/get-position-style.d.ts.map +1 -1
- package/cjs/common/use-position-style/get-position-style.js +14 -8
- package/cjs/common/use-position-style/index.d.ts +1 -0
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +15 -5
- 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 +3 -2
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +3 -3
- package/cjs/components/use-form/use-form.type.d.ts +2 -2
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-virtual.js +1 -1
- package/cjs/components/use-tree/index.d.ts +1 -1
- package/cjs/components/use-tree/index.d.ts.map +1 -1
- package/cjs/components/use-tree/index.js +11 -2
- package/cjs/utils/warning.js +5 -5
- 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-border.d.ts +6 -0
- package/esm/common/use-position-style/check-border.d.ts.map +1 -0
- package/esm/common/use-position-style/check-border.js +29 -0
- package/esm/common/use-position-style/get-position-style.d.ts +1 -0
- package/esm/common/use-position-style/get-position-style.d.ts.map +1 -1
- package/esm/common/use-position-style/get-position-style.js +14 -8
- package/esm/common/use-position-style/index.d.ts +1 -0
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +15 -5
- 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 +3 -2
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +3 -3
- package/esm/components/use-form/use-form.type.d.ts +2 -2
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-table/use-table-virtual.js +1 -1
- package/esm/components/use-tree/index.d.ts +1 -1
- package/esm/components/use-tree/index.d.ts.map +1 -1
- package/esm/components/use-tree/index.js +1 -1
- package/esm/utils/warning.js +5 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;EA0E3F"}
|
|
@@ -46,19 +46,18 @@ function useInputAble(props) {
|
|
|
46
46
|
var render = (0, _useRender.useRender)(syncValue);
|
|
47
47
|
var shouldUseState = delay || !control;
|
|
48
48
|
var value = shouldUseState ? stateValue : valuePo;
|
|
49
|
-
(0, _react.
|
|
50
|
-
if (context.timer) {
|
|
51
|
-
clearTimeout(context.timer);
|
|
52
|
-
context.timer = null;
|
|
53
|
-
}
|
|
49
|
+
(0, _react.useLayoutEffect)(function () {
|
|
54
50
|
if (delay && control && props.value !== stateValue) {
|
|
55
51
|
changeStateValue(props.value);
|
|
52
|
+
} else if (context.timer) {
|
|
53
|
+
clearTimeout(context.timer);
|
|
54
|
+
context.timer = null;
|
|
56
55
|
}
|
|
57
56
|
}, [props.value, delay, control]);
|
|
58
57
|
var forceDelayChange = (0, _usePersistFn.default)(function () {
|
|
59
|
-
if (context.
|
|
58
|
+
if (context.delayChange) context.delayChange();
|
|
59
|
+
if (context.timer) {
|
|
60
60
|
clearTimeout(context.timer);
|
|
61
|
-
context.delayChange();
|
|
62
61
|
context.timer = null;
|
|
63
62
|
context.delayChange = null;
|
|
64
63
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface UseCheckElementBorderWidthOptions {
|
|
2
|
+
direction?: 'horizontal' | 'vertical';
|
|
3
|
+
}
|
|
4
|
+
export declare const useCheckElementBorderWidth: (elementRef: React.RefObject<HTMLElement>, options?: UseCheckElementBorderWidthOptions) => number;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=check-border.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACvC;AAGD,eAAO,MAAM,0BAA0B,eACzB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,iCAAiC,KACzC,MAqBF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCheckElementBorderWidth = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
+
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; }
|
|
12
|
+
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; } }
|
|
13
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
var useCheckElementBorderWidth = exports.useCheckElementBorderWidth = function useCheckElementBorderWidth(elementRef) {
|
|
15
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
16
|
+
var _useState = (0, _react.useState)(0),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
borderWidth = _useState2[0],
|
|
19
|
+
setBorderWidth = _useState2[1];
|
|
20
|
+
|
|
21
|
+
// 获取指定方向上的border宽度之和
|
|
22
|
+
var getBorderWidth = (0, _react.useCallback)(function () {
|
|
23
|
+
if (elementRef.current) {
|
|
24
|
+
var _options$direction = options.direction,
|
|
25
|
+
direction = _options$direction === void 0 ? 'horizontal' : _options$direction;
|
|
26
|
+
var style = window.getComputedStyle(elementRef.current);
|
|
27
|
+
var _borderWidth = direction === 'horizontal' ? parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth) : parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
28
|
+
setBorderWidth(_borderWidth);
|
|
29
|
+
}
|
|
30
|
+
}, [elementRef]);
|
|
31
|
+
(0, _react.useEffect)(function () {
|
|
32
|
+
getBorderWidth();
|
|
33
|
+
}, [getBorderWidth]);
|
|
34
|
+
return borderWidth;
|
|
35
|
+
};
|
|
@@ -3,5 +3,6 @@ export declare const getPositionStyle: (position: string, config?: {
|
|
|
3
3
|
popupGap?: number | undefined;
|
|
4
4
|
zIndex?: number | undefined;
|
|
5
5
|
fixedWidth?: boolean | "min" | undefined;
|
|
6
|
+
parentBorderWidth?: number | undefined;
|
|
6
7
|
} | undefined) => React.CSSProperties;
|
|
7
8
|
//# sourceMappingURL=get-position-style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-position-style.d.ts","sourceRoot":"","sources":["get-position-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"get-position-style.d.ts","sourceRoot":"","sources":["get-position-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,gBAAgB,aACjB,MAAM;;;;;qCA+CjB,CAAC"}
|
|
@@ -28,6 +28,9 @@ var getPositionStyle = exports.getPositionStyle = function getPositionStyle(posi
|
|
|
28
28
|
if (config !== null && config !== void 0 && config.fixedWidth) {
|
|
29
29
|
var key = config.fixedWidth === 'min' ? 'minWidth' : 'width';
|
|
30
30
|
newStyle[key] = '100%';
|
|
31
|
+
if (config.parentBorderWidth) {
|
|
32
|
+
newStyle[key] = "calc(100% + ".concat(config.parentBorderWidth, "px)");
|
|
33
|
+
}
|
|
31
34
|
}
|
|
32
35
|
if (position === 'drop-down') {
|
|
33
36
|
newStyle.top = mainMargin;
|
|
@@ -39,19 +42,22 @@ var getPositionStyle = exports.getPositionStyle = function getPositionStyle(posi
|
|
|
39
42
|
var positionArr = (position || '').split('-');
|
|
40
43
|
if (positionArr.length === 2) {
|
|
41
44
|
var _positionArr = _slicedToArray(positionArr, 2),
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
newStyle[ReverseDir[
|
|
45
|
-
newStyle[
|
|
45
|
+
vDirection = _positionArr[0],
|
|
46
|
+
hDirection = _positionArr[1];
|
|
47
|
+
newStyle[ReverseDir[vDirection]] = mainMargin;
|
|
48
|
+
newStyle[hDirection] = 0;
|
|
49
|
+
if (config !== null && config !== void 0 && config.parentBorderWidth) {
|
|
50
|
+
newStyle[hDirection] = -config.parentBorderWidth / 2;
|
|
51
|
+
}
|
|
46
52
|
} else {
|
|
47
53
|
var _positionArr2 = _slicedToArray(positionArr, 1),
|
|
48
|
-
|
|
49
|
-
newStyle[ReverseDir[
|
|
50
|
-
if (
|
|
54
|
+
_vDirection = _positionArr2[0];
|
|
55
|
+
newStyle[ReverseDir[_vDirection]] = mainMargin;
|
|
56
|
+
if (_vDirection === 'left' || _vDirection === 'right') {
|
|
51
57
|
newStyle.top = halfMargin;
|
|
52
58
|
newStyle.transform = 'translateY(-50%)';
|
|
53
59
|
}
|
|
54
|
-
if (
|
|
60
|
+
if (_vDirection === 'top' || _vDirection === 'bottom') {
|
|
55
61
|
newStyle.left = halfMargin;
|
|
56
62
|
newStyle.transform = 'translateX(-50%)';
|
|
57
63
|
}
|
|
@@ -15,6 +15,7 @@ export interface PositionStyleConfig {
|
|
|
15
15
|
fixedWidth?: boolean | 'min';
|
|
16
16
|
updateKey?: number | string;
|
|
17
17
|
adjust?: boolean;
|
|
18
|
+
offset?: [number, number];
|
|
18
19
|
}
|
|
19
20
|
export declare const usePositionStyle: (config: PositionStyleConfig) => {
|
|
20
21
|
style: React.CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,CAAC;AAYb,KAAK,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,OAAO,CAAC;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IAEd,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAiT3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -9,6 +9,7 @@ exports.usePositionStyle = exports.default = void 0;
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _getPositionStyle = require("./get-position-style");
|
|
11
11
|
var _checkPosition = require("./check-position");
|
|
12
|
+
var _checkBorder = require("./check-border");
|
|
12
13
|
var _shallowEqual = _interopRequireDefault(require("../../utils/shallow-equal"));
|
|
13
14
|
var _usePersistFn = _interopRequireDefault(require("../use-persist-fn"));
|
|
14
15
|
var _utils = require("../../utils");
|
|
@@ -43,7 +44,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
|
43
44
|
popupElRef = _ref.popupElRef,
|
|
44
45
|
scrollElRef = _ref.scrollElRef,
|
|
45
46
|
updateKey = _ref.updateKey,
|
|
46
|
-
adjust = _ref.adjust
|
|
47
|
+
adjust = _ref.adjust,
|
|
48
|
+
offset = _ref.offset;
|
|
47
49
|
// 初次渲染无样式的时候, 隐藏展示
|
|
48
50
|
var _useState = (0, _react.useState)(hideStyle),
|
|
49
51
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -74,6 +76,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
|
74
76
|
scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
|
|
75
77
|
enable: show && adjust
|
|
76
78
|
});
|
|
79
|
+
var parentElBorderWidth = (0, _checkBorder.useCheckElementBorderWidth)(parentElRef, {
|
|
80
|
+
direction: 'horizontal'
|
|
81
|
+
});
|
|
77
82
|
var adjustPosition = function adjustPosition(position) {
|
|
78
83
|
var winHeight = _utils.docSize.height;
|
|
79
84
|
if (!verticalPosition.includes(position)) return position;
|
|
@@ -150,6 +155,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
|
150
155
|
};
|
|
151
156
|
context.containerRect = containerRect;
|
|
152
157
|
context.containerScroll = containerScroll;
|
|
158
|
+
console.log('======================');
|
|
159
|
+
console.log('targetPosition: >>', targetPosition);
|
|
160
|
+
console.log('======================');
|
|
153
161
|
if (verticalPosition.includes(targetPosition)) {
|
|
154
162
|
var _targetPosition$split = targetPosition.split('-'),
|
|
155
163
|
_targetPosition$split2 = _slicedToArray(_targetPosition$split, 2),
|
|
@@ -225,11 +233,11 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
|
225
233
|
_h = _targetPosition$split4[0],
|
|
226
234
|
_v = _targetPosition$split4[1];
|
|
227
235
|
if (_v === 'top') {
|
|
228
|
-
style.top = rect.top - containerRect.top + containerScroll.top;
|
|
236
|
+
style.top = rect.top - containerRect.top + containerScroll.top - (offset ? offset[1] : 0);
|
|
229
237
|
style.transform = '';
|
|
230
238
|
arrayStyle.top = "8px";
|
|
231
239
|
} else if (_v === 'bottom') {
|
|
232
|
-
style.top = rect.bottom - containerRect.top + containerScroll.top;
|
|
240
|
+
style.top = rect.bottom - containerRect.top + containerScroll.top + (offset ? offset[1] : 0);
|
|
233
241
|
arrayStyle.bottom = "8px";
|
|
234
242
|
style.transform = 'translateY(-100%)';
|
|
235
243
|
} else {
|
|
@@ -304,17 +312,19 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
|
304
312
|
newStyle: style
|
|
305
313
|
};
|
|
306
314
|
context.parentRect = parentElRef.current.getBoundingClientRect();
|
|
315
|
+
var realPosition = position;
|
|
307
316
|
if (adjust) {
|
|
308
317
|
var popupInfo = getPopUpInfo(context.parentRect);
|
|
309
318
|
context.popUpHeight = popupInfo.height;
|
|
310
319
|
context.popUpWidth = popupInfo.width;
|
|
320
|
+
realPosition = adjustPosition(position);
|
|
311
321
|
}
|
|
312
|
-
var realPosition = adjust ? adjustPosition(position) : position;
|
|
313
322
|
if (!absolute) {
|
|
314
323
|
newStyle = (0, _getPositionStyle.getPositionStyle)(realPosition, {
|
|
315
324
|
popupGap: popupGap,
|
|
316
325
|
zIndex: zIndex,
|
|
317
|
-
fixedWidth: fixedWidth
|
|
326
|
+
fixedWidth: fixedWidth,
|
|
327
|
+
parentBorderWidth: parentElBorderWidth
|
|
318
328
|
});
|
|
319
329
|
} else {
|
|
320
330
|
var _ref3 = getAbsoluteStyle(realPosition),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA0B/D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;
|
|
1
|
+
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA0B/D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBAkJpC,CAAC,YAAY,GAAG,EAAE;;;;;EAkDrD"}
|
|
@@ -97,6 +97,7 @@ function useFormControl(props) {
|
|
|
97
97
|
var formValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
98
98
|
var errors = arguments.length > 1 ? arguments[1] : undefined;
|
|
99
99
|
var severErrors = arguments.length > 2 ? arguments[2] : undefined;
|
|
100
|
+
var names = arguments.length > 3 ? arguments[3] : undefined;
|
|
100
101
|
if (!name) return;
|
|
101
102
|
if ((0, _is.isArray)(name)) {
|
|
102
103
|
var _value = getValue(name, formValue);
|
|
@@ -108,7 +109,7 @@ function useFormControl(props) {
|
|
|
108
109
|
var dv = (0, _is.isArray)(defaultValue) ? defaultValue : [];
|
|
109
110
|
var nextValue = [];
|
|
110
111
|
name.forEach(function (n, index) {
|
|
111
|
-
if (_value[index] === undefined && dv[index] !== undefined) {
|
|
112
|
+
if (!names.has(n) && _value[index] === undefined && dv[index] !== undefined) {
|
|
112
113
|
nextValue[index] = dv[index];
|
|
113
114
|
} else {
|
|
114
115
|
nextValue[index] = _value[index];
|
|
@@ -122,7 +123,7 @@ function useFormControl(props) {
|
|
|
122
123
|
setErrorState(_error2);
|
|
123
124
|
}
|
|
124
125
|
if (!(0, _shallowEqual.shallowEqual)(_value2, latestInfo.valueState)) {
|
|
125
|
-
if (_value2 === undefined && defaultValue !== undefined) {
|
|
126
|
+
if (!names.has(name) && _value2 === undefined && defaultValue !== undefined) {
|
|
126
127
|
setValueState(defaultValue);
|
|
127
128
|
} else {
|
|
128
129
|
setValueState(_value2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA+BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA+BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAgRC;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;aAAE;8BApJd,MAAM;oCAuND,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCAlLxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCAoPvB,MAAM,WAAW,gBAAgB;gCA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAzHpD,MAAM,0BAAyB,qBAAqB;;;;;;oBA2DjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BApJd,MAAM;gCAuND,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAlLxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCAoPvB,MAAM,WAAW,gBAAgB;4BA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAzHpD,MAAM,0BAAyB,qBAAqB;;CA8Y9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -78,7 +78,7 @@ var useForm = function useForm(props) {
|
|
|
78
78
|
Object.keys(context.updateMap).forEach(function (key) {
|
|
79
79
|
var _context$updateMap$ke;
|
|
80
80
|
(_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (update) {
|
|
81
|
-
update(context.value, context.errors, context.serverErrors);
|
|
81
|
+
update(context.value, context.errors, context.serverErrors, context.names);
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
Object.keys(context.flowMap).forEach(function (key) {
|
|
@@ -96,12 +96,12 @@ var useForm = function useForm(props) {
|
|
|
96
96
|
var _context$updateMap$pa;
|
|
97
97
|
var parentKey = key.split('.')[0];
|
|
98
98
|
(_context$updateMap$pa = context.updateMap[parentKey]) === null || _context$updateMap$pa === void 0 || _context$updateMap$pa.forEach(function (update) {
|
|
99
|
-
update(context.value, context.errors, context.serverErrors);
|
|
99
|
+
update(context.value, context.errors, context.serverErrors, context.names);
|
|
100
100
|
});
|
|
101
101
|
} else {
|
|
102
102
|
var _context$updateMap$ke2;
|
|
103
103
|
(_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (update) {
|
|
104
|
-
update(context.value, context.errors, context.serverErrors);
|
|
104
|
+
update(context.value, context.errors, context.serverErrors, context.names);
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
(_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (update) {
|
|
@@ -17,7 +17,7 @@ export type ValidateFnConfig = {
|
|
|
17
17
|
ignoreChildren?: boolean;
|
|
18
18
|
};
|
|
19
19
|
export type ValidateFn = (name: string, value: any, formData: ObjectType, config?: ValidateFnConfig) => Promise<true | FormError>;
|
|
20
|
-
export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void;
|
|
20
|
+
export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>, names: Set<string>) => void;
|
|
21
21
|
export interface FormContextValueType {
|
|
22
22
|
func?: {
|
|
23
23
|
unbind: (n: string, reserveAble?: boolean, validate?: ValidateFn, update?: UpdateFn) => void;
|
|
@@ -191,7 +191,7 @@ export type FormContext = {
|
|
|
191
191
|
lastValue: ObjectType | undefined;
|
|
192
192
|
resetTime: number;
|
|
193
193
|
mounted: boolean;
|
|
194
|
-
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void>>;
|
|
194
|
+
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>, names: Set<string>) => void>>;
|
|
195
195
|
flowMap: ObjectType<Set<() => void>>;
|
|
196
196
|
value: ObjectType;
|
|
197
197
|
errors: ObjectType<Error | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OA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GAAG,SAAS,CAAC,EAC3C,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,KACf,IAAI,CACV,CACF,CAAC;IAEF,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC;IACrC,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IACtC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,CAAC;IAC5C,SAAS,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,OAAO,CAAC;IACpB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,GAAG,CAAC;IACd,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,UAAU,CACzE,mBAAmB,EACnB,MAAM,CACP,CAAC"}
|
|
@@ -209,7 +209,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
209
209
|
setStartIndex(currentIndex);
|
|
210
210
|
|
|
211
211
|
// startIndex处于上方某个合并行的中间一行时,可能引起translate闪烁
|
|
212
|
-
if (!fromDrag && startIndex < currentIndex) {
|
|
212
|
+
if (rowSpanInfo && !fromDrag && startIndex < currentIndex) {
|
|
213
213
|
context.autoAddRows = currentIndex - startIndex;
|
|
214
214
|
setTimeout(function () {
|
|
215
215
|
context.autoAddRows = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default, default as useTree } from './use-tree';
|
|
1
|
+
export { default, default as useTree, MODE } from './use-tree';
|
|
2
2
|
export type { BaseTreeProps, UpdateFunc, TreePathType, TreeModeType, DisabledOption, } from './use-tree.type';
|
|
3
3
|
export { default as useTreeNode } from './use-tree-node';
|
|
4
4
|
export type { BaseTreeNodeProps, UpdateType } from './use-tree-node.type';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
3
|
|
|
4
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
8
|
+
Object.defineProperty(exports, "MODE", {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function get() {
|
|
11
|
+
return _useTree.MODE;
|
|
12
|
+
}
|
|
13
|
+
});
|
|
7
14
|
Object.defineProperty(exports, "default", {
|
|
8
15
|
enumerable: true,
|
|
9
16
|
get: function get() {
|
|
@@ -22,6 +29,8 @@ Object.defineProperty(exports, "useTreeNode", {
|
|
|
22
29
|
return _useTreeNode.default;
|
|
23
30
|
}
|
|
24
31
|
});
|
|
25
|
-
var _useTree =
|
|
32
|
+
var _useTree = _interopRequireWildcard(require("./use-tree"));
|
|
26
33
|
var _useTreeNode = _interopRequireDefault(require("./use-tree-node"));
|
|
27
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
34
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
35
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
36
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
package/cjs/utils/warning.js
CHANGED
|
@@ -15,29 +15,29 @@ var shouldShowMessage = function shouldShowMessage(message) {
|
|
|
15
15
|
var deprecated = function deprecated(prop, newProp, component, extraMessage) {
|
|
16
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
17
|
var msg = "[shineout] '".concat(prop, "' in ").concat(component, " component is deprecated, please use '").concat(newProp, "' instead. ").concat(extraMessage);
|
|
18
|
-
shouldShowMessage(msg)
|
|
18
|
+
if (shouldShowMessage(msg)) console.error(msg);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
var breakingChange = function breakingChange(message) {
|
|
22
22
|
if (process.env.NODE_ENV !== 'production') {
|
|
23
23
|
var msg = "[shineout] ".concat(message);
|
|
24
|
-
shouldShowMessage(msg)
|
|
24
|
+
if (shouldShowMessage(msg)) console.error(msg);
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
var devWarn = function devWarn(message) {
|
|
28
28
|
if (process.env.NODE_ENV !== 'production') {
|
|
29
|
-
shouldShowMessage(message)
|
|
29
|
+
if (shouldShowMessage(message)) console.warn("[shineout] ".concat(message));
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
var conflictWarning = function conflictWarning(component, prop1, prop2) {
|
|
33
33
|
if (process.env.NODE_ENV !== 'production') {
|
|
34
34
|
var msg = "[shineout] ".concat(prop1, " and ").concat(prop2, " cannot be used at the same time in ").concat(component, ".");
|
|
35
|
-
shouldShowMessage(msg)
|
|
35
|
+
if (shouldShowMessage(msg)) console.warn(msg);
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
var error = function error(message) {
|
|
39
39
|
var msg = new Error("[shineout] ".concat(message));
|
|
40
|
-
shouldShowMessage(msg.message)
|
|
40
|
+
if (shouldShowMessage(msg.message)) console.error(msg);
|
|
41
41
|
};
|
|
42
42
|
var devUseWarning = exports.devUseWarning = {
|
|
43
43
|
error: error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;
|
|
1
|
+
{"version":3,"file":"use-Input-able.d.ts","sourceRoot":"","sources":["use-Input-able.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,CAAC,EAAE,CAAC,SAAS,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC,CAAC;;;;EA0E3F"}
|
|
@@ -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 {
|
|
7
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
8
8
|
import { isFunc } from "../../utils/is";
|
|
9
9
|
import { shallowEqual } from "../../utils/shallow-equal";
|
|
10
10
|
import usePersistFn from "../use-persist-fn";
|
|
@@ -39,19 +39,18 @@ export default function useInputAble(props) {
|
|
|
39
39
|
var render = useRender(syncValue);
|
|
40
40
|
var shouldUseState = delay || !control;
|
|
41
41
|
var value = shouldUseState ? stateValue : valuePo;
|
|
42
|
-
|
|
43
|
-
if (context.timer) {
|
|
44
|
-
clearTimeout(context.timer);
|
|
45
|
-
context.timer = null;
|
|
46
|
-
}
|
|
42
|
+
useLayoutEffect(function () {
|
|
47
43
|
if (delay && control && props.value !== stateValue) {
|
|
48
44
|
changeStateValue(props.value);
|
|
45
|
+
} else if (context.timer) {
|
|
46
|
+
clearTimeout(context.timer);
|
|
47
|
+
context.timer = null;
|
|
49
48
|
}
|
|
50
49
|
}, [props.value, delay, control]);
|
|
51
50
|
var forceDelayChange = usePersistFn(function () {
|
|
52
|
-
if (context.
|
|
51
|
+
if (context.delayChange) context.delayChange();
|
|
52
|
+
if (context.timer) {
|
|
53
53
|
clearTimeout(context.timer);
|
|
54
|
-
context.delayChange();
|
|
55
54
|
context.timer = null;
|
|
56
55
|
context.delayChange = null;
|
|
57
56
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
interface UseCheckElementBorderWidthOptions {
|
|
2
|
+
direction?: 'horizontal' | 'vertical';
|
|
3
|
+
}
|
|
4
|
+
export declare const useCheckElementBorderWidth: (elementRef: React.RefObject<HTMLElement>, options?: UseCheckElementBorderWidthOptions) => number;
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=check-border.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-border.d.ts","sourceRoot":"","sources":["check-border.ts"],"names":[],"mappings":"AAEA,UAAU,iCAAiC;IAGzC,SAAS,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;CACvC;AAGD,eAAO,MAAM,0BAA0B,eACzB,MAAM,SAAS,CAAC,WAAW,CAAC,YAC/B,iCAAiC,KACzC,MAqBF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
2
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
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
|
+
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
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
export var useCheckElementBorderWidth = function useCheckElementBorderWidth(elementRef) {
|
|
9
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
10
|
+
var _useState = useState(0),
|
|
11
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
12
|
+
borderWidth = _useState2[0],
|
|
13
|
+
setBorderWidth = _useState2[1];
|
|
14
|
+
|
|
15
|
+
// 获取指定方向上的border宽度之和
|
|
16
|
+
var getBorderWidth = useCallback(function () {
|
|
17
|
+
if (elementRef.current) {
|
|
18
|
+
var _options$direction = options.direction,
|
|
19
|
+
direction = _options$direction === void 0 ? 'horizontal' : _options$direction;
|
|
20
|
+
var style = window.getComputedStyle(elementRef.current);
|
|
21
|
+
var _borderWidth = direction === 'horizontal' ? parseFloat(style.borderLeftWidth) + parseFloat(style.borderRightWidth) : parseFloat(style.borderTopWidth) + parseFloat(style.borderBottomWidth);
|
|
22
|
+
setBorderWidth(_borderWidth);
|
|
23
|
+
}
|
|
24
|
+
}, [elementRef]);
|
|
25
|
+
useEffect(function () {
|
|
26
|
+
getBorderWidth();
|
|
27
|
+
}, [getBorderWidth]);
|
|
28
|
+
return borderWidth;
|
|
29
|
+
};
|
|
@@ -3,5 +3,6 @@ export declare const getPositionStyle: (position: string, config?: {
|
|
|
3
3
|
popupGap?: number | undefined;
|
|
4
4
|
zIndex?: number | undefined;
|
|
5
5
|
fixedWidth?: boolean | "min" | undefined;
|
|
6
|
+
parentBorderWidth?: number | undefined;
|
|
6
7
|
} | undefined) => React.CSSProperties;
|
|
7
8
|
//# sourceMappingURL=get-position-style.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-position-style.d.ts","sourceRoot":"","sources":["get-position-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"get-position-style.d.ts","sourceRoot":"","sources":["get-position-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,eAAO,MAAM,gBAAgB,aACjB,MAAM;;;;;qCA+CjB,CAAC"}
|
|
@@ -22,6 +22,9 @@ export var getPositionStyle = function getPositionStyle(position, config) {
|
|
|
22
22
|
if (config !== null && config !== void 0 && config.fixedWidth) {
|
|
23
23
|
var key = config.fixedWidth === 'min' ? 'minWidth' : 'width';
|
|
24
24
|
newStyle[key] = '100%';
|
|
25
|
+
if (config.parentBorderWidth) {
|
|
26
|
+
newStyle[key] = "calc(100% + ".concat(config.parentBorderWidth, "px)");
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
if (position === 'drop-down') {
|
|
27
30
|
newStyle.top = mainMargin;
|
|
@@ -33,19 +36,22 @@ export var getPositionStyle = function getPositionStyle(position, config) {
|
|
|
33
36
|
var positionArr = (position || '').split('-');
|
|
34
37
|
if (positionArr.length === 2) {
|
|
35
38
|
var _positionArr = _slicedToArray(positionArr, 2),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
newStyle[ReverseDir[
|
|
39
|
-
newStyle[
|
|
39
|
+
vDirection = _positionArr[0],
|
|
40
|
+
hDirection = _positionArr[1];
|
|
41
|
+
newStyle[ReverseDir[vDirection]] = mainMargin;
|
|
42
|
+
newStyle[hDirection] = 0;
|
|
43
|
+
if (config !== null && config !== void 0 && config.parentBorderWidth) {
|
|
44
|
+
newStyle[hDirection] = -config.parentBorderWidth / 2;
|
|
45
|
+
}
|
|
40
46
|
} else {
|
|
41
47
|
var _positionArr2 = _slicedToArray(positionArr, 1),
|
|
42
|
-
|
|
43
|
-
newStyle[ReverseDir[
|
|
44
|
-
if (
|
|
48
|
+
_vDirection = _positionArr2[0];
|
|
49
|
+
newStyle[ReverseDir[_vDirection]] = mainMargin;
|
|
50
|
+
if (_vDirection === 'left' || _vDirection === 'right') {
|
|
45
51
|
newStyle.top = halfMargin;
|
|
46
52
|
newStyle.transform = 'translateY(-50%)';
|
|
47
53
|
}
|
|
48
|
-
if (
|
|
54
|
+
if (_vDirection === 'top' || _vDirection === 'bottom') {
|
|
49
55
|
newStyle.left = halfMargin;
|
|
50
56
|
newStyle.transform = 'translateX(-50%)';
|
|
51
57
|
}
|
|
@@ -15,6 +15,7 @@ export interface PositionStyleConfig {
|
|
|
15
15
|
fixedWidth?: boolean | 'min';
|
|
16
16
|
updateKey?: number | string;
|
|
17
17
|
adjust?: boolean;
|
|
18
|
+
offset?: [number, number];
|
|
18
19
|
}
|
|
19
20
|
export declare const usePositionStyle: (config: PositionStyleConfig) => {
|
|
20
21
|
style: React.CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AASnD,MAAM,MAAM,kBAAkB,GAC1B,aAAa,GACb,UAAU,GACV,cAAc,GACd,WAAW,GACX,MAAM,GACN,OAAO,CAAC;AACZ,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,cAAc,GACd,UAAU,GACV,WAAW,GACX,KAAK,GACL,QAAQ,CAAC;AAYb,KAAK,YAAY,GAAG,kBAAkB,GAAG,gBAAgB,GAAG,OAAO,CAAC;AACpE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,YAAY,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IAEd,WAAW,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAE1C,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAEzC,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAC3C,YAAY,EAAE,MAAM,WAAW,GAAG,IAAI,GAAG,SAAS,CAAC;IACnD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3B;AAOD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAiT3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -8,6 +8,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
8
8
|
import React, { useEffect, useState } from 'react';
|
|
9
9
|
import { getPositionStyle } from "./get-position-style";
|
|
10
10
|
import { useCheckElementPosition } from "./check-position";
|
|
11
|
+
import { useCheckElementBorderWidth } from "./check-border";
|
|
11
12
|
import shallowEqual from "../../utils/shallow-equal";
|
|
12
13
|
import usePersistFn from "../use-persist-fn";
|
|
13
14
|
import { getCurrentCSSZoom } from "../../utils";
|
|
@@ -34,7 +35,8 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
|
34
35
|
popupElRef = _ref.popupElRef,
|
|
35
36
|
scrollElRef = _ref.scrollElRef,
|
|
36
37
|
updateKey = _ref.updateKey,
|
|
37
|
-
adjust = _ref.adjust
|
|
38
|
+
adjust = _ref.adjust,
|
|
39
|
+
offset = _ref.offset;
|
|
38
40
|
// 初次渲染无样式的时候, 隐藏展示
|
|
39
41
|
var _useState = useState(hideStyle),
|
|
40
42
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -65,6 +67,9 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
|
65
67
|
scrollContainer: scrollElRef === null || scrollElRef === void 0 ? void 0 : scrollElRef.current,
|
|
66
68
|
enable: show && adjust
|
|
67
69
|
});
|
|
70
|
+
var parentElBorderWidth = useCheckElementBorderWidth(parentElRef, {
|
|
71
|
+
direction: 'horizontal'
|
|
72
|
+
});
|
|
68
73
|
var adjustPosition = function adjustPosition(position) {
|
|
69
74
|
var winHeight = docSize.height;
|
|
70
75
|
if (!verticalPosition.includes(position)) return position;
|
|
@@ -141,6 +146,9 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
|
141
146
|
};
|
|
142
147
|
context.containerRect = containerRect;
|
|
143
148
|
context.containerScroll = containerScroll;
|
|
149
|
+
console.log('======================');
|
|
150
|
+
console.log('targetPosition: >>', targetPosition);
|
|
151
|
+
console.log('======================');
|
|
144
152
|
if (verticalPosition.includes(targetPosition)) {
|
|
145
153
|
var _targetPosition$split = targetPosition.split('-'),
|
|
146
154
|
_targetPosition$split2 = _slicedToArray(_targetPosition$split, 2),
|
|
@@ -216,11 +224,11 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
|
216
224
|
_h = _targetPosition$split4[0],
|
|
217
225
|
_v = _targetPosition$split4[1];
|
|
218
226
|
if (_v === 'top') {
|
|
219
|
-
style.top = rect.top - containerRect.top + containerScroll.top;
|
|
227
|
+
style.top = rect.top - containerRect.top + containerScroll.top - (offset ? offset[1] : 0);
|
|
220
228
|
style.transform = '';
|
|
221
229
|
arrayStyle.top = "8px";
|
|
222
230
|
} else if (_v === 'bottom') {
|
|
223
|
-
style.top = rect.bottom - containerRect.top + containerScroll.top;
|
|
231
|
+
style.top = rect.bottom - containerRect.top + containerScroll.top + (offset ? offset[1] : 0);
|
|
224
232
|
arrayStyle.bottom = "8px";
|
|
225
233
|
style.transform = 'translateY(-100%)';
|
|
226
234
|
} else {
|
|
@@ -295,17 +303,19 @@ export var usePositionStyle = function usePositionStyle(config) {
|
|
|
295
303
|
newStyle: style
|
|
296
304
|
};
|
|
297
305
|
context.parentRect = parentElRef.current.getBoundingClientRect();
|
|
306
|
+
var realPosition = position;
|
|
298
307
|
if (adjust) {
|
|
299
308
|
var popupInfo = getPopUpInfo(context.parentRect);
|
|
300
309
|
context.popUpHeight = popupInfo.height;
|
|
301
310
|
context.popUpWidth = popupInfo.width;
|
|
311
|
+
realPosition = adjustPosition(position);
|
|
302
312
|
}
|
|
303
|
-
var realPosition = adjust ? adjustPosition(position) : position;
|
|
304
313
|
if (!absolute) {
|
|
305
314
|
newStyle = getPositionStyle(realPosition, {
|
|
306
315
|
popupGap: popupGap,
|
|
307
316
|
zIndex: zIndex,
|
|
308
|
-
fixedWidth: fixedWidth
|
|
317
|
+
fixedWidth: fixedWidth,
|
|
318
|
+
parentBorderWidth: parentElBorderWidth
|
|
309
319
|
});
|
|
310
320
|
} else {
|
|
311
321
|
var _ref3 = getAbsoluteStyle(realPosition),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA0B/D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;
|
|
1
|
+
{"version":3,"file":"use-form-control.d.ts","sourceRoot":"","sources":["use-form-control.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AA0B/D,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC;;kBAkJpC,CAAC,YAAY,GAAG,EAAE;;;;;EAkDrD"}
|
|
@@ -88,6 +88,7 @@ export default function useFormControl(props) {
|
|
|
88
88
|
var formValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
89
89
|
var errors = arguments.length > 1 ? arguments[1] : undefined;
|
|
90
90
|
var severErrors = arguments.length > 2 ? arguments[2] : undefined;
|
|
91
|
+
var names = arguments.length > 3 ? arguments[3] : undefined;
|
|
91
92
|
if (!name) return;
|
|
92
93
|
if (isArray(name)) {
|
|
93
94
|
var _value = getValue(name, formValue);
|
|
@@ -99,7 +100,7 @@ export default function useFormControl(props) {
|
|
|
99
100
|
var dv = isArray(defaultValue) ? defaultValue : [];
|
|
100
101
|
var nextValue = [];
|
|
101
102
|
name.forEach(function (n, index) {
|
|
102
|
-
if (_value[index] === undefined && dv[index] !== undefined) {
|
|
103
|
+
if (!names.has(n) && _value[index] === undefined && dv[index] !== undefined) {
|
|
103
104
|
nextValue[index] = dv[index];
|
|
104
105
|
} else {
|
|
105
106
|
nextValue[index] = _value[index];
|
|
@@ -113,7 +114,7 @@ export default function useFormControl(props) {
|
|
|
113
114
|
setErrorState(_error2);
|
|
114
115
|
}
|
|
115
116
|
if (!shallowEqual(_value2, latestInfo.valueState)) {
|
|
116
|
-
if (_value2 === undefined && defaultValue !== undefined) {
|
|
117
|
+
if (!names.has(name) && _value2 === undefined && defaultValue !== undefined) {
|
|
117
118
|
setValueState(defaultValue);
|
|
118
119
|
} else {
|
|
119
120
|
setValueState(_value2);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA+BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AA+BA,OAAO,EAEL,aAAa,EACb,YAAY,EACZ,gBAAgB,EAGhB,gBAAgB,EAEjB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAgRC;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;aAAE;8BApJd,MAAM;oCAuND,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCAlLxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCAoPvB,MAAM,WAAW,gBAAgB;gCA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAzHpD,MAAM,0BAAyB,qBAAqB;;;;;;oBA2DjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BApJd,MAAM;gCAuND,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAlLxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCAoPvB,MAAM,WAAW,gBAAgB;4BA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAzHpD,MAAM,0BAAyB,qBAAqB;;CA8Y9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -69,7 +69,7 @@ var useForm = function useForm(props) {
|
|
|
69
69
|
Object.keys(context.updateMap).forEach(function (key) {
|
|
70
70
|
var _context$updateMap$ke;
|
|
71
71
|
(_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (update) {
|
|
72
|
-
update(context.value, context.errors, context.serverErrors);
|
|
72
|
+
update(context.value, context.errors, context.serverErrors, context.names);
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
Object.keys(context.flowMap).forEach(function (key) {
|
|
@@ -87,12 +87,12 @@ var useForm = function useForm(props) {
|
|
|
87
87
|
var _context$updateMap$pa;
|
|
88
88
|
var parentKey = key.split('.')[0];
|
|
89
89
|
(_context$updateMap$pa = context.updateMap[parentKey]) === null || _context$updateMap$pa === void 0 || _context$updateMap$pa.forEach(function (update) {
|
|
90
|
-
update(context.value, context.errors, context.serverErrors);
|
|
90
|
+
update(context.value, context.errors, context.serverErrors, context.names);
|
|
91
91
|
});
|
|
92
92
|
} else {
|
|
93
93
|
var _context$updateMap$ke2;
|
|
94
94
|
(_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (update) {
|
|
95
|
-
update(context.value, context.errors, context.serverErrors);
|
|
95
|
+
update(context.value, context.errors, context.serverErrors, context.names);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
(_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (update) {
|
|
@@ -17,7 +17,7 @@ export type ValidateFnConfig = {
|
|
|
17
17
|
ignoreChildren?: boolean;
|
|
18
18
|
};
|
|
19
19
|
export type ValidateFn = (name: string, value: any, formData: ObjectType, config?: ValidateFnConfig) => Promise<true | FormError>;
|
|
20
|
-
export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void;
|
|
20
|
+
export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>, names: Set<string>) => void;
|
|
21
21
|
export interface FormContextValueType {
|
|
22
22
|
func?: {
|
|
23
23
|
unbind: (n: string, reserveAble?: boolean, validate?: ValidateFn, update?: UpdateFn) => void;
|
|
@@ -191,7 +191,7 @@ export type FormContext = {
|
|
|
191
191
|
lastValue: ObjectType | undefined;
|
|
192
192
|
resetTime: number;
|
|
193
193
|
mounted: boolean;
|
|
194
|
-
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void>>;
|
|
194
|
+
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>, names: Set<string>) => void>>;
|
|
195
195
|
flowMap: ObjectType<Set<() => void>>;
|
|
196
196
|
value: ObjectType;
|
|
197
197
|
errors: ObjectType<Error | undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE/C,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC,MAAM,EAAE,CAAC,CAAC;IACV,WAAW,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,EAAE,CAAC;KAClB,EAAE,CAAC;CACL;AAED,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;IACjC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,
|
|
1
|
+
{"version":3,"file":"use-form.type.d.ts","sourceRoot":"","sources":["use-form.type.ts"],"names":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E,mBAAmB,EACnB,MAAM,CACP,CAAC"}
|
|
@@ -203,7 +203,7 @@ var useTableVirtual = function useTableVirtual(props) {
|
|
|
203
203
|
setStartIndex(currentIndex);
|
|
204
204
|
|
|
205
205
|
// startIndex处于上方某个合并行的中间一行时,可能引起translate闪烁
|
|
206
|
-
if (!fromDrag && startIndex < currentIndex) {
|
|
206
|
+
if (rowSpanInfo && !fromDrag && startIndex < currentIndex) {
|
|
207
207
|
context.autoAddRows = currentIndex - startIndex;
|
|
208
208
|
setTimeout(function () {
|
|
209
209
|
context.autoAddRows = 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default, default as useTree } from './use-tree';
|
|
1
|
+
export { default, default as useTree, MODE } from './use-tree';
|
|
2
2
|
export type { BaseTreeProps, UpdateFunc, TreePathType, TreeModeType, DisabledOption, } from './use-tree.type';
|
|
3
3
|
export { default as useTreeNode } from './use-tree-node';
|
|
4
4
|
export type { BaseTreeNodeProps, UpdateType } from './use-tree-node.type';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EACV,aAAa,EACb,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,cAAc,GACf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC"}
|
package/esm/utils/warning.js
CHANGED
|
@@ -9,29 +9,29 @@ var shouldShowMessage = function shouldShowMessage(message) {
|
|
|
9
9
|
var deprecated = function deprecated(prop, newProp, component, extraMessage) {
|
|
10
10
|
if (process.env.NODE_ENV !== 'production') {
|
|
11
11
|
var msg = "[shineout] '".concat(prop, "' in ").concat(component, " component is deprecated, please use '").concat(newProp, "' instead. ").concat(extraMessage);
|
|
12
|
-
shouldShowMessage(msg)
|
|
12
|
+
if (shouldShowMessage(msg)) console.error(msg);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
var breakingChange = function breakingChange(message) {
|
|
16
16
|
if (process.env.NODE_ENV !== 'production') {
|
|
17
17
|
var msg = "[shineout] ".concat(message);
|
|
18
|
-
shouldShowMessage(msg)
|
|
18
|
+
if (shouldShowMessage(msg)) console.error(msg);
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
var devWarn = function devWarn(message) {
|
|
22
22
|
if (process.env.NODE_ENV !== 'production') {
|
|
23
|
-
shouldShowMessage(message)
|
|
23
|
+
if (shouldShowMessage(message)) console.warn("[shineout] ".concat(message));
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
var conflictWarning = function conflictWarning(component, prop1, prop2) {
|
|
27
27
|
if (process.env.NODE_ENV !== 'production') {
|
|
28
28
|
var msg = "[shineout] ".concat(prop1, " and ").concat(prop2, " cannot be used at the same time in ").concat(component, ".");
|
|
29
|
-
shouldShowMessage(msg)
|
|
29
|
+
if (shouldShowMessage(msg)) console.warn(msg);
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
var error = function error(message) {
|
|
33
33
|
var msg = new Error("[shineout] ".concat(message));
|
|
34
|
-
shouldShowMessage(msg.message)
|
|
34
|
+
if (shouldShowMessage(msg.message)) console.error(msg);
|
|
35
35
|
};
|
|
36
36
|
export var devUseWarning = {
|
|
37
37
|
error: error,
|