@sheinx/hooks 3.7.0-beta.9 → 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { produce } from "./immer";
|
|
2
|
+
var names = ['delay', 'onDatumBind', 'rules', 'formDatum', 'forceChange', 'trim', 'beforeChange', 'validateHook', 'innerFormNamePath', 'fieldSetValidate', 'combineRules', 'popoverProps', 'inputFocus', 'placeTitle', 'cancelChange', 'integerLimit', 'autoSelect', 'autoFix', 'numType'];
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* delete some props if needed, will not modify the pass argument
|
|
6
|
+
* @param props
|
|
7
|
+
* @returns {Produced<*, *>}
|
|
8
|
+
*/
|
|
9
|
+
export function cleanProps(props) {
|
|
10
|
+
return produce(props, function (draft) {
|
|
11
|
+
names.forEach(function (p) {
|
|
12
|
+
return delete draft[p];
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"highlight.d.ts","sourceRoot":"","sources":["highlight.tsx"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,EAClC,QAAQ,EACR,WAAW,EACX,kBAAkB,EAClB,MAAM,GACP,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,CAAC,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,GAAG,CAAC,CA8BJ"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React, { cloneElement } from 'react';
|
|
2
|
+
import { escapeRegExp } from "./string";
|
|
3
|
+
import { isArray } from "./is";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
6
|
+
export function getHighlightText(_ref) {
|
|
7
|
+
var nodeList = _ref.nodeList,
|
|
8
|
+
searchWords = _ref.searchWords,
|
|
9
|
+
highlightClassName = _ref.highlightClassName,
|
|
10
|
+
enable = _ref.enable;
|
|
11
|
+
if (!enable || !searchWords) {
|
|
12
|
+
return nodeList;
|
|
13
|
+
}
|
|
14
|
+
var transformNode = function transformNode(node) {
|
|
15
|
+
var _node$props;
|
|
16
|
+
if (node && typeof ((_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.children) === 'string') {
|
|
17
|
+
return /*#__PURE__*/cloneElement(node, undefined, /*#__PURE__*/_jsx(HighlightText, {
|
|
18
|
+
textToHighlight: node.props.children,
|
|
19
|
+
searchWords: searchWords,
|
|
20
|
+
highlightClassName: highlightClassName
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
if (node && typeof node === 'string') {
|
|
24
|
+
return /*#__PURE__*/_jsx(HighlightText, {
|
|
25
|
+
textToHighlight: node,
|
|
26
|
+
searchWords: searchWords,
|
|
27
|
+
highlightClassName: highlightClassName
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return node;
|
|
31
|
+
};
|
|
32
|
+
return isArray(nodeList) ? nodeList.map(transformNode) : transformNode(nodeList);
|
|
33
|
+
}
|
|
34
|
+
function HighlightText(_ref2) {
|
|
35
|
+
var textToHighlight = _ref2.textToHighlight,
|
|
36
|
+
searchWords = _ref2.searchWords,
|
|
37
|
+
highlightClassName = _ref2.highlightClassName;
|
|
38
|
+
if (!searchWords) return /*#__PURE__*/_jsx(_Fragment, {
|
|
39
|
+
children: textToHighlight
|
|
40
|
+
});
|
|
41
|
+
if (searchWords.length > 500) {
|
|
42
|
+
searchWords = searchWords.slice(0, 500);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 注意这里的括号,这里使用了带capture group功能的正则,来split字符串
|
|
46
|
+
// 从而在strArr中可以保留匹配文本
|
|
47
|
+
var re = new RegExp("(".concat(escapeRegExp(searchWords), ")"), 'i');
|
|
48
|
+
var strArr = textToHighlight.split(re);
|
|
49
|
+
return /*#__PURE__*/_jsx(_Fragment, {
|
|
50
|
+
children: strArr.map(function (item, index) {
|
|
51
|
+
return re.test(item) ? /*#__PURE__*/_jsx("span", {
|
|
52
|
+
className: highlightClassName,
|
|
53
|
+
children: item
|
|
54
|
+
}, index) : /*#__PURE__*/_jsx(React.Fragment, {
|
|
55
|
+
children: item
|
|
56
|
+
}, index);
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
}
|
package/esm/utils/index.d.ts
CHANGED
package/esm/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,MAAM,CAAC;AACrB,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAC3E,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC;AAC5B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,cAAc,eAAe,CAAC"}
|
package/esm/utils/index.js
CHANGED
|
@@ -21,5 +21,7 @@ export * from "./array";
|
|
|
21
21
|
export * from "./tree";
|
|
22
22
|
export * from "./immer";
|
|
23
23
|
export * from "./warning";
|
|
24
|
+
export * from "./highlight";
|
|
24
25
|
import * as _flat from "./flat";
|
|
25
|
-
export { _flat as flat };
|
|
26
|
+
export { _flat as flat };
|
|
27
|
+
export * from "./clean-props";
|
package/esm/utils/string.d.ts
CHANGED
|
@@ -11,4 +11,5 @@ export declare function substitute<T extends ObjectType = ObjectType>(str: strin
|
|
|
11
11
|
* 输出 '//github.com/'
|
|
12
12
|
*/
|
|
13
13
|
export declare function removeProtocol(url: string): string;
|
|
14
|
+
export declare function escapeRegExp(str?: any): any;
|
|
14
15
|
//# sourceMappingURL=string.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAC1D,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,EAClC,GAAG,EAAE,CAAC,UAoBP;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,UAQzC"}
|
|
1
|
+
{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["string.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,EAC1D,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,MAAM,CAAC,EAClC,GAAG,EAAE,CAAC,UAoBP;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,UAQzC;AASD,wBAAgB,YAAY,CAAC,GAAG,GAAE,GAAQ,OAKzC"}
|
package/esm/utils/string.js
CHANGED
|
@@ -37,4 +37,16 @@ export function removeProtocol(url) {
|
|
|
37
37
|
} catch (error) {
|
|
38
38
|
return url;
|
|
39
39
|
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Used to match `RegExp`
|
|
44
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
45
|
+
*/
|
|
46
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g,
|
|
47
|
+
reHasRegExpChar = RegExp(reRegExpChar.source);
|
|
48
|
+
export function escapeRegExp() {
|
|
49
|
+
var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
50
|
+
var string = typeof str === 'string' ? str : str.toString();
|
|
51
|
+
return string && reHasRegExpChar.test(string) ? string.replace(reRegExpChar, '\\$&') : string;
|
|
40
52
|
}
|