@innoways/drip-form-theme-antd 9.0.12 → 9.0.14
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/CHANGELOG.md +18 -0
- package/dist/index.js +47 -37
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- refactor: simplify DatePickerField component by extracting value and change handlers 9.0.14
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @innoways/hooks@9.0.14
|
|
10
|
+
- @innoways/utils@9.0.14
|
|
11
|
+
|
|
12
|
+
## 9.0.13
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- fix: applied Enter fieldKey, based on that field value dates will be disabled config 9.0.13
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @innoways/hooks@9.0.13
|
|
19
|
+
- @innoways/utils@9.0.13
|
|
20
|
+
|
|
3
21
|
## 9.0.12
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.js
CHANGED
|
@@ -22352,12 +22352,12 @@ var config$8 = {
|
|
|
22352
22352
|
type: 'switch'
|
|
22353
22353
|
}
|
|
22354
22354
|
}, {
|
|
22355
|
-
fieldKey: '
|
|
22356
|
-
type: '
|
|
22357
|
-
title: 'Can not select previous date',
|
|
22358
|
-
"default": false,
|
|
22355
|
+
fieldKey: 'can_not_select_previous_date_of',
|
|
22356
|
+
type: 'string',
|
|
22357
|
+
title: 'Can not select previous date of',
|
|
22359
22358
|
ui: {
|
|
22360
|
-
type: '
|
|
22359
|
+
type: 'text',
|
|
22360
|
+
placeholder: 'Enter fieldKey, based on that field value dates will be disabled'
|
|
22361
22361
|
}
|
|
22362
22362
|
}, {
|
|
22363
22363
|
fieldKey: 'disabled',
|
|
@@ -22502,7 +22502,7 @@ var config$8 = {
|
|
|
22502
22502
|
}
|
|
22503
22503
|
};
|
|
22504
22504
|
|
|
22505
|
-
var _excluded$9 = ["disabled", "onChange", "fieldData", "fieldKey", "dispatch", "style", "range", "
|
|
22505
|
+
var _excluded$9 = ["disabled", "onChange", "fieldData", "fieldKey", "dispatch", "style", "range", "can_not_select_previous_date_of", "format", "flatpickrFormat", "picker", "asyncValidate", "showTime", "allowClear", "getKey", "formMode", "showCurrentDate", "themeColor", "options"];
|
|
22506
22506
|
|
|
22507
22507
|
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22508
22508
|
|
|
@@ -22510,6 +22510,8 @@ function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) {
|
|
|
22510
22510
|
_DatePicker.RangePicker;
|
|
22511
22511
|
|
|
22512
22512
|
var DatePickerField = function DatePickerField(_ref) {
|
|
22513
|
+
var _restProps$formData;
|
|
22514
|
+
|
|
22513
22515
|
var disabled = _ref.disabled,
|
|
22514
22516
|
onChange = _ref.onChange,
|
|
22515
22517
|
fieldData = _ref.fieldData,
|
|
@@ -22517,8 +22519,8 @@ var DatePickerField = function DatePickerField(_ref) {
|
|
|
22517
22519
|
dispatch = _ref.dispatch,
|
|
22518
22520
|
style = _ref.style,
|
|
22519
22521
|
range = _ref.range,
|
|
22520
|
-
_ref$can_not_select_p = _ref.
|
|
22521
|
-
|
|
22522
|
+
_ref$can_not_select_p = _ref.can_not_select_previous_date_of,
|
|
22523
|
+
can_not_select_previous_date_of = _ref$can_not_select_p === void 0 ? '' : _ref$can_not_select_p,
|
|
22522
22524
|
_ref$format = _ref.format,
|
|
22523
22525
|
format = _ref$format === void 0 ? 'DD-MMM-YYYY' : _ref$format,
|
|
22524
22526
|
_ref$flatpickrFormat = _ref.flatpickrFormat,
|
|
@@ -22533,8 +22535,8 @@ var DatePickerField = function DatePickerField(_ref) {
|
|
|
22533
22535
|
formMode = _ref.formMode;
|
|
22534
22536
|
_ref.showCurrentDate;
|
|
22535
22537
|
var themeColor = _ref.themeColor,
|
|
22536
|
-
options = _ref.options
|
|
22537
|
-
_objectWithoutProperties(_ref, _excluded$9);
|
|
22538
|
+
options = _ref.options,
|
|
22539
|
+
restProps = _objectWithoutProperties(_ref, _excluded$9);
|
|
22538
22540
|
|
|
22539
22541
|
/**
|
|
22540
22542
|
* 暂时不支持的DatePicker功能
|
|
@@ -22578,49 +22580,57 @@ var DatePickerField = function DatePickerField(_ref) {
|
|
|
22578
22580
|
if (formMode === 'view') return fieldData ? typeCheck(fieldData) === 'Array' ? fieldData.map(function (item) {
|
|
22579
22581
|
return moment(item).format(format);
|
|
22580
22582
|
}).join(' ~ ') : moment(fieldData).format(format) : null;
|
|
22581
|
-
|
|
22582
|
-
|
|
22583
|
-
|
|
22584
|
-
|
|
22585
|
-
|
|
22586
|
-
if (
|
|
22587
|
-
|
|
22588
|
-
} else {
|
|
22589
|
-
_onChange(date);
|
|
22583
|
+
|
|
22584
|
+
var getFlatpickrValue = function getFlatpickrValue() {
|
|
22585
|
+
if (!fieldData) return [];
|
|
22586
|
+
|
|
22587
|
+
if (range) {
|
|
22588
|
+
if (Array.isArray(fieldData) && fieldData.length === 2) {
|
|
22589
|
+
return [moment(fieldData[0], format).toDate(), moment(fieldData[1], format).toDate()];
|
|
22590
22590
|
}
|
|
22591
|
-
|
|
22592
|
-
|
|
22593
|
-
|
|
22594
|
-
|
|
22595
|
-
|
|
22596
|
-
|
|
22597
|
-
|
|
22598
|
-
|
|
22599
|
-
|
|
22600
|
-
|
|
22601
|
-
|
|
22602
|
-
|
|
22603
|
-
|
|
22604
|
-
|
|
22591
|
+
|
|
22592
|
+
return [];
|
|
22593
|
+
}
|
|
22594
|
+
|
|
22595
|
+
return [typeof fieldData === 'string' ? moment(fieldData, format, true).isValid() ? moment(fieldData, format).toDate() : moment(fieldData).toDate() : moment(fieldData).toDate()];
|
|
22596
|
+
};
|
|
22597
|
+
|
|
22598
|
+
var handleFlatpickrChange = function handleFlatpickrChange(date, isCleared) {
|
|
22599
|
+
if (isCleared) {
|
|
22600
|
+
_onChange(null);
|
|
22601
|
+
|
|
22602
|
+
return;
|
|
22603
|
+
}
|
|
22604
|
+
|
|
22605
|
+
if (range) {
|
|
22606
|
+
if (date.length === 2) {
|
|
22607
|
+
_onChange([moment(date[0]).format(format), moment(date[1]).format(format)]);
|
|
22605
22608
|
} else if (date.length) {
|
|
22606
22609
|
_onChange(moment(date[0]).format(format));
|
|
22607
22610
|
}
|
|
22608
|
-
}
|
|
22611
|
+
}
|
|
22612
|
+
};
|
|
22613
|
+
|
|
22614
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledFlatPicker, {
|
|
22615
|
+
disabled: disabled,
|
|
22616
|
+
value: getFlatpickrValue(),
|
|
22617
|
+
onChange: handleFlatpickrChange,
|
|
22609
22618
|
id: "".concat(fieldKey, "-default-picker"),
|
|
22610
22619
|
themeColor: themeColor,
|
|
22611
22620
|
style: style,
|
|
22612
22621
|
allowClear: allowClear,
|
|
22613
22622
|
options: _objectSpread$4(_objectSpread$4({
|
|
22623
|
+
mode: range ? 'range' : 'single',
|
|
22614
22624
|
enableTime: showTime,
|
|
22615
22625
|
altInput: true,
|
|
22616
22626
|
allowInput: false,
|
|
22617
22627
|
altFormat: showTime ? flatpickrFormat + ' H:i' : flatpickrFormat,
|
|
22618
22628
|
dateFormat: showTime ? 'Y-m-d H:i' : 'Y-m-d',
|
|
22619
22629
|
altInputClass: disabled ? 'drip_date_picker_input_disabled' : 'drip_date_picker_input'
|
|
22620
|
-
},
|
|
22621
|
-
minDate: moment(
|
|
22630
|
+
}, can_not_select_previous_date_of && fieldData && (_restProps$formData = restProps.formData) !== null && _restProps$formData !== void 0 && _restProps$formData[can_not_select_previous_date_of] && moment(restProps.formData[can_not_select_previous_date_of], format).isValid() ? {
|
|
22631
|
+
minDate: moment(restProps.formData[can_not_select_previous_date_of], format).toDate()
|
|
22622
22632
|
} : {}), options)
|
|
22623
|
-
}))
|
|
22633
|
+
}));
|
|
22624
22634
|
};
|
|
22625
22635
|
|
|
22626
22636
|
DatePickerField.propTypes = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@innoways/drip-form-theme-antd",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.14",
|
|
4
4
|
"author": "JDFED",
|
|
5
5
|
"description": "drip-form antd主题包",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@ant-design/icons": "^4.7.0",
|
|
33
33
|
"@babel/runtime": "^7.10.2",
|
|
34
|
-
"@innoways/hooks": "^9.0.
|
|
35
|
-
"@innoways/utils": "^9.0.
|
|
34
|
+
"@innoways/hooks": "^9.0.14",
|
|
35
|
+
"@innoways/utils": "^9.0.14",
|
|
36
36
|
"antd": "^4.16.13",
|
|
37
37
|
"flatpickr": "4.6.3",
|
|
38
38
|
"moment": "^2.26.0",
|