@qn-pandora/pandora-component 5.0.0 → 5.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/index.less CHANGED
@@ -1,54 +1,54 @@
1
1
  @import './style/mixin.less';
2
2
  @import './style/theme.less';
3
- @import './components/AutoComplete/style.less';
4
3
  @import './components/Breadcrumb/style.less';
4
+ @import './components/AutoComplete/style.less';
5
+ @import './components/Button/style.less';
5
6
  @import './components/Card/style.less';
6
- @import './components/Checkbox/style.less';
7
7
  @import './components/CheckTransformList/style.less';
8
- @import './components/Button/style.less';
9
- @import './components/CheckboxList/style.less';
10
- @import './components/Collapse/style.less';
8
+ @import './components/Checkbox/style.less';
11
9
  @import './components/CollapsiblePanel/style.less';
12
- @import './components/DateTimePicker/style.less';
10
+ @import './components/Collapse/style.less';
11
+ @import './components/CheckboxList/style.less';
13
12
  @import './components/Descriptions/style.less';
13
+ @import './components/DateTimePicker/style.less';
14
14
  @import './components/Drawer/style.less';
15
15
  @import './components/Input/style.less';
16
16
  @import './components/FileResumable/style.less';
17
17
  @import './components/KeyValuePair/style.less';
18
18
  @import './components/Menu/style.less';
19
- @import './components/Modal/style.less';
20
19
  @import './components/NameExplainTooltip/style.less';
21
- @import './components/RadioGroup/style.less';
22
- @import './components/OptionList/style.less';
23
20
  @import './components/NameLimiter/style.less';
21
+ @import './components/Modal/style.less';
22
+ @import './components/OptionList/style.less';
23
+ @import './components/RadioGroup/style.less';
24
24
  @import './components/RangeInput/style.less';
25
25
  @import './components/RemarkName/style.less';
26
26
  @import './components/Selector/style.less';
27
27
  @import './components/Spin/style.less';
28
28
  @import './components/Steps/style.less';
29
+ @import './components/Table/style.less';
29
30
  @import './components/Tabs/style.less';
30
31
  @import './components/TagList/style.less';
31
- @import './components/Table/style.less';
32
- @import './components/TreeSelector/style.less';
33
32
  @import './components/Transfer/style.less';
34
33
  @import './components/Timeline/style.less';
34
+ @import './components/TreeSelector/style.less';
35
35
  @import './components/Card/RowExtra/style.less';
36
36
  @import './components/Card/SearchInput/style.less';
37
37
  @import './components/DateTimePicker/Base/style.less';
38
38
  @import './components/DateTimePicker/BaseMobile/style.less';
39
39
  @import './components/DateTimePicker/DisplayInput/style.less';
40
40
  @import './components/Drawer/CloseIcon/style.less';
41
- @import './components/OptionList/InlineOptionList/style.less';
42
41
  @import './components/OptionList/OptionItem/style.less';
42
+ @import './components/OptionList/InlineOptionList/style.less';
43
43
  @import './components/OptionList/PopoverOptionList/style.less';
44
44
  @import './components/Steps/ControlButton/style.less';
45
- @import './components/TagList/Tag/style.less';
46
- @import './components/TagList/TagSwitch/style.less';
47
45
  @import './components/Table/ColumnSetting/style.less';
48
- @import './components/Table/ColumnTag/style.less';
49
46
  @import './components/Table/ResizableTitle/style.less';
50
- @import './components/Transfer/ListBody/style.less';
47
+ @import './components/Table/ColumnTag/style.less';
48
+ @import './components/TagList/Tag/style.less';
49
+ @import './components/TagList/TagSwitch/style.less';
51
50
  @import './components/Transfer/List/style.less';
51
+ @import './components/Transfer/ListBody/style.less';
52
52
  @import './components/Timeline/TimelineItem/style.less';
53
53
  @import './components/DateTimePicker/BaseMobile/Absolute/style.less';
54
54
  @import './components/DateTimePicker/Collapse/Panel/style.less';
@@ -10,6 +10,25 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
13
32
  var __rest = (this && this.__rest) || function (s, e) {
14
33
  var t = {};
15
34
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -21,25 +40,54 @@ var __rest = (this && this.__rest) || function (s, e) {
21
40
  }
22
41
  return t;
23
42
  };
