@arim-aisdc/public-components 2.3.17 → 2.3.19

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.
@@ -17,7 +17,7 @@ export declare const foramtBaseInfoField: (data: any, dataField: BaseInfoFieldTy
17
17
  value: any;
18
18
  field: string;
19
19
  label?: string;
20
- text: string | Element | JSX.Element;
20
+ text: string | JSX.Element | Element;
21
21
  units?: string;
22
22
  width?: string;
23
23
  labelWidth?: string;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  import './index.less';
3
3
  import { CenterModalPropsType } from './type';
4
- declare const _default: React.NamedExoticComponent<CenterModalPropsType>;
5
- export default _default;
4
+ declare const CenterModal: React.FC<CenterModalPropsType>;
5
+ export default CenterModal;
@@ -1,25 +1,27 @@
1
1
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["open", "title", "okText", "hasfooter", "footer", "width", "size", "renderContent", "handleConfirm", "handleCancel", "confirmLoading", "maskClosable", "bodyStyle", "afterClose"];
2
+ var _excluded = ["open", "title", "okText", "hasfooter", "footer", "width", "size", "renderContent", "handleConfirm", "handleCancel", "confirmLoading", "maskClosable", "bodyStyle", "afterClose", "enableResizing", "enableDragging", "minResizeWidth", "minResizeHeight"];
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
7
  function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
8
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
15
9
  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; }
16
10
  import { Modal } from 'antd';
17
- import React, { useRef, useState } from 'react';
18
- import Draggable from 'react-draggable';
11
+ import React, { useEffect, useMemo, useRef } from 'react';
12
+ import { Rnd } from 'react-rnd';
19
13
  import "./index.less";
20
14
  import { jsx as _jsx } from "react/jsx-runtime";
