@ecoding/components.antd 0.4.32 → 0.5.0

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.
@@ -15,14 +15,14 @@ import { DndContext, PointerSensor, useSensor } from '@dnd-kit/core';
15
15
  import { arrayMove, SortableContext, useSortable, rectSortingStrategy, } from '@dnd-kit/sortable';
16
16
  import { CSS } from '@dnd-kit/utilities';
17
17
  import Toast from "../../core/toast";
18
- const DraggableUploadListItem = ({ originNode, file }) => {
18
+ const DraggableUploadListItem = ({ originNode, file, disabled }) => {
19
19
  const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
20
20
  id: file.uid,
21
21
  });
22
22
  const style = {
23
23
  transform: CSS.Translate.toString(transform),
24
24
  transition,
25
- cursor: 'move',
25
+ cursor: disabled ? 'not-allowed' : 'move',
26
26
  height: '102px',
27
27
  width: '102px',
28
28
  };
@@ -230,9 +230,9 @@ const MultipleImgUpload = (props) => {
230
230
  !((_b = props.opts) === null || _b === void 0 ? void 0 : _b.maxW) ? null : (React.createElement("span", null, i18n ? `${i18n.$t("global.maxW", "最大宽")}:${props.opts.maxW}` : `最大宽:${props.opts.maxW}`)),
231
231
  !((_c = props.opts) === null || _c === void 0 ? void 0 : _c.minH) ? null : (React.createElement("span", null, i18n ? `${i18n.$t("global.minH", "最小高")}:${props.opts.minH}` : `最小高:${props.opts.minH}`)),
232
232
  !((_d = props.opts) === null || _d === void 0 ? void 0 : _d.maxH) ? null : (React.createElement("span", null, i18n ? `${i18n.$t("global.maxH", "最大高")}:${props.opts.maxH}` : `最大高:${props.opts.maxH}`))))) : null)), type: "warning", showIcon: true })),
233
- React.createElement(DndContext, { sensors: [sensor], onDragEnd: onDragEnd },
233
+ React.createElement(DndContext, { sensors: disabled ? [] : [sensor], onDragEnd: disabled ? undefined : onDragEnd },
234
234
  React.createElement(SortableContext, { items: imgList === null || imgList === void 0 ? void 0 : imgList.map((i) => i.uid), strategy: rectSortingStrategy },
235
- React.createElement(Upload, { listType: "picture-card", fileList: imgList, action: action, beforeUpload: beforeUpload, onPreview: handlePreview, onChange: handleChange, onRemove: handleRemove, name: name, data: props.data, multiple: true, disabled: disabled, withCredentials: true, itemRender: (originNode, file) => (React.createElement(DraggableUploadListItem, { originNode: originNode, file: file })) }, maxCount == 0 ? uploadButton : maxCount && imgList.length >= maxCount ? null : uploadButton),
235
+ React.createElement(Upload, { listType: "picture-card", fileList: imgList, action: action, beforeUpload: beforeUpload, onPreview: handlePreview, onChange: handleChange, onRemove: handleRemove, name: name, data: props.data, multiple: true, disabled: disabled, withCredentials: true, itemRender: (originNode, file) => (React.createElement(DraggableUploadListItem, { originNode: originNode, file: file, disabled: disabled })) }, maxCount == 0 ? uploadButton : maxCount && imgList.length >= maxCount ? null : uploadButton),
236
236
  previewImage && (React.createElement(Img, { wrapperStyle: { display: 'none' }, preview: {
237
237
  visible: previewOpen,
238
238
  onVisibleChange: (visible) => setPreviewOpen(visible),
@@ -100,7 +100,7 @@ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchIn
100
100
  useEffect(() => {
101
101
  if (tableRef.current && innerColumns.length > 0 && scrollY == '100%') {
102
102
  const thead = tableRef.current.querySelector('thead');
103
- setTimeout(() => {
103
+ const runCalcHeight = () => {
104
104
  if (offsetY && offsetY > 0) {
105
105
  if (tableRef.current) {
106
106
  setY(tableRef.current.clientHeight - offsetY);
@@ -111,9 +111,17 @@ const TablePro = ({ className, header, buttonArea, filterArea, filters, searchIn
111
111
  setY(tableRef.current.clientHeight - (thead.clientHeight && thead.clientHeight + (pagination ? 64 : 20)));
112
112
  }
113
113
  }
114
- }, 100);
114
+ };
115
+ if (typeof window !== 'undefined' && typeof window.requestAnimationFrame === 'function') {
116
+ window.requestAnimationFrame(() => {
117
+ setTimeout(runCalcHeight, 100);
118
+ });
119
+ }
120
+ else {
121
+ setTimeout(runCalcHeight, 300);
122
+ }
115
123
  }
116
- }, [header, loading, innerColumns]);
124
+ }, [header, loading, innerColumns, offsetY]);
117
125
  useEffect(() => {
118
126
  if (selectKeys && selectKeys.length > 0 && !isEqual(selectedRowKeys, selectKeys)) {
119
127
  setSelectedRowKeys(selectKeys);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.4.32",
3
+ "version": "0.5.0",
4
4
  "author": "cxc",
5
5
  "homepage": "",
6
6
  "license": "MIT",
@@ -47,5 +47,5 @@
47
47
  "antd": "^6.0.0",
48
48
  "axios": "^1.1.2"
49
49
  },
50
- "gitHead": "cf8c284162bf81352e97c8ebc6e2d00741939543"
50
+ "gitHead": "5d9c405730775cb0373521dd2532b1918719eaa3"
51
51
  }