@icos-desktop/react-components 2.0.45 → 2.0.47

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.
@@ -377,7 +377,6 @@ interface ProTableProps extends TableProps {
377
377
  hidden?: boolean;
378
378
  defaultShow?: boolean;
379
379
  }[];
380
- containerHeight?: number;
381
380
  }
382
381
 
383
382
  declare const _default: React.NamedExoticComponent<ProTableProps>;
@@ -1,7 +1,7 @@
1
1
  import { message, Form, Input, TreeSelect, Collapse, App, Button, Tooltip, Modal as Modal$1, List, Space, Table, Radio, Checkbox, Popover, theme, Select, Tree, DatePicker, InputNumber, Image, Steps as Steps$1, Upload as Upload$1, Progress, Cascader, Empty, Slider, Tabs as Tabs$1, Breadcrumb, Segmented, Divider, Spin, Splitter } from '@xirang/design-antd';
2
2
  import * as React from 'react';
3
3
  import React__default, { useState, forwardRef, useEffect, useImperativeHandle, useRef, memo, useMemo, createRef } from 'react';
4
- import { useRequest, useMount, useDebounceEffect, useAntdTable, useExternal, useAsyncEffect, useDeepCompareEffect } from 'ahooks';
4
+ import { useRequest, useMount, useSize, useDebounceEffect, useAntdTable, useExternal, useAsyncEffect, useDeepCompareEffect } from 'ahooks';
5
5
  import { omit, cloneDeep, isEmpty, debounce, pick } from 'lodash';
6
6
  import qs from 'qs';
7
7
  import { produce } from 'immer';
@@ -10,7 +10,6 @@ import classNames from 'classnames';
10
10
  import dayjs from 'dayjs';
11
11
  import { Menu, Submenu, Item as Item$2, contextMenu, useContextMenu } from 'react-contexify';
12
12
  import Highlighter from 'react-highlight-words';
13
- import ResizeObserver from 'rc-resize-observer';
14
13
  import { v4 } from 'uuid';
15
14
  import ReactDOM from 'react-dom';
16
15
  import RcOverflow from 'rc-overflow';
@@ -5326,53 +5325,74 @@ var SvgSetting = function SvgSetting(props) {
5326
5325
  })));
5327
5326
  };
5328
5327
 
