@aloudata/aloudata-design 1.0.1 → 1.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.
@@ -18,7 +18,11 @@
18
18
  font-weight: 600;
19
19
  font-size: 12px;
20
20
  text-shadow: none;
21
- text-decoration:none;
21
+ text-decoration: none;
22
+
23
+ &:focus-visible {
24
+ outline: none;
25
+ }
22
26
  }
23
27
 
24
28
  &.ant-btn-loading::before {
@@ -258,7 +262,7 @@
258
262
  }
259
263
  }
260
264
 
261
- gap:@button-left-icon-margin-right-large;
265
+ gap: @button-left-icon-margin-right-large;
262
266
  // .aldicon-icon-left + span {
263
267
  // margin-left: @button-left-icon-margin-right-large;
264
268
  // }
@@ -289,7 +293,7 @@
289
293
  }
290
294
  }
291
295
 
292
- gap:@button-left-icon-margin-right-middle;
296
+ gap: @button-left-icon-margin-right-middle;
293
297
  // .aldicon-icon-left + span {
294
298
  // margin-left: @button-left-icon-margin-right-middle;
295
299
  // }
@@ -320,7 +324,7 @@
320
324
  }
321
325
  }
322
326
 
323
- gap:@button-left-icon-margin-right-small;
327
+ gap: @button-left-icon-margin-right-small;
324
328
  // .aldicon-icon-left + span {
325
329
  // margin-left: @button-left-icon-margin-right-small;
326
330
  // }
@@ -5,6 +5,6 @@ declare const DoubleCircleIcon: (props: {
5
5
  size?: number | undefined;
6
6
  innerColor?: string | undefined;
7
7
  children: React.ReactNode;
8
- type?: "warning" | "error" | "success" | "info" | undefined;
8
+ type?: "error" | "success" | "warning" | "info" | undefined;
9
9
  }) => JSX.Element;
10
10
  export default DoubleCircleIcon;
@@ -73,6 +73,11 @@ export interface IDropdownProps {
73
73
  */
74
74
  forceRender?: boolean;
75
75
  children?: React.ReactNode;
76
+ /**
77
+ * @description 自定义下拉框内容
78
+ * @default -
79
+ */
80
+ dropdownRender?: (menus: React.ReactNode) => React.ReactNode;
76
81
  /**
77
82
  * @description 是否禁用
78
83
  * @default false
@@ -4,8 +4,8 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
4
4
 
5
5
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
6
6
 
7
- import React from 'react';
8
7
  import { Dropdown as AntdDropdown } from 'antd';
8
+ import React from 'react';
9
9
  import DropdownButton from "./Button";
10
10
  export default function Dropdown(props) {
11
11
  var children = props.children,
@@ -1,4 +1,4 @@
1
- var _excluded = ["className", "expandIcon"];
1
+ var _excluded = ["className", "expandIcon", "items"];
2
2
 
3
3
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
4
4
 
@@ -6,17 +6,49 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
6
6
 
7
7
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
8
 
9
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
10
+
11
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
12
+
13
+ function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
14
+
9
15
  import { ChevronRightLine } from '@aloudata/icons-react';
10
16
  import { Menu as AntdMenu } from 'antd';
11
17
  import classNames from 'classnames';
12
- import theme from "../style/themes/default/themeColor.module.less";
13
18
  import React from 'react';
19
+ import theme from "../style/themes/default/themeColor.module.less";
14
20
  import Divider from "./Divider";
15
21
  import MenuItem from "./MenuItem";
16
22
  import SubMenu from "./SubMenu";
23
+
24
+ function isSubMenuType(item) {
25
+ return item.children !== undefined;
26
+ }
27
+
28
+ function addPopupOffset(items) {
29
+ if (typeof items === 'undefined') {
30
+ return;
31
+ }
32
+
33
+ var OFFSET_WIDTH = 1;
34
+ var OFFSET_HEIGHT = 0;
35
+ return items.map(function (item) {
36
+ if (isSubMenuType(item)) {
37
+ return _objectSpread(_objectSpread({
38
+ popupOffset: [OFFSET_WIDTH, OFFSET_HEIGHT]
39
+ }, item), {}, {
40
+ children: addPopupOffset(item.children)
41
+ });
42
+ }
43
+
44
+ return item;
45
+ }, []);
46
+ }
47
+
17
48
  export default function Menu(props) {
18
49
  var className = props.className,
19
50
  expandIcon = props.expandIcon,
51
+ items = props.items,
20
52
  otherProps = _objectWithoutProperties(props, _excluded);
21
53
 
22
54
  return /*#__PURE__*/React.createElement(AntdMenu, _extends({
@@ -26,6 +58,7 @@ export default function Menu(props) {
26
58
  size: 16
27
59
  })
28
60
  }, otherProps, {
61
+ items: addPopupOffset(items) || [],
29
62
  theme: "light"
30
63
  }));
