@douyinfe/semi-ui 2.52.0-beta.1 → 2.52.1
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 +1 -0
- package/dist/css/semi.min.css +1 -1
- package/dist/umd/semi-ui.js +145 -994
- 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/cascader/index.d.ts +3 -2
- package/lib/cjs/cascader/index.js +31 -21
- package/lib/cjs/datePicker/datePicker.js +1 -1
- package/lib/cjs/datePicker/yearAndMonth.js +20 -16
- package/lib/cjs/form/hoc/withField.d.ts +3 -3
- package/lib/cjs/modal/Modal.js +2 -2
- package/lib/cjs/resizeObserver/index.d.ts +0 -1
- package/lib/cjs/resizeObserver/index.js +2 -3
- package/lib/cjs/select/option.js +2 -1
- package/lib/cjs/table/ResizableTable.js +1 -1
- package/lib/cjs/timePicker/TimePicker.d.ts +1 -1
- package/lib/es/cascader/index.d.ts +3 -2
- package/lib/es/cascader/index.js +31 -21
- package/lib/es/datePicker/datePicker.js +1 -1
- package/lib/es/datePicker/yearAndMonth.js +20 -16
- package/lib/es/form/hoc/withField.d.ts +3 -3
- package/lib/es/modal/Modal.js +2 -2
- package/lib/es/resizeObserver/index.d.ts +0 -1
- package/lib/es/resizeObserver/index.js +0 -1
- package/lib/es/select/option.js +2 -1
- package/lib/es/table/ResizableTable.js +1 -1
- package/lib/es/timePicker/TimePicker.d.ts +1 -1
- package/package.json +8 -9
- package/dist/umd/semi-ui.min.js.LICENSE.txt +0 -5
package/dist/umd/semi-ui.js
CHANGED
|
@@ -18633,6 +18633,7 @@ class foundation_Tooltip extends foundation {
|
|
|
18633
18633
|
return null;
|
|
18634
18634
|
}
|
|
18635
18635
|
calcPosStyle(props) {
|
|
18636
|
+
var _a;
|
|
18636
18637
|
const {
|
|
18637
18638
|
spacing,
|
|
18638
18639
|
isOverFlow
|
|
@@ -18683,6 +18684,10 @@ class foundation_Tooltip extends foundation {
|
|
|
18683
18684
|
const isTriggerNearLeft = middleX - containerRect.left < containerRect.right - middleX;
|
|
18684
18685
|
const isTriggerNearTop = middleY - containerRect.top < containerRect.bottom - middleY;
|
|
18685
18686
|
const isWrapperWidthOverflow = wrapperRect.width > innerWidth;
|
|
18687
|
+
const scaled = Math.abs((wrapperRect === null || wrapperRect === void 0 ? void 0 : wrapperRect.width) - ((_a = this._adapter.getContainer()) === null || _a === void 0 ? void 0 : _a.clientWidth)) > 1;
|
|
18688
|
+
if (scaled) {
|
|
18689
|
+
SPACING = SPACING * wrapperRect.width / this._adapter.getContainer().clientWidth;
|
|
18690
|
+
}
|
|
18686
18691
|
switch (position) {
|
|
18687
18692
|
case 'top':
|
|
18688
18693
|
// left = middleX;
|
|
@@ -18799,6 +18804,12 @@ class foundation_Tooltip extends foundation {
|
|
|
18799
18804
|
// Calculate container positioning relative to window
|
|
18800
18805
|
left = left - containerRect.left;
|
|
18801
18806
|
top = top - containerRect.top;
|
|
18807
|
+
if (scaled) {
|
|
18808
|
+
left /= wrapperRect.width / this._adapter.getContainer().clientWidth;
|
|
18809
|
+
}
|
|
18810
|
+
if (scaled) {
|
|
18811
|
+
top /= wrapperRect.height / this._adapter.getContainer().clientHeight;
|
|
18812
|
+
}
|
|
18802
18813
|
/**
|
|
18803
18814
|
* container为body时,如果position不为relative或absolute,这时trigger计算出的top/left会根据html定位(initial containing block)
|
|
18804
18815
|
* 此时如果body有margin,则计算出的位置相对于body会有问题 fix issue #1368
|
|
@@ -22648,942 +22659,11 @@ const getRenderText = function (originEle, rows) {
|
|
|
22648
22659
|
return resText;
|
|
22649
22660
|
};
|
|
22650
22661
|
/* harmony default export */ const util = (getRenderText);
|
|
22651
|
-
;// CONCATENATED MODULE: ../../node_modules/resize-observer-polyfill/dist/ResizeObserver.es.js
|
|
22652
|
-
/**
|
|
22653
|
-
* A collection of shims that provide minimal functionality of the ES6 collections.
|
|
22654
|
-
*
|
|
22655
|
-
* These implementations are not meant to be used outside of the ResizeObserver
|
|
22656
|
-
* modules as they cover only a limited range of use cases.
|
|
22657
|
-
*/
|
|
22658
|
-
/* eslint-disable require-jsdoc, valid-jsdoc */
|
|
22659
|
-
var MapShim = (function () {
|
|
22660
|
-
if (typeof Map !== 'undefined') {
|
|
22661
|
-
return Map;
|
|
22662
|
-
}
|
|
22663
|
-
/**
|
|
22664
|
-
* Returns index in provided array that matches the specified key.
|
|
22665
|
-
*
|
|
22666
|
-
* @param {Array<Array>} arr
|
|
22667
|
-
* @param {*} key
|
|
22668
|
-
* @returns {number}
|
|
22669
|
-
*/
|
|
22670
|
-
function getIndex(arr, key) {
|
|
22671
|
-
var result = -1;
|
|
22672
|
-
arr.some(function (entry, index) {
|
|
22673
|
-
if (entry[0] === key) {
|
|
22674
|
-
result = index;
|
|
22675
|
-
return true;
|
|
22676
|
-
}
|
|
22677
|
-
return false;
|
|
22678
|
-
});
|
|
22679
|
-
return result;
|
|
22680
|
-
}
|
|
22681
|
-
return /** @class */ (function () {
|
|
22682
|
-
function class_1() {
|
|
22683
|
-
this.__entries__ = [];
|
|
22684
|
-
}
|
|
22685
|
-
Object.defineProperty(class_1.prototype, "size", {
|
|
22686
|
-
/**
|
|
22687
|
-
* @returns {boolean}
|
|
22688
|
-
*/
|
|
22689
|
-
get: function () {
|
|
22690
|
-
return this.__entries__.length;
|
|
22691
|
-
},
|
|
22692
|
-
enumerable: true,
|
|
22693
|
-
configurable: true
|
|
22694
|
-
});
|
|
22695
|
-
/**
|
|
22696
|
-
* @param {*} key
|
|
22697
|
-
* @returns {*}
|
|
22698
|
-
*/
|
|
22699
|
-
class_1.prototype.get = function (key) {
|
|
22700
|
-
var index = getIndex(this.__entries__, key);
|
|
22701
|
-
var entry = this.__entries__[index];
|
|
22702
|
-
return entry && entry[1];
|
|
22703
|
-
};
|
|
22704
|
-
/**
|
|
22705
|
-
* @param {*} key
|
|
22706
|
-
* @param {*} value
|
|
22707
|
-
* @returns {void}
|
|
22708
|
-
*/
|
|
22709
|
-
class_1.prototype.set = function (key, value) {
|
|
22710
|
-
var index = getIndex(this.__entries__, key);
|
|
22711
|
-
if (~index) {
|
|
22712
|
-
this.__entries__[index][1] = value;
|
|
22713
|
-
}
|
|
22714
|
-
else {
|
|
22715
|
-
this.__entries__.push([key, value]);
|
|
22716
|
-
}
|
|
22717
|
-
};
|
|
22718
|
-
/**
|
|
22719
|
-
* @param {*} key
|
|
22720
|
-
* @returns {void}
|
|
22721
|
-
*/
|
|
22722
|
-
class_1.prototype.delete = function (key) {
|
|
22723
|
-
var entries = this.__entries__;
|
|
22724
|
-
var index = getIndex(entries, key);
|
|
22725
|
-
if (~index) {
|
|
22726
|
-
entries.splice(index, 1);
|
|
22727
|
-
}
|
|
22728
|
-
};
|
|
22729
|
-
/**
|
|
22730
|
-
* @param {*} key
|
|
22731
|
-
* @returns {void}
|
|
22732
|
-
*/
|
|
22733
|
-
class_1.prototype.has = function (key) {
|
|
22734
|
-
return !!~getIndex(this.__entries__, key);
|
|
22735
|
-
};
|
|
22736
|
-
/**
|
|
22737
|
-
* @returns {void}
|
|
22738
|
-
*/
|
|
22739
|
-
class_1.prototype.clear = function () {
|
|
22740
|
-
this.__entries__.splice(0);
|
|
22741
|
-
};
|
|
22742
|
-
/**
|
|
22743
|
-
* @param {Function} callback
|
|
22744
|
-
* @param {*} [ctx=null]
|
|
22745
|
-
* @returns {void}
|
|
22746
|
-
*/
|
|
22747
|
-
class_1.prototype.forEach = function (callback, ctx) {
|
|
22748
|
-
if (ctx === void 0) { ctx = null; }
|
|
22749
|
-
for (var _i = 0, _a = this.__entries__; _i < _a.length; _i++) {
|
|
22750
|
-
var entry = _a[_i];
|
|
22751
|
-
callback.call(ctx, entry[1], entry[0]);
|
|
22752
|
-
}
|
|
22753
|
-
};
|
|
22754
|
-
return class_1;
|
|
22755
|
-
}());
|
|
22756
|
-
})();
|
|
22757
|
-
|
|
22758
|
-
/**
|
|
22759
|
-
* Detects whether window and document objects are available in current environment.
|
|
22760
|
-
*/
|
|
22761
|
-
var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined' && window.document === document;
|
|
22762
|
-
|
|
22763
|
-
// Returns global object of a current environment.
|
|
22764
|
-
var global$1 = (function () {
|
|
22765
|
-
if (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g.Math === Math) {
|
|
22766
|
-
return __webpack_require__.g;
|
|
22767
|
-
}
|
|
22768
|
-
if (typeof self !== 'undefined' && self.Math === Math) {
|
|
22769
|
-
return self;
|
|
22770
|
-
}
|
|
22771
|
-
if (typeof window !== 'undefined' && window.Math === Math) {
|
|
22772
|
-
return window;
|
|
22773
|
-
}
|
|
22774
|
-
// eslint-disable-next-line no-new-func
|
|
22775
|
-
return Function('return this')();
|
|
22776
|
-
})();
|
|
22777
|
-
|
|
22778
|
-
/**
|
|
22779
|
-
* A shim for the requestAnimationFrame which falls back to the setTimeout if
|
|
22780
|
-
* first one is not supported.
|
|
22781
|
-
*
|
|
22782
|
-
* @returns {number} Requests' identifier.
|
|
22783
|
-
*/
|
|
22784
|
-
var requestAnimationFrame$1 = (function () {
|
|
22785
|
-
if (typeof requestAnimationFrame === 'function') {
|
|
22786
|
-
// It's required to use a bounded function because IE sometimes throws
|
|
22787
|
-
// an "Invalid calling object" error if rAF is invoked without the global
|
|
22788
|
-
// object on the left hand side.
|
|
22789
|
-
return requestAnimationFrame.bind(global$1);
|
|
22790
|
-
}
|
|
22791
|
-
return function (callback) { return setTimeout(function () { return callback(Date.now()); }, 1000 / 60); };
|
|
22792
|
-
})();
|
|
22793
|
-
|
|
22794
|
-
// Defines minimum timeout before adding a trailing call.
|
|
22795
|
-
var trailingTimeout = 2;
|
|
22796
|
-
/**
|
|
22797
|
-
* Creates a wrapper function which ensures that provided callback will be
|
|
22798
|
-
* invoked only once during the specified delay period.
|
|
22799
|
-
*
|
|
22800
|
-
* @param {Function} callback - Function to be invoked after the delay period.
|
|
22801
|
-
* @param {number} delay - Delay after which to invoke callback.
|
|
22802
|
-
* @returns {Function}
|
|
22803
|
-
*/
|
|
22804
|
-
function ResizeObserver_es_throttle (callback, delay) {
|
|
22805
|
-
var leadingCall = false, trailingCall = false, lastCallTime = 0;
|
|
22806
|
-
/**
|
|
22807
|
-
* Invokes the original callback function and schedules new invocation if
|
|
22808
|
-
* the "proxy" was called during current request.
|
|
22809
|
-
*
|
|
22810
|
-
* @returns {void}
|
|
22811
|
-
*/
|
|
22812
|
-
function resolvePending() {
|
|
22813
|
-
if (leadingCall) {
|
|
22814
|
-
leadingCall = false;
|
|
22815
|
-
callback();
|
|
22816
|
-
}
|
|
22817
|
-
if (trailingCall) {
|
|
22818
|
-
proxy();
|
|
22819
|
-
}
|
|
22820
|
-
}
|
|
22821
|
-
/**
|
|
22822
|
-
* Callback invoked after the specified delay. It will further postpone
|
|
22823
|
-
* invocation of the original function delegating it to the
|
|
22824
|
-
* requestAnimationFrame.
|
|
22825
|
-
*
|
|
22826
|
-
* @returns {void}
|
|
22827
|
-
*/
|
|
22828
|
-
function timeoutCallback() {
|
|
22829
|
-
requestAnimationFrame$1(resolvePending);
|
|
22830
|
-
}
|
|
22831
|
-
/**
|
|
22832
|
-
* Schedules invocation of the original function.
|
|
22833
|
-
*
|
|
22834
|
-
* @returns {void}
|
|
22835
|
-
*/
|
|
22836
|
-
function proxy() {
|
|
22837
|
-
var timeStamp = Date.now();
|
|
22838
|
-
if (leadingCall) {
|
|
22839
|
-
// Reject immediately following calls.
|
|
22840
|
-
if (timeStamp - lastCallTime < trailingTimeout) {
|
|
22841
|
-
return;
|
|
22842
|
-
}
|
|
22843
|
-
// Schedule new call to be in invoked when the pending one is resolved.
|
|
22844
|
-
// This is important for "transitions" which never actually start
|
|
22845
|
-
// immediately so there is a chance that we might miss one if change
|
|
22846
|
-
// happens amids the pending invocation.
|
|
22847
|
-
trailingCall = true;
|
|
22848
|
-
}
|
|
22849
|
-
else {
|
|
22850
|
-
leadingCall = true;
|
|
22851
|
-
trailingCall = false;
|
|
22852
|
-
setTimeout(timeoutCallback, delay);
|
|
22853
|
-
}
|
|
22854
|
-
lastCallTime = timeStamp;
|
|
22855
|
-
}
|
|
22856
|
-
return proxy;
|
|
22857
|
-
}
|
|
22858
|
-
|
|
22859
|
-
// Minimum delay before invoking the update of observers.
|
|
22860
|
-
var REFRESH_DELAY = 20;
|
|
22861
|
-
// A list of substrings of CSS properties used to find transition events that
|
|
22862
|
-
// might affect dimensions of observed elements.
|
|
22863
|
-
var transitionKeys = ['top', 'right', 'bottom', 'left', 'width', 'height', 'size', 'weight'];
|
|
22864
|
-
// Check if MutationObserver is available.
|
|
22865
|
-
var mutationObserverSupported = typeof MutationObserver !== 'undefined';
|
|
22866
|
-
/**
|
|
22867
|
-
* Singleton controller class which handles updates of ResizeObserver instances.
|
|
22868
|
-
*/
|
|
22869
|
-
var ResizeObserverController = /** @class */ (function () {
|
|
22870
|
-
/**
|
|
22871
|
-
* Creates a new instance of ResizeObserverController.
|
|
22872
|
-
*
|
|
22873
|
-
* @private
|
|
22874
|
-
*/
|
|
22875
|
-
function ResizeObserverController() {
|
|
22876
|
-
/**
|
|
22877
|
-
* Indicates whether DOM listeners have been added.
|
|
22878
|
-
*
|
|
22879
|
-
* @private {boolean}
|
|
22880
|
-
*/
|
|
22881
|
-
this.connected_ = false;
|
|
22882
|
-
/**
|
|
22883
|
-
* Tells that controller has subscribed for Mutation Events.
|
|
22884
|
-
*
|
|
22885
|
-
* @private {boolean}
|
|
22886
|
-
*/
|
|
22887
|
-
this.mutationEventsAdded_ = false;
|
|
22888
|
-
/**
|
|
22889
|
-
* Keeps reference to the instance of MutationObserver.
|
|
22890
|
-
*
|
|
22891
|
-
* @private {MutationObserver}
|
|
22892
|
-
*/
|
|
22893
|
-
this.mutationsObserver_ = null;
|
|
22894
|
-
/**
|
|
22895
|
-
* A list of connected observers.
|
|
22896
|
-
*
|
|
22897
|
-
* @private {Array<ResizeObserverSPI>}
|
|
22898
|
-
*/
|
|
22899
|
-
this.observers_ = [];
|
|
22900
|
-
this.onTransitionEnd_ = this.onTransitionEnd_.bind(this);
|
|
22901
|
-
this.refresh = ResizeObserver_es_throttle(this.refresh.bind(this), REFRESH_DELAY);
|
|
22902
|
-
}
|
|
22903
|
-
/**
|
|
22904
|
-
* Adds observer to observers list.
|
|
22905
|
-
*
|
|
22906
|
-
* @param {ResizeObserverSPI} observer - Observer to be added.
|
|
22907
|
-
* @returns {void}
|
|
22908
|
-
*/
|
|
22909
|
-
ResizeObserverController.prototype.addObserver = function (observer) {
|
|
22910
|
-
if (!~this.observers_.indexOf(observer)) {
|
|
22911
|
-
this.observers_.push(observer);
|
|
22912
|
-
}
|
|
22913
|
-
// Add listeners if they haven't been added yet.
|
|
22914
|
-
if (!this.connected_) {
|
|
22915
|
-
this.connect_();
|
|
22916
|
-
}
|
|
22917
|
-
};
|
|
22918
|
-
/**
|
|
22919
|
-
* Removes observer from observers list.
|
|
22920
|
-
*
|
|
22921
|
-
* @param {ResizeObserverSPI} observer - Observer to be removed.
|
|
22922
|
-
* @returns {void}
|
|
22923
|
-
*/
|
|
22924
|
-
ResizeObserverController.prototype.removeObserver = function (observer) {
|
|
22925
|
-
var observers = this.observers_;
|
|
22926
|
-
var index = observers.indexOf(observer);
|
|
22927
|
-
// Remove observer if it's present in registry.
|
|
22928
|
-
if (~index) {
|
|
22929
|
-
observers.splice(index, 1);
|
|
22930
|
-
}
|
|
22931
|
-
// Remove listeners if controller has no connected observers.
|
|
22932
|
-
if (!observers.length && this.connected_) {
|
|
22933
|
-
this.disconnect_();
|
|
22934
|
-
}
|
|
22935
|
-
};
|
|
22936
|
-
/**
|
|
22937
|
-
* Invokes the update of observers. It will continue running updates insofar
|
|
22938
|
-
* it detects changes.
|
|
22939
|
-
*
|
|
22940
|
-
* @returns {void}
|
|
22941
|
-
*/
|
|
22942
|
-
ResizeObserverController.prototype.refresh = function () {
|
|
22943
|
-
var changesDetected = this.updateObservers_();
|
|
22944
|
-
// Continue running updates if changes have been detected as there might
|
|
22945
|
-
// be future ones caused by CSS transitions.
|
|
22946
|
-
if (changesDetected) {
|
|
22947
|
-
this.refresh();
|
|
22948
|
-
}
|
|
22949
|
-
};
|
|
22950
|
-
/**
|
|
22951
|
-
* Updates every observer from observers list and notifies them of queued
|
|
22952
|
-
* entries.
|
|
22953
|
-
*
|
|
22954
|
-
* @private
|
|
22955
|
-
* @returns {boolean} Returns "true" if any observer has detected changes in
|
|
22956
|
-
* dimensions of it's elements.
|
|
22957
|
-
*/
|
|
22958
|
-
ResizeObserverController.prototype.updateObservers_ = function () {
|
|
22959
|
-
// Collect observers that have active observations.
|
|
22960
|
-
var activeObservers = this.observers_.filter(function (observer) {
|
|
22961
|
-
return observer.gatherActive(), observer.hasActive();
|
|
22962
|
-
});
|
|
22963
|
-
// Deliver notifications in a separate cycle in order to avoid any
|
|
22964
|
-
// collisions between observers, e.g. when multiple instances of
|
|
22965
|
-
// ResizeObserver are tracking the same element and the callback of one
|
|
22966
|
-
// of them changes content dimensions of the observed target. Sometimes
|
|
22967
|
-
// this may result in notifications being blocked for the rest of observers.
|
|
22968
|
-
activeObservers.forEach(function (observer) { return observer.broadcastActive(); });
|
|
22969
|
-
return activeObservers.length > 0;
|
|
22970
|
-
};
|
|
22971
|
-
/**
|
|
22972
|
-
* Initializes DOM listeners.
|
|
22973
|
-
*
|
|
22974
|
-
* @private
|
|
22975
|
-
* @returns {void}
|
|
22976
|
-
*/
|
|
22977
|
-
ResizeObserverController.prototype.connect_ = function () {
|
|
22978
|
-
// Do nothing if running in a non-browser environment or if listeners
|
|
22979
|
-
// have been already added.
|
|
22980
|
-
if (!isBrowser || this.connected_) {
|
|
22981
|
-
return;
|
|
22982
|
-
}
|
|
22983
|
-
// Subscription to the "Transitionend" event is used as a workaround for
|
|
22984
|
-
// delayed transitions. This way it's possible to capture at least the
|
|
22985
|
-
// final state of an element.
|
|
22986
|
-
document.addEventListener('transitionend', this.onTransitionEnd_);
|
|
22987
|
-
window.addEventListener('resize', this.refresh);
|
|
22988
|
-
if (mutationObserverSupported) {
|
|
22989
|
-
this.mutationsObserver_ = new MutationObserver(this.refresh);
|
|
22990
|
-
this.mutationsObserver_.observe(document, {
|
|
22991
|
-
attributes: true,
|
|
22992
|
-
childList: true,
|
|
22993
|
-
characterData: true,
|
|
22994
|
-
subtree: true
|
|
22995
|
-
});
|
|
22996
|
-
}
|
|
22997
|
-
else {
|
|
22998
|
-
document.addEventListener('DOMSubtreeModified', this.refresh);
|
|
22999
|
-
this.mutationEventsAdded_ = true;
|
|
23000
|
-
}
|
|
23001
|
-
this.connected_ = true;
|
|
23002
|
-
};
|
|
23003
|
-
/**
|
|
23004
|
-
* Removes DOM listeners.
|
|
23005
|
-
*
|
|
23006
|
-
* @private
|
|
23007
|
-
* @returns {void}
|
|
23008
|
-
*/
|
|
23009
|
-
ResizeObserverController.prototype.disconnect_ = function () {
|
|
23010
|
-
// Do nothing if running in a non-browser environment or if listeners
|
|
23011
|
-
// have been already removed.
|
|
23012
|
-
if (!isBrowser || !this.connected_) {
|
|
23013
|
-
return;
|
|
23014
|
-
}
|
|
23015
|
-
document.removeEventListener('transitionend', this.onTransitionEnd_);
|
|
23016
|
-
window.removeEventListener('resize', this.refresh);
|
|
23017
|
-
if (this.mutationsObserver_) {
|
|
23018
|
-
this.mutationsObserver_.disconnect();
|
|
23019
|
-
}
|
|
23020
|
-
if (this.mutationEventsAdded_) {
|
|
23021
|
-
document.removeEventListener('DOMSubtreeModified', this.refresh);
|
|
23022
|
-
}
|
|
23023
|
-
this.mutationsObserver_ = null;
|
|
23024
|
-
this.mutationEventsAdded_ = false;
|
|
23025
|
-
this.connected_ = false;
|
|
23026
|
-
};
|
|
23027
|
-
/**
|
|
23028
|
-
* "Transitionend" event handler.
|
|
23029
|
-
*
|
|
23030
|
-
* @private
|
|
23031
|
-
* @param {TransitionEvent} event
|
|
23032
|
-
* @returns {void}
|
|
23033
|
-
*/
|
|
23034
|
-
ResizeObserverController.prototype.onTransitionEnd_ = function (_a) {
|
|
23035
|
-
var _b = _a.propertyName, propertyName = _b === void 0 ? '' : _b;
|
|
23036
|
-
// Detect whether transition may affect dimensions of an element.
|
|
23037
|
-
var isReflowProperty = transitionKeys.some(function (key) {
|
|
23038
|
-
return !!~propertyName.indexOf(key);
|
|
23039
|
-
});
|
|
23040
|
-
if (isReflowProperty) {
|
|
23041
|
-
this.refresh();
|
|
23042
|
-
}
|
|
23043
|
-
};
|
|
23044
|
-
/**
|
|
23045
|
-
* Returns instance of the ResizeObserverController.
|
|
23046
|
-
*
|
|
23047
|
-
* @returns {ResizeObserverController}
|
|
23048
|
-
*/
|
|
23049
|
-
ResizeObserverController.getInstance = function () {
|
|
23050
|
-
if (!this.instance_) {
|
|
23051
|
-
this.instance_ = new ResizeObserverController();
|
|
23052
|
-
}
|
|
23053
|
-
return this.instance_;
|
|
23054
|
-
};
|
|
23055
|
-
/**
|
|
23056
|
-
* Holds reference to the controller's instance.
|
|
23057
|
-
*
|
|
23058
|
-
* @private {ResizeObserverController}
|
|
23059
|
-
*/
|
|
23060
|
-
ResizeObserverController.instance_ = null;
|
|
23061
|
-
return ResizeObserverController;
|
|
23062
|
-
}());
|
|
23063
|
-
|
|
23064
|
-
/**
|
|
23065
|
-
* Defines non-writable/enumerable properties of the provided target object.
|
|
23066
|
-
*
|
|
23067
|
-
* @param {Object} target - Object for which to define properties.
|
|
23068
|
-
* @param {Object} props - Properties to be defined.
|
|
23069
|
-
* @returns {Object} Target object.
|
|
23070
|
-
*/
|
|
23071
|
-
var defineConfigurable = (function (target, props) {
|
|
23072
|
-
for (var _i = 0, _a = Object.keys(props); _i < _a.length; _i++) {
|
|
23073
|
-
var key = _a[_i];
|
|
23074
|
-
Object.defineProperty(target, key, {
|
|
23075
|
-
value: props[key],
|
|
23076
|
-
enumerable: false,
|
|
23077
|
-
writable: false,
|
|
23078
|
-
configurable: true
|
|
23079
|
-
});
|
|
23080
|
-
}
|
|
23081
|
-
return target;
|
|
23082
|
-
});
|
|
23083
|
-
|
|
23084
|
-
/**
|
|
23085
|
-
* Returns the global object associated with provided element.
|
|
23086
|
-
*
|
|
23087
|
-
* @param {Object} target
|
|
23088
|
-
* @returns {Object}
|
|
23089
|
-
*/
|
|
23090
|
-
var getWindowOf = (function (target) {
|
|
23091
|
-
// Assume that the element is an instance of Node, which means that it
|
|
23092
|
-
// has the "ownerDocument" property from which we can retrieve a
|
|
23093
|
-
// corresponding global object.
|
|
23094
|
-
var ownerGlobal = target && target.ownerDocument && target.ownerDocument.defaultView;
|
|
23095
|
-
// Return the local global object if it's not possible extract one from
|
|
23096
|
-
// provided element.
|
|
23097
|
-
return ownerGlobal || global$1;
|
|
23098
|
-
});
|
|
23099
|
-
|
|
23100
|
-
// Placeholder of an empty content rectangle.
|
|
23101
|
-
var emptyRect = createRectInit(0, 0, 0, 0);
|
|
23102
|
-
/**
|
|
23103
|
-
* Converts provided string to a number.
|
|
23104
|
-
*
|
|
23105
|
-
* @param {number|string} value
|
|
23106
|
-
* @returns {number}
|
|
23107
|
-
*/
|
|
23108
|
-
function toFloat(value) {
|
|
23109
|
-
return parseFloat(value) || 0;
|
|
23110
|
-
}
|
|
23111
|
-
/**
|
|
23112
|
-
* Extracts borders size from provided styles.
|
|
23113
|
-
*
|
|
23114
|
-
* @param {CSSStyleDeclaration} styles
|
|
23115
|
-
* @param {...string} positions - Borders positions (top, right, ...)
|
|
23116
|
-
* @returns {number}
|
|
23117
|
-
*/
|
|
23118
|
-
function getBordersSize(styles) {
|
|
23119
|
-
var positions = [];
|
|
23120
|
-
for (var _i = 1; _i < arguments.length; _i++) {
|
|
23121
|
-
positions[_i - 1] = arguments[_i];
|
|
23122
|
-
}
|
|
23123
|
-
return positions.reduce(function (size, position) {
|
|
23124
|
-
var value = styles['border-' + position + '-width'];
|
|
23125
|
-
return size + toFloat(value);
|
|
23126
|
-
}, 0);
|
|
23127
|
-
}
|
|
23128
|
-
/**
|
|
23129
|
-
* Extracts paddings sizes from provided styles.
|
|
23130
|
-
*
|
|
23131
|
-
* @param {CSSStyleDeclaration} styles
|
|
23132
|
-
* @returns {Object} Paddings box.
|
|
23133
|
-
*/
|
|
23134
|
-
function getPaddings(styles) {
|
|
23135
|
-
var positions = ['top', 'right', 'bottom', 'left'];
|
|
23136
|
-
var paddings = {};
|
|
23137
|
-
for (var _i = 0, positions_1 = positions; _i < positions_1.length; _i++) {
|
|
23138
|
-
var position = positions_1[_i];
|
|
23139
|
-
var value = styles['padding-' + position];
|
|
23140
|
-
paddings[position] = toFloat(value);
|
|
23141
|
-
}
|
|
23142
|
-
return paddings;
|
|
23143
|
-
}
|
|
23144
|
-
/**
|
|
23145
|
-
* Calculates content rectangle of provided SVG element.
|
|
23146
|
-
*
|
|
23147
|
-
* @param {SVGGraphicsElement} target - Element content rectangle of which needs
|
|
23148
|
-
* to be calculated.
|
|
23149
|
-
* @returns {DOMRectInit}
|
|
23150
|
-
*/
|
|
23151
|
-
function getSVGContentRect(target) {
|
|
23152
|
-
var bbox = target.getBBox();
|
|
23153
|
-
return createRectInit(0, 0, bbox.width, bbox.height);
|
|
23154
|
-
}
|
|
23155
|
-
/**
|
|
23156
|
-
* Calculates content rectangle of provided HTMLElement.
|
|
23157
|
-
*
|
|
23158
|
-
* @param {HTMLElement} target - Element for which to calculate the content rectangle.
|
|
23159
|
-
* @returns {DOMRectInit}
|
|
23160
|
-
*/
|
|
23161
|
-
function getHTMLElementContentRect(target) {
|
|
23162
|
-
// Client width & height properties can't be
|
|
23163
|
-
// used exclusively as they provide rounded values.
|
|
23164
|
-
var clientWidth = target.clientWidth, clientHeight = target.clientHeight;
|
|
23165
|
-
// By this condition we can catch all non-replaced inline, hidden and
|
|
23166
|
-
// detached elements. Though elements with width & height properties less
|
|
23167
|
-
// than 0.5 will be discarded as well.
|
|
23168
|
-
//
|
|
23169
|
-
// Without it we would need to implement separate methods for each of
|
|
23170
|
-
// those cases and it's not possible to perform a precise and performance
|
|
23171
|
-
// effective test for hidden elements. E.g. even jQuery's ':visible' filter
|
|
23172
|
-
// gives wrong results for elements with width & height less than 0.5.
|
|
23173
|
-
if (!clientWidth && !clientHeight) {
|
|
23174
|
-
return emptyRect;
|
|
23175
|
-
}
|
|
23176
|
-
var styles = getWindowOf(target).getComputedStyle(target);
|
|
23177
|
-
var paddings = getPaddings(styles);
|
|
23178
|
-
var horizPad = paddings.left + paddings.right;
|
|
23179
|
-
var vertPad = paddings.top + paddings.bottom;
|
|
23180
|
-
// Computed styles of width & height are being used because they are the
|
|
23181
|
-
// only dimensions available to JS that contain non-rounded values. It could
|
|
23182
|
-
// be possible to utilize the getBoundingClientRect if only it's data wasn't
|
|
23183
|
-
// affected by CSS transformations let alone paddings, borders and scroll bars.
|
|
23184
|
-
var width = toFloat(styles.width), height = toFloat(styles.height);
|
|
23185
|
-
// Width & height include paddings and borders when the 'border-box' box
|
|
23186
|
-
// model is applied (except for IE).
|
|
23187
|
-
if (styles.boxSizing === 'border-box') {
|
|
23188
|
-
// Following conditions are required to handle Internet Explorer which
|
|
23189
|
-
// doesn't include paddings and borders to computed CSS dimensions.
|
|
23190
|
-
//
|
|
23191
|
-
// We can say that if CSS dimensions + paddings are equal to the "client"
|
|
23192
|
-
// properties then it's either IE, and thus we don't need to subtract
|
|
23193
|
-
// anything, or an element merely doesn't have paddings/borders styles.
|
|
23194
|
-
if (Math.round(width + horizPad) !== clientWidth) {
|
|
23195
|
-
width -= getBordersSize(styles, 'left', 'right') + horizPad;
|
|
23196
|
-
}
|
|
23197
|
-
if (Math.round(height + vertPad) !== clientHeight) {
|
|
23198
|
-
height -= getBordersSize(styles, 'top', 'bottom') + vertPad;
|
|
23199
|
-
}
|
|
23200
|
-
}
|
|
23201
|
-
// Following steps can't be applied to the document's root element as its
|
|
23202
|
-
// client[Width/Height] properties represent viewport area of the window.
|
|
23203
|
-
// Besides, it's as well not necessary as the <html> itself neither has
|
|
23204
|
-
// rendered scroll bars nor it can be clipped.
|
|
23205
|
-
if (!isDocumentElement(target)) {
|
|
23206
|
-
// In some browsers (only in Firefox, actually) CSS width & height
|
|
23207
|
-
// include scroll bars size which can be removed at this step as scroll
|
|
23208
|
-
// bars are the only difference between rounded dimensions + paddings
|
|
23209
|
-
// and "client" properties, though that is not always true in Chrome.
|
|
23210
|
-
var vertScrollbar = Math.round(width + horizPad) - clientWidth;
|
|
23211
|
-
var horizScrollbar = Math.round(height + vertPad) - clientHeight;
|
|
23212
|
-
// Chrome has a rather weird rounding of "client" properties.
|
|
23213
|
-
// E.g. for an element with content width of 314.2px it sometimes gives
|
|
23214
|
-
// the client width of 315px and for the width of 314.7px it may give
|
|
23215
|
-
// 314px. And it doesn't happen all the time. So just ignore this delta
|
|
23216
|
-
// as a non-relevant.
|
|
23217
|
-
if (Math.abs(vertScrollbar) !== 1) {
|
|
23218
|
-
width -= vertScrollbar;
|
|
23219
|
-
}
|
|
23220
|
-
if (Math.abs(horizScrollbar) !== 1) {
|
|
23221
|
-
height -= horizScrollbar;
|
|
23222
|
-
}
|
|
23223
|
-
}
|
|
23224
|
-
return createRectInit(paddings.left, paddings.top, width, height);
|
|
23225
|
-
}
|
|
23226
|
-
/**
|
|
23227
|
-
* Checks whether provided element is an instance of the SVGGraphicsElement.
|
|
23228
|
-
*
|
|
23229
|
-
* @param {Element} target - Element to be checked.
|
|
23230
|
-
* @returns {boolean}
|
|
23231
|
-
*/
|
|
23232
|
-
var isSVGGraphicsElement = (function () {
|
|
23233
|
-
// Some browsers, namely IE and Edge, don't have the SVGGraphicsElement
|
|
23234
|
-
// interface.
|
|
23235
|
-
if (typeof SVGGraphicsElement !== 'undefined') {
|
|
23236
|
-
return function (target) { return target instanceof getWindowOf(target).SVGGraphicsElement; };
|
|
23237
|
-
}
|
|
23238
|
-
// If it's so, then check that element is at least an instance of the
|
|
23239
|
-
// SVGElement and that it has the "getBBox" method.
|
|
23240
|
-
// eslint-disable-next-line no-extra-parens
|
|
23241
|
-
return function (target) { return (target instanceof getWindowOf(target).SVGElement &&
|
|
23242
|
-
typeof target.getBBox === 'function'); };
|
|
23243
|
-
})();
|
|
23244
|
-
/**
|
|
23245
|
-
* Checks whether provided element is a document element (<html>).
|
|
23246
|
-
*
|
|
23247
|
-
* @param {Element} target - Element to be checked.
|
|
23248
|
-
* @returns {boolean}
|
|
23249
|
-
*/
|
|
23250
|
-
function isDocumentElement(target) {
|
|
23251
|
-
return target === getWindowOf(target).document.documentElement;
|
|
23252
|
-
}
|
|
23253
|
-
/**
|
|
23254
|
-
* Calculates an appropriate content rectangle for provided html or svg element.
|
|
23255
|
-
*
|
|
23256
|
-
* @param {Element} target - Element content rectangle of which needs to be calculated.
|
|
23257
|
-
* @returns {DOMRectInit}
|
|
23258
|
-
*/
|
|
23259
|
-
function getContentRect(target) {
|
|
23260
|
-
if (!isBrowser) {
|
|
23261
|
-
return emptyRect;
|
|
23262
|
-
}
|
|
23263
|
-
if (isSVGGraphicsElement(target)) {
|
|
23264
|
-
return getSVGContentRect(target);
|
|
23265
|
-
}
|
|
23266
|
-
return getHTMLElementContentRect(target);
|
|
23267
|
-
}
|
|
23268
|
-
/**
|
|
23269
|
-
* Creates rectangle with an interface of the DOMRectReadOnly.
|
|
23270
|
-
* Spec: https://drafts.fxtf.org/geometry/#domrectreadonly
|
|
23271
|
-
*
|
|
23272
|
-
* @param {DOMRectInit} rectInit - Object with rectangle's x/y coordinates and dimensions.
|
|
23273
|
-
* @returns {DOMRectReadOnly}
|
|
23274
|
-
*/
|
|
23275
|
-
function createReadOnlyRect(_a) {
|
|
23276
|
-
var x = _a.x, y = _a.y, width = _a.width, height = _a.height;
|
|
23277
|
-
// If DOMRectReadOnly is available use it as a prototype for the rectangle.
|
|
23278
|
-
var Constr = typeof DOMRectReadOnly !== 'undefined' ? DOMRectReadOnly : Object;
|
|
23279
|
-
var rect = Object.create(Constr.prototype);
|
|
23280
|
-
// Rectangle's properties are not writable and non-enumerable.
|
|
23281
|
-
defineConfigurable(rect, {
|
|
23282
|
-
x: x, y: y, width: width, height: height,
|
|
23283
|
-
top: y,
|
|
23284
|
-
right: x + width,
|
|
23285
|
-
bottom: height + y,
|
|
23286
|
-
left: x
|
|
23287
|
-
});
|
|
23288
|
-
return rect;
|
|
23289
|
-
}
|
|
23290
|
-
/**
|
|
23291
|
-
* Creates DOMRectInit object based on the provided dimensions and the x/y coordinates.
|
|
23292
|
-
* Spec: https://drafts.fxtf.org/geometry/#dictdef-domrectinit
|
|
23293
|
-
*
|
|
23294
|
-
* @param {number} x - X coordinate.
|
|
23295
|
-
* @param {number} y - Y coordinate.
|
|
23296
|
-
* @param {number} width - Rectangle's width.
|
|
23297
|
-
* @param {number} height - Rectangle's height.
|
|
23298
|
-
* @returns {DOMRectInit}
|
|
23299
|
-
*/
|
|
23300
|
-
function createRectInit(x, y, width, height) {
|
|
23301
|
-
return { x: x, y: y, width: width, height: height };
|
|
23302
|
-
}
|
|
23303
|
-
|
|
23304
|
-
/**
|
|
23305
|
-
* Class that is responsible for computations of the content rectangle of
|
|
23306
|
-
* provided DOM element and for keeping track of it's changes.
|
|
23307
|
-
*/
|
|
23308
|
-
var ResizeObservation = /** @class */ (function () {
|
|
23309
|
-
/**
|
|
23310
|
-
* Creates an instance of ResizeObservation.
|
|
23311
|
-
*
|
|
23312
|
-
* @param {Element} target - Element to be observed.
|
|
23313
|
-
*/
|
|
23314
|
-
function ResizeObservation(target) {
|
|
23315
|
-
/**
|
|
23316
|
-
* Broadcasted width of content rectangle.
|
|
23317
|
-
*
|
|
23318
|
-
* @type {number}
|
|
23319
|
-
*/
|
|
23320
|
-
this.broadcastWidth = 0;
|
|
23321
|
-
/**
|
|
23322
|
-
* Broadcasted height of content rectangle.
|
|
23323
|
-
*
|
|
23324
|
-
* @type {number}
|
|
23325
|
-
*/
|
|
23326
|
-
this.broadcastHeight = 0;
|
|
23327
|
-
/**
|
|
23328
|
-
* Reference to the last observed content rectangle.
|
|
23329
|
-
*
|
|
23330
|
-
* @private {DOMRectInit}
|
|
23331
|
-
*/
|
|
23332
|
-
this.contentRect_ = createRectInit(0, 0, 0, 0);
|
|
23333
|
-
this.target = target;
|
|
23334
|
-
}
|
|
23335
|
-
/**
|
|
23336
|
-
* Updates content rectangle and tells whether it's width or height properties
|
|
23337
|
-
* have changed since the last broadcast.
|
|
23338
|
-
*
|
|
23339
|
-
* @returns {boolean}
|
|
23340
|
-
*/
|
|
23341
|
-
ResizeObservation.prototype.isActive = function () {
|
|
23342
|
-
var rect = getContentRect(this.target);
|
|
23343
|
-
this.contentRect_ = rect;
|
|
23344
|
-
return (rect.width !== this.broadcastWidth ||
|
|
23345
|
-
rect.height !== this.broadcastHeight);
|
|
23346
|
-
};
|
|
23347
|
-
/**
|
|
23348
|
-
* Updates 'broadcastWidth' and 'broadcastHeight' properties with a data
|
|
23349
|
-
* from the corresponding properties of the last observed content rectangle.
|
|
23350
|
-
*
|
|
23351
|
-
* @returns {DOMRectInit} Last observed content rectangle.
|
|
23352
|
-
*/
|
|
23353
|
-
ResizeObservation.prototype.broadcastRect = function () {
|
|
23354
|
-
var rect = this.contentRect_;
|
|
23355
|
-
this.broadcastWidth = rect.width;
|
|
23356
|
-
this.broadcastHeight = rect.height;
|
|
23357
|
-
return rect;
|
|
23358
|
-
};
|
|
23359
|
-
return ResizeObservation;
|
|
23360
|
-
}());
|
|
23361
|
-
|
|
23362
|
-
var ResizeObserverEntry = /** @class */ (function () {
|
|
23363
|
-
/**
|
|
23364
|
-
* Creates an instance of ResizeObserverEntry.
|
|
23365
|
-
*
|
|
23366
|
-
* @param {Element} target - Element that is being observed.
|
|
23367
|
-
* @param {DOMRectInit} rectInit - Data of the element's content rectangle.
|
|
23368
|
-
*/
|
|
23369
|
-
function ResizeObserverEntry(target, rectInit) {
|
|
23370
|
-
var contentRect = createReadOnlyRect(rectInit);
|
|
23371
|
-
// According to the specification following properties are not writable
|
|
23372
|
-
// and are also not enumerable in the native implementation.
|
|
23373
|
-
//
|
|
23374
|
-
// Property accessors are not being used as they'd require to define a
|
|
23375
|
-
// private WeakMap storage which may cause memory leaks in browsers that
|
|
23376
|
-
// don't support this type of collections.
|
|
23377
|
-
defineConfigurable(this, { target: target, contentRect: contentRect });
|
|
23378
|
-
}
|
|
23379
|
-
return ResizeObserverEntry;
|
|
23380
|
-
}());
|
|
23381
|
-
|
|
23382
|
-
var ResizeObserverSPI = /** @class */ (function () {
|
|
23383
|
-
/**
|
|
23384
|
-
* Creates a new instance of ResizeObserver.
|
|
23385
|
-
*
|
|
23386
|
-
* @param {ResizeObserverCallback} callback - Callback function that is invoked
|
|
23387
|
-
* when one of the observed elements changes it's content dimensions.
|
|
23388
|
-
* @param {ResizeObserverController} controller - Controller instance which
|
|
23389
|
-
* is responsible for the updates of observer.
|
|
23390
|
-
* @param {ResizeObserver} callbackCtx - Reference to the public
|
|
23391
|
-
* ResizeObserver instance which will be passed to callback function.
|
|
23392
|
-
*/
|
|
23393
|
-
function ResizeObserverSPI(callback, controller, callbackCtx) {
|
|
23394
|
-
/**
|
|
23395
|
-
* Collection of resize observations that have detected changes in dimensions
|
|
23396
|
-
* of elements.
|
|
23397
|
-
*
|
|
23398
|
-
* @private {Array<ResizeObservation>}
|
|
23399
|
-
*/
|
|
23400
|
-
this.activeObservations_ = [];
|
|
23401
|
-
/**
|
|
23402
|
-
* Registry of the ResizeObservation instances.
|
|
23403
|
-
*
|
|
23404
|
-
* @private {Map<Element, ResizeObservation>}
|
|
23405
|
-
*/
|
|
23406
|
-
this.observations_ = new MapShim();
|
|
23407
|
-
if (typeof callback !== 'function') {
|
|
23408
|
-
throw new TypeError('The callback provided as parameter 1 is not a function.');
|
|
23409
|
-
}
|
|
23410
|
-
this.callback_ = callback;
|
|
23411
|
-
this.controller_ = controller;
|
|
23412
|
-
this.callbackCtx_ = callbackCtx;
|
|
23413
|
-
}
|
|
23414
|
-
/**
|
|
23415
|
-
* Starts observing provided element.
|
|
23416
|
-
*
|
|
23417
|
-
* @param {Element} target - Element to be observed.
|
|
23418
|
-
* @returns {void}
|
|
23419
|
-
*/
|
|
23420
|
-
ResizeObserverSPI.prototype.observe = function (target) {
|
|
23421
|
-
if (!arguments.length) {
|
|
23422
|
-
throw new TypeError('1 argument required, but only 0 present.');
|
|
23423
|
-
}
|
|
23424
|
-
// Do nothing if current environment doesn't have the Element interface.
|
|
23425
|
-
if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
|
23426
|
-
return;
|
|
23427
|
-
}
|
|
23428
|
-
if (!(target instanceof getWindowOf(target).Element)) {
|
|
23429
|
-
throw new TypeError('parameter 1 is not of type "Element".');
|
|
23430
|
-
}
|
|
23431
|
-
var observations = this.observations_;
|
|
23432
|
-
// Do nothing if element is already being observed.
|
|
23433
|
-
if (observations.has(target)) {
|
|
23434
|
-
return;
|
|
23435
|
-
}
|
|
23436
|
-
observations.set(target, new ResizeObservation(target));
|
|
23437
|
-
this.controller_.addObserver(this);
|
|
23438
|
-
// Force the update of observations.
|
|
23439
|
-
this.controller_.refresh();
|
|
23440
|
-
};
|
|
23441
|
-
/**
|
|
23442
|
-
* Stops observing provided element.
|
|
23443
|
-
*
|
|
23444
|
-
* @param {Element} target - Element to stop observing.
|
|
23445
|
-
* @returns {void}
|
|
23446
|
-
*/
|
|
23447
|
-
ResizeObserverSPI.prototype.unobserve = function (target) {
|
|
23448
|
-
if (!arguments.length) {
|
|
23449
|
-
throw new TypeError('1 argument required, but only 0 present.');
|
|
23450
|
-
}
|
|
23451
|
-
// Do nothing if current environment doesn't have the Element interface.
|
|
23452
|
-
if (typeof Element === 'undefined' || !(Element instanceof Object)) {
|
|
23453
|
-
return;
|
|
23454
|
-
}
|
|
23455
|
-
if (!(target instanceof getWindowOf(target).Element)) {
|
|
23456
|
-
throw new TypeError('parameter 1 is not of type "Element".');
|
|
23457
|
-
}
|
|
23458
|
-
var observations = this.observations_;
|
|
23459
|
-
// Do nothing if element is not being observed.
|
|
23460
|
-
if (!observations.has(target)) {
|
|
23461
|
-
return;
|
|
23462
|
-
}
|
|
23463
|
-
observations.delete(target);
|
|
23464
|
-
if (!observations.size) {
|
|
23465
|
-
this.controller_.removeObserver(this);
|
|
23466
|
-
}
|
|
23467
|
-
};
|
|
23468
|
-
/**
|
|
23469
|
-
* Stops observing all elements.
|
|
23470
|
-
*
|
|
23471
|
-
* @returns {void}
|
|
23472
|
-
*/
|
|
23473
|
-
ResizeObserverSPI.prototype.disconnect = function () {
|
|
23474
|
-
this.clearActive();
|
|
23475
|
-
this.observations_.clear();
|
|
23476
|
-
this.controller_.removeObserver(this);
|
|
23477
|
-
};
|
|
23478
|
-
/**
|
|
23479
|
-
* Collects observation instances the associated element of which has changed
|
|
23480
|
-
* it's content rectangle.
|
|
23481
|
-
*
|
|
23482
|
-
* @returns {void}
|
|
23483
|
-
*/
|
|
23484
|
-
ResizeObserverSPI.prototype.gatherActive = function () {
|
|
23485
|
-
var _this = this;
|
|
23486
|
-
this.clearActive();
|
|
23487
|
-
this.observations_.forEach(function (observation) {
|
|
23488
|
-
if (observation.isActive()) {
|
|
23489
|
-
_this.activeObservations_.push(observation);
|
|
23490
|
-
}
|
|
23491
|
-
});
|
|
23492
|
-
};
|
|
23493
|
-
/**
|
|
23494
|
-
* Invokes initial callback function with a list of ResizeObserverEntry
|
|
23495
|
-
* instances collected from active resize observations.
|
|
23496
|
-
*
|
|
23497
|
-
* @returns {void}
|
|
23498
|
-
*/
|
|
23499
|
-
ResizeObserverSPI.prototype.broadcastActive = function () {
|
|
23500
|
-
// Do nothing if observer doesn't have active observations.
|
|
23501
|
-
if (!this.hasActive()) {
|
|
23502
|
-
return;
|
|
23503
|
-
}
|
|
23504
|
-
var ctx = this.callbackCtx_;
|
|
23505
|
-
// Create ResizeObserverEntry instance for every active observation.
|
|
23506
|
-
var entries = this.activeObservations_.map(function (observation) {
|
|
23507
|
-
return new ResizeObserverEntry(observation.target, observation.broadcastRect());
|
|
23508
|
-
});
|
|
23509
|
-
this.callback_.call(ctx, entries, ctx);
|
|
23510
|
-
this.clearActive();
|
|
23511
|
-
};
|
|
23512
|
-
/**
|
|
23513
|
-
* Clears the collection of active observations.
|
|
23514
|
-
*
|
|
23515
|
-
* @returns {void}
|
|
23516
|
-
*/
|
|
23517
|
-
ResizeObserverSPI.prototype.clearActive = function () {
|
|
23518
|
-
this.activeObservations_.splice(0);
|
|
23519
|
-
};
|
|
23520
|
-
/**
|
|
23521
|
-
* Tells whether observer has active observations.
|
|
23522
|
-
*
|
|
23523
|
-
* @returns {boolean}
|
|
23524
|
-
*/
|
|
23525
|
-
ResizeObserverSPI.prototype.hasActive = function () {
|
|
23526
|
-
return this.activeObservations_.length > 0;
|
|
23527
|
-
};
|
|
23528
|
-
return ResizeObserverSPI;
|
|
23529
|
-
}());
|
|
23530
|
-
|
|
23531
|
-
// Registry of internal observers. If WeakMap is not available use current shim
|
|
23532
|
-
// for the Map collection as it has all required methods and because WeakMap
|
|
23533
|
-
// can't be fully polyfilled anyway.
|
|
23534
|
-
var observers = typeof WeakMap !== 'undefined' ? new WeakMap() : new MapShim();
|
|
23535
|
-
/**
|
|
23536
|
-
* ResizeObserver API. Encapsulates the ResizeObserver SPI implementation
|
|
23537
|
-
* exposing only those methods and properties that are defined in the spec.
|
|
23538
|
-
*/
|
|
23539
|
-
var ResizeObserver_es_ResizeObserver = /** @class */ (function () {
|
|
23540
|
-
/**
|
|
23541
|
-
* Creates a new instance of ResizeObserver.
|
|
23542
|
-
*
|
|
23543
|
-
* @param {ResizeObserverCallback} callback - Callback that is invoked when
|
|
23544
|
-
* dimensions of the observed elements change.
|
|
23545
|
-
*/
|
|
23546
|
-
function ResizeObserver(callback) {
|
|
23547
|
-
if (!(this instanceof ResizeObserver)) {
|
|
23548
|
-
throw new TypeError('Cannot call a class as a function.');
|
|
23549
|
-
}
|
|
23550
|
-
if (!arguments.length) {
|
|
23551
|
-
throw new TypeError('1 argument required, but only 0 present.');
|
|
23552
|
-
}
|
|
23553
|
-
var controller = ResizeObserverController.getInstance();
|
|
23554
|
-
var observer = new ResizeObserverSPI(callback, controller, this);
|
|
23555
|
-
observers.set(this, observer);
|
|
23556
|
-
}
|
|
23557
|
-
return ResizeObserver;
|
|
23558
|
-
}());
|
|
23559
|
-
// Expose public methods of ResizeObserver.
|
|
23560
|
-
[
|
|
23561
|
-
'observe',
|
|
23562
|
-
'unobserve',
|
|
23563
|
-
'disconnect'
|
|
23564
|
-
].forEach(function (method) {
|
|
23565
|
-
ResizeObserver_es_ResizeObserver.prototype[method] = function () {
|
|
23566
|
-
var _a;
|
|
23567
|
-
return (_a = observers.get(this))[method].apply(_a, arguments);
|
|
23568
|
-
};
|
|
23569
|
-
});
|
|
23570
|
-
|
|
23571
|
-
var index = (function () {
|
|
23572
|
-
// Export existing implementation if available.
|
|
23573
|
-
if (typeof global$1.ResizeObserver !== 'undefined') {
|
|
23574
|
-
return global$1.ResizeObserver;
|
|
23575
|
-
}
|
|
23576
|
-
return ResizeObserver_es_ResizeObserver;
|
|
23577
|
-
})();
|
|
23578
|
-
|
|
23579
|
-
/* harmony default export */ const ResizeObserver_es = (index);
|
|
23580
|
-
|
|
23581
22662
|
;// CONCATENATED MODULE: ./resizeObserver/index.tsx
|
|
23582
22663
|
|
|
23583
22664
|
|
|
23584
22665
|
|
|
23585
22666
|
|
|
23586
|
-
|
|
23587
22667
|
class ReactResizeObserver extends BaseComponent {
|
|
23588
22668
|
constructor(props) {
|
|
23589
22669
|
super(props);
|
|
@@ -23606,7 +22686,7 @@ class ReactResizeObserver extends BaseComponent {
|
|
|
23606
22686
|
ref.current = node;
|
|
23607
22687
|
}
|
|
23608
22688
|
};
|
|
23609
|
-
this.observer = new
|
|
22689
|
+
this.observer = new ResizeObserver(props.onResize);
|
|
23610
22690
|
}
|
|
23611
22691
|
componentDidMount() {
|
|
23612
22692
|
this.observeElement();
|
|
@@ -23625,7 +22705,7 @@ class ReactResizeObserver extends BaseComponent {
|
|
|
23625
22705
|
let force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
23626
22706
|
const element = this.getElement();
|
|
23627
22707
|
if (!this.observer) {
|
|
23628
|
-
this.observer = new
|
|
22708
|
+
this.observer = new ResizeObserver(this.props.onResize);
|
|
23629
22709
|
}
|
|
23630
22710
|
if (!(element && element instanceof Element)) {
|
|
23631
22711
|
// stop everything if not defined
|
|
@@ -36892,14 +35972,13 @@ function calcMotionKeys(oldKeySet, newKeySet, keyEntities) {
|
|
|
36892
35972
|
/**
|
|
36893
35973
|
* @returns whether option includes sugInput.
|
|
36894
35974
|
* When filterTreeNode is a function,returns the result of filterTreeNode which called with (sugInput, target, option).
|
|
36895
|
-
* The filteredPath parameter will only be passed in when the Cascader calls the filter function
|
|
36896
35975
|
*/
|
|
36897
|
-
function filter(sugInput, option, filterTreeNode, filterProps
|
|
35976
|
+
function filter(sugInput, option, filterTreeNode, filterProps) {
|
|
36898
35977
|
if (!filterTreeNode) {
|
|
36899
35978
|
return true;
|
|
36900
35979
|
}
|
|
36901
35980
|
let filterFn = filterTreeNode;
|
|
36902
|
-
let target =
|
|
35981
|
+
let target = option;
|
|
36903
35982
|
if (typeof filterTreeNode === 'boolean') {
|
|
36904
35983
|
filterFn = (targetVal, val) => {
|
|
36905
35984
|
const input = targetVal.toLowerCase();
|
|
@@ -37172,6 +36251,33 @@ function util_normalizedArr(val) {
|
|
|
37172
36251
|
return val;
|
|
37173
36252
|
}
|
|
37174
36253
|
}
|
|
36254
|
+
/**
|
|
36255
|
+
* @returns whether option includes sugInput.
|
|
36256
|
+
* When filterTreeNode is a function,returns the result of filterTreeNode which called with (sugInput, target, option).
|
|
36257
|
+
*/
|
|
36258
|
+
function util_filter(sugInput, option, filterTreeNode, filteredPath) {
|
|
36259
|
+
if (!filterTreeNode) {
|
|
36260
|
+
return true;
|
|
36261
|
+
}
|
|
36262
|
+
let filterFn = filterTreeNode;
|
|
36263
|
+
let target;
|
|
36264
|
+
if (typeof filterTreeNode === 'boolean') {
|
|
36265
|
+
filterFn = (targetVal, val) => {
|
|
36266
|
+
const input = targetVal.toLowerCase();
|
|
36267
|
+
return val.toLowerCase().includes(input);
|
|
36268
|
+
};
|
|
36269
|
+
// 当 filterTreeNode 是 bool 类型时,由 Cascader 内部判断是否符合筛选条件,使用 join('') 修复搜索英文逗号导致所有数据被匹配问题
|
|
36270
|
+
// When the type of of filterTreeNode is bool, Cascader internally determines whether it meets the filtering conditions.
|
|
36271
|
+
// Use join('') to fix the problem that searching for English commas causes all data to be matched.
|
|
36272
|
+
target = filteredPath.join('');
|
|
36273
|
+
} else {
|
|
36274
|
+
// 当 filterTreeNode 为函数类型时,由用户判断是否符合筛选条件,使用 join(), 和原来保持一致
|
|
36275
|
+
// When the type of of filterTreeNode is function, the user determines whether it meets the filtering conditions,
|
|
36276
|
+
// uses join() to be consistent with the previous version.
|
|
36277
|
+
target = filteredPath.join();
|
|
36278
|
+
}
|
|
36279
|
+
return filterFn(sugInput, target, option);
|
|
36280
|
+
}
|
|
37175
36281
|
/**
|
|
37176
36282
|
* Traverse all the data by `treeData`.
|
|
37177
36283
|
*/
|
|
@@ -37182,10 +36288,12 @@ function util_traverseDataNodes(treeNodes, callback) {
|
|
|
37182
36288
|
// Process node if is not root
|
|
37183
36289
|
if (node) {
|
|
37184
36290
|
const key = parent ? `${parent.key}${constants_VALUE_SPLIT}${node.value}` : node.value;
|
|
36291
|
+
const pos = parent ? util_getPosition(parent.pos, ind) : `${ind}`;
|
|
37185
36292
|
item = {
|
|
37186
36293
|
data: Object.assign({}, node),
|
|
37187
36294
|
ind,
|
|
37188
36295
|
key,
|
|
36296
|
+
pos,
|
|
37189
36297
|
level: parent ? parent.level + 1 : 0,
|
|
37190
36298
|
parentKey: parent ? parent.key : null,
|
|
37191
36299
|
path: parent ? [...parent.path, key] : [key],
|
|
@@ -37218,6 +36326,17 @@ function getKeyByValuePath(valuePath) {
|
|
|
37218
36326
|
function getValuePathByKey(key) {
|
|
37219
36327
|
return key.split(VALUE_SPLIT);
|
|
37220
36328
|
}
|
|
36329
|
+
function getKeyByPos(pos, treeData) {
|
|
36330
|
+
const posArr = pos.split('-').map(item => Number(item));
|
|
36331
|
+
let resultData = treeData;
|
|
36332
|
+
let valuePath = [];
|
|
36333
|
+
posArr.forEach((item, index) => {
|
|
36334
|
+
var _a;
|
|
36335
|
+
resultData = index === 0 ? resultData[item] : (_a = resultData === null || resultData === void 0 ? void 0 : resultData.children) === null || _a === void 0 ? void 0 : _a[item];
|
|
36336
|
+
valuePath.push(resultData === null || resultData === void 0 ? void 0 : resultData.value);
|
|
36337
|
+
});
|
|
36338
|
+
return getKeyByValuePath(valuePath);
|
|
36339
|
+
}
|
|
37221
36340
|
function util_convertDataToEntities(dataNodes) {
|
|
37222
36341
|
const keyEntities = {};
|
|
37223
36342
|
util_traverseDataNodes(dataNodes, data => {
|
|
@@ -37272,6 +36391,28 @@ class CascaderFoundation extends foundation {
|
|
|
37272
36391
|
isSearching: false
|
|
37273
36392
|
});
|
|
37274
36393
|
};
|
|
36394
|
+
this.handleTagRemoveByKey = key => {
|
|
36395
|
+
var _a, _b;
|
|
36396
|
+
const {
|
|
36397
|
+
keyEntities
|
|
36398
|
+
} = this.getStates();
|
|
36399
|
+
const {
|
|
36400
|
+
disabled
|
|
36401
|
+
} = this.getProps();
|
|
36402
|
+
if (disabled) {
|
|
36403
|
+
/* istanbul ignore next */
|
|
36404
|
+
return;
|
|
36405
|
+
}
|
|
36406
|
+
const removedItem = (_a = keyEntities[key]) !== null && _a !== void 0 ? _a : {};
|
|
36407
|
+
!((_b = removedItem === null || removedItem === void 0 ? void 0 : removedItem.data) === null || _b === void 0 ? void 0 : _b.disable) && this._handleMultipleSelect(removedItem);
|
|
36408
|
+
};
|
|
36409
|
+
this.handleTagRemoveInTrigger = pos => {
|
|
36410
|
+
const {
|
|
36411
|
+
treeData
|
|
36412
|
+
} = this.getStates();
|
|
36413
|
+
const key = getKeyByPos(pos, treeData);
|
|
36414
|
+
this.handleTagRemoveByKey(key);
|
|
36415
|
+
};
|
|
37275
36416
|
}
|
|
37276
36417
|
init() {
|
|
37277
36418
|
const isOpen = this.getProp('open') || this.getProp('defaultOpen');
|
|
@@ -37980,8 +37121,8 @@ class CascaderFoundation extends foundation {
|
|
|
37980
37121
|
if (_notExist) {
|
|
37981
37122
|
return false;
|
|
37982
37123
|
}
|
|
37983
|
-
const filteredPath = this.getItemPropPath(key, treeNodeFilterProp)
|
|
37984
|
-
return
|
|
37124
|
+
const filteredPath = this.getItemPropPath(key, treeNodeFilterProp);
|
|
37125
|
+
return util_filter(sugInput, data, filterTreeNode, filteredPath);
|
|
37985
37126
|
}).filter(item => filterTreeNode && !filterLeafOnly || this._isLeaf(item)).map(item => item.key);
|
|
37986
37127
|
}
|
|
37987
37128
|
this._adapter.updateStates({
|
|
@@ -38003,6 +37144,7 @@ class CascaderFoundation extends foundation {
|
|
|
38003
37144
|
const isControlled = this._isControlledComponent();
|
|
38004
37145
|
const newState = {};
|
|
38005
37146
|
if (multiple) {
|
|
37147
|
+
newState.isSearching = false;
|
|
38006
37148
|
this._adapter.updateInputValue('');
|
|
38007
37149
|
this._adapter.notifyOnSearch('');
|
|
38008
37150
|
newState.checkedKeys = new Set([]);
|
|
@@ -38105,20 +37247,6 @@ class CascaderFoundation extends foundation {
|
|
|
38105
37247
|
activeNode: data
|
|
38106
37248
|
});
|
|
38107
37249
|
}
|
|
38108
|
-
handleTagRemove(e, tagValuePath) {
|
|
38109
|
-
const {
|
|
38110
|
-
keyEntities
|
|
38111
|
-
} = this.getStates();
|
|
38112
|
-
const {
|
|
38113
|
-
disabled
|
|
38114
|
-
} = this.getProps();
|
|
38115
|
-
if (disabled) {
|
|
38116
|
-
/* istanbul ignore next */
|
|
38117
|
-
return;
|
|
38118
|
-
}
|
|
38119
|
-
const removedItem = Object.values(keyEntities).filter(item => isEqual_default()(item.valuePath, tagValuePath))[0];
|
|
38120
|
-
!isEmpty_default()(removedItem) && !removedItem.data.disabled && this._handleMultipleSelect(removedItem);
|
|
38121
|
-
}
|
|
38122
37250
|
}
|
|
38123
37251
|
// EXTERNAL MODULE: ../semi-foundation/cascader/cascader.scss
|
|
38124
37252
|
var cascader = __webpack_require__("B2DP");
|
|
@@ -47777,14 +46905,13 @@ class Cascader extends BaseComponent {
|
|
|
47777
46905
|
this.handleInputChange = value => {
|
|
47778
46906
|
this.foundation.handleInputChange(value);
|
|
47779
46907
|
};
|
|
47780
|
-
this.
|
|
47781
|
-
this.foundation.
|
|
46908
|
+
this.handleTagRemoveInTrigger = pos => {
|
|
46909
|
+
this.foundation.handleTagRemoveInTrigger(pos);
|
|
47782
46910
|
};
|
|
47783
|
-
this.
|
|
47784
|
-
|
|
47785
|
-
|
|
47786
|
-
|
|
47787
|
-
this.handleTagRemove(null, keyEntities[key].valuePath);
|
|
46911
|
+
this.handleTagClose = (tagChildren, e, tagKey) => {
|
|
46912
|
+
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
46913
|
+
e.preventDefault();
|
|
46914
|
+
this.foundation.handleTagRemoveByKey(tagKey);
|
|
47788
46915
|
};
|
|
47789
46916
|
this.renderTagItem = (nodeKey, idx) => {
|
|
47790
46917
|
const {
|
|
@@ -47812,18 +46939,18 @@ class Cascader extends BaseComponent {
|
|
|
47812
46939
|
size: size === 'default' ? 'large' : size,
|
|
47813
46940
|
key: `tag-${nodeKey}-${idx}`,
|
|
47814
46941
|
color: "white",
|
|
46942
|
+
tagKey: nodeKey,
|
|
47815
46943
|
className: tagCls,
|
|
47816
46944
|
closable: true,
|
|
47817
|
-
onClose:
|
|
47818
|
-
// When value has not changed, prevent clicking tag closeBtn to close tag
|
|
47819
|
-
e.preventDefault();
|
|
47820
|
-
this.handleTagRemove(e, keyEntities[nodeKey].valuePath);
|
|
47821
|
-
}
|
|
46945
|
+
onClose: this.handleTagClose
|
|
47822
46946
|
}, keyEntities[nodeKey].data[displayProp]);
|
|
47823
46947
|
}
|
|
47824
46948
|
}
|
|
47825
46949
|
return null;
|
|
47826
46950
|
};
|
|
46951
|
+
this.onRemoveInTagInput = v => {
|
|
46952
|
+
this.foundation.handleTagRemoveByKey(v);
|
|
46953
|
+
};
|
|
47827
46954
|
this.handleItemClick = (e, item) => {
|
|
47828
46955
|
this.foundation.handleItemClick(e, item);
|
|
47829
46956
|
};
|
|
@@ -48023,6 +47150,7 @@ class Cascader extends BaseComponent {
|
|
|
48023
47150
|
}, labelNode);
|
|
48024
47151
|
};
|
|
48025
47152
|
this.renderCustomTrigger = () => {
|
|
47153
|
+
var _a;
|
|
48026
47154
|
const {
|
|
48027
47155
|
disabled,
|
|
48028
47156
|
triggerRender,
|
|
@@ -48033,17 +47161,26 @@ class Cascader extends BaseComponent {
|
|
|
48033
47161
|
inputValue,
|
|
48034
47162
|
inputPlaceHolder,
|
|
48035
47163
|
resolvedCheckedKeys,
|
|
48036
|
-
checkedKeys
|
|
47164
|
+
checkedKeys,
|
|
47165
|
+
keyEntities
|
|
48037
47166
|
} = this.state;
|
|
48038
47167
|
let realValue;
|
|
48039
47168
|
if (multiple) {
|
|
48040
47169
|
if (this.mergeType === cascader_constants_strings.NONE_MERGE_TYPE) {
|
|
48041
|
-
realValue =
|
|
47170
|
+
realValue = new Set();
|
|
47171
|
+
checkedKeys.forEach(key => {
|
|
47172
|
+
var _a;
|
|
47173
|
+
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
47174
|
+
});
|
|
48042
47175
|
} else {
|
|
48043
|
-
realValue =
|
|
47176
|
+
realValue = new Set();
|
|
47177
|
+
resolvedCheckedKeys.forEach(key => {
|
|
47178
|
+
var _a;
|
|
47179
|
+
realValue.add((_a = keyEntities[key]) === null || _a === void 0 ? void 0 : _a.pos);
|
|
47180
|
+
});
|
|
48044
47181
|
}
|
|
48045
47182
|
} else {
|
|
48046
|
-
realValue = [...selectedKeys][0];
|
|
47183
|
+
realValue = (_a = keyEntities[[...selectedKeys][0]]) === null || _a === void 0 ? void 0 : _a.pos;
|
|
48047
47184
|
}
|
|
48048
47185
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(trigger, {
|
|
48049
47186
|
value: realValue,
|
|
@@ -48056,7 +47193,7 @@ class Cascader extends BaseComponent {
|
|
|
48056
47193
|
componentName: 'Cascader',
|
|
48057
47194
|
componentProps: Object.assign({}, this.props),
|
|
48058
47195
|
onSearch: this.handleInputChange,
|
|
48059
|
-
onRemove: this.
|
|
47196
|
+
onRemove: this.handleTagRemoveInTrigger
|
|
48060
47197
|
});
|
|
48061
47198
|
};
|
|
48062
47199
|
this.handleMouseOver = () => {
|
|
@@ -48087,11 +47224,12 @@ class Cascader extends BaseComponent {
|
|
|
48087
47224
|
selectedKeys,
|
|
48088
47225
|
isOpen,
|
|
48089
47226
|
isHovering,
|
|
48090
|
-
checkedKeys
|
|
47227
|
+
checkedKeys,
|
|
47228
|
+
inputValue
|
|
48091
47229
|
} = this.state;
|
|
48092
47230
|
const hasValue = selectedKeys.size;
|
|
48093
47231
|
const multipleWithHaveValue = multiple && checkedKeys.size;
|
|
48094
|
-
return showClear && (hasValue || multipleWithHaveValue) && !disabled && (isOpen || isHovering);
|
|
47232
|
+
return showClear && (inputValue || hasValue || multipleWithHaveValue) && !disabled && (isOpen || isHovering);
|
|
48095
47233
|
};
|
|
48096
47234
|
this.renderClearBtn = () => {
|
|
48097
47235
|
const clearCls = classnames_default()(`${cascader_prefixcls}-clearbtn`);
|
|
@@ -48540,11 +47678,11 @@ class Cascader extends BaseComponent {
|
|
|
48540
47678
|
showRestTagsPopover: showRestTagsPopover,
|
|
48541
47679
|
restTagsPopoverProps: restTagsPopoverProps,
|
|
48542
47680
|
maxTagCount: maxTagCount,
|
|
48543
|
-
renderTagItem:
|
|
47681
|
+
renderTagItem: this.renderTagItem,
|
|
48544
47682
|
inputValue: inputValue,
|
|
48545
47683
|
onInputChange: this.handleInputChange,
|
|
48546
47684
|
// TODO Modify logic, not modify type
|
|
48547
|
-
onRemove:
|
|
47685
|
+
onRemove: this.onRemoveInTagInput,
|
|
48548
47686
|
placeholder: placeholder,
|
|
48549
47687
|
expandRestTagsOnClick: false
|
|
48550
47688
|
});
|
|
@@ -53375,6 +52513,7 @@ function isValidTimeZone(timeZone) {
|
|
|
53375
52513
|
|
|
53376
52514
|
|
|
53377
52515
|
|
|
52516
|
+
|
|
53378
52517
|
/**
|
|
53379
52518
|
* The datePicker foundation.js is responsible for maintaining the date value and the input box value, as well as the callback of both
|
|
53380
52519
|
* task 1. Accept the selected date change, update the date value, and update the input box value according to the date = > Notify the change
|
|
@@ -53478,6 +52617,8 @@ class DatePickerFoundation extends foundation {
|
|
|
53478
52617
|
parsedV = zonedTimeToUtc(parsedV, prevTimeZone);
|
|
53479
52618
|
}
|
|
53480
52619
|
result.push(isValidTimeZone(timeZone) ? utcToZonedTime(parsedV, timeZone) : parsedV);
|
|
52620
|
+
} else {
|
|
52621
|
+
warning(true, `[Semi DatePicker] value cannot be parsed, value: ${String(v)}`);
|
|
53481
52622
|
}
|
|
53482
52623
|
}
|
|
53483
52624
|
}
|
|
@@ -59109,16 +58250,6 @@ class YearAndMonth extends BaseComponent {
|
|
|
59109
58250
|
currentYear,
|
|
59110
58251
|
currentMonth
|
|
59111
58252
|
} = props;
|
|
59112
|
-
const currentLeftYear = currentYear.left || now.getFullYear();
|
|
59113
|
-
const currentLeftMonth = currentMonth.left || now.getMonth() + 1;
|
|
59114
|
-
currentYear = {
|
|
59115
|
-
left: currentLeftYear,
|
|
59116
|
-
right: currentLeftYear
|
|
59117
|
-
};
|
|
59118
|
-
currentMonth = {
|
|
59119
|
-
left: currentLeftMonth,
|
|
59120
|
-
right: currentMonth.right || currentLeftMonth + 1
|
|
59121
|
-
};
|
|
59122
58253
|
this.state = {
|
|
59123
58254
|
years: _utils_getYears(props.startYear, props.endYear).map(year => ({
|
|
59124
58255
|
value: year,
|
|
@@ -59128,8 +58259,14 @@ class YearAndMonth extends BaseComponent {
|
|
|
59128
58259
|
value: idx + 1,
|
|
59129
58260
|
month: idx + 1
|
|
59130
58261
|
})),
|
|
59131
|
-
currentYear
|
|
59132
|
-
|
|
58262
|
+
currentYear: {
|
|
58263
|
+
left: currentYear.left || now.getFullYear(),
|
|
58264
|
+
right: currentYear.right || now.getFullYear()
|
|
58265
|
+
},
|
|
58266
|
+
currentMonth: {
|
|
58267
|
+
left: currentMonth.left || now.getMonth() + 1,
|
|
58268
|
+
right: currentMonth.right || now.getMonth() + 2
|
|
58269
|
+
}
|
|
59133
58270
|
};
|
|
59134
58271
|
this.yearRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
59135
58272
|
this.monthRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
@@ -59166,11 +58303,19 @@ class YearAndMonth extends BaseComponent {
|
|
|
59166
58303
|
}
|
|
59167
58304
|
static getDerivedStateFromProps(props, state) {
|
|
59168
58305
|
const willUpdateStates = {};
|
|
59169
|
-
if (!isEqual_default()(props.currentYear, state.currentYear)
|
|
59170
|
-
|
|
58306
|
+
if (!isEqual_default()(props.currentYear, state.currentYear)) {
|
|
58307
|
+
const nowYear = new Date().getFullYear();
|
|
58308
|
+
willUpdateStates.currentYear = {
|
|
58309
|
+
left: props.currentYear.left || nowYear,
|
|
58310
|
+
right: props.currentYear.right || nowYear
|
|
58311
|
+
};
|
|
59171
58312
|
}
|
|
59172
|
-
if (!isEqual_default()(props.currentMonth, state.currentMonth)
|
|
59173
|
-
|
|
58313
|
+
if (!isEqual_default()(props.currentMonth, state.currentMonth)) {
|
|
58314
|
+
const nowMonth = new Date().getMonth();
|
|
58315
|
+
willUpdateStates.currentMonth = {
|
|
58316
|
+
left: props.currentMonth.left || nowMonth + 1,
|
|
58317
|
+
right: props.currentMonth.right || nowMonth + 2
|
|
58318
|
+
};
|
|
59174
58319
|
}
|
|
59175
58320
|
return willUpdateStates;
|
|
59176
58321
|
}
|
|
@@ -60589,7 +59734,7 @@ class DatePicker extends BaseComponent {
|
|
|
60589
59734
|
return /range/i.test(type) && !isFunction_default()(triggerRender);
|
|
60590
59735
|
}
|
|
60591
59736
|
componentDidUpdate(prevProps) {
|
|
60592
|
-
if (prevProps.value
|
|
59737
|
+
if (!isEqual_default()(prevProps.value, this.props.value)) {
|
|
60593
59738
|
this.foundation.initFromProps(Object.assign({}, this.props));
|
|
60594
59739
|
} else if (this.props.timeZone !== prevProps.timeZone) {
|
|
60595
59740
|
this.foundation.initFromProps({
|
|
@@ -62336,6 +61481,7 @@ const destroyFns = [];
|
|
|
62336
61481
|
class Modal extends BaseComponent {
|
|
62337
61482
|
constructor(props) {
|
|
62338
61483
|
super(props);
|
|
61484
|
+
this.bodyOverflow = null;
|
|
62339
61485
|
this.handleCancel = e => {
|
|
62340
61486
|
this.foundation.handleCancel(e);
|
|
62341
61487
|
};
|
|
@@ -62482,7 +61628,6 @@ class Modal extends BaseComponent {
|
|
|
62482
61628
|
};
|
|
62483
61629
|
this.foundation = new ModalFoundation(this.adapter);
|
|
62484
61630
|
this.modalRef = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createRef();
|
|
62485
|
-
this.bodyOverflow = '';
|
|
62486
61631
|
this.scrollBarWidth = 0;
|
|
62487
61632
|
this.originBodyWidth = '100%';
|
|
62488
61633
|
}
|
|
@@ -62503,7 +61648,7 @@ class Modal extends BaseComponent {
|
|
|
62503
61648
|
const {
|
|
62504
61649
|
getPopupContainer
|
|
62505
61650
|
} = this.props;
|
|
62506
|
-
if (!getPopupContainer && this.bodyOverflow !== 'hidden') {
|
|
61651
|
+
if (!getPopupContainer && this.bodyOverflow !== null && this.bodyOverflow !== 'hidden') {
|
|
62507
61652
|
document.body.style.overflow = this.bodyOverflow;
|
|
62508
61653
|
document.body.style.width = this.originBodyWidth;
|
|
62509
61654
|
}
|
|
@@ -70269,6 +69414,8 @@ class SelectFoundation extends foundation {
|
|
|
70269
69414
|
if (filter) {
|
|
70270
69415
|
this.clearInput(e);
|
|
70271
69416
|
}
|
|
69417
|
+
// after click showClear button, the select need to be focused
|
|
69418
|
+
this.focus();
|
|
70272
69419
|
this.clearSelected();
|
|
70273
69420
|
// prevent this click open dropdown
|
|
70274
69421
|
e.stopPropagation();
|
|
@@ -70779,7 +69926,8 @@ class option_Option extends external_root_React_commonjs2_react_commonjs_react_a
|
|
|
70779
69926
|
value,
|
|
70780
69927
|
label,
|
|
70781
69928
|
children
|
|
70782
|
-
}, rest), e)
|
|
69929
|
+
}, rest), e),
|
|
69930
|
+
className
|
|
70783
69931
|
}, rest));
|
|
70784
69932
|
}
|
|
70785
69933
|
const config = {
|
|
@@ -84570,7 +83718,7 @@ const ResizableTable = function () {
|
|
|
84570
83718
|
width: table_constants_numbers.DEFAULT_WIDTH_COLUMN_EXPAND
|
|
84571
83719
|
});
|
|
84572
83720
|
}
|
|
84573
|
-
if (props.rowSelection && !find_default()(rawColumns, item => item.key === table_constants_strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
83721
|
+
if (props.rowSelection && !get_default()(props.rowSelection, 'hidden') && !find_default()(rawColumns, item => item.key === table_constants_strings.DEFAULT_KEY_COLUMN_SELECTION)) {
|
|
84574
83722
|
newColumns.unshift({
|
|
84575
83723
|
width: get_default()(props, 'rowSelection.width', table_constants_numbers.DEFAULT_WIDTH_COLUMN_SELECTION),
|
|
84576
83724
|
key: table_constants_strings.DEFAULT_KEY_COLUMN_SELECTION
|
|
@@ -100746,6 +99894,9 @@ class PreviewInnerFoundation extends foundation {
|
|
|
100746
99894
|
return;
|
|
100747
99895
|
}
|
|
100748
99896
|
const preloadImages = getPreloadImagArr(imgSrc, currentIndex, preLoadGap, infinite);
|
|
99897
|
+
if (preloadImages.length === 0) {
|
|
99898
|
+
return;
|
|
99899
|
+
}
|
|
100749
99900
|
const Img = new Image();
|
|
100750
99901
|
let index = 0;
|
|
100751
99902
|
function callback(e) {
|