@icos-desktop/react-components 2.0.46 → 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.
@@ -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';
@@ -5325,36 +5325,74 @@ var SvgSetting = function SvgSetting(props) {
5325
5325
  })));
5326
5326
  };
5327
5327
 
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.index-module_no-pagination__DUAKv .ant-table {\n height: 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";
5329
- var styles$$ = {"container":"index-module_container__triFT","no-pagination":"index-module_no-pagination__DUAKv","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"};
5330
5330
  styleInject(css_248z$11);
5331
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
+ };
5332
5342
  var ProTable = function (_a) {
5333
5343
  var _b;
5334
- 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, props = __rest(_a, ["header", "columns", "pagination"]);
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
5346
  var _f = useState([]), headerValue = _f[0], setHeaderValue = _f[1];
5347
+ var containerRef = useRef();
5337
5348
  var token = theme.useToken().token;
5349
+ var containerSize = useSize(containerRef);
5338
5350
  // 表格列配置修改
5339
5351
  var handleHeaderConfigChange = function (value) {
5340
5352
  setHeaderValue(value);
5341
5353
  };
5342
5354
  // 表格列
5343
- var columnsMerge = useMemo(function () {
5355
+ var _g = useMemo(function () {
5344
5356
  var newColumns = columns.filter(function (item) {
5345
5357
  return headerValue.includes(item.key || item.dataIndex);
5346
5358
  });
5359
+ var tableWidth = 36;
5347
5360
  if (newColumns.length > 0) {
5348
- newColumns.push({
5349
- title: (React__default.createElement("div", { className: styles$$['columns-config'] },
5350
- React__default.createElement(SvgSetting, null),
5351
- 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' } }))),
5352
- width: 36,
5353
- fixed: 'right',
5354
- });
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
+ ];
5355
5393
  }
5356
- return newColumns;
5357
- }, [JSON.stringify(columns), headerValue]);
5394
+ return [[], 0];
5395
+ }, [JSON.stringify(columns), headerValue, JSON.stringify(dataSource)]), columnsMerge = _g[0], x = _g[1];
5358
5396
  useEffect(function () {
5359
5397
  // 表头配置
5360
5398
  setHeaderValue((header === null || header === void 0 ? void 0 : header.filter(function (item) { return item.defaultShow; }).map(function (item) { return item.code; })) || []);
@@ -5362,10 +5400,16 @@ var ProTable = function (_a) {
5362
5400
  useEffect(function () {
5363
5401
  document.documentElement.style.setProperty('--ant-table-empty-stroke-color', token.colorTextSecondary);
5364
5402
  }, [token.colorTextSecondary]);
5365
- return (React__default.createElement("div", { className: classNames(styles$$.container, (_b = {},
5366
- _b[styles$$['no-pagination']] = pagination === false,
5403
+ return (React__default.createElement("div", { ref: containerRef, className: classNames(styles$$.container, (_b = {},
5404
+ _b[styles$$.pagination] = pagination !== false,
5405
+ _b[styles$$.virtual] = virtual,
5367
5406
  _b)) },
5368
- React__default.createElement(Table, __assign({}, props, { pagination: pagination, columns: columnsMerge, scroll: { x: 'max-content' } }))));
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 }))));
5369
5413
  };
5370
5414
  var ProTable$1 = memo(ProTable);
5371
5415
 
@@ -10125,7 +10169,7 @@ styleInject(css_248z$B);
10125
10169
  var SenseContentTable = forwardRef(function (props, ref) {
10126
10170
  var _a;
10127
10171
  var _b, _c;
10128
- 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"]);
10129
10173
  var PAGINATION = {
10130
10174
  current: 1,
10131
10175
  total: 0,
@@ -10271,9 +10315,7 @@ var SenseContentTable = forwardRef(function (props, ref) {
10271
10315
  // rowKey="sense_global_code"
10272
10316
  onRow: onRow,
10273
10317
  // rowClassName={rowClassName}
10274
- onChange: handleChangeTable,
10275
- // rowSelection={rowSelection}
10276
- containerHeight: proTableContainerHeight, scroll: { x: 'max-content', y: null } }, tableProps))),
10318
+ onChange: handleChangeTable }, tableProps))),
10277
10319
  React__default.createElement(ExportModal, null)));
10278
10320
  });
10279
10321
 
@@ -16263,11 +16305,11 @@ var CcosVideoPlayer = function (props) {
16263
16305
  CcosVideoPlayer.settings = settings$1;
16264
16306
 
16265
16307
  try {
16266
- window._ICOS_DESKTOP_VERSION_ = JSON.parse('{"version":"2.0.46","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-28 19:48:27"}');
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"}');
16267
16309
  }
16268
16310
  catch (err) {
16269
16311
  console.warn(err);
16270
- window._ICOS_DESKTOP_VERSION_ = '{"version":"2.0.46","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-28 19:48:27"}';
16312
+ window._ICOS_DESKTOP_VERSION_ = '{"version":"2.0.47","branch":"remotes/origin/release_v2.0.0","buildDate":"2025-04-29 13:43:19"}';
16271
16313
  }
16272
16314
 
16273
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 };