43
+ var __read = (this && this.__read) || function (o, n) {
44
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
45
+ if (!m) return o;
46
+ var i = m.call(o), r, ar = [], e;
47
+ try {
48
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
49
+ }
50
+ catch (error) { e = { error: error }; }
51
+ finally {
52
+ try {
53
+ if (r && !r.done && (m = i["return"])) m.call(i);
54
+ }
55
+ finally { if (e) throw e.error; }
56
+ }
57
+ return ar;
58
+ };
24
59
  var __importDefault = (this && this.__importDefault) || function (mod) {
25
60
  return (mod && mod.__esModule) ? mod : { "default": mod };
26
61
  };
27
62
  Object.defineProperty(exports, "__esModule", { value: true });
28
- var react_1 = __importDefault(require("react"));
63
+ var react_1 = __importStar(require("react"));
29
64
  var react_resizable_1 = require("react-resizable");
30
65
  var classnames_1 = __importDefault(require("classnames"));
31
66
  var pandora_component_icons_1 = require("@qn-pandora/pandora-component-icons");
32
67
  var style_1 = require("../../../constants/style");
33
68
  var ResizableTitle = function (props) {
34
- var onResize = props.onResize, width = props.width, className = props.className, restProps = __rest(props, ["onResize", "width", "className"]);
35
- if (!width) {
69
+ var onResize = props.onResize, propsWidth = props.width, className = props.className, isLastColumn = props.isLastColumn, restProps = __rest(props, ["onResize", "width", "className", "isLastColumn"]);
70
+ var _a = __read(react_1.useState(propsWidth), 2), width = _a[0], setWidth = _a[1];
71
+ var contentRef = react_1.useRef(null);
72
+ react_1.useEffect(function () {
73
+ // Set the initial width based on content
74
+ if (!width && contentRef.current) {
75
+ setWidth(contentRef.current.offsetWidth);
76
+ }
77
+ }, [width]);
78
+ var handleResize = function (event, params) {
79
+ setWidth(params.size.width);
80
+ onResize(event, params);
81
+ };
82
+ // 最后一列不添加拖拽按钮
83
+ if (!onResize || isLastColumn) {
36
84
  return (react_1.default.createElement("th", __assign({}, restProps, { className: classnames_1.default(className, style_1.SDK_PREFIX + "-table-resizable-th") })));
37
85
  }
38
- return (react_1.default.createElement(react_resizable_1.Resizable, { width: width, height: 0, onResize: onResize, minConstraints: [40, 0], draggableOpts: { enableUserSelectHack: false }, handle: react_1.default.createElement("span", { className: style_1.SDK_PREFIX + "-table-resizable-handle", onClick: function (e) {
86
+ return (react_1.default.createElement(react_resizable_1.Resizable, { axis: "x", width: width, className: style_1.SDK_PREFIX + "-table-resizable-Resizable", height: 0, onResize: handleResize, minConstraints: [40, 0], draggableOpts: { enableUserSelectHack: false }, handle: react_1.default.createElement("span", { className: style_1.SDK_PREFIX + "-table-resizable-handle", onClick: function (e) {
39
87
  e.preventDefault();
40
88
  e.stopPropagation();
41
89
  } },
42
90
  react_1.default.createElement(pandora_component_icons_1.Resizable, null)) },
43
- react_1.default.createElement("th", __assign({}, restProps, { className: classnames_1.default(className, style_1.SDK_PREFIX + "-table-resizable-th") }))));
91
+ react_1.default.createElement("th", __assign({}, restProps, { className: classnames_1.default(className, style_1.SDK_PREFIX + "-table-resizable-th"), ref: contentRef }))));
44
92
  };
45
93
  exports.default = ResizableTitle;
@@ -1,13 +1,14 @@
1
+ .pandora-sdk-table-resizable-th {
2
+ width: 100%;
3
+ }
1
4
  .pandora-sdk-table-resizable-th .pandora-sdk-table-resizable-handle {
2
5
  position: absolute;
3
6
  cursor: col-resize;
4
- right: 6px;
5
- margin-left: 6px;
7
+ right: 1px;
6
8
  height: 40%;
7
9
  top: 50%;
8
10
  -webkit-transform: translateY(-50%);
9
11
  transform: translateY(-50%);
10
- padding: 2px;
11
12
  width: 8px;
12
13
  opacity: 0;
13
14
  -webkit-transition: opacity 0.2s ease-in-out;
@@ -1,15 +1,14 @@
1
1
  @import '../../../style/theme.less';
2
2
 
3
3
  .@{sdk-prefix}-table-resizable-th {
4
+ width: 100%;
4
5
  .@{sdk-prefix}-table-resizable-handle {
5
6
  position: absolute;
6
7
  cursor: col-resize;
7
- right: 6px;
8
- margin-left: 6px;
8
+ right: 1px;
9
9
  height: 40%;
10
10
  top: 50%;
11
11
  transform: translateY(-50%);
12
- padding: 2px;
13
12
  width: 8px;
14
13
  opacity: 0;
15
14
  transition: opacity 0.2s ease-in-out;
@@ -24,5 +24,7 @@ export declare enum ETableDragSaveKey {
24
24
  NeuralertChangeEvent = "Keta_drag_neuralert_change_event",
25
25
  /** 归档 */
26
26
  /** 历史数据归档 */
27
- BackUpFileArchiveTaskHistory = "backup_file_archive_task_history"
27
+ BackUpFileArchiveTaskHistory = "Keta_drag_backup_file_archive_task_history",
28
+ /** 导出任务 */
29
+ SearchExportTask = "Keta_drag_search_export_task"
28
30
  }
@@ -29,5 +29,7 @@ var ETableDragSaveKey;
29
29
  ETableDragSaveKey["NeuralertChangeEvent"] = "Keta_drag_neuralert_change_event";
30
30
  /** 归档 */
31
31
  /** 历史数据归档 */
32
- ETableDragSaveKey["BackUpFileArchiveTaskHistory"] = "backup_file_archive_task_history";
32
+ ETableDragSaveKey["BackUpFileArchiveTaskHistory"] = "Keta_drag_backup_file_archive_task_history";
33
+ /** 导出任务 */
34
+ ETableDragSaveKey["SearchExportTask"] = "Keta_drag_search_export_task";
33
35
  })(ETableDragSaveKey = exports.ETableDragSaveKey || (exports.ETableDragSaveKey = {}));
@@ -61,6 +61,12 @@ export interface ITableProps<T> extends Omit<TableProps<T>, 'columns'> {
61
61
  draggable?: boolean | ETableSettingType;
62
62
  saveSettingKey?: string;
63
63
  onSettingChange?: (fields: ISaveFieldItem[]) => void;
64
+ /**
65
+ * 是否需要填充空白列, 默认为true
66
+ * 如果支持拖拽,在屏幕宽度大于table总的列宽的时候,会把剩余空间平均分到每一列上。那么拖拽一列会导致其他列的宽度都发生变更
67
+ * 添加一个空白列,宽度auto.可以解决此问题。如果可以接受上述问题,那就无需空白列,needEmptyColumn = false
68
+ */
69
+ needEmptyColumn?: boolean;
64
70
  }
65
71
  /**
66
72
  * pandora2.0风格的表格
@@ -108,7 +114,7 @@ declare class Table<T = any> extends React.Component<ITableProps<T>, any> {
108
114
  updateSettingFields(columns: Array<IColumnType<T>>, settingFields: ISaveFieldItem[]): void;
109
115
  handleHideColumnsChange(keys: string[]): Promise<void> | undefined;
110
116
  getSortedColumns(): IKeyValues<any>[];
111
- transfromColumns(columns: IKeyValues[]): IKeyValues<any>[];
117
+ transfromColumns(columns: IKeyValues[], needEmptyColumn?: boolean): IKeyValues<any>[];
112
118
  getColumns(): IKeyValues<any>[];
113
119
  getRowKey(row: any, index: number): any;
114
120
  getSortCoulmns(columns: IKeyValues[]): IKeyValues<any>[];
@@ -412,8 +412,8 @@ var Table = /** @class */ (function (_super) {
412
412
  };
413
413
  // 如果支持拖拽,在屏幕宽度大于table总的列宽的时候,添加一个空白列,宽度auto.
414
414
  // 空白列添加到右固定列的前面
415
- Table.prototype.transfromColumns = function (columns) {
416
- if (!this.resizable)
415
+ Table.prototype.transfromColumns = function (columns, needEmptyColumn) {
416
+ if (!this.resizable || needEmptyColumn === false)
417
417
  return columns;
418
418
  var cols = __spread(columns);
419
419
  var firstFixedRightIndex = cols.findIndex(function (item) { return lodash_1.get(item, 'fixed') === 'right'; });
@@ -431,14 +431,14 @@ var Table = /** @class */ (function (_super) {
431
431
  return cols;
432
432
  };
433
433
  Table.prototype.getColumns = function () {
434
- var _a = this.props, showColumnSetting = _a.showColumnSetting, columnSettingOverlayClass = _a.columnSettingOverlayClass;
434
+ var _a = this.props, showColumnSetting = _a.showColumnSetting, columnSettingOverlayClass = _a.columnSettingOverlayClass, needEmptyColumn = _a.needEmptyColumn;
435
435
  if (!showColumnSetting) {
436
- return this.transfromColumns(this.columns);
436
+ return this.transfromColumns(this.columns, needEmptyColumn);
437
437
  }
438
438
  // 获取到列设置的options
439
439
  var columnsSettingOptions = this.columnsSettingOptions;
440
440
  var allCols = this.getSortedColumns();
441
- this.transfromColumns(allCols);
441
+ this.transfromColumns(allCols, needEmptyColumn);
442
442
  var length = allCols.length;
443
443
  if (length > 0) {
444
444
  var title = (React.createElement("span", { className: style_1.SDK_PREFIX + "-last-column-title" },
@@ -570,6 +570,7 @@ var Table = /** @class */ (function (_super) {
570
570
  return noneSelected || disabled;
571
571
  };
572
572
  Table.prototype.handleResize = function (col, size, oldColumn) {
573
+ console.log('handleResize', col, size);
573
574
  var newColumns = __spread(oldColumn);
574
575
  newColumns.forEach(function (item) {
575
576
  if (lodash_1.get(item, 'dataIndex') === col.dataIndex) {
@@ -579,11 +580,18 @@ var Table = /** @class */ (function (_super) {
579
580
  var sizeMap = {};
580
581
  var setttingFields = this.settingFields;
581
582
  newColumns.forEach(function (element) {
582
- if (element.dataIndex && lodash_1.isNumber(element.width)) {
583
+ if (element.dataIndex &&
584
+ lodash_1.isNumber(element.width) &&
585
+ !isNaN(element.width)) {
583
586
  sizeMap[element.dataIndex] = element.width;
584
587
  }
585
588
  });
586
589
  if (this.props.onSettingChange) {
590
+ setttingFields.forEach(function (field) {
591
+ if (sizeMap[field.field]) {
592
+ field.width = sizeMap[field.field];
593
+ }
594
+ });
587
595
  this.props.onSettingChange(setttingFields);
588
596
  }
589
597
  else if (this.resizable && this.props.saveSettingKey) {
@@ -607,18 +615,22 @@ var Table = /** @class */ (function (_super) {
607
615
  return lodash_1.isNumber(width) ? __assign(__assign({}, col), { width: width }) : col;
608
616
  });
609
617
  }
610
- var transformColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (it) {
618
+ var transformColumns = columns === null || columns === void 0 ? void 0 : columns.map(function (it, index) {
611
619
  if (lodash_1.get(it, 'resizable') && _this.resizable) {
612
620
  return __assign(__assign({}, it), { ellipsis: {
613
621
  showTitle: true
614
- }, onHeaderCell: function (col) { return ({
615
- width: col.width,
616
- // !传入newColumn,而不传入column是因为需要拿到有onHeaderCell的值,外面collumn的变化内部监听不到
617
- onResize: function (_, _a) {
618
- var size = _a.size;
619
- _this.handleResize(col, size, transformColumns);
620
- }
621
- }); } });
622
+ }, onHeaderCell: function (col) {
623
+ var _a;
624
+ return ({
625
+ width: col.width,
626
+ // !传入newColumn,而不传入column是因为需要拿到有onHeaderCell的值,外面collumn的变化内部监听不到
627
+ onResize: function (_, _a) {
628
+ var size = _a.size;
629
+ _this.handleResize(col, size, transformColumns);
630
+ },
631
+ isLastColumn: index === ((_a = (columns || [])) === null || _a === void 0 ? void 0 : _a.length) - 1
632
+ });
633
+ } });
622
634
  }
623
635
  return it;
624
636
  });
@@ -775,7 +787,7 @@ var Table = /** @class */ (function (_super) {
775
787
  __decorate([
776
788
  bind_1.default,
777
789
  __metadata("design:type", Function),
778
- __metadata("design:paramtypes", [Array]),
790
+ __metadata("design:paramtypes", [Array, Boolean]),
779
791
  __metadata("design:returntype", void 0)
780
792
  ], Table.prototype, "transfromColumns", null);
781
793
  __decorate([