antd3-esm 1.0.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/LICENSE +21 -0
- package/dist/Checkbox.js +164 -0
- package/dist/CommonMixin.js +816 -0
- package/dist/Divider.js +646 -0
- package/dist/Notification.js +279 -0
- package/dist/Pagination.js +1106 -0
- package/dist/PortalWrapper.js +347 -0
- package/dist/RowContext.js +5 -0
- package/dist/Sider.js +533 -0
- package/dist/TextArea.js +432 -0
- package/dist/_arrayMap.js +68 -0
- package/dist/_assignValue.js +95 -0
- package/dist/_copyArray.js +31 -0
- package/dist/_hasPath.js +53 -0
- package/dist/_overArg.js +437 -0
- package/dist/_stringToArray.js +136 -0
- package/dist/antd/es/affix.js +12 -0
- package/dist/antd/es/alert.js +5 -0
- package/dist/antd/es/anchor.js +466 -0
- package/dist/antd/es/auto-complete.js +5 -0
- package/dist/antd/es/avatar.js +5 -0
- package/dist/antd/es/back-top.js +5 -0
- package/dist/antd/es/badge.js +5 -0
- package/dist/antd/es/breadcrumb.js +18 -0
- package/dist/antd/es/button.js +12 -0
- package/dist/antd/es/calendar.js +953 -0
- package/dist/antd/es/card.js +5 -0
- package/dist/antd/es/carousel.js +5 -0
- package/dist/antd/es/cascader.js +1275 -0
- package/dist/antd/es/checkbox.js +11 -0
- package/dist/antd/es/col.js +4 -0
- package/dist/antd/es/collapse.js +688 -0
- package/dist/antd/es/comment.js +5 -0
- package/dist/antd/es/config-provider.js +2 -0
- package/dist/antd/es/date-picker.js +4322 -0
- package/dist/antd/es/descriptions.js +342 -0
- package/dist/antd/es/divider.js +53 -0
- package/dist/antd/es/drawer.js +1115 -0
- package/dist/antd/es/dropdown.js +14 -0
- package/dist/antd/es/empty.js +6 -0
- package/dist/antd/es/form.js +5008 -0
- package/dist/antd/es/grid.js +13 -0
- package/dist/antd/es/icon.js +6 -0
- package/dist/antd/es/input-number.js +5 -0
- package/dist/antd/es/input.js +16 -0
- package/dist/antd/es/layout.js +14 -0
- package/dist/antd/es/list.js +5 -0
- package/dist/antd/es/locale/ar_EG.js +102 -0
- package/dist/antd/es/locale/bg_BG.js +98 -0
- package/dist/antd/es/locale/ca_ES.js +96 -0
- package/dist/antd/es/locale/cs_CZ.js +96 -0
- package/dist/antd/es/locale/da_DK.js +98 -0
- package/dist/antd/es/locale/de_DE.js +98 -0
- package/dist/antd/es/locale/default.js +2 -0
- package/dist/antd/es/locale/el_GR.js +98 -0
- package/dist/antd/es/locale/en_GB.js +98 -0
- package/dist/antd/es/locale/en_US.js +2 -0
- package/dist/antd/es/locale/es_ES.js +114 -0
- package/dist/antd/es/locale/et_EE.js +98 -0
- package/dist/antd/es/locale/fa_IR.js +98 -0
- package/dist/antd/es/locale/fi_FI.js +99 -0
- package/dist/antd/es/locale/fr_BE.js +102 -0
- package/dist/antd/es/locale/fr_FR.js +102 -0
- package/dist/antd/es/locale/ga_IE.js +99 -0
- package/dist/antd/es/locale/he_IL.js +99 -0
- package/dist/antd/es/locale/hi_IN.js +107 -0
- package/dist/antd/es/locale/hr_HR.js +113 -0
- package/dist/antd/es/locale/hu_HU.js +99 -0
- package/dist/antd/es/locale/hy_AM.js +109 -0
- package/dist/antd/es/locale/id_ID.js +101 -0
- package/dist/antd/es/locale/is_IS.js +98 -0
- package/dist/antd/es/locale/it_IT.js +111 -0
- package/dist/antd/es/locale/ja_JP.js +96 -0
- package/dist/antd/es/locale/kn_IN.js +107 -0
- package/dist/antd/es/locale/ko_KR.js +98 -0
- package/dist/antd/es/locale/ku_IQ.js +98 -0
- package/dist/antd/es/locale/lv_LV.js +98 -0
- package/dist/antd/es/locale/mk_MK.js +113 -0
- package/dist/antd/es/locale/mn_MN.js +99 -0
- package/dist/antd/es/locale/ms_MY.js +118 -0
- package/dist/antd/es/locale/nb_NO.js +97 -0
- package/dist/antd/es/locale/ne_NP.js +44 -0
- package/dist/antd/es/locale/nl_BE.js +98 -0
- package/dist/antd/es/locale/nl_NL.js +117 -0
- package/dist/antd/es/locale/pl_PL.js +98 -0
- package/dist/antd/es/locale/pt_BR.js +104 -0
- package/dist/antd/es/locale/pt_PT.js +127 -0
- package/dist/antd/es/locale/ro_RO.js +118 -0
- package/dist/antd/es/locale/ru_RU.js +110 -0
- package/dist/antd/es/locale/sk_SK.js +118 -0
- package/dist/antd/es/locale/sl_SI.js +96 -0
- package/dist/antd/es/locale/sr_RS.js +97 -0
- package/dist/antd/es/locale/sv_SE.js +101 -0
- package/dist/antd/es/locale/ta_IN.js +119 -0
- package/dist/antd/es/locale/th_TH.js +117 -0
- package/dist/antd/es/locale/tr_TR.js +112 -0
- package/dist/antd/es/locale/uk_UA.js +97 -0
- package/dist/antd/es/locale/vi_VN.js +99 -0
- package/dist/antd/es/locale/zh_CN.js +104 -0
- package/dist/antd/es/locale/zh_TW.js +100 -0
- package/dist/antd/es/locale-provider.js +6 -0
- package/dist/antd/es/mention.js +23215 -0
- package/dist/antd/es/mentions.js +961 -0
- package/dist/antd/es/menu.js +5 -0
- package/dist/antd/es/message.js +161 -0
- package/dist/antd/es/modal.js +885 -0
- package/dist/antd/es/notification.js +216 -0
- package/dist/antd/es/page-header.js +350 -0
- package/dist/antd/es/pagination.js +15 -0
- package/dist/antd/es/popconfirm.js +215 -0
- package/dist/antd/es/popover.js +5 -0
- package/dist/antd/es/progress.js +10 -0
- package/dist/antd/es/radio.js +10 -0
- package/dist/antd/es/rate.js +5 -0
- package/dist/antd/es/result.js +828 -0
- package/dist/antd/es/row.js +9 -0
- package/dist/antd/es/select.js +5 -0
- package/dist/antd/es/skeleton.js +370 -0
- package/dist/antd/es/slider.js +5 -0
- package/dist/antd/es/spin.js +11 -0
- package/dist/antd/es/statistic.js +650 -0
- package/dist/antd/es/steps.js +5 -0
- package/dist/antd/es/style.js +5 -0
- package/dist/antd/es/switch.js +5 -0
- package/dist/antd/es/table.js +7057 -0
- package/dist/antd/es/tabs.js +5 -0
- package/dist/antd/es/tag.js +12 -0
- package/dist/antd/es/time-picker.js +10 -0
- package/dist/antd/es/timeline.js +206 -0
- package/dist/antd/es/tooltip.js +9 -0
- package/dist/antd/es/transfer.js +2508 -0
- package/dist/antd/es/tree-select.js +5 -0
- package/dist/antd/es/tree.js +10 -0
- package/dist/antd/es/typography.js +1246 -0
- package/dist/antd/es/upload.js +3418 -0
- package/dist/antd/es/version.js +7 -0
- package/dist/col.js +142 -0
- package/dist/config-provider.js +6949 -0
- package/dist/dropdown.js +442 -0
- package/dist/get.js +1043 -0
- package/dist/icon.js +6138 -0
- package/dist/identity.js +230 -0
- package/dist/index.js +462 -0
- package/dist/index10.js +478 -0
- package/dist/index11.js +232 -0
- package/dist/index12.js +2766 -0
- package/dist/index13.js +422 -0
- package/dist/index14.js +283 -0
- package/dist/index15.js +1755 -0
- package/dist/index2.js +374 -0
- package/dist/index3.js +407 -0
- package/dist/index4.js +522 -0
- package/dist/index5.js +601 -0
- package/dist/index6.js +601 -0
- package/dist/index7.js +364 -0
- package/dist/index8.js +436 -0
- package/dist/index9.js +130 -0
- package/dist/input.js +475 -0
- package/dist/isLength.js +402 -0
- package/dist/keys.js +292 -0
- package/dist/menu.js +8138 -0
- package/dist/progress.js +852 -0
- package/dist/raf.js +34 -0
- package/dist/responsiveObserve.js +444 -0
- package/dist/row.js +173 -0
- package/dist/scrollTo.js +66 -0
- package/dist/toInteger.js +123 -0
- package/dist/toString.js +84 -0
- package/dist/transButton.js +121 -0
- package/dist/tree.js +3017 -0
- package/dist/warning.js +55 -0
- package/dist/wave.js +230 -0
- package/dist/zh_CN.js +17 -0
- package/package.json +160 -0
|
@@ -0,0 +1,2508 @@
|
|
|
1
|
+
import { a as commonjsGlobal, n, g as getDefaultExportFromCjs, b as requirePropTypes, c as classNames, C as ConfigConsumer, L as LocaleReceiver, i as defaultLocale, p as propTypesExports } from '../../config-provider.js';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import { k as requireShallowequal, A as Animate, p as polyfill } from '../../menu.js';
|
|
5
|
+
import * as ReactDOM from 'react-dom';
|
|
6
|
+
import ReactDOM__default, { findDOMNode } from 'react-dom';
|
|
7
|
+
import { I as Input, t as tuple, o as omit } from '../../input.js';
|
|
8
|
+
import { C as Checkbox } from '../../index8.js';
|
|
9
|
+
import { I as Icon } from '../../icon.js';
|
|
10
|
+
import '../../index10.js';
|
|
11
|
+
import { w as wrapperRaf } from '../../raf.js';
|
|
12
|
+
import { B as Button } from '../../index7.js';
|
|
13
|
+
import '../../Checkbox.js';
|
|
14
|
+
import '../../TextArea.js';
|
|
15
|
+
import '../../index2.js';
|
|
16
|
+
import '../../warning.js';
|
|
17
|
+
import '../../wave.js';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
21
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
22
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
23
|
+
* Released under MIT license <https://lodash.com/license>
|
|
24
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
25
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
var lodash_debounce;
|
|
29
|
+
var hasRequiredLodash_debounce;
|
|
30
|
+
|
|
31
|
+
function requireLodash_debounce () {
|
|
32
|
+
if (hasRequiredLodash_debounce) return lodash_debounce;
|
|
33
|
+
hasRequiredLodash_debounce = 1;
|
|
34
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
35
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
36
|
+
|
|
37
|
+
/** Used as references for various `Number` constants. */
|
|
38
|
+
var NAN = 0 / 0;
|
|
39
|
+
|
|
40
|
+
/** `Object#toString` result references. */
|
|
41
|
+
var symbolTag = '[object Symbol]';
|
|
42
|
+
|
|
43
|
+
/** Used to match leading and trailing whitespace. */
|
|
44
|
+
var reTrim = /^\s+|\s+$/g;
|
|
45
|
+
|
|
46
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
47
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
48
|
+
|
|
49
|
+
/** Used to detect binary string values. */
|
|
50
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
51
|
+
|
|
52
|
+
/** Used to detect octal string values. */
|
|
53
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
54
|
+
|
|
55
|
+
/** Built-in method references without a dependency on `root`. */
|
|
56
|
+
var freeParseInt = parseInt;
|
|
57
|
+
|
|
58
|
+
/** Detect free variable `global` from Node.js. */
|
|
59
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
60
|
+
|
|
61
|
+
/** Detect free variable `self`. */
|
|
62
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
63
|
+
|
|
64
|
+
/** Used as a reference to the global object. */
|
|
65
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
66
|
+
|
|
67
|
+
/** Used for built-in method references. */
|
|
68
|
+
var objectProto = Object.prototype;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Used to resolve the
|
|
72
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
73
|
+
* of values.
|
|
74
|
+
*/
|
|
75
|
+
var objectToString = objectProto.toString;
|
|
76
|
+
|
|
77
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
78
|
+
var nativeMax = Math.max,
|
|
79
|
+
nativeMin = Math.min;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
83
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
84
|
+
*
|
|
85
|
+
* @static
|
|
86
|
+
* @memberOf _
|
|
87
|
+
* @since 2.4.0
|
|
88
|
+
* @category Date
|
|
89
|
+
* @returns {number} Returns the timestamp.
|
|
90
|
+
* @example
|
|
91
|
+
*
|
|
92
|
+
* _.defer(function(stamp) {
|
|
93
|
+
* console.log(_.now() - stamp);
|
|
94
|
+
* }, _.now());
|
|
95
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
96
|
+
*/
|
|
97
|
+
var now = function() {
|
|
98
|
+
return root.Date.now();
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
103
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
104
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
105
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
106
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
107
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
108
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
109
|
+
* calls to the debounced function return the result of the last `func`
|
|
110
|
+
* invocation.
|
|
111
|
+
*
|
|
112
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
113
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
114
|
+
* is invoked more than once during the `wait` timeout.
|
|
115
|
+
*
|
|
116
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
117
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
118
|
+
*
|
|
119
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
120
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
121
|
+
*
|
|
122
|
+
* @static
|
|
123
|
+
* @memberOf _
|
|
124
|
+
* @since 0.1.0
|
|
125
|
+
* @category Function
|
|
126
|
+
* @param {Function} func The function to debounce.
|
|
127
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
128
|
+
* @param {Object} [options={}] The options object.
|
|
129
|
+
* @param {boolean} [options.leading=false]
|
|
130
|
+
* Specify invoking on the leading edge of the timeout.
|
|
131
|
+
* @param {number} [options.maxWait]
|
|
132
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
133
|
+
* @param {boolean} [options.trailing=true]
|
|
134
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
135
|
+
* @returns {Function} Returns the new debounced function.
|
|
136
|
+
* @example
|
|
137
|
+
*
|
|
138
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
139
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
140
|
+
*
|
|
141
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
142
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
143
|
+
* 'leading': true,
|
|
144
|
+
* 'trailing': false
|
|
145
|
+
* }));
|
|
146
|
+
*
|
|
147
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
148
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
149
|
+
* var source = new EventSource('/stream');
|
|
150
|
+
* jQuery(source).on('message', debounced);
|
|
151
|
+
*
|
|
152
|
+
* // Cancel the trailing debounced invocation.
|
|
153
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
154
|
+
*/
|
|
155
|
+
function debounce(func, wait, options) {
|
|
156
|
+
var lastArgs,
|
|
157
|
+
lastThis,
|
|
158
|
+
maxWait,
|
|
159
|
+
result,
|
|
160
|
+
timerId,
|
|
161
|
+
lastCallTime,
|
|
162
|
+
lastInvokeTime = 0,
|
|
163
|
+
leading = false,
|
|
164
|
+
maxing = false,
|
|
165
|
+
trailing = true;
|
|
166
|
+
|
|
167
|
+
if (typeof func != 'function') {
|
|
168
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
169
|
+
}
|
|
170
|
+
wait = toNumber(wait) || 0;
|
|
171
|
+
if (isObject(options)) {
|
|
172
|
+
leading = !!options.leading;
|
|
173
|
+
maxing = 'maxWait' in options;
|
|
174
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
175
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function invokeFunc(time) {
|
|
179
|
+
var args = lastArgs,
|
|
180
|
+
thisArg = lastThis;
|
|
181
|
+
|
|
182
|
+
lastArgs = lastThis = undefined;
|
|
183
|
+
lastInvokeTime = time;
|
|
184
|
+
result = func.apply(thisArg, args);
|
|
185
|
+
return result;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function leadingEdge(time) {
|
|
189
|
+
// Reset any `maxWait` timer.
|
|
190
|
+
lastInvokeTime = time;
|
|
191
|
+
// Start the timer for the trailing edge.
|
|
192
|
+
timerId = setTimeout(timerExpired, wait);
|
|
193
|
+
// Invoke the leading edge.
|
|
194
|
+
return leading ? invokeFunc(time) : result;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function remainingWait(time) {
|
|
198
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
199
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
200
|
+
result = wait - timeSinceLastCall;
|
|
201
|
+
|
|
202
|
+
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function shouldInvoke(time) {
|
|
206
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
207
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
208
|
+
|
|
209
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
210
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
211
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
212
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
213
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function timerExpired() {
|
|
217
|
+
var time = now();
|
|
218
|
+
if (shouldInvoke(time)) {
|
|
219
|
+
return trailingEdge(time);
|
|
220
|
+
}
|
|
221
|
+
// Restart the timer.
|
|
222
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
function trailingEdge(time) {
|
|
226
|
+
timerId = undefined;
|
|
227
|
+
|
|
228
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
229
|
+
// debounced at least once.
|
|
230
|
+
if (trailing && lastArgs) {
|
|
231
|
+
return invokeFunc(time);
|
|
232
|
+
}
|
|
233
|
+
lastArgs = lastThis = undefined;
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
function cancel() {
|
|
238
|
+
if (timerId !== undefined) {
|
|
239
|
+
clearTimeout(timerId);
|
|
240
|
+
}
|
|
241
|
+
lastInvokeTime = 0;
|
|
242
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function flush() {
|
|
246
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
function debounced() {
|
|
250
|
+
var time = now(),
|
|
251
|
+
isInvoking = shouldInvoke(time);
|
|
252
|
+
|
|
253
|
+
lastArgs = arguments;
|
|
254
|
+
lastThis = this;
|
|
255
|
+
lastCallTime = time;
|
|
256
|
+
|
|
257
|
+
if (isInvoking) {
|
|
258
|
+
if (timerId === undefined) {
|
|
259
|
+
return leadingEdge(lastCallTime);
|
|
260
|
+
}
|
|
261
|
+
if (maxing) {
|
|
262
|
+
// Handle invocations in a tight loop.
|
|
263
|
+
timerId = setTimeout(timerExpired, wait);
|
|
264
|
+
return invokeFunc(lastCallTime);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (timerId === undefined) {
|
|
268
|
+
timerId = setTimeout(timerExpired, wait);
|
|
269
|
+
}
|
|
270
|
+
return result;
|
|
271
|
+
}
|
|
272
|
+
debounced.cancel = cancel;
|
|
273
|
+
debounced.flush = flush;
|
|
274
|
+
return debounced;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Checks if `value` is the
|
|
279
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
280
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
281
|
+
*
|
|
282
|
+
* @static
|
|
283
|
+
* @memberOf _
|
|
284
|
+
* @since 0.1.0
|
|
285
|
+
* @category Lang
|
|
286
|
+
* @param {*} value The value to check.
|
|
287
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
288
|
+
* @example
|
|
289
|
+
*
|
|
290
|
+
* _.isObject({});
|
|
291
|
+
* // => true
|
|
292
|
+
*
|
|
293
|
+
* _.isObject([1, 2, 3]);
|
|
294
|
+
* // => true
|
|
295
|
+
*
|
|
296
|
+
* _.isObject(_.noop);
|
|
297
|
+
* // => true
|
|
298
|
+
*
|
|
299
|
+
* _.isObject(null);
|
|
300
|
+
* // => false
|
|
301
|
+
*/
|
|
302
|
+
function isObject(value) {
|
|
303
|
+
var type = typeof value;
|
|
304
|
+
return !!value && (type == 'object' || type == 'function');
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
309
|
+
* and has a `typeof` result of "object".
|
|
310
|
+
*
|
|
311
|
+
* @static
|
|
312
|
+
* @memberOf _
|
|
313
|
+
* @since 4.0.0
|
|
314
|
+
* @category Lang
|
|
315
|
+
* @param {*} value The value to check.
|
|
316
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
317
|
+
* @example
|
|
318
|
+
*
|
|
319
|
+
* _.isObjectLike({});
|
|
320
|
+
* // => true
|
|
321
|
+
*
|
|
322
|
+
* _.isObjectLike([1, 2, 3]);
|
|
323
|
+
* // => true
|
|
324
|
+
*
|
|
325
|
+
* _.isObjectLike(_.noop);
|
|
326
|
+
* // => false
|
|
327
|
+
*
|
|
328
|
+
* _.isObjectLike(null);
|
|
329
|
+
* // => false
|
|
330
|
+
*/
|
|
331
|
+
function isObjectLike(value) {
|
|
332
|
+
return !!value && typeof value == 'object';
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
337
|
+
*
|
|
338
|
+
* @static
|
|
339
|
+
* @memberOf _
|
|
340
|
+
* @since 4.0.0
|
|
341
|
+
* @category Lang
|
|
342
|
+
* @param {*} value The value to check.
|
|
343
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
344
|
+
* @example
|
|
345
|
+
*
|
|
346
|
+
* _.isSymbol(Symbol.iterator);
|
|
347
|
+
* // => true
|
|
348
|
+
*
|
|
349
|
+
* _.isSymbol('abc');
|
|
350
|
+
* // => false
|
|
351
|
+
*/
|
|
352
|
+
function isSymbol(value) {
|
|
353
|
+
return typeof value == 'symbol' ||
|
|
354
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Converts `value` to a number.
|
|
359
|
+
*
|
|
360
|
+
* @static
|
|
361
|
+
* @memberOf _
|
|
362
|
+
* @since 4.0.0
|
|
363
|
+
* @category Lang
|
|
364
|
+
* @param {*} value The value to process.
|
|
365
|
+
* @returns {number} Returns the number.
|
|
366
|
+
* @example
|
|
367
|
+
*
|
|
368
|
+
* _.toNumber(3.2);
|
|
369
|
+
* // => 3.2
|
|
370
|
+
*
|
|
371
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
372
|
+
* // => 5e-324
|
|
373
|
+
*
|
|
374
|
+
* _.toNumber(Infinity);
|
|
375
|
+
* // => Infinity
|
|
376
|
+
*
|
|
377
|
+
* _.toNumber('3.2');
|
|
378
|
+
* // => 3.2
|
|
379
|
+
*/
|
|
380
|
+
function toNumber(value) {
|
|
381
|
+
if (typeof value == 'number') {
|
|
382
|
+
return value;
|
|
383
|
+
}
|
|
384
|
+
if (isSymbol(value)) {
|
|
385
|
+
return NAN;
|
|
386
|
+
}
|
|
387
|
+
if (isObject(value)) {
|
|
388
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
389
|
+
value = isObject(other) ? (other + '') : other;
|
|
390
|
+
}
|
|
391
|
+
if (typeof value != 'string') {
|
|
392
|
+
return value === 0 ? value : +value;
|
|
393
|
+
}
|
|
394
|
+
value = value.replace(reTrim, '');
|
|
395
|
+
var isBinary = reIsBinary.test(value);
|
|
396
|
+
return (isBinary || reIsOctal.test(value))
|
|
397
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
398
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
lodash_debounce = debounce;
|
|
402
|
+
return lodash_debounce;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
var css = "/* stylelint-disable at-rule-empty-line-before,at-rule-name-space-after,at-rule-no-unknown */\n/* stylelint-disable no-duplicate-selectors */\n/* stylelint-disable */\n/* stylelint-disable declaration-bang-space-before,no-duplicate-selectors,string-no-newline */\n@keyframes antCheckboxEffect {\n 0% {\n transform: scale(1);\n opacity: 0.5;\n }\n 100% {\n transform: scale(1.6);\n opacity: 0;\n }\n}\n.ant-transfer-customize-list {\n display: flex;\n}\n.ant-transfer-customize-list .ant-transfer-operation {\n flex: none;\n align-self: center;\n}\n.ant-transfer-customize-list .ant-transfer-list {\n flex: auto;\n width: auto;\n height: auto;\n min-height: 200px;\n}\n.ant-transfer-customize-list .ant-transfer-list-body-with-search {\n padding-top: 0;\n}\n.ant-transfer-customize-list .ant-transfer-list-body-search-wrapper {\n position: relative;\n padding-bottom: 0;\n}\n.ant-transfer-customize-list .ant-transfer-list-body-customize-wrapper {\n padding: 12px;\n}\n.ant-transfer-customize-list .ant-table-wrapper .ant-table-small {\n border: 0;\n border-radius: 0;\n}\n.ant-transfer-customize-list .ant-table-wrapper .ant-table-small > .ant-table-content > .ant-table-body > table > .ant-table-thead > tr > th {\n background: #fafafa;\n}\n.ant-transfer-customize-list .ant-table-wrapper .ant-table-small > .ant-table-content .ant-table-row:last-child td {\n border-bottom: 1px solid #e8e8e8;\n}\n.ant-transfer-customize-list .ant-table-wrapper .ant-table-small .ant-table-body {\n margin: 0;\n}\n.ant-transfer-customize-list .ant-table-wrapper .ant-table-pagination.ant-pagination {\n margin: 16px 0 4px;\n}\n.ant-transfer {\n box-sizing: border-box;\n margin: 0;\n padding: 0;\n color: rgba(0, 0, 0, 0.65);\n font-size: 14px;\n font-variant: tabular-nums;\n line-height: 1.5;\n list-style: none;\n font-feature-settings: 'tnum';\n position: relative;\n}\n.ant-transfer-disabled .ant-transfer-list {\n background: #f5f5f5;\n}\n.ant-transfer-list {\n position: relative;\n display: inline-block;\n width: 180px;\n height: 200px;\n padding-top: 40px;\n vertical-align: middle;\n border: 1px solid #d9d9d9;\n border-radius: 4px;\n}\n.ant-transfer-list-with-footer {\n padding-bottom: 34px;\n}\n.ant-transfer-list-search {\n padding: 0 24px 0 8px;\n}\n.ant-transfer-list-search-action {\n position: absolute;\n top: 12px;\n right: 12px;\n bottom: 12px;\n width: 28px;\n color: rgba(0, 0, 0, 0.25);\n line-height: 32px;\n text-align: center;\n}\n.ant-transfer-list-search-action .anticon {\n color: rgba(0, 0, 0, 0.25);\n transition: all 0.3s;\n}\n.ant-transfer-list-search-action .anticon:hover {\n color: rgba(0, 0, 0, 0.45);\n}\nspan.ant-transfer-list-search-action {\n pointer-events: none;\n}\n.ant-transfer-list-header {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n padding: 8px 12px 9px;\n overflow: hidden;\n color: rgba(0, 0, 0, 0.65);\n background: #fff;\n border-bottom: 1px solid #e8e8e8;\n border-radius: 4px 4px 0 0;\n}\n.ant-transfer-list-header-title {\n position: absolute;\n right: 12px;\n}\n.ant-transfer-list-header .ant-checkbox-wrapper + span {\n padding-left: 8px;\n}\n.ant-transfer-list-body {\n position: relative;\n height: 100%;\n font-size: 14px;\n}\n.ant-transfer-list-body-search-wrapper {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n padding: 12px;\n}\n.ant-transfer-list-body-with-search {\n padding-top: 56px;\n}\n.ant-transfer-list-content {\n height: 100%;\n margin: 0;\n padding: 0;\n overflow: auto;\n list-style: none;\n}\n.ant-transfer-list-content > .LazyLoad {\n animation: transferHighlightIn 1s;\n}\n.ant-transfer-list-content-item {\n min-height: 32px;\n padding: 6px 12px;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n transition: all 0.3s;\n}\n.ant-transfer-list-content-item > span {\n padding-right: 0;\n}\n.ant-transfer-list-content-item-text {\n padding-left: 8px;\n}\n.ant-transfer-list-content-item:not(.ant-transfer-list-content-item-disabled):hover {\n background-color: #e6f7ff;\n cursor: pointer;\n}\n.ant-transfer-list-content-item-disabled {\n color: rgba(0, 0, 0, 0.25);\n cursor: not-allowed;\n}\n.ant-transfer-list-body-not-found {\n position: absolute;\n top: 50%;\n width: 100%;\n padding-top: 0;\n color: rgba(0, 0, 0, 0.25);\n text-align: center;\n transform: translateY(-50%);\n}\n.ant-transfer-list-body-with-search .ant-transfer-list-body-not-found {\n margin-top: 16px;\n}\n.ant-transfer-list-footer {\n position: absolute;\n bottom: 0;\n left: 0;\n width: 100%;\n border-top: 1px solid #e8e8e8;\n border-radius: 0 0 4px 4px;\n}\n.ant-transfer-operation {\n display: inline-block;\n margin: 0 8px;\n overflow: hidden;\n vertical-align: middle;\n}\n.ant-transfer-operation .ant-btn {\n display: block;\n}\n.ant-transfer-operation .ant-btn:first-child {\n margin-bottom: 4px;\n}\n.ant-transfer-operation .ant-btn .anticon {\n font-size: 12px;\n}\n@keyframes transferHighlightIn {\n 0% {\n background: #bae7ff;\n }\n 100% {\n background: transparent;\n }\n}\n/*# sourceMappingURL=index.css.map */";
|
|
406
|
+
n(css,{"prepend":true});
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Copyright 2013-present, Facebook, Inc.
|
|
410
|
+
* All rights reserved.
|
|
411
|
+
*
|
|
412
|
+
* This source code is licensed under the BSD-style license found in the
|
|
413
|
+
* LICENSE file in the root directory of this source tree. An additional grant
|
|
414
|
+
* of patent rights can be found in the PATENTS file in the same directory.
|
|
415
|
+
*
|
|
416
|
+
* @providesModule ReactComponentWithPureRenderMixin
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
var PureRenderMixin$1;
|
|
420
|
+
var hasRequiredPureRenderMixin;
|
|
421
|
+
|
|
422
|
+
function requirePureRenderMixin () {
|
|
423
|
+
if (hasRequiredPureRenderMixin) return PureRenderMixin$1;
|
|
424
|
+
hasRequiredPureRenderMixin = 1;
|
|
425
|
+
var shallowEqual = requireShallowequal();
|
|
426
|
+
|
|
427
|
+
function shallowCompare(instance, nextProps, nextState) {
|
|
428
|
+
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* If your React component's render function is "pure", e.g. it will render the
|
|
432
|
+
* same result given the same props and state, provide this mixin for a
|
|
433
|
+
* considerable performance boost.
|
|
434
|
+
*
|
|
435
|
+
* Most React components have pure render functions.
|
|
436
|
+
*
|
|
437
|
+
* Example:
|
|
438
|
+
*
|
|
439
|
+
* var ReactComponentWithPureRenderMixin =
|
|
440
|
+
* require('ReactComponentWithPureRenderMixin');
|
|
441
|
+
* React.createClass({
|
|
442
|
+
* mixins: [ReactComponentWithPureRenderMixin],
|
|
443
|
+
*
|
|
444
|
+
* render: function() {
|
|
445
|
+
* return <div className={this.props.className}>foo</div>;
|
|
446
|
+
* }
|
|
447
|
+
* });
|
|
448
|
+
*
|
|
449
|
+
* Note: This only checks shallow equality for props and state. If these contain
|
|
450
|
+
* complex data structures this mixin may have false-negatives for deeper
|
|
451
|
+
* differences. Only mixin to components which have simple props and state, or
|
|
452
|
+
* use `forceUpdate()` when you know deep data structures have changed.
|
|
453
|
+
*
|
|
454
|
+
* See https://facebook.github.io/react/docs/pure-render-mixin.html
|
|
455
|
+
*/
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
var ReactComponentWithPureRenderMixin = {
|
|
459
|
+
shouldComponentUpdate: function shouldComponentUpdate(nextProps, nextState) {
|
|
460
|
+
return shallowCompare(this, nextProps, nextState);
|
|
461
|
+
}
|
|
462
|
+
};
|
|
463
|
+
PureRenderMixin$1 = ReactComponentWithPureRenderMixin;
|
|
464
|
+
return PureRenderMixin$1;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
var PureRenderMixinExports = requirePureRenderMixin();
|
|
468
|
+
var PureRenderMixin = /*@__PURE__*/getDefaultExportFromCjs(PureRenderMixinExports);
|
|
469
|
+
|
|
470
|
+
function _typeof$4(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$4 = function _typeof(obj) { return typeof obj; }; } else { _typeof$4 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$4(obj); }
|
|
471
|
+
|
|
472
|
+
function _classCallCheck$4(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
473
|
+
|
|
474
|
+
function _defineProperties$4(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
475
|
+
|
|
476
|
+
function _createClass$4(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$4(Constructor.prototype, protoProps); return Constructor; }
|
|
477
|
+
|
|
478
|
+
function _inherits$4(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$4(subClass, superClass); }
|
|
479
|
+
|
|
480
|
+
function _setPrototypeOf$4(o, p) { _setPrototypeOf$4 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$4(o, p); }
|
|
481
|
+
|
|
482
|
+
function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = _getPrototypeOf$4(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$4(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$4(this, result); }; }
|
|
483
|
+
|
|
484
|
+
function _possibleConstructorReturn$4(self, call) { if (call && (_typeof$4(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$4(self); }
|
|
485
|
+
|
|
486
|
+
function _assertThisInitialized$4(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
487
|
+
|
|
488
|
+
function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
489
|
+
|
|
490
|
+
function _getPrototypeOf$4(o) { _getPrototypeOf$4 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$4(o); }
|
|
491
|
+
|
|
492
|
+
var Search = /*#__PURE__*/function (_React$Component) {
|
|
493
|
+
_inherits$4(Search, _React$Component);
|
|
494
|
+
|
|
495
|
+
var _super = _createSuper$4(Search);
|
|
496
|
+
|
|
497
|
+
function Search() {
|
|
498
|
+
var _this;
|
|
499
|
+
|
|
500
|
+
_classCallCheck$4(this, Search);
|
|
501
|
+
|
|
502
|
+
_this = _super.apply(this, arguments);
|
|
503
|
+
|
|
504
|
+
_this.handleChange = function (e) {
|
|
505
|
+
var onChange = _this.props.onChange;
|
|
506
|
+
|
|
507
|
+
if (onChange) {
|
|
508
|
+
onChange(e);
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
_this.handleClear = function (e) {
|
|
513
|
+
e.preventDefault();
|
|
514
|
+
var _this$props = _this.props,
|
|
515
|
+
handleClear = _this$props.handleClear,
|
|
516
|
+
disabled = _this$props.disabled;
|
|
517
|
+
|
|
518
|
+
if (!disabled && handleClear) {
|
|
519
|
+
handleClear(e);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
|
|
523
|
+
return _this;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
_createClass$4(Search, [{
|
|
527
|
+
key: "render",
|
|
528
|
+
value: function render() {
|
|
529
|
+
var _this$props2 = this.props,
|
|
530
|
+
placeholder = _this$props2.placeholder,
|
|
531
|
+
value = _this$props2.value,
|
|
532
|
+
prefixCls = _this$props2.prefixCls,
|
|
533
|
+
disabled = _this$props2.disabled;
|
|
534
|
+
var icon = value && value.length > 0 ? /*#__PURE__*/React.createElement("a", {
|
|
535
|
+
href: "#",
|
|
536
|
+
className: "".concat(prefixCls, "-action"),
|
|
537
|
+
onClick: this.handleClear
|
|
538
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
539
|
+
type: "close-circle",
|
|
540
|
+
theme: "filled"
|
|
541
|
+
})) : /*#__PURE__*/React.createElement("span", {
|
|
542
|
+
className: "".concat(prefixCls, "-action")
|
|
543
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
544
|
+
type: "search"
|
|
545
|
+
}));
|
|
546
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Input, {
|
|
547
|
+
placeholder: placeholder,
|
|
548
|
+
className: prefixCls,
|
|
549
|
+
value: value,
|
|
550
|
+
onChange: this.handleChange,
|
|
551
|
+
disabled: disabled
|
|
552
|
+
}), icon);
|
|
553
|
+
}
|
|
554
|
+
}]);
|
|
555
|
+
|
|
556
|
+
return Search;
|
|
557
|
+
}(React.Component);
|
|
558
|
+
Search.defaultProps = {
|
|
559
|
+
placeholder: ''
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
var LazyLoad = {};
|
|
563
|
+
|
|
564
|
+
var eventlistener$1 = {exports: {}};
|
|
565
|
+
|
|
566
|
+
var eventlistener = eventlistener$1.exports;
|
|
567
|
+
|
|
568
|
+
var hasRequiredEventlistener;
|
|
569
|
+
|
|
570
|
+
function requireEventlistener () {
|
|
571
|
+
if (hasRequiredEventlistener) return eventlistener$1.exports;
|
|
572
|
+
hasRequiredEventlistener = 1;
|
|
573
|
+
(function (module, exports$1) {
|
|
574
|
+
(function(root,factory){
|
|
575
|
+
{
|
|
576
|
+
module.exports = factory();
|
|
577
|
+
}
|
|
578
|
+
}(eventlistener, function () {
|
|
579
|
+
function wrap(standard, fallback) {
|
|
580
|
+
return function (el, evtName, listener, useCapture) {
|
|
581
|
+
if (el[standard]) {
|
|
582
|
+
el[standard](evtName, listener, useCapture);
|
|
583
|
+
} else if (el[fallback]) {
|
|
584
|
+
el[fallback]('on' + evtName, listener);
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
return {
|
|
590
|
+
add: wrap('addEventListener', 'attachEvent'),
|
|
591
|
+
remove: wrap('removeEventListener', 'detachEvent')
|
|
592
|
+
};
|
|
593
|
+
}));
|
|
594
|
+
} (eventlistener$1));
|
|
595
|
+
return eventlistener$1.exports;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
/**
|
|
599
|
+
* lodash (Custom Build) <https://lodash.com/>
|
|
600
|
+
* Build: `lodash modularize exports="npm" -o ./`
|
|
601
|
+
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
602
|
+
* Released under MIT license <https://lodash.com/license>
|
|
603
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
604
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
605
|
+
*/
|
|
606
|
+
|
|
607
|
+
var lodash_throttle;
|
|
608
|
+
var hasRequiredLodash_throttle;
|
|
609
|
+
|
|
610
|
+
function requireLodash_throttle () {
|
|
611
|
+
if (hasRequiredLodash_throttle) return lodash_throttle;
|
|
612
|
+
hasRequiredLodash_throttle = 1;
|
|
613
|
+
/** Used as the `TypeError` message for "Functions" methods. */
|
|
614
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
615
|
+
|
|
616
|
+
/** Used as references for various `Number` constants. */
|
|
617
|
+
var NAN = 0 / 0;
|
|
618
|
+
|
|
619
|
+
/** `Object#toString` result references. */
|
|
620
|
+
var symbolTag = '[object Symbol]';
|
|
621
|
+
|
|
622
|
+
/** Used to match leading and trailing whitespace. */
|
|
623
|
+
var reTrim = /^\s+|\s+$/g;
|
|
624
|
+
|
|
625
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
626
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
627
|
+
|
|
628
|
+
/** Used to detect binary string values. */
|
|
629
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
630
|
+
|
|
631
|
+
/** Used to detect octal string values. */
|
|
632
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
633
|
+
|
|
634
|
+
/** Built-in method references without a dependency on `root`. */
|
|
635
|
+
var freeParseInt = parseInt;
|
|
636
|
+
|
|
637
|
+
/** Detect free variable `global` from Node.js. */
|
|
638
|
+
var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
|
639
|
+
|
|
640
|
+
/** Detect free variable `self`. */
|
|
641
|
+
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
|
642
|
+
|
|
643
|
+
/** Used as a reference to the global object. */
|
|
644
|
+
var root = freeGlobal || freeSelf || Function('return this')();
|
|
645
|
+
|
|
646
|
+
/** Used for built-in method references. */
|
|
647
|
+
var objectProto = Object.prototype;
|
|
648
|
+
|
|
649
|
+
/**
|
|
650
|
+
* Used to resolve the
|
|
651
|
+
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
652
|
+
* of values.
|
|
653
|
+
*/
|
|
654
|
+
var objectToString = objectProto.toString;
|
|
655
|
+
|
|
656
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
657
|
+
var nativeMax = Math.max,
|
|
658
|
+
nativeMin = Math.min;
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
662
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
663
|
+
*
|
|
664
|
+
* @static
|
|
665
|
+
* @memberOf _
|
|
666
|
+
* @since 2.4.0
|
|
667
|
+
* @category Date
|
|
668
|
+
* @returns {number} Returns the timestamp.
|
|
669
|
+
* @example
|
|
670
|
+
*
|
|
671
|
+
* _.defer(function(stamp) {
|
|
672
|
+
* console.log(_.now() - stamp);
|
|
673
|
+
* }, _.now());
|
|
674
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
675
|
+
*/
|
|
676
|
+
var now = function() {
|
|
677
|
+
return root.Date.now();
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
682
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
683
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
684
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
685
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
686
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
687
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
688
|
+
* calls to the debounced function return the result of the last `func`
|
|
689
|
+
* invocation.
|
|
690
|
+
*
|
|
691
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
692
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
693
|
+
* is invoked more than once during the `wait` timeout.
|
|
694
|
+
*
|
|
695
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
696
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
697
|
+
*
|
|
698
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
699
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
700
|
+
*
|
|
701
|
+
* @static
|
|
702
|
+
* @memberOf _
|
|
703
|
+
* @since 0.1.0
|
|
704
|
+
* @category Function
|
|
705
|
+
* @param {Function} func The function to debounce.
|
|
706
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
707
|
+
* @param {Object} [options={}] The options object.
|
|
708
|
+
* @param {boolean} [options.leading=false]
|
|
709
|
+
* Specify invoking on the leading edge of the timeout.
|
|
710
|
+
* @param {number} [options.maxWait]
|
|
711
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
712
|
+
* @param {boolean} [options.trailing=true]
|
|
713
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
714
|
+
* @returns {Function} Returns the new debounced function.
|
|
715
|
+
* @example
|
|
716
|
+
*
|
|
717
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
718
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
719
|
+
*
|
|
720
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
721
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
722
|
+
* 'leading': true,
|
|
723
|
+
* 'trailing': false
|
|
724
|
+
* }));
|
|
725
|
+
*
|
|
726
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
727
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
728
|
+
* var source = new EventSource('/stream');
|
|
729
|
+
* jQuery(source).on('message', debounced);
|
|
730
|
+
*
|
|
731
|
+
* // Cancel the trailing debounced invocation.
|
|
732
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
733
|
+
*/
|
|
734
|
+
function debounce(func, wait, options) {
|
|
735
|
+
var lastArgs,
|
|
736
|
+
lastThis,
|
|
737
|
+
maxWait,
|
|
738
|
+
result,
|
|
739
|
+
timerId,
|
|
740
|
+
lastCallTime,
|
|
741
|
+
lastInvokeTime = 0,
|
|
742
|
+
leading = false,
|
|
743
|
+
maxing = false,
|
|
744
|
+
trailing = true;
|
|
745
|
+
|
|
746
|
+
if (typeof func != 'function') {
|
|
747
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
748
|
+
}
|
|
749
|
+
wait = toNumber(wait) || 0;
|
|
750
|
+
if (isObject(options)) {
|
|
751
|
+
leading = !!options.leading;
|
|
752
|
+
maxing = 'maxWait' in options;
|
|
753
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
754
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
function invokeFunc(time) {
|
|
758
|
+
var args = lastArgs,
|
|
759
|
+
thisArg = lastThis;
|
|
760
|
+
|
|
761
|
+
lastArgs = lastThis = undefined;
|
|
762
|
+
lastInvokeTime = time;
|
|
763
|
+
result = func.apply(thisArg, args);
|
|
764
|
+
return result;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
function leadingEdge(time) {
|
|
768
|
+
// Reset any `maxWait` timer.
|
|
769
|
+
lastInvokeTime = time;
|
|
770
|
+
// Start the timer for the trailing edge.
|
|
771
|
+
timerId = setTimeout(timerExpired, wait);
|
|
772
|
+
// Invoke the leading edge.
|
|
773
|
+
return leading ? invokeFunc(time) : result;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
function remainingWait(time) {
|
|
777
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
778
|
+
timeSinceLastInvoke = time - lastInvokeTime,
|
|
779
|
+
result = wait - timeSinceLastCall;
|
|
780
|
+
|
|
781
|
+
return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
function shouldInvoke(time) {
|
|
785
|
+
var timeSinceLastCall = time - lastCallTime,
|
|
786
|
+
timeSinceLastInvoke = time - lastInvokeTime;
|
|
787
|
+
|
|
788
|
+
// Either this is the first call, activity has stopped and we're at the
|
|
789
|
+
// trailing edge, the system time has gone backwards and we're treating
|
|
790
|
+
// it as the trailing edge, or we've hit the `maxWait` limit.
|
|
791
|
+
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
|
|
792
|
+
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
function timerExpired() {
|
|
796
|
+
var time = now();
|
|
797
|
+
if (shouldInvoke(time)) {
|
|
798
|
+
return trailingEdge(time);
|
|
799
|
+
}
|
|
800
|
+
// Restart the timer.
|
|
801
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
802
|
+
}
|
|
803
|
+
|
|
804
|
+
function trailingEdge(time) {
|
|
805
|
+
timerId = undefined;
|
|
806
|
+
|
|
807
|
+
// Only invoke if we have `lastArgs` which means `func` has been
|
|
808
|
+
// debounced at least once.
|
|
809
|
+
if (trailing && lastArgs) {
|
|
810
|
+
return invokeFunc(time);
|
|
811
|
+
}
|
|
812
|
+
lastArgs = lastThis = undefined;
|
|
813
|
+
return result;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function cancel() {
|
|
817
|
+
if (timerId !== undefined) {
|
|
818
|
+
clearTimeout(timerId);
|
|
819
|
+
}
|
|
820
|
+
lastInvokeTime = 0;
|
|
821
|
+
lastArgs = lastCallTime = lastThis = timerId = undefined;
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
function flush() {
|
|
825
|
+
return timerId === undefined ? result : trailingEdge(now());
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function debounced() {
|
|
829
|
+
var time = now(),
|
|
830
|
+
isInvoking = shouldInvoke(time);
|
|
831
|
+
|
|
832
|
+
lastArgs = arguments;
|
|
833
|
+
lastThis = this;
|
|
834
|
+
lastCallTime = time;
|
|
835
|
+
|
|
836
|
+
if (isInvoking) {
|
|
837
|
+
if (timerId === undefined) {
|
|
838
|
+
return leadingEdge(lastCallTime);
|
|
839
|
+
}
|
|
840
|
+
if (maxing) {
|
|
841
|
+
// Handle invocations in a tight loop.
|
|
842
|
+
timerId = setTimeout(timerExpired, wait);
|
|
843
|
+
return invokeFunc(lastCallTime);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
if (timerId === undefined) {
|
|
847
|
+
timerId = setTimeout(timerExpired, wait);
|
|
848
|
+
}
|
|
849
|
+
return result;
|
|
850
|
+
}
|
|
851
|
+
debounced.cancel = cancel;
|
|
852
|
+
debounced.flush = flush;
|
|
853
|
+
return debounced;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
858
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
859
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
860
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
861
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
862
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
863
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
864
|
+
* result of the last `func` invocation.
|
|
865
|
+
*
|
|
866
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
867
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
868
|
+
* is invoked more than once during the `wait` timeout.
|
|
869
|
+
*
|
|
870
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
871
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
872
|
+
*
|
|
873
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
874
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
875
|
+
*
|
|
876
|
+
* @static
|
|
877
|
+
* @memberOf _
|
|
878
|
+
* @since 0.1.0
|
|
879
|
+
* @category Function
|
|
880
|
+
* @param {Function} func The function to throttle.
|
|
881
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
882
|
+
* @param {Object} [options={}] The options object.
|
|
883
|
+
* @param {boolean} [options.leading=true]
|
|
884
|
+
* Specify invoking on the leading edge of the timeout.
|
|
885
|
+
* @param {boolean} [options.trailing=true]
|
|
886
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
887
|
+
* @returns {Function} Returns the new throttled function.
|
|
888
|
+
* @example
|
|
889
|
+
*
|
|
890
|
+
* // Avoid excessively updating the position while scrolling.
|
|
891
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
892
|
+
*
|
|
893
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
894
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
895
|
+
* jQuery(element).on('click', throttled);
|
|
896
|
+
*
|
|
897
|
+
* // Cancel the trailing throttled invocation.
|
|
898
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
899
|
+
*/
|
|
900
|
+
function throttle(func, wait, options) {
|
|
901
|
+
var leading = true,
|
|
902
|
+
trailing = true;
|
|
903
|
+
|
|
904
|
+
if (typeof func != 'function') {
|
|
905
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
906
|
+
}
|
|
907
|
+
if (isObject(options)) {
|
|
908
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
909
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
910
|
+
}
|
|
911
|
+
return debounce(func, wait, {
|
|
912
|
+
'leading': leading,
|
|
913
|
+
'maxWait': wait,
|
|
914
|
+
'trailing': trailing
|
|
915
|
+
});
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
/**
|
|
919
|
+
* Checks if `value` is the
|
|
920
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
921
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
922
|
+
*
|
|
923
|
+
* @static
|
|
924
|
+
* @memberOf _
|
|
925
|
+
* @since 0.1.0
|
|
926
|
+
* @category Lang
|
|
927
|
+
* @param {*} value The value to check.
|
|
928
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
929
|
+
* @example
|
|
930
|
+
*
|
|
931
|
+
* _.isObject({});
|
|
932
|
+
* // => true
|
|
933
|
+
*
|
|
934
|
+
* _.isObject([1, 2, 3]);
|
|
935
|
+
* // => true
|
|
936
|
+
*
|
|
937
|
+
* _.isObject(_.noop);
|
|
938
|
+
* // => true
|
|
939
|
+
*
|
|
940
|
+
* _.isObject(null);
|
|
941
|
+
* // => false
|
|
942
|
+
*/
|
|
943
|
+
function isObject(value) {
|
|
944
|
+
var type = typeof value;
|
|
945
|
+
return !!value && (type == 'object' || type == 'function');
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/**
|
|
949
|
+
* Checks if `value` is object-like. A value is object-like if it's not `null`
|
|
950
|
+
* and has a `typeof` result of "object".
|
|
951
|
+
*
|
|
952
|
+
* @static
|
|
953
|
+
* @memberOf _
|
|
954
|
+
* @since 4.0.0
|
|
955
|
+
* @category Lang
|
|
956
|
+
* @param {*} value The value to check.
|
|
957
|
+
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
|
|
958
|
+
* @example
|
|
959
|
+
*
|
|
960
|
+
* _.isObjectLike({});
|
|
961
|
+
* // => true
|
|
962
|
+
*
|
|
963
|
+
* _.isObjectLike([1, 2, 3]);
|
|
964
|
+
* // => true
|
|
965
|
+
*
|
|
966
|
+
* _.isObjectLike(_.noop);
|
|
967
|
+
* // => false
|
|
968
|
+
*
|
|
969
|
+
* _.isObjectLike(null);
|
|
970
|
+
* // => false
|
|
971
|
+
*/
|
|
972
|
+
function isObjectLike(value) {
|
|
973
|
+
return !!value && typeof value == 'object';
|
|
974
|
+
}
|
|
975
|
+
|
|
976
|
+
/**
|
|
977
|
+
* Checks if `value` is classified as a `Symbol` primitive or object.
|
|
978
|
+
*
|
|
979
|
+
* @static
|
|
980
|
+
* @memberOf _
|
|
981
|
+
* @since 4.0.0
|
|
982
|
+
* @category Lang
|
|
983
|
+
* @param {*} value The value to check.
|
|
984
|
+
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
|
|
985
|
+
* @example
|
|
986
|
+
*
|
|
987
|
+
* _.isSymbol(Symbol.iterator);
|
|
988
|
+
* // => true
|
|
989
|
+
*
|
|
990
|
+
* _.isSymbol('abc');
|
|
991
|
+
* // => false
|
|
992
|
+
*/
|
|
993
|
+
function isSymbol(value) {
|
|
994
|
+
return typeof value == 'symbol' ||
|
|
995
|
+
(isObjectLike(value) && objectToString.call(value) == symbolTag);
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Converts `value` to a number.
|
|
1000
|
+
*
|
|
1001
|
+
* @static
|
|
1002
|
+
* @memberOf _
|
|
1003
|
+
* @since 4.0.0
|
|
1004
|
+
* @category Lang
|
|
1005
|
+
* @param {*} value The value to process.
|
|
1006
|
+
* @returns {number} Returns the number.
|
|
1007
|
+
* @example
|
|
1008
|
+
*
|
|
1009
|
+
* _.toNumber(3.2);
|
|
1010
|
+
* // => 3.2
|
|
1011
|
+
*
|
|
1012
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
1013
|
+
* // => 5e-324
|
|
1014
|
+
*
|
|
1015
|
+
* _.toNumber(Infinity);
|
|
1016
|
+
* // => Infinity
|
|
1017
|
+
*
|
|
1018
|
+
* _.toNumber('3.2');
|
|
1019
|
+
* // => 3.2
|
|
1020
|
+
*/
|
|
1021
|
+
function toNumber(value) {
|
|
1022
|
+
if (typeof value == 'number') {
|
|
1023
|
+
return value;
|
|
1024
|
+
}
|
|
1025
|
+
if (isSymbol(value)) {
|
|
1026
|
+
return NAN;
|
|
1027
|
+
}
|
|
1028
|
+
if (isObject(value)) {
|
|
1029
|
+
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
|
|
1030
|
+
value = isObject(other) ? (other + '') : other;
|
|
1031
|
+
}
|
|
1032
|
+
if (typeof value != 'string') {
|
|
1033
|
+
return value === 0 ? value : +value;
|
|
1034
|
+
}
|
|
1035
|
+
value = value.replace(reTrim, '');
|
|
1036
|
+
var isBinary = reIsBinary.test(value);
|
|
1037
|
+
return (isBinary || reIsOctal.test(value))
|
|
1038
|
+
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
|
1039
|
+
: (reIsBadHex.test(value) ? NAN : +value);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
lodash_throttle = throttle;
|
|
1043
|
+
return lodash_throttle;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
var parentScroll = {};
|
|
1047
|
+
|
|
1048
|
+
var hasRequiredParentScroll;
|
|
1049
|
+
|
|
1050
|
+
function requireParentScroll () {
|
|
1051
|
+
if (hasRequiredParentScroll) return parentScroll;
|
|
1052
|
+
hasRequiredParentScroll = 1;
|
|
1053
|
+
|
|
1054
|
+
Object.defineProperty(parentScroll, "__esModule", {
|
|
1055
|
+
value: true
|
|
1056
|
+
});
|
|
1057
|
+
var style = function style(element, prop) {
|
|
1058
|
+
return typeof getComputedStyle !== 'undefined' ? getComputedStyle(element, null).getPropertyValue(prop) : element.style[prop];
|
|
1059
|
+
};
|
|
1060
|
+
|
|
1061
|
+
var overflow = function overflow(element) {
|
|
1062
|
+
return style(element, 'overflow') + style(element, 'overflow-y') + style(element, 'overflow-x');
|
|
1063
|
+
};
|
|
1064
|
+
|
|
1065
|
+
var scrollParent = function scrollParent(element) {
|
|
1066
|
+
if (!(element instanceof HTMLElement)) {
|
|
1067
|
+
return window;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
var parent = element;
|
|
1071
|
+
|
|
1072
|
+
while (parent) {
|
|
1073
|
+
if (parent === document.body || parent === document.documentElement) {
|
|
1074
|
+
break;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
if (!parent.parentNode) {
|
|
1078
|
+
break;
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
if (/(scroll|auto)/.test(overflow(parent))) {
|
|
1082
|
+
return parent;
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
parent = parent.parentNode;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
return window;
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
parentScroll.default = scrollParent;
|
|
1092
|
+
return parentScroll;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
var inViewport = {};
|
|
1096
|
+
|
|
1097
|
+
var getElementPosition = {};
|
|
1098
|
+
|
|
1099
|
+
var hasRequiredGetElementPosition;
|
|
1100
|
+
|
|
1101
|
+
function requireGetElementPosition () {
|
|
1102
|
+
if (hasRequiredGetElementPosition) return getElementPosition;
|
|
1103
|
+
hasRequiredGetElementPosition = 1;
|
|
1104
|
+
|
|
1105
|
+
Object.defineProperty(getElementPosition, "__esModule", {
|
|
1106
|
+
value: true
|
|
1107
|
+
});
|
|
1108
|
+
getElementPosition.default = getElementPosition$1;
|
|
1109
|
+
/*
|
|
1110
|
+
* Finds element's position relative to the whole document,
|
|
1111
|
+
* rather than to the viewport as it is the case with .getBoundingClientRect().
|
|
1112
|
+
*/
|
|
1113
|
+
function getElementPosition$1(element) {
|
|
1114
|
+
var rect = element.getBoundingClientRect();
|
|
1115
|
+
|
|
1116
|
+
return {
|
|
1117
|
+
top: rect.top + window.pageYOffset,
|
|
1118
|
+
left: rect.left + window.pageXOffset
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
return getElementPosition;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
var hasRequiredInViewport;
|
|
1125
|
+
|
|
1126
|
+
function requireInViewport () {
|
|
1127
|
+
if (hasRequiredInViewport) return inViewport;
|
|
1128
|
+
hasRequiredInViewport = 1;
|
|
1129
|
+
|
|
1130
|
+
Object.defineProperty(inViewport, "__esModule", {
|
|
1131
|
+
value: true
|
|
1132
|
+
});
|
|
1133
|
+
inViewport.default = inViewport$1;
|
|
1134
|
+
|
|
1135
|
+
var _getElementPosition = requireGetElementPosition();
|
|
1136
|
+
|
|
1137
|
+
var _getElementPosition2 = _interopRequireDefault(_getElementPosition);
|
|
1138
|
+
|
|
1139
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1140
|
+
|
|
1141
|
+
var isHidden = function isHidden(element) {
|
|
1142
|
+
return element.offsetParent === null;
|
|
1143
|
+
};
|
|
1144
|
+
|
|
1145
|
+
function inViewport$1(element, container, customOffset) {
|
|
1146
|
+
if (isHidden(element)) {
|
|
1147
|
+
return false;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
var top = void 0;
|
|
1151
|
+
var bottom = void 0;
|
|
1152
|
+
var left = void 0;
|
|
1153
|
+
var right = void 0;
|
|
1154
|
+
|
|
1155
|
+
if (typeof container === 'undefined' || container === window) {
|
|
1156
|
+
top = window.pageYOffset;
|
|
1157
|
+
left = window.pageXOffset;
|
|
1158
|
+
bottom = top + window.innerHeight;
|
|
1159
|
+
right = left + window.innerWidth;
|
|
1160
|
+
} else {
|
|
1161
|
+
if (!inViewport$1(container, window, customOffset)) return false;
|
|
1162
|
+
|
|
1163
|
+
var containerPosition = (0, _getElementPosition2.default)(container);
|
|
1164
|
+
|
|
1165
|
+
top = containerPosition.top;
|
|
1166
|
+
left = containerPosition.left;
|
|
1167
|
+
bottom = top + container.offsetHeight;
|
|
1168
|
+
right = left + container.offsetWidth;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
var elementPosition = (0, _getElementPosition2.default)(element);
|
|
1172
|
+
|
|
1173
|
+
return top <= elementPosition.top + element.offsetHeight + customOffset.top && bottom >= elementPosition.top - customOffset.bottom && left <= elementPosition.left + element.offsetWidth + customOffset.left && right >= elementPosition.left - customOffset.right;
|
|
1174
|
+
}
|
|
1175
|
+
return inViewport;
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
var hasRequiredLazyLoad;
|
|
1179
|
+
|
|
1180
|
+
function requireLazyLoad () {
|
|
1181
|
+
if (hasRequiredLazyLoad) return LazyLoad;
|
|
1182
|
+
hasRequiredLazyLoad = 1;
|
|
1183
|
+
|
|
1184
|
+
Object.defineProperty(LazyLoad, "__esModule", {
|
|
1185
|
+
value: true
|
|
1186
|
+
});
|
|
1187
|
+
|
|
1188
|
+
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
|
|
1189
|
+
|
|
1190
|
+
var _react = React__default;
|
|
1191
|
+
|
|
1192
|
+
var _react2 = _interopRequireDefault(_react);
|
|
1193
|
+
|
|
1194
|
+
var _propTypes = /*@__PURE__*/ requirePropTypes();
|
|
1195
|
+
|
|
1196
|
+
var _propTypes2 = _interopRequireDefault(_propTypes);
|
|
1197
|
+
|
|
1198
|
+
var _reactDom = ReactDOM__default;
|
|
1199
|
+
|
|
1200
|
+
var _eventlistener = requireEventlistener();
|
|
1201
|
+
|
|
1202
|
+
var _lodash = requireLodash_debounce();
|
|
1203
|
+
|
|
1204
|
+
var _lodash2 = _interopRequireDefault(_lodash);
|
|
1205
|
+
|
|
1206
|
+
var _lodash3 = requireLodash_throttle();
|
|
1207
|
+
|
|
1208
|
+
var _lodash4 = _interopRequireDefault(_lodash3);
|
|
1209
|
+
|
|
1210
|
+
var _parentScroll = requireParentScroll();
|
|
1211
|
+
|
|
1212
|
+
var _parentScroll2 = _interopRequireDefault(_parentScroll);
|
|
1213
|
+
|
|
1214
|
+
var _inViewport = requireInViewport();
|
|
1215
|
+
|
|
1216
|
+
var _inViewport2 = _interopRequireDefault(_inViewport);
|
|
1217
|
+
|
|
1218
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
1219
|
+
|
|
1220
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1221
|
+
|
|
1222
|
+
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
|
|
1223
|
+
|
|
1224
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
|
|
1225
|
+
|
|
1226
|
+
var LazyLoad$1 = function (_Component) {
|
|
1227
|
+
_inherits(LazyLoad, _Component);
|
|
1228
|
+
|
|
1229
|
+
function LazyLoad(props) {
|
|
1230
|
+
_classCallCheck(this, LazyLoad);
|
|
1231
|
+
|
|
1232
|
+
var _this = _possibleConstructorReturn(this, (LazyLoad.__proto__ || Object.getPrototypeOf(LazyLoad)).call(this, props));
|
|
1233
|
+
|
|
1234
|
+
_this.lazyLoadHandler = _this.lazyLoadHandler.bind(_this);
|
|
1235
|
+
|
|
1236
|
+
if (props.throttle > 0) {
|
|
1237
|
+
if (props.debounce) {
|
|
1238
|
+
_this.lazyLoadHandler = (0, _lodash2.default)(_this.lazyLoadHandler, props.throttle);
|
|
1239
|
+
} else {
|
|
1240
|
+
_this.lazyLoadHandler = (0, _lodash4.default)(_this.lazyLoadHandler, props.throttle);
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
_this.state = { visible: false };
|
|
1245
|
+
return _this;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
_createClass(LazyLoad, [{
|
|
1249
|
+
key: 'componentDidMount',
|
|
1250
|
+
value: function componentDidMount() {
|
|
1251
|
+
this._mounted = true;
|
|
1252
|
+
var eventNode = this.getEventNode();
|
|
1253
|
+
|
|
1254
|
+
this.lazyLoadHandler();
|
|
1255
|
+
|
|
1256
|
+
if (this.lazyLoadHandler.flush) {
|
|
1257
|
+
this.lazyLoadHandler.flush();
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
(0, _eventlistener.add)(window, 'resize', this.lazyLoadHandler);
|
|
1261
|
+
(0, _eventlistener.add)(eventNode, 'scroll', this.lazyLoadHandler);
|
|
1262
|
+
|
|
1263
|
+
if (eventNode !== window) (0, _eventlistener.add)(window, 'scroll', this.lazyLoadHandler);
|
|
1264
|
+
}
|
|
1265
|
+
}, {
|
|
1266
|
+
key: 'componentDidUpdate',
|
|
1267
|
+
value: function componentDidUpdate() {
|
|
1268
|
+
if (!this.state.visible) {
|
|
1269
|
+
this.lazyLoadHandler();
|
|
1270
|
+
}
|
|
1271
|
+
}
|
|
1272
|
+
}, {
|
|
1273
|
+
key: 'shouldComponentUpdate',
|
|
1274
|
+
value: function shouldComponentUpdate(_nextProps, nextState) {
|
|
1275
|
+
return nextState.visible;
|
|
1276
|
+
}
|
|
1277
|
+
}, {
|
|
1278
|
+
key: 'componentWillUnmount',
|
|
1279
|
+
value: function componentWillUnmount() {
|
|
1280
|
+
this._mounted = false;
|
|
1281
|
+
if (this.lazyLoadHandler.cancel) {
|
|
1282
|
+
this.lazyLoadHandler.cancel();
|
|
1283
|
+
}
|
|
1284
|
+
|
|
1285
|
+
this.detachListeners();
|
|
1286
|
+
}
|
|
1287
|
+
}, {
|
|
1288
|
+
key: 'getEventNode',
|
|
1289
|
+
value: function getEventNode() {
|
|
1290
|
+
return (0, _parentScroll2.default)((0, _reactDom.findDOMNode)(this));
|
|
1291
|
+
}
|
|
1292
|
+
}, {
|
|
1293
|
+
key: 'getOffset',
|
|
1294
|
+
value: function getOffset() {
|
|
1295
|
+
var _props = this.props,
|
|
1296
|
+
offset = _props.offset,
|
|
1297
|
+
offsetVertical = _props.offsetVertical,
|
|
1298
|
+
offsetHorizontal = _props.offsetHorizontal,
|
|
1299
|
+
offsetTop = _props.offsetTop,
|
|
1300
|
+
offsetBottom = _props.offsetBottom,
|
|
1301
|
+
offsetLeft = _props.offsetLeft,
|
|
1302
|
+
offsetRight = _props.offsetRight,
|
|
1303
|
+
threshold = _props.threshold;
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
var _offsetAll = threshold || offset;
|
|
1307
|
+
var _offsetVertical = offsetVertical || _offsetAll;
|
|
1308
|
+
var _offsetHorizontal = offsetHorizontal || _offsetAll;
|
|
1309
|
+
|
|
1310
|
+
return {
|
|
1311
|
+
top: offsetTop || _offsetVertical,
|
|
1312
|
+
bottom: offsetBottom || _offsetVertical,
|
|
1313
|
+
left: offsetLeft || _offsetHorizontal,
|
|
1314
|
+
right: offsetRight || _offsetHorizontal
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
}, {
|
|
1318
|
+
key: 'lazyLoadHandler',
|
|
1319
|
+
value: function lazyLoadHandler() {
|
|
1320
|
+
if (!this._mounted) {
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
var offset = this.getOffset();
|
|
1324
|
+
var node = (0, _reactDom.findDOMNode)(this);
|
|
1325
|
+
var eventNode = this.getEventNode();
|
|
1326
|
+
|
|
1327
|
+
if ((0, _inViewport2.default)(node, eventNode, offset)) {
|
|
1328
|
+
var onContentVisible = this.props.onContentVisible;
|
|
1329
|
+
|
|
1330
|
+
|
|
1331
|
+
this.setState({ visible: true }, function () {
|
|
1332
|
+
if (onContentVisible) {
|
|
1333
|
+
onContentVisible();
|
|
1334
|
+
}
|
|
1335
|
+
});
|
|
1336
|
+
this.detachListeners();
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}, {
|
|
1340
|
+
key: 'detachListeners',
|
|
1341
|
+
value: function detachListeners() {
|
|
1342
|
+
var eventNode = this.getEventNode();
|
|
1343
|
+
|
|
1344
|
+
(0, _eventlistener.remove)(window, 'resize', this.lazyLoadHandler);
|
|
1345
|
+
(0, _eventlistener.remove)(eventNode, 'scroll', this.lazyLoadHandler);
|
|
1346
|
+
|
|
1347
|
+
if (eventNode !== window) (0, _eventlistener.remove)(window, 'scroll', this.lazyLoadHandler);
|
|
1348
|
+
}
|
|
1349
|
+
}, {
|
|
1350
|
+
key: 'render',
|
|
1351
|
+
value: function render() {
|
|
1352
|
+
var _props2 = this.props,
|
|
1353
|
+
children = _props2.children,
|
|
1354
|
+
className = _props2.className,
|
|
1355
|
+
height = _props2.height,
|
|
1356
|
+
width = _props2.width;
|
|
1357
|
+
var visible = this.state.visible;
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
var elStyles = { height: height, width: width };
|
|
1361
|
+
var elClasses = 'LazyLoad' + (visible ? ' is-visible' : '') + (className ? ' ' + className : '');
|
|
1362
|
+
|
|
1363
|
+
return _react2.default.createElement(this.props.elementType, {
|
|
1364
|
+
className: elClasses,
|
|
1365
|
+
style: elStyles
|
|
1366
|
+
}, visible && _react.Children.only(children));
|
|
1367
|
+
}
|
|
1368
|
+
}]);
|
|
1369
|
+
|
|
1370
|
+
return LazyLoad;
|
|
1371
|
+
}(_react.Component);
|
|
1372
|
+
|
|
1373
|
+
LazyLoad.default = LazyLoad$1;
|
|
1374
|
+
|
|
1375
|
+
|
|
1376
|
+
LazyLoad$1.propTypes = {
|
|
1377
|
+
children: _propTypes2.default.node.isRequired,
|
|
1378
|
+
className: _propTypes2.default.string,
|
|
1379
|
+
debounce: _propTypes2.default.bool,
|
|
1380
|
+
elementType: _propTypes2.default.string,
|
|
1381
|
+
height: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
|
|
1382
|
+
offset: _propTypes2.default.number,
|
|
1383
|
+
offsetBottom: _propTypes2.default.number,
|
|
1384
|
+
offsetHorizontal: _propTypes2.default.number,
|
|
1385
|
+
offsetLeft: _propTypes2.default.number,
|
|
1386
|
+
offsetRight: _propTypes2.default.number,
|
|
1387
|
+
offsetTop: _propTypes2.default.number,
|
|
1388
|
+
offsetVertical: _propTypes2.default.number,
|
|
1389
|
+
threshold: _propTypes2.default.number,
|
|
1390
|
+
throttle: _propTypes2.default.number,
|
|
1391
|
+
width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
|
|
1392
|
+
onContentVisible: _propTypes2.default.func
|
|
1393
|
+
};
|
|
1394
|
+
|
|
1395
|
+
LazyLoad$1.defaultProps = {
|
|
1396
|
+
elementType: 'div',
|
|
1397
|
+
debounce: true,
|
|
1398
|
+
offset: 0,
|
|
1399
|
+
offsetBottom: 0,
|
|
1400
|
+
offsetHorizontal: 0,
|
|
1401
|
+
offsetLeft: 0,
|
|
1402
|
+
offsetRight: 0,
|
|
1403
|
+
offsetTop: 0,
|
|
1404
|
+
offsetVertical: 0,
|
|
1405
|
+
throttle: 250
|
|
1406
|
+
};
|
|
1407
|
+
return LazyLoad;
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
var LazyLoadExports = requireLazyLoad();
|
|
1411
|
+
var Lazyload = /*@__PURE__*/getDefaultExportFromCjs(LazyLoadExports);
|
|
1412
|
+
|
|
1413
|
+
function _typeof$3(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$3 = function _typeof(obj) { return typeof obj; }; } else { _typeof$3 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$3(obj); }
|
|
1414
|
+
|
|
1415
|
+
function _extends$2() { _extends$2 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
|
|
1416
|
+
|
|
1417
|
+
function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1418
|
+
|
|
1419
|
+
function _classCallCheck$3(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1420
|
+
|
|
1421
|
+
function _defineProperties$3(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1422
|
+
|
|
1423
|
+
function _createClass$3(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$3(Constructor.prototype, protoProps); return Constructor; }
|
|
1424
|
+
|
|
1425
|
+
function _inherits$3(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$3(subClass, superClass); }
|
|
1426
|
+
|
|
1427
|
+
function _setPrototypeOf$3(o, p) { _setPrototypeOf$3 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$3(o, p); }
|
|
1428
|
+
|
|
1429
|
+
function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = _getPrototypeOf$3(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$3(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$3(this, result); }; }
|
|
1430
|
+
|
|
1431
|
+
function _possibleConstructorReturn$3(self, call) { if (call && (_typeof$3(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$3(self); }
|
|
1432
|
+
|
|
1433
|
+
function _assertThisInitialized$3(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1434
|
+
|
|
1435
|
+
function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1436
|
+
|
|
1437
|
+
function _getPrototypeOf$3(o) { _getPrototypeOf$3 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$3(o); }
|
|
1438
|
+
|
|
1439
|
+
var ListItem = /*#__PURE__*/function (_React$Component) {
|
|
1440
|
+
_inherits$3(ListItem, _React$Component);
|
|
1441
|
+
|
|
1442
|
+
var _super = _createSuper$3(ListItem);
|
|
1443
|
+
|
|
1444
|
+
function ListItem() {
|
|
1445
|
+
_classCallCheck$3(this, ListItem);
|
|
1446
|
+
|
|
1447
|
+
return _super.apply(this, arguments);
|
|
1448
|
+
}
|
|
1449
|
+
|
|
1450
|
+
_createClass$3(ListItem, [{
|
|
1451
|
+
key: "shouldComponentUpdate",
|
|
1452
|
+
value: function shouldComponentUpdate() {
|
|
1453
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1454
|
+
args[_key] = arguments[_key];
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
|
1458
|
+
}
|
|
1459
|
+
}, {
|
|
1460
|
+
key: "render",
|
|
1461
|
+
value: function render() {
|
|
1462
|
+
var _classNames;
|
|
1463
|
+
|
|
1464
|
+
var _this$props = this.props,
|
|
1465
|
+
renderedText = _this$props.renderedText,
|
|
1466
|
+
renderedEl = _this$props.renderedEl,
|
|
1467
|
+
item = _this$props.item,
|
|
1468
|
+
lazy = _this$props.lazy,
|
|
1469
|
+
checked = _this$props.checked,
|
|
1470
|
+
disabled = _this$props.disabled,
|
|
1471
|
+
prefixCls = _this$props.prefixCls,
|
|
1472
|
+
onClick = _this$props.onClick;
|
|
1473
|
+
var className = classNames((_classNames = {}, _defineProperty$2(_classNames, "".concat(prefixCls, "-content-item"), true), _defineProperty$2(_classNames, "".concat(prefixCls, "-content-item-disabled"), disabled || item.disabled), _classNames));
|
|
1474
|
+
var title;
|
|
1475
|
+
|
|
1476
|
+
if (typeof renderedText === 'string' || typeof renderedText === 'number') {
|
|
1477
|
+
title = String(renderedText);
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
var listItem = /*#__PURE__*/React.createElement("li", {
|
|
1481
|
+
className: className,
|
|
1482
|
+
title: title,
|
|
1483
|
+
onClick: disabled || item.disabled ? undefined : function () {
|
|
1484
|
+
return onClick(item);
|
|
1485
|
+
}
|
|
1486
|
+
}, /*#__PURE__*/React.createElement(Checkbox, {
|
|
1487
|
+
checked: checked,
|
|
1488
|
+
disabled: disabled || item.disabled
|
|
1489
|
+
}), /*#__PURE__*/React.createElement("span", {
|
|
1490
|
+
className: "".concat(prefixCls, "-content-item-text")
|
|
1491
|
+
}, renderedEl));
|
|
1492
|
+
var children = null;
|
|
1493
|
+
|
|
1494
|
+
if (lazy) {
|
|
1495
|
+
var lazyProps = _extends$2({
|
|
1496
|
+
height: 32,
|
|
1497
|
+
offset: 500,
|
|
1498
|
+
throttle: 0,
|
|
1499
|
+
debounce: false
|
|
1500
|
+
}, lazy);
|
|
1501
|
+
|
|
1502
|
+
children = /*#__PURE__*/React.createElement(Lazyload, lazyProps, listItem);
|
|
1503
|
+
} else {
|
|
1504
|
+
children = listItem;
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
return children;
|
|
1508
|
+
}
|
|
1509
|
+
}]);
|
|
1510
|
+
|
|
1511
|
+
return ListItem;
|
|
1512
|
+
}(React.Component);
|
|
1513
|
+
|
|
1514
|
+
function _typeof$2(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$2 = function _typeof(obj) { return typeof obj; }; } else { _typeof$2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$2(obj); }
|
|
1515
|
+
|
|
1516
|
+
function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1517
|
+
|
|
1518
|
+
function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1519
|
+
|
|
1520
|
+
function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); return Constructor; }
|
|
1521
|
+
|
|
1522
|
+
function _inherits$2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$2(subClass, superClass); }
|
|
1523
|
+
|
|
1524
|
+
function _setPrototypeOf$2(o, p) { _setPrototypeOf$2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$2(o, p); }
|
|
1525
|
+
|
|
1526
|
+
function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = _getPrototypeOf$2(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$2(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$2(this, result); }; }
|
|
1527
|
+
|
|
1528
|
+
function _possibleConstructorReturn$2(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$2(self); }
|
|
1529
|
+
|
|
1530
|
+
function _assertThisInitialized$2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1531
|
+
|
|
1532
|
+
function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1533
|
+
|
|
1534
|
+
function _getPrototypeOf$2(o) { _getPrototypeOf$2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$2(o); }
|
|
1535
|
+
var OmitProps = tuple('handleFilter', 'handleSelect', 'handleSelectAll', 'handleClear', 'body', 'checkedKeys');
|
|
1536
|
+
|
|
1537
|
+
var ListBody = /*#__PURE__*/function (_React$Component) {
|
|
1538
|
+
_inherits$2(ListBody, _React$Component);
|
|
1539
|
+
|
|
1540
|
+
var _super = _createSuper$2(ListBody);
|
|
1541
|
+
|
|
1542
|
+
function ListBody() {
|
|
1543
|
+
var _this;
|
|
1544
|
+
|
|
1545
|
+
_classCallCheck$2(this, ListBody);
|
|
1546
|
+
|
|
1547
|
+
_this = _super.apply(this, arguments);
|
|
1548
|
+
_this.state = {
|
|
1549
|
+
mounted: false
|
|
1550
|
+
};
|
|
1551
|
+
|
|
1552
|
+
_this.onItemSelect = function (item) {
|
|
1553
|
+
var _this$props = _this.props,
|
|
1554
|
+
onItemSelect = _this$props.onItemSelect,
|
|
1555
|
+
selectedKeys = _this$props.selectedKeys;
|
|
1556
|
+
var checked = selectedKeys.indexOf(item.key) >= 0;
|
|
1557
|
+
onItemSelect(item.key, !checked);
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
return _this;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
_createClass$2(ListBody, [{
|
|
1564
|
+
key: "componentDidMount",
|
|
1565
|
+
value: function componentDidMount() {
|
|
1566
|
+
var _this2 = this;
|
|
1567
|
+
|
|
1568
|
+
this.mountId = wrapperRaf(function () {
|
|
1569
|
+
_this2.setState({
|
|
1570
|
+
mounted: true
|
|
1571
|
+
});
|
|
1572
|
+
});
|
|
1573
|
+
}
|
|
1574
|
+
}, {
|
|
1575
|
+
key: "componentDidUpdate",
|
|
1576
|
+
value: function componentDidUpdate(prevProps) {
|
|
1577
|
+
var _this$props2 = this.props,
|
|
1578
|
+
filteredRenderItems = _this$props2.filteredRenderItems,
|
|
1579
|
+
lazy = _this$props2.lazy;
|
|
1580
|
+
|
|
1581
|
+
if (prevProps.filteredRenderItems.length !== filteredRenderItems.length && lazy !== false) {
|
|
1582
|
+
// TODO: Replace this with ref when react 15 support removed.
|
|
1583
|
+
var container = findDOMNode(this);
|
|
1584
|
+
wrapperRaf.cancel(this.lazyId);
|
|
1585
|
+
this.lazyId = wrapperRaf(function () {
|
|
1586
|
+
if (container) {
|
|
1587
|
+
var scrollEvent = new Event('scroll', {
|
|
1588
|
+
bubbles: true
|
|
1589
|
+
});
|
|
1590
|
+
container.dispatchEvent(scrollEvent);
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}, {
|
|
1596
|
+
key: "componentWillUnmount",
|
|
1597
|
+
value: function componentWillUnmount() {
|
|
1598
|
+
wrapperRaf.cancel(this.mountId);
|
|
1599
|
+
wrapperRaf.cancel(this.lazyId);
|
|
1600
|
+
}
|
|
1601
|
+
}, {
|
|
1602
|
+
key: "render",
|
|
1603
|
+
value: function render() {
|
|
1604
|
+
var _this3 = this;
|
|
1605
|
+
|
|
1606
|
+
var mounted = this.state.mounted;
|
|
1607
|
+
var _this$props3 = this.props,
|
|
1608
|
+
prefixCls = _this$props3.prefixCls,
|
|
1609
|
+
onScroll = _this$props3.onScroll,
|
|
1610
|
+
filteredRenderItems = _this$props3.filteredRenderItems,
|
|
1611
|
+
lazy = _this$props3.lazy,
|
|
1612
|
+
selectedKeys = _this$props3.selectedKeys,
|
|
1613
|
+
globalDisabled = _this$props3.disabled;
|
|
1614
|
+
return /*#__PURE__*/React.createElement(Animate, {
|
|
1615
|
+
component: "ul",
|
|
1616
|
+
componentProps: {
|
|
1617
|
+
onScroll: onScroll
|
|
1618
|
+
},
|
|
1619
|
+
className: "".concat(prefixCls, "-content"),
|
|
1620
|
+
transitionName: mounted ? "".concat(prefixCls, "-content-item-highlight") : '',
|
|
1621
|
+
transitionLeave: false
|
|
1622
|
+
}, filteredRenderItems.map(function (_ref) {
|
|
1623
|
+
var renderedEl = _ref.renderedEl,
|
|
1624
|
+
renderedText = _ref.renderedText,
|
|
1625
|
+
item = _ref.item;
|
|
1626
|
+
var disabled = item.disabled;
|
|
1627
|
+
var checked = selectedKeys.indexOf(item.key) >= 0;
|
|
1628
|
+
return /*#__PURE__*/React.createElement(ListItem, {
|
|
1629
|
+
disabled: globalDisabled || disabled,
|
|
1630
|
+
key: item.key,
|
|
1631
|
+
item: item,
|
|
1632
|
+
lazy: lazy,
|
|
1633
|
+
renderedText: renderedText,
|
|
1634
|
+
renderedEl: renderedEl,
|
|
1635
|
+
checked: checked,
|
|
1636
|
+
prefixCls: prefixCls,
|
|
1637
|
+
onClick: _this3.onItemSelect
|
|
1638
|
+
});
|
|
1639
|
+
}));
|
|
1640
|
+
}
|
|
1641
|
+
}]);
|
|
1642
|
+
|
|
1643
|
+
return ListBody;
|
|
1644
|
+
}(React.Component);
|
|
1645
|
+
|
|
1646
|
+
var ListBodyWrapper = function ListBodyWrapper(props) {
|
|
1647
|
+
return /*#__PURE__*/React.createElement(ListBody, props);
|
|
1648
|
+
};
|
|
1649
|
+
|
|
1650
|
+
function triggerEvent(el, type) {
|
|
1651
|
+
if ('createEvent' in document) {
|
|
1652
|
+
// modern browsers, IE9+
|
|
1653
|
+
var e = document.createEvent('HTMLEvents');
|
|
1654
|
+
e.initEvent(type, false, true);
|
|
1655
|
+
el.dispatchEvent(e);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function _typeof(obj) { return typeof obj; }; } else { _typeof$1 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof$1(obj); }
|
|
1660
|
+
|
|
1661
|
+
function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
1662
|
+
|
|
1663
|
+
function _extends$1() { _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
|
|
1664
|
+
|
|
1665
|
+
function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
1666
|
+
|
|
1667
|
+
function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
1668
|
+
|
|
1669
|
+
function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); return Constructor; }
|
|
1670
|
+
|
|
1671
|
+
function _inherits$1(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf$1(subClass, superClass); }
|
|
1672
|
+
|
|
1673
|
+
function _setPrototypeOf$1(o, p) { _setPrototypeOf$1 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf$1(o, p); }
|
|
1674
|
+
|
|
1675
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf$1(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf$1(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn$1(this, result); }; }
|
|
1676
|
+
|
|
1677
|
+
function _possibleConstructorReturn$1(self, call) { if (call && (_typeof$1(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized$1(self); }
|
|
1678
|
+
|
|
1679
|
+
function _assertThisInitialized$1(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
1680
|
+
|
|
1681
|
+
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
1682
|
+
|
|
1683
|
+
function _getPrototypeOf$1(o) { _getPrototypeOf$1 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf$1(o); }
|
|
1684
|
+
|
|
1685
|
+
var defaultRender = function defaultRender() {
|
|
1686
|
+
return null;
|
|
1687
|
+
};
|
|
1688
|
+
|
|
1689
|
+
function isRenderResultPlainObject(result) {
|
|
1690
|
+
return result && ! /*#__PURE__*/React.isValidElement(result) && Object.prototype.toString.call(result) === '[object Object]';
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
function renderListNode(renderList, props) {
|
|
1694
|
+
var bodyContent = renderList ? renderList(props) : null;
|
|
1695
|
+
var customize = !!bodyContent;
|
|
1696
|
+
|
|
1697
|
+
if (!customize) {
|
|
1698
|
+
bodyContent = ListBodyWrapper(props);
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
return {
|
|
1702
|
+
customize: customize,
|
|
1703
|
+
bodyContent: bodyContent
|
|
1704
|
+
};
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
var TransferList = /*#__PURE__*/function (_React$Component) {
|
|
1708
|
+
_inherits$1(TransferList, _React$Component);
|
|
1709
|
+
|
|
1710
|
+
var _super = _createSuper$1(TransferList);
|
|
1711
|
+
|
|
1712
|
+
function TransferList(props) {
|
|
1713
|
+
var _this;
|
|
1714
|
+
|
|
1715
|
+
_classCallCheck$1(this, TransferList);
|
|
1716
|
+
|
|
1717
|
+
_this = _super.call(this, props);
|
|
1718
|
+
|
|
1719
|
+
_this.handleFilter = function (e) {
|
|
1720
|
+
var handleFilter = _this.props.handleFilter;
|
|
1721
|
+
var filterValue = e.target.value;
|
|
1722
|
+
|
|
1723
|
+
_this.setState({
|
|
1724
|
+
filterValue: filterValue
|
|
1725
|
+
});
|
|
1726
|
+
|
|
1727
|
+
handleFilter(e);
|
|
1728
|
+
|
|
1729
|
+
if (!filterValue) {
|
|
1730
|
+
return;
|
|
1731
|
+
} // Manually trigger scroll event for lazy search bug
|
|
1732
|
+
// https://github.com/ant-design/ant-design/issues/5631
|
|
1733
|
+
|
|
1734
|
+
|
|
1735
|
+
_this.triggerScrollTimer = window.setTimeout(function () {
|
|
1736
|
+
var transferNode = ReactDOM.findDOMNode(_assertThisInitialized$1(_this));
|
|
1737
|
+
var listNode = transferNode.querySelectorAll('.ant-transfer-list-content')[0];
|
|
1738
|
+
|
|
1739
|
+
if (listNode) {
|
|
1740
|
+
triggerEvent(listNode, 'scroll');
|
|
1741
|
+
}
|
|
1742
|
+
}, 0);
|
|
1743
|
+
};
|
|
1744
|
+
|
|
1745
|
+
_this.handleClear = function () {
|
|
1746
|
+
var handleClear = _this.props.handleClear;
|
|
1747
|
+
|
|
1748
|
+
_this.setState({
|
|
1749
|
+
filterValue: ''
|
|
1750
|
+
});
|
|
1751
|
+
|
|
1752
|
+
handleClear();
|
|
1753
|
+
};
|
|
1754
|
+
|
|
1755
|
+
_this.matchFilter = function (text, item) {
|
|
1756
|
+
var filterValue = _this.state.filterValue;
|
|
1757
|
+
var filterOption = _this.props.filterOption;
|
|
1758
|
+
|
|
1759
|
+
if (filterOption) {
|
|
1760
|
+
return filterOption(filterValue, item);
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1763
|
+
return text.indexOf(filterValue) >= 0;
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
_this.renderItem = function (item) {
|
|
1767
|
+
var _this$props$render = _this.props.render,
|
|
1768
|
+
render = _this$props$render === void 0 ? defaultRender : _this$props$render;
|
|
1769
|
+
var renderResult = render(item);
|
|
1770
|
+
var isRenderResultPlain = isRenderResultPlainObject(renderResult);
|
|
1771
|
+
return {
|
|
1772
|
+
renderedText: isRenderResultPlain ? renderResult.value : renderResult,
|
|
1773
|
+
renderedEl: isRenderResultPlain ? renderResult.label : renderResult,
|
|
1774
|
+
item: item
|
|
1775
|
+
};
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
_this.state = {
|
|
1779
|
+
filterValue: ''
|
|
1780
|
+
};
|
|
1781
|
+
return _this;
|
|
1782
|
+
}
|
|
1783
|
+
|
|
1784
|
+
_createClass$1(TransferList, [{
|
|
1785
|
+
key: "shouldComponentUpdate",
|
|
1786
|
+
value: function shouldComponentUpdate() {
|
|
1787
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1788
|
+
args[_key] = arguments[_key];
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
return PureRenderMixin.shouldComponentUpdate.apply(this, args);
|
|
1792
|
+
}
|
|
1793
|
+
}, {
|
|
1794
|
+
key: "componentWillUnmount",
|
|
1795
|
+
value: function componentWillUnmount() {
|
|
1796
|
+
clearTimeout(this.triggerScrollTimer);
|
|
1797
|
+
}
|
|
1798
|
+
}, {
|
|
1799
|
+
key: "getCheckStatus",
|
|
1800
|
+
value: function getCheckStatus(filteredItems) {
|
|
1801
|
+
var checkedKeys = this.props.checkedKeys;
|
|
1802
|
+
|
|
1803
|
+
if (checkedKeys.length === 0) {
|
|
1804
|
+
return 'none';
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
if (filteredItems.every(function (item) {
|
|
1808
|
+
return checkedKeys.indexOf(item.key) >= 0 || !!item.disabled;
|
|
1809
|
+
})) {
|
|
1810
|
+
return 'all';
|
|
1811
|
+
}
|
|
1812
|
+
|
|
1813
|
+
return 'part';
|
|
1814
|
+
}
|
|
1815
|
+
}, {
|
|
1816
|
+
key: "getFilteredItems",
|
|
1817
|
+
value: function getFilteredItems(dataSource, filterValue) {
|
|
1818
|
+
var _this2 = this;
|
|
1819
|
+
|
|
1820
|
+
var filteredItems = [];
|
|
1821
|
+
var filteredRenderItems = [];
|
|
1822
|
+
dataSource.forEach(function (item) {
|
|
1823
|
+
var renderedItem = _this2.renderItem(item);
|
|
1824
|
+
|
|
1825
|
+
var renderedText = renderedItem.renderedText; // Filter skip
|
|
1826
|
+
|
|
1827
|
+
if (filterValue && filterValue.trim() && !_this2.matchFilter(renderedText, item)) {
|
|
1828
|
+
return null;
|
|
1829
|
+
}
|
|
1830
|
+
|
|
1831
|
+
filteredItems.push(item);
|
|
1832
|
+
filteredRenderItems.push(renderedItem);
|
|
1833
|
+
});
|
|
1834
|
+
return {
|
|
1835
|
+
filteredItems: filteredItems,
|
|
1836
|
+
filteredRenderItems: filteredRenderItems
|
|
1837
|
+
};
|
|
1838
|
+
}
|
|
1839
|
+
}, {
|
|
1840
|
+
key: "getListBody",
|
|
1841
|
+
value: function getListBody(prefixCls, searchPlaceholder, filterValue, filteredItems, notFoundContent, bodyDom, filteredRenderItems, checkedKeys, renderList, showSearch, disabled) {
|
|
1842
|
+
var search = showSearch ? /*#__PURE__*/React.createElement("div", {
|
|
1843
|
+
className: "".concat(prefixCls, "-body-search-wrapper")
|
|
1844
|
+
}, /*#__PURE__*/React.createElement(Search, {
|
|
1845
|
+
prefixCls: "".concat(prefixCls, "-search"),
|
|
1846
|
+
onChange: this.handleFilter,
|
|
1847
|
+
handleClear: this.handleClear,
|
|
1848
|
+
placeholder: searchPlaceholder,
|
|
1849
|
+
value: filterValue,
|
|
1850
|
+
disabled: disabled
|
|
1851
|
+
})) : null;
|
|
1852
|
+
var listBody = bodyDom;
|
|
1853
|
+
|
|
1854
|
+
if (!listBody) {
|
|
1855
|
+
var bodyNode;
|
|
1856
|
+
|
|
1857
|
+
var _renderListNode = renderListNode(renderList, _extends$1(_extends$1({}, omit(this.props, OmitProps)), {
|
|
1858
|
+
filteredItems: filteredItems,
|
|
1859
|
+
filteredRenderItems: filteredRenderItems,
|
|
1860
|
+
selectedKeys: checkedKeys
|
|
1861
|
+
})),
|
|
1862
|
+
bodyContent = _renderListNode.bodyContent,
|
|
1863
|
+
customize = _renderListNode.customize; // We should wrap customize list body in a classNamed div to use flex layout.
|
|
1864
|
+
|
|
1865
|
+
|
|
1866
|
+
if (customize) {
|
|
1867
|
+
bodyNode = /*#__PURE__*/React.createElement("div", {
|
|
1868
|
+
className: "".concat(prefixCls, "-body-customize-wrapper")
|
|
1869
|
+
}, bodyContent);
|
|
1870
|
+
} else {
|
|
1871
|
+
bodyNode = filteredItems.length ? bodyContent : /*#__PURE__*/React.createElement("div", {
|
|
1872
|
+
className: "".concat(prefixCls, "-body-not-found")
|
|
1873
|
+
}, notFoundContent);
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1876
|
+
listBody = /*#__PURE__*/React.createElement("div", {
|
|
1877
|
+
className: classNames(showSearch ? "".concat(prefixCls, "-body ").concat(prefixCls, "-body-with-search") : "".concat(prefixCls, "-body"))
|
|
1878
|
+
}, search, bodyNode);
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1881
|
+
return listBody;
|
|
1882
|
+
}
|
|
1883
|
+
}, {
|
|
1884
|
+
key: "getCheckBox",
|
|
1885
|
+
value: function getCheckBox(filteredItems, onItemSelectAll, showSelectAll, disabled) {
|
|
1886
|
+
var checkStatus = this.getCheckStatus(filteredItems);
|
|
1887
|
+
var checkedAll = checkStatus === 'all';
|
|
1888
|
+
var checkAllCheckbox = showSelectAll !== false && /*#__PURE__*/React.createElement(Checkbox, {
|
|
1889
|
+
disabled: disabled,
|
|
1890
|
+
checked: checkedAll,
|
|
1891
|
+
indeterminate: checkStatus === 'part',
|
|
1892
|
+
onChange: function onChange() {
|
|
1893
|
+
// Only select enabled items
|
|
1894
|
+
onItemSelectAll(filteredItems.filter(function (item) {
|
|
1895
|
+
return !item.disabled;
|
|
1896
|
+
}).map(function (_ref) {
|
|
1897
|
+
var key = _ref.key;
|
|
1898
|
+
return key;
|
|
1899
|
+
}), !checkedAll);
|
|
1900
|
+
}
|
|
1901
|
+
});
|
|
1902
|
+
return checkAllCheckbox;
|
|
1903
|
+
}
|
|
1904
|
+
}, {
|
|
1905
|
+
key: "render",
|
|
1906
|
+
value: function render() {
|
|
1907
|
+
var filterValue = this.state.filterValue;
|
|
1908
|
+
var _this$props = this.props,
|
|
1909
|
+
prefixCls = _this$props.prefixCls,
|
|
1910
|
+
dataSource = _this$props.dataSource,
|
|
1911
|
+
titleText = _this$props.titleText,
|
|
1912
|
+
checkedKeys = _this$props.checkedKeys,
|
|
1913
|
+
disabled = _this$props.disabled,
|
|
1914
|
+
body = _this$props.body,
|
|
1915
|
+
footer = _this$props.footer,
|
|
1916
|
+
showSearch = _this$props.showSearch,
|
|
1917
|
+
style = _this$props.style,
|
|
1918
|
+
searchPlaceholder = _this$props.searchPlaceholder,
|
|
1919
|
+
notFoundContent = _this$props.notFoundContent,
|
|
1920
|
+
itemUnit = _this$props.itemUnit,
|
|
1921
|
+
itemsUnit = _this$props.itemsUnit,
|
|
1922
|
+
renderList = _this$props.renderList,
|
|
1923
|
+
onItemSelectAll = _this$props.onItemSelectAll,
|
|
1924
|
+
showSelectAll = _this$props.showSelectAll; // Custom Layout
|
|
1925
|
+
|
|
1926
|
+
var footerDom = footer && footer(this.props);
|
|
1927
|
+
var bodyDom = body && body(this.props);
|
|
1928
|
+
var listCls = classNames(prefixCls, _defineProperty$1({}, "".concat(prefixCls, "-with-footer"), !!footerDom)); // ====================== Get filtered, checked item list ======================
|
|
1929
|
+
|
|
1930
|
+
var _this$getFilteredItem = this.getFilteredItems(dataSource, filterValue),
|
|
1931
|
+
filteredItems = _this$getFilteredItem.filteredItems,
|
|
1932
|
+
filteredRenderItems = _this$getFilteredItem.filteredRenderItems; // ================================= List Body =================================
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
var unit = dataSource.length > 1 ? itemsUnit : itemUnit;
|
|
1936
|
+
var listBody = this.getListBody(prefixCls, searchPlaceholder, filterValue, filteredItems, notFoundContent, bodyDom, filteredRenderItems, checkedKeys, renderList, showSearch, disabled); // ================================ List Footer ================================
|
|
1937
|
+
|
|
1938
|
+
var listFooter = footerDom ? /*#__PURE__*/React.createElement("div", {
|
|
1939
|
+
className: "".concat(prefixCls, "-footer")
|
|
1940
|
+
}, footerDom) : null;
|
|
1941
|
+
var checkAllCheckbox = this.getCheckBox(filteredItems, onItemSelectAll, showSelectAll, disabled); // ================================== Render ===================================
|
|
1942
|
+
|
|
1943
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1944
|
+
className: listCls,
|
|
1945
|
+
style: style
|
|
1946
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
1947
|
+
className: "".concat(prefixCls, "-header")
|
|
1948
|
+
}, checkAllCheckbox, /*#__PURE__*/React.createElement("span", {
|
|
1949
|
+
className: "".concat(prefixCls, "-header-selected")
|
|
1950
|
+
}, /*#__PURE__*/React.createElement("span", null, (checkedKeys.length > 0 ? "".concat(checkedKeys.length, "/") : '') + filteredItems.length, ' ', unit), /*#__PURE__*/React.createElement("span", {
|
|
1951
|
+
className: "".concat(prefixCls, "-header-title")
|
|
1952
|
+
}, titleText))), listBody, listFooter);
|
|
1953
|
+
}
|
|
1954
|
+
}]);
|
|
1955
|
+
|
|
1956
|
+
return TransferList;
|
|
1957
|
+
}(React.Component);
|
|
1958
|
+
TransferList.defaultProps = {
|
|
1959
|
+
dataSource: [],
|
|
1960
|
+
titleText: '',
|
|
1961
|
+
showSearch: false,
|
|
1962
|
+
lazy: {}
|
|
1963
|
+
};
|
|
1964
|
+
|
|
1965
|
+
var Operation = function Operation(_ref) {
|
|
1966
|
+
var disabled = _ref.disabled,
|
|
1967
|
+
moveToLeft = _ref.moveToLeft,
|
|
1968
|
+
moveToRight = _ref.moveToRight,
|
|
1969
|
+
_ref$leftArrowText = _ref.leftArrowText,
|
|
1970
|
+
leftArrowText = _ref$leftArrowText === void 0 ? '' : _ref$leftArrowText,
|
|
1971
|
+
_ref$rightArrowText = _ref.rightArrowText,
|
|
1972
|
+
rightArrowText = _ref$rightArrowText === void 0 ? '' : _ref$rightArrowText,
|
|
1973
|
+
leftActive = _ref.leftActive,
|
|
1974
|
+
rightActive = _ref.rightActive,
|
|
1975
|
+
className = _ref.className,
|
|
1976
|
+
style = _ref.style;
|
|
1977
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
1978
|
+
className: className,
|
|
1979
|
+
style: style
|
|
1980
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
1981
|
+
type: "primary",
|
|
1982
|
+
size: "small",
|
|
1983
|
+
disabled: disabled || !rightActive,
|
|
1984
|
+
onClick: moveToRight,
|
|
1985
|
+
icon: "right"
|
|
1986
|
+
}, rightArrowText), /*#__PURE__*/React.createElement(Button, {
|
|
1987
|
+
type: "primary",
|
|
1988
|
+
size: "small",
|
|
1989
|
+
disabled: disabled || !leftActive,
|
|
1990
|
+
onClick: moveToLeft,
|
|
1991
|
+
icon: "left"
|
|
1992
|
+
}, leftArrowText));
|
|
1993
|
+
};
|
|
1994
|
+
|
|
1995
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
1996
|
+
|
|
1997
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
1998
|
+
|
|
1999
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
2000
|
+
|
|
2001
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
2002
|
+
|
|
2003
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
2004
|
+
|
|
2005
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
2006
|
+
|
|
2007
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
2008
|
+
|
|
2009
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2010
|
+
|
|
2011
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
2012
|
+
|
|
2013
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2014
|
+
|
|
2015
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
2016
|
+
|
|
2017
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
2018
|
+
|
|
2019
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
2020
|
+
|
|
2021
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
2022
|
+
|
|
2023
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
2024
|
+
|
|
2025
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
2026
|
+
|
|
2027
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
2028
|
+
|
|
2029
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
2030
|
+
|
|
2031
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
2032
|
+
|
|
2033
|
+
var Transfer = /*#__PURE__*/function (_React$Component) {
|
|
2034
|
+
_inherits(Transfer, _React$Component);
|
|
2035
|
+
|
|
2036
|
+
var _super = _createSuper(Transfer);
|
|
2037
|
+
|
|
2038
|
+
function Transfer(props) {
|
|
2039
|
+
var _this;
|
|
2040
|
+
|
|
2041
|
+
_classCallCheck(this, Transfer);
|
|
2042
|
+
|
|
2043
|
+
_this = _super.call(this, props);
|
|
2044
|
+
_this.separatedDataSource = null;
|
|
2045
|
+
|
|
2046
|
+
_this.getLocale = function (transferLocale, renderEmpty) {
|
|
2047
|
+
// Keep old locale props still working.
|
|
2048
|
+
var oldLocale = {
|
|
2049
|
+
notFoundContent: renderEmpty('Transfer')
|
|
2050
|
+
};
|
|
2051
|
+
|
|
2052
|
+
if ('notFoundContent' in _this.props) {
|
|
2053
|
+
oldLocale.notFoundContent = _this.props.notFoundContent;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
if ('searchPlaceholder' in _this.props) {
|
|
2057
|
+
oldLocale.searchPlaceholder = _this.props.searchPlaceholder;
|
|
2058
|
+
}
|
|
2059
|
+
|
|
2060
|
+
return _extends(_extends(_extends({}, transferLocale), oldLocale), _this.props.locale);
|
|
2061
|
+
};
|
|
2062
|
+
|
|
2063
|
+
_this.moveTo = function (direction) {
|
|
2064
|
+
var _this$props = _this.props,
|
|
2065
|
+
_this$props$targetKey = _this$props.targetKeys,
|
|
2066
|
+
targetKeys = _this$props$targetKey === void 0 ? [] : _this$props$targetKey,
|
|
2067
|
+
_this$props$dataSourc = _this$props.dataSource,
|
|
2068
|
+
dataSource = _this$props$dataSourc === void 0 ? [] : _this$props$dataSourc,
|
|
2069
|
+
onChange = _this$props.onChange;
|
|
2070
|
+
var _this$state = _this.state,
|
|
2071
|
+
sourceSelectedKeys = _this$state.sourceSelectedKeys,
|
|
2072
|
+
targetSelectedKeys = _this$state.targetSelectedKeys;
|
|
2073
|
+
var moveKeys = direction === 'right' ? sourceSelectedKeys : targetSelectedKeys; // filter the disabled options
|
|
2074
|
+
|
|
2075
|
+
var newMoveKeys = moveKeys.filter(function (key) {
|
|
2076
|
+
return !dataSource.some(function (data) {
|
|
2077
|
+
return !!(key === data.key && data.disabled);
|
|
2078
|
+
});
|
|
2079
|
+
}); // move items to target box
|
|
2080
|
+
|
|
2081
|
+
var newTargetKeys = direction === 'right' ? newMoveKeys.concat(targetKeys) : targetKeys.filter(function (targetKey) {
|
|
2082
|
+
return newMoveKeys.indexOf(targetKey) === -1;
|
|
2083
|
+
}); // empty checked keys
|
|
2084
|
+
|
|
2085
|
+
var oppositeDirection = direction === 'right' ? 'left' : 'right';
|
|
2086
|
+
|
|
2087
|
+
_this.setState(_defineProperty({}, _this.getSelectedKeysName(oppositeDirection), []));
|
|
2088
|
+
|
|
2089
|
+
_this.handleSelectChange(oppositeDirection, []);
|
|
2090
|
+
|
|
2091
|
+
if (onChange) {
|
|
2092
|
+
onChange(newTargetKeys, direction, newMoveKeys);
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
|
|
2096
|
+
_this.moveToLeft = function () {
|
|
2097
|
+
return _this.moveTo('left');
|
|
2098
|
+
};
|
|
2099
|
+
|
|
2100
|
+
_this.moveToRight = function () {
|
|
2101
|
+
return _this.moveTo('right');
|
|
2102
|
+
};
|
|
2103
|
+
|
|
2104
|
+
_this.onItemSelectAll = function (direction, selectedKeys, checkAll) {
|
|
2105
|
+
var originalSelectedKeys = _this.state[_this.getSelectedKeysName(direction)] || [];
|
|
2106
|
+
var mergedCheckedKeys = [];
|
|
2107
|
+
|
|
2108
|
+
if (checkAll) {
|
|
2109
|
+
// Merge current keys with origin key
|
|
2110
|
+
mergedCheckedKeys = Array.from(new Set([].concat(_toConsumableArray(originalSelectedKeys), _toConsumableArray(selectedKeys))));
|
|
2111
|
+
} else {
|
|
2112
|
+
// Remove current keys from origin keys
|
|
2113
|
+
mergedCheckedKeys = originalSelectedKeys.filter(function (key) {
|
|
2114
|
+
return selectedKeys.indexOf(key) === -1;
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
|
|
2118
|
+
_this.handleSelectChange(direction, mergedCheckedKeys);
|
|
2119
|
+
|
|
2120
|
+
if (!_this.props.selectedKeys) {
|
|
2121
|
+
_this.setState(_defineProperty({}, _this.getSelectedKeysName(direction), mergedCheckedKeys));
|
|
2122
|
+
}
|
|
2123
|
+
};
|
|
2124
|
+
|
|
2125
|
+
_this.handleSelectAll = function (direction, filteredDataSource, checkAll) {
|
|
2126
|
+
|
|
2127
|
+
_this.onItemSelectAll(direction, filteredDataSource.map(function (_ref) {
|
|
2128
|
+
var key = _ref.key;
|
|
2129
|
+
return key;
|
|
2130
|
+
}), !checkAll);
|
|
2131
|
+
}; // [Legacy] Old prop `body` pass origin check as arg. It's confusing.
|
|
2132
|
+
// TODO: Remove this in next version.
|
|
2133
|
+
|
|
2134
|
+
|
|
2135
|
+
_this.handleLeftSelectAll = function (filteredDataSource, checkAll) {
|
|
2136
|
+
return _this.handleSelectAll('left', filteredDataSource, !checkAll);
|
|
2137
|
+
};
|
|
2138
|
+
|
|
2139
|
+
_this.handleRightSelectAll = function (filteredDataSource, checkAll) {
|
|
2140
|
+
return _this.handleSelectAll('right', filteredDataSource, !checkAll);
|
|
2141
|
+
};
|
|
2142
|
+
|
|
2143
|
+
_this.onLeftItemSelectAll = function (selectedKeys, checkAll) {
|
|
2144
|
+
return _this.onItemSelectAll('left', selectedKeys, checkAll);
|
|
2145
|
+
};
|
|
2146
|
+
|
|
2147
|
+
_this.onRightItemSelectAll = function (selectedKeys, checkAll) {
|
|
2148
|
+
return _this.onItemSelectAll('right', selectedKeys, checkAll);
|
|
2149
|
+
};
|
|
2150
|
+
|
|
2151
|
+
_this.handleFilter = function (direction, e) {
|
|
2152
|
+
var _this$props2 = _this.props,
|
|
2153
|
+
onSearchChange = _this$props2.onSearchChange,
|
|
2154
|
+
onSearch = _this$props2.onSearch;
|
|
2155
|
+
var value = e.target.value;
|
|
2156
|
+
|
|
2157
|
+
if (onSearchChange) {
|
|
2158
|
+
onSearchChange(direction, e);
|
|
2159
|
+
}
|
|
2160
|
+
|
|
2161
|
+
if (onSearch) {
|
|
2162
|
+
onSearch(direction, value);
|
|
2163
|
+
}
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
_this.handleLeftFilter = function (e) {
|
|
2167
|
+
return _this.handleFilter('left', e);
|
|
2168
|
+
};
|
|
2169
|
+
|
|
2170
|
+
_this.handleRightFilter = function (e) {
|
|
2171
|
+
return _this.handleFilter('right', e);
|
|
2172
|
+
};
|
|
2173
|
+
|
|
2174
|
+
_this.handleClear = function (direction) {
|
|
2175
|
+
var onSearch = _this.props.onSearch;
|
|
2176
|
+
|
|
2177
|
+
if (onSearch) {
|
|
2178
|
+
onSearch(direction, '');
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
|
|
2182
|
+
_this.handleLeftClear = function () {
|
|
2183
|
+
return _this.handleClear('left');
|
|
2184
|
+
};
|
|
2185
|
+
|
|
2186
|
+
_this.handleRightClear = function () {
|
|
2187
|
+
return _this.handleClear('right');
|
|
2188
|
+
};
|
|
2189
|
+
|
|
2190
|
+
_this.onItemSelect = function (direction, selectedKey, checked) {
|
|
2191
|
+
var _this$state2 = _this.state,
|
|
2192
|
+
sourceSelectedKeys = _this$state2.sourceSelectedKeys,
|
|
2193
|
+
targetSelectedKeys = _this$state2.targetSelectedKeys;
|
|
2194
|
+
var holder = direction === 'left' ? _toConsumableArray(sourceSelectedKeys) : _toConsumableArray(targetSelectedKeys);
|
|
2195
|
+
var index = holder.indexOf(selectedKey);
|
|
2196
|
+
|
|
2197
|
+
if (index > -1) {
|
|
2198
|
+
holder.splice(index, 1);
|
|
2199
|
+
}
|
|
2200
|
+
|
|
2201
|
+
if (checked) {
|
|
2202
|
+
holder.push(selectedKey);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
_this.handleSelectChange(direction, holder);
|
|
2206
|
+
|
|
2207
|
+
if (!_this.props.selectedKeys) {
|
|
2208
|
+
_this.setState(_defineProperty({}, _this.getSelectedKeysName(direction), holder));
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
|
|
2212
|
+
_this.handleSelect = function (direction, selectedItem, checked) {
|
|
2213
|
+
|
|
2214
|
+
_this.onItemSelect(direction, selectedItem.key, checked);
|
|
2215
|
+
};
|
|
2216
|
+
|
|
2217
|
+
_this.handleLeftSelect = function (selectedItem, checked) {
|
|
2218
|
+
return _this.handleSelect('left', selectedItem, checked);
|
|
2219
|
+
};
|
|
2220
|
+
|
|
2221
|
+
_this.handleRightSelect = function (selectedItem, checked) {
|
|
2222
|
+
return _this.handleSelect('right', selectedItem, checked);
|
|
2223
|
+
};
|
|
2224
|
+
|
|
2225
|
+
_this.onLeftItemSelect = function (selectedKey, checked) {
|
|
2226
|
+
return _this.onItemSelect('left', selectedKey, checked);
|
|
2227
|
+
};
|
|
2228
|
+
|
|
2229
|
+
_this.onRightItemSelect = function (selectedKey, checked) {
|
|
2230
|
+
return _this.onItemSelect('right', selectedKey, checked);
|
|
2231
|
+
};
|
|
2232
|
+
|
|
2233
|
+
_this.handleScroll = function (direction, e) {
|
|
2234
|
+
var onScroll = _this.props.onScroll;
|
|
2235
|
+
|
|
2236
|
+
if (onScroll) {
|
|
2237
|
+
onScroll(direction, e);
|
|
2238
|
+
}
|
|
2239
|
+
};
|
|
2240
|
+
|
|
2241
|
+
_this.handleLeftScroll = function (e) {
|
|
2242
|
+
return _this.handleScroll('left', e);
|
|
2243
|
+
};
|
|
2244
|
+
|
|
2245
|
+
_this.handleRightScroll = function (e) {
|
|
2246
|
+
return _this.handleScroll('right', e);
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
_this.handleListStyle = function (listStyle, direction) {
|
|
2250
|
+
if (typeof listStyle === 'function') {
|
|
2251
|
+
return listStyle({
|
|
2252
|
+
direction: direction
|
|
2253
|
+
});
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
return listStyle;
|
|
2257
|
+
};
|
|
2258
|
+
|
|
2259
|
+
_this.renderTransfer = function (transferLocale) {
|
|
2260
|
+
return /*#__PURE__*/React.createElement(ConfigConsumer, null, function (_ref2) {
|
|
2261
|
+
var _classNames;
|
|
2262
|
+
|
|
2263
|
+
var getPrefixCls = _ref2.getPrefixCls,
|
|
2264
|
+
renderEmpty = _ref2.renderEmpty;
|
|
2265
|
+
var _this$props3 = _this.props,
|
|
2266
|
+
customizePrefixCls = _this$props3.prefixCls,
|
|
2267
|
+
className = _this$props3.className,
|
|
2268
|
+
disabled = _this$props3.disabled,
|
|
2269
|
+
_this$props3$operatio = _this$props3.operations,
|
|
2270
|
+
operations = _this$props3$operatio === void 0 ? [] : _this$props3$operatio,
|
|
2271
|
+
showSearch = _this$props3.showSearch,
|
|
2272
|
+
body = _this$props3.body,
|
|
2273
|
+
footer = _this$props3.footer,
|
|
2274
|
+
style = _this$props3.style,
|
|
2275
|
+
listStyle = _this$props3.listStyle,
|
|
2276
|
+
operationStyle = _this$props3.operationStyle,
|
|
2277
|
+
filterOption = _this$props3.filterOption,
|
|
2278
|
+
render = _this$props3.render,
|
|
2279
|
+
lazy = _this$props3.lazy,
|
|
2280
|
+
children = _this$props3.children,
|
|
2281
|
+
showSelectAll = _this$props3.showSelectAll;
|
|
2282
|
+
var prefixCls = getPrefixCls('transfer', customizePrefixCls);
|
|
2283
|
+
|
|
2284
|
+
var locale = _this.getLocale(transferLocale, renderEmpty);
|
|
2285
|
+
|
|
2286
|
+
var _this$state3 = _this.state,
|
|
2287
|
+
sourceSelectedKeys = _this$state3.sourceSelectedKeys,
|
|
2288
|
+
targetSelectedKeys = _this$state3.targetSelectedKeys;
|
|
2289
|
+
|
|
2290
|
+
var _this$separateDataSou = _this.separateDataSource(),
|
|
2291
|
+
leftDataSource = _this$separateDataSou.leftDataSource,
|
|
2292
|
+
rightDataSource = _this$separateDataSou.rightDataSource;
|
|
2293
|
+
|
|
2294
|
+
var leftActive = targetSelectedKeys.length > 0;
|
|
2295
|
+
var rightActive = sourceSelectedKeys.length > 0;
|
|
2296
|
+
var cls = classNames(className, prefixCls, (_classNames = {}, _defineProperty(_classNames, "".concat(prefixCls, "-disabled"), disabled), _defineProperty(_classNames, "".concat(prefixCls, "-customize-list"), !!children), _classNames));
|
|
2297
|
+
|
|
2298
|
+
var titles = _this.getTitles(locale);
|
|
2299
|
+
|
|
2300
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
2301
|
+
className: cls,
|
|
2302
|
+
style: style
|
|
2303
|
+
}, /*#__PURE__*/React.createElement(TransferList, _extends({
|
|
2304
|
+
prefixCls: "".concat(prefixCls, "-list"),
|
|
2305
|
+
titleText: titles[0],
|
|
2306
|
+
dataSource: leftDataSource,
|
|
2307
|
+
filterOption: filterOption,
|
|
2308
|
+
style: _this.handleListStyle(listStyle, 'left'),
|
|
2309
|
+
checkedKeys: sourceSelectedKeys,
|
|
2310
|
+
handleFilter: _this.handleLeftFilter,
|
|
2311
|
+
handleClear: _this.handleLeftClear,
|
|
2312
|
+
handleSelect: _this.handleLeftSelect,
|
|
2313
|
+
handleSelectAll: _this.handleLeftSelectAll,
|
|
2314
|
+
onItemSelect: _this.onLeftItemSelect,
|
|
2315
|
+
onItemSelectAll: _this.onLeftItemSelectAll,
|
|
2316
|
+
render: render,
|
|
2317
|
+
showSearch: showSearch,
|
|
2318
|
+
body: body,
|
|
2319
|
+
renderList: children,
|
|
2320
|
+
footer: footer,
|
|
2321
|
+
lazy: lazy,
|
|
2322
|
+
onScroll: _this.handleLeftScroll,
|
|
2323
|
+
disabled: disabled,
|
|
2324
|
+
direction: "left",
|
|
2325
|
+
showSelectAll: showSelectAll
|
|
2326
|
+
}, locale)), /*#__PURE__*/React.createElement(Operation, {
|
|
2327
|
+
className: "".concat(prefixCls, "-operation"),
|
|
2328
|
+
rightActive: rightActive,
|
|
2329
|
+
rightArrowText: operations[0],
|
|
2330
|
+
moveToRight: _this.moveToRight,
|
|
2331
|
+
leftActive: leftActive,
|
|
2332
|
+
leftArrowText: operations[1],
|
|
2333
|
+
moveToLeft: _this.moveToLeft,
|
|
2334
|
+
style: operationStyle,
|
|
2335
|
+
disabled: disabled
|
|
2336
|
+
}), /*#__PURE__*/React.createElement(TransferList, _extends({
|
|
2337
|
+
prefixCls: "".concat(prefixCls, "-list"),
|
|
2338
|
+
titleText: titles[1],
|
|
2339
|
+
dataSource: rightDataSource,
|
|
2340
|
+
filterOption: filterOption,
|
|
2341
|
+
style: _this.handleListStyle(listStyle, 'right'),
|
|
2342
|
+
checkedKeys: targetSelectedKeys,
|
|
2343
|
+
handleFilter: _this.handleRightFilter,
|
|
2344
|
+
handleClear: _this.handleRightClear,
|
|
2345
|
+
handleSelect: _this.handleRightSelect,
|
|
2346
|
+
handleSelectAll: _this.handleRightSelectAll,
|
|
2347
|
+
onItemSelect: _this.onRightItemSelect,
|
|
2348
|
+
onItemSelectAll: _this.onRightItemSelectAll,
|
|
2349
|
+
render: render,
|
|
2350
|
+
showSearch: showSearch,
|
|
2351
|
+
body: body,
|
|
2352
|
+
renderList: children,
|
|
2353
|
+
footer: footer,
|
|
2354
|
+
lazy: lazy,
|
|
2355
|
+
onScroll: _this.handleRightScroll,
|
|
2356
|
+
disabled: disabled,
|
|
2357
|
+
direction: "right",
|
|
2358
|
+
showSelectAll: showSelectAll
|
|
2359
|
+
}, locale)));
|
|
2360
|
+
});
|
|
2361
|
+
};
|
|
2362
|
+
var _props$selectedKeys = props.selectedKeys,
|
|
2363
|
+
selectedKeys = _props$selectedKeys === void 0 ? [] : _props$selectedKeys,
|
|
2364
|
+
_props$targetKeys = props.targetKeys,
|
|
2365
|
+
targetKeys = _props$targetKeys === void 0 ? [] : _props$targetKeys;
|
|
2366
|
+
_this.state = {
|
|
2367
|
+
sourceSelectedKeys: selectedKeys.filter(function (key) {
|
|
2368
|
+
return targetKeys.indexOf(key) === -1;
|
|
2369
|
+
}),
|
|
2370
|
+
targetSelectedKeys: selectedKeys.filter(function (key) {
|
|
2371
|
+
return targetKeys.indexOf(key) > -1;
|
|
2372
|
+
})
|
|
2373
|
+
};
|
|
2374
|
+
return _this;
|
|
2375
|
+
}
|
|
2376
|
+
|
|
2377
|
+
_createClass(Transfer, [{
|
|
2378
|
+
key: "getSelectedKeysName",
|
|
2379
|
+
// eslint-disable-next-line
|
|
2380
|
+
value: function getSelectedKeysName(direction) {
|
|
2381
|
+
return direction === 'left' ? 'sourceSelectedKeys' : 'targetSelectedKeys';
|
|
2382
|
+
}
|
|
2383
|
+
}, {
|
|
2384
|
+
key: "getTitles",
|
|
2385
|
+
value: function getTitles(transferLocale) {
|
|
2386
|
+
var props = this.props;
|
|
2387
|
+
|
|
2388
|
+
if (props.titles) {
|
|
2389
|
+
return props.titles;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
return transferLocale.titles;
|
|
2393
|
+
}
|
|
2394
|
+
}, {
|
|
2395
|
+
key: "handleSelectChange",
|
|
2396
|
+
value: function handleSelectChange(direction, holder) {
|
|
2397
|
+
var _this$state4 = this.state,
|
|
2398
|
+
sourceSelectedKeys = _this$state4.sourceSelectedKeys,
|
|
2399
|
+
targetSelectedKeys = _this$state4.targetSelectedKeys;
|
|
2400
|
+
var onSelectChange = this.props.onSelectChange;
|
|
2401
|
+
|
|
2402
|
+
if (!onSelectChange) {
|
|
2403
|
+
return;
|
|
2404
|
+
}
|
|
2405
|
+
|
|
2406
|
+
if (direction === 'left') {
|
|
2407
|
+
onSelectChange(holder, targetSelectedKeys);
|
|
2408
|
+
} else {
|
|
2409
|
+
onSelectChange(sourceSelectedKeys, holder);
|
|
2410
|
+
}
|
|
2411
|
+
}
|
|
2412
|
+
}, {
|
|
2413
|
+
key: "separateDataSource",
|
|
2414
|
+
value: function separateDataSource() {
|
|
2415
|
+
var _this$props4 = this.props,
|
|
2416
|
+
dataSource = _this$props4.dataSource,
|
|
2417
|
+
rowKey = _this$props4.rowKey,
|
|
2418
|
+
_this$props4$targetKe = _this$props4.targetKeys,
|
|
2419
|
+
targetKeys = _this$props4$targetKe === void 0 ? [] : _this$props4$targetKe;
|
|
2420
|
+
var leftDataSource = [];
|
|
2421
|
+
var rightDataSource = new Array(targetKeys.length);
|
|
2422
|
+
dataSource.forEach(function (record) {
|
|
2423
|
+
if (rowKey) {
|
|
2424
|
+
record.key = rowKey(record);
|
|
2425
|
+
} // rightDataSource should be ordered by targetKeys
|
|
2426
|
+
// leftDataSource should be ordered by dataSource
|
|
2427
|
+
|
|
2428
|
+
|
|
2429
|
+
var indexOfKey = targetKeys.indexOf(record.key);
|
|
2430
|
+
|
|
2431
|
+
if (indexOfKey !== -1) {
|
|
2432
|
+
rightDataSource[indexOfKey] = record;
|
|
2433
|
+
} else {
|
|
2434
|
+
leftDataSource.push(record);
|
|
2435
|
+
}
|
|
2436
|
+
});
|
|
2437
|
+
return {
|
|
2438
|
+
leftDataSource: leftDataSource,
|
|
2439
|
+
rightDataSource: rightDataSource
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
}, {
|
|
2443
|
+
key: "render",
|
|
2444
|
+
value: function render() {
|
|
2445
|
+
return /*#__PURE__*/React.createElement(LocaleReceiver, {
|
|
2446
|
+
componentName: "Transfer",
|
|
2447
|
+
defaultLocale: defaultLocale.Transfer
|
|
2448
|
+
}, this.renderTransfer);
|
|
2449
|
+
}
|
|
2450
|
+
}], [{
|
|
2451
|
+
key: "getDerivedStateFromProps",
|
|
2452
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
2453
|
+
if (nextProps.selectedKeys) {
|
|
2454
|
+
var targetKeys = nextProps.targetKeys || [];
|
|
2455
|
+
return {
|
|
2456
|
+
sourceSelectedKeys: nextProps.selectedKeys.filter(function (key) {
|
|
2457
|
+
return !targetKeys.includes(key);
|
|
2458
|
+
}),
|
|
2459
|
+
targetSelectedKeys: nextProps.selectedKeys.filter(function (key) {
|
|
2460
|
+
return targetKeys.includes(key);
|
|
2461
|
+
})
|
|
2462
|
+
};
|
|
2463
|
+
}
|
|
2464
|
+
|
|
2465
|
+
return null;
|
|
2466
|
+
}
|
|
2467
|
+
}]);
|
|
2468
|
+
|
|
2469
|
+
return Transfer;
|
|
2470
|
+
}(React.Component); // For high-level customized Transfer @dqaria
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
Transfer.List = TransferList;
|
|
2474
|
+
Transfer.Operation = Operation;
|
|
2475
|
+
Transfer.Search = Search;
|
|
2476
|
+
Transfer.defaultProps = {
|
|
2477
|
+
dataSource: [],
|
|
2478
|
+
locale: {},
|
|
2479
|
+
showSearch: false,
|
|
2480
|
+
listStyle: function listStyle() {}
|
|
2481
|
+
};
|
|
2482
|
+
Transfer.propTypes = {
|
|
2483
|
+
prefixCls: propTypesExports.string,
|
|
2484
|
+
disabled: propTypesExports.bool,
|
|
2485
|
+
dataSource: propTypesExports.array,
|
|
2486
|
+
render: propTypesExports.func,
|
|
2487
|
+
targetKeys: propTypesExports.array,
|
|
2488
|
+
onChange: propTypesExports.func,
|
|
2489
|
+
height: propTypesExports.number,
|
|
2490
|
+
style: propTypesExports.object,
|
|
2491
|
+
listStyle: propTypesExports.oneOfType([propTypesExports.func, propTypesExports.object]),
|
|
2492
|
+
operationStyle: propTypesExports.object,
|
|
2493
|
+
className: propTypesExports.string,
|
|
2494
|
+
titles: propTypesExports.array,
|
|
2495
|
+
operations: propTypesExports.array,
|
|
2496
|
+
showSearch: propTypesExports.bool,
|
|
2497
|
+
filterOption: propTypesExports.func,
|
|
2498
|
+
searchPlaceholder: propTypesExports.string,
|
|
2499
|
+
notFoundContent: propTypesExports.node,
|
|
2500
|
+
locale: propTypesExports.object,
|
|
2501
|
+
body: propTypesExports.func,
|
|
2502
|
+
footer: propTypesExports.func,
|
|
2503
|
+
rowKey: propTypesExports.func,
|
|
2504
|
+
lazy: propTypesExports.oneOfType([propTypesExports.object, propTypesExports.bool])
|
|
2505
|
+
};
|
|
2506
|
+
polyfill(Transfer);
|
|
2507
|
+
|
|
2508
|
+
export { Transfer as default };
|