@sheinx/hooks 3.6.0-beta.8 → 3.6.0
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-pagination-list/index.d.ts.map +1 -1
- package/cjs/common/use-pagination-list/index.js +6 -1
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +7 -3
- package/cjs/components/use-check/use-check.d.ts +1 -1
- package/cjs/components/use-check/use-check.d.ts.map +1 -1
- package/cjs/components/use-check/use-check.js +10 -3
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +4 -0
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/cjs/components/use-form/Provider.d.ts +1 -2
- package/cjs/components/use-form/Provider.d.ts.map +1 -1
- 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 +2 -3
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/fieldset-context.js +3 -2
- package/cjs/components/use-form/use-form-fieldset/index.d.ts +1 -0
- package/cjs/components/use-form/use-form-fieldset/index.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-fieldset/index.js +6 -0
- package/cjs/components/use-form/use-form.d.ts +1 -2
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +20 -11
- package/cjs/components/use-form/use-form.type.d.ts +5 -3
- package/cjs/components/use-form/use-form.type.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-format.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.d.ts +1 -1
- package/cjs/components/use-input/use-input-number.d.ts.map +1 -1
- package/cjs/components/use-input/use-input-number.js +1 -0
- package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
- package/cjs/components/use-popup/use-popup.js +5 -0
- package/cjs/components/use-table/index.d.ts +2 -1
- package/cjs/components/use-table/index.d.ts.map +1 -1
- package/cjs/components/use-table/index.js +7 -0
- package/cjs/components/use-table/use-table-filter.d.ts +19 -0
- package/cjs/components/use-table/use-table-filter.d.ts.map +1 -0
- package/cjs/components/use-table/use-table-filter.js +96 -0
- package/cjs/components/use-table/use-table.type.d.ts +93 -0
- package/cjs/components/use-table/use-table.type.d.ts.map +1 -1
- package/cjs/components/use-tabs/context.d.ts +1 -1
- package/cjs/components/use-tabs/context.d.ts.map +1 -1
- package/cjs/components/use-tabs/use-tabs.d.ts +1 -1
- package/cjs/components/use-tree/use-tree.d.ts.map +1 -1
- package/cjs/components/use-tree/use-tree.js +58 -13
- package/cjs/components/use-tree/use-tree.type.d.ts +4 -0
- package/cjs/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/cjs/components/use-treeselect/use-tiled.d.ts +1 -1
- package/cjs/utils/dom/element.d.ts +1 -1
- package/cjs/utils/dom/element.d.ts.map +1 -1
- package/cjs/utils/dom/element.js +5 -3
- package/cjs/utils/lazyload.d.ts.map +1 -1
- package/cjs/utils/lazyload.js +2 -2
- package/esm/common/use-pagination-list/index.d.ts.map +1 -1
- package/esm/common/use-pagination-list/index.js +6 -1
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +7 -3
- package/esm/components/use-check/use-check.d.ts +1 -1
- package/esm/components/use-check/use-check.d.ts.map +1 -1
- package/esm/components/use-check/use-check.js +10 -3
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +4 -0
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/esm/components/use-form/Provider.d.ts +1 -2
- package/esm/components/use-form/Provider.d.ts.map +1 -1
- 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 +2 -3
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/fieldset-context.js +2 -1
- package/esm/components/use-form/use-form-fieldset/index.d.ts +1 -0
- package/esm/components/use-form/use-form-fieldset/index.d.ts.map +1 -1
- package/esm/components/use-form/use-form-fieldset/index.js +2 -1
- package/esm/components/use-form/use-form.d.ts +1 -2
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +20 -11
- package/esm/components/use-form/use-form.type.d.ts +5 -3
- package/esm/components/use-form/use-form.type.d.ts.map +1 -1
- package/esm/components/use-input/use-input-format.d.ts +1 -1
- package/esm/components/use-input/use-input-number.d.ts +1 -1
- package/esm/components/use-input/use-input-number.d.ts.map +1 -1
- package/esm/components/use-input/use-input-number.js +1 -0
- package/esm/components/use-popup/use-popup.d.ts.map +1 -1
- package/esm/components/use-popup/use-popup.js +5 -0
- package/esm/components/use-table/index.d.ts +2 -1
- package/esm/components/use-table/index.d.ts.map +1 -1
- package/esm/components/use-table/index.js +1 -0
- package/esm/components/use-table/use-table-filter.d.ts +19 -0
- package/esm/components/use-table/use-table-filter.d.ts.map +1 -0
- package/esm/components/use-table/use-table-filter.js +89 -0
- package/esm/components/use-table/use-table.type.d.ts +93 -0
- package/esm/components/use-table/use-table.type.d.ts.map +1 -1
- package/esm/components/use-tabs/context.d.ts +1 -1
- package/esm/components/use-tabs/context.d.ts.map +1 -1
- package/esm/components/use-tabs/use-tabs.d.ts +1 -1
- package/esm/components/use-tree/use-tree.d.ts.map +1 -1
- package/esm/components/use-tree/use-tree.js +58 -13
- package/esm/components/use-tree/use-tree.type.d.ts +4 -0
- package/esm/components/use-tree/use-tree.type.d.ts.map +1 -1
- package/esm/components/use-treeselect/use-tiled.d.ts +1 -1
- package/esm/utils/dom/element.d.ts +1 -1
- package/esm/utils/dom/element.d.ts.map +1 -1
- package/esm/utils/dom/element.js +4 -2
- package/esm/utils/lazyload.d.ts.map +1 -1
- package/esm/utils/lazyload.js +3 -3
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,iBAAiB,UAAW,mBAAmB;;;;;;;;;;;;;wBAKP,MAAM,YAAY,MAAM;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.tsx"],"names":[],"mappings":"AAGA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IAC7B,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IACpE,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;CAC3B;AAED,QAAA,MAAM,iBAAiB,UAAW,mBAAmB;;;;;;;;;;;;;wBAKP,MAAM,YAAY,MAAM;CA0CrE,CAAC;AAEF,eAAe,iBAAiB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
@@ -40,8 +40,13 @@ var usePaginationList = exports.usePaginationList = function usePaginationList(p
|
|
40
40
|
var _props$total;
|
41
41
|
if (!shouldPage) return {};
|
42
42
|
var total = (_props$total = props.total) !== null && _props$total !== void 0 ? _props$total : Array.isArray(data) ? data.length : 0;
|
43
|
+
var finalCurrent = props.current || current;
|
44
|
+
var maxCurrent = Math.ceil(total / (props.pageSize || pageSize));
|
45
|
+
if (current > maxCurrent) {
|
46
|
+
finalCurrent = 1;
|
47
|
+
}
|
43
48
|
return {
|
44
|
-
current:
|
49
|
+
current: finalCurrent,
|
45
50
|
pageSize: props.pageSize || pageSize,
|
46
51
|
total: total,
|
47
52
|
disabled: !!props.loading,
|
@@ -1 +1 @@
|
|
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,EAA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AAE,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;;;CAkT3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -247,10 +247,12 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
247
247
|
}
|
248
248
|
if (_h === 'right') {
|
249
249
|
style.left = rect.right - containerRect.left + containerScroll.left + popupGap;
|
250
|
+
arrayStyle.left = '0px';
|
251
|
+
arrayStyle.right = 'auto';
|
250
252
|
} else {
|
251
|
-
style.
|
252
|
-
arrayStyle.right =
|
253
|
-
|
253
|
+
style.right = containerRect.right - rect.left;
|
254
|
+
arrayStyle.right = '0px';
|
255
|
+
arrayStyle.left = 'auto';
|
254
256
|
}
|
255
257
|
} else if (position === 'cover') {
|
256
258
|
style.top = rect.top - containerRect.top + containerScroll.top;
|
@@ -333,6 +335,8 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
333
335
|
// for animation
|
334
336
|
if (realPosition.indexOf('top') === 0) {
|
335
337
|
newStyle.transformOrigin = 'center bottom';
|
338
|
+
} else if (realPosition.indexOf('bottom') === 0) {
|
339
|
+
newStyle.transformOrigin = 'center top';
|
336
340
|
}
|
337
341
|
return {
|
338
342
|
newStyle: newStyle,
|
@@ -22,7 +22,7 @@ declare const useCheck: (props: BaseCheckProps) => {
|
|
22
22
|
ref: ((instance: HTMLInputElement | null) => void) | null;
|
23
23
|
disabled: boolean | undefined;
|
24
24
|
};
|
25
|
-
getRootProps: <TOther_2 extends ObjectType>(externalProps?: TOther_2) => TOther_2 & {
|
25
|
+
getRootProps: <TOther_2 extends ObjectType>(externalProps?: TOther_2) => Omit<TOther_2, "needStopPropagation"> & {
|
26
26
|
onClick: (event: React.MouseEvent) => void;
|
27
27
|
};
|
28
28
|
disabled: boolean | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-check.d.ts","sourceRoot":"","sources":["use-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;
|
1
|
+
{"version":3,"file":"use-check.d.ts","sourceRoot":"","sources":["use-check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;qBAuDpB,gBAAgB,CAAC,gBAAgB,CAAC;0BArBT,MAAM,WAAW,CAAC,gBAAgB,CAAC;;;;;;;;;;;yBAnBa,gBAAgB;;;;CAiE3G,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.default = void 0;
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
9
9
|
var _utils = require("../../utils");
|
10
|
+
var _ = require("../..");
|
10
11
|
var _useForkRef = _interopRequireDefault(require("../../common/use-fork-ref"));
|
11
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
12
13
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
@@ -43,9 +44,12 @@ var useCheck = function useCheck(props) {
|
|
43
44
|
};
|
44
45
|
var inputRef = _react.default.useRef(null);
|
45
46
|
var handleInputRef = (0, _useForkRef.default)(inputRef, inputRefPo);
|
46
|
-
var handleClick = function handleClick(otherHandlers) {
|
47
|
+
var handleClick = function handleClick(otherHandlers, needStopPropagation) {
|
47
48
|
return function (event) {
|
48
49
|
var _inputRef$current, _otherHandlers$onClic;
|
50
|
+
if (needStopPropagation) {
|
51
|
+
event.stopPropagation();
|
52
|
+
}
|
49
53
|
(_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.click();
|
50
54
|
otherHandlers === null || otherHandlers === void 0 || (_otherHandlers$onClic = otherHandlers.onClick) === null || _otherHandlers$onClic === void 0 || _otherHandlers$onClic.call(otherHandlers, event);
|
51
55
|
};
|
@@ -53,8 +57,10 @@ var useCheck = function useCheck(props) {
|
|
53
57
|
var getRootProps = function getRootProps() {
|
54
58
|
var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
55
59
|
var externalEventHandlers = (0, _utils.extractEventHandlers)(externalProps);
|
56
|
-
return _objectSpread(_objectSpread({}, externalProps
|
57
|
-
|
60
|
+
return _objectSpread(_objectSpread({}, _.util.removeProps(externalProps, {
|
61
|
+
needStopPropagation: true
|
62
|
+
})), {}, {
|
63
|
+
onClick: handleClick(externalEventHandlers, externalProps.needStopPropagation)
|
58
64
|
});
|
59
65
|
//封装点击事件 点击触发input 的点击
|
60
66
|
// disabled 禁用后不可点击
|
@@ -83,6 +89,7 @@ var useCheck = function useCheck(props) {
|
|
83
89
|
disabled: disabled
|
84
90
|
}, checkProps), {}, {
|
85
91
|
onClick: function onClick(e) {
|
92
|
+
// TODO: 这个e.stopPropagation生效不了,外部的触发是通过inputRef.current?.click()方式的;没啥用的代码
|
86
93
|
e.stopPropagation();
|
87
94
|
_onClick === null || _onClick === void 0 || _onClick(e);
|
88
95
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"use-datepicker-format.d.ts","sourceRoot":"","sources":["use-datepicker-format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAE3D,OAAO,KAAK,EACV,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACzB,MAAM,8BAA8B,CAAC;AAkEtC,QAAA,MAAM,mBAAmB;;;;;;;;;;;;;;;;;0BAuMe,gBAAgB;sCAiEJ,MAAM;iCA7BX,MAAM,SAAS,MAAM;yCAxLrD,OAAO,GAAG,KAAK,GAAG,SAAS,QAAQ,MAAM,UAAU,IAAI,KAAK,OAAO;uCAWvE,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC,QAC3B,MAAM;kBACG,MAAM,SAAS;mBAAS,GAAG;;+BA4CrC,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS,gBAAgB,MAAM;;CAwN3E,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
@@ -211,6 +211,10 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
|
|
211
211
|
if (props.formatResult) {
|
212
212
|
if (typeof props.formatResult === 'string') {
|
213
213
|
return getFormatValueArr(dateArr, props.formatResult);
|
214
|
+
} else if (typeof props.formatResult === 'function') {
|
215
|
+
return dateArr.map(function (item) {
|
216
|
+
return props.formatResult(item);
|
217
|
+
});
|
214
218
|
} else {
|
215
219
|
return dateArr.map(function (item) {
|
216
220
|
if (!item) return '';
|
@@ -5,7 +5,7 @@ export type DatePickerModeType = 'year' | 'month' | 'quarter' | 'time' | 'day';
|
|
5
5
|
export interface UseDatePickerFormatProps<Value extends DatePickerValueType> {
|
6
6
|
type: 'date' | 'datetime' | 'month' | 'time' | 'week' | 'year' | 'quarter';
|
7
7
|
format: string | undefined;
|
8
|
-
formatResult
|
8
|
+
formatResult?: string | ((date?: Date) => string);
|
9
9
|
range: boolean | undefined | number;
|
10
10
|
value: Value | undefined;
|
11
11
|
onChange: ((value: Value extends any[] ? string[] : string, ...args: any) => void) | undefined;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-format.type.d.ts","sourceRoot":"","sources":["use-datepicker-format.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC;AAClG,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;AAC/E,MAAM,WAAW,wBAAwB,CAAC,KAAK,SAAS,mBAAmB;IACzE,IAAI,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;IAC3E,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,MAAM,CAAC,
|
1
|
+
{"version":3,"file":"use-datepicker-format.type.d.ts","sourceRoot":"","sources":["use-datepicker-format.type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,MAAM,MAAM,mBAAmB,GAAG,YAAY,GAAG,YAAY,EAAE,CAAC;AAChE,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,OAAO,GAAG,SA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AAS,CAAC;IACd,QAAQ,EACJ,OAAO,GACP,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,KAAK,EAAE,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,IAAI,KAAK,OAAO,CAAC,GACvF,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,GAC1C,SAAS,CAAC;CACf"}
|
@@ -1,4 +1,3 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import { ProviderProps } from './use-form.type';
|
3
|
-
export declare const Provider: (props: ProviderProps) => JSX.Element;
|
2
|
+
export declare const Provider: (props: ProviderProps) => import("react/jsx-runtime").JSX.Element;
|
4
3
|
//# sourceMappingURL=Provider.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"Provider.d.ts","sourceRoot":"","sources":["Provider.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,eAAO,MAAM,QAAQ,UAAW,aAAa,4CAW5C,CAAC"}
|
@@ -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;;kBAiJpC,CAAC,YAAY,GAAG,EAAE;;;;;EAkDrD"}
|
@@ -97,7 +97,6 @@ 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;
|
101
100
|
if (!name) return;
|
102
101
|
if ((0, _is.isArray)(name)) {
|
103
102
|
var _value = getValue(name, formValue);
|
@@ -109,7 +108,7 @@ function useFormControl(props) {
|
|
109
108
|
var dv = (0, _is.isArray)(defaultValue) ? defaultValue : [];
|
110
109
|
var nextValue = [];
|
111
110
|
name.forEach(function (n, index) {
|
112
|
-
if (
|
111
|
+
if (_value[index] === undefined && dv[index] !== undefined) {
|
113
112
|
nextValue[index] = dv[index];
|
114
113
|
} else {
|
115
114
|
nextValue[index] = _value[index];
|
@@ -123,7 +122,7 @@ function useFormControl(props) {
|
|
123
122
|
setErrorState(_error2);
|
124
123
|
}
|
125
124
|
if (!(0, _shallowEqual.shallowEqual)(_value2, latestInfo.valueState)) {
|
126
|
-
if (
|
125
|
+
if (_value2 === undefined && defaultValue !== undefined) {
|
127
126
|
setValueState(defaultValue);
|
128
127
|
} else {
|
129
128
|
setValueState(_value2);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,
|
1
|
+
{"version":3,"file":"fieldset-context.d.ts","sourceRoot":"","sources":["fieldset-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAwB,MAAM,OAAO,CAAC;AAE7C,eAAO,MAAM,eAAe;;;EAA0D,CAAC;AAGvF,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACzB;AAiBD,eAAO,MAAM,mBAAmB;;;;CAe/B,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
@@ -4,7 +4,7 @@
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.useFieldSetConsumer = exports.default = void 0;
|
7
|
+
exports.useFieldSetConsumer = exports.default = exports.FieldsetContext = void 0;
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
9
9
|
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); }
|
10
10
|
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; }
|
@@ -14,10 +14,11 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
14
14
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
15
15
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
16
16
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
17
|
-
var FieldsetContext = /*#__PURE__*/(0, _react.createContext)({
|
17
|
+
var FieldsetContext = exports.FieldsetContext = /*#__PURE__*/(0, _react.createContext)({
|
18
18
|
path: '',
|
19
19
|
validateFieldSet: function validateFieldSet() {}
|
20
20
|
});
|
21
|
+
FieldsetContext.displayName = 'FieldsetContext';
|
21
22
|
function extendName() {
|
22
23
|
var path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
23
24
|
var name = arguments.length > 1 ? arguments[1] : undefined;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
export { default as useFormFieldSet, default } from './use-form-fieldset';
|
2
2
|
export { useFieldSetConsumer } from './fieldset-context';
|
3
|
+
export { FieldsetContext } from './fieldset-context';
|
3
4
|
export type { BaseFormFieldSetProps } from './use-form-fieldset.type';
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
|
@@ -4,6 +4,12 @@
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
+
Object.defineProperty(exports, "FieldsetContext", {
|
8
|
+
enumerable: true,
|
9
|
+
get: function get() {
|
10
|
+
return _fieldsetContext.FieldsetContext;
|
11
|
+
}
|
12
|
+
});
|
7
13
|
Object.defineProperty(exports, "default", {
|
8
14
|
enumerable: true,
|
9
15
|
get: function get() {
|
@@ -1,9 +1,8 @@
|
|
1
|
-
/// <reference types="react" />
|
2
1
|
import { ProviderProps, UseFormProps, UseFormSlotProps, ValidateFnConfig } from './use-form.type';
|
3
2
|
import { ObjectType } from '../../common/type';
|
4
3
|
declare const useForm: <T extends ObjectType>(props: UseFormProps<T>) => {
|
5
4
|
getFormProps: <TOther extends ObjectType = ObjectType>(externalProps?: TOther) => UseFormSlotProps<TOther>;
|
6
|
-
Provider: (props: ProviderProps) => JSX.Element;
|
5
|
+
Provider: (props: ProviderProps) => import("react/jsx-runtime").JSX.Element;
|
7
6
|
ProviderProps: {
|
8
7
|
formValue: import("./use-form.type").FormContextValueType;
|
9
8
|
formConfig: import("./use-form.type").FormCommonConfig;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":"
|
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;;;;;;;;;wBAyRC;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;gBAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;aAAE;8BA9Jd,MAAM;oCAiOD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCA5LxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;qCA8PvB,MAAM,WAAW,gBAAgB;gCA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;kCAnIpD,MAAM,0BAAyB,qBAAqB;;;;;;oBAqEjD;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAC;YAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE;0BA9Jd,MAAM;gCAiOD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCA5LxC,MAAM,GAAG,MAAM,EAAE,WAAU,gBAAgB;iCA8PvB,MAAM,WAAW,gBAAgB;4BA/CzB,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;8BAnIpD,MAAM,0BAAyB,qBAAqB;;CAma9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -53,7 +53,6 @@ var useForm = function useForm(props) {
|
|
53
53
|
forceSet: true
|
54
54
|
};
|
55
55
|
var preValue = (0, _useDefaultValue.usePrevious)(props.value);
|
56
|
-
var formDomRef = React.useRef();
|
57
56
|
var _React$useRef = React.useRef({
|
58
57
|
defaultValues: {},
|
59
58
|
validateMap: {},
|
@@ -79,7 +78,7 @@ var useForm = function useForm(props) {
|
|
79
78
|
Object.keys(context.updateMap).forEach(function (key) {
|
80
79
|
var _context$updateMap$ke;
|
81
80
|
(_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (update) {
|
82
|
-
update(context.value, context.errors, context.serverErrors
|
81
|
+
update(context.value, context.errors, context.serverErrors);
|
83
82
|
});
|
84
83
|
});
|
85
84
|
Object.keys(context.flowMap).forEach(function (key) {
|
@@ -97,12 +96,12 @@ var useForm = function useForm(props) {
|
|
97
96
|
var _context$updateMap$pa;
|
98
97
|
var parentKey = key.split('.')[0];
|
99
98
|
(_context$updateMap$pa = context.updateMap[parentKey]) === null || _context$updateMap$pa === void 0 || _context$updateMap$pa.forEach(function (update) {
|
100
|
-
update(context.value, context.errors, context.serverErrors
|
99
|
+
update(context.value, context.errors, context.serverErrors);
|
101
100
|
});
|
102
101
|
} else {
|
103
102
|
var _context$updateMap$ke2;
|
104
103
|
(_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (update) {
|
105
|
-
update(context.value, context.errors, context.serverErrors
|
104
|
+
update(context.value, context.errors, context.serverErrors);
|
106
105
|
});
|
107
106
|
}
|
108
107
|
(_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (update) {
|
@@ -127,9 +126,9 @@ var useForm = function useForm(props) {
|
|
127
126
|
onError === null || onError === void 0 || onError(err);
|
128
127
|
if (!props.scrollToError) return;
|
129
128
|
setTimeout(function () {
|
130
|
-
var
|
129
|
+
var _props$formElRef$curr;
|
131
130
|
var selector = "[".concat((0, _attribute.getDataAttributeName)('status'), "=\"error\"]");
|
132
|
-
var el = (
|
131
|
+
var el = (_props$formElRef$curr = props.formElRef.current) === null || _props$formElRef$curr === void 0 ? void 0 : _props$formElRef$curr.querySelector(selector);
|
133
132
|
if (el) {
|
134
133
|
el.scrollIntoView();
|
135
134
|
var focusableSelectors = 'textarea, input,[tabindex]:not([tabindex="-1"])';
|
@@ -253,10 +252,20 @@ var useForm = function useForm(props) {
|
|
253
252
|
var isVisibleX = elementRect.left >= parentRect.left && elementRect.right <= parentRect.right;
|
254
253
|
if (!isVisibleY || !isVisibleX) {
|
255
254
|
// 计算元素相对于父元素的偏移量
|
256
|
-
var offsetTop =
|
257
|
-
var offsetLeft =
|
258
|
-
|
259
|
-
|
255
|
+
var offsetTop = elementRect.top - parentRect.top;
|
256
|
+
var offsetLeft = elementRect.left - parentRect.left;
|
257
|
+
// 如果是往上滚动,那么只有当元素的偏移量小于0时才需要滚动
|
258
|
+
if (offsetTop < 0) {
|
259
|
+
parentEl.scrollTop = Math.max(parentEl.scrollTop + offsetTop, 0);
|
260
|
+
} else {
|
261
|
+
parentEl.scrollTop = Math.min(parentEl.scrollTop + offsetTop, parentEl.scrollHeight - parentEl.clientHeight);
|
262
|
+
}
|
263
|
+
// 如果是往左滚动,那么只有当元素的偏移量小于0时才需要滚动
|
264
|
+
if (offsetLeft < 0) {
|
265
|
+
parentEl.scrollLeft = Math.max(parentEl.scrollLeft + offsetLeft, 0);
|
266
|
+
} else {
|
267
|
+
parentEl.scrollLeft = Math.min(parentEl.scrollLeft + offsetLeft, parentEl.scrollWidth - parentEl.clientWidth);
|
268
|
+
}
|
260
269
|
}
|
261
270
|
} else {
|
262
271
|
// 如果没有找到可滚动的父元素,使用默认行为
|
@@ -460,7 +469,6 @@ var useForm = function useForm(props) {
|
|
460
469
|
var externalProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
461
470
|
var externalEventHandlers = (0, _utils.extractEventHandlers)(externalProps);
|
462
471
|
return _objectSpread(_objectSpread(_objectSpread({}, externalProps), externalEventHandlers), {}, {
|
463
|
-
ref: formDomRef,
|
464
472
|
disabled: !!disabled,
|
465
473
|
onSubmit: handleSubmit(externalEventHandlers),
|
466
474
|
onReset: handleReset(externalEventHandlers)
|
@@ -506,6 +514,7 @@ var useForm = function useForm(props) {
|
|
506
514
|
}
|
507
515
|
if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
|
508
516
|
context.names.delete(n);
|
517
|
+
delete context.errors[n];
|
509
518
|
delete context.defaultValues[n];
|
510
519
|
}
|
511
520
|
var finalReserveAble = (_props$reserveAble = props.reserveAble) !== null && _props$reserveAble !== void 0 ? _props$reserveAble : reserveAble;
|
@@ -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
|
20
|
+
export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void;
|
21
21
|
export interface FormContextValueType {
|
22
22
|
func?: {
|
23
23
|
unbind: (n: string, reserveAble?: boolean, validate?: ValidateFn, update?: UpdateFn) => void;
|
@@ -185,7 +185,9 @@ export interface BaseFormProps<T> extends Omit<FormCommonConfig, 'formName'> {
|
|
185
185
|
*/
|
186
186
|
name?: string;
|
187
187
|
}
|
188
|
-
export type UseFormProps<T> = BaseFormProps<T
|
188
|
+
export type UseFormProps<T> = BaseFormProps<T> & {
|
189
|
+
formElRef: React.RefObject<HTMLFormElement>;
|
190
|
+
};
|
189
191
|
export type FormContext = {
|
190
192
|
defaultValues: ObjectType;
|
191
193
|
validateMap: ObjectType<Set<(name: string, v: any, formValue: ObjectType, config?: {
|
@@ -198,7 +200,7 @@ export type FormContext = {
|
|
198
200
|
lastValue: ObjectType | undefined;
|
199
201
|
resetTime: number;
|
200
202
|
mounted: boolean;
|
201
|
-
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined
|
203
|
+
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void>>;
|
202
204
|
flowMap: ObjectType<Set<() => void>>;
|
203
205
|
value: ObjectType;
|
204
206
|
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,W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AO,CAAC;IAEjB,SAAS,EAAE,UAAU,CACnB,GAAG,CACD,CACE,SAAS,EAAE,UAAU,EACrB,MAAM,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,EACrC,YAAY,EAAE,UAAU,CAAC,KAAK,GAAG,SAAS,CAAC,KACxC,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"}
|
@@ -5,7 +5,7 @@ declare const useInputFormat: (props: InputFormatProps) => {
|
|
5
5
|
onBlur: (e: React.FocusEvent) => void;
|
6
6
|
onFocus: (e: React.FocusEvent) => void;
|
7
7
|
value: string | undefined;
|
8
|
-
type: "search" |
|
8
|
+
type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "image" | "month" | "password" | "week" | undefined;
|
9
9
|
};
|
10
10
|
export default useInputFormat;
|
11
11
|
//# sourceMappingURL=use-input-format.d.ts.map
|
@@ -7,7 +7,7 @@ declare const useNumberFormat: (props: InputNumberProps) => {
|
|
7
7
|
onBlur: (e: React.FocusEvent<Element, Element>) => void;
|
8
8
|
onFocus: (e: React.FocusEvent<Element, Element>) => void;
|
9
9
|
value: string | undefined;
|
10
|
-
type: "search" |
|
10
|
+
type: "search" | (string & {}) | "color" | "button" | "time" | "reset" | "submit" | "email" | "url" | "range" | "tel" | "hidden" | "checkbox" | "radio" | "text" | "date" | "datetime-local" | "file" | "image" | "month" | "password" | "week" | undefined;
|
11
11
|
};
|
12
12
|
export default useNumberFormat;
|
13
13
|
//# sourceMappingURL=use-input-number.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;
|
1
|
+
{"version":3,"file":"use-input-number.d.ts","sourceRoot":"","sources":["use-input-number.ts"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAK3D,QAAA,MAAM,eAAe,UAAW,gBAAgB;;;;;;;;CAwJ/C,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
@@ -75,6 +75,7 @@ var useNumberFormat = function useNumberFormat(props) {
|
|
75
75
|
var onInnerChange = (0, _usePersistFn.default)(function (val) {
|
76
76
|
setInternalInputValue(getStringValue(val));
|
77
77
|
if (typeof val === 'string') {
|
78
|
+
if (val.endsWith('.')) return;
|
78
79
|
var num = parseFloat(val);
|
79
80
|
if (val === '') {
|
80
81
|
// 如果允许空值,则返回 null,否则返回 undefined
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-popup.d.ts","sourceRoot":"","sources":["use-popup.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhE,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;;;
|
1
|
+
{"version":3,"file":"use-popup.d.ts","sourceRoot":"","sources":["use-popup.ts"],"names":[],"mappings":"AAAA,OAAO,KAA2D,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOhE,QAAA,MAAM,QAAQ,UAAW,cAAc;;;;;;;0BA8HK;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;0BAM9B;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;;;;;qBA5B7B;YAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAAA;SAAE;;;;;;;;;;;;;;;;;;;;;;;;;2BA6ElD,MAAM,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;6BAGxC,MAAM,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC;;CAsBpE,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
@@ -79,6 +79,11 @@ var usePopup = function usePopup(props) {
|
|
79
79
|
updatePosition();
|
80
80
|
}
|
81
81
|
setOpenState(!!props.open);
|
82
|
+
|
83
|
+
// 外部传了open时,需要正常的触发onCollapse;触发了onCollapse才能让组件内部的edit状态正确,否则可能会出现弹出层打开了但是用户却无法选择的情况
|
84
|
+
if (props.open !== undefined) {
|
85
|
+
changeOpen(!!props.open);
|
86
|
+
}
|
82
87
|
}, [props.open]);
|
83
88
|
|
84
89
|
// const getPopUpHeight = () => {
|
@@ -2,9 +2,10 @@ export { default, default as useTableLayout } from './use-table-layout';
|
|
2
2
|
export { default as useTableColumns } from './use-table-columns';
|
3
3
|
export { default as useTableGroup } from './use-table-group';
|
4
4
|
export { default as useTableSort } from './use-table-sort';
|
5
|
+
export { default as useTableFilter } from './use-table-filter';
|
5
6
|
export { default as useTableRow } from './use-table-row';
|
6
7
|
export { default as useTableExpand } from './use-table-expand';
|
7
8
|
export { default as useTableTree } from './use-table-tree';
|
8
9
|
export { default as useTableVirtual } from './use-table-virtual';
|
9
|
-
export type { TableFormatColumn, TableColumnItem, TableHeadColumn, TableGroupColumn, TableSorterInfo, BaseTableProps, } from './use-table.type';
|
10
|
+
export type { TableFormatColumn, TableColumnItem, TableHeadColumn, TableGroupColumn, TableSorterInfo, BaseTableProps, TableColumnFilter, TableFilterData, } from './use-table.type';
|
10
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,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,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,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,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"}
|
@@ -22,6 +22,12 @@ Object.defineProperty(exports, "useTableExpand", {
|
|
22
22
|
return _useTableExpand.default;
|
23
23
|
}
|
24
24
|
});
|
25
|
+
Object.defineProperty(exports, "useTableFilter", {
|
26
|
+
enumerable: true,
|
27
|
+
get: function get() {
|
28
|
+
return _useTableFilter.default;
|
29
|
+
}
|
30
|
+
});
|
25
31
|
Object.defineProperty(exports, "useTableGroup", {
|
26
32
|
enumerable: true,
|
27
33
|
get: function get() {
|
@@ -62,6 +68,7 @@ var _useTableLayout = _interopRequireDefault(require("./use-table-layout"));
|
|
62
68
|
var _useTableColumns = _interopRequireDefault(require("./use-table-columns"));
|
63
69
|
var _useTableGroup = _interopRequireDefault(require("./use-table-group"));
|
64
70
|
var _useTableSort = _interopRequireDefault(require("./use-table-sort"));
|
71
|
+
var _useTableFilter = _interopRequireDefault(require("./use-table-filter"));
|
65
72
|
var _useTableRow = _interopRequireDefault(require("./use-table-row"));
|
66
73
|
var _useTableExpand = _interopRequireDefault(require("./use-table-expand"));
|
67
74
|
var _useTableTree = _interopRequireDefault(require("./use-table-tree"));
|
@@ -0,0 +1,19 @@
|
|
1
|
+
/// <reference types="react" />
|
2
|
+
import { TableColumnItem, BaseTableProps } from './use-table.type';
|
3
|
+
import { KeygenResult } from '../../common/type';
|
4
|
+
export interface UseTableFilterProps<Item = any> extends Pick<BaseTableProps<Item>, 'onSortCancel' | 'sorter' | 'data'> {
|
5
|
+
columns?: TableColumnItem<Item>[];
|
6
|
+
}
|
7
|
+
export interface FilterInfo<T> {
|
8
|
+
value?: any;
|
9
|
+
onFilter?: (value: any, row: T) => boolean;
|
10
|
+
}
|
11
|
+
export type FilterMap<T> = Map<KeygenResult, FilterInfo<T>>;
|
12
|
+
declare const useTableFilter: <Item = any>(props: UseTableFilterProps<Item>) => {
|
13
|
+
filterInfo: FilterMap<Item>;
|
14
|
+
setFilterInfo: import("react").Dispatch<import("react").SetStateAction<FilterMap<Item>>>;
|
15
|
+
filteredData: Item[] | undefined;
|
16
|
+
onFilterChange: (columnKey: KeygenResult, value: any) => void;
|
17
|
+
};
|
18
|
+
export default useTableFilter;
|
19
|
+
//# sourceMappingURL=use-table-filter.d.ts.map
|
@@ -0,0 +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;;;;gCA6BH,YAAY,SAAS,GAAG;CAoDxC,CAAC;AAEF,eAAe,cAAc,CAAC"}
|