zmdms-webui 2.5.2 → 2.5.4

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 (44) hide show
  1. package/dist/es/_virtual/_commonjsHelpers.js +1 -29
  2. package/dist/es/_virtual/index2.js +2 -2
  3. package/dist/es/canvastable/canvasTable.js +26 -13
  4. package/dist/es/canvastable/hooks/useAutoHeight.js +41 -5
  5. package/dist/es/canvastable/interface.d.ts +10 -2
  6. package/dist/es/canvastable/utils/formatHelpers.js +1 -1
  7. package/dist/es/modal/useDraggable.js +1 -1
  8. package/dist/es/node_modules/immutability-helper/index.js +1 -1
  9. package/dist/es/node_modules/rc-util/es/Dom/findDOMNode.js +2 -2
  10. package/dist/es/node_modules/react-is/cjs/react-is.development.js +1 -1
  11. package/dist/es/node_modules/react-is/cjs/react-is.production.min.js +1 -1
  12. package/dist/es/node_modules/react-is/index.js +1 -1
  13. package/package.json +2 -2
  14. package/dist/es/_virtual/Draggable.js +0 -3
  15. package/dist/es/_virtual/DraggableCore.js +0 -3
  16. package/dist/es/_virtual/cjs.js +0 -3
  17. package/dist/es/_virtual/clsx.m.js +0 -6
  18. package/dist/es/_virtual/domFns.js +0 -3
  19. package/dist/es/_virtual/getPrefix.js +0 -3
  20. package/dist/es/_virtual/index4.js +0 -3
  21. package/dist/es/_virtual/index5.js +0 -3
  22. package/dist/es/_virtual/log.js +0 -3
  23. package/dist/es/_virtual/positionFns.js +0 -3
  24. package/dist/es/_virtual/react-is.development2.js +0 -3
  25. package/dist/es/_virtual/react-is.production.min2.js +0 -3
  26. package/dist/es/_virtual/shims.js +0 -3
  27. package/dist/es/node_modules/object-assign/index.js +0 -99
  28. package/dist/es/node_modules/prop-types/checkPropTypes.js +0 -115
  29. package/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -74
  30. package/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -625
  31. package/dist/es/node_modules/prop-types/index.js +0 -28
  32. package/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -21
  33. package/dist/es/node_modules/prop-types/lib/has.js +0 -11
  34. package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -190
  35. package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -26
  36. package/dist/es/node_modules/prop-types/node_modules/react-is/index.js +0 -19
  37. package/dist/es/node_modules/react-draggable/build/cjs/Draggable.js +0 -474
  38. package/dist/es/node_modules/react-draggable/build/cjs/DraggableCore.js +0 -580
  39. package/dist/es/node_modules/react-draggable/build/cjs/cjs.js +0 -20
  40. package/dist/es/node_modules/react-draggable/build/cjs/utils/domFns.js +0 -361
  41. package/dist/es/node_modules/react-draggable/build/cjs/utils/getPrefix.js +0 -85
  42. package/dist/es/node_modules/react-draggable/build/cjs/utils/log.js +0 -10
  43. package/dist/es/node_modules/react-draggable/build/cjs/utils/positionFns.js +0 -214
  44. package/dist/es/node_modules/react-draggable/build/cjs/utils/shims.js +0 -64
@@ -4,32 +4,4 @@ function getDefaultExportFromCjs (x) {
4
4
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5
5
  }
6
6
 
7
- function getAugmentedNamespace(n) {
8
- if (n.__esModule) return n;
9
- var f = n.default;
10
- if (typeof f == "function") {
11
- var a = function a () {
12
- if (this instanceof a) {
13
- var args = [null];
14
- args.push.apply(args, arguments);
15
- var Ctor = Function.bind.apply(f, args);
16
- return new Ctor();
17
- }
18
- return f.apply(this, arguments);
19
- };
20
- a.prototype = f.prototype;
21
- } else a = {};
22
- Object.defineProperty(a, '__esModule', {value: true});
23
- Object.keys(n).forEach(function (k) {
24
- var d = Object.getOwnPropertyDescriptor(n, k);
25
- Object.defineProperty(a, k, d.get ? d : {
26
- enumerable: true,
27
- get: function () {
28
- return n[k];
29
- }
30
- });
31
- });
32
- return a;
33
- }
34
-
35
- export { commonjsGlobal, getAugmentedNamespace, getDefaultExportFromCjs };
7
+ export { commonjsGlobal, getDefaultExportFromCjs };
@@ -1,3 +1,3 @@
1
- var propTypes = {exports: {}};
1
+ var immutabilityHelper = {exports: {}};
2
2
 