5329
- var css_248z$11 = ":root {\n --ant-table-empty-stroke-color: #d9d9d9;\n}\n.index-module_container__triFT {\n position: relative;\n height: 100%;\n width: 100%;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ {\n position: absolute;\n top: 12px;\n width: 16px;\n height: 16px;\n z-index: 9;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ > svg {\n position: absolute;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ .ant-select {\n opacity: 0;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ .ant-select .ant-select-selector {\n width: 16px;\n height: 16px;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ .ant-select .ant-select-selector .ant-select-selection-overflow {\n display: none;\n}\n.index-module_container__triFT .ant-table-wrapper .ant-table-cell-fix-right-first::after {\n box-shadow: none;\n}\n.index-module_container__triFT .ant-table-cell {\n line-height: 24px;\n}\n.index-module_container__triFT .ant-table-wrapper .ant-table-container::before,\n.index-module_container__triFT .ant-table-wrapper .ant-table-container::after {\n display: none;\n}\n.index-module_container__triFT .ant-table-cell-scrollbar {\n display: none;\n}\n.index-module_container__triFT .ant-table-thead .ant-table-cell {\n overflow: hidden;\n}\n.index-module_container__triFT .ant-table-row:has(.ant-table-cell-fix-right) .ant-table-cell.ant-table-cell-fix-right {\n transition: none;\n}\n.index-module_container__triFT .ant-empty-image svg path {\n stroke: var(--ant-table-empty-stroke-color, #d9d9d9);\n}\n.index-module_container__triFT .ant-table-wrapper .ant-table .ant-table-title,\n.index-module_container__triFT .ant-table-wrapper .ant-table .ant-table-footer,\n.index-module_container__triFT .ant-table-wrapper .ant-table .ant-table-cell,\n.index-module_container__triFT .ant-table-wrapper .ant-table .ant-table-thead > tr > th,\n.index-module_container__triFT .ant-table-wrapper .ant-table .ant-table-tbody > tr > th,\n.index-module_container__triFT .ant-table-wrapper .ant-table .ant-table-tbody > tr > td,\n.index-module_container__triFT .ant-table-wrapper .ant-table tfoot > tr > th,\n.index-module_container__triFT .ant-table-wrapper .ant-table tfoot > tr > td {\n max-width: 380px;\n}\n.index-module_container__triFT .ant-table {\n height: calc(100% - 56px);\n}\n.index-module_container__triFT .ant-table-wrapper,\n.index-module_container__triFT .ant-spin-nested-loading,\n.index-module_container__triFT .ant-spin-container,\n.index-module_container__triFT .ant-table-container,\n.index-module_container__triFT .ant-table-content {\n height: 100%;\n}\n.index-module_container__triFT .ant-table-content {\n overflow: auto !important;\n}\n.index-module_container__triFT .ant-table-thead {\n position: sticky;\n top: 0;\n z-index: 10;\n}\n.index-module_columns-config-popup__-d8ej .ant-select-item {\n position: relative;\n}\n.index-module_columns-config-popup__-d8ej .ant-select-item .ant-select-item-option-content {\n position: absolute;\n left: 32px;\n width: -webkit-fill-available;\n}\n.index-module_columns-config-popup__-d8ej .ant-select-item .ant-select-item-option-state {\n position: absolute;\n left: 8px;\n top: 8px;\n}\n.index-module_columns-config-popup__-d8ej .rc-virtual-list-holder {\n overflow-x: hidden;\n}\n";
5330
- var styles$$ = {"container":"index-module_container__triFT","columns-config":"index-module_columns-config__pSkLQ","columns-config-popup":"index-module_columns-config-popup__-d8ej"};
5328
+ var css_248z$11 = ":root {\n --ant-table-empty-stroke-color: #d9d9d9;\n}\n.index-module_container__triFT {\n position: relative;\n height: 100%;\n width: 100%;\n}\n.index-module_container__triFT:not(.index-module_pagination__eCJE3) .ant-table {\n height: 100%;\n}\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table .ant-table-title,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table .ant-table-footer,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table .ant-table-cell,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table .ant-table-thead > tr > th,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table .ant-table-tbody > tr > th,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table .ant-table-tbody > tr > td,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table tfoot > tr > th,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper .ant-table tfoot > tr > td {\n max-width: 380px;\n}\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table {\n height: calc(100% - 56px);\n}\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-wrapper,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-spin-nested-loading,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-spin-container,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-container,\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-content {\n height: 100%;\n}\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-content {\n overflow: auto !important;\n}\n.index-module_container__triFT:not(.index-module_virtual__iU2Fi) .ant-table-thead {\n position: sticky;\n top: 0;\n z-index: 10;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ {\n position: absolute;\n top: 12px;\n width: 16px;\n height: 16px;\n z-index: 9;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ > svg {\n position: absolute;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ .ant-select {\n opacity: 0;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ .ant-select .ant-select-selector {\n width: 16px;\n height: 16px;\n}\n.index-module_container__triFT .index-module_columns-config__pSkLQ .ant-select .ant-select-selector .ant-select-selection-overflow {\n display: none;\n}\n.index-module_container__triFT .ant-table-wrapper .ant-table-cell-fix-right-first::after {\n box-shadow: none;\n}\n.index-module_container__triFT .ant-table-cell {\n line-height: 24px;\n}\n.index-module_container__triFT .ant-table-wrapper .ant-table-container::before,\n.index-module_container__triFT .ant-table-wrapper .ant-table-container::after {\n display: none;\n}\n.index-module_container__triFT .ant-table-cell-scrollbar {\n display: none;\n}\n.index-module_container__triFT .ant-table-thead .ant-table-cell {\n overflow: hidden;\n}\n.index-module_container__triFT .ant-table-row:has(.ant-table-cell-fix-right) .ant-table-cell.ant-table-cell-fix-right {\n transition: none;\n}\n.index-module_container__triFT .ant-empty-image svg path {\n stroke: var(--ant-table-empty-stroke-color, #d9d9d9);\n}\n.index-module_columns-config-popup__-d8ej .ant-select-item {\n position: relative;\n}\n.index-module_columns-config-popup__-d8ej .ant-select-item .ant-select-item-option-content {\n position: absolute;\n left: 32px;\n width: -webkit-fill-available;\n}\n.index-module_columns-config-popup__-d8ej .ant-select-item .ant-select-item-option-state {\n position: absolute;\n left: 8px;\n top: 8px;\n}\n.index-module_columns-config-popup__-d8ej .rc-virtual-list-holder {\n overflow-x: hidden;\n}\n";
5329
+ var styles$$ = {"container":"index-module_container__triFT","pagination":"index-module_pagination__eCJE3","virtual":"index-module_virtual__iU2Fi","columns-config":"index-module_columns-config__pSkLQ","columns-config-popup":"index-module_columns-config-popup__-d8ej"};
5331
5330
  styleInject(css_248z$11);
