@douyinfe/semi-ui 2.49.0 → 2.49.2
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/dist/css/semi.css +3 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +255 -157
- package/dist/umd/semi-ui.js.map +1 -1
- package/dist/umd/semi-ui.min.js +1 -1
- package/dist/umd/semi-ui.min.js.map +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +1 -5
- package/lib/cjs/form/baseForm.d.ts +1 -1
- package/lib/cjs/form/field.d.ts +1 -1
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +14 -0
- package/lib/cjs/notification/index.js +6 -5
- package/lib/cjs/select/index.d.ts +1 -1
- package/lib/cjs/treeSelect/index.d.ts +2 -2
- package/lib/cjs/treeSelect/index.js +117 -29
- package/lib/es/datePicker/yearAndMonth.js +1 -5
- package/lib/es/form/baseForm.d.ts +1 -1
- package/lib/es/form/field.d.ts +1 -1
- package/lib/es/index.d.ts +2 -0
- package/lib/es/index.js +2 -0
- package/lib/es/notification/index.js +6 -5
- package/lib/es/select/index.d.ts +1 -1
- package/lib/es/treeSelect/index.d.ts +2 -2
- package/lib/es/treeSelect/index.js +118 -30
- package/package.json +8 -8
package/dist/umd/semi-ui.js
CHANGED
|
@@ -17286,6 +17286,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17286
17286
|
"BackTop": () => (/* reexport */ BackTop),
|
|
17287
17287
|
"Badge": () => (/* reexport */ Badge),
|
|
17288
17288
|
"Banner": () => (/* reexport */ Banner),
|
|
17289
|
+
"BaseComponent": () => (/* reexport */ BaseComponent),
|
|
17290
|
+
"BaseFoundation": () => (/* reexport */ foundation),
|
|
17289
17291
|
"Breadcrumb": () => (/* reexport */ breadcrumb_0),
|
|
17290
17292
|
"Button": () => (/* reexport */ button_0),
|
|
17291
17293
|
"ButtonGroup": () => (/* reexport */ ButtonGroup),
|
|
@@ -17375,45 +17377,12 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
17375
17377
|
|
|
17376
17378
|
// EXTERNAL MODULE: ./_base/base.scss
|
|
17377
17379
|
var base = __webpack_require__("q7sR");
|
|
17378
|
-
// EXTERNAL MODULE: ../../node_modules/lodash/throttle.js
|
|
17379
|
-
var throttle = __webpack_require__("Bcqe");
|
|
17380
|
-
var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle);
|
|
17381
|
-
// EXTERNAL MODULE: ../../node_modules/lodash/debounce.js
|
|
17382
|
-
var debounce = __webpack_require__("RNvQ");
|
|
17383
|
-
var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
|
|
17384
17380
|
// EXTERNAL MODULE: ../../node_modules/lodash/noop.js
|
|
17385
17381
|
var noop = __webpack_require__("nnm9");
|
|
17386
17382
|
var noop_default = /*#__PURE__*/__webpack_require__.n(noop);
|
|
17387
|
-
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
17388
|
-
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("neV8");
|
|
17389
|
-
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
17390
|
-
// EXTERNAL MODULE: ../../node_modules/classnames/index.js
|
|
17391
|
-
var classnames = __webpack_require__("O94r");
|
|
17392
|
-
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
17393
|
-
// EXTERNAL MODULE: ../../node_modules/prop-types/index.js
|
|
17394
|
-
var prop_types = __webpack_require__("aWzz");
|
|
17395
|
-
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
|
|
17396
|
-
;// CONCATENATED MODULE: ../semi-foundation/base/env.ts
|
|
17397
|
-
const BASE_CLASS_PREFIX = 'semi';
|
|
17398
|
-
;// CONCATENATED MODULE: ../semi-foundation/anchor/constants.ts
|
|
17399
|
-
|
|
17400
|
-
const cssClasses = {
|
|
17401
|
-
PREFIX: `${BASE_CLASS_PREFIX}-anchor`
|
|
17402
|
-
};
|
|
17403
|
-
const constants_strings = {
|
|
17404
|
-
SIZE: ['small', 'default'],
|
|
17405
|
-
SLIDE_COLOR: ['primary', 'tertiary', 'muted'],
|
|
17406
|
-
MAX_WIDTH: '200px',
|
|
17407
|
-
MAX_HEIGHT: '750px',
|
|
17408
|
-
POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver']
|
|
17409
|
-
};
|
|
17410
|
-
|
|
17411
17383
|
// EXTERNAL MODULE: ../../node_modules/lodash/get.js
|
|
17412
17384
|
var get = __webpack_require__("2srY");
|
|
17413
17385
|
var get_default = /*#__PURE__*/__webpack_require__.n(get);
|
|
17414
|
-
// EXTERNAL MODULE: ../../node_modules/lodash/isArray.js
|
|
17415
|
-
var isArray = __webpack_require__("wxYD");
|
|
17416
|
-
var isArray_default = /*#__PURE__*/__webpack_require__.n(isArray);
|
|
17417
17386
|
;// CONCATENATED MODULE: ../semi-foundation/utils/log.ts
|
|
17418
17387
|
|
|
17419
17388
|
const log = function (text) {
|
|
@@ -17540,6 +17509,115 @@ class BaseFoundation {
|
|
|
17540
17509
|
}
|
|
17541
17510
|
}
|
|
17542
17511
|
/* harmony default export */ const foundation = (BaseFoundation);
|
|
17512
|
+
// EXTERNAL MODULE: external {"root":"React","commonjs2":"react","commonjs":"react","amd":"react"}
|
|
17513
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_ = __webpack_require__("neV8");
|
|
17514
|
+
var external_root_React_commonjs2_react_commonjs_react_amd_react_default = /*#__PURE__*/__webpack_require__.n(external_root_React_commonjs2_react_commonjs_react_amd_react_);
|
|
17515
|
+
;// CONCATENATED MODULE: ../semi-foundation/utils/getDataAttr.ts
|
|
17516
|
+
function getDataAttr(props) {
|
|
17517
|
+
return Object.keys(props).reduce((prev, key) => {
|
|
17518
|
+
if (key.substr(0, 5) === 'data-') {
|
|
17519
|
+
prev[key] = props[key];
|
|
17520
|
+
}
|
|
17521
|
+
return prev;
|
|
17522
|
+
}, {});
|
|
17523
|
+
}
|
|
17524
|
+
;// CONCATENATED MODULE: ./_base/baseComponent.tsx
|
|
17525
|
+
/**
|
|
17526
|
+
* The Semi Foundation / Adapter architecture split was inspired by Material Component For Web. (https://github.com/material-components/material-components-web)
|
|
17527
|
+
* We re-implemented our own code based on the principle and added more functions we need according to actual needs.
|
|
17528
|
+
*/
|
|
17529
|
+
|
|
17530
|
+
|
|
17531
|
+
|
|
17532
|
+
const {
|
|
17533
|
+
hasOwnProperty: baseComponent_hasOwnProperty
|
|
17534
|
+
} = Object.prototype;
|
|
17535
|
+
// eslint-disable-next-line
|
|
17536
|
+
class BaseComponent extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
|
|
17537
|
+
constructor(props) {
|
|
17538
|
+
super(props);
|
|
17539
|
+
// eslint-disable-next-line
|
|
17540
|
+
this.isControlled = key => Boolean(key && this.props && typeof this.props === 'object' && baseComponent_hasOwnProperty.call(this.props, key));
|
|
17541
|
+
this.cache = {};
|
|
17542
|
+
this.foundation = null;
|
|
17543
|
+
}
|
|
17544
|
+
componentDidMount() {
|
|
17545
|
+
this.foundation && typeof this.foundation.init === 'function' && this.foundation.init();
|
|
17546
|
+
}
|
|
17547
|
+
componentWillUnmount() {
|
|
17548
|
+
this.foundation && typeof this.foundation.destroy === 'function' && this.foundation.destroy();
|
|
17549
|
+
this.cache = {};
|
|
17550
|
+
}
|
|
17551
|
+
get adapter() {
|
|
17552
|
+
return {
|
|
17553
|
+
getContext: key => {
|
|
17554
|
+
if (this.context && key) {
|
|
17555
|
+
return this.context[key];
|
|
17556
|
+
}
|
|
17557
|
+
},
|
|
17558
|
+
getContexts: () => this.context,
|
|
17559
|
+
getProp: key => this.props[key],
|
|
17560
|
+
// return all props
|
|
17561
|
+
getProps: () => this.props,
|
|
17562
|
+
getState: key => this.state[key],
|
|
17563
|
+
getStates: () => this.state,
|
|
17564
|
+
setState: (states, cb) => this.setState(Object.assign({}, states), cb),
|
|
17565
|
+
getCache: key => key && this.cache[key],
|
|
17566
|
+
getCaches: () => this.cache,
|
|
17567
|
+
setCache: (key, value) => key && (this.cache[key] = value),
|
|
17568
|
+
stopPropagation: e => {
|
|
17569
|
+
try {
|
|
17570
|
+
e.stopPropagation();
|
|
17571
|
+
e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
|
|
17572
|
+
} catch (error) {}
|
|
17573
|
+
},
|
|
17574
|
+
persistEvent: e => {
|
|
17575
|
+
e && e.persist && typeof e.persist === 'function' ? e.persist() : null;
|
|
17576
|
+
}
|
|
17577
|
+
};
|
|
17578
|
+
}
|
|
17579
|
+
log(text) {
|
|
17580
|
+
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
17581
|
+
rest[_key - 1] = arguments[_key];
|
|
17582
|
+
}
|
|
17583
|
+
return utils_log(text, ...rest);
|
|
17584
|
+
}
|
|
17585
|
+
getDataAttr(props) {
|
|
17586
|
+
return getDataAttr(props);
|
|
17587
|
+
}
|
|
17588
|
+
}
|
|
17589
|
+
BaseComponent.propTypes = {};
|
|
17590
|
+
BaseComponent.defaultProps = {};
|
|
17591
|
+
// EXTERNAL MODULE: ../../node_modules/lodash/throttle.js
|
|
17592
|
+
var throttle = __webpack_require__("Bcqe");
|
|
17593
|
+
var throttle_default = /*#__PURE__*/__webpack_require__.n(throttle);
|
|
17594
|
+
// EXTERNAL MODULE: ../../node_modules/lodash/debounce.js
|
|
17595
|
+
var debounce = __webpack_require__("RNvQ");
|
|
17596
|
+
var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce);
|
|
17597
|
+
// EXTERNAL MODULE: ../../node_modules/classnames/index.js
|
|
17598
|
+
var classnames = __webpack_require__("O94r");
|
|
17599
|
+
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
|
|
17600
|
+
// EXTERNAL MODULE: ../../node_modules/prop-types/index.js
|
|
17601
|
+
var prop_types = __webpack_require__("aWzz");
|
|
17602
|
+
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
|
|
17603
|
+
;// CONCATENATED MODULE: ../semi-foundation/base/env.ts
|
|
17604
|
+
const BASE_CLASS_PREFIX = 'semi';
|
|
17605
|
+
;// CONCATENATED MODULE: ../semi-foundation/anchor/constants.ts
|
|
17606
|
+
|
|
17607
|
+
const cssClasses = {
|
|
17608
|
+
PREFIX: `${BASE_CLASS_PREFIX}-anchor`
|
|
17609
|
+
};
|
|
17610
|
+
const constants_strings = {
|
|
17611
|
+
SIZE: ['small', 'default'],
|
|
17612
|
+
SLIDE_COLOR: ['primary', 'tertiary', 'muted'],
|
|
17613
|
+
MAX_WIDTH: '200px',
|
|
17614
|
+
MAX_HEIGHT: '750px',
|
|
17615
|
+
POSITION_SET: ['top', 'topLeft', 'topRight', 'left', 'leftTop', 'leftBottom', 'right', 'rightTop', 'rightBottom', 'bottom', 'bottomLeft', 'bottomRight', 'leftTopOver', 'rightTopOver']
|
|
17616
|
+
};
|
|
17617
|
+
|
|
17618
|
+
// EXTERNAL MODULE: ../../node_modules/lodash/isArray.js
|
|
17619
|
+
var isArray = __webpack_require__("wxYD");
|
|
17620
|
+
var isArray_default = /*#__PURE__*/__webpack_require__.n(isArray);
|
|
17543
17621
|
;// CONCATENATED MODULE: ../../node_modules/compute-scroll-into-view/dist/index.mjs
|
|
17544
17622
|
function t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}var i=function(e,i){var o=window,l=i.scrollMode,d=i.block,f=i.inline,h=i.boundary,u=i.skipOverflowHiddenElements,s="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var a,c,g=document.scrollingElement||document.documentElement,p=[],m=e;t(m)&&s(m);){if((m=null==(c=(a=m).parentElement)?a.getRootNode().host||null:c)===g){p.push(m);break}null!=m&&m===document.body&&n(m)&&!n(document.documentElement)||null!=m&&n(m,u)&&p.push(m)}for(var w=o.visualViewport?o.visualViewport.width:innerWidth,v=o.visualViewport?o.visualViewport.height:innerHeight,W=window.scrollX||pageXOffset,H=window.scrollY||pageYOffset,b=e.getBoundingClientRect(),y=b.height,E=b.width,M=b.top,V=b.right,x=b.bottom,I=b.left,C="start"===d||"nearest"===d?M:"end"===d?x:M+y/2,R="center"===f?I+E/2:"end"===f?V:I,T=[],k=0;k<p.length;k++){var B=p[k],D=B.getBoundingClientRect(),O=D.height,X=D.width,Y=D.top,L=D.right,S=D.bottom,j=D.left;if("if-needed"===l&&M>=0&&I>=0&&x<=v&&V<=w&&M>=Y&&x<=S&&I>=j&&V<=L)return T;var N=getComputedStyle(B),q=parseInt(N.borderLeftWidth,10),z=parseInt(N.borderTopWidth,10),A=parseInt(N.borderRightWidth,10),F=parseInt(N.borderBottomWidth,10),G=0,J=0,K="offsetWidth"in B?B.offsetWidth-B.clientWidth-q-A:0,P="offsetHeight"in B?B.offsetHeight-B.clientHeight-z-F:0,Q="offsetWidth"in B?0===B.offsetWidth?0:X/B.offsetWidth:0,U="offsetHeight"in B?0===B.offsetHeight?0:O/B.offsetHeight:0;if(g===B)G="start"===d?C:"end"===d?C-v:"nearest"===d?r(H,H+v,v,z,F,H+C,H+C+y,y):C-v/2,J="start"===f?R:"center"===f?R-w/2:"end"===f?R-w:r(W,W+w,w,q,A,W+R,W+R+E,E),G=Math.max(0,G+H),J=Math.max(0,J+W);else{G="start"===d?C-Y-z:"end"===d?C-S+F+P:"nearest"===d?r(Y,S,O,z,F+P,C,C+y,y):C-(Y+O/2)+P/2,J="start"===f?R-j-q:"center"===f?R-(j+X/2)+K/2:"end"===f?R-L+A+K:r(j,L,X,q,A+K,R,R+E,E);var Z=B.scrollLeft,$=B.scrollTop;C+=$-(G=Math.max(0,Math.min($+G/U,B.scrollHeight-O/U+P))),R+=Z-(J=Math.max(0,Math.min(Z+J/Q,B.scrollWidth-X/Q+K)))}T.push({el:B,top:G,left:J})}return T};
|
|
17545
17623
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -17793,82 +17871,6 @@ class AnchorFoundation extends foundation {
|
|
|
17793
17871
|
};
|
|
17794
17872
|
}
|
|
17795
17873
|
}
|
|
17796
|
-
;// CONCATENATED MODULE: ../semi-foundation/utils/getDataAttr.ts
|
|
17797
|
-
function getDataAttr(props) {
|
|
17798
|
-
return Object.keys(props).reduce((prev, key) => {
|
|
17799
|
-
if (key.substr(0, 5) === 'data-') {
|
|
17800
|
-
prev[key] = props[key];
|
|
17801
|
-
}
|
|
17802
|
-
return prev;
|
|
17803
|
-
}, {});
|
|
17804
|
-
}
|
|
17805
|
-
;// CONCATENATED MODULE: ./_base/baseComponent.tsx
|
|
17806
|
-
/**
|
|
17807
|
-
* The Semi Foundation / Adapter architecture split was inspired by Material Component For Web. (https://github.com/material-components/material-components-web)
|
|
17808
|
-
* We re-implemented our own code based on the principle and added more functions we need according to actual needs.
|
|
17809
|
-
*/
|
|
17810
|
-
|
|
17811
|
-
|
|
17812
|
-
|
|
17813
|
-
const {
|
|
17814
|
-
hasOwnProperty: baseComponent_hasOwnProperty
|
|
17815
|
-
} = Object.prototype;
|
|
17816
|
-
// eslint-disable-next-line
|
|
17817
|
-
class BaseComponent extends external_root_React_commonjs2_react_commonjs_react_amd_react_.Component {
|
|
17818
|
-
constructor(props) {
|
|
17819
|
-
super(props);
|
|
17820
|
-
// eslint-disable-next-line
|
|
17821
|
-
this.isControlled = key => Boolean(key && this.props && typeof this.props === 'object' && baseComponent_hasOwnProperty.call(this.props, key));
|
|
17822
|
-
this.cache = {};
|
|
17823
|
-
this.foundation = null;
|
|
17824
|
-
}
|
|
17825
|
-
componentDidMount() {
|
|
17826
|
-
this.foundation && typeof this.foundation.init === 'function' && this.foundation.init();
|
|
17827
|
-
}
|
|
17828
|
-
componentWillUnmount() {
|
|
17829
|
-
this.foundation && typeof this.foundation.destroy === 'function' && this.foundation.destroy();
|
|
17830
|
-
this.cache = {};
|
|
17831
|
-
}
|
|
17832
|
-
get adapter() {
|
|
17833
|
-
return {
|
|
17834
|
-
getContext: key => {
|
|
17835
|
-
if (this.context && key) {
|
|
17836
|
-
return this.context[key];
|
|
17837
|
-
}
|
|
17838
|
-
},
|
|
17839
|
-
getContexts: () => this.context,
|
|
17840
|
-
getProp: key => this.props[key],
|
|
17841
|
-
// return all props
|
|
17842
|
-
getProps: () => this.props,
|
|
17843
|
-
getState: key => this.state[key],
|
|
17844
|
-
getStates: () => this.state,
|
|
17845
|
-
setState: (states, cb) => this.setState(Object.assign({}, states), cb),
|
|
17846
|
-
getCache: key => key && this.cache[key],
|
|
17847
|
-
getCaches: () => this.cache,
|
|
17848
|
-
setCache: (key, value) => key && (this.cache[key] = value),
|
|
17849
|
-
stopPropagation: e => {
|
|
17850
|
-
try {
|
|
17851
|
-
e.stopPropagation();
|
|
17852
|
-
e.nativeEvent && e.nativeEvent.stopImmediatePropagation();
|
|
17853
|
-
} catch (error) {}
|
|
17854
|
-
},
|
|
17855
|
-
persistEvent: e => {
|
|
17856
|
-
e && e.persist && typeof e.persist === 'function' ? e.persist() : null;
|
|
17857
|
-
}
|
|
17858
|
-
};
|
|
17859
|
-
}
|
|
17860
|
-
log(text) {
|
|
17861
|
-
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
17862
|
-
rest[_key - 1] = arguments[_key];
|
|
17863
|
-
}
|
|
17864
|
-
return utils_log(text, ...rest);
|
|
17865
|
-
}
|
|
17866
|
-
getDataAttr(props) {
|
|
17867
|
-
return getDataAttr(props);
|
|
17868
|
-
}
|
|
17869
|
-
}
|
|
17870
|
-
BaseComponent.propTypes = {};
|
|
17871
|
-
BaseComponent.defaultProps = {};
|
|
17872
17874
|
// EXTERNAL MODULE: ../../node_modules/lodash/isObject.js
|
|
17873
17875
|
var isObject = __webpack_require__("tQYX");
|
|
17874
17876
|
var isObject_default = /*#__PURE__*/__webpack_require__.n(isObject);
|
|
@@ -59008,11 +59010,7 @@ class YearAndMonth extends BaseComponent {
|
|
|
59008
59010
|
const right = datePicker_constants_strings.PANEL_TYPE_RIGHT;
|
|
59009
59011
|
const needDisabled = year => {
|
|
59010
59012
|
if (panelType === right && currentYear[left]) {
|
|
59011
|
-
|
|
59012
|
-
return currentYear[left] > year;
|
|
59013
|
-
} else {
|
|
59014
|
-
return currentYear[left] >= year;
|
|
59015
|
-
}
|
|
59013
|
+
return currentYear[left] > year;
|
|
59016
59014
|
}
|
|
59017
59015
|
return false;
|
|
59018
59016
|
};
|
|
@@ -68034,6 +68032,7 @@ class NotificationList extends BaseComponent {
|
|
|
68034
68032
|
}
|
|
68035
68033
|
static addNotice(notice) {
|
|
68036
68034
|
var _a;
|
|
68035
|
+
notice = Object.assign(Object.assign({}, notification_defaultConfig), notice);
|
|
68037
68036
|
const id = (_a = notice.id) !== null && _a !== void 0 ? _a : getUuid('notification');
|
|
68038
68037
|
if (!ref) {
|
|
68039
68038
|
const {
|
|
@@ -68077,27 +68076,27 @@ class NotificationList extends BaseComponent {
|
|
|
68077
68076
|
return id;
|
|
68078
68077
|
}
|
|
68079
68078
|
static info(opts) {
|
|
68080
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
68079
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
68081
68080
|
type: 'info'
|
|
68082
68081
|
}));
|
|
68083
68082
|
}
|
|
68084
68083
|
static success(opts) {
|
|
68085
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
68084
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
68086
68085
|
type: 'success'
|
|
68087
68086
|
}));
|
|
68088
68087
|
}
|
|
68089
68088
|
static error(opts) {
|
|
68090
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
68089
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
68091
68090
|
type: 'error'
|
|
68092
68091
|
}));
|
|
68093
68092
|
}
|
|
68094
68093
|
static warning(opts) {
|
|
68095
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
68094
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
68096
68095
|
type: 'warning'
|
|
68097
68096
|
}));
|
|
68098
68097
|
}
|
|
68099
68098
|
static open(opts) {
|
|
68100
|
-
return this.addNotice(Object.assign(Object.assign(
|
|
68099
|
+
return this.addNotice(Object.assign(Object.assign({}, opts), {
|
|
68101
68100
|
type: 'default'
|
|
68102
68101
|
}));
|
|
68103
68102
|
}
|
|
@@ -69372,6 +69371,9 @@ class SelectFoundation extends foundation {
|
|
|
69372
69371
|
const newOptions = this._filterOption(options, sugInput).filter(item => !item._inputCreateOnly);
|
|
69373
69372
|
this._adapter.updateOptions(newOptions);
|
|
69374
69373
|
this.toggle2SearchInput(true);
|
|
69374
|
+
} else {
|
|
69375
|
+
// whether it is a filter or not, isFocus is guaranteed to be true when open
|
|
69376
|
+
this._adapter.updateFocusState(true);
|
|
69375
69377
|
}
|
|
69376
69378
|
this._adapter.openMenu();
|
|
69377
69379
|
this._setDropdownWidth();
|
|
@@ -69381,7 +69383,6 @@ class SelectFoundation extends foundation {
|
|
|
69381
69383
|
this.close(e);
|
|
69382
69384
|
this._notifyBlur(e);
|
|
69383
69385
|
this._adapter.updateFocusState(false);
|
|
69384
|
-
this._adapter.unregisterClickOutsideHandler();
|
|
69385
69386
|
});
|
|
69386
69387
|
}
|
|
69387
69388
|
toggle2SearchInput(isShow) {
|
|
@@ -69400,6 +69401,7 @@ class SelectFoundation extends foundation {
|
|
|
69400
69401
|
// this.unBindKeyBoardEvent();
|
|
69401
69402
|
// this._notifyBlur(e);
|
|
69402
69403
|
// this._adapter.updateFocusState(false);
|
|
69404
|
+
this._adapter.unregisterClickOutsideHandler();
|
|
69403
69405
|
const isFilterable = this._isFilterable();
|
|
69404
69406
|
if (isFilterable) {
|
|
69405
69407
|
this.toggle2SearchInput(false);
|
|
@@ -70086,7 +70088,6 @@ class SelectFoundation extends foundation {
|
|
|
70086
70088
|
this._adapter.setIsFocusInContainer(false);
|
|
70087
70089
|
}
|
|
70088
70090
|
handleTriggerBlur(e) {
|
|
70089
|
-
this._adapter.updateFocusState(false);
|
|
70090
70091
|
const {
|
|
70091
70092
|
filter,
|
|
70092
70093
|
autoFocus
|
|
@@ -70099,6 +70100,7 @@ class SelectFoundation extends foundation {
|
|
|
70099
70100
|
// But when autoFocus or the panel is close, because clickOutsideHandler is not register or unregister, you need to listen for the trigger's blur and trigger the notify callback
|
|
70100
70101
|
if (isFocus && !isOpen) {
|
|
70101
70102
|
this._notifyBlur(e);
|
|
70103
|
+
this._adapter.updateFocusState(false);
|
|
70102
70104
|
}
|
|
70103
70105
|
}
|
|
70104
70106
|
handleInputBlur(e) {
|
|
@@ -89629,6 +89631,12 @@ class TreeSelectFoundation extends foundation {
|
|
|
89629
89631
|
this.close(e);
|
|
89630
89632
|
});
|
|
89631
89633
|
};
|
|
89634
|
+
this.clearInputValue = () => {
|
|
89635
|
+
const {
|
|
89636
|
+
inputValue
|
|
89637
|
+
} = this.getStates();
|
|
89638
|
+
inputValue && this._adapter.updateInputValue('');
|
|
89639
|
+
};
|
|
89632
89640
|
}
|
|
89633
89641
|
init() {
|
|
89634
89642
|
const {
|
|
@@ -89780,7 +89788,7 @@ class TreeSelectFoundation extends foundation {
|
|
|
89780
89788
|
const isSearching = Boolean(inputValue);
|
|
89781
89789
|
const treeNodeProps = {
|
|
89782
89790
|
eventKey: key,
|
|
89783
|
-
expanded: isSearching
|
|
89791
|
+
expanded: isSearching ? filteredExpandedKeys.has(key) : expandedKeys.has(key),
|
|
89784
89792
|
selected: selectedKeys.includes(key),
|
|
89785
89793
|
checked: realChecked,
|
|
89786
89794
|
halfChecked: realHalfChecked,
|
|
@@ -90053,8 +90061,8 @@ class TreeSelectFoundation extends foundation {
|
|
|
90053
90061
|
expandedOptsKeys.forEach(item => newExpandedKeys.add(item));
|
|
90054
90062
|
const newFlattenNodes = flattenTreeData(treeData, newExpandedKeys, keyMaps);
|
|
90055
90063
|
this._adapter.updateState({
|
|
90056
|
-
expandedKeys:
|
|
90057
|
-
flattenNodes:
|
|
90064
|
+
expandedKeys: newExpandedKeys,
|
|
90065
|
+
flattenNodes: newFlattenNodes,
|
|
90058
90066
|
inputValue: '',
|
|
90059
90067
|
motionKeys: new Set([]),
|
|
90060
90068
|
filteredKeys: new Set([]),
|
|
@@ -90103,8 +90111,8 @@ class TreeSelectFoundation extends foundation {
|
|
|
90103
90111
|
const newFilteredExpandedKeys = new Set(expandedOptsKeys);
|
|
90104
90112
|
this._adapter.notifySearch(sugInput, Array.from(newFilteredExpandedKeys));
|
|
90105
90113
|
this._adapter.updateState({
|
|
90106
|
-
expandedKeys:
|
|
90107
|
-
flattenNodes:
|
|
90114
|
+
expandedKeys: newExpandedKeys,
|
|
90115
|
+
flattenNodes: newFlattenNodes,
|
|
90108
90116
|
motionKeys: new Set([]),
|
|
90109
90117
|
filteredKeys: new Set(filteredOptsKeys),
|
|
90110
90118
|
filteredExpandedKeys: newFilteredExpandedKeys,
|
|
@@ -90312,7 +90320,7 @@ class TreeSelectFoundation extends foundation {
|
|
|
90312
90320
|
return;
|
|
90313
90321
|
}
|
|
90314
90322
|
const isExpandControlled = this._isExpandControlled();
|
|
90315
|
-
if (isSearching
|
|
90323
|
+
if (isSearching) {
|
|
90316
90324
|
this.handleNodeExpandInSearch(e, treeNode);
|
|
90317
90325
|
return;
|
|
90318
90326
|
}
|
|
@@ -91082,13 +91090,27 @@ class TreeSelect extends BaseComponent {
|
|
|
91082
91090
|
searchAutoFocus,
|
|
91083
91091
|
searchPosition
|
|
91084
91092
|
} = this.props;
|
|
91085
|
-
|
|
91086
|
-
|
|
91093
|
+
// 将 inputValue 清空,如果有选中值的话,选中项能够快速回显
|
|
91094
|
+
// Clear the inputValue. If there is a selected value, the selected item can be quickly echoed.
|
|
91095
|
+
if (isVisible === false && filterTreeNode) {
|
|
91096
|
+
this.foundation.clearInputValue();
|
|
91087
91097
|
}
|
|
91088
91098
|
if (filterTreeNode && searchPosition === treeSelect_constants_strings.SEARCH_POSITION_DROPDOWN && isVisible && searchAutoFocus) {
|
|
91089
91099
|
this.foundation.focusInput(true);
|
|
91090
91100
|
}
|
|
91091
91101
|
};
|
|
91102
|
+
this.afterClose = () => {
|
|
91103
|
+
// flattenNode 的变化将导致弹出层面板中的选项数目变化
|
|
91104
|
+
// 在弹层完全收起之后,再通过 clearInput 重新计算 state 中的 expandedKey, flattenNode
|
|
91105
|
+
// 防止在弹出层未收起时弹层面板中选项数目变化导致视觉上出现弹层闪动问题
|
|
91106
|
+
// Changes to flattenNode will cause the number of options in the popup panel to change
|
|
91107
|
+
// After the pop-up layer is completely closed, recalculate the expandedKey and flattenNode in the state through clearInput.
|
|
91108
|
+
// Prevent the pop-up layer from flickering visually due to changes in the number of options in the pop-up panel when the pop-up layer is not collapsed.
|
|
91109
|
+
const {
|
|
91110
|
+
filterTreeNode
|
|
91111
|
+
} = this.props;
|
|
91112
|
+
filterTreeNode && this.foundation.clearInput();
|
|
91113
|
+
};
|
|
91092
91114
|
this.renderTreeNode = (treeNode, ind, style) => {
|
|
91093
91115
|
const {
|
|
91094
91116
|
data,
|
|
@@ -91121,6 +91143,7 @@ class TreeSelect extends BaseComponent {
|
|
|
91121
91143
|
this.renderNodeList = () => {
|
|
91122
91144
|
const {
|
|
91123
91145
|
flattenNodes,
|
|
91146
|
+
cachedFlattenNodes,
|
|
91124
91147
|
motionKeys,
|
|
91125
91148
|
motionType,
|
|
91126
91149
|
filteredKeys
|
|
@@ -91136,7 +91159,7 @@ class TreeSelect extends BaseComponent {
|
|
|
91136
91159
|
if (!virtualize || isEmpty_default()(virtualize)) {
|
|
91137
91160
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(NodeList, {
|
|
91138
91161
|
flattenNodes: flattenNodes,
|
|
91139
|
-
flattenList:
|
|
91162
|
+
flattenList: cachedFlattenNodes,
|
|
91140
91163
|
motionKeys: motionExpand ? motionKeys : new Set([]),
|
|
91141
91164
|
motionType: motionType,
|
|
91142
91165
|
// When motionKeys is empty, but filteredKeys is not empty (that is, the search hits), this situation should be distinguished from ordinary motionKeys
|
|
@@ -91255,6 +91278,7 @@ class TreeSelect extends BaseComponent {
|
|
|
91255
91278
|
keyEntities: {},
|
|
91256
91279
|
treeData: [],
|
|
91257
91280
|
flattenNodes: [],
|
|
91281
|
+
cachedFlattenNodes: undefined,
|
|
91258
91282
|
selectedKeys: [],
|
|
91259
91283
|
checkedKeys: new Set(),
|
|
91260
91284
|
halfCheckedKeys: new Set(),
|
|
@@ -91284,6 +91308,7 @@ class TreeSelect extends BaseComponent {
|
|
|
91284
91308
|
};
|
|
91285
91309
|
}
|
|
91286
91310
|
static getDerivedStateFromProps(props, prevState) {
|
|
91311
|
+
var _a;
|
|
91287
91312
|
const {
|
|
91288
91313
|
prevProps,
|
|
91289
91314
|
rePosKey
|
|
@@ -91301,6 +91326,8 @@ class TreeSelect extends BaseComponent {
|
|
|
91301
91326
|
};
|
|
91302
91327
|
const needUpdateTreeData = needUpdate('treeData');
|
|
91303
91328
|
const needUpdateExpandedKeys = needUpdate('expandedKeys');
|
|
91329
|
+
const isExpandControlled = ('expandedKeys' in props);
|
|
91330
|
+
const isSearching = Boolean(props.filterTreeNode && prevState.inputValue && prevState.inputValue.length);
|
|
91304
91331
|
// TreeNode
|
|
91305
91332
|
if (needUpdateTreeData) {
|
|
91306
91333
|
treeData = props.treeData;
|
|
@@ -91319,31 +91346,97 @@ class TreeSelect extends BaseComponent {
|
|
|
91319
91346
|
}
|
|
91320
91347
|
}
|
|
91321
91348
|
const expandAllWhenDataChange = needUpdateTreeData && props.expandAll;
|
|
91322
|
-
|
|
91323
|
-
|
|
91324
|
-
|
|
91325
|
-
|
|
91326
|
-
|
|
91327
|
-
|
|
91328
|
-
|
|
91329
|
-
|
|
91330
|
-
|
|
91331
|
-
|
|
91332
|
-
|
|
91333
|
-
|
|
91334
|
-
|
|
91335
|
-
|
|
91336
|
-
|
|
91337
|
-
|
|
91338
|
-
|
|
91339
|
-
|
|
91340
|
-
|
|
91341
|
-
|
|
91342
|
-
|
|
91343
|
-
|
|
91344
|
-
|
|
91345
|
-
|
|
91346
|
-
|
|
91349
|
+
if (!isSearching) {
|
|
91350
|
+
// expandedKeys
|
|
91351
|
+
if (needUpdateExpandedKeys || prevProps && needUpdate('autoExpandParent')) {
|
|
91352
|
+
newState.expandedKeys = calcExpandedKeys(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
|
|
91353
|
+
// only show animation when treeData does not change
|
|
91354
|
+
if (prevProps && props.motion && !treeData) {
|
|
91355
|
+
const {
|
|
91356
|
+
motionKeys,
|
|
91357
|
+
motionType
|
|
91358
|
+
} = calcMotionKeys(prevState.expandedKeys, newState.expandedKeys, keyEntities);
|
|
91359
|
+
newState.motionKeys = new Set(motionKeys);
|
|
91360
|
+
newState.motionType = motionType;
|
|
91361
|
+
if (motionType === 'hide') {
|
|
91362
|
+
// cache flatten nodes: expandedKeys changed may not be triggered by interaction
|
|
91363
|
+
newState.cachedFlattenNodes = treeUtil_cloneDeep(prevState.flattenNodes);
|
|
91364
|
+
}
|
|
91365
|
+
}
|
|
91366
|
+
} else if (!prevProps && (props.defaultExpandAll || props.expandAll) || expandAllWhenDataChange) {
|
|
91367
|
+
newState.expandedKeys = new Set(Object.keys(keyEntities));
|
|
91368
|
+
} else if (!prevProps && props.defaultExpandedKeys) {
|
|
91369
|
+
newState.expandedKeys = calcExpandedKeys(props.defaultExpandedKeys, keyEntities);
|
|
91370
|
+
} else if (!prevProps && props.defaultValue) {
|
|
91371
|
+
newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.defaultValue, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
91372
|
+
} else if (!prevProps && props.value) {
|
|
91373
|
+
newState.expandedKeys = calcExpandedKeysForValues(normalizeValue(props.value, withObject, keyMaps), keyEntities, props.multiple, valueEntities);
|
|
91374
|
+
} else if (!isExpandControlled && needUpdateTreeData && props.value) {
|
|
91375
|
+
// 当 treeData 已经设置具体的值,并且设置了 props.loadData ,则认为 treeData 的更新是因为 loadData 导致的
|
|
91376
|
+
// 如果是因为 loadData 导致 treeData改变, 此时在这里重新计算 key 会导致为未选中的展开项目被收起
|
|
91377
|
+
// 所以此时不需要重新计算 expandedKeys,因为在点击展开按钮时候已经把被展开的项添加到 expandedKeys 中
|
|
91378
|
+
// When treeData has a specific value and props.loadData is set, it is considered that the update of treeData is caused by loadData
|
|
91379
|
+
// If the treeData is changed because of loadData, recalculating the key here will cause the unselected expanded items to be collapsed
|
|
91380
|
+
// So there is no need to recalculate expandedKeys at this time, because the expanded item has been added to expandedKeys when the expand button is clicked
|
|
91381
|
+
if (!(prevState.treeData && ((_a = prevState.treeData) === null || _a === void 0 ? void 0 : _a.length) > 0 && props.loadData)) {
|
|
91382
|
+
newState.expandedKeys = calcExpandedKeysForValues(props.value, keyEntities, props.multiple, valueEntities);
|
|
91383
|
+
}
|
|
91384
|
+
}
|
|
91385
|
+
if (!newState.expandedKeys) {
|
|
91386
|
+
delete newState.expandedKeys;
|
|
91387
|
+
}
|
|
91388
|
+
if (treeData || newState.expandedKeys) {
|
|
91389
|
+
const flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.expandedKeys || prevState.expandedKeys, keyMaps);
|
|
91390
|
+
newState.flattenNodes = flattenNodes;
|
|
91391
|
+
}
|
|
91392
|
+
} else {
|
|
91393
|
+
let filteredState;
|
|
91394
|
+
// treeData changed while searching
|
|
91395
|
+
if (treeData) {
|
|
91396
|
+
// Get filter data
|
|
91397
|
+
filteredState = filterTreeData({
|
|
91398
|
+
treeData,
|
|
91399
|
+
inputValue: prevState.inputValue,
|
|
91400
|
+
filterTreeNode: props.filterTreeNode,
|
|
91401
|
+
filterProps: props.treeNodeFilterProp,
|
|
91402
|
+
showFilteredOnly: props.showFilteredOnly,
|
|
91403
|
+
keyEntities: newState.keyEntities,
|
|
91404
|
+
prevExpandedKeys: [...prevState.filteredExpandedKeys],
|
|
91405
|
+
keyMaps: keyMaps
|
|
91406
|
+
});
|
|
91407
|
+
newState.flattenNodes = filteredState.flattenNodes;
|
|
91408
|
+
newState.motionKeys = new Set([]);
|
|
91409
|
+
newState.filteredKeys = filteredState.filteredKeys;
|
|
91410
|
+
newState.filteredShownKeys = filteredState.filteredShownKeys;
|
|
91411
|
+
newState.filteredExpandedKeys = filteredState.filteredExpandedKeys;
|
|
91412
|
+
}
|
|
91413
|
+
// expandedKeys changed while searching
|
|
91414
|
+
if (props.expandedKeys) {
|
|
91415
|
+
newState.filteredExpandedKeys = calcExpandedKeys(props.expandedKeys, keyEntities, props.autoExpandParent || !prevProps);
|
|
91416
|
+
if (prevProps && props.motion) {
|
|
91417
|
+
const prevKeys = prevState ? prevState.filteredExpandedKeys : new Set([]);
|
|
91418
|
+
// only show animation when treeData does not change
|
|
91419
|
+
if (!treeData) {
|
|
91420
|
+
const motionResult = calcMotionKeys(prevKeys, newState.filteredExpandedKeys, keyEntities);
|
|
91421
|
+
let {
|
|
91422
|
+
motionKeys
|
|
91423
|
+
} = motionResult;
|
|
91424
|
+
const {
|
|
91425
|
+
motionType
|
|
91426
|
+
} = motionResult;
|
|
91427
|
+
if (props.showFilteredOnly) {
|
|
91428
|
+
motionKeys = motionKeys.filter(key => prevState.filteredShownKeys.has(key));
|
|
91429
|
+
}
|
|
91430
|
+
if (motionType === 'hide') {
|
|
91431
|
+
// cache flatten nodes: expandedKeys changed may not be triggered by interaction
|
|
91432
|
+
newState.cachedFlattenNodes = treeUtil_cloneDeep(prevState.flattenNodes);
|
|
91433
|
+
}
|
|
91434
|
+
newState.motionKeys = new Set(motionKeys);
|
|
91435
|
+
newState.motionType = motionType;
|
|
91436
|
+
}
|
|
91437
|
+
}
|
|
91438
|
+
newState.flattenNodes = flattenTreeData(treeData || prevState.treeData, newState.filteredExpandedKeys || prevState.filteredExpandedKeys, keyMaps, props.showFilteredOnly && prevState.filteredShownKeys);
|
|
91439
|
+
}
|
|
91347
91440
|
}
|
|
91348
91441
|
// selectedKeys: single mode controlled
|
|
91349
91442
|
const isMultiple = props.multiple;
|
|
@@ -91450,7 +91543,9 @@ class TreeSelect extends BaseComponent {
|
|
|
91450
91543
|
this.props.onSearch && this.props.onSearch(input, filteredExpandedKeys);
|
|
91451
91544
|
},
|
|
91452
91545
|
cacheFlattenNodes: bool => {
|
|
91453
|
-
this.
|
|
91546
|
+
this.setState({
|
|
91547
|
+
cachedFlattenNodes: bool ? treeUtil_cloneDeep(this.state.flattenNodes) : undefined
|
|
91548
|
+
});
|
|
91454
91549
|
},
|
|
91455
91550
|
notifyLoad: (newLoadedKeys, data) => {
|
|
91456
91551
|
const {
|
|
@@ -91595,7 +91690,8 @@ class TreeSelect extends BaseComponent {
|
|
|
91595
91690
|
autoAdjustOverflow: autoAdjustOverflow,
|
|
91596
91691
|
mouseLeaveDelay: mouseLeaveDelay,
|
|
91597
91692
|
mouseEnterDelay: mouseEnterDelay,
|
|
91598
|
-
onVisibleChange: this.handlePopoverClose
|
|
91693
|
+
onVisibleChange: this.handlePopoverClose,
|
|
91694
|
+
afterClose: this.afterClose
|
|
91599
91695
|
}, selection);
|
|
91600
91696
|
}
|
|
91601
91697
|
}
|
|
@@ -101404,6 +101500,8 @@ Preview.defaultProps = {
|
|
|
101404
101500
|
|
|
101405
101501
|
|
|
101406
101502
|
|
|
101503
|
+
|
|
101504
|
+
|
|
101407
101505
|
|
|
101408
101506
|
|
|
101409
101507
|
|