3
- export { propTypes as __module };
3
+ export { immutabilityHelper as __module };
@@ -110,8 +110,14 @@ function CanvasTable(props) {
110
110
  columns: processedColumns,
111
111
  dataSource: newDataSource,
112
112
  }), finalDataSource = _z.finalDataSource, hasSummaryRow = _z.hasSummaryRow;
113
+ // 用于存储计算后的表头高度(用于自动高度的精确计算)
114
+ var _0 = useState(undefined), preciseHeaderHeight = _0[0], setPreciseHeaderHeight = _0[1];
113
115
  // 自动高度计算(需要在容器尺寸计算之前)
114
- var autoHeight = useCanvasTableAutoHeight(isAutoScrollY, autoScrollYMarginBottom, canvasTableId);
116
+ var autoHeight = useCanvasTableAutoHeight(isAutoScrollY, autoScrollYMarginBottom, canvasTableId, finalDataSource.length, // 数据行数(用于 content 模式)
117
+ headerHeight, // 表头基础高度(用于 content 模式的初始计算)
118
+ rowHeight, // 行高(用于 content 模式)
119
+ preciseHeaderHeight // 计算后的表头高度(用于 content 模式的精确计算)
120
+ );
115
121
  // 监听容器尺寸变化(提前计算,用于列宽自适应)