5332
5331
 
5332
+ // 计算最大宽度
5333
+ var getMaxWidth = function (texts) {
5334
+ var canvas = document.createElement('canvas');
5335
+ var context = canvas.getContext('2d');
5336
+ context.font = '14px Arial';
5337
+ return Math.min(texts.reduce(function (maxWidth, text) {
5338
+ var columnWidth = context.measureText(text).width + 32;
5339
+ return Math.max(maxWidth, columnWidth);
5340
+ }, 0), 380);
5341
+ };
5333
5342
  var ProTable = function (_a) {
5334
- var _b = _a.header, header = _b === void 0 ? [] : _b, _c = _a.columns, columns = _c === void 0 ? [] : _c, _d = _a.pagination, pagination = _d === void 0 ? false : _d, containerHeight = _a.containerHeight, props = __rest(_a, ["header", "columns", "pagination", "containerHeight"]);
5343
+ var _b;
5344
+ var _c = _a.header, header = _c === void 0 ? [] : _c, _d = _a.columns, columns = _d === void 0 ? [] : _d, _e = _a.pagination, pagination = _e === void 0 ? false : _e, dataSource = _a.dataSource, virtual = _a.virtual, props = __rest(_a, ["header", "columns", "pagination", "dataSource", "virtual"]);
5335
5345
  // 表头显示配置
5336
- var _e = useState([]), headerValue = _e[0], setHeaderValue = _e[1];
5337
- // 表格宽度
5338
- var _f = useState(0), tableWidth = _f[0], setTableWidth = _f[1];
5339
- // 表格高度
5340
- var _g = useState(0), tableHeight = _g[0], setTableHeight = _g[1];
5346
+ var _f = useState([]), headerValue = _f[0], setHeaderValue = _f[1];
5347
+ var containerRef = useRef();
5341
5348
  var token = theme.useToken().token;
5342
- // 表格宽高变化
5343
- var handleTableResize = function (_a) {
5344
- var height = _a.height, width = _a.width;
5345
- if (containerHeight || height) {
5346
- var newHeight = containerHeight ? containerHeight : height - 38 - 8;
5347
- if (pagination) {
5348
- newHeight -= 64;
5349
- }
5350
- setTableHeight(newHeight);
5351
- }
5352
- if (width) {
5353
- setTableWidth(width);
5354
- }
5355
- };
5349
+ var containerSize = useSize(containerRef);
5356
5350
  // 表格列配置修改
5357
5351
  var handleHeaderConfigChange = function (value) {
5358
5352
  setHeaderValue(value);
5359
5353
  };
5360
5354
  // 表格列
5361
- var columnsMerge = useMemo(function () {
5355
+ var _g = useMemo(function () {
5362
5356
  var newColumns = columns.filter(function (item) {
5363
5357
  return headerValue.includes(item.key || item.dataIndex);
5364
5358
  });
5359
+ var tableWidth = 36;
5365
5360
  if (newColumns.length > 0) {
5366
- newColumns.push({
5367
- title: (React__default.createElement("div", { className: styles$$['columns-config'] },
5368
- React__default.createElement(SvgSetting, null),
5369
- React__default.createElement(Select, { popupClassName: styles$$['columns-config-popup'], mode: "multiple", showSearch: false, defaultActiveFirstOption: false, popupMatchSelectWidth: 122, placement: "bottomRight", value: headerValue, onChange: handleHeaderConfigChange, options: header.filter(function (item) { return !item.hidden; }), fieldNames: { label: 'name', value: 'code' } }))),
5370
- width: 36,
5371
- fixed: 'right',
5372
- });
5361
+ if (virtual) {
5362
+ return [
5363
+ __spreadArray(__spreadArray([], newColumns.map(function (item) {
5364
+ var width = getMaxWidth(__spreadArray([
5365
+ item.title
5366
+ ], (dataSource || []).map(function (it) { return it[item.dataIndex]; }), true)) || undefined;
5367
+ tableWidth += width;
5368
+ return __assign(__assign({}, item), { width: width });
5369
+ }), true), [
5370
+ {
5371
+ title: (React__default.createElement("div", { className: styles$$['columns-config'] },
5372
+ React__default.createElement(SvgSetting, null),
5373
+ React__default.createElement(Select, { popupClassName: styles$$['columns-config-popup'], mode: "multiple", showSearch: false, defaultActiveFirstOption: false, popupMatchSelectWidth: 122, placement: "bottomRight", value: headerValue, onChange: handleHeaderConfigChange, options: header.filter(function (item) { return !item.hidden; }), fieldNames: { label: 'name', value: 'code' } }))),
5374
+ width: 36,
5375
+ fixed: 'right',
5376
+ },
5377
+ ], false),
5378
+ tableWidth,
5379
+ ];
5380
+ }
5381
+ return [
5382
+ __spreadArray(__spreadArray([], newColumns, true), [
5383
+ {
5384
+ title: (React__default.createElement("div", { className: styles$$['columns-config'] },
5385
+ React__default.createElement(SvgSetting, null),
5386
+ React__default.createElement(Select, { popupClassName: styles$$['columns-config-popup'], mode: "multiple", showSearch: false, defaultActiveFirstOption: false, popupMatchSelectWidth: 122, placement: "bottomRight", value: headerValue, onChange: handleHeaderConfigChange, options: header.filter(function (item) { return !item.hidden; }), fieldNames: { label: 'name', value: 'code' } }))),
5387
+ width: 36,
5388
+ fixed: 'right',
5389
+ },
5390
+ ], false),
5391
+ tableWidth,
5392
+ ];
5373
5393
  }
5374
- return newColumns;
5375
- }, [JSON.stringify(columns), headerValue]);
5394
+ return [[], 0];
5395
+ }, [JSON.stringify(columns), headerValue, JSON.stringify(dataSource)]), columnsMerge = _g[0], x = _g[1];
5376
5396
  useEffect(function () {
5377
5397
  // 表头配置
5378
5398
  setHeaderValue((header === null || header === void 0 ? void 0 : header.filter(function (item) { return item.defaultShow; }).map(function (item) { return item.code; })) || []);
@@ -5380,9 +5400,16 @@ var ProTable = function (_a) {
5380
5400
  useEffect(function () {
5381
5401
  document.documentElement.style.setProperty('--ant-table-empty-stroke-color', token.colorTextSecondary);
5382
5402
  }, [token.colorTextSecondary]);
5383
- return (React__default.createElement(ResizeObserver, { onResize: handleTableResize },
5384
- React__default.createElement("div", { className: styles$$.container },
5385
- React__default.createElement(Table, __assign({}, props, { pagination: pagination, scroll: __assign({ x: tableWidth, y: tableHeight }, props.scroll), columns: columnsMerge })))));
5403
+ return (React__default.createElement("div", { ref: containerRef, className: classNames(styles$$.container, (_b = {},
5404
+ _b[styles$$.pagination] = pagination !== false,
5405
+ _b[styles$$.virtual] = virtual,
5406
+ _b)) },
5407
+ React__default.createElement(Table, __assign({}, props, { pagination: pagination, columns: columnsMerge, dataSource: dataSource, scroll: virtual
5408
+ ? {
5409
+ x: Math.min(x, containerSize === null || containerSize === void 0 ? void 0 : containerSize.width),
5410
+ y: Math.max(0, (containerSize === null || containerSize === void 0 ? void 0 : containerSize.height) - 40 - 56),
5411
+ }
5412
+ : { x: 'max-content' }, virtual: virtual }))));
5386
5413
  };
5387
5414
  var ProTable$1 = memo(ProTable);
5388
5415
 
@@ -10142,7 +10169,7 @@ styleInject(css_248z$B);
10142
10169
  var SenseContentTable = forwardRef(function (props, ref) {
10143
10170
  var _a;
10144
10171
  var _b, _c;
10145
- var senseGlobalCodes = props.senseGlobalCodes, tableName = props.tableName, extraParams = props.extraParams, timeFieldName = props.timeFieldName, timeFieldFormat = props.timeFieldFormat, filterConfig = props.filterConfig, showExportButton = props.showExportButton, customButtons = props.customButtons, customColumns = props.customColumns, selectedRowLength = props.selectedRowLength, _d = props.pageSize, pageSize = _d === void 0 ? 1000 : _d, onClick = props.onClick, onDoubleClick = props.onDoubleClick, onRefresh = props.onRefresh, proTableContainerHeight = props.proTableContainerHeight, tableProps = __rest(props, ["senseGlobalCodes", "tableName", "extraParams", "timeFieldName", "timeFieldFormat", "filterConfig", "showExportButton", "customButtons", "customColumns", "selectedRowLength", "pageSize", "onClick", "onDoubleClick", "onRefresh", "proTableContainerHeight"]);
10172
+ var senseGlobalCodes = props.senseGlobalCodes, tableName = props.tableName, extraParams = props.extraParams, timeFieldName = props.timeFieldName, timeFieldFormat = props.timeFieldFormat, filterConfig = props.filterConfig, showExportButton = props.showExportButton, customButtons = props.customButtons, customColumns = props.customColumns, selectedRowLength = props.selectedRowLength, _d = props.pageSize, pageSize = _d === void 0 ? 1000 : _d, onClick = props.onClick, onDoubleClick = props.onDoubleClick, onRefresh = props.onRefresh; props.proTableContainerHeight; var tableProps = __rest(props, ["senseGlobalCodes", "tableName", "extraParams", "timeFieldName", "timeFieldFormat", "filterConfig", "showExportButton", "customButtons", "customColumns", "selectedRowLength", "pageSize", "onClick", "onDoubleClick", "onRefresh", "proTableContainerHeight"]);
10146
10173
  var PAGINATION = {
10147
10174
  current: 1,
10148
10175
  total: 0,
@@ -10288,9 +10315,7 @@ var SenseContentTable = forwardRef(function (props, ref) {
10288
10315
  // rowKey="sense_global_code"
10289
10316
  onRow: onRow,
10290
10317
  // rowClassName={rowClassName}
10291
- onChange: handleChangeTable,
10292
- // rowSelection={rowSelection}
10293
- containerHeight: proTableContainerHeight, scroll: { x: 'max-content', y: null } }, tableProps))),
10318
+ onChange: handleChangeTable }, tableProps))),
10294
10319
  React__default.createElement(ExportModal, null)));