21
- // import 'ant-design-draggable-modal/dist/index.css';
22
-
15
+ var resizeHandleClasses = {
16
+ bottom: "resizeHandleBottom",
17
+ bottomLeft: "resizeHandleBottomLeft",
18
+ bottomRight: "resizeHandleBottomRight",
19
+ left: "resizeHandleLeft",
20
+ right: "resizeHandleRight",
21
+ top: "resizeHandleTop",
22
+ topLeft: "resizeHandleTopLeft",
23
+ topRight: "resizeHandleTopRight"
24
+ };
23
25
  var CenterModal = function CenterModal(_ref) {
24
26
  var _ref$open = _ref.open,
25
27
  open = _ref$open === void 0 ? false : _ref$open,
@@ -43,114 +45,114 @@ var CenterModal = function CenterModal(_ref) {
43
45
  _ref$bodyStyle = _ref.bodyStyle,
44
46
  bodyStyle = _ref$bodyStyle === void 0 ? {
45
47
  position: 'relative'
46
- // padding: '24px 32px',
47
48
  } : _ref$bodyStyle,
48
49
  afterClose = _ref.afterClose,
50
+ _ref$enableResizing = _ref.enableResizing,
51
+ enableResizing = _ref$enableResizing === void 0 ? true : _ref$enableResizing,
52
+ _ref$enableDragging = _ref.enableDragging,
53
+ enableDragging = _ref$enableDragging === void 0 ? true : _ref$enableDragging,
54
+ _ref$minResizeWidth = _ref.minResizeWidth,
55
+ minResizeWidth = _ref$minResizeWidth === void 0 ? 200 : _ref$minResizeWidth,
56
+ _ref$minResizeHeight = _ref.minResizeHeight,
57
+ minResizeHeight = _ref$minResizeHeight === void 0 ? 200 : _ref$minResizeHeight,
49
58
  rest = _objectWithoutProperties(_ref, _excluded);
50
- var _useState = useState(false),
51
- _useState2 = _slicedToArray(_useState, 2),
52
- disabled = _useState2[0],
53
- setDisabled = _useState2[1];
54
- var _useState3 = useState({
55
- left: 0,
56
- top: 0,
57
- bottom: 0,
58
- right: 0
59
- }),
60
- _useState4 = _slicedToArray(_useState3, 2),
61
- bounds = _useState4[0],
62
- setBounds = _useState4[1];
63
- var draggleRef = useRef(null);
64
- var domList = document.querySelectorAll('.modal-header');
65
- var id = 'modal-header';
66
- if ((domList === null || domList === void 0 ? void 0 : domList.length) > 0) {
67
- id = "modal-header-".concat(domList === null || domList === void 0 ? void 0 : domList.length);
68
- }
69
- var _onStart = function onStart(event, uiData) {
70
- var _window, _draggleRef$current;
71
- // eslint-disable-next-line no-unsafe-optional-chaining
72
- var _window$document$docu = (_window = window) === null || _window === void 0 || (_window = _window.document) === null || _window === void 0 ? void 0 : _window.documentElement,
73
- clientWidth = _window$document$docu.clientWidth,
74
- clientHeight = _window$document$docu.clientHeight;
75
- var modalHeader = document.getElementById(id);
76
- var targetRect = draggleRef === null || draggleRef === void 0 || (_draggleRef$current = draggleRef.current) === null || _draggleRef$current === void 0 ? void 0 : _draggleRef$current.getBoundingClientRect();
77
- console.log(modalHeader, event.target);
78
- if (modalHeader && !modalHeader.contains(event.target)) {
79
- setBounds({
80
- left: 0,
81
- right: 0,
82
- top: 0,
83
- bottom: 0
84
- });
85
- return;
59
+ var modalRef = useRef(null);
60
+ var modalBodyRef = useRef(null);
61
+ var startSizeRef = useRef();
62
+ var titleElementRef = useRef();
63
+ var dragHandleClassName = useMemo(function () {
64
+ var _titleElementRef$curr;
65
+ return "drag-handle-".concat((_titleElementRef$curr = titleElementRef.current) === null || _titleElementRef$curr === void 0 ? void 0 : _titleElementRef$curr.length);
66
+ }, [titleElementRef.current]);
67
+ useEffect(function () {
68
+ var titleElements = document.querySelectorAll('.modal-header');
69
+ if (titleElements) {
70
+ titleElementRef.current = titleElements;
71
+ }
72
+ }, []);
73
+ useEffect(function () {
74
+ var modal = modalBodyRef.current;
75
+ if (modal) {
76
+ var rect = modal.getBoundingClientRect();
77
+ console.log('rect', rect.width, rect.height);
78
+ startSizeRef.current = {
79
+ width: rect.width,
80
+ height: rect.height
81
+ };
86
82
  }
87
- setBounds({
88
- left: -(targetRect === null || targetRect === void 0 ? void 0 : targetRect.left) + (uiData === null || uiData === void 0 ? void 0 : uiData.x),
89
- right: clientWidth - ((targetRect === null || targetRect === void 0 ? void 0 : targetRect.right) - (uiData === null || uiData === void 0 ? void 0 : uiData.x)),
90
- top: -(targetRect === null || targetRect === void 0 ? void 0 : targetRect.top) + (uiData === null || uiData === void 0 ? void 0 : uiData.y),
91
- bottom: clientHeight - ((targetRect === null || targetRect === void 0 ? void 0 : targetRect.bottom) - (uiData === null || uiData === void 0 ? void 0 : uiData.y))
92
- });
93
- };
83
+ }, [modalBodyRef.current]);
94
84
  return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
95
85
  className: "centerModal".concat(size),
86
+ wrapClassName: 'wrapClassName',
96
87
  title: /*#__PURE__*/_jsx("div", {
97
- id: id,
98
- className: "modal-header",
88
+ className: "modal-header ".concat(dragHandleClassName),
99
89
  style: {
100
90
  width: '100%',
101
91
  cursor: 'move'
102
92
  },
103
- onMouseOver: function onMouseOver() {
104
- if (disabled) {
105
- setDisabled(false);
106
- }
107
- },
108
- onMouseOut: function onMouseOut() {
109
- setDisabled(false);
110
- }
111
- // fix eslintjsx-a11y/mouse-events-have-key-events
112
- // https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/master/docs/rules/mouse-events-have-key-events.md
113
- ,
114
- onFocus: function onFocus() {},
115
- onBlur: function onBlur() {}
116
- // end
117
- ,
118
93
  children: title
119
94
  }),
120
95
  open: open,
121
- width: width,
122
- maskClosable: maskClosable,
123
96
  onOk: handleConfirm,
124
97
  onCancel: handleCancel,
125
98
  okText: okText,
126
99
  footer: hasfooter ? footer : null,
127
- centered: true,
100
+ centered: false,
128
101
  closeIcon: /*#__PURE__*/_jsx("i", {
129
- className: "iconfont-other icon-other-close"
102
+ className: "iconfont-other icon-other-close",
103
+ children: " "
130
104
  }),
131
105
  destroyOnClose: true,
132
106
  confirmLoading: confirmLoading,
107
+ maskClosable: maskClosable,
108
+ afterClose: afterClose,
133
109
  styles: {
134
- body: bodyStyle
110
+ body: _objectSpread(_objectSpread({}, bodyStyle), {}, {
111
+ overflow: 'auto'
112
+ })
135
113
  },
136
- afterClose: afterClose,
114
+ width: width,
137
115
  modalRender: function modalRender(modal) {
138
- return /*#__PURE__*/_jsx(Draggable, {
139
- disabled: disabled,
140
- bounds: bounds,
141
- handle: "#".concat(id),
142
- onStart: function onStart(event, uiData) {
143
- return _onStart(event, uiData);
116
+ return /*#__PURE__*/_jsx(Rnd, {
117
+ ref: modalRef,
118
+ enableResizing: enableResizing,
119
+ disableDragging: !enableDragging,
120
+ resizeHandleWrapperClass: "resizeHandles",
121
+ resizeHandleClasses: resizeHandleClasses,
122
+ dragHandleClassName: dragHandleClassName,
123
+ default: {
124
+ x: 0,
125
+ y: 0,
126
+ width: 'fit-content',
127
+ height: 'fit-content'
128
+ },
129
+ onResizeStop: function onResizeStop(e, direction, ref, delta, position) {
130
+ var _ref$querySelector;
131
+ if (direction === 'left' || direction === 'right') return;
132
+ var modalContent = (_ref$querySelector = ref.querySelector('.ant-modal-content')) === null || _ref$querySelector === void 0 ? void 0 : _ref$querySelector.getBoundingClientRect();
133
+ var resizeContent = ref === null || ref === void 0 ? void 0 : ref.getBoundingClientRect();
134
+ var height = modalContent.height;
135
+ if (modalContent.height !== resizeContent.height) {
136
+ ref.style.height = height + "px";
137
+ }
138
+ },
139
+ style: {
140
+ display: 'flex',
141
+ flexDirection: 'column',
142
+ overflow: 'hidden' // 添加overflow隐藏
144
143
  },
145
- children: /*#__PURE__*/_jsx("div", {
146
- children: modal
147
- })
144
+ minWidth: minResizeWidth,
145
+ minHeight: minResizeHeight,
146
+ children: modal
148
147
  });
149
148
  }
150
149
  }, rest), {}, {
151
- children: renderContent ? renderContent : /*#__PURE__*/_jsx("div", {
152
- className: "gantt-leftbar-defalutItem"
150
+ children: /*#__PURE__*/_jsx("div", {
151
+ ref: modalBodyRef,
152
+ children: renderContent || /*#__PURE__*/_jsx("div", {
153
+ className: "gantt-leftbar-defalutItem"
154
+ })
153
155
  })
154
156
  }));
155
157
  };
156
- export default /*#__PURE__*/React.memo(CenterModal);
158
+ export default CenterModal;
@@ -1,13 +1,33 @@
1
- .custom-light-modal {
2
- top: 0 !important;
3
- left: 0 !important;
4
- height: 'none' !important;
5
- }
1
+ .centerModal {
2
+ .resizeHandles div {
3
+ pointer-events: auto;
4
+ z-index: 1002;
5
+ }
6
+
7
+ .ant-modal-content {
8
+ display: flex;
9
+ flex-direction: column;
10
+
11
+ .ant-modal-body {
12
+ flex: 1;
13
+ overflow: auto;
14
+ }
15
+ }
6
16
 
7
- .ant-design-draggable-modal-resize-handle {
8
- display: none;
17
+ .react-draggable {
18
+ position: relative !important;
19
+ }
9
20
 
10
- .ant-design-draggable-modal .ant-design-draggable-modal-title {
11
- padding: 0;
21
+ .resizeHandleBottomLeft, .resizeHandleBottomRight, .resizeHandleTopLeft, .resizeHandleTopRight {
22
+ width: 40px !important;
23
+ height: 40px !important;
12
24
  }
25
+
26
+ // .resizeHandleLeft, .resizeHandleRight {
27
+ // width: 20px !important;
28
+ // }
29
+
30
+ // .resizeHandleTop, .resizeHandleBottom {
31
+ // height: 20px !important;
32
+ // }
13
33
  }
@@ -21,4 +21,12 @@ export interface CenterModalPropsType extends ModalProps {
21
21
  confirmLoading?: boolean;
22
22
  bodyStyle?: object;
23
23
  afterClose?: () => void;
24
+ enableResizing?: boolean;
25
+ enableDragging?: boolean;
26
+ minResizeWidth?: string | number;
27
+ minResizeHeight?: string | number;
24
28
  }
29
+ export type ModalSizeType = {
30
+ width: number | string;
31
+ height: number | string;
32
+ };
@@ -689,7 +689,11 @@ var CustomForm = function CustomForm(_ref, ref) {
689
689
  xl: 12,
690
690
  xxl: 24
691
691
  },
692
- className: "customFormRow"
692
+ className: "customFormRow",
693
+ style: {
694
+ marginLeft: 0,
695
+ marginRight: 0
696
+ }
693
697
  // justify="space-between"
694
698
  ,
695
699
  children: [data.map(function (item, index) {
@@ -1,13 +1,13 @@
1
1
  import { TableMaxColumnType } from "../../type";
2
- export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
3
- export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
4
- export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
5
- export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
2
+ export declare const numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
3
+ export declare const stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
4
+ export declare const numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
5
+ export declare const timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
6
6
  declare const customSortFns: {
7
- numberSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
8
- stringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
9
- timeSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
10
- numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 0 | 1 | -1;
7
+ numberSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
8
+ stringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
9
+ timeSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
10
+ numberOrStringSortFn: (rowA: any, rowB: any, columnId: string) => 1 | 0 | -1;
11
11
  };
12
12
  export default customSortFns;
13
13
  export type SortFnType = keyof typeof customSortFns | undefined;
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { ColumnSizing } from '../TableMax';
3
+ interface UseColumnWidthProps {
4
+ tableContentRef: React.RefObject<HTMLDivElement>;
5
+ tableId: string;
6
+ tableKeyPrefixCls: string;
7
+ columnVisibleConfig?: Record<string, boolean>;
8
+ tableKey: string;
9
+ }
10
+ export declare const useColumnWidth: ({ tableContentRef, tableId, tableKeyPrefixCls, columnVisibleConfig, tableKey, }: UseColumnWidthProps) => {
11
+ columnSizing: ColumnSizing;
12
+ allColumnCount: number;
13
+ onColumnSizingChange: (data: any) => void;
14
+ tableContainerWidth: number;
15
+ initializeColumnSizing: (columns: any) => void;
16
+ handleVisibleConfigChange: (key: any, value: any) => void;
17
+ };
18
+ export {};