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.
Files changed (174) hide show
  1. package/LICENSE +21 -0
  2. package/dist/Checkbox.js +164 -0
  3. package/dist/CommonMixin.js +816 -0
  4. package/dist/Divider.js +646 -0
  5. package/dist/Notification.js +279 -0
  6. package/dist/Pagination.js +1106 -0
  7. package/dist/PortalWrapper.js +347 -0
  8. package/dist/RowContext.js +5 -0
  9. package/dist/Sider.js +533 -0
  10. package/dist/TextArea.js +432 -0
  11. package/dist/_arrayMap.js +68 -0
  12. package/dist/_assignValue.js +95 -0
  13. package/dist/_copyArray.js +31 -0
  14. package/dist/_hasPath.js +53 -0
  15. package/dist/_overArg.js +437 -0
  16. package/dist/_stringToArray.js +136 -0
  17. package/dist/antd/es/affix.js +12 -0
  18. package/dist/antd/es/alert.js +5 -0
  19. package/dist/antd/es/anchor.js +466 -0
  20. package/dist/antd/es/auto-complete.js +5 -0
  21. package/dist/antd/es/avatar.js +5 -0
  22. package/dist/antd/es/back-top.js +5 -0
  23. package/dist/antd/es/badge.js +5 -0
  24. package/dist/antd/es/breadcrumb.js +18 -0
  25. package/dist/antd/es/button.js +12 -0
  26. package/dist/antd/es/calendar.js +953 -0
  27. package/dist/antd/es/card.js +5 -0
  28. package/dist/antd/es/carousel.js +5 -0
  29. package/dist/antd/es/cascader.js +1275 -0
  30. package/dist/antd/es/checkbox.js +11 -0
  31. package/dist/antd/es/col.js +4 -0
  32. package/dist/antd/es/collapse.js +688 -0
  33. package/dist/antd/es/comment.js +5 -0
  34. package/dist/antd/es/config-provider.js +2 -0
  35. package/dist/antd/es/date-picker.js +4322 -0
  36. package/dist/antd/es/descriptions.js +342 -0
  37. package/dist/antd/es/divider.js +53 -0
  38. package/dist/antd/es/drawer.js +1115 -0
  39. package/dist/antd/es/dropdown.js +14 -0
  40. package/dist/antd/es/empty.js +6 -0
  41. package/dist/antd/es/form.js +5008 -0
  42. package/dist/antd/es/grid.js +13 -0
  43. package/dist/antd/es/icon.js +6 -0
  44. package/dist/antd/es/input-number.js +5 -0
  45. package/dist/antd/es/input.js +16 -0
  46. package/dist/antd/es/layout.js +14 -0
  47. package/dist/antd/es/list.js +5 -0
  48. package/dist/antd/es/locale/ar_EG.js +102 -0
  49. package/dist/antd/es/locale/bg_BG.js +98 -0
  50. package/dist/antd/es/locale/ca_ES.js +96 -0
  51. package/dist/antd/es/locale/cs_CZ.js +96 -0
  52. package/dist/antd/es/locale/da_DK.js +98 -0
  53. package/dist/antd/es/locale/de_DE.js +98 -0
  54. package/dist/antd/es/locale/default.js +2 -0
  55. package/dist/antd/es/locale/el_GR.js +98 -0
  56. package/dist/antd/es/locale/en_GB.js +98 -0
  57. package/dist/antd/es/locale/en_US.js +2 -0
  58. package/dist/antd/es/locale/es_ES.js +114 -0
  59. package/dist/antd/es/locale/et_EE.js +98 -0
  60. package/dist/antd/es/locale/fa_IR.js +98 -0
  61. package/dist/antd/es/locale/fi_FI.js +99 -0
  62. package/dist/antd/es/locale/fr_BE.js +102 -0
  63. package/dist/antd/es/locale/fr_FR.js +102 -0
  64. package/dist/antd/es/locale/ga_IE.js +99 -0
  65. package/dist/antd/es/locale/he_IL.js +99 -0
  66. package/dist/antd/es/locale/hi_IN.js +107 -0
  67. package/dist/antd/es/locale/hr_HR.js +113 -0
  68. package/dist/antd/es/locale/hu_HU.js +99 -0
  69. package/dist/antd/es/locale/hy_AM.js +109 -0
  70. package/dist/antd/es/locale/id_ID.js +101 -0
  71. package/dist/antd/es/locale/is_IS.js +98 -0
  72. package/dist/antd/es/locale/it_IT.js +111 -0
  73. package/dist/antd/es/locale/ja_JP.js +96 -0
  74. package/dist/antd/es/locale/kn_IN.js +107 -0
  75. package/dist/antd/es/locale/ko_KR.js +98 -0
  76. package/dist/antd/es/locale/ku_IQ.js +98 -0
  77. package/dist/antd/es/locale/lv_LV.js +98 -0
  78. package/dist/antd/es/locale/mk_MK.js +113 -0
  79. package/dist/antd/es/locale/mn_MN.js +99 -0
  80. package/dist/antd/es/locale/ms_MY.js +118 -0
  81. package/dist/antd/es/locale/nb_NO.js +97 -0
  82. package/dist/antd/es/locale/ne_NP.js +44 -0
  83. package/dist/antd/es/locale/nl_BE.js +98 -0
  84. package/dist/antd/es/locale/nl_NL.js +117 -0
  85. package/dist/antd/es/locale/pl_PL.js +98 -0
  86. package/dist/antd/es/locale/pt_BR.js +104 -0
  87. package/dist/antd/es/locale/pt_PT.js +127 -0
  88. package/dist/antd/es/locale/ro_RO.js +118 -0
  89. package/dist/antd/es/locale/ru_RU.js +110 -0
  90. package/dist/antd/es/locale/sk_SK.js +118 -0
  91. package/dist/antd/es/locale/sl_SI.js +96 -0
  92. package/dist/antd/es/locale/sr_RS.js +97 -0
  93. package/dist/antd/es/locale/sv_SE.js +101 -0
  94. package/dist/antd/es/locale/ta_IN.js +119 -0
  95. package/dist/antd/es/locale/th_TH.js +117 -0
  96. package/dist/antd/es/locale/tr_TR.js +112 -0
  97. package/dist/antd/es/locale/uk_UA.js +97 -0
  98. package/dist/antd/es/locale/vi_VN.js +99 -0
  99. package/dist/antd/es/locale/zh_CN.js +104 -0
  100. package/dist/antd/es/locale/zh_TW.js +100 -0
  101. package/dist/antd/es/locale-provider.js +6 -0
  102. package/dist/antd/es/mention.js +23215 -0
  103. package/dist/antd/es/mentions.js +961 -0
  104. package/dist/antd/es/menu.js +5 -0
  105. package/dist/antd/es/message.js +161 -0
  106. package/dist/antd/es/modal.js +885 -0
  107. package/dist/antd/es/notification.js +216 -0
  108. package/dist/antd/es/page-header.js +350 -0
  109. package/dist/antd/es/pagination.js +15 -0
  110. package/dist/antd/es/popconfirm.js +215 -0
  111. package/dist/antd/es/popover.js +5 -0
  112. package/dist/antd/es/progress.js +10 -0
  113. package/dist/antd/es/radio.js +10 -0
  114. package/dist/antd/es/rate.js +5 -0
  115. package/dist/antd/es/result.js +828 -0
  116. package/dist/antd/es/row.js +9 -0
  117. package/dist/antd/es/select.js +5 -0
  118. package/dist/antd/es/skeleton.js +370 -0
  119. package/dist/antd/es/slider.js +5 -0
  120. package/dist/antd/es/spin.js +11 -0
  121. package/dist/antd/es/statistic.js +650 -0
  122. package/dist/antd/es/steps.js +5 -0
  123. package/dist/antd/es/style.js +5 -0
  124. package/dist/antd/es/switch.js +5 -0
  125. package/dist/antd/es/table.js +7057 -0
  126. package/dist/antd/es/tabs.js +5 -0
  127. package/dist/antd/es/tag.js +12 -0
  128. package/dist/antd/es/time-picker.js +10 -0
  129. package/dist/antd/es/timeline.js +206 -0
  130. package/dist/antd/es/tooltip.js +9 -0
  131. package/dist/antd/es/transfer.js +2508 -0
  132. package/dist/antd/es/tree-select.js +5 -0
  133. package/dist/antd/es/tree.js +10 -0
  134. package/dist/antd/es/typography.js +1246 -0
  135. package/dist/antd/es/upload.js +3418 -0
  136. package/dist/antd/es/version.js +7 -0
  137. package/dist/col.js +142 -0
  138. package/dist/config-provider.js +6949 -0
  139. package/dist/dropdown.js +442 -0
  140. package/dist/get.js +1043 -0
  141. package/dist/icon.js +6138 -0
  142. package/dist/identity.js +230 -0
  143. package/dist/index.js +462 -0
  144. package/dist/index10.js +478 -0
  145. package/dist/index11.js +232 -0
  146. package/dist/index12.js +2766 -0
  147. package/dist/index13.js +422 -0
  148. package/dist/index14.js +283 -0
  149. package/dist/index15.js +1755 -0
  150. package/dist/index2.js +374 -0
  151. package/dist/index3.js +407 -0
  152. package/dist/index4.js +522 -0
  153. package/dist/index5.js +601 -0
  154. package/dist/index6.js +601 -0
  155. package/dist/index7.js +364 -0
  156. package/dist/index8.js +436 -0
  157. package/dist/index9.js +130 -0
  158. package/dist/input.js +475 -0
  159. package/dist/isLength.js +402 -0
  160. package/dist/keys.js +292 -0
  161. package/dist/menu.js +8138 -0
  162. package/dist/progress.js +852 -0
  163. package/dist/raf.js +34 -0
  164. package/dist/responsiveObserve.js +444 -0
  165. package/dist/row.js +173 -0
  166. package/dist/scrollTo.js +66 -0
  167. package/dist/toInteger.js +123 -0
  168. package/dist/toString.js +84 -0
  169. package/dist/transButton.js +121 -0
  170. package/dist/tree.js +3017 -0
  171. package/dist/warning.js +55 -0
  172. package/dist/wave.js +230 -0
  173. package/dist/zh_CN.js +17 -0
  174. package/package.json +160 -0
