mctable-react 1.0.2 → 1.0.3

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.
Files changed (3) hide show
  1. package/README.md +11 -4
  2. package/dist/index.js +14 -9
  3. package/package.json +30 -9
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # mctable-react
2
2
 
3
- React wrapper for the `mctable` package.
3
+ React wrapper for the [`mctable`](https://www.npmjs.com/package/mctable) package.
4
4
 
5
- Base mctable: https://mormitech.com/mctable/
5
+ mctable home page, docs, usage and demo: https://mormitech.com/mctable/
6
6
 
7
- mctable-react: https://mormitech.com/mctable/react
7
+ mctable-react home page: https://mormitech.com/mctable/react
8
8
 
9
9
  ## Install
10
10
 
@@ -21,7 +21,6 @@ Make sure the table container has an explicit size (height/width) so the table c
21
21
  ```tsx
22
22
  import * as React from "react";
23
23
  import { McTable } from "mctable-react";
24
- import "mctable-react/McTable.less";
25
24
 
26
25
  const columns = [
27
26
  { name: "id", title: "ID", type: "number" },
@@ -51,3 +50,11 @@ export function UsersTable() {
51
50
  ```
52
51
 
53
52
  You can also pass `settings`, `license`, or `onReady` if you need deeper access to the underlying `mctable` instance.
53
+
54
+
55
+ ## Changelog
56
+
57
+ ```
58
+ v1.0.3
59
+ - Aligned with `mctable` core library `v1.2.3`
60
+ ```
package/dist/index.js CHANGED
@@ -42,7 +42,7 @@ function __stableSignature(value) {
42
42
  return "[unserializable]";
43
43
  }
44
44
  }
45
- function __getInitialWidthOnlyChanges({
45
+ function __getWidthOnlyChanges({
46
46
  prevRecords,
47
47
  prevColumns,
48
48
  nextRecords,
@@ -54,15 +54,15 @@ function __getInitialWidthOnlyChanges({
54
54
  for (let index = 0; index < prevColumns.length; index++) {
55
55
  const prevColumn = prevColumns[index];
56
56
  const nextColumn = nextColumns[index];
57
- const { initialWidth: _prevInitialWidth, ...prevColumnWithoutInitialWidth } = prevColumn;
58
- const { initialWidth: _nextInitialWidth, ...nextColumnWithoutInitialWidth } = nextColumn;
59
- if (__stableSignature(prevColumnWithoutInitialWidth) !== __stableSignature(nextColumnWithoutInitialWidth)) {
57
+ const { width: _prevWidth, ...prevColumnWithoutWidth } = prevColumn;
58
+ const { width: _nextWidth, ...nextColumnWithoutWidth } = nextColumn;
59
+ if (__stableSignature(prevColumnWithoutWidth) !== __stableSignature(nextColumnWithoutWidth)) {
60
60
  return null;
61
61
  }
62
- if (prevColumn.initialWidth !== nextColumn.initialWidth) {
62
+ if (prevColumn.width !== nextColumn.width) {
63
63
  widthChanges.push({
64
64
  position: index + 1,
65
- width: nextColumn.initialWidth ?? "reset"
65
+ width: nextColumn.width ?? "reset"
66
66
  });
67
67
  }
68
68
  }
@@ -204,14 +204,14 @@ var McTableReact = React.forwardRef(
204
204
  columnsCount: nextColumnsCount,
205
205
  columnsSig: nextColumnsSig
206
206
  };
207
- const initialWidthOnlyChanges = __getInitialWidthOnlyChanges({
207
+ const widthOnlyChanges = __getWidthOnlyChanges({
208
208
  prevRecords,
209
209
  prevColumns,
210
210
  nextRecords,
211
211
  nextColumns
212
212
  });
213
- if (initialWidthOnlyChanges) {
214
- for (const change of initialWidthOnlyChanges) {
213
+ if (widthOnlyChanges) {
214
+ for (const change of widthOnlyChanges) {
215
215
  table.api.setContentColumnWidth(change);
216
216
  }
217
217
  } else {
@@ -233,6 +233,11 @@ var McTableReact = React.forwardRef(
233
233
  const combinedStyle = {
234
234
  width: "100%",
235
235
  height: "100%",
236
+ display: "flex",
237
+ flex: "1 1 auto",
238
+ minWidth: 0,
239
+ minHeight: 0,
240
+ alignItems: "stretch",
236
241
  ...style
237
242
  };
238
243
  return /* @__PURE__ */ jsx("div", { ref: containerRef, className: combinedClassName, style: combinedStyle });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mctable-react",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -9,13 +9,10 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
- },
13
- "./McTable.less": "./McTable.less"
12
+ }
14
13
  },
15
14
  "files": [
16
- "dist",
17
- "README.md",
18
- "McTable.less"
15
+ "dist"
19
16
  ],
20
17
  "scripts": {
21
18
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -25,8 +22,32 @@
25
22
  "prepare": "npm run build",
26
23
  "prepack": "npm run build"
27
24
  },
28
- "keywords": [],
29
- "author": "",
25
+ "keywords": [
26
+ "canvas",
27
+ "table",
28
+ "grid",
29
+ "html5",
30
+ "excel",
31
+ "spreadsheet",
32
+ "editable",
33
+ "table editor",
34
+ "writeback",
35
+ "validation",
36
+ "performance",
37
+ "customizable",
38
+ "change tracking",
39
+ "Power BI",
40
+ "typescript",
41
+ "javascript",
42
+ "API",
43
+ "fetch more",
44
+ "dropdown",
45
+ "undo",
46
+ "redo",
47
+ "filter",
48
+ "filtering"
49
+ ],
50
+ "author": "Mormitech",
30
51
  "license": "SEE LICENSE.md",
31
52
  "peerDependencies": {
32
53
  "react": "^18.0.0",
@@ -44,6 +65,6 @@
44
65
  "vite": "^5.4.12"
45
66
  },
46
67
  "dependencies": {
47
- "mctable": "^1.2.2"
68
+ "mctable": "^1.2.3"
48
69
  }
49
70
  }