@pinnacle0/web-ui 0.3.44 → 0.3.45
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.
- package/core/Form/index.less +0 -15
- package/core/VirtualTable/index.d.ts +2 -1
- package/core/VirtualTable/index.js +7 -6
- package/core/VirtualTable/index.js.map +1 -1
- package/package.json +1 -3
- package/admin/RichEditor/index.d.ts +0 -34
- package/admin/RichEditor/index.js +0 -104
- package/admin/RichEditor/index.js.map +0 -1
- package/admin/RichEditor/index.less +0 -6
package/core/Form/index.less
CHANGED
|
@@ -79,17 +79,6 @@
|
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
// For braft editor
|
|
83
|
-
.bf-container {
|
|
84
|
-
border: 1px solid #d7d7d7;
|
|
85
|
-
border-radius: 4px;
|
|
86
|
-
width: 780px;
|
|
87
|
-
|
|
88
|
-
.bf-content {
|
|
89
|
-
height: 350px;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
82
|
&.has-error {
|
|
94
83
|
textarea,
|
|
95
84
|
input,
|
|
@@ -99,10 +88,6 @@
|
|
|
99
88
|
.ant-upload {
|
|
100
89
|
border-color: #f5222d !important;
|
|
101
90
|
}
|
|
102
|
-
|
|
103
|
-
.bf-container {
|
|
104
|
-
border-color: #f5222d;
|
|
105
|
-
}
|
|
106
91
|
}
|
|
107
92
|
|
|
108
93
|
&.width-fill {
|
|
@@ -24,7 +24,8 @@ export interface VirtualTableProps<RowType extends object> {
|
|
|
24
24
|
rowKey?: StringKey<RowType> | "index";
|
|
25
25
|
headerHeight?: number;
|
|
26
26
|
rowExpand?: VirtualTableRowExpand<RowType>;
|
|
27
|
+
horizontalScrollBarSize?: number;
|
|
27
28
|
}
|
|
28
|
-
export declare const VirtualTable: (<RowType extends object>({ columns, rowHeight, scrollY, dataSource, className, rowClassName, loading, emptyPlaceholder, rowSelection, onRowClick, scrollX, rowExpand, rowKey, headerHeight, }: VirtualTableProps<RowType>) => JSX.Element) & {
|
|
29
|
+
export declare const VirtualTable: (<RowType extends object>({ columns, rowHeight, scrollY, dataSource, className, rowClassName, loading, emptyPlaceholder, rowSelection, onRowClick, scrollX, rowExpand, rowKey, headerHeight, horizontalScrollBarSize, }: VirtualTableProps<RowType>) => JSX.Element) & {
|
|
29
30
|
displayName: string;
|
|
30
31
|
};
|
|
@@ -33,24 +33,25 @@ import { TableRow } from "./TableRow";
|
|
|
33
33
|
import { TableHeader } from "./TableHeader";
|
|
34
34
|
import "./index.less";
|
|
35
35
|
export var VirtualTable = Object.assign(function (_a) {
|
|
36
|
-
var columns = _a.columns, rowHeight = _a.rowHeight, scrollY = _a.scrollY, dataSource = _a.dataSource, className = _a.className, rowClassName = _a.rowClassName, loading = _a.loading, emptyPlaceholder = _a.emptyPlaceholder, rowSelection = _a.rowSelection, onRowClick = _a.onRowClick, scrollX = _a.scrollX, rowExpand = _a.rowExpand, _b = _a.rowKey, rowKey = _b === void 0 ? "index" : _b, _c = _a.headerHeight, headerHeight = _c === void 0 ? 50 : _c;
|
|
36
|
+
var columns = _a.columns, rowHeight = _a.rowHeight, scrollY = _a.scrollY, dataSource = _a.dataSource, className = _a.className, rowClassName = _a.rowClassName, loading = _a.loading, emptyPlaceholder = _a.emptyPlaceholder, rowSelection = _a.rowSelection, onRowClick = _a.onRowClick, scrollX = _a.scrollX, rowExpand = _a.rowExpand, _b = _a.rowKey, rowKey = _b === void 0 ? "index" : _b, _c = _a.headerHeight, headerHeight = _c === void 0 ? 50 : _c, _d = _a.horizontalScrollBarSize, horizontalScrollBarSize = _d === void 0 ? 20 : _d;
|
|
37
37
|
var size = dataSource.length;
|
|
38
38
|
var scrollContentRef = React.useRef(null);
|
|
39
39
|
var headersRef = React.useRef(null);
|
|
40
40
|
var estimateSize = React.useCallback(function () { return rowHeight; }, [rowHeight]);
|
|
41
41
|
var overscan = rowExpand ? Math.floor(scrollY / rowHeight) : 1;
|
|
42
|
-
var
|
|
42
|
+
var _e = useVirtual({
|
|
43
43
|
size: size,
|
|
44
44
|
parentRef: scrollContentRef,
|
|
45
45
|
estimateSize: estimateSize,
|
|
46
46
|
overscan: overscan,
|
|
47
|
-
}), virtualItems =
|
|
47
|
+
}), virtualItems = _e.virtualItems, totalSize = _e.totalSize;
|
|
48
48
|
var transformedColumns = useTransformColumn({ columns: columns, dataSource: dataSource, rowSelection: rowSelection, rowKey: rowKey, rowExpand: rowExpand });
|
|
49
49
|
var isScrollable = totalSize > scrollY;
|
|
50
|
-
var
|
|
51
|
-
var
|
|
50
|
+
var _f = useLayout({ headersRef: headersRef, scrollContentRef: scrollContentRef, isScrollable: isScrollable, columns: transformedColumns }), scrollBarSize = _f.scrollBarSize, stickyPosition = _f.stickyPosition, columnWidths = _f.columnWidths, isScrollToEdge = _f.isScrollToEdge, isScrollToLeft = _f.isScrollToLeft, isScrollToRight = _f.isScrollToRight;
|
|
51
|
+
var isHorizontalScrollable = scrollContentRef.current ? columnWidths.reduce(function (acc, curr) { return acc + curr; }, 0) > scrollContentRef.current.clientWidth : false;
|
|
52
|
+
var tableHeight = scrollY + headerHeight + (isHorizontalScrollable ? horizontalScrollBarSize : 0);
|
|
53
|
+
var tableBodyHeight = scrollY + (isHorizontalScrollable ? horizontalScrollBarSize : 0);
|
|
52
54
|
var emptyElement = emptyPlaceholder || "暂无数据";
|
|
53
|
-
var _e = useLayout({ headersRef: headersRef, scrollContentRef: scrollContentRef, isScrollable: isScrollable, columns: transformedColumns }), scrollBarSize = _e.scrollBarSize, stickyPosition = _e.stickyPosition, columnWidths = _e.columnWidths, isScrollToEdge = _e.isScrollToEdge, isScrollToLeft = _e.isScrollToLeft, isScrollToRight = _e.isScrollToRight;
|
|
54
55
|
var lastShownColumnIndex = React.useMemo(function () { return transformedColumns.length - 1 - __spreadArray([], __read(transformedColumns), false).reverse().findIndex(function (_) { return _.display !== "hidden"; }); }, [transformedColumns]);
|
|
55
56
|
// handle the edge position & shadow of the fixed columns
|
|
56
57
|
var getFixedColumnClassNames = React.useCallback(function (fixed, columnIndex) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VirtualTable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAG1C,OAAO,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/VirtualTable/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAG1C,OAAO,cAAc,CAAC;AA2BtB,MAAM,CAAC,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CACrC,UAAkC,EAgBL;QAfzB,OAAO,aAAA,EACP,SAAS,eAAA,EACT,OA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|
"dependencies": {
|
|
27
27
|
"@ant-design/icons": "4.7.0",
|
|
28
28
|
"antd": "4.22.0",
|
|
29
|
-
"braft-editor": "2.3.9",
|
|
30
29
|
"classnames": "2.3.1",
|
|
31
30
|
"moment": "2.29.4",
|
|
32
31
|
"rc-resize-observer": "1.2.0",
|
|
@@ -44,7 +43,6 @@
|
|
|
44
43
|
"@testing-library/jest-dom": "5.16.4",
|
|
45
44
|
"@testing-library/react": "13.3.0",
|
|
46
45
|
"@testing-library/user-event": "14.3.0",
|
|
47
|
-
"@types/draft-js": "0.11.9",
|
|
48
46
|
"@types/history": "4.7.11",
|
|
49
47
|
"@types/react": "18.0.15",
|
|
50
48
|
"@types/react-dom": "18.0.6",
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { EditorState } from "braft-editor";
|
|
3
|
-
import type { ControlledFormValue } from "../../internal/type";
|
|
4
|
-
import type { UploaderProps } from "../../util/UploadUtil/type";
|
|
5
|
-
import "braft-editor/dist/index.css";
|
|
6
|
-
import "./index.less";
|
|
7
|
-
/**
|
|
8
|
-
* onChange/value is of the HTML content.
|
|
9
|
-
* If the HTML content is only empty rows (e.g: pure <p/>), onChange also emit "".
|
|
10
|
-
*
|
|
11
|
-
* CAVEAT:
|
|
12
|
-
* This component is storing the editor state internally (un-controlled).
|
|
13
|
-
* The props.value only represents the initial value.
|
|
14
|
-
* Because createEditorState must only be created only ONCE, in the constructor.
|
|
15
|
-
* Therefore, we cannot create new editor state every time based on current props.value.
|
|
16
|
-
*
|
|
17
|
-
* Ref: https://www.yuque.com/braft-editor/be/lzwpnr#1bbbb204
|
|
18
|
-
*/
|
|
19
|
-
export interface Props<SuccessResponseType, ErrorResponseType> extends ControlledFormValue<string>, UploaderProps<SuccessResponseType, ErrorResponseType> {
|
|
20
|
-
imageURLParser: (response: SuccessResponseType) => string;
|
|
21
|
-
}
|
|
22
|
-
interface State {
|
|
23
|
-
editorState: EditorState;
|
|
24
|
-
}
|
|
25
|
-
export declare class RichEditor<SuccessResponseType, ErrorResponseType> extends React.PureComponent<Props<SuccessResponseType, ErrorResponseType>, State> {
|
|
26
|
-
static displayName: string;
|
|
27
|
-
private readonly editorControls;
|
|
28
|
-
private readonly imageControls;
|
|
29
|
-
private readonly mediaConfig;
|
|
30
|
-
constructor(props: Props<SuccessResponseType, ErrorResponseType>);
|
|
31
|
-
onChange: (editorState: EditorState) => void;
|
|
32
|
-
render(): JSX.Element;
|
|
33
|
-
}
|
|
34
|
-
export {};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
var __extends = (this && this.__extends) || (function () {
|
|
2
|
-
var extendStatics = function (d, b) {
|
|
3
|
-
extendStatics = Object.setPrototypeOf ||
|
|
4
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
5
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
6
|
-
return extendStatics(d, b);
|
|
7
|
-
};
|
|
8
|
-
return function (d, b) {
|
|
9
|
-
if (typeof b !== "function" && b !== null)
|
|
10
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
11
|
-
extendStatics(d, b);
|
|
12
|
-
function __() { this.constructor = d; }
|
|
13
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
14
|
-
};
|
|
15
|
-
})();
|
|
16
|
-
import React from "react";
|
|
17
|
-
import BraftEditor from "braft-editor";
|
|
18
|
-
import { LocaleUtil } from "../../util/LocaleUtil";
|
|
19
|
-
import "braft-editor/dist/index.css";
|
|
20
|
-
import "./index.less";
|
|
21
|
-
import { UploadUtil } from "../../util/UploadUtil";
|
|
22
|
-
var RichEditor = /** @class */ (function (_super) {
|
|
23
|
-
__extends(RichEditor, _super);
|
|
24
|
-
function RichEditor(props) {
|
|
25
|
-
var _this = _super.call(this, props) || this;
|
|
26
|
-
// API reference: https://www.yuque.com/braft-editor/be/gz44tn
|
|
27
|
-
_this.editorControls = [
|
|
28
|
-
"font-size",
|
|
29
|
-
"text-align",
|
|
30
|
-
"text-color",
|
|
31
|
-
"bold",
|
|
32
|
-
"italic",
|
|
33
|
-
"underline",
|
|
34
|
-
"strike-through",
|
|
35
|
-
"separator",
|
|
36
|
-
"list-ul",
|
|
37
|
-
"list-ol",
|
|
38
|
-
"separator",
|
|
39
|
-
"link",
|
|
40
|
-
"media",
|
|
41
|
-
"separator",
|
|
42
|
-
"remove-styles",
|
|
43
|
-
];
|
|
44
|
-
_this.imageControls = [];
|
|
45
|
-
_this.mediaConfig = {
|
|
46
|
-
pasteImage: false,
|
|
47
|
-
accepts: {
|
|
48
|
-
image: "image/png,image/jpeg,image/gif,image/svg",
|
|
49
|
-
video: false,
|
|
50
|
-
audio: false,
|
|
51
|
-
},
|
|
52
|
-
externals: {
|
|
53
|
-
image: false,
|
|
54
|
-
audio: false,
|
|
55
|
-
video: false,
|
|
56
|
-
embed: false,
|
|
57
|
-
},
|
|
58
|
-
uploadFn: function (params) {
|
|
59
|
-
var _a = _this.props, formField = _a.formField, uploadURL = _a.uploadURL, imageURLParser = _a.imageURLParser, onUploadFailure = _a.onUploadFailure, onUploadSuccess = _a.onUploadSuccess;
|
|
60
|
-
var file = params.file, success = params.success, progress = params.progress;
|
|
61
|
-
UploadUtil.createRequest({
|
|
62
|
-
uploadURL: uploadURL,
|
|
63
|
-
file: file,
|
|
64
|
-
formField: formField,
|
|
65
|
-
onSuccess: function (logEntry, response) {
|
|
66
|
-
var imageURL = imageURLParser(response);
|
|
67
|
-
success({
|
|
68
|
-
url: imageURL,
|
|
69
|
-
meta: {
|
|
70
|
-
id: imageURL,
|
|
71
|
-
title: "",
|
|
72
|
-
alt: "image",
|
|
73
|
-
// Below are for video settings, not available here
|
|
74
|
-
loop: true,
|
|
75
|
-
autoPlay: true,
|
|
76
|
-
controls: true,
|
|
77
|
-
poster: "",
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
onUploadSuccess === null || onUploadSuccess === void 0 ? void 0 : onUploadSuccess(logEntry, response);
|
|
81
|
-
},
|
|
82
|
-
onError: onUploadFailure,
|
|
83
|
-
onProgress: progress,
|
|
84
|
-
});
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
_this.onChange = function (editorState) {
|
|
88
|
-
_this.setState({ editorState: editorState });
|
|
89
|
-
var onChange = _this.props.onChange;
|
|
90
|
-
var textContent = editorState.toText().trim();
|
|
91
|
-
onChange(textContent === "" ? "" : editorState.toHTML());
|
|
92
|
-
};
|
|
93
|
-
_this.state = { editorState: BraftEditor.createEditorState(_this.props.value) };
|
|
94
|
-
return _this;
|
|
95
|
-
}
|
|
96
|
-
RichEditor.prototype.render = function () {
|
|
97
|
-
var editorState = this.state.editorState;
|
|
98
|
-
return (React.createElement(BraftEditor, { language: LocaleUtil.current(), controls: this.editorControls, media: this.mediaConfig, imageControls: this.imageControls, value: editorState, stripPastedStyles: true, onChange: this.onChange }));
|
|
99
|
-
};
|
|
100
|
-
RichEditor.displayName = "RichEditor";
|
|
101
|
-
return RichEditor;
|
|
102
|
-
}(React.PureComponent));
|
|
103
|
-
export { RichEditor };
|
|
104
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/admin/RichEditor/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,WAAW,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAGjD,OAAO,6BAA6B,CAAC;AACrC,OAAO,cAAc,CAAC;AACtB,OAAO,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAsBjD;IAAwE,8BAAyE;IAkE7I,oBAAY,KAAoD;QAAhE,YACI,kBAAM,KAAK,CAAC,SAEf;QAlED,8DAA8D;QAC7C,oBAAc,GAAkB;YAC7C,WAAW;YAC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