package/dist/raf.js ADDED
@@ -0,0 +1,34 @@
1
+ import { r as raf } from './menu.js';
2
+
3
+ var id = 0;
4
+ var ids = {}; // Support call raf with delay specified frame
5
+
6
+ function wrapperRaf(callback) {
7
+ var delayFrames = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
8
+ var myId = id++;
9
+ var restFrames = delayFrames;
10
+
11
+ function internalCallback() {
12
+ restFrames -= 1;
13
+
14
+ if (restFrames <= 0) {
15
+ callback();
16
+ delete ids[myId];
17
+ } else {
18
+ ids[myId] = raf(internalCallback);
19
+ }
20
+ }
21
+
22
+ ids[myId] = raf(internalCallback);
23
+ return myId;
24
+ }
25
+
26
+ wrapperRaf.cancel = function cancel(pid) {
27
+ if (pid === undefined) return;
28
+ raf.cancel(ids[pid]);
29
+ delete ids[pid];
30
+ };
31
+
32
+ wrapperRaf.ids = ids; // export this for test usage
33
+
34
+ export { wrapperRaf as w };
@@ -0,0 +1,444 @@
1
+ /**
2
+ * Delegate to handle a media query being matched and unmatched.
3
+ *
4
+ * @param {object} options
5
+ * @param {function} options.match callback for when the media query is matched
6
+ * @param {function} [options.unmatch] callback for when the media query is unmatched
7
+ * @param {function} [options.setup] one-time callback triggered the first time a query is matched
8
+ * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched?
9
+ * @constructor
10
+ */
11
+
12
+ var QueryHandler_1;
13
+ var hasRequiredQueryHandler;
14
+
15
+ function requireQueryHandler () {
16
+ if (hasRequiredQueryHandler) return QueryHandler_1;
17
+ hasRequiredQueryHandler = 1;
18
+ function QueryHandler(options) {
19
+ this.options = options;
20
+ !options.deferSetup && this.setup();
21
+ }
22
+
23
+ QueryHandler.prototype = {
24
+
25
+ constructor : QueryHandler,
26
+
27
+ /**
28
+ * coordinates setup of the handler
29
+ *
30
+ * @function
31
+ */
32
+ setup : function() {
33
+ if(this.options.setup) {
34
+ this.options.setup();
35
+ }
36
+ this.initialised = true;
37
+ },
38
+
39
+ /**
40
+ * coordinates setup and triggering of the handler
41
+ *
42
+ * @function
43
+ */
44
+ on : function() {
45
+ !this.initialised && this.setup();
46
+ this.options.match && this.options.match();
47
+ },
48
+
49
+ /**
50
+ * coordinates the unmatch event for the handler
51
+ *
52
+ * @function
53
+ */
54
+ off : function() {
55
+ this.options.unmatch && this.options.unmatch();
56
+ },
57
+
58
+ /**
59
+ * called when a handler is to be destroyed.
60
+ * delegates to the destroy or unmatch callbacks, depending on availability.
61
+ *
62
+ * @function
63
+ */
64
+ destroy : function() {
65
+ this.options.destroy ? this.options.destroy() : this.off();
66
+ },
67
+
68
+ /**
69
+ * determines equality by reference.
70
+ * if object is supplied compare options, if function, compare match callback
71
+ *
72
+ * @function
73
+ * @param {object || function} [target] the target for comparison
74
+ */
75
+ equals : function(target) {
76
+ return this.options === target || this.options.match === target;
77
+ }
78
+
79
+ };
80
+
81
+ QueryHandler_1 = QueryHandler;
82
+ return QueryHandler_1;
83
+ }
84
+
85
+ /**
86
+ * Helper function for iterating over a collection
87
+ *
88
+ * @param collection
89
+ * @param fn
90
+ */
91
+
92
+ var Util;
93
+ var hasRequiredUtil;
94
+
95
+ function requireUtil () {
96
+ if (hasRequiredUtil) return Util;
97
+ hasRequiredUtil = 1;
98
+ function each(collection, fn) {
99
+ var i = 0,
100
+ length = collection.length,
101
+ cont;
102
+
103
+ for(i; i < length; i++) {
104
+ cont = fn(collection[i], i);
105
+ if(cont === false) {
106
+ break; //allow early exit
107
+ }
108
+ }
109
+ }
110
+
111
+ /**
112
+ * Helper function for determining whether target object is an array
113
+ *
114
+ * @param target the object under test
115
+ * @return {Boolean} true if array, false otherwise
116
+ */
117
+ function isArray(target) {
118
+ return Object.prototype.toString.apply(target) === '[object Array]';
119
+ }
120
+
121
+ /**
122
+ * Helper function for determining whether target object is a function
123
+ *
124
+ * @param target the object under test
125
+ * @return {Boolean} true if function, false otherwise
126
+ */
127
+ function isFunction(target) {
128
+ return typeof target === 'function';
129
+ }
130
+
131
+ Util = {
132
+ isFunction : isFunction,
133
+ isArray : isArray,
134
+ each : each
135
+ };
136
+ return Util;
137
+ }
138
+
139
+ var MediaQuery_1;
140
+ var hasRequiredMediaQuery;
141
+
142
+ function requireMediaQuery () {
143
+ if (hasRequiredMediaQuery) return MediaQuery_1;
144
+ hasRequiredMediaQuery = 1;
145
+ var QueryHandler = requireQueryHandler();
146
+ var each = requireUtil().each;
147
+
148
+ /**
149
+ * Represents a single media query, manages it's state and registered handlers for this query
150
+ *
151
+ * @constructor
152
+ * @param {string} query the media query string
153
+ * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design
154
+ */
155
+ function MediaQuery(query, isUnconditional) {
156
+ this.query = query;
157
+ this.isUnconditional = isUnconditional;
158
+ this.handlers = [];
159
+ this.mql = window.matchMedia(query);
160
+
161
+ var self = this;
162
+ this.listener = function(mql) {
163
+ // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly
164
+ self.mql = mql.currentTarget || mql;
165
+ self.assess();
166
+ };
167
+ this.mql.addListener(this.listener);
168
+ }
169
+
170
+ MediaQuery.prototype = {
171
+
172
+ constuctor : MediaQuery,
173
+
174
+ /**
175
+ * add a handler for this query, triggering if already active
176
+ *
177
+ * @param {object} handler
178
+ * @param {function} handler.match callback for when query is activated
179
+ * @param {function} [handler.unmatch] callback for when query is deactivated
180
+ * @param {function} [handler.setup] callback for immediate execution when a query handler is registered
181
+ * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched?
182
+ */
183
+ addHandler : function(handler) {
184
+ var qh = new QueryHandler(handler);
185
+ this.handlers.push(qh);
186
+
187
+ this.matches() && qh.on();
188
+ },
189
+
190
+ /**
191
+ * removes the given handler from the collection, and calls it's destroy methods
192
+ *
193
+ * @param {object || function} handler the handler to remove
194
+ */
195
+ removeHandler : function(handler) {
196
+ var handlers = this.handlers;
197
+ each(handlers, function(h, i) {
198
+ if(h.equals(handler)) {
199
+ h.destroy();
200
+ return !handlers.splice(i,1); //remove from array and exit each early
201
+ }
202
+ });
203
+ },
204
+
205
+ /**
206
+ * Determine whether the media query should be considered a match
207
+ *
208
+ * @return {Boolean} true if media query can be considered a match, false otherwise
209
+ */
210
+ matches : function() {
211
+ return this.mql.matches || this.isUnconditional;
212
+ },
213
+
214
+ /**
215
+ * Clears all handlers and unbinds events
216
+ */
217
+ clear : function() {
218
+ each(this.handlers, function(handler) {
219
+ handler.destroy();
220
+ });
221
+ this.mql.removeListener(this.listener);
222
+ this.handlers.length = 0; //clear array
223
+ },
224
+
225
+ /*
226
+ * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match
227
+ */
228
+ assess : function() {
229
+ var action = this.matches() ? 'on' : 'off';
230
+
231
+ each(this.handlers, function(handler) {
232
+ handler[action]();
233
+ });
234
+ }
235
+ };
236
+
237
+ MediaQuery_1 = MediaQuery;
238
+ return MediaQuery_1;
239
+ }
240
+
241
+ var MediaQueryDispatch_1;
242
+ var hasRequiredMediaQueryDispatch;
243
+
244
+ function requireMediaQueryDispatch () {
245
+ if (hasRequiredMediaQueryDispatch) return MediaQueryDispatch_1;
246
+ hasRequiredMediaQueryDispatch = 1;
247
+ var MediaQuery = requireMediaQuery();
248
+ var Util = requireUtil();
249
+ var each = Util.each;
250
+ var isFunction = Util.isFunction;
251
+ var isArray = Util.isArray;
252
+
253
+ /**
254
+ * Allows for registration of query handlers.
255
+ * Manages the query handler's state and is responsible for wiring up browser events
256
+ *
257
+ * @constructor
258
+ */
259
+ function MediaQueryDispatch () {
260
+ if(!window.matchMedia) {
261
+ throw new Error('matchMedia not present, legacy browsers require a polyfill');
262
+ }
263
+
264
+ this.queries = {};
265
+ this.browserIsIncapable = !window.matchMedia('only all').matches;
266
+ }
267
+
268
+ MediaQueryDispatch.prototype = {
269
+
270
+ constructor : MediaQueryDispatch,
271
+
272
+ /**
273
+ * Registers a handler for the given media query
274
+ *
275
+ * @param {string} q the media query
276
+ * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers
277
+ * @param {function} options.match fired when query matched
278
+ * @param {function} [options.unmatch] fired when a query is no longer matched
279
+ * @param {function} [options.setup] fired when handler first triggered
280
+ * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched
281
+ * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers
282
+ */
283
+ register : function(q, options, shouldDegrade) {
284
+ var queries = this.queries,
285
+ isUnconditional = shouldDegrade && this.browserIsIncapable;
286
+
287
+ if(!queries[q]) {
288
+ queries[q] = new MediaQuery(q, isUnconditional);
289
+ }
290
+
291
+ //normalise to object in an array
292
+ if(isFunction(options)) {
293
+ options = { match : options };
294
+ }
295
+ if(!isArray(options)) {
296
+ options = [options];
297
+ }
298
+ each(options, function(handler) {
299
+ if (isFunction(handler)) {
300
+ handler = { match : handler };
301
+ }
302
+ queries[q].addHandler(handler);
303
+ });
304
+
305
+ return this;
306
+ },
307
+
308
+ /**
309
+ * unregisters a query and all it's handlers, or a specific handler for a query
310
+ *
311
+ * @param {string} q the media query to target
312
+ * @param {object || function} [handler] specific handler to unregister
313
+ */
314
+ unregister : function(q, handler) {
315
+ var query = this.queries[q];
316
+
317
+ if(query) {
318
+ if(handler) {
319
+ query.removeHandler(handler);
320
+ }
321
+ else {
322
+ query.clear();
323
+ delete this.queries[q];
324
+ }
325
+ }
326
+
327
+ return this;
328
+ }
329
+ };
330
+
331
+ MediaQueryDispatch_1 = MediaQueryDispatch;
332
+ return MediaQueryDispatch_1;
333
+ }
334
+
335
+ var src;
336
+ var hasRequiredSrc;
337
+
338
+ function requireSrc () {
339
+ if (hasRequiredSrc) return src;
340
+ hasRequiredSrc = 1;
341
+ var MediaQueryDispatch = requireMediaQueryDispatch();
342
+ src = new MediaQueryDispatch();
343
+ return src;
344
+ }
345
+
346
+ 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; }
347
+
348
+ 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); }
349
+
350
+ // matchMedia polyfill for
351
+ // https://github.com/WickyNilliams/enquire.js/issues/82
352
+ var enquire; // TODO: Will be removed in antd 4.0 because we will no longer support ie9
353
+
354
+ if (typeof window !== 'undefined') {
355
+ var matchMediaPolyfill = function matchMediaPolyfill(mediaQuery) {
356
+ return {
357
+ media: mediaQuery,
358
+ matches: false,
359
+ addListener: function addListener() {},
360
+ removeListener: function removeListener() {}
361
+ };
362
+ }; // ref: https://github.com/ant-design/ant-design/issues/18774
363
+
364
+
365
+ if (!window.matchMedia) window.matchMedia = matchMediaPolyfill; // eslint-disable-next-line global-require
366
+
367
+ enquire = requireSrc();
368
+ }
369
+
370
+ var responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
371
+ var responsiveMap = {
372
+ xs: '(max-width: 575px)',
373
+ sm: '(min-width: 576px)',
374
+ md: '(min-width: 768px)',
375
+ lg: '(min-width: 992px)',
376
+ xl: '(min-width: 1200px)',
377
+ xxl: '(min-width: 1600px)'
378
+ };
379
+ var subscribers = [];
380
+ var subUid = -1;
381
+ var screens = {};
382
+ var responsiveObserve = {
383
+ dispatch: function dispatch(pointMap) {
384
+ screens = pointMap;
385
+
386
+ if (subscribers.length < 1) {
387
+ return false;
388
+ }
389
+
390
+ subscribers.forEach(function (item) {
391
+ item.func(screens);
392
+ });
393
+ return true;
394
+ },
395
+ subscribe: function subscribe(func) {
396
+ if (subscribers.length === 0) {
397
+ this.register();
398
+ }
399
+
400
+ var token = (++subUid).toString();
401
+ subscribers.push({
402
+ token: token,
403
+ func: func
404
+ });
405
+ func(screens);
406
+ return token;
407
+ },
408
+ unsubscribe: function unsubscribe(token) {
409
+ subscribers = subscribers.filter(function (item) {
410
+ return item.token !== token;
411
+ });
412
+
413
+ if (subscribers.length === 0) {
414
+ this.unregister();
415
+ }
416
+ },
417
+ unregister: function unregister() {
418
+ Object.keys(responsiveMap).map(function (screen) {
419
+ return enquire.unregister(responsiveMap[screen]);
420
+ });
421
+ },
422
+ register: function register() {
423
+ var _this = this;
424
+
425
+ Object.keys(responsiveMap).map(function (screen) {
426
+ return enquire.register(responsiveMap[screen], {
427
+ match: function match() {
428
+ var pointMap = _extends(_extends({}, screens), _defineProperty({}, screen, true));
429
+
430
+ _this.dispatch(pointMap);
431
+ },
432
+ unmatch: function unmatch() {
433
+ var pointMap = _extends(_extends({}, screens), _defineProperty({}, screen, false));
434
+
435
+ _this.dispatch(pointMap);
436
+ },
437
+ // Keep a empty destory to avoid triggering unmatch when unregister
438
+ destroy: function destroy() {}
439
+ });
440
+ });
441
+ }
442
+ };
443
+
444
+ export { responsiveArray as a, responsiveObserve as r };
package/dist/row.js ADDED
@@ -0,0 +1,173 @@
1
+ import * as React from 'react';
2
+ import { c as classNames, C as ConfigConsumer, p as propTypesExports } from './config-provider.js';
3
+ import { R as RowContext } from './RowContext.js';
4
+ import { t as tuple } from './input.js';
5
+ import { r as responsiveObserve, a as responsiveArray } from './responsiveObserve.js';
6
+
7
+ 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); }
8
+
9
+ 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); }
10
+
11
+ 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; }
12
+
13
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
14
+
15
+ 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); } }
16
+
17
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); return Constructor; }
18
+
19
+ 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); }
20
+
21
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
22
+
23
+ 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); }; }
24
+
25
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
26
+
27
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
28
+
29
+ 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; } }
30
+
31
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
32
+
33
+ var __rest = undefined && undefined.__rest || function (s, e) {
34
+ var t = {};
35
+
36
+ for (var p in s) {
37
+ if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
38
+ }
39
+
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
42
+ }
43
+ return t;
44
+ };
45
+ var RowAligns = tuple('top', 'middle', 'bottom', 'stretch');
46
+ var RowJustify = tuple('start', 'end', 'center', 'space-around', 'space-between');
47
+
48
+ var Row = /*#__PURE__*/function (_React$Component) {
49
+ _inherits(Row, _React$Component);
50
+
51
+ var _super = _createSuper(Row);
52
+
53
+ function Row() {
54
+ var _this;
55
+
56
+ _classCallCheck(this, Row);
57
+
58
+ _this = _super.apply(this, arguments);
59
+ _this.state = {
60
+ screens: {}
61
+ };
62
+
63
+ _this.renderRow = function (_ref) {
64
+ var _classNames;
65
+
66
+ var getPrefixCls = _ref.getPrefixCls;
67
+
68
+ var _a = _this.props,
69
+ customizePrefixCls = _a.prefixCls,
70
+ type = _a.type,
71
+ justify = _a.justify,
72
+ align = _a.align,
73
+ className = _a.className,
74
+ style = _a.style,
75
+ children = _a.children,
76
+ others = __rest(_a, ["prefixCls", "type", "justify", "align", "className", "style", "children"]);
77
+
78
+ var prefixCls = getPrefixCls('row', customizePrefixCls);
79
+
80
+ var gutter = _this.getGutter();
81
+
82
+ var classes = classNames((_classNames = {}, _defineProperty(_classNames, prefixCls, !type), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type), type), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type, "-").concat(justify), type && justify), _defineProperty(_classNames, "".concat(prefixCls, "-").concat(type, "-").concat(align), type && align), _classNames), className);
83
+
84
+ var rowStyle = _extends(_extends(_extends({}, gutter[0] > 0 ? {
85
+ marginLeft: gutter[0] / -2,
86
+ marginRight: gutter[0] / -2
87
+ } : {}), gutter[1] > 0 ? {
88
+ marginTop: gutter[1] / -2,
89
+ marginBottom: gutter[1] / -2
90
+ } : {}), style);
91
+
92
+ var otherProps = _extends({}, others);
93
+
94
+ delete otherProps.gutter;
95
+ return /*#__PURE__*/React.createElement(RowContext.Provider, {
96
+ value: {
97
+ gutter: gutter
98
+ }
99
+ }, /*#__PURE__*/React.createElement("div", _extends({}, otherProps, {
100
+ className: classes,
101
+ style: rowStyle
102
+ }), children));
103
+ };
104
+
105
+ return _this;
106
+ }
107
+
108
+ _createClass(Row, [{
109
+ key: "componentDidMount",
110
+ value: function componentDidMount() {
111
+ var _this2 = this;
112
+
113
+ this.token = responsiveObserve.subscribe(function (screens) {
114
+ var gutter = _this2.props.gutter;
115
+
116
+ if (_typeof(gutter) === 'object' || Array.isArray(gutter) && (_typeof(gutter[0]) === 'object' || _typeof(gutter[1]) === 'object')) {
117
+ _this2.setState({
118
+ screens: screens
119
+ });
120
+ }
121
+ });
122
+ }
123
+ }, {
124
+ key: "componentWillUnmount",
125
+ value: function componentWillUnmount() {
126
+ responsiveObserve.unsubscribe(this.token);
127
+ }
128
+ }, {
129
+ key: "getGutter",
130
+ value: function getGutter() {
131
+ var results = [0, 0];
132
+ var gutter = this.props.gutter;
133
+ var screens = this.state.screens;
134
+ var normalizedGutter = Array.isArray(gutter) ? gutter : [gutter, 0];
135
+ normalizedGutter.forEach(function (g, index) {
136
+ if (_typeof(g) === 'object') {
137
+ for (var i = 0; i < responsiveArray.length; i++) {
138
+ var breakpoint = responsiveArray[i];
139
+
140
+ if (screens[breakpoint] && g[breakpoint] !== undefined) {
141
+ results[index] = g[breakpoint];
142
+ break;
143
+ }
144
+ }
145
+ } else {
146
+ results[index] = g || 0;
147
+ }
148
+ });
149
+ return results;
150
+ }
151
+ }, {
152
+ key: "render",
153
+ value: function render() {
154
+ return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderRow);
155
+ }
156
+ }]);
157
+
158
+ return Row;
159
+ }(React.Component);
160
+ Row.defaultProps = {
161
+ gutter: 0
162
+ };
163
+ Row.propTypes = {
164
+ type: propTypesExports.oneOf(['flex']),
165
+ align: propTypesExports.oneOf(RowAligns),
166
+ justify: propTypesExports.oneOf(RowJustify),
167
+ className: propTypesExports.string,
168
+ children: propTypesExports.node,
169
+ gutter: propTypesExports.oneOfType([propTypesExports.object, propTypesExports.number, propTypesExports.array]),
170
+ prefixCls: propTypesExports.string
171
+ };
172
+
173
+ export { Row as R };