116
122
  var containerSize = useContainerSize({
117
123
  containerRef: containerRef,
@@ -151,6 +157,13 @@ function CanvasTable(props) {
151
157
  headerHeight: headerHeight,
152
158
  columnRenderInfos: columnRenderInfos,
153
159
  });
160
+ // 在 content 模式下,当计算后的表头高度变化时,更新精确高度以触发自动高度重新计算
161
+ useEffect(function () {
162
+ if (isAutoScrollY === "content" &&
163
+ calculatedHeaderHeight !== preciseHeaderHeight) {
164
+ setPreciseHeaderHeight(calculatedHeaderHeight);
165
+ }
166
+ }, [isAutoScrollY, calculatedHeaderHeight, preciseHeaderHeight]);
154
167
  // 计算合并单元格信息
155
168
  var mergeCellMap = useMergeCells({
156
169
  dataSource: finalDataSource,
@@ -164,7 +177,7 @@ function CanvasTable(props) {
164
177
  return calculateTotalHeight(calculatedHeaderHeight, finalDataSource.length, rowHeight);
165
178
  }, [calculatedHeaderHeight, finalDataSource.length, rowHeight]);
166
179
  // 计算滚动条指标
167
- var _0 = useScrollbarMetrics({
180
+ var _1 = useScrollbarMetrics({
168
181
  containerWidth: containerWidth,
169
182
  containerHeight: containerHeight,
170
183
  totalWidth: totalWidth,
@@ -172,14 +185,14 @@ function CanvasTable(props) {
172
185
  headerHeight: calculatedHeaderHeight,
173
186
  scrollTop: 0,
174
187
  scrollLeft: 0,
175
- }), maxScrollTop = _0.maxScrollTop, maxScrollLeft = _0.maxScrollLeft;
188
+ }), maxScrollTop = _1.maxScrollTop, maxScrollLeft = _1.maxScrollLeft;
176
189
  // 滚动管理(使用预先计算的maxScrollTop和maxScrollLeft)
177
- var _1 = useTableScroll({
190
+ var _2 = useTableScroll({
178
191
  containerRef: containerRef,
179
192
  maxScrollTop: maxScrollTop,
180
193
  maxScrollLeft: maxScrollLeft,
181
194
  onScroll: onScroll,
182
- }), scrollState = _1.scrollState, setScrollState = _1.setScrollState;
195
+ }), scrollState = _2.scrollState, setScrollState = _2.setScrollState;
183
196
  // 使用 ref 保存最新的滚动位置,确保在组件卸载过程中仍能访问
184
197
  var scrollPositionRef = useRef({ x: 0, y: 0 });
185
198
  useEffect(function () {
@@ -208,12 +221,12 @@ function CanvasTable(props) {
208
221
  scrollLeft: scrollState.scrollLeft,
209
222
  }).actualMetrics;
210
223
  // 单元格框选
211
- var _2 = useTableSelection({
224
+ var _3 = useTableSelection({
212
225
  state: state,
213
226
  setState: setState,
214
227
  }),
215
228
  // selectionStartRef,
216
- startSelection = _2.startSelection, updateSelection = _2.updateSelection, extendSelection = _2.extendSelection;
229
+ startSelection = _3.startSelection, updateSelection = _3.updateSelection, extendSelection = _3.extendSelection;
217
230
  // 处理列宽调整
218
231
  var handleColumnResize = useCallback(function (columnKey, newWidth) {
219
232
  var _a;
@@ -268,20 +281,20 @@ function CanvasTable(props) {
268
281
  onCurrentListChange,
269
282
  ]);
270
283
  // 列宽调整
271
- var _3 = useColumnResize({
284
+ var _4 = useColumnResize({
272
285
  columnRenderInfos: columnRenderInfos,
273
286
  containerWidth: containerWidth,
274
287
  headerHeight: calculatedHeaderHeight,
275
288
  scrollLeft: scrollState.scrollLeft,
276
289
  onColumnResize: handleColumnResize,
277
- }), resizeState = _3.resizeState, checkResizeHandle = _3.checkResizeHandle, startResize = _3.startResize, updateResize = _3.updateResize, endResize = _3.endResize, setHoverResizeColumn = _3.setHoverResizeColumn, getColumnWidth = _3.getColumnWidth, RESIZE_HANDLE_WIDTH = _3.RESIZE_HANDLE_WIDTH;
290
+ }), resizeState = _4.resizeState, checkResizeHandle = _4.checkResizeHandle, startResize = _4.startResize, updateResize = _4.updateResize, endResize = _4.endResize, setHoverResizeColumn = _4.setHoverResizeColumn, getColumnWidth = _4.getColumnWidth, RESIZE_HANDLE_WIDTH = _4.RESIZE_HANDLE_WIDTH;
278
291
  // 复制到剪贴板
279
- var _4 = useCopyToClipboard({
292
+ var _5 = useCopyToClipboard({
280
293
  cellSelection: state.cellSelection,
281
294
  processedDataSource: finalDataSource,
282
295
  columns: processedColumns,
283
296
  containerRef: containerRef,
284
- }), getSelectedCellsText = _4.getSelectedCellsText, copyToClipboard = _4.copyToClipboard;
297
+ }), getSelectedCellsText = _5.getSelectedCellsText, copyToClipboard = _5.copyToClipboard;
285
298
  // 处理右键菜单的复制操作
286
299
  var handleCopy = useCallback(function () {
287
300
  var text = getSelectedCellsText();
@@ -300,7 +313,7 @@ function CanvasTable(props) {
300
313
  summaryConfig: (exportExcelConfig === null || exportExcelConfig === void 0 ? void 0 : exportExcelConfig.isExportNoSummary) ? undefined : [],
301
314
  });
302
315
  // 交互事件处理(使用baseScrollbarMetrics的maxScrollTop/maxScrollLeft以保持稳定)
303
- var _5 = useTableInteraction({
316
+ var _6 = useTableInteraction({
304
317
  state: state,
305
318
  setState: setState,
306
319
  scrollState: scrollState,
@@ -347,7 +360,7 @@ function CanvasTable(props) {
347
360
  fixedRowsCount: fixedRowsCount,
348
361
  fixedRowsConfig: fixedRowsConfig,
349
362
  summaryFixed: summaryFixed,
350
- }), handleCanvasMouseDown = _5.handleCanvasMouseDown, handleCanvasMouseMove = _5.handleCanvasMouseMove, handleCanvasMouseUp = _5.handleCanvasMouseUp, handleCanvasMouseLeave = _5.handleCanvasMouseLeave, handleCanvasContextMenu = _5.handleCanvasContextMenu;
363
+ }), handleCanvasMouseDown = _6.handleCanvasMouseDown, handleCanvasMouseMove = _6.handleCanvasMouseMove, handleCanvasMouseUp = _6.handleCanvasMouseUp, handleCanvasMouseLeave = _6.handleCanvasMouseLeave, handleCanvasContextMenu = _6.handleCanvasContextMenu;
351
364
  // 渲染表格
352
365
  useTableRender(__assign(__assign({ canvasRef: canvasRef, processedDataSource: finalDataSource, columnRenderInfos: columnRenderInfos, columns: processedColumns, // 传递原始columns用于渲染多级表头
353
366
  state: state, scrollState: scrollState, rowSelection: rowSelection, containerWidth: containerWidth, containerHeight: containerHeight, headerHeight: calculatedHeaderHeight, baseHeaderHeight: headerHeight, // 传入原始基础高度用于计算每层高度
@@ -5,17 +5,45 @@ import { useState, useEffect } from 'react';
5
5
  */
6
6
  /**
7
7
  * 计算CanvasTable高度
8
- * @param isAutoScrollY 是否自动计算高度
9
- * @param marginBottom canvas table下面留出的距离
8
+ * @param isAutoScrollY 自动高度模式
9
+ * @param marginBottom canvas table下面留出的距离(仅在 viewport 模式下生效)
10
10
  * @param canvasTableId 表格id
11
+ * @param dataLength 数据行数(用于 content 模式)
12
+ * @param headerHeight 表头基础高度(用于 content 模式的初始计算)
13
+ * @param rowHeight 行高(用于 content 模式)
14
+ * @param calculatedHeaderHeight 计算后的表头高度(优先使用,用于 content 模式的精确计算)
11
15
  * @returns 计算出的表格高度
12
16
  */
13
- function useCanvasTableAutoHeight(isAutoScrollY, marginBottom, canvasTableId) {
17
+ function useCanvasTableAutoHeight(isAutoScrollY, marginBottom, canvasTableId, dataLength, headerHeight, rowHeight, calculatedHeaderHeight) {
14
18
  if (marginBottom === void 0) { marginBottom = 65; }
15
19
  var _a = useState(undefined), tableHeight = _a[0], setTableHeight = _a[1];
16
20
  useEffect(function () {
17
- if (!isAutoScrollY)
21
+ // 归一化模式:true 转换为 'viewport'
22
+ var mode = isAutoScrollY === true ? "viewport" : isAutoScrollY;
23
+ if (!mode)
18
24
  return;
25
+ // 内容模式:根据数据行数计算高度
26
+ if (mode === "content") {
27
+ if (dataLength !== undefined &&
28
+ headerHeight !== undefined &&
29
+ rowHeight !== undefined) {
30
+ // 优先使用计算后的表头高度(考虑了换行、多级表头等因素)
31
+ // 如果还未计算完成,使用基础高度作为初始值
32
+ var actualHeaderHeight = calculatedHeaderHeight || headerHeight;
33
+ // 计算总高度 = 表头高度 + (数据行数 * 行高)
34
+ var calculatedHeight = actualHeaderHeight + dataLength * rowHeight;
35
+ // 设置最小高度和最大高度
36
+ var minHeight = 200;
37
+ var maxHeight = 5000; // 防止数据过多时表格过高
38
+ // 如果没有数据,使用最小高度(包含表头和空状态提示)
39
+ var finalHeight = dataLength === 0
40
+ ? minHeight
41
+ : Math.min(Math.max(calculatedHeight, minHeight), maxHeight);
42
+ setTableHeight(finalHeight);
43
+ }
44
+ return;
45
+ }
46
+ // 视口模式:根据页面位置计算高度
19
47
  var calculateHeight = function () {
20
48
  var _a, _b;
21
49
  // 查找容器元素
@@ -60,7 +88,15 @@ function useCanvasTableAutoHeight(isAutoScrollY, marginBottom, canvasTableId) {
60
88
  window.removeEventListener("resize", handleResize);
61
89
  observer.disconnect();
62
90
  };
63
- }, [isAutoScrollY, marginBottom, canvasTableId]);
91
+ }, [
92
+ isAutoScrollY,
93
+ marginBottom,
94
+ canvasTableId,
95
+ dataLength,
96
+ headerHeight,
97
+ rowHeight,
98
+ calculatedHeaderHeight, // 当计算后的表头高度变化时,重新计算总高度
99
+ ]);
64
100
  return tableHeight;
65
101
  }
66
102
 
@@ -105,6 +105,10 @@ interface ICanvasColumnType<RecordType = any> {
105
105
  * 获取复制的值(用于自定义复制内容)
106
106
  */
107
107
  getCopyValue?: (text: any, record: RecordType, index: number) => string;
108
+ /**
109
+ * 是否默认不勾选
110
+ */
111
+ defaultUnChecked?: boolean;
108
112
  /**
109
113
  * 是否开启维度自定义
110
114
  */
@@ -395,11 +399,15 @@ interface ICanvasTableProps<RecordType = any> {
395
399
  */
396
400
  summaryFixed?: boolean;
397
401
  /**
398
- * 是否开启自动计算Y轴高度
402
+ * 自动计算Y轴高度模式
403
+ * - false: 不自动调整(默认)
404
+ * - true | 'viewport': 根据视口自动调整高度(距离页面底部的距离)
405
+ * - 'content': 根据内容自动撑开高度(表头 + 所有数据行)
399
406
  */
400
- isAutoScrollY?: boolean;
407
+ isAutoScrollY?: boolean | "viewport" | "content";
401
408
  /**
402
409
  * 自动计算Y轴高度时,canvas table下面留出的距离
410
+ * 仅在 isAutoScrollY 为 true 或 'viewport' 时生效
403
411
  */
404
412
  autoScrollYMarginBottom?: number;
405
413
  /**
@@ -30,7 +30,7 @@ var formatCellValue = function (value, column, noEmptyText) {
30
30
  formattedValue = formatDate(formattedValue, column.dateFormat);
31
31
  }
32
32
  // 数值精度
33
- if (column.precision !== undefined) {
33
+ if (column.precision !== undefined && !isNaN(Number(formattedValue))) {
34
34
  formattedValue = exactRound(formattedValue, column.precision);
35
35
  }
36
36
  // 千分符
@@ -1,7 +1,7 @@
1
1
  import { __assign } from '../_virtual/_tslib.js';
2
2
  import { jsx } from 'react/jsx-runtime';
3
3
  import { useState, useRef } from 'react';
4
- import Draggable from '../node_modules/react-draggable/build/cjs/cjs.js';
4
+ import Draggable from 'react-draggable';
5
5
 
6
6
  var useDraggable = function (options) {
7
7
  var isDrag = options.isDrag, title = options.title;
@@ -1,5 +1,5 @@
1
1
  import { getDefaultExportFromCjs } from '../../_virtual/_commonjsHelpers.js';
2
- import { __module as immutabilityHelper } from '../../_virtual/index4.js';
2
+ import { __module as immutabilityHelper } from '../../_virtual/index2.js';
3
3
 
4
4
  (function (module, exports) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,5 @@
1
1
  import React__default from 'react';
2
- import require$$2 from 'react-dom';
2
+ import ReactDOM from 'react-dom';
3
3
 
4
4
  function isDOM(node) {
5
5
  // https://developer.mozilla.org/en-US/docs/Web/API/Element
@@ -15,7 +15,7 @@ function findDOMNode(node) {
15
15
  return node;
16
16
  }
17
17
  if (node instanceof React__default.Component) {
18
- return require$$2.findDOMNode(node);
18
+ return ReactDOM.findDOMNode(node);
19
19
  }
20
20
  return null;
21
21
  }
@@ -1,4 +1,4 @@
1
- import { __exports as reactIs_development } from '../../../_virtual/react-is.development2.js';
1
+ import { __exports as reactIs_development } from '../../../_virtual/react-is.development.js';
2
2
 
3
3
  /**
4
4
  * @license React
@@ -1,4 +1,4 @@
1
- import { __exports as reactIs_production_min } from '../../../_virtual/react-is.production.min2.js';
1
+ import { __exports as reactIs_production_min } from '../../../_virtual/react-is.production.min.js';
2
2
 
3
3
  /**
4
4
  * @license React
@@ -1,4 +1,4 @@
1
- import { __module as reactIs } from '../../_virtual/index5.js';
1
+ import { __module as reactIs } from '../../_virtual/index3.js';
2
2
  import { __require as requireReactIs_production_min } from './cjs/react-is.production.min.js';
3
3
  import { __require as requireReactIs_development } from './cjs/react-is.development.js';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.5.2",
3
+ "version": "2.5.4",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
@@ -22,6 +22,7 @@
22
22
  "react-dom": ">=16.8.0",
23
23
  "react-resizable": "^3.0.5",
24
24
  "react-router-dom": ">=6",
25
+ "react-draggable": ">=4.4.5",
25
26
  "zmdms-utils": ">=0.0.1"
26
27
  },
27
28
  "sideEffects": [
@@ -148,7 +149,6 @@
148
149
  "react-contexify": "^6.0.0",
149
150
  "react-dnd": "^16.0.1",
150
151
  "react-dnd-html5-backend": "^16.0.1",
151
- "react-draggable": "4.4.5",
152
152
  "screenfull": "^6.0.2",
153
153
  "virtuallist-antd": "^0.8.0-beta.1",
154
154
  "xlsx": "^0.18.5",
@@ -1,3 +0,0 @@
1
- var Draggable = {};
2
-
3
- export { Draggable as __exports };
@@ -1,3 +0,0 @@
1
- var DraggableCore = {};
2
-
3
- export { DraggableCore as __exports };
@@ -1,3 +0,0 @@
1
- var cjs = {exports: {}};
2
-
3
- export { cjs as __module };
@@ -1,6 +0,0 @@
1
- import { getAugmentedNamespace } from './_commonjsHelpers.js';
2
- import * as clsx_m from '../node_modules/clsx/dist/clsx.m.js';
3
-
4
- var require$$3 = /*@__PURE__*/getAugmentedNamespace(clsx_m);
5
-
6
- export { require$$3 as default };
@@ -1,3 +0,0 @@
1
- var domFns = {};
2
-
3
- export { domFns as __exports };
@@ -1,3 +0,0 @@
1
- var getPrefix = {};
2
-
3
- export { getPrefix as __exports };
@@ -1,3 +0,0 @@
1
- var immutabilityHelper = {exports: {}};
2
-
3
- export { immutabilityHelper as __module };
@@ -1,3 +0,0 @@
1
- var reactIs = {exports: {}};
2
-
3
- export { reactIs as __module };
@@ -1,3 +0,0 @@
1
- var log = {};
2
-
3
- export { log as __exports };
@@ -1,3 +0,0 @@
1
- var positionFns = {};
2
-
3
- export { positionFns as __exports };
@@ -1,3 +0,0 @@
1
- var reactIs_development = {};
2
-
3
- export { reactIs_development as __exports };
@@ -1,3 +0,0 @@
1
- var reactIs_production_min = {};
2
-
3
- export { reactIs_production_min as __exports };
@@ -1,3 +0,0 @@
1
- var shims = {};
2
-
3
- export { shims as __exports };
@@ -1,99 +0,0 @@
1
- /*
2
- object-assign
3
- (c) Sindre Sorhus
4
- @license MIT
5
- */
6
-
7
- var objectAssign;
8
- var hasRequiredObjectAssign;
9
-
10
- function requireObjectAssign () {
11
- if (hasRequiredObjectAssign) return objectAssign;
12
- hasRequiredObjectAssign = 1;
13
- /* eslint-disable no-unused-vars */
14
- var getOwnPropertySymbols = Object.getOwnPropertySymbols;
15
- var hasOwnProperty = Object.prototype.hasOwnProperty;
16
- var propIsEnumerable = Object.prototype.propertyIsEnumerable;
17
-
18
- function toObject(val) {
19
- if (val === null || val === undefined) {
20
- throw new TypeError('Object.assign cannot be called with null or undefined');
21
- }
22
-
23
- return Object(val);
24
- }
25
-
26
- function shouldUseNative() {
27
- try {
28
- if (!Object.assign) {
29
- return false;
30
- }
31
-
32
- // Detect buggy property enumeration order in older V8 versions.
33
-
34
- // https://bugs.chromium.org/p/v8/issues/detail?id=4118
35
- var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
36
- test1[5] = 'de';
37
- if (Object.getOwnPropertyNames(test1)[0] === '5') {
38
- return false;
39
- }
40
-
41
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
42
- var test2 = {};
43
- for (var i = 0; i < 10; i++) {
44
- test2['_' + String.fromCharCode(i)] = i;
45
- }
46
- var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
47
- return test2[n];
48
- });
49
- if (order2.join('') !== '0123456789') {
50
- return false;
51
- }
52
-
53
- // https://bugs.chromium.org/p/v8/issues/detail?id=3056
54
- var test3 = {};
55
- 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
56
- test3[letter] = letter;
57
- });
58
- if (Object.keys(Object.assign({}, test3)).join('') !==
59
- 'abcdefghijklmnopqrst') {
60
- return false;
61
- }
62
-
63
- return true;
64
- } catch (err) {
65
- // We don't expect any of the above to throw, but better to be safe.
66
- return false;
67
- }
68
- }
69
-
70
- objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
71
- var from;
72
- var to = toObject(target);
73
- var symbols;
74
-
75
- for (var s = 1; s < arguments.length; s++) {
76
- from = Object(arguments[s]);
77
-
78
- for (var key in from) {
79
- if (hasOwnProperty.call(from, key)) {
80
- to[key] = from[key];
81
- }
82
- }
83
-
84
- if (getOwnPropertySymbols) {
85
- symbols = getOwnPropertySymbols(from);
86
- for (var i = 0; i < symbols.length; i++) {
87
- if (propIsEnumerable.call(from, symbols[i])) {
88
- to[symbols[i]] = from[symbols[i]];
89
- }
90
- }
91
- }
92
- }
93
-
94
- return to;
95
- };
96
- return objectAssign;
97
- }
98
-
99
- export { requireObjectAssign as __require };
@@ -1,115 +0,0 @@
1
- import { __require as requireReactPropTypesSecret } from './lib/ReactPropTypesSecret.js';
2
- import { __require as requireHas } from './lib/has.js';
3
-
4
- /**
5
- * Copyright (c) 2013-present, Facebook, Inc.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */
10
-
11
- var checkPropTypes_1;
12
- var hasRequiredCheckPropTypes;
13
-
14
- function requireCheckPropTypes () {
15
- if (hasRequiredCheckPropTypes) return checkPropTypes_1;
16
- hasRequiredCheckPropTypes = 1;
17
-
18
- var printWarning = function() {};
19
-
20
- if (process.env.NODE_ENV !== 'production') {
21
- var ReactPropTypesSecret = requireReactPropTypesSecret();
22
- var loggedTypeFailures = {};
23
- var has = requireHas();
24
-
25
- printWarning = function(text) {
26
- var message = 'Warning: ' + text;
27
- if (typeof console !== 'undefined') {
28
- console.error(message);
29
- }
30
- try {
31
- // --- Welcome to debugging React ---
32
- // This error was thrown as a convenience so that you can use this stack
33
- // to find the callsite that caused this warning to fire.
34
- throw new Error(message);
35
- } catch (x) { /**/ }
36
- };
37
- }
38
-
39
- /**
40
- * Assert that the values match with the type specs.
41
- * Error messages are memorized and will only be shown once.
42
- *
43
- * @param {object} typeSpecs Map of name to a ReactPropType
44
- * @param {object} values Runtime values that need to be type-checked
45
- * @param {string} location e.g. "prop", "context", "child context"
46
- * @param {string} componentName Name of the component for error messages.
47
- * @param {?Function} getStack Returns the component stack.
48
- * @private
49
- */
50
- function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
51
- if (process.env.NODE_ENV !== 'production') {
52
- for (var typeSpecName in typeSpecs) {
53
- if (has(typeSpecs, typeSpecName)) {
54
- var error;
55
- // Prop type validation may throw. In case they do, we don't want to
56
- // fail the render phase where it didn't fail before. So we log it.
57
- // After these have been cleaned up, we'll let them throw.
58
- try {
59
- // This is intentionally an invariant that gets caught. It's the same
60
- // behavior as without this statement except with a better message.
61
- if (typeof typeSpecs[typeSpecName] !== 'function') {
62
- var err = Error(
63
- (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
64
- 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
65
- 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
66
- );
67
- err.name = 'Invariant Violation';
68
- throw err;
69
- }
70
- error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
71
- } catch (ex) {
72
- error = ex;
73
- }
74
- if (error && !(error instanceof Error)) {
75
- printWarning(
76
- (componentName || 'React class') + ': type specification of ' +
77
- location + ' `' + typeSpecName + '` is invalid; the type checker ' +
78
- 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
79
- 'You may have forgotten to pass an argument to the type checker ' +
80
- 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
81
- 'shape all require an argument).'
82
- );
83
- }
84
- if (error instanceof Error && !(error.message in loggedTypeFailures)) {
85
- // Only monitor this failure once because there tends to be a lot of the
86
- // same error.
87
- loggedTypeFailures[error.message] = true;
88
-
89
- var stack = getStack ? getStack() : '';
90
-
91
- printWarning(
92
- 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
93
- );
94
- }
95
- }
96
- }
97
- }
98
- }
99
-
100
- /**
101
- * Resets warning cache when testing.
102
- *
103
- * @private
104
- */
105
- checkPropTypes.resetWarningCache = function() {
106
- if (process.env.NODE_ENV !== 'production') {
107
- loggedTypeFailures = {};
108
- }
109
- };
110
-
111
- checkPropTypes_1 = checkPropTypes;
112
- return checkPropTypes_1;
113
- }
114
-
115
- export { requireCheckPropTypes as __require };