@zat-design/sisyphus-react 3.4.10-beta.11 → 3.4.10-beta.13
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/es/ProEditTable/components/RenderField/index.js +29 -32
- package/es/ProForm/components/base/DatePicker/useDateLimit.d.ts +9 -0
- package/es/ProForm/components/base/DatePicker/useDateLimit.js +15 -0
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +29 -32
- package/lib/ProForm/components/base/DatePicker/useDateLimit.d.ts +9 -0
- package/lib/ProForm/components/base/DatePicker/useDateLimit.js +22 -0
- package/lib/ProForm/components/base/InputNumber/index.js +1 -1
- package/package.json +1 -1
|
@@ -160,11 +160,6 @@ var RenderField = function RenderField(_ref) {
|
|
|
160
160
|
_formItemProps.valuePropName = 'checked';
|
|
161
161
|
valueType = 'switch';
|
|
162
162
|
}
|
|
163
|
-
// 针对Percentage特殊处理
|
|
164
|
-
if (type === 'Percentage') {
|
|
165
|
-
type = 'InputNumber';
|
|
166
|
-
valueType = 'percentage';
|
|
167
|
-
}
|
|
168
163
|
/**
|
|
169
164
|
* 针对一些特殊类型,基于formItem的normalize与getValueProps进行默认值类型转换
|
|
170
165
|
* @returns {}
|
|
@@ -320,49 +315,50 @@ var RenderField = function RenderField(_ref) {
|
|
|
320
315
|
_args = [].concat(args);
|
|
321
316
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
322
317
|
row = form.getFieldValue(rowPath, true);
|
|
318
|
+
if (type === 'InputNumber' && column.name) row[column.name] = args[0];
|
|
323
319
|
orgRow = cloneDeep(row);
|
|
324
320
|
if (!onFieldChange) {
|
|
325
|
-
_context.next =
|
|
321
|
+
_context.next = 19;
|
|
326
322
|
break;
|
|
327
323
|
}
|
|
328
324
|
_args = formatArgs(args);
|
|
329
325
|
_args[1] = row;
|
|
330
326
|
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
|
331
327
|
if (!_context.t0) {
|
|
332
|
-
_context.next =
|
|
328
|
+
_context.next = 13;
|
|
333
329
|
break;
|
|
334
330
|
}
|
|
335
|
-
_context.next =
|
|
331
|
+
_context.next = 13;
|
|
336
332
|
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, _toConsumableArray(_args));
|
|
337
|
-
case
|
|
333
|
+
case 13:
|
|
338
334
|
_context.t1 = onFieldChange;
|
|
339
335
|
if (!_context.t1) {
|
|
340
|
-
_context.next =
|
|
336
|
+
_context.next = 17;
|
|
341
337
|
break;
|
|
342
338
|
}
|
|
343
|
-
_context.next =
|
|
339
|
+
_context.next = 17;
|
|
344
340
|
return onFieldChange.apply(void 0, _toConsumableArray(_args));
|
|
345
|
-
case
|
|
346
|
-
_context.next =
|
|
341
|
+
case 17:
|
|
342
|
+
_context.next = 28;
|
|
347
343
|
break;
|
|
348
|
-
case
|
|
344
|
+
case 19:
|
|
349
345
|
_args = _args.concat([row, index, form]);
|
|
350
346
|
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
351
347
|
if (!_context.t2) {
|
|
352
|
-
_context.next =
|
|
348
|
+
_context.next = 24;
|
|
353
349
|
break;
|
|
354
350
|
}
|
|
355
|
-
_context.next =
|
|
351
|
+
_context.next = 24;
|
|
356
352
|
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, _toConsumableArray(_args));
|
|
357
|
-
case
|
|
353
|
+
case 24:
|
|
358
354
|
_context.t3 = onChange;
|
|
359
355
|
if (!_context.t3) {
|
|
360
|
-
_context.next =
|
|
356
|
+
_context.next = 28;
|
|
361
357
|
break;
|
|
362
358
|
}
|
|
363
|
-
_context.next =
|
|
359
|
+
_context.next = 28;
|
|
364
360
|
return onChange.apply(void 0, _toConsumableArray(_args));
|
|
365
|
-
case
|
|
361
|
+
case 28:
|
|
366
362
|
// 判断属性是否变动
|
|
367
363
|
form.setFieldValue(rowPath, row);
|
|
368
364
|
if (!isEqual(orgRow, row)) {
|
|
@@ -381,7 +377,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
381
377
|
d: Date.now()
|
|
382
378
|
}
|
|
383
379
|
});
|
|
384
|
-
case
|
|
380
|
+
case 31:
|
|
385
381
|
case "end":
|
|
386
382
|
return _context.stop();
|
|
387
383
|
}
|
|
@@ -411,24 +407,25 @@ var RenderField = function RenderField(_ref) {
|
|
|
411
407
|
_args = formatArgs([].concat(args));
|
|
412
408
|
rowPath = [].concat(_toConsumableArray(namePath), [index]);
|
|
413
409
|
row = form.getFieldValue(rowPath, true);
|
|
410
|
+
if (type === 'InputNumber' && column.name) row[column.name] = args[0];
|
|
414
411
|
orgRow = cloneDeep(row);
|
|
415
412
|
_args[1] = row;
|
|
416
413
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
417
414
|
if (!_context2.t0) {
|
|
418
|
-
_context2.next =
|
|
415
|
+
_context2.next = 11;
|
|
419
416
|
break;
|
|
420
417
|
}
|
|
421
|
-
_context2.next =
|
|
418
|
+
_context2.next = 11;
|
|
422
419
|
return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, _toConsumableArray(_args));
|
|
423
|
-
case
|
|
420
|
+
case 11:
|
|
424
421
|
_context2.t1 = onBlur;
|
|
425
422
|
if (!_context2.t1) {
|
|
426
|
-
_context2.next =
|
|
423
|
+
_context2.next = 15;
|
|
427
424
|
break;
|
|
428
425
|
}
|
|
429
|
-
_context2.next =
|
|
426
|
+
_context2.next = 15;
|
|
430
427
|
return onBlur.apply(void 0, _toConsumableArray(_args));
|
|
431
|
-
case
|
|
428
|
+
case 15:
|
|
432
429
|
// 判断属性是否变动
|
|
433
430
|
form.setFieldValue(rowPath, row);
|
|
434
431
|
if (!isEqual(orgRow, row)) {
|
|
@@ -441,23 +438,23 @@ var RenderField = function RenderField(_ref) {
|
|
|
441
438
|
}
|
|
442
439
|
}
|
|
443
440
|
if (!isCell) {
|
|
444
|
-
_context2.next =
|
|
441
|
+
_context2.next = 21;
|
|
445
442
|
break;
|
|
446
443
|
}
|
|
447
|
-
_context2.next =
|
|
444
|
+
_context2.next = 20;
|
|
448
445
|
return form.validateFields([cellName]);
|
|
449
|
-
case
|
|
446
|
+
case 20:
|
|
450
447
|
setState({
|
|
451
448
|
cellNamePath: []
|
|
452
449
|
});
|
|
453
|
-
case
|
|
450
|
+
case 21:
|
|
454
451
|
// 单行编辑时需要 强制更新视图
|
|
455
452
|
setState({
|
|
456
453
|
forceUpdate: {
|
|
457
454
|
d: Date.now()
|
|
458
455
|
}
|
|
459
456
|
});
|
|
460
|
-
case
|
|
457
|
+
case 22:
|
|
461
458
|
case "end":
|
|
462
459
|
return _context2.stop();
|
|
463
460
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DurationInputArg1, DurationInputArg2, Moment } from 'moment';
|
|
2
|
+
interface Props {
|
|
3
|
+
range?: [Moment?, Moment?];
|
|
4
|
+
limit?: [DurationInputArg1, DurationInputArg2];
|
|
5
|
+
}
|
|
6
|
+
export declare const useDateLimit: (props: Props) => {
|
|
7
|
+
onCalendarChange: (val: any) => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
export var useDateLimit = function useDateLimit(props) {
|
|
4
|
+
var range = props.range,
|
|
5
|
+
limit = props.limit;
|
|
6
|
+
var _useState = useState(),
|
|
7
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8
|
+
dates = _useState2[0],
|
|
9
|
+
setDates = _useState2[1];
|
|
10
|
+
return {
|
|
11
|
+
onCalendarChange: function onCalendarChange(val) {
|
|
12
|
+
return setDates(val);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -253,7 +253,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
253
253
|
value = limitNumber(value, limit);
|
|
254
254
|
break;
|
|
255
255
|
}
|
|
256
|
-
onBlur
|
|
256
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, Number(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value));
|
|
257
257
|
};
|
|
258
258
|
// 获得焦点
|
|
259
259
|
var handleFocus = function handleFocus(e) {
|
|
@@ -163,11 +163,6 @@ var RenderField = function RenderField(_ref) {
|
|
|
163
163
|
_formItemProps.valuePropName = 'checked';
|
|
164
164
|
valueType = 'switch';
|
|
165
165
|
}
|
|
166
|
-
// 针对Percentage特殊处理
|
|
167
|
-
if (type === 'Percentage') {
|
|
168
|
-
type = 'InputNumber';
|
|
169
|
-
valueType = 'percentage';
|
|
170
|
-
}
|
|
171
166
|
/**
|
|
172
167
|
* 针对一些特殊类型,基于formItem的normalize与getValueProps进行默认值类型转换
|
|
173
168
|
* @returns {}
|
|
@@ -323,49 +318,50 @@ var RenderField = function RenderField(_ref) {
|
|
|
323
318
|
_args = [].concat(args);
|
|
324
319
|
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
325
320
|
row = form.getFieldValue(rowPath, true);
|
|
321
|
+
if (type === 'InputNumber' && column.name) row[column.name] = args[0];
|
|
326
322
|
orgRow = (0, _lodash.cloneDeep)(row);
|
|
327
323
|
if (!onFieldChange) {
|
|
328
|
-
_context.next =
|
|
324
|
+
_context.next = 19;
|
|
329
325
|
break;
|
|
330
326
|
}
|
|
331
327
|
_args = formatArgs(args);
|
|
332
328
|
_args[1] = row;
|
|
333
329
|
_context.t0 = (_TargetComponent = TargetComponent) === null || _TargetComponent === void 0 ? void 0 : (_TargetComponent$prop = _TargetComponent.props) === null || _TargetComponent$prop === void 0 ? void 0 : _TargetComponent$prop.onFieldChange;
|
|
334
330
|
if (!_context.t0) {
|
|
335
|
-
_context.next =
|
|
331
|
+
_context.next = 13;
|
|
336
332
|
break;
|
|
337
333
|
}
|
|
338
|
-
_context.next =
|
|
334
|
+
_context.next = 13;
|
|
339
335
|
return (_TargetComponent$prop2 = TargetComponent.props).onFieldChange.apply(_TargetComponent$prop2, (0, _toConsumableArray2.default)(_args));
|
|
340
|
-
case
|
|
336
|
+
case 13:
|
|
341
337
|
_context.t1 = onFieldChange;
|
|
342
338
|
if (!_context.t1) {
|
|
343
|
-
_context.next =
|
|
339
|
+
_context.next = 17;
|
|
344
340
|
break;
|
|
345
341
|
}
|
|
346
|
-
_context.next =
|
|
342
|
+
_context.next = 17;
|
|
347
343
|
return onFieldChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
348
|
-
case
|
|
349
|
-
_context.next =
|
|
344
|
+
case 17:
|
|
345
|
+
_context.next = 28;
|
|
350
346
|
break;
|
|
351
|
-
case
|
|
347
|
+
case 19:
|
|
352
348
|
_args = _args.concat([row, index, form]);
|
|
353
349
|
_context.t2 = (_TargetComponent2 = TargetComponent) === null || _TargetComponent2 === void 0 ? void 0 : (_TargetComponent2$pro = _TargetComponent2.props) === null || _TargetComponent2$pro === void 0 ? void 0 : _TargetComponent2$pro.onChange;
|
|
354
350
|
if (!_context.t2) {
|
|
355
|
-
_context.next =
|
|
351
|
+
_context.next = 24;
|
|
356
352
|
break;
|
|
357
353
|
}
|
|
358
|
-
_context.next =
|
|
354
|
+
_context.next = 24;
|
|
359
355
|
return (_TargetComponent$prop3 = TargetComponent.props).onChange.apply(_TargetComponent$prop3, (0, _toConsumableArray2.default)(_args));
|
|
360
|
-
case
|
|
356
|
+
case 24:
|
|
361
357
|
_context.t3 = onChange;
|
|
362
358
|
if (!_context.t3) {
|
|
363
|
-
_context.next =
|
|
359
|
+
_context.next = 28;
|
|
364
360
|
break;
|
|
365
361
|
}
|
|
366
|
-
_context.next =
|
|
362
|
+
_context.next = 28;
|
|
367
363
|
return onChange.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
368
|
-
case
|
|
364
|
+
case 28:
|
|
369
365
|
// 判断属性是否变动
|
|
370
366
|
form.setFieldValue(rowPath, row);
|
|
371
367
|
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
@@ -384,7 +380,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
384
380
|
d: Date.now()
|
|
385
381
|
}
|
|
386
382
|
});
|
|
387
|
-
case
|
|
383
|
+
case 31:
|
|
388
384
|
case "end":
|
|
389
385
|
return _context.stop();
|
|
390
386
|
}
|
|
@@ -414,24 +410,25 @@ var RenderField = function RenderField(_ref) {
|
|
|
414
410
|
_args = formatArgs([].concat(args));
|
|
415
411
|
rowPath = [].concat((0, _toConsumableArray2.default)(namePath), [index]);
|
|
416
412
|
row = form.getFieldValue(rowPath, true);
|
|
413
|
+
if (type === 'InputNumber' && column.name) row[column.name] = args[0];
|
|
417
414
|
orgRow = (0, _lodash.cloneDeep)(row);
|
|
418
415
|
_args[1] = row;
|
|
419
416
|
_context2.t0 = (_TargetComponent3 = TargetComponent) === null || _TargetComponent3 === void 0 ? void 0 : (_TargetComponent3$pro = _TargetComponent3.props) === null || _TargetComponent3$pro === void 0 ? void 0 : _TargetComponent3$pro.onBlur;
|
|
420
417
|
if (!_context2.t0) {
|
|
421
|
-
_context2.next =
|
|
418
|
+
_context2.next = 11;
|
|
422
419
|
break;
|
|
423
420
|
}
|
|
424
|
-
_context2.next =
|
|
421
|
+
_context2.next = 11;
|
|
425
422
|
return (_TargetComponent$prop4 = TargetComponent.props).onBlur.apply(_TargetComponent$prop4, (0, _toConsumableArray2.default)(_args));
|
|
426
|
-
case
|
|
423
|
+
case 11:
|
|
427
424
|
_context2.t1 = onBlur;
|
|
428
425
|
if (!_context2.t1) {
|
|
429
|
-
_context2.next =
|
|
426
|
+
_context2.next = 15;
|
|
430
427
|
break;
|
|
431
428
|
}
|
|
432
|
-
_context2.next =
|
|
429
|
+
_context2.next = 15;
|
|
433
430
|
return onBlur.apply(void 0, (0, _toConsumableArray2.default)(_args));
|
|
434
|
-
case
|
|
431
|
+
case 15:
|
|
435
432
|
// 判断属性是否变动
|
|
436
433
|
form.setFieldValue(rowPath, row);
|
|
437
434
|
if (!(0, _lodash.isEqual)(orgRow, row)) {
|
|
@@ -444,23 +441,23 @@ var RenderField = function RenderField(_ref) {
|
|
|
444
441
|
}
|
|
445
442
|
}
|
|
446
443
|
if (!isCell) {
|
|
447
|
-
_context2.next =
|
|
444
|
+
_context2.next = 21;
|
|
448
445
|
break;
|
|
449
446
|
}
|
|
450
|
-
_context2.next =
|
|
447
|
+
_context2.next = 20;
|
|
451
448
|
return form.validateFields([cellName]);
|
|
452
|
-
case
|
|
449
|
+
case 20:
|
|
453
450
|
setState({
|
|
454
451
|
cellNamePath: []
|
|
455
452
|
});
|
|
456
|
-
case
|
|
453
|
+
case 21:
|
|
457
454
|
// 单行编辑时需要 强制更新视图
|
|
458
455
|
setState({
|
|
459
456
|
forceUpdate: {
|
|
460
457
|
d: Date.now()
|
|
461
458
|
}
|
|
462
459
|
});
|
|
463
|
-
case
|
|
460
|
+
case 22:
|
|
464
461
|
case "end":
|
|
465
462
|
return _context2.stop();
|
|
466
463
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DurationInputArg1, DurationInputArg2, Moment } from 'moment';
|
|
2
|
+
interface Props {
|
|
3
|
+
range?: [Moment?, Moment?];
|
|
4
|
+
limit?: [DurationInputArg1, DurationInputArg2];
|
|
5
|
+
}
|
|
6
|
+
export declare const useDateLimit: (props: Props) => {
|
|
7
|
+
onCalendarChange: (val: any) => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useDateLimit = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var useDateLimit = exports.useDateLimit = function useDateLimit(props) {
|
|
11
|
+
var range = props.range,
|
|
12
|
+
limit = props.limit;
|
|
13
|
+
var _useState = (0, _react.useState)(),
|
|
14
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
15
|
+
dates = _useState2[0],
|
|
16
|
+
setDates = _useState2[1];
|
|
17
|
+
return {
|
|
18
|
+
onCalendarChange: function onCalendarChange(val) {
|
|
19
|
+
return setDates(val);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -257,7 +257,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
257
257
|
value = limitNumber(value, limit);
|
|
258
258
|
break;
|
|
259
259
|
}
|
|
260
|
-
onBlur
|
|
260
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(value, Number(e === null || e === void 0 ? void 0 : (_e$target2 = e.target) === null || _e$target2 === void 0 ? void 0 : _e$target2.value));
|
|
261
261
|
};
|
|
262
262
|
// 获得焦点
|
|
263
263
|
var handleFocus = function handleFocus(e) {
|