mctable-react 1.0.11 → 1.0.13
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/README.md +11 -0
- package/dist/index.cjs +14 -11
- package/dist/index.js +14 -11
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -54,6 +54,17 @@ You can also pass `settings`, `license`, or `onReady` if you need deeper access
|
|
|
54
54
|
|
|
55
55
|
## Changelog
|
|
56
56
|
|
|
57
|
+
```
|
|
58
|
+
v1.0.13
|
|
59
|
+
- Upgrade to `mctable` core library `v1.4.5`
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
v1.0.12
|
|
64
|
+
- Upgrade to `mctable` core library `v1.4.4`
|
|
65
|
+
- useEffect for column visibility changes
|
|
66
|
+
```
|
|
67
|
+
|
|
57
68
|
```
|
|
58
69
|
v1.0.11
|
|
59
70
|
- Upgrade to `mctable` core library `v1.4.3`
|
package/dist/index.cjs
CHANGED
|
@@ -99,7 +99,7 @@ function __areColumnsEqual(prevColumns, nextColumns) {
|
|
|
99
99
|
}
|
|
100
100
|
return true;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function __getColumnSettingsOnlyChanges({
|
|
103
103
|
prevRecords,
|
|
104
104
|
prevColumns,
|
|
105
105
|
nextRecords,
|
|
@@ -107,12 +107,12 @@ function __getValidationOnlyChanges({
|
|
|
107
107
|
}) {
|
|
108
108
|
if (__stableSignature(prevRecords) !== __stableSignature(nextRecords)) return null;
|
|
109
109
|
if (prevColumns.length !== nextColumns.length) return null;
|
|
110
|
-
const
|
|
110
|
+
const columnSettingsChanges = [];
|
|
111
111
|
for (let index = 0; index < prevColumns.length; index++) {
|
|
112
112
|
const prevColumn = prevColumns[index];
|
|
113
113
|
const nextColumn = nextColumns[index];
|
|
114
|
-
const { validation: prevValidation, ...prevColumnWithoutValidation } = prevColumn;
|
|
115
|
-
const { validation: nextValidation, ...nextColumnWithoutValidation } = nextColumn;
|
|
114
|
+
const { validation: prevValidation, isVisible: prevVisibility, ...prevColumnWithoutValidation } = prevColumn;
|
|
115
|
+
const { validation: nextValidation, isVisible: nextVisibility, ...nextColumnWithoutValidation } = nextColumn;
|
|
116
116
|
if (__stableSignature(prevColumnWithoutValidation) !== __stableSignature(nextColumnWithoutValidation)) {
|
|
117
117
|
return null;
|
|
118
118
|
}
|
|
@@ -120,25 +120,28 @@ function __getValidationOnlyChanges({
|
|
|
120
120
|
const nextRequired = nextValidation?.required;
|
|
121
121
|
const prevTypeMatch = prevValidation?.typeMatch;
|
|
122
122
|
const nextTypeMatch = nextValidation?.typeMatch;
|
|
123
|
-
if (prevRequired === nextRequired && prevTypeMatch === nextTypeMatch) {
|
|
123
|
+
if (prevRequired === nextRequired && prevTypeMatch === nextTypeMatch && prevVisibility === nextVisibility) {
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
126
|
const settings = {
|
|
127
127
|
name: nextColumn.name
|
|
128
128
|
};
|
|
129
|
+
if (prevVisibility !== nextVisibility) {
|
|
130
|
+
settings.isVisible = nextVisibility;
|
|
131
|
+
}
|
|
129
132
|
if (prevRequired !== nextRequired) {
|
|
130
133
|
settings.required = nextRequired ?? null;
|
|
131
134
|
}
|
|
132
135
|
if (prevTypeMatch !== nextTypeMatch) {
|
|
133
136
|
settings.typeMatch = nextTypeMatch ?? null;
|
|
134
137
|
}
|
|
135
|
-
|
|
138
|
+
columnSettingsChanges.push({
|
|
136
139
|
position: index + 1,
|
|
137
140
|
settings
|
|
138
141
|
});
|
|
139
142
|
}
|
|
140
|
-
if (
|
|
141
|
-
return
|
|
143
|
+
if (columnSettingsChanges.length === 0) return null;
|
|
144
|
+
return columnSettingsChanges;
|
|
142
145
|
}
|
|
143
146
|
function __getWidthOnlyChanges({
|
|
144
147
|
prevRecords,
|
|
@@ -294,7 +297,7 @@ var McTableReact = React.forwardRef(
|
|
|
294
297
|
nextRecords,
|
|
295
298
|
nextColumns
|
|
296
299
|
});
|
|
297
|
-
const
|
|
300
|
+
const columnSettingsOnlyChanges = __getColumnSettingsOnlyChanges({
|
|
298
301
|
prevRecords,
|
|
299
302
|
prevColumns,
|
|
300
303
|
nextRecords,
|
|
@@ -304,8 +307,8 @@ var McTableReact = React.forwardRef(
|
|
|
304
307
|
for (const change of widthOnlyChanges) {
|
|
305
308
|
table.api.setContentColumnWidth(change);
|
|
306
309
|
}
|
|
307
|
-
} else if (
|
|
308
|
-
for (const change of
|
|
310
|
+
} else if (columnSettingsOnlyChanges) {
|
|
311
|
+
for (const change of columnSettingsOnlyChanges) {
|
|
309
312
|
table.api.updateContentColumnSettings(change.settings);
|
|
310
313
|
}
|
|
311
314
|
} else {
|
package/dist/index.js
CHANGED
|
@@ -62,7 +62,7 @@ function __areColumnsEqual(prevColumns, nextColumns) {
|
|
|
62
62
|
}
|
|
63
63
|
return true;
|
|
64
64
|
}
|
|
65
|
-
function
|
|
65
|
+
function __getColumnSettingsOnlyChanges({
|
|
66
66
|
prevRecords,
|
|
67
67
|
prevColumns,
|
|
68
68
|
nextRecords,
|
|
@@ -70,12 +70,12 @@ function __getValidationOnlyChanges({
|
|
|
70
70
|
}) {
|
|
71
71
|
if (__stableSignature(prevRecords) !== __stableSignature(nextRecords)) return null;
|
|
72
72
|
if (prevColumns.length !== nextColumns.length) return null;
|
|
73
|
-
const
|
|
73
|
+
const columnSettingsChanges = [];
|
|
74
74
|
for (let index = 0; index < prevColumns.length; index++) {
|
|
75
75
|
const prevColumn = prevColumns[index];
|
|
76
76
|
const nextColumn = nextColumns[index];
|
|
77
|
-
const { validation: prevValidation, ...prevColumnWithoutValidation } = prevColumn;
|
|
78
|
-
const { validation: nextValidation, ...nextColumnWithoutValidation } = nextColumn;
|
|
77
|
+
const { validation: prevValidation, isVisible: prevVisibility, ...prevColumnWithoutValidation } = prevColumn;
|
|
78
|
+
const { validation: nextValidation, isVisible: nextVisibility, ...nextColumnWithoutValidation } = nextColumn;
|
|
79
79
|
if (__stableSignature(prevColumnWithoutValidation) !== __stableSignature(nextColumnWithoutValidation)) {
|
|
80
80
|
return null;
|
|
81
81
|
}
|
|
@@ -83,25 +83,28 @@ function __getValidationOnlyChanges({
|
|
|
83
83
|
const nextRequired = nextValidation?.required;
|
|
84
84
|
const prevTypeMatch = prevValidation?.typeMatch;
|
|
85
85
|
const nextTypeMatch = nextValidation?.typeMatch;
|
|
86
|
-
if (prevRequired === nextRequired && prevTypeMatch === nextTypeMatch) {
|
|
86
|
+
if (prevRequired === nextRequired && prevTypeMatch === nextTypeMatch && prevVisibility === nextVisibility) {
|
|
87
87
|
continue;
|
|
88
88
|
}
|
|
89
89
|
const settings = {
|
|
90
90
|
name: nextColumn.name
|
|
91
91
|
};
|
|
92
|
+
if (prevVisibility !== nextVisibility) {
|
|
93
|
+
settings.isVisible = nextVisibility;
|
|
94
|
+
}
|
|
92
95
|
if (prevRequired !== nextRequired) {
|
|
93
96
|
settings.required = nextRequired ?? null;
|
|
94
97
|
}
|
|
95
98
|
if (prevTypeMatch !== nextTypeMatch) {
|
|
96
99
|
settings.typeMatch = nextTypeMatch ?? null;
|
|
97
100
|
}
|
|
98
|
-
|
|
101
|
+
columnSettingsChanges.push({
|
|
99
102
|
position: index + 1,
|
|
100
103
|
settings
|
|
101
104
|
});
|
|
102
105
|
}
|
|
103
|
-
if (
|
|
104
|
-
return
|
|
106
|
+
if (columnSettingsChanges.length === 0) return null;
|
|
107
|
+
return columnSettingsChanges;
|
|
105
108
|
}
|
|
106
109
|
function __getWidthOnlyChanges({
|
|
107
110
|
prevRecords,
|
|
@@ -257,7 +260,7 @@ var McTableReact = React.forwardRef(
|
|
|
257
260
|
nextRecords,
|
|
258
261
|
nextColumns
|
|
259
262
|
});
|
|
260
|
-
const
|
|
263
|
+
const columnSettingsOnlyChanges = __getColumnSettingsOnlyChanges({
|
|
261
264
|
prevRecords,
|
|
262
265
|
prevColumns,
|
|
263
266
|
nextRecords,
|
|
@@ -267,8 +270,8 @@ var McTableReact = React.forwardRef(
|
|
|
267
270
|
for (const change of widthOnlyChanges) {
|
|
268
271
|
table.api.setContentColumnWidth(change);
|
|
269
272
|
}
|
|
270
|
-
} else if (
|
|
271
|
-
for (const change of
|
|
273
|
+
} else if (columnSettingsOnlyChanges) {
|
|
274
|
+
for (const change of columnSettingsOnlyChanges) {
|
|
272
275
|
table.api.updateContentColumnSettings(change.settings);
|
|
273
276
|
}
|
|
274
277
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mctable-react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -67,6 +67,6 @@
|
|
|
67
67
|
"vite": "^5.4.12"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"mctable": "^1.4.
|
|
70
|
+
"mctable": "^1.4.5"
|
|
71
71
|
}
|
|
72
72
|
}
|