Skip to content

Commit 027798e

Browse files
author
Jiaqi Liu
committed
fix: fix composition event in $memo mode
1 parent 6fa40d4 commit 027798e

22 files changed

+111
-62487
lines changed

dist/react-bootstrap-formutil.cjs.development.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,13 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
594594
} // If $memo is true, pass the children to Field for SCU diffing.
595595

596596

597-
if (props.$memo === true) {
598-
fieldProps.__DIFF__ = childList;
597+
if (fieldProps.$memo === true) {
598+
fieldProps.__DIFF__ = {
599+
childList: childList,
600+
compositionValue: this.compositionValue
601+
};
602+
} else if (Array.isArray(fieldProps.$memo)) {
603+
fieldProps.$memo = fieldProps.$memo.concat(this.compositionValue);
599604
}
600605

601606
var children = typeof childList === 'function' ? childList : React.Children.only(childList);
@@ -687,13 +692,13 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
687692
default:
688693
childProps = (_childProps = {
689694
onCompositionEnd: function onCompositionEnd(ev) {
690-
_this2.isComposition = false;
695+
_this2.isComposing = false;
691696
delete _this2.compositionValue;
692697

693698
_onChange(ev);
694699
},
695700
onCompositionStart: function onCompositionStart() {
696-
return _this2.isComposition = true;
701+
return _this2.isComposing = true;
697702
}
698703
}, defineProperty(_childProps, changePropName, component === 'multipleSelect' ? function (ev) {
699704
_onChange([].slice.call(ev.target.options).filter(function (option) {
@@ -702,7 +707,7 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
702707
return option.value;
703708
}), ev);
704709
} : function (ev) {
705-
if (_this2.isComposition) {
710+
if (_this2.isComposing) {
706711
_this2.compositionValue = ev.target[valuePropName];
707712

708713
_this2.forceUpdate();
@@ -714,8 +719,8 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
714719
_onChange.apply(void 0, [ev].concat(rest));
715720
}
716721
}), defineProperty(_childProps, valuePropName, 'compositionValue' in _this2 ? _this2.compositionValue : value), defineProperty(_childProps, blurPropName, function () {
717-
if (_this2.isComposition) {
718-
_this2.isComposition = false;
722+
if (_this2.isComposing) {
723+
_this2.isComposing = false;
719724
delete _this2.compositionValue;
720725

721726
_onChange.apply(void 0, arguments);

dist/react-bootstrap-formutil.cjs.production.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-bootstrap-formutil.esm.development.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -542,8 +542,13 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
542542
} // If $memo is true, pass the children to Field for SCU diffing.
543543

544544

545-
if (props.$memo === true) {
546-
fieldProps.__DIFF__ = childList;
545+
if (fieldProps.$memo === true) {
546+
fieldProps.__DIFF__ = {
547+
childList: childList,
548+
compositionValue: this.compositionValue
549+
};
550+
} else if (Array.isArray(fieldProps.$memo)) {
551+
fieldProps.$memo = fieldProps.$memo.concat(this.compositionValue);
547552
}
548553

549554
var children = typeof childList === 'function' ? childList : Children.only(childList);
@@ -635,13 +640,13 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
635640
default:
636641
childProps = (_childProps = {
637642
onCompositionEnd: function onCompositionEnd(ev) {
638-
_this2.isComposition = false;
643+
_this2.isComposing = false;
639644
delete _this2.compositionValue;
640645

641646
_onChange(ev);
642647
},
643648
onCompositionStart: function onCompositionStart() {
644-
return _this2.isComposition = true;
649+
return _this2.isComposing = true;
645650
}
646651
}, _defineProperty(_childProps, changePropName, component === 'multipleSelect' ? function (ev) {
647652
_onChange([].slice.call(ev.target.options).filter(function (option) {
@@ -650,7 +655,7 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
650655
return option.value;
651656
}), ev);
652657
} : function (ev) {
653-
if (_this2.isComposition) {
658+
if (_this2.isComposing) {
654659
_this2.compositionValue = ev.target[valuePropName];
655660

656661
_this2.forceUpdate();
@@ -662,8 +667,8 @@ var _FormGroup = /*#__PURE__*/function (_Component) {
662667
_onChange.apply(void 0, [ev].concat(rest));
663668
}
664669
}), _defineProperty(_childProps, valuePropName, 'compositionValue' in _this2 ? _this2.compositionValue : value), _defineProperty(_childProps, blurPropName, function () {
665-
if (_this2.isComposition) {
666-
_this2.isComposition = false;
670+
if (_this2.isComposing) {
671+
_this2.isComposing = false;
667672
delete _this2.compositionValue;
668673

669674
_onChange.apply(void 0, arguments);

dist/react-bootstrap-formutil.esm.production.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-bootstrap-formutil.umd.development.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -984,8 +984,13 @@
984984
} // If $memo is true, pass the children to Field for SCU diffing.
985985

986986

987-
if (props.$memo === true) {
988-
fieldProps.__DIFF__ = childList;
987+
if (fieldProps.$memo === true) {
988+
fieldProps.__DIFF__ = {
989+
childList: childList,
990+
compositionValue: this.compositionValue
991+
};
992+
} else if (Array.isArray(fieldProps.$memo)) {
993+
fieldProps.$memo = fieldProps.$memo.concat(this.compositionValue);
989994
}
990995

991996
var children = typeof childList === 'function' ? childList : React.Children.only(childList);
@@ -1077,13 +1082,13 @@
10771082
default:
10781083
childProps = (_childProps = {
10791084
onCompositionEnd: function onCompositionEnd(ev) {
1080-
_this2.isComposition = false;
1085+
_this2.isComposing = false;
10811086
delete _this2.compositionValue;
10821087

10831088
_onChange(ev);
10841089
},
10851090
onCompositionStart: function onCompositionStart() {
1086-
return _this2.isComposition = true;
1091+
return _this2.isComposing = true;
10871092
}
10881093
}, defineProperty(_childProps, changePropName, component === 'multipleSelect' ? function (ev) {
10891094
_onChange([].slice.call(ev.target.options).filter(function (option) {
@@ -1092,7 +1097,7 @@
10921097
return option.value;
10931098
}), ev);
10941099
} : function (ev) {
1095-
if (_this2.isComposition) {
1100+
if (_this2.isComposing) {
10961101
_this2.compositionValue = ev.target[valuePropName];
10971102

10981103
_this2.forceUpdate();
@@ -1104,8 +1109,8 @@
11041109
_onChange.apply(void 0, [ev].concat(rest));
11051110
}
11061111
}), defineProperty(_childProps, valuePropName, 'compositionValue' in _this2 ? _this2.compositionValue : value), defineProperty(_childProps, blurPropName, function () {
1107-
if (_this2.isComposition) {
1108-
_this2.isComposition = false;
1112+
if (_this2.isComposing) {
1113+
_this2.isComposing = false;
11091114
delete _this2.compositionValue;
11101115

11111116
_onChange.apply(void 0, arguments);

dist/react-bootstrap-formutil.umd.production.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/demo/index.html

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1 @@
1-
<!DOCTYPE html>
2-
<html lang="en">
3-
<head>
4-
<meta charset="utf-8">
5-
<meta http-equiv="x-ua-compatible" content="ie=edge">
6-
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, shrink-to-fit=no">
7-
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
8-
<title>react-bootstrap-formutil</title>
9-
</head>
10-
<body>
11-
<div id="wrap" class="wrapper">
12-
<!-- your html -->
13-
</div>
14-
<script src="./static/js/runtime.9f6dfe74.js"></script><script src="./static/js/vendor.9f6dfe74.js"></script><script src="./static/js/_vendor_.9f6dfe74.js"></script><script src="./static/js/index.9f6dfe74.js"></script></body>
15-
</html>
1+
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="x-ua-compatible" content="ie=edge"><meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,shrink-to-fit=no"><link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"><title>react-bootstrap-formutil</title></head><body><div id="wrap" class="wrapper"></div><script>/*! @author qiqiboy */!function(e){function r(r){for(var n,l,f=r[0],i=r[1],a=r[2],c=0,s=[];c<f.length;c++)l=f[c],Object.prototype.hasOwnProperty.call(o,l)&&o[l]&&s.push(o[l][0]),o[l]=0;for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n]);for(p&&p(r);s.length;)s.shift()();return u.push.apply(u,a||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,f=1;f<t.length;f++){var i=t[f];0!==o[i]&&(n=!1)}n&&(u.splice(r--,1),e=l(l.s=t[0]))}return e}var n={},o={0:0},u=[];function l(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,l),t.l=!0,t.exports}l.m=e,l.c=n,l.d=function(e,r,t){l.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,r){if(1&r&&(e=l(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(l.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)l.d(t,n,function(r){return e[r]}.bind(null,n));return t},l.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(r,"a",r),r},l.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},l.p="./";var f=this.webpackJsonp=this.webpackJsonp||[],i=f.push.bind(f);f.push=r,f=f.slice();for(var a=0;a<f.length;a++)r(f[a]);var p=i;t()}([])</script><script src="./static/js/vendor.23b076eb.js"></script><script src="./static/js/_vendor_.6c270d91.js"></script><script src="./static/js/index.5b0fc71a.js"></script></body></html>
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/*! @author qiqiboy */
2+
(this.webpackJsonp=this.webpackJsonp||[]).push([[2],[],[[0,0,1]]]);

docs/demo/static/js/_vendor_.9f6dfe74.js

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/demo/static/js/_vendor_.9f6dfe74.js.map

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)