31
64
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { IRadioGroupProps } from '../../interface/radioGroup';
3
- export declare const RadioGroupContext: React.Context<Omit<IRadioGroupProps, "children" | "className"> & {
3
+ export declare const RadioGroupContext: React.Context<Omit<IRadioGroupProps, "className" | "children"> & {
4
4
  sliderRef?: React.RefObject<HTMLDivElement> | undefined;
5
5
  }>;
6
6
  export default function RadioGroup(props: IRadioGroupProps): JSX.Element;
@@ -21,18 +21,18 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
21
  /* eslint-disable no-unneeded-ternary */
22
22
  /// <reference types ='./react-table-config' />
23
23
  import classnames from 'classnames';
24
- import React, { useEffect, useMemo, useRef, useState, useCallback } from 'react';
25
- import usePrefixCls from "../_utils/hooks/usePrefixCls";
26
24
  import ResizeObserver from 'rc-resize-observer';
27
- import { useTable, useBlockLayout, useRowSelect, useSortBy, useResizeColumns } from 'react-table';
28
- import { getColumnsWidthMap, getValidScrollThreshold } from "./utils";
29
- import "./style/index";
25
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
26
+ import { useBlockLayout, useResizeColumns, useRowSelect, useSortBy, useTable } from 'react-table';
30
27
  import message from "../message";
31
- import Loading from "./components/Loading";
28
+ import usePrefixCls from "../_utils/hooks/usePrefixCls";
32
29
  import Empty from "./components/Empty";
33
- import TableHead from "./components/TableHead";
30
+ import Loading from "./components/Loading";
34
31
  import TableBodyRowList from "./components/TableBodyRowList";
32
+ import TableHead from "./components/TableHead";
35
33
  import { useTimeoutLock } from "./hooks/useFrame";
34
+ import "./style/index";
35
+ import { getColumnsWidthMap, getValidScrollThreshold } from "./utils";
36
36
  var tableHeadRowHeight = 44;
37
37
  var SCROLLBAR_SIZE = 15;
38
38
  var ZERO = 0;
@@ -62,7 +62,9 @@ function Table(props, ref) {
62
62
  _props$ellipsis = props.ellipsis,
63
63
  ellipsis = _props$ellipsis === void 0 ? true : _props$ellipsis,
64
64
  rowKey = props.rowKey,
65
- height = props.height;
65
+ height = props.height,
66
+ _props$canSelected = props.canSelected,
67
+ canSelected = _props$canSelected === void 0 ? false : _props$canSelected;
66
68
 
67
69
  var _useState = useState(undefined),
68
70
  _useState2 = _slicedToArray(_useState, 2),
@@ -227,6 +229,7 @@ function Table(props, ref) {
227
229
  };
228
230
  });
