@arim-aisdc/public-components 0.0.11 → 0.0.13

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 React from 'react';
2
2
  import { Size } from 'react-split-pane';
3
3
  import { SplitPrimary, SplitType } from './config';
4
- import './index.less';
4
+ import './splitPane.less';
5
5
  export type SplitPaneModuleType = {
6
6
  defaultSize: Size;
7
7
  minSize?: Size;
@@ -23,6 +23,7 @@ export type SplitPaneModuleType = {
23
23
  routerName: string;
24
24
  pane1Name: string;
25
25
  pane2Name: string;
26
+ userId: string;
26
27
  dragFinished?: () => void;
27
28
  };
28
29
  declare const _default: React.NamedExoticComponent<SplitPaneModuleType>;
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
13
  import React, { useEffect, useRef, useState } from 'react';
14
14
  import SplitPane from 'react-split-pane';
15
15
  import { DomNames, PrimaryList, SplitSizeType, SplitTypeList } from "./config";
16
- import "./index.less";
16
+ import "./splitPane.less";
17
17
  import { getCurrentRouterName, getLocalStorageItem, getProAndUserKey, setLocalStorageItem, setSplitSizeData } from "./util";
18
18
  import { jsxs as _jsxs } from "react/jsx-runtime";
19
19
  var defaultMinSize = 50;
@@ -38,6 +38,7 @@ var SplitPaneModule = function SplitPaneModule(_ref) {
38
38
  splitStep = _ref.splitStep,
39
39
  pane1Dom = _ref.pane1Dom,
40
40
  pane2Dom = _ref.pane2Dom,
41
+ userId = _ref.userId,
41
42
  dragFinished = _ref.dragFinished,
42
43
  resizerClassName = _ref.resizerClassName,
43
44
  currentModulePageName = _ref.currentModulePageName,
@@ -47,20 +48,20 @@ var SplitPaneModule = function SplitPaneModule(_ref) {
47
48
  pane2Name = _ref.pane2Name;
48
49
  var sizeType = SplitSizeType[splitType];
49
50
  var SpalitPaneModuleRef = useRef(null);
50
- var _useState = useState(setSplitSizeData(currentModulePageName, currentModuleDataName) || null),
51
+ var _useState = useState(setSplitSizeData(currentModulePageName, currentModuleDataName, userId) || null),
51
52
  _useState2 = _slicedToArray(_useState, 2),
52
53
  currentComponentSize = _useState2[0],
53
54
  setCurrentComponentSize = _useState2[1];
54
55
  var setLocalSize = function setLocalSize(size) {
55
56
  if (SpalitPaneModuleRef !== null && SpalitPaneModuleRef !== void 0 && SpalitPaneModuleRef.current && getCurrentRouterName() === routerName) {
56
57
  var _SpalitPaneModuleRef$, _currentUserData$curr, _objectSpread2;
57
- var _currentRouterData = getLocalStorageItem(getProAndUserKey()) || {};
58
+ var _currentRouterData = getLocalStorageItem(getProAndUserKey(userId)) || {};
58
59
  var _currentUserData = _currentRouterData[getCurrentRouterName()] || {};
59
60
  var _anotherPaneName = splitPrimary === PrimaryList.firstComponent ? DomNames.secondName : DomNames.firstName;
60
61
  var _anotherSize = SpalitPaneModuleRef === null || SpalitPaneModuleRef === void 0 || (_SpalitPaneModuleRef$ = SpalitPaneModuleRef.current) === null || _SpalitPaneModuleRef$ === void 0 || (_SpalitPaneModuleRef$ = _SpalitPaneModuleRef$[_anotherPaneName]) === null || _SpalitPaneModuleRef$ === void 0 ? void 0 : _SpalitPaneModuleRef$[offsetName + sizeType];
61
62
  _currentRouterData[getCurrentRouterName()] = _objectSpread(_objectSpread({}, _currentUserData), {}, _defineProperty({}, currentModulePageName, _defineProperty({}, currentModuleDataName, _objectSpread(_objectSpread({}, _currentUserData === null || _currentUserData === void 0 || (_currentUserData$curr = _currentUserData[currentModulePageName]) === null || _currentUserData$curr === void 0 ? void 0 : _currentUserData$curr[currentModuleDataName]), {}, (_objectSpread2 = {}, _defineProperty(_objectSpread2, pane1Name + sizeType, splitPrimary === PrimaryList.firstComponent ? size || (currentComponentSize === null || currentComponentSize === void 0 ? void 0 : currentComponentSize[pane1Name + sizeType]) : _anotherSize), _defineProperty(_objectSpread2, pane2Name + sizeType, splitPrimary === PrimaryList.secondComponent ? size || (currentComponentSize === null || currentComponentSize === void 0 ? void 0 : currentComponentSize[pane2Name + sizeType]) : _anotherSize), _objectSpread2)))));
62
- setCurrentComponentSize(_objectSpread(_objectSpread({}, currentComponentSize), setSplitSizeData(currentModulePageName, currentModuleDataName)));
63
- setLocalStorageItem(getProAndUserKey(), _currentRouterData);
63
+ setCurrentComponentSize(_objectSpread(_objectSpread({}, currentComponentSize), setSplitSizeData(currentModulePageName, currentModuleDataName, userId)));
64
+ setLocalStorageItem(getProAndUserKey(userId), _currentRouterData);
64
65
  dragFinished === null || dragFinished === void 0 || dragFinished();
65
66
  }
66
67
  };
@@ -2,5 +2,5 @@ import SplitPane from './SplitPane';
2
2
  export type { SplitPaneModuleType } from './SplitPane';
3
3
  export { DomNames, PrimaryList, SplitSizeType, SplitTypeList } from './config';
4
4
  export type { SplitPrimary, SplitType } from './config';
5
- export { ProjectName, delLocalStorageItem, emptyValueList, getComponentsSize, getCurrentRouterName, getLocalStorageItem, getProAndUserKey, getUserId, setLocalStorageItem, setSplitSizeData, } from './util';
5
+ export { ProjectName, delLocalStorageItem, emptyValueList, getComponentsSize, getCurrentRouterName, getLocalStorageItem, getProAndUserKey, setLocalStorageItem, setSplitSizeData, } from './util';
6
6
  export default SplitPane;
@@ -1,4 +1,4 @@
1
1
  import SplitPane from "./SplitPane";
2
2
  export { DomNames, PrimaryList, SplitSizeType, SplitTypeList } from "./config";
3
- export { ProjectName, delLocalStorageItem, emptyValueList, getComponentsSize, getCurrentRouterName, getLocalStorageItem, getProAndUserKey, getUserId, setLocalStorageItem, setSplitSizeData } from "./util";
3
+ export { ProjectName, delLocalStorageItem, emptyValueList, getComponentsSize, getCurrentRouterName, getLocalStorageItem, getProAndUserKey, setLocalStorageItem, setSplitSizeData } from "./util";
4
4
  export default SplitPane;
@@ -0,0 +1,16 @@
1
+ .split-pane-section {
2
+ > div {
3
+ overflow: hidden !important;
4
+ background: @globalColor7 !important;
5
+ }
6
+
7
+ > span {
8
+ opacity: 1 !important;
9
+ border: none !important;
10
+ background: @globalColor8 !important;
11
+
12
+ &:hover {
13
+ border: none !important;
14
+ }
15
+ }
16
+ }
@@ -1,18 +1,17 @@
1
1
  import { SplitType } from './config';
2
- export declare const ProjectName = "HBIS_TG";
2
+ export declare const ProjectName = "ARIM_AISDC";
3
3
  export declare const getCurrentRouterName: () => string;
4
4
  export declare const emptyValueList: Array<any>;
5
5
  export declare const getLocalStorageItem: (item: string) => any;
6
6
  export declare const delLocalStorageItem: (item: string) => void;
7
7
  export declare const setLocalStorageItem: (item: string, data: any) => void;
8
- export declare const getUserId: () => any;
9
- export declare const getProAndUserKey: () => string;
8
+ export declare const getProAndUserKey: (userId: string) => string;
10
9
  /**
11
10
  * 更新split各组件宽高
12
11
  * @param modulePageName 页面名称
13
12
  * @param moduleDataName 数据名称
14
13
  */
15
- export declare const setSplitSizeData: (modulePageName: string, moduleDataName: string) => any;
14
+ export declare const setSplitSizeData: (modulePageName: string, moduleDataName: string, userId: string) => any;
16
15
  /**
17
16
  * 获取split两组件宽高
18
17
  * @param splitType split类型
@@ -20,5 +19,6 @@ export declare const setSplitSizeData: (modulePageName: string, moduleDataName:
20
19
  * @param moduleDataName 数据名称
21
20
  * @param pane1Name 组件1名称
22
21
  * @param pane2Name 组件2名称
22
+ * @param userId 用户id
23
23
  */
24
- export declare const getComponentsSize: (splitType: SplitType, modulePageName: string, moduleDataName: string, pane1Name: string, pane2Name: string) => any[];
24
+ export declare const getComponentsSize: (splitType: SplitType, modulePageName: string, moduleDataName: string, pane1Name: string, pane2Name: string, userId: string) => any[];
@@ -1,5 +1,5 @@
1
1
  import { SplitSizeType } from "./config";
2
- export var ProjectName = 'HBIS_TG';
2
+ export var ProjectName = 'ARIM_AISDC';
3
3
 
4
4
  // 当前页面路由
5
5
  export var getCurrentRouterName = function getCurrentRouterName() {
@@ -22,15 +22,9 @@ export var setLocalStorageItem = function setLocalStorageItem(item, data) {
22
22
  }
23
23
  };
24
24
 
25
- // 获取用户id
26
- export var getUserId = function getUserId() {
27
- var _getLocalStorageItem;
28
- return ((_getLocalStorageItem = getLocalStorageItem('poi-permission')) === null || _getLocalStorageItem === void 0 || (_getLocalStorageItem = _getLocalStorageItem.currentUser) === null || _getLocalStorageItem === void 0 ? void 0 : _getLocalStorageItem.id) || '';
29
- };
30
-
31
25
  // 唯一路由拼接key(根据 项目名称+用户id)
32
- export var getProAndUserKey = function getProAndUserKey() {
33
- return "".concat(ProjectName, "-").concat(getUserId());
26
+ export var getProAndUserKey = function getProAndUserKey(userId) {
27
+ return "".concat(ProjectName, "-").concat(userId);
34
28
  };
35
29
 
36
30
  /**
@@ -38,9 +32,9 @@ export var getProAndUserKey = function getProAndUserKey() {
38
32
  * @param modulePageName 页面名称
39
33
  * @param moduleDataName 数据名称
40
34
  */
41
- export var setSplitSizeData = function setSplitSizeData(modulePageName, moduleDataName) {
42
- var _getLocalStorageItem2;
43
- return (_getLocalStorageItem2 = getLocalStorageItem(getProAndUserKey())) === null || _getLocalStorageItem2 === void 0 || (_getLocalStorageItem2 = _getLocalStorageItem2[getCurrentRouterName()]) === null || _getLocalStorageItem2 === void 0 || (_getLocalStorageItem2 = _getLocalStorageItem2[modulePageName]) === null || _getLocalStorageItem2 === void 0 ? void 0 : _getLocalStorageItem2[moduleDataName];
35
+ export var setSplitSizeData = function setSplitSizeData(modulePageName, moduleDataName, userId) {
36
+ var _getLocalStorageItem;
37
+ return (_getLocalStorageItem = getLocalStorageItem(getProAndUserKey(userId))) === null || _getLocalStorageItem === void 0 || (_getLocalStorageItem = _getLocalStorageItem[getCurrentRouterName()]) === null || _getLocalStorageItem === void 0 || (_getLocalStorageItem = _getLocalStorageItem[modulePageName]) === null || _getLocalStorageItem === void 0 ? void 0 : _getLocalStorageItem[moduleDataName];
44
38
  };
45
39
 
46
40
  /**
@@ -50,10 +44,11 @@ export var setSplitSizeData = function setSplitSizeData(modulePageName, moduleDa
50
44
  * @param moduleDataName 数据名称
51
45
  * @param pane1Name 组件1名称
52
46
  * @param pane2Name 组件2名称
47
+ * @param userId 用户id
53
48
  */
54
- export var getComponentsSize = function getComponentsSize(splitType, modulePageName, moduleDataName, pane1Name, pane2Name) {
49
+ export var getComponentsSize = function getComponentsSize(splitType, modulePageName, moduleDataName, pane1Name, pane2Name, userId) {
55
50
  var sizeType = SplitSizeType[splitType];
56
- var _ref = setSplitSizeData(modulePageName, moduleDataName) || {},
51
+ var _ref = setSplitSizeData(modulePageName, moduleDataName, userId) || {},
57
52
  pane1Size = _ref[pane1Name + sizeType],
58
53
  pane2Size = _ref[pane2Name + sizeType];
59
54
  return [pane1Size, pane2Size];
@@ -14,6 +14,7 @@ type TableBodyPropsType = {
14
14
  canFilter: boolean;
15
15
  canSelection: boolean;
16
16
  selectionWithoutChecked?: boolean;
17
+ tableBodyHeight: number;
17
18
  bodyContentHeight: number;
18
19
  tableContainerWidth: number;
19
20
  selectedRowDragging: boolean;
@@ -52,5 +53,5 @@ type TableBodyPropsType = {
52
53
  };
53
54
  dragBeforeStart: (datas: any) => boolean;
54
55
  };
55
- declare const TableBody: ({ table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, hasVerticalScrollBar, datas, emptyDataHeight, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, pinShadowVisible, dragBeforeStart, }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
56
+ declare const TableBody: ({ table, tableId, theme, reorderRow, rowSelectedId, setRowSelectedId, selectedRowChange, onSelectChange, canSelection, selectionWithoutChecked, tableBodyHeight, tableContainerWidth, selectedRowDragging, setSelectedRowDragging, canRowDrag, rowKey, loading, rowClassName, cellClassName, rowStyle, getCellProps, rowHeight, renderSubComponent, onRowMouseEnter, onRowMouseLeave, onRowMouseClick, onRowMouseDoubleClick, disableDragRowIds, selectRowWhenClick, hasVerticalScrollBar, datas, emptyDataHeight, canEditRowWhenDClick, editingRowId, handleEditRowWhenDClick, pinShadowVisible, dragBeforeStart, }: TableBodyPropsType) => import("react/jsx-runtime").JSX.Element;
56
57
  export default TableBody;
@@ -12,6 +12,7 @@ import { useDrop } from 'react-dnd';
12
12
  import { CustomDragLayer } from "../components/CustomDragerLayer";
13
13
  // import RowContent from "../components/RowContent";
14
14
 
15
+ import { useEffect } from 'react';
15
16
  import { createPortal } from 'react-dom';
16
17
  import Row from "./Row";
17
18
  import "./index.less";
@@ -30,6 +31,7 @@ var TableBody = function TableBody(_ref) {
30
31
  onSelectChange = _ref.onSelectChange,
31
32
  canSelection = _ref.canSelection,
32
33
  selectionWithoutChecked = _ref.selectionWithoutChecked,
34
+ tableBodyHeight = _ref.tableBodyHeight,
33
35
  tableContainerWidth = _ref.tableContainerWidth,
34
36
  selectedRowDragging = _ref.selectedRowDragging,
35
37
  setSelectedRowDragging = _ref.setSelectedRowDragging,
@@ -237,11 +239,9 @@ var TableBody = function TableBody(_ref) {
237
239
  }
238
240
  return EmptyContent();
239
241
  };
240
-
241
- // useEffect(() => {
242
- // console.log(tableBodyHeight, 'tableBodyHeight*******************');
243
- // }, [tableBodyHeight]);
244
-
242
+ useEffect(function () {
243
+ console.log(tableBodyHeight, 'tableBodyHeight*******************');
244
+ }, [tableBodyHeight]);
245
245
  return (
246
246
  /*#__PURE__*/
247
247
  // 修复筛选数据为空时,滚动条丢失
@@ -3,6 +3,7 @@ table {
3
3
  // background: @globalColor_14;
4
4
  width: 100%;
5
5
  border-collapse: collapse;
6
+ overflow: hidden;
6
7
 
7
8
  th {
8
9
  position: relative;
@@ -81,7 +81,8 @@ var TableMax = function TableMax(_ref) {
81
81
  _ref$showSizeChanger = _ref.showSizeChanger,
82
82
  showSizeChanger = _ref$showSizeChanger === void 0 ? true : _ref$showSizeChanger,
83
83
  changePagination = _ref.changePagination,
84
- defaultScrollY = _ref.defaultScrollY,
84
+ _ref$defaultScrollY = _ref.defaultScrollY,
85
+ defaultScrollY = _ref$defaultScrollY === void 0 ? 600 : _ref$defaultScrollY,
85
86
  _ref$columnResizeMode = _ref.columnResizeMode,
86
87
  columnResizeMode = _ref$columnResizeMode === void 0 ? 'onChange' : _ref$columnResizeMode,
87
88
  rowKey = _ref.rowKey,
@@ -366,19 +367,18 @@ var TableMax = function TableMax(_ref) {
366
367
  var _tableHeaderRef$curre;
367
368
  setTableHeadHeight(tableHeaderRef === null || tableHeaderRef === void 0 || (_tableHeaderRef$curre = tableHeaderRef.current) === null || _tableHeaderRef$curre === void 0 ? void 0 : _tableHeaderRef$curre.clientHeight);
368
369
  }, [tableHeaderRef === null || tableHeaderRef === void 0 || (_tableHeaderRef$curre2 = tableHeaderRef.current) === null || _tableHeaderRef$curre2 === void 0 ? void 0 : _tableHeaderRef$curre2.clientHeight, enableFilters]);
369
- var bodyContentHeight = useMemo(function () {
370
- return datas.length * Number(rowHeight);
371
- }, [datas.length, rowHeight]);
372
370
 
373
371
  /**table-body高度 */
374
372
  useEffect(function () {
375
373
  var _tableContentRef$curr, _tableContentRef$curr2;
376
374
  var horizontalScrollHeight = table.getTotalSize() > (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr = tableContentRef.current) === null || _tableContentRef$curr === void 0 ? void 0 : _tableContentRef$curr.offsetWidth) ? 10 : 0;
377
- setTableBodyHeight(autoHeight ? (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 ? void 0 : _tableContentRef$curr2.clientHeight) - tableHeadHeight - horizontalScrollHeight : defaultScrollY ? defaultScrollY - tableHeadHeight - horizontalScrollHeight : bodyContentHeight);
378
- }, [table.getTotalSize(), defaultScrollY, autoHeight, tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current, tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr3 = tableContentRef.current) === null || _tableContentRef$curr3 === void 0 ? void 0 : _tableContentRef$curr3.clientHeight, tableHeadHeight, bodyContentHeight]);
375
+ setTableBodyHeight(autoHeight ? (tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr2 = tableContentRef.current) === null || _tableContentRef$curr2 === void 0 ? void 0 : _tableContentRef$curr2.clientHeight) - tableHeadHeight - horizontalScrollHeight : defaultScrollY - tableHeadHeight - horizontalScrollHeight);
376
+ }, [table.getTotalSize(), defaultScrollY, autoHeight, tableContentRef === null || tableContentRef === void 0 ? void 0 : tableContentRef.current, tableContentRef === null || tableContentRef === void 0 || (_tableContentRef$curr3 = tableContentRef.current) === null || _tableContentRef$curr3 === void 0 ? void 0 : _tableContentRef$curr3.clientHeight, tableHeadHeight]);
379
377
 
380
378
  /**table-body-content 高度 */
381
-
379
+ var bodyContentHeight = useMemo(function () {
380
+ return datas.length * Number(rowHeight);
381
+ }, [datas.length, rowHeight]);
382
382
  var hasVerticalScrollBar = useMemo(function () {
383
383
  return tableBodyHeight - bodyContentHeight + 10 < 0;
384
384
  }, [tableBodyHeight, bodyContentHeight]);
@@ -967,7 +967,7 @@ var TableMax = function TableMax(_ref) {
967
967
  selectionWithoutChecked: selectionWithoutChecked,
968
968
  // scroll,
969
969
  // setScroll,
970
- // tableBodyHeight,
970
+ tableBodyHeight: tableBodyHeight,
971
971
  // tableHeadHeight,
972
972
  // setTableHeadHeight,
973
973
  bodyContentHeight: bodyContentHeight,
@@ -1126,7 +1126,7 @@ var TableMax = function TableMax(_ref) {
1126
1126
  className: "table-center",
1127
1127
  ref: tableContentRef,
1128
1128
  style: {
1129
- height: !autoHeight && defaultScrollY ? defaultScrollY : 'fix-content'
1129
+ height: !autoHeight ? defaultScrollY : 'fix-content'
1130
1130
  },
1131
1131
  children: [/*#__PURE__*/_jsx("div", {
1132
1132
  ref: tableHeaderRef,
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { default as Foo } from './components/Foo';
1
+ export * from './components/SplitPane';
2
2
  export { default as SplitPane } from './components/SplitPane';
3
3
  export * from './components/TableMax';
4
4
  export { default as TableMax } from './components/TableMax';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { default as Foo } from "./components/Foo";
1
+ export * from "./components/SplitPane";
2
2
  export { default as SplitPane } from "./components/SplitPane";
3
3
  export * from "./components/TableMax";
4
4
  export { default as TableMax } from "./components/TableMax";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arim-aisdc/public-components",
3
- "version": "0.0.11",
3
+ "version": "0.0.13",
4
4
  "description": "前端组件库",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -49,7 +49,6 @@
49
49
  "@tanstack/react-table": "^8.9.1",
50
50
  "ahooks": "^3.7.8",
51
51
  "css-vars-ponyfill": "^2.4.8",
52
- "f": "^1.4.0",
53
52
  "fs": "^0.0.1-security",
54
53
  "lodash": "^4.17.21",
55
54
  "path": "^0.12.7",
@@ -91,4 +90,4 @@
91
90
  "authors": [
92
91
  "na.xu2278@foxmail.com"
93
92
  ]
94
- }
93
+ }
@@ -1,33 +0,0 @@
1
- .split-pane-section {
2
- > div {
3
- overflow: hidden !important;
4
- background: @globalColor7 !important;
5
- }
6
-
7
- > span {
8
- opacity: 1 !important;
9
- border: none !important;
10
- background: @globalColor8 !important;
11
-
12
- &:hover {
13
- border: none !important;
14
- }
15
- }
16
-
17
- // :global {
18
- // .Pane {
19
- // overflow: hidden;
20
- // background: @globalColor7;
21
- // }
22
-
23
- // .Resizer {
24
- // opacity: 1;
25
- // border: none;
26
- // background: @globalColor8;
27
-
28
- // &:hover {
29
- // border: none;
30
- // }
31
- // }
32
- // }
33
- }