10295
10320
  });
10296
10321
 
@@ -16280,11 +16305,11 @@ var CcosVideoPlayer = function (props) {
16280
16305
  CcosVideoPlayer.settings = settings$1;
16281
16306
 
16282
16307
  try {
16283
- window._ICOS_DESKTOP_VERSION_ = JSON.parse('{"version":"2.0.45","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-28 19:16:54"}');
16308
+ window._ICOS_DESKTOP_VERSION_ = JSON.parse('{"version":"2.0.47","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-29 13:43:19"}');
16284
16309
  }
16285
16310
  catch (err) {
16286
16311
  console.warn(err);
16287
- window._ICOS_DESKTOP_VERSION_ = '{"version":"2.0.45","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-28 19:16:54"}';
16312
+ window._ICOS_DESKTOP_VERSION_ = '{"version":"2.0.47","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-29 13:43:19"}';
16288
16313
  }
16289
16314
 
16290
16315
  export { BookDetail, BookGroupImport, BookGroupTable, BookImport, BookInfo, BookSelect, BookTable, CcosBookDetail, CcosImportTable, CcosSenseCreate, CcosSenseDetail, CcosSenseEdit, CcosSenseFullTable, CcosSenseManager, CcosSenseSearch, CcosSenseTree, CcosSenseView, CcosTagConfig, CcosVideoPlayer, EntityClassFilter, EntityClassTreeSelect, ImportTable, Modal, OrgTreeSelect, PersonSelector, ProSearch, ProTable$1 as ProTable, RegionCascader, RegionTreeSelect, RelationGraph, SenseContentTable, SenseCreate, SenseDetail, SenseEdit, SenseForm, SenseFullTable, SenseInfo, SenseManager, SenseSearch, SenseTable, SenseTree, SenseView, TagConfig, TagTreeSelect, VideoControl, VideoPlayer, setCconfig as config };