229
231
  var tableHeadNode = /*#__PURE__*/React.createElement(TableHead, {
232
+ tableHeadRef: tableHeadRef,
230
233
  canResizeColumn: resizeColumn,
231
234
  headerGroups: headerGroups // tableContentWidth={columnsTotalWidthRef.current}
232
235
  ,
@@ -360,8 +363,8 @@ function Table(props, ref) {
360
363
 
361
364
  return /*#__PURE__*/React.createElement("div", {
362
365
  style: {
363
- overflow: 'overlay',
364
- overflowX: tableClientWidth + SCROLLBAR_SIZE > columnsTotalWidthRef.current ? 'hidden' : 'unset',
366
+ overflow: 'auto',
367
+ overflowX: 'unset',
365
368
  height: tableClientHeight - tableHeadRowHeight
366
369
  },
367
370
  ref: tableBodyRef,
@@ -372,7 +375,6 @@ function Table(props, ref) {
372
375
  return /*#__PURE__*/React.createElement("div", {
373
376
  className: classnames("".concat(prefixCls, "-inner-wrap"), _defineProperty({}, "".concat(prefixCls, "-innerScroll"), !!height))
374
377
  }, /*#__PURE__*/React.createElement("div", {
375
- ref: tableHeadRef,
376
378
  className: "".concat(prefixCls, "-tableHeadScrollWrap")
377
379
  }, tableHeadNode), /*#__PURE__*/React.createElement("div", _extends({}, getTableBodyProps(), {
378
380
  className: classnames("".concat(prefixCls, "-tbody"), _defineProperty({}, "".concat(prefixCls, "-tbody-innerScroll"), !!height))
@@ -384,7 +386,8 @@ function Table(props, ref) {
384
386
  className: prefixCls,
385
387
  ref: tableRef,
386
388
  style: {
387
- height: !height ? 'unset' : height
389
+ height: !height ? 'unset' : height,
390
+ userSelect: canSelected ? 'auto' : 'none'
388
391
  }
389
392
  }, /*#__PURE__*/React.createElement(ResizeObserver, {
390
393
  onResize: function onResize(_ref3) {
@@ -1,4 +1,4 @@
1
- import { MutableRefObject } from 'react';
1
+ import React, { MutableRefObject } from 'react';
2
2
  import { HeaderGroup, SortingRule } from 'react-table';
3
3
  import { ISort, TSortOrder } from '../../interface';
4
4
  import { IWidthDetail } from '../../utils';
@@ -15,6 +15,7 @@ interface ITableWithoutHeightProps<T extends object = {}> {
15
15
  sortDirections?: Array<'ascend' | 'descend'>;
16
16
  setSortBy: (sortBy: SortingRule<T>[]) => void;
17
17
  onChange?: (sort: ISort<T>) => void;
18
+ tableHeadRef: React.Ref<HTMLDivElement>;
18
19
  columnsWidthMapRef: MutableRefObject<Map<string, IWidthDetail> | undefined>;
19
20
  columnsTotalWidthRef: MutableRefObject<number>;
20
21
  }
@@ -24,13 +24,13 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
24
24
 
25
25
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
 
27
- import React, { useState } from 'react';
28
- import usePrefixCls from "../../../_utils/hooks/usePrefixCls";
29
- import classnames from 'classnames';
30
27
  import { FoldDownFill, FoldUpFill } from '@aloudata/icons-react';
28
+ import classnames from 'classnames';
31
29
  import _ from 'lodash';
32
- import { getValidWidthByNumber } from "../../utils";
30
+ import React, { useState } from 'react';
33
31
  import message from "../../../message";
32
+ import usePrefixCls from "../../../_utils/hooks/usePrefixCls";
33
+ import { getValidWidthByNumber } from "../../utils";
34
34
  var ARRAY_FIRST_INDEX = 0;
35
35
 
36
36
  function TableHead(props) {
@@ -48,6 +48,7 @@ function TableHead(props) {
48
48
  setSortBy = props.setSortBy,
49
49
  _props$onChange = props.onChange,
50
50
  onChange = _props$onChange === void 0 ? function () {} : _props$onChange,
51
+ tableHeadRef = props.tableHeadRef,
51
52
  columnsWidthMapRef = props.columnsWidthMapRef,
52
53
  columnsTotalWidthRef = props.columnsTotalWidthRef;
53
54
  var prefixCls = usePrefixCls('', 'ald-table'); // 第一列的情况 默认或者恢复是需要用到
@@ -227,6 +228,7 @@ function TableHead(props) {
227
228
 
228
229
  return /*#__PURE__*/React.createElement("div", {
229
230
  className: "".concat(prefixCls, "-thead"),
231
+ ref: tableHeadRef,
230
232
  style: {
231
233
  width: columnsTotalWidthRef.current
232
234
  }
@@ -38,4 +38,5 @@ export interface ITableProps<RecordType> {
38
38
  rowClassName?: string;
39
39
  ellipsis?: boolean;
40
40
  rowKey?: string | ((row: RecordType) => string);
41
+ canSelected?: boolean;
41
42
  }
@@ -10,7 +10,6 @@
10
10
  flex-direction: column;
11
11
  width: 100%;
12
12
  overflow: hidden;
13
- user-select: none;
14
13
 
15
14
  &-page-loading {
16
15
  opacity: 0;
@@ -67,6 +66,7 @@
67
66
  font-weight: 600;
68
67
  background-color: @BG80;
69
68
  mix-blend-mode: multiply;
69
+ user-select: none;
70
70
 
71
71
  .ald-table-row {
72
72
  min-width: 9999px; // 防止拖动时的闪动
@@ -130,6 +130,9 @@
130
130
 
131
131
  .ald-table-cell {
132
132
  display: flex;
133
+ flex-shrink: 0;
134
+ box-sizing: border-box;
135
+ flex-grow: 0;
133
136
  align-items: center;
134
137
  padding-left: 16px;
135
138
  color: @NL0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aloudata/aloudata-design",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",
@@ -11,6 +11,7 @@
11
11
  "scripts": {
12
12
  "build": "father build",
13
13
  "build:watch": "father dev",
14
+ "changelog": "conventional-changelog -p custom-config -i CHANGELOG.md -s -r 0 -n ./changelog-option.js && git add CHANGELOG.md",
14
15
  "cmt": "zx ./scripts/createComponentTemplate.mjs",
15
16
  "dev": "dumi dev",
16
17
  "docs:build": "dumi build",
@@ -53,6 +54,10 @@
53
54
  "@aloudata/icons-react": "^0.1.12",
54
55
  "@aloudata/icons-svg": "0.1.7",
55
56
  "antd": "^5.3.1",
57
+ "compare-func": "^2.0.0",
58
+ "conventional-changelog": "^3.1.25",
59
+ "conventional-changelog-cli": "^2.2.2",
60
+ "conventional-changelog-custom-config": "^0.3.1",
56
61
  "memoize-one": "^6.0.0",
57
62
  "rc-menu": "^9.8.0",
58
63
  "react-table": "^7.8.0",
@@ -61,8 +66,8 @@
61
66
  "devDependencies": {
62
67
  "@babel/preset-env": "^7.20.2",
63
68
  "@babel/preset-react": "^7.18.6",
64
- "@commitlint/cli": "^17.1.2",
65
- "@commitlint/config-conventional": "^17.1.0",
69
+ "@commitlint/cli": "^17.5.1",
70
+ "@commitlint/config-conventional": "^17.4.4",
66
71
  "@testing-library/jest-dom": "^5.16.5",
67
72
  "@testing-library/react": "^13.4.0",
68
73
  "@types/jest": "^29.4.0",
@@ -73,7 +78,7 @@
73
78
  "dumi": "2.1.10",
74
79
  "eslint": "^8.23.0",
75
80
  "father": "^4.1.0",
76
- "husky": "^8.0.1",
81
+ "husky": "^8.0.3",
77
82
  "jest": "^29.4.2",
78
83
  "jest-environment-jsdom": "^29.4.2",
79
84
  "lint-staged": "^13.0.3",