mctable-react 1.0.0 → 1.0.1
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/LICENSE.md +30 -0
- package/README.md +2 -0
- package/dist/index.d.ts +7 -1
- package/dist/index.js +36 -4
- package/package.json +3 -3
package/LICENSE.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# mctable-react License
|
|
2
|
+
|
|
3
|
+
**By using this software, you agree to the terms and conditions outlined below.**
|
|
4
|
+
|
|
5
|
+
You are not allowed to modify, distribute, or reverse-engineer the software.
|
|
6
|
+
Free usage is permitted only for non-commercial purposes.
|
|
7
|
+
For commercial use, please contact sales@mormitech.com for licensing information.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
|
10
|
+
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
|
11
|
+
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL,
|
|
12
|
+
DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
14
|
+
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
|
|
16
|
+
> Copyright (c) 2025-2026 Mormitech. All rights reserved.
|
|
17
|
+
|
|
18
|
+
[mormitech.com/mctable/react](mormitech.com/mctable/react)
|
|
19
|
+
|
|
20
|
+
## Dependencies
|
|
21
|
+
|
|
22
|
+
This project uses the following dependencies:
|
|
23
|
+
|
|
24
|
+
- mctable - [LICENSE](https://mormitech.com/mctable/license)
|
|
25
|
+
|
|
26
|
+
Copyright 2019 JS Foundation and other contributors
|
|
27
|
+
|
|
28
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
29
|
+
|
|
30
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
package/README.md
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { MctColumn, MctInitSettings, MctLicense, McTable, MctApi } from 'mctable';
|
|
2
|
+
import { MctColumn, MctInitSettings, MctLicense, McTable, MctRow, MctApi } from 'mctable';
|
|
3
3
|
export { McTableCtor, MctApi, MctColumn, MctColumnData, MctInitSettings, MctLicense, MctRow, MctScrollPosition } from 'mctable';
|
|
4
4
|
|
|
5
5
|
type McTableReactHandle = {
|
|
@@ -12,6 +12,12 @@ type McTableReactProps = {
|
|
|
12
12
|
settings?: MctInitSettings;
|
|
13
13
|
license?: MctLicense;
|
|
14
14
|
onReady?: (table: McTable) => void;
|
|
15
|
+
onColumnResizeStart?: (currentColumnWidth: number, column: MctColumn) => void;
|
|
16
|
+
onColumnResizing?: (currentColumnWidth: number, column: MctColumn) => void;
|
|
17
|
+
onColumnResizeEnd?: (newColumnWidth: number, column: MctColumn) => void;
|
|
18
|
+
onRowResizeStart?: (currentRowHeight: number, row: MctRow) => void;
|
|
19
|
+
onRowResizing?: (currentRowHeight: number, row: MctRow) => void;
|
|
20
|
+
onRowResizeEnd?: (newRowHeight: number, row: MctRow) => void;
|
|
15
21
|
className?: string;
|
|
16
22
|
style?: React.CSSProperties;
|
|
17
23
|
};
|
package/dist/index.js
CHANGED
|
@@ -51,6 +51,12 @@ var McTableReact = React.forwardRef(
|
|
|
51
51
|
settings,
|
|
52
52
|
license,
|
|
53
53
|
onReady,
|
|
54
|
+
onColumnResizeStart,
|
|
55
|
+
onColumnResizing,
|
|
56
|
+
onColumnResizeEnd,
|
|
57
|
+
onRowResizeStart,
|
|
58
|
+
onRowResizing,
|
|
59
|
+
onRowResizeEnd,
|
|
54
60
|
className,
|
|
55
61
|
style
|
|
56
62
|
}, ref) => {
|
|
@@ -67,6 +73,32 @@ var McTableReact = React.forwardRef(
|
|
|
67
73
|
columnsSig: __stableSignature(columns ?? [])
|
|
68
74
|
});
|
|
69
75
|
const [readyTick, setReadyTick] = React.useState(0);
|
|
76
|
+
const effectiveSettings = React.useMemo(() => {
|
|
77
|
+
const hasAnyResizeCallback = onColumnResizeStart !== void 0 || onColumnResizing !== void 0 || onColumnResizeEnd !== void 0 || onRowResizeStart !== void 0 || onRowResizing !== void 0 || onRowResizeEnd !== void 0;
|
|
78
|
+
if (!settings && !hasAnyResizeCallback) return void 0;
|
|
79
|
+
if (!hasAnyResizeCallback) return settings;
|
|
80
|
+
const nextEvents = {
|
|
81
|
+
...settings?.events ?? {}
|
|
82
|
+
};
|
|
83
|
+
if (onColumnResizeStart !== void 0) nextEvents.onColumnResizeStart = onColumnResizeStart;
|
|
84
|
+
if (onColumnResizing !== void 0) nextEvents.onColumnResizing = onColumnResizing;
|
|
85
|
+
if (onColumnResizeEnd !== void 0) nextEvents.onColumnResizeEnd = onColumnResizeEnd;
|
|
86
|
+
if (onRowResizeStart !== void 0) nextEvents.onRowResizeStart = onRowResizeStart;
|
|
87
|
+
if (onRowResizing !== void 0) nextEvents.onRowResizing = onRowResizing;
|
|
88
|
+
if (onRowResizeEnd !== void 0) nextEvents.onRowResizeEnd = onRowResizeEnd;
|
|
89
|
+
return {
|
|
90
|
+
...settings ?? {},
|
|
91
|
+
events: nextEvents
|
|
92
|
+
};
|
|
93
|
+
}, [
|
|
94
|
+
settings,
|
|
95
|
+
onColumnResizeStart,
|
|
96
|
+
onColumnResizing,
|
|
97
|
+
onColumnResizeEnd,
|
|
98
|
+
onRowResizeStart,
|
|
99
|
+
onRowResizing,
|
|
100
|
+
onRowResizeEnd
|
|
101
|
+
]);
|
|
70
102
|
React.useImperativeHandle(
|
|
71
103
|
ref,
|
|
72
104
|
() => ({
|
|
@@ -92,7 +124,7 @@ var McTableReact = React.forwardRef(
|
|
|
92
124
|
container,
|
|
93
125
|
records: initialRecords,
|
|
94
126
|
columns: initialColumns,
|
|
95
|
-
settings,
|
|
127
|
+
settings: effectiveSettings,
|
|
96
128
|
license
|
|
97
129
|
});
|
|
98
130
|
tableRef.current = instance;
|
|
@@ -151,9 +183,9 @@ var McTableReact = React.forwardRef(
|
|
|
151
183
|
React.useEffect(() => {
|
|
152
184
|
const table = tableRef.current;
|
|
153
185
|
if (!table) return;
|
|
154
|
-
if (!
|
|
155
|
-
table.api.updateSettings(
|
|
156
|
-
}, [
|
|
186
|
+
if (!effectiveSettings) return;
|
|
187
|
+
table.api.updateSettings(effectiveSettings);
|
|
188
|
+
}, [effectiveSettings]);
|
|
157
189
|
const combinedClassName = ["mctable-react", className].filter(Boolean).join(" ");
|
|
158
190
|
const combinedStyle = {
|
|
159
191
|
width: "100%",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mctable-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
},
|
|
28
28
|
"keywords": [],
|
|
29
29
|
"author": "",
|
|
30
|
-
"license": "
|
|
30
|
+
"license": "SEE LICENSE.md",
|
|
31
31
|
"peerDependencies": {
|
|
32
32
|
"react": "^18.0.0",
|
|
33
33
|
"react-dom": "^18.0.0"
|
|
@@ -44,6 +44,6 @@
|
|
|
44
44
|
"vite": "^5.4.12"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"mctable": "^1.2.
|
|
47
|
+
"mctable": "^1.2.2"
|
|
48
48
|
}
|
|
49
49
|
}
|