@sheinx/hooks 3.4.0-beta.4 → 3.4.0-beta.5
Sign up to get free protection for your applications and to get access to all the features.
- package/cjs/common/use-position-style/index.d.ts +4 -1
- package/cjs/common/use-position-style/index.d.ts.map +1 -1
- package/cjs/common/use-position-style/index.js +98 -11
- package/cjs/components/use-datepicker/use-date.d.ts +2 -2
- package/cjs/components/use-datepicker/use-date.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-date.js +2 -2
- package/cjs/components/use-datepicker/use-date.type.d.ts +1 -1
- package/cjs/components/use-datepicker/use-date.type.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-datepicker-format.js +3 -1
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts +1 -0
- package/cjs/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/cjs/components/use-datepicker/use-month.d.ts +1 -1
- package/cjs/components/use-datepicker/use-quarter.d.ts +1 -1
- package/cjs/components/use-datepicker/use-year.d.ts +1 -1
- package/cjs/components/use-datepicker/util.d.ts +1 -1
- package/cjs/components/use-datepicker/util.d.ts.map +1 -1
- package/cjs/components/use-datepicker/util.js +2 -1
- package/cjs/components/use-form/use-form-control/use-form-control.js +2 -2
- package/cjs/components/use-form/use-form.d.ts.map +1 -1
- package/cjs/components/use-form/use-form.js +40 -19
- package/cjs/components/use-form/use-form.type.d.ts +11 -6
- 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-popup/use-popup.d.ts +1 -0
- package/cjs/components/use-popup/use-popup.d.ts.map +1 -1
- package/cjs/components/use-popup/use-popup.js +7 -4
- package/cjs/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/cjs/components/use-table/use-table-virtual.js +28 -3
- package/cjs/utils/position.d.ts +1 -1
- package/cjs/utils/position.d.ts.map +1 -1
- package/cjs/utils/position.js +20 -5
- package/esm/common/use-position-style/index.d.ts +4 -1
- package/esm/common/use-position-style/index.d.ts.map +1 -1
- package/esm/common/use-position-style/index.js +99 -12
- package/esm/components/use-datepicker/use-date.d.ts +2 -2
- package/esm/components/use-datepicker/use-date.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-date.js +2 -2
- package/esm/components/use-datepicker/use-date.type.d.ts +1 -1
- package/esm/components/use-datepicker/use-date.type.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-datepicker-format.js +3 -1
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts +1 -0
- package/esm/components/use-datepicker/use-datepicker-format.type.d.ts.map +1 -1
- package/esm/components/use-datepicker/use-month.d.ts +1 -1
- package/esm/components/use-datepicker/use-quarter.d.ts +1 -1
- package/esm/components/use-datepicker/use-year.d.ts +1 -1
- package/esm/components/use-datepicker/util.d.ts +1 -1
- package/esm/components/use-datepicker/util.d.ts.map +1 -1
- package/esm/components/use-datepicker/util.js +2 -1
- package/esm/components/use-form/use-form-control/use-form-control.js +2 -2
- package/esm/components/use-form/use-form.d.ts.map +1 -1
- package/esm/components/use-form/use-form.js +40 -19
- package/esm/components/use-form/use-form.type.d.ts +11 -6
- 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-popup/use-popup.d.ts +1 -0
- package/esm/components/use-popup/use-popup.d.ts.map +1 -1
- package/esm/components/use-popup/use-popup.js +7 -4
- package/esm/components/use-table/use-table-virtual.d.ts.map +1 -1
- package/esm/components/use-table/use-table-virtual.js +28 -3
- package/esm/utils/position.d.ts +1 -1
- package/esm/utils/position.d.ts.map +1 -1
- package/esm/utils/position.js +20 -5
- package/package.json +1 -1
@@ -16,6 +16,9 @@ export interface PositionStyleConfig {
|
|
16
16
|
updateKey?: number | string;
|
17
17
|
adjust?: boolean;
|
18
18
|
}
|
19
|
-
export declare const usePositionStyle: (config: PositionStyleConfig) =>
|
19
|
+
export declare const usePositionStyle: (config: PositionStyleConfig) => {
|
20
|
+
style: React.CSSProperties;
|
21
|
+
arrayStyle: React.CSSProperties;
|
22
|
+
};
|
20
23
|
export default usePositionStyle;
|
21
24
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,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;CAClB;AAQD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,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;CAClB;AAQD,eAAO,MAAM,gBAAgB,WAAY,mBAAmB;;;CAmS3D,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
@@ -49,6 +49,10 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
49
49
|
_useState2 = _slicedToArray(_useState, 2),
|
50
50
|
style = _useState2[0],
|
51
51
|
setStyle = _useState2[1];
|
52
|
+
var _useState3 = (0, _react.useState)({}),
|
53
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
54
|
+
arrayStyle = _useState4[0],
|
55
|
+
setArrayStyle = _useState4[1];
|
52
56
|
var _React$useRef = _react.default.useRef({
|
53
57
|
element: null,
|
54
58
|
containerRect: {
|
@@ -122,10 +126,12 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
122
126
|
};
|
123
127
|
};
|
124
128
|
var getAbsolutePositionStyle = function getAbsolutePositionStyle(rect, position) {
|
129
|
+
var _popupElRef$current;
|
125
130
|
var style = {
|
126
131
|
position: 'absolute',
|
127
132
|
zIndex: zIndex
|
128
133
|
};
|
134
|
+
var arrayStyle = {};
|
129
135
|
if (fixedWidth) {
|
130
136
|
var widthKey = fixedWidth === 'min' ? 'minWidth' : 'width';
|
131
137
|
style[widthKey] = rect.width;
|
@@ -135,6 +141,7 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
135
141
|
var containerRect = rootContainer.getBoundingClientRect();
|
136
142
|
var bodyRect = (document.documentElement || document.body).getBoundingClientRect();
|
137
143
|
var containerScrollBarWidth = rootContainer.offsetWidth - rootContainer.clientWidth;
|
144
|
+
var targetRect = (_popupElRef$current = popupElRef.current) === null || _popupElRef$current === void 0 ? void 0 : _popupElRef$current.getBoundingClientRect();
|
138
145
|
var containerScroll = {
|
139
146
|
left: rootContainer.scrollLeft,
|
140
147
|
top: rootContainer.scrollTop
|
@@ -151,14 +158,25 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
151
158
|
if (h === 'left') {
|
152
159
|
style.left = rect.left - containerRect.left + containerScroll.left;
|
153
160
|
style.transform = '';
|
161
|
+
arrayStyle.left = "8px";
|
154
162
|
if (adjust) {
|
155
163
|
overRight = rect.left + context.popUpWidth - bodyRect.right + containerScrollBarWidth;
|
164
|
+
if (style.left < 0 && targetRect) {
|
165
|
+
style.left = 'auto';
|
166
|
+
}
|
156
167
|
}
|
157
168
|
} else if (h === 'right') {
|
158
169
|
style.right = containerRect.right - rect.right + containerScrollBarWidth - containerScroll.left;
|
159
170
|
style.left = 'auto';
|
160
171
|
style.transform = '';
|
161
|
-
|
172
|
+
arrayStyle.right = "8px";
|
173
|
+
if (adjust) {
|
174
|
+
overLeft = bodyRect.left - (rect.right - context.popUpWidth);
|
175
|
+
if (style.right < 0 && targetRect) {
|
176
|
+
style.left = bodyRect.width - targetRect.width;
|
177
|
+
style.right = 'auto';
|
178
|
+
}
|
179
|
+
}
|
162
180
|
} else {
|
163
181
|
// 居中对齐
|
164
182
|
style.left = rect.left + rect.width / 2 - containerRect.left + containerScroll.left;
|
@@ -167,6 +185,9 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
167
185
|
overRight = rect.left + rect.width / 2 + context.popUpWidth / 2 - bodyRect.width + containerScrollBarWidth;
|
168
186
|
overLeft = bodyRect.left - (rect.left + rect.width / 2 - context.popUpWidth / 2);
|
169
187
|
}
|
188
|
+
if (targetRect) {
|
189
|
+
arrayStyle.left = "".concat(targetRect.width / 2 - 5.9, "px");
|
190
|
+
}
|
170
191
|
}
|
171
192
|
if (adjust) {
|
172
193
|
// 调节左右溢出
|
@@ -175,16 +196,26 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
175
196
|
style.left -= overRight;
|
176
197
|
// 扣除触发器距离页面右侧的距离,以保证从右侧弹出的窗口最右边对齐触发器最右边
|
177
198
|
style.left -= toRightDistance;
|
199
|
+
if (targetRect) {
|
200
|
+
arrayStyle.left = "".concat((targetRect === null || targetRect === void 0 ? void 0 : targetRect.width) - context.parentRect.width / 2 - 5.9, "px");
|
201
|
+
}
|
178
202
|
}
|
179
203
|
if (overLeft > 0) {
|
180
204
|
style.left += overLeft;
|
205
|
+
arrayStyle.left = "".concat(rect.width / 2 - 5.9, "px");
|
181
206
|
}
|
182
207
|
}
|
183
208
|
if (v === 'bottom') {
|
184
209
|
style.top = rect.bottom - containerRect.top + containerScroll.top + popupGap;
|
210
|
+
if (targetRect) {
|
211
|
+
arrayStyle.top = "".concat(0, "px");
|
212
|
+
}
|
185
213
|
} else {
|
186
214
|
style.top = rect.top - containerRect.top + containerScroll.top - popupGap;
|
187
215
|
style.transform += 'translateY(-100%)';
|
216
|
+
if (targetRect) {
|
217
|
+
arrayStyle.top = "".concat(targetRect.height - 5.9 - 4, "px");
|
218
|
+
}
|
188
219
|
}
|
189
220
|
} else if (horizontalPosition.includes(targetPosition)) {
|
190
221
|
var _targetPosition$split3 = targetPosition.split('-'),
|
@@ -194,45 +225,88 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
194
225
|
if (_v === 'top') {
|
195
226
|
style.top = rect.top - containerRect.top + containerScroll.top;
|
196
227
|
style.transform = '';
|
228
|
+
arrayStyle.top = "8px";
|
197
229
|
} else if (_v === 'bottom') {
|
198
230
|
style.top = rect.bottom - containerRect.top + containerScroll.top;
|
231
|
+
arrayStyle.bottom = "8px";
|
199
232
|
style.transform = 'translateY(-100%)';
|
200
233
|
} else {
|
201
234
|
// 居中对齐
|
202
235
|
style.top = rect.top - containerRect.top + containerScroll.top + rect.height / 2;
|
236
|
+
if (targetRect) {
|
237
|
+
arrayStyle.top = "".concat(targetRect.height / 2 - 5.9 / 2, "px");
|
238
|
+
}
|
203
239
|
style.transform = 'translateY(-50%)';
|
204
240
|
}
|
205
241
|
if (_h === 'right') {
|
206
242
|
style.left = rect.right - containerRect.left + containerScroll.left + popupGap;
|
207
243
|
} else {
|
208
244
|
style.left = rect.left - containerRect.left + containerScroll.left - popupGap;
|
245
|
+
arrayStyle.right = "0px";
|
209
246
|
style.transform += ' translateX(-100%)';
|
210
247
|
}
|
211
248
|
} else if (position === 'cover') {
|
212
249
|
style.top = rect.top - containerRect.top + containerScroll.top;
|
213
250
|
style.left = rect.left - containerRect.left + containerScroll.left;
|
214
251
|
}
|
215
|
-
return
|
252
|
+
return {
|
253
|
+
style: style,
|
254
|
+
arrayStyle: arrayStyle
|
255
|
+
};
|
216
256
|
};
|
217
257
|
var getAbsoluteStyle = function getAbsoluteStyle(position) {
|
218
|
-
if (!parentElRef.current) return
|
258
|
+
if (!parentElRef.current) return {
|
259
|
+
style: hideStyle
|
260
|
+
};
|
219
261
|
var rect = context.parentRect;
|
220
262
|
if (scrollElRef !== null && scrollElRef !== void 0 && scrollElRef.current) {
|
221
263
|
var _scrollElRef$current;
|
222
264
|
var visibleRect = ((_scrollElRef$current = scrollElRef.current) === null || _scrollElRef$current === void 0 ? void 0 : _scrollElRef$current.getBoundingClientRect()) || {};
|
223
265
|
if (rect.bottom < visibleRect.top || rect.top > visibleRect.bottom || rect.right < visibleRect.left || rect.left > visibleRect.right) {
|
224
|
-
return
|
266
|
+
return {
|
267
|
+
style: hideStyle
|
268
|
+
};
|
225
269
|
}
|
226
270
|
}
|
227
|
-
var
|
228
|
-
|
271
|
+
var _getAbsolutePositionS = getAbsolutePositionStyle(rect, position),
|
272
|
+
style = _getAbsolutePositionS.style,
|
273
|
+
arrayStyle = _getAbsolutePositionS.arrayStyle;
|
274
|
+
|
275
|
+
// TODO: 如果是版本大于chrome128,需要根据currentCSSZoom处理chrome的bug
|
276
|
+
if (!(0, _utils.isChromeLowerThan)(128)) {
|
277
|
+
// @ts-ignore currentCSSZoom
|
278
|
+
var currentCSSZoom = document.body.currentCSSZoom;
|
279
|
+
if (currentCSSZoom === 1 || !currentCSSZoom) return {
|
280
|
+
style: style,
|
281
|
+
arrayStyle: arrayStyle
|
282
|
+
};
|
283
|
+
if (style.left && typeof style.left === 'number') {
|
284
|
+
style.left = style.left * (1 / currentCSSZoom);
|
285
|
+
}
|
286
|
+
if (style.top && typeof style.top === 'number') {
|
287
|
+
style.top = style.top * (1 / currentCSSZoom);
|
288
|
+
}
|
289
|
+
if (style.right && typeof style.right === 'number') {
|
290
|
+
style.right = style.right * (1 / currentCSSZoom);
|
291
|
+
}
|
292
|
+
if (style.bottom && typeof style.bottom === 'number') {
|
293
|
+
style.bottom = style.bottom * (1 / currentCSSZoom);
|
294
|
+
}
|
295
|
+
}
|
296
|
+
return {
|
297
|
+
style: style,
|
298
|
+
arrayStyle: arrayStyle
|
299
|
+
};
|
229
300
|
};
|
230
301
|
var getStyle = function getStyle() {
|
231
302
|
var newStyle = {};
|
303
|
+
var newArrayStyle = {};
|
232
304
|
var _ref2 = config || {},
|
233
305
|
position = _ref2.position,
|
234
306
|
absolute = _ref2.absolute;
|
235
|
-
if (!position || !show || !parentElRef.current) return
|
307
|
+
if (!position || !show || !parentElRef.current) return {
|
308
|
+
newStyle: style
|
309
|
+
};
|
236
310
|
context.parentRect = parentElRef.current.getBoundingClientRect();
|
237
311
|
if (adjust) {
|
238
312
|
var popupInfo = getPopUpInfo(context.parentRect);
|
@@ -247,21 +321,34 @@ var usePositionStyle = exports.usePositionStyle = function usePositionStyle(conf
|
|
247
321
|
fixedWidth: fixedWidth
|
248
322
|
});
|
249
323
|
} else {
|
250
|
-
|
324
|
+
var _ref3 = getAbsoluteStyle(realPosition),
|
325
|
+
nextStyle = _ref3.style,
|
326
|
+
nextArrayStyle = _ref3.arrayStyle;
|
327
|
+
newStyle = nextStyle;
|
328
|
+
newArrayStyle = nextArrayStyle;
|
251
329
|
}
|
252
330
|
// for animation
|
253
331
|
if (realPosition.indexOf('top') === 0) {
|
254
332
|
newStyle.transformOrigin = 'center bottom';
|
255
333
|
}
|
256
|
-
return
|
334
|
+
return {
|
335
|
+
newStyle: newStyle,
|
336
|
+
newArrayStyle: newArrayStyle
|
337
|
+
};
|
257
338
|
};
|
258
339
|
var updateStyle = (0, _usePersistFn.default)(function () {
|
259
|
-
var
|
340
|
+
var _getStyle = getStyle(),
|
341
|
+
newStyle = _getStyle.newStyle,
|
342
|
+
newArrayStyle = _getStyle.newArrayStyle;
|
260
343
|
if (newStyle && !(0, _shallowEqual.default)(style, newStyle)) {
|
261
344
|
setStyle(newStyle);
|
345
|
+
setArrayStyle(newArrayStyle || {});
|
262
346
|
}
|
263
347
|
});
|
264
348
|
(0, _react.useEffect)(updateStyle, [show, position, absolute, updateKey, fixedWidth]);
|
265
|
-
return
|
349
|
+
return {
|
350
|
+
style: style,
|
351
|
+
arrayStyle: arrayStyle
|
352
|
+
};
|
266
353
|
};
|
267
354
|
var _default = exports.default = usePositionStyle;
|
@@ -12,9 +12,9 @@ declare const useDate: (props: UseDateProps) => {
|
|
12
12
|
isToday: (date: Date) => boolean;
|
13
13
|
isDisabled: (date: Date) => boolean;
|
14
14
|
isActive: (date: Date) => boolean;
|
15
|
-
isInRange: (date: Date) => false | "
|
15
|
+
isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
|
16
16
|
isCurrentMonth: (date: Date) => boolean;
|
17
|
-
handleDayClick: (date: Date) => void;
|
17
|
+
handleDayClick: (date: Date, noClose?: boolean) => void;
|
18
18
|
getDayStr: (date: Date) => number;
|
19
19
|
getWeekStr: (date: Date) => number;
|
20
20
|
getTimeStr: () => string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAmBX,IAAI;2BA6CD,IAAI;yBAgBN,IAAI;0BAiDH,IAAI;+BArEC,IAAI;+BA+CJ,IAAI;
|
1
|
+
{"version":3,"file":"use-date.d.ts","sourceRoot":"","sources":["use-date.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAU/C,QAAA,MAAM,OAAO,UAAW,YAAY;;;;;;;;;;wBAmBX,IAAI;2BA6CD,IAAI;yBAgBN,IAAI;0BAiDH,IAAI;+BArEC,IAAI;+BA+CJ,IAAI,YAAY,OAAO;0BAnB5B,IAAI;2BAIH,IAAI;;gCAIC,IAAI;;CAgFpC,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -101,11 +101,11 @@ var useDate = function useDate(props) {
|
|
101
101
|
var getDateWithTime = function getDateWithTime(date) {
|
102
102
|
return _util.default.getDateWithTime(date, props.value, props.defaultTime, props.min, props.max, options);
|
103
103
|
};
|
104
|
-
var handleDayClick = function handleDayClick(date) {
|
104
|
+
var handleDayClick = function handleDayClick(date, noClose) {
|
105
105
|
var _props$onChange;
|
106
106
|
if (isDisabled(date)) return;
|
107
107
|
var newDate = getDateWithTime(date);
|
108
|
-
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate);
|
108
|
+
(_props$onChange = props.onChange) === null || _props$onChange === void 0 || _props$onChange.call(props, newDate, noClose);
|
109
109
|
setCurrent(newDate);
|
110
110
|
};
|
111
111
|
var getTimeStr = function getTimeStr() {
|
@@ -4,7 +4,7 @@ export interface UseDateProps {
|
|
4
4
|
defaultCurrent?: Date;
|
5
5
|
onCurrentChange?: (date: Date) => void;
|
6
6
|
value?: Date;
|
7
|
-
onChange?: (date: Date) => void;
|
7
|
+
onChange?: (date: Date, noClose?: boolean) => void;
|
8
8
|
min?: Date;
|
9
9
|
max?: Date;
|
10
10
|
type?: 'date' | 'week' | 'datetime';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-date.type.d.ts","sourceRoot":"","sources":["use-date.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;
|
1
|
+
{"version":3,"file":"use-date.type.d.ts","sourceRoot":"","sources":["use-date.type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,SAAS,CAAC,EAAE,KAAK,CAAC,IAAI,GAAG,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACvC,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACnD,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,GAAG,CAAC,EAAE,IAAI,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACrC,OAAO,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACH"}
|
@@ -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;;;;;;;;;;;;;;;;yBA4Ic,gBAAgB;
|
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;;;;;;;;;;;;;;;;yBA4Ic,gBAAgB;iCAgCR,MAAM,SAAS,MAAM;yCA/HrD,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;;+BAQH,IAAI,YAAY,OAAO,GAAG,KAAK,GAAG,SAAS;;CA0KvF,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
@@ -229,7 +229,7 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
|
|
229
229
|
}
|
230
230
|
} else {
|
231
231
|
var _props$onChange;
|
232
|
-
var emptyValue = props.clearWithUndefined ? undefined : '';
|
232
|
+
var emptyValue = props.clearWithUndefined || props.clearToUndefined ? undefined : '';
|
233
233
|
var v = emptyValue;
|
234
234
|
if (range) {
|
235
235
|
v = [emptyValue, emptyValue];
|
@@ -238,6 +238,8 @@ var useDatePickerFormat = function useDatePickerFormat(props) {
|
|
238
238
|
v = [props.value[0], emptyValue];
|
239
239
|
} else if (props.value[1] && disabledStatus === 'right') {
|
240
240
|
v = [emptyValue, props.value[1]];
|
241
|
+
} else if (props.clearToUndefined) {
|
242
|
+
v = undefined;
|
241
243
|
}
|
242
244
|
}
|
243
245
|
}
|
@@ -15,6 +15,7 @@ export interface UseDatePickerFormatProps<Value extends DatePickerValueType> {
|
|
15
15
|
} | undefined;
|
16
16
|
clearable: boolean | undefined;
|
17
17
|
clearWithUndefined: boolean | undefined;
|
18
|
+
clearToUndefined?: boolean;
|
18
19
|
onClear: (() => void) | undefined;
|
19
20
|
allowSingle: boolean | undefined;
|
20
21
|
defaultCurrent: DatePickerValueType;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-datepicker-format.type.d.ts","sourceRoot":"","sources":["use-datepicker-format.type.ts"],"names":[],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=> boolean;
|
10
10
|
isDisabled: (date: Date) => boolean;
|
11
11
|
isActive: (date: Date) => boolean;
|
12
|
-
isInRange: (date: Date) => false | "
|
12
|
+
isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
|
13
13
|
handleMonthClick: (date: Date) => void;
|
14
14
|
getMonthStr: (date: Date) => number;
|
15
15
|
};
|
@@ -9,7 +9,7 @@ declare const useQuarter: (props: UseMonthProps) => {
|
|
9
9
|
isNow: (date: Date) => boolean;
|
10
10
|
isDisabled: (date: Date) => boolean;
|
11
11
|
isActive: (date: Date) => boolean;
|
12
|
-
isInRange: (date: Date) => false | "
|
12
|
+
isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
|
13
13
|
handleQuarterClick: (date: Date) => void;
|
14
14
|
getQuarterStr: (date: Date) => number;
|
15
15
|
};
|
@@ -11,7 +11,7 @@ declare const useYear: (props: UseYearProps) => {
|
|
11
11
|
isNow: (date: Date) => boolean;
|
12
12
|
isDisabled: (date: Date) => boolean;
|
13
13
|
isActive: (date: Date) => boolean;
|
14
|
-
isInRange: (date: Date) => false | "
|
14
|
+
isInRange: (date: Date) => false | "end" | "start" | "start-end" | "in";
|
15
15
|
handleYearClick: (date: Date) => void;
|
16
16
|
getYearStr: (date: Date) => number;
|
17
17
|
};
|
@@ -36,7 +36,7 @@ declare function setTime(date: Date, old: Date, options?: DateOptions): Date;
|
|
36
36
|
declare function cloneTime(date: Date, old: DateTimeType, fmt?: string, options?: DateOptions): Date;
|
37
37
|
declare function formatDateWithDefaultTime(date: Date, value: Date | undefined, defaultTime: Date | undefined, fmt: string, options: DateOptions): string | Date;
|
38
38
|
declare function clearHMS(date: Date, options: DateOptions): Date;
|
39
|
-
declare function compareDateArray(arr1: Date[], arr2: Date[], type: string | undefined, options: DateOptions): boolean;
|
39
|
+
declare function compareDateArray(arr1: Date[], arr2: Date[], type: string | undefined, options: DateOptions, fmt?: string): boolean;
|
40
40
|
declare function resetTimeByFormat(value: Date | undefined, fo: string, options: DateOptions): Date | null;
|
41
41
|
declare function formatted(date: Date, fmt: string | ((date: Date, offsetDate: Date) => string), options: DateOptions): string;
|
42
42
|
declare function getStartYear(date: Date, options: DateOptions): number;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"AAaA,MAAM,MAAM,YAAY,GAAG,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAC9D,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,OAAO,GACP,SAAS,GACT,MAAM,GACN,KAAK,GACL,QAAQ,GACR,QAAQ,GACR,MAAM,GACN,MAAM,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAKjD,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAqBD,eAAO,MAAM,aAAa,SAAU,MAAM,uBAmBzC,CAAC;AAOF,iBAAS,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,GAAE,WAAgB,EAAE,IAAI,UAAQ,QAa3E;AAED,iBAAS,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKhE;AAED,iBAAS,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKlE;AAED,iBAAS,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKnE;AAED,iBAAS,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,QAKjE;AAED,iBAAS,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,W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WASb;AAcD,iBAAS,iBAAiB,CAAC,KAAK,EAAE,IAAI,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,eAInF;AAED,iBAAS,SAAS,CAChB,IAAI,EAAE,IAAI,EACV,GAAG,EAAE,MAAM,GAAG,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,KAAK,MAAM,CAAC,EACxD,OAAO,EAAE,WAAW,UAKrB;AAED,iBAAS,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,UAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBD,wBAsCE"}
|
@@ -327,11 +327,12 @@ function clearHMS(date, options) {
|
|
327
327
|
function compareDateArray(arr1, arr2) {
|
328
328
|
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'date';
|
329
329
|
var options = arguments.length > 3 ? arguments[3] : undefined;
|
330
|
+
var fmt = arguments.length > 4 ? arguments[4] : undefined;
|
330
331
|
if (!arr1 || !arr2 || arr1.length !== arr2.length) return false;
|
331
332
|
return arr1.every(function (v, i) {
|
332
333
|
if (!v || !arr2[i]) return false;
|
333
334
|
if (type === 'week') return format(v, 'gggg ww', options) === format(arr2[i], 'gggg ww', options);
|
334
|
-
return v.getTime() === arr2[i].getTime();
|
335
|
+
return toDateWithFormat(v, fmt).getTime() === toDateWithFormat(arr2[i], fmt).getTime();
|
335
336
|
});
|
336
337
|
}
|
337
338
|
function getFormat(fo) {
|
@@ -192,11 +192,11 @@ function useFormControl(props) {
|
|
192
192
|
if (inForm && controlFunc) {
|
193
193
|
if ((0, _is.isArray)(name)) {
|
194
194
|
name.forEach(function (n) {
|
195
|
-
controlFunc.unbind(n, reserveAble);
|
195
|
+
controlFunc.unbind(n, reserveAble, validateFiled, update);
|
196
196
|
updateError(n, undefined);
|
197
197
|
});
|
198
198
|
} else {
|
199
|
-
controlFunc.unbind(name, reserveAble);
|
199
|
+
controlFunc.unbind(name, reserveAble, validateFiled, update);
|
200
200
|
updateError(name, undefined);
|
201
201
|
}
|
202
202
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,
|
1
|
+
{"version":3,"file":"use-form.d.ts","sourceRoot":"","sources":["use-form.ts"],"names":[],"mappings":";AAyBA,OAAO,EAAe,aAAa,EAAE,YAAY,EAAE,gBAAgB,EAAwB,MAAM,iBAAiB,CAAC;AACnH,OAAO,EAAe,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAI5D,QAAA,MAAM,OAAO;;;;;;;;;wBAuK8B;gBAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;aAAE;8BARzB,MAAM;oCAyDD,OAAO;;6BAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;oCAdrB,MAAM,EAAE;sCAvEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;qCAmI5D,MAAM;gCAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;gCAKpC,MAAM,SAAS,MAAM;;;;;;oBA5CpB;YAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;SAAE;0BARzB,MAAM;gCAyDD,OAAO;;yBAfb,MAAM,KAAK,KAAK,GAAG,SAAS;;gCAdrB,MAAM,EAAE;kCAvEN,MAAM,GAAG,MAAM,EAAE,mBAAgB,QAAQ,IAAI,CAAC;iCAmI5D,MAAM;4BAzCE,MAAM,SAAS,MAAM,UAAU,KAAK;4BAKpC,MAAM,SAAS,MAAM;;CAoQ9D,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
@@ -74,8 +74,10 @@ var useForm = function useForm(props) {
|
|
74
74
|
var _context$flowMap$glob;
|
75
75
|
if (!name) {
|
76
76
|
Object.keys(context.updateMap).forEach(function (key) {
|
77
|
-
var _context$updateMap$ke
|
78
|
-
(_context$updateMap$ke =
|
77
|
+
var _context$updateMap$ke;
|
78
|
+
(_context$updateMap$ke = context.updateMap[key]) === null || _context$updateMap$ke === void 0 || _context$updateMap$ke.forEach(function (update) {
|
79
|
+
update(context.value, context.errors, context.serverErrors);
|
80
|
+
});
|
79
81
|
});
|
80
82
|
Object.keys(context.flowMap).forEach(function (key) {
|
81
83
|
context.flowMap[key].forEach(function (update) {
|
@@ -85,8 +87,10 @@ var useForm = function useForm(props) {
|
|
85
87
|
} else {
|
86
88
|
var names = (0, _utils.isArray)(name) ? name : [name];
|
87
89
|
names.forEach(function (key) {
|
88
|
-
var _context$updateMap$ke2, _context$
|
89
|
-
(_context$updateMap$ke2 =
|
90
|
+
var _context$updateMap$ke2, _context$flowMap$key;
|
91
|
+
(_context$updateMap$ke2 = context.updateMap[key]) === null || _context$updateMap$ke2 === void 0 || _context$updateMap$ke2.forEach(function (update) {
|
92
|
+
update(context.value, context.errors, context.serverErrors);
|
93
|
+
});
|
90
94
|
(_context$flowMap$key = context.flowMap[key]) === null || _context$flowMap$key === void 0 || _context$flowMap$key.forEach(function (update) {
|
91
95
|
update();
|
92
96
|
});
|
@@ -142,9 +146,11 @@ var useForm = function useForm(props) {
|
|
142
146
|
}) : Object.keys(context.validateMap);
|
143
147
|
var validates = files2.map(function (key) {
|
144
148
|
var validateField = context.validateMap[key];
|
145
|
-
return validateField(
|
149
|
+
return Array.from(validateField).map(function (validate) {
|
150
|
+
return validate(key, (0, _utils.deepGet)(context.value, key), context.value, config);
|
151
|
+
});
|
146
152
|
});
|
147
|
-
Promise.all(validates).then(function (results) {
|
153
|
+
Promise.all(validates.flat()).then(function (results) {
|
148
154
|
var error = results.find(function (n) {
|
149
155
|
return n !== true;
|
150
156
|
});
|
@@ -189,8 +195,10 @@ var useForm = function useForm(props) {
|
|
189
195
|
Object.keys(vals).forEach(function (key) {
|
190
196
|
(0, _utils.deepSet)(draft, key, vals[key], deepSetOptions);
|
191
197
|
if (option.validate) {
|
192
|
-
var _context$validateMap
|
193
|
-
(_context$validateMap$ =
|
198
|
+
var _context$validateMap$;
|
199
|
+
(_context$validateMap$ = context.validateMap[key]) === null || _context$validateMap$ === void 0 || _context$validateMap$.forEach(function (validate) {
|
200
|
+
validate(key, vals[key], (0, _immer.current)(draft));
|
201
|
+
});
|
194
202
|
}
|
195
203
|
});
|
196
204
|
});
|
@@ -334,12 +342,17 @@ var useForm = function useForm(props) {
|
|
334
342
|
var controlFunc = (0, _useLatestObj.default)({
|
335
343
|
bind: function bind(n, df, validate, updateFn) {
|
336
344
|
if (context.names.has(n)) {
|
337
|
-
console.
|
338
|
-
return;
|
345
|
+
console.warn("name \"".concat(n, "\" already exist"));
|
339
346
|
}
|
340
347
|
context.names.add(n);
|
341
|
-
context.validateMap[n]
|
342
|
-
|
348
|
+
if (!context.validateMap[n]) {
|
349
|
+
context.validateMap[n] = new Set();
|
350
|
+
}
|
351
|
+
context.validateMap[n].add(validate);
|
352
|
+
if (!context.updateMap[n]) {
|
353
|
+
context.updateMap[n] = new Set();
|
354
|
+
}
|
355
|
+
context.updateMap[n].add(updateFn);
|
343
356
|
context.removeArr.delete(n);
|
344
357
|
if (df !== undefined && (0, _utils.deepGet)(context.value, n) === undefined) {
|
345
358
|
if (!context.mounted) context.defaultValues[n] = df;
|
@@ -349,11 +362,19 @@ var useForm = function useForm(props) {
|
|
349
362
|
}
|
350
363
|
update(n);
|
351
364
|
},
|
352
|
-
unbind: function unbind(n, reserveAble) {
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
365
|
+
unbind: function unbind(n, reserveAble, validateFiled, update) {
|
366
|
+
var validateFieldSet = context.validateMap[n];
|
367
|
+
if (validateFiled && validateFieldSet.has(validateFiled)) {
|
368
|
+
validateFieldSet.delete(validateFiled);
|
369
|
+
}
|
370
|
+
var updateFieldSet = context.updateMap[n];
|
371
|
+
if (update && updateFieldSet.has(update)) {
|
372
|
+
updateFieldSet.delete(update);
|
373
|
+
}
|
374
|
+
if (validateFieldSet.size === 0 && updateFieldSet.size === 0) {
|
375
|
+
context.names.delete(n);
|
376
|
+
delete context.defaultValues[n];
|
377
|
+
}
|
357
378
|
if (!reserveAble && !context.removeLock) {
|
358
379
|
addRemove(n);
|
359
380
|
}
|
@@ -428,12 +449,12 @@ var useForm = function useForm(props) {
|
|
428
449
|
React.useEffect(function () {
|
429
450
|
// 服务端错误更新
|
430
451
|
if (!props.error) context.serverErrors = {};else {
|
431
|
-
var
|
452
|
+
var errors = Object.keys(props.error).reduce(function (prev, cur) {
|
432
453
|
var item = props.error[cur];
|
433
454
|
var error = item instanceof Error ? item : new Error(item);
|
434
455
|
return _objectSpread(_objectSpread({}, prev), {}, _defineProperty({}, cur, error));
|
435
456
|
}, {});
|
436
|
-
context.serverErrors =
|
457
|
+
context.serverErrors = errors;
|
437
458
|
}
|
438
459
|
update();
|
439
460
|
}, [props.error]);
|
@@ -2,12 +2,15 @@
|
|
2
2
|
import { ReactNode } from 'react';
|
3
3
|
import { AddNoProps, ObjectType } from '../../common/type';
|
4
4
|
import { FormItemRule } from '../../utils/rule/rule.type';
|
5
|
+
import { FormError } from '../../utils';
|
6
|
+
export type ValidateFn = (name: string, value: any, formData: ObjectType, config?: {
|
7
|
+
ignoreBind?: boolean;
|
8
|
+
}) => Promise<boolean | FormError>;
|
9
|
+
export type UpdateFn = (formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void;
|
5
10
|
export interface FormContextValueType {
|
6
11
|
func?: {
|
7
|
-
unbind: (n: string, reserveAble?: boolean) => void;
|
8
|
-
bind: (n: string, df: any, validate:
|
9
|
-
ignoreBind?: boolean;
|
10
|
-
}) => void, update: (formValue: ObjectType, errors: ObjectType<Error>, serverErrors: ObjectType<Error>) => void) => void;
|
12
|
+
unbind: (n: string, reserveAble?: boolean, validate?: ValidateFn, update?: UpdateFn) => void;
|
13
|
+
bind: (n: string, df: any, validate: ValidateFn, update: UpdateFn) => void;
|
11
14
|
combineRules: <ValueItem>(name: string, propRules: FormItemRule<ValueItem>) => FormItemRule<ValueItem>;
|
12
15
|
watch: (names: string[] | undefined, update: () => void) => void;
|
13
16
|
unWatch: (names: string[] | undefined, update: () => void) => void;
|
@@ -149,7 +152,9 @@ export interface BaseFormProps<T> extends FormCommonConfig {
|
|
149
152
|
export type UseFormProps<T> = BaseFormProps<T>;
|
150
153
|
export type FormContext = {
|
151
154
|
defaultValues: ObjectType;
|
152
|
-
validateMap: ObjectType
|
155
|
+
validateMap: ObjectType<Set<(name: string, v: any, formValue: ObjectType, config?: {
|
156
|
+
ignoreBind?: boolean;
|
157
|
+
}) => Promise<boolean | FormError>>>;
|
153
158
|
removeArr: Set<string>;
|
154
159
|
removeTimer?: number | NodeJS.Timeout;
|
155
160
|
names: Set<string>;
|
@@ -157,7 +162,7 @@ export type FormContext = {
|
|
157
162
|
lastValue: ObjectType | undefined;
|
158
163
|
resetTime: number;
|
159
164
|
mounted: boolean;
|
160
|
-
updateMap: ObjectType
|
165
|
+
updateMap: ObjectType<Set<(formValue: ObjectType, errors: ObjectType<Error | undefined>, serverErrors: ObjectType<Error | undefined>) => void>>;
|
161
166
|
flowMap: ObjectType<Set<() => void>>;
|
162
167
|
value: ObjectType;
|
163
168
|
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;
|
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,OA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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;CACrB,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" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "
|
8
|
+
type: "search" | "color" | "button" | "time" | "image" | "text" | "reset" | "submit" | "email" | "url" | "range" | "tel" | (string & {}) | "checkbox" | "radio" | "hidden" | "date" | "datetime-local" | "file" | "month" | "password" | "week" | undefined;
|
9
9
|
};
|
10
10
|
export default useInputFormat;
|
11
11
|
//# sourceMappingURL=use-input-format.d.ts.map
|