material-react-table 2.0.0-beta.9 → 2.0.0-rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. package/README.md +36 -27
  2. package/dist/index.d.ts +54 -5
  3. package/dist/{esm/material-react-table.esm.js → index.esm.js} +56 -60
  4. package/dist/index.esm.js.map +1 -0
  5. package/dist/{cjs/index.js → index.js} +298 -208
  6. package/dist/index.js.map +1 -0
  7. package/locales/{ar.d.ts → ar/index.d.ts} +1 -1
  8. package/locales/ar/index.esm.d.ts +3 -0
  9. package/locales/{ar.js → ar/index.js} +2 -0
  10. package/locales/ar/package.json +6 -0
  11. package/locales/{az.d.ts → az/index.d.ts} +1 -1
  12. package/locales/az/index.esm.d.ts +3 -0
  13. package/locales/{az.js → az/index.js} +2 -0
  14. package/locales/az/package.json +6 -0
  15. package/locales/{bg.d.ts → bg/index.d.ts} +1 -1
  16. package/locales/bg/index.esm.d.ts +3 -0
  17. package/locales/{bg.js → bg/index.js} +2 -0
  18. package/locales/bg/package.json +6 -0
  19. package/locales/{cs.d.ts → cs/index.d.ts} +1 -1
  20. package/locales/cs/index.esm.d.ts +3 -0
  21. package/locales/{cs.js → cs/index.js} +2 -0
  22. package/locales/cs/package.json +6 -0
  23. package/locales/{da.d.ts → da/index.d.ts} +1 -1
  24. package/locales/da/index.esm.d.ts +3 -0
  25. package/locales/{da.js → da/index.js} +2 -0
  26. package/locales/da/package.json +6 -0
  27. package/locales/{de.d.ts → de/index.d.ts} +1 -1
  28. package/locales/de/index.esm.d.ts +3 -0
  29. package/locales/{de.js → de/index.js} +2 -0
  30. package/locales/de/package.json +6 -0
  31. package/locales/{en.d.ts → en/index.d.ts} +1 -1
  32. package/locales/en/index.esm.d.ts +3 -0
  33. package/locales/{en.js → en/index.js} +2 -0
  34. package/locales/en/package.json +6 -0
  35. package/locales/{es.d.ts → es/index.d.ts} +1 -1
  36. package/locales/es/index.esm.d.ts +3 -0
  37. package/locales/{es.js → es/index.js} +2 -0
  38. package/locales/es/package.json +6 -0
  39. package/locales/{et.d.ts → et/index.d.ts} +1 -1
  40. package/locales/et/index.esm.d.ts +3 -0
  41. package/locales/{et.js → et/index.js} +2 -0
  42. package/locales/et/package.json +6 -0
  43. package/locales/{fa.d.ts → fa/index.d.ts} +1 -1
  44. package/locales/fa/index.esm.d.ts +3 -0
  45. package/locales/{fa.js → fa/index.js} +2 -0
  46. package/locales/fa/package.json +6 -0
  47. package/locales/{fi.d.ts → fi/index.d.ts} +1 -1
  48. package/locales/fi/index.esm.d.ts +3 -0
  49. package/locales/{fi.js → fi/index.js} +2 -0
  50. package/locales/fi/package.json +6 -0
  51. package/locales/{fr.d.ts → fr/index.d.ts} +1 -1
  52. package/locales/fr/index.esm.d.ts +3 -0
  53. package/locales/{fr.js → fr/index.js} +2 -0
  54. package/locales/fr/package.json +6 -0
  55. package/locales/{hu.d.ts → hu/index.d.ts} +1 -1
  56. package/locales/hu/index.esm.d.ts +3 -0
  57. package/locales/{hu.js → hu/index.js} +2 -0
  58. package/locales/hu/package.json +6 -0
  59. package/locales/{hy.d.ts → hy/index.d.ts} +1 -1
  60. package/locales/hy/index.esm.d.ts +3 -0
  61. package/locales/{hy.js → hy/index.js} +2 -0
  62. package/locales/hy/package.json +6 -0
  63. package/locales/{id.d.ts → id/index.d.ts} +1 -1
  64. package/locales/id/index.esm.d.ts +3 -0
  65. package/locales/{id.js → id/index.js} +2 -0
  66. package/locales/id/package.json +6 -0
  67. package/locales/{it.d.ts → it/index.d.ts} +1 -1
  68. package/locales/it/index.esm.d.ts +3 -0
  69. package/locales/{it.js → it/index.js} +2 -0
  70. package/locales/it/package.json +6 -0
  71. package/locales/{ja.d.ts → ja/index.d.ts} +1 -1
  72. package/locales/ja/index.esm.d.ts +3 -0
  73. package/locales/{ja.js → ja/index.js} +2 -0
  74. package/locales/ja/package.json +6 -0
  75. package/locales/{ko.d.ts → ko/index.d.ts} +1 -1
  76. package/locales/ko/index.esm.d.ts +3 -0
  77. package/locales/{ko.js → ko/index.js} +2 -0
  78. package/locales/ko/package.json +6 -0
  79. package/locales/{nl.d.ts → nl/index.d.ts} +1 -1
  80. package/locales/nl/index.esm.d.ts +3 -0
  81. package/locales/{nl.js → nl/index.js} +2 -0
  82. package/locales/nl/package.json +6 -0
  83. package/locales/{no.d.ts → no/index.d.ts} +1 -1
  84. package/locales/no/index.esm.d.ts +3 -0
  85. package/locales/{no.js → no/index.js} +2 -0
  86. package/locales/no/package.json +6 -0
  87. package/locales/{np.d.ts → np/index.d.ts} +1 -1
  88. package/locales/np/index.esm.d.ts +3 -0
  89. package/locales/{np.js → np/index.js} +2 -0
  90. package/locales/np/package.json +6 -0
  91. package/locales/{pl.d.ts → pl/index.d.ts} +1 -1
  92. package/locales/pl/index.esm.d.ts +3 -0
  93. package/locales/{pl.js → pl/index.js} +2 -0
  94. package/locales/pl/package.json +6 -0
  95. package/locales/{pt.d.ts → pt/index.d.ts} +1 -1
  96. package/locales/pt/index.esm.d.ts +3 -0
  97. package/locales/{pt.js → pt/index.js} +2 -0
  98. package/locales/pt/package.json +6 -0
  99. package/locales/{pt-BR.d.ts → pt-BR/index.d.ts} +1 -1
  100. package/locales/pt-BR/index.esm.d.ts +3 -0
  101. package/locales/{pt-BR.js → pt-BR/index.js} +2 -0
  102. package/locales/pt-BR/package.json +6 -0
  103. package/locales/{ro.d.ts → ro/index.d.ts} +1 -1
  104. package/locales/ro/index.esm.d.ts +3 -0
  105. package/locales/{ro.js → ro/index.js} +2 -0
  106. package/locales/ro/package.json +6 -0
  107. package/locales/{ru.d.ts → ru/index.d.ts} +1 -1
  108. package/locales/ru/index.esm.d.ts +3 -0
  109. package/locales/{ru.js → ru/index.js} +2 -0
  110. package/locales/ru/package.json +6 -0
  111. package/locales/{sk.d.ts → sk/index.d.ts} +1 -1
  112. package/locales/sk/index.esm.d.ts +3 -0
  113. package/locales/{sk.js → sk/index.js} +2 -0
  114. package/locales/sk/package.json +6 -0
  115. package/locales/{sr-Cyrl-RS.d.ts → sr-Cyrl-RS/index.d.ts} +1 -1
  116. package/locales/sr-Cyrl-RS/index.esm.d.ts +3 -0
  117. package/locales/{sr-Cyrl-RS.js → sr-Cyrl-RS/index.js} +2 -0
  118. package/locales/sr-Cyrl-RS/package.json +6 -0
  119. package/locales/{sr-Latn-RS.d.ts → sr-Latn-RS/index.d.ts} +1 -1
  120. package/locales/sr-Latn-RS/index.esm.d.ts +3 -0
  121. package/locales/{sr-Latn-RS.js → sr-Latn-RS/index.js} +2 -0
  122. package/locales/sr-Latn-RS/package.json +6 -0
  123. package/locales/{sv.d.ts → sv/index.d.ts} +1 -1
  124. package/locales/sv/index.esm.d.ts +3 -0
  125. package/locales/{sv.js → sv/index.js} +2 -0
  126. package/locales/sv/package.json +6 -0
  127. package/locales/{tr.d.ts → tr/index.d.ts} +1 -1
  128. package/locales/tr/index.esm.d.ts +3 -0
  129. package/locales/{tr.js → tr/index.js} +2 -0
  130. package/locales/tr/package.json +6 -0
  131. package/locales/{uk.d.ts → uk/index.d.ts} +1 -1
  132. package/locales/uk/index.esm.d.ts +3 -0
  133. package/locales/{uk.js → uk/index.js} +2 -0
  134. package/locales/uk/package.json +6 -0
  135. package/locales/{vi.d.ts → vi/index.d.ts} +1 -1
  136. package/locales/vi/index.esm.d.ts +3 -0
  137. package/locales/{vi.js → vi/index.js} +2 -0
  138. package/locales/vi/package.json +6 -0
  139. package/locales/{zh-Hans.d.ts → zh-Hans/index.d.ts} +1 -1
  140. package/locales/zh-Hans/index.esm.d.ts +3 -0
  141. package/locales/{zh-Hans.mjs → zh-Hans/index.esm.js} +3 -3
  142. package/locales/{zh-Hans.js → zh-Hans/index.js} +5 -3
  143. package/locales/zh-Hans/package.json +6 -0
  144. package/locales/{zh-Hant.d.ts → zh-Hant/index.d.ts} +1 -1
  145. package/locales/zh-Hant/index.esm.d.ts +3 -0
  146. package/locales/{zh-Hant.js → zh-Hant/index.js} +2 -0
  147. package/locales/zh-Hant/package.json +6 -0
  148. package/package.json +25 -210
  149. package/src/body/MRT_TableBodyCell.tsx +2 -2
  150. package/src/column.utils.ts +17 -0
  151. package/src/hooks/index.ts +4 -0
  152. package/src/hooks/useMRT_TableOptions.ts +2 -2
  153. package/src/index.ts +1 -0
  154. package/src/inputs/MRT_EditCellTextField.tsx +20 -30
  155. package/src/inputs/MRT_FilterTextField.tsx +39 -51
  156. package/src/locales/zh-Hans.ts +3 -3
  157. package/src/table/MRT_TablePaper.tsx +6 -6
  158. package/src/types.ts +23 -4
  159. package/dist/cjs/index.js.map +0 -1
  160. package/dist/esm/material-react-table.esm.js.map +0 -1
  161. /package/locales/{ar.mjs → ar/index.esm.js} +0 -0
  162. /package/locales/{az.mjs → az/index.esm.js} +0 -0
  163. /package/locales/{bg.mjs → bg/index.esm.js} +0 -0
  164. /package/locales/{cs.mjs → cs/index.esm.js} +0 -0
  165. /package/locales/{da.mjs → da/index.esm.js} +0 -0
  166. /package/locales/{de.mjs → de/index.esm.js} +0 -0
  167. /package/locales/{en.mjs → en/index.esm.js} +0 -0
  168. /package/locales/{es.mjs → es/index.esm.js} +0 -0
  169. /package/locales/{et.mjs → et/index.esm.js} +0 -0
  170. /package/locales/{fa.mjs → fa/index.esm.js} +0 -0
  171. /package/locales/{fi.mjs → fi/index.esm.js} +0 -0
  172. /package/locales/{fr.mjs → fr/index.esm.js} +0 -0
  173. /package/locales/{hu.mjs → hu/index.esm.js} +0 -0
  174. /package/locales/{hy.mjs → hy/index.esm.js} +0 -0
  175. /package/locales/{id.mjs → id/index.esm.js} +0 -0
  176. /package/locales/{it.mjs → it/index.esm.js} +0 -0
  177. /package/locales/{ja.mjs → ja/index.esm.js} +0 -0
  178. /package/locales/{ko.mjs → ko/index.esm.js} +0 -0
  179. /package/locales/{nl.mjs → nl/index.esm.js} +0 -0
  180. /package/locales/{no.mjs → no/index.esm.js} +0 -0
  181. /package/locales/{np.mjs → np/index.esm.js} +0 -0
  182. /package/locales/{pl.mjs → pl/index.esm.js} +0 -0
  183. /package/locales/{pt.mjs → pt/index.esm.js} +0 -0
  184. /package/locales/{pt-BR.mjs → pt-BR/index.esm.js} +0 -0
  185. /package/locales/{ro.mjs → ro/index.esm.js} +0 -0
  186. /package/locales/{ru.mjs → ru/index.esm.js} +0 -0
  187. /package/locales/{sk.mjs → sk/index.esm.js} +0 -0
  188. /package/locales/{sr-Cyrl-RS.mjs → sr-Cyrl-RS/index.esm.js} +0 -0
  189. /package/locales/{sr-Latn-RS.mjs → sr-Latn-RS/index.esm.js} +0 -0
  190. /package/locales/{sv.mjs → sv/index.esm.js} +0 -0
  191. /package/locales/{tr.mjs → tr/index.esm.js} +0 -0
  192. /package/locales/{uk.mjs → uk/index.esm.js} +0 -0
  193. /package/locales/{vi.mjs → vi/index.esm.js} +0 -0
  194. /package/locales/{zh-Hant.mjs → zh-Hant/index.esm.js} +0 -0
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-beta.9",
2
+ "version": "2.0.0-rc.0",
3
3
  "license": "MIT",
4
4
  "name": "material-react-table",
5
5
  "description": "A fully featured Material UI V5 implementation of TanStack React Table V8, written from the ground up in TypeScript.",
@@ -24,192 +24,9 @@
24
24
  "url": "https://github.com/KevinVandy/material-react-table/issues"
25
25
  },
26
26
  "sideEffects": false,
27
- "main": "dist/cjs/index.js",
28
- "module": "dist/esm/material-react-table.esm.js",
27
+ "main": "dist/index.js",
28
+ "module": "dist/index.esm.js",
29
29
  "typings": "dist/index.d.ts",
30
- "exports": {
31
- ".": {
32
- "types": "./dist/index.d.ts",
33
- "import": "./dist/esm/material-react-table.esm.js",
34
- "default": "./dist/cjs/index.js"
35
- },
36
- "./package.json": "./package.json",
37
- "./locales/ar": {
38
- "import": "./locales/ar.mjs",
39
- "default": "./locales/ar.js",
40
- "types": "./locales/ar.d.ts"
41
- },
42
- "./locales/az": {
43
- "import": "./locales/az.mjs",
44
- "default": "./locales/az.js",
45
- "types": "./locales/az.d.ts"
46
- },
47
- "./locales/bg": {
48
- "import": "./locales/bg.mjs",
49
- "default": "./locales/bg.js",
50
- "types": "./locales/bg.d.ts"
51
- },
52
- "./locales/cs": {
53
- "import": "./locales/cs.mjs",
54
- "default": "./locales/cs.js",
55
- "types": "./locales/cs.d.ts"
56
- },
57
- "./locales/da": {
58
- "import": "./locales/da.mjs",
59
- "default": "./locales/da.js",
60
- "types": "./locales/da.d.ts"
61
- },
62
- "./locales/de": {
63
- "import": "./locales/de.mjs",
64
- "default": "./locales/de.js",
65
- "types": "./locales/de.d.ts"
66
- },
67
- "./locales/en": {
68
- "import": "./locales/en.mjs",
69
- "default": "./locales/en.js",
70
- "types": "./locales/en.d.ts"
71
- },
72
- "./locales/es": {
73
- "import": "./locales/es.mjs",
74
- "default": "./locales/es.js",
75
- "types": "./locales/es.d.ts"
76
- },
77
- "./locales/et": {
78
- "import": "./locales/et.mjs",
79
- "default": "./locales/et.js",
80
- "types": "./locales/et.d.ts"
81
- },
82
- "./locales/fa": {
83
- "import": "./locales/fa.mjs",
84
- "default": "./locales/fa.js",
85
- "types": "./locales/fa.d.ts"
86
- },
87
- "./locales/fi": {
88
- "import": "./locales/fi.mjs",
89
- "default": "./locales/fi.js",
90
- "types": "./locales/fi.d.ts"
91
- },
92
- "./locales/fr": {
93
- "import": "./locales/fr.mjs",
94
- "default": "./locales/fr.js",
95
- "types": "./locales/fr.d.ts"
96
- },
97
- "./locales/hu": {
98
- "import": "./locales/hu.mjs",
99
- "default": "./locales/hu.js",
100
- "types": "./locales/hu.d.ts"
101
- },
102
- "./locales/hy": {
103
- "import": "./locales/hy.mjs",
104
- "default": "./locales/hy.js",
105
- "types": "./locales/hy.d.ts"
106
- },
107
- "./locales/id": {
108
- "import": "./locales/id.mjs",
109
- "default": "./locales/id.js",
110
- "types": "./locales/id.d.ts"
111
- },
112
- "./locales/it": {
113
- "import": "./locales/it.mjs",
114
- "default": "./locales/it.js",
115
- "types": "./locales/it.d.ts"
116
- },
117
- "./locales/ja": {
118
- "import": "./locales/ja.mjs",
119
- "default": "./locales/ja.js",
120
- "types": "./locales/ja.d.ts"
121
- },
122
- "./locales/ko": {
123
- "import": "./locales/ko.mjs",
124
- "default": "./locales/ko.js",
125
- "types": "./locales/ko.d.ts"
126
- },
127
- "./locales/nl": {
128
- "import": "./locales/nl.mjs",
129
- "default": "./locales/nl.js",
130
- "types": "./locales/nl.d.ts"
131
- },
132
- "./locales/no": {
133
- "import": "./locales/no.mjs",
134
- "default": "./locales/no.js",
135
- "types": "./locales/no.d.ts"
136
- },
137
- "./locales/np": {
138
- "import": "./locales/np.mjs",
139
- "default": "./locales/np.js",
140
- "types": "./locales/np.d.ts"
141
- },
142
- "./locales/pl": {
143
- "import": "./locales/pl.mjs",
144
- "default": "./locales/pl.js",
145
- "types": "./locales/pl.d.ts"
146
- },
147
- "./locales/pt": {
148
- "import": "./locales/pt.mjs",
149
- "default": "./locales/pt.js",
150
- "types": "./locales/pt.d.ts"
151
- },
152
- "./locales/pt-BR": {
153
- "import": "./locales/pt-BR.mjs",
154
- "default": "./locales/pt-BR.js",
155
- "types": "./locales/pt-BR.d.ts"
156
- },
157
- "./locales/ro": {
158
- "import": "./locales/ro.mjs",
159
- "default": "./locales/ro.js",
160
- "types": "./locales/ro.d.ts"
161
- },
162
- "./locales/ru": {
163
- "import": "./locales/ru.mjs",
164
- "default": "./locales/ru.js",
165
- "types": "./locales/ru.d.ts"
166
- },
167
- "./locales/sk": {
168
- "import": "./locales/sk.mjs",
169
- "default": "./locales/sk.js",
170
- "types": "./locales/sk.d.ts"
171
- },
172
- "./locales/sr-Cyrl-RS": {
173
- "import": "./locales/sr-Cyrl-RS.mjs",
174
- "default": "./locales/sr-Cyrl-RS.js",
175
- "types": "./locales/sr-Cyrl-RS.d.ts"
176
- },
177
- "./locales/sr-Latn-RS": {
178
- "import": "./locales/sr-Latn-RS.mjs",
179
- "default": "./locales/sr-Latn-RS.js",
180
- "types": "./locales/sr-Latn-RS.d.ts"
181
- },
182
- "./locales/sv": {
183
- "import": "./locales/sv.mjs",
184
- "default": "./locales/sv.js",
185
- "types": "./locales/sv.d.ts"
186
- },
187
- "./locales/tr": {
188
- "import": "./locales/tr.mjs",
189
- "default": "./locales/tr.js",
190
- "types": "./locales/tr.d.ts"
191
- },
192
- "./locales/uk": {
193
- "import": "./locales/uk.mjs",
194
- "default": "./locales/uk.js",
195
- "types": "./locales/uk.d.ts"
196
- },
197
- "./locales/vi": {
198
- "import": "./locales/vi.mjs",
199
- "default": "./locales/vi.js",
200
- "types": "./locales/vi.d.ts"
201
- },
202
- "./locales/zh-Hans": {
203
- "import": "./locales/zh-Hans.mjs",
204
- "default": "./locales/zh-Hans.js",
205
- "types": "./locales/zh-Hans.d.ts"
206
- },
207
- "./locales/zh-Hant": {
208
- "import": "./locales/zh-Hant.mjs",
209
- "default": "./locales/zh-Hant.js",
210
- "types": "./locales/zh-Hant.d.ts"
211
- }
212
- },
213
30
  "files": [
214
31
  "dist",
215
32
  "locales",
@@ -217,11 +34,11 @@
217
34
  ],
218
35
  "size-limit": [
219
36
  {
220
- "path": "dist/cjs/index.js",
37
+ "path": "dist/index.js",
221
38
  "limit": "59 KB"
222
39
  },
223
40
  {
224
- "path": "dist/esm/material-react-table.esm.js",
41
+ "path": "dist/index.esm.js",
225
42
  "limit": "55 KB"
226
43
  }
227
44
  ],
@@ -233,7 +50,7 @@
233
50
  "build-locales": "pnpm lib:build-locales",
234
51
  "build-lib": "pnpm lib:build-lib",
235
52
  "dev": "pnpm lib:dev",
236
- "lib:build": "rm -rf dist && pnpm build-lib && pnpm build-locales && rm -rf dist/cjs/types dist/esm/types",
53
+ "lib:build": "rm -rf dist && pnpm build-lib && pnpm build-locales && rm -rf dist/types",
237
54
  "lib:build-locales": "rm -rf locales && node build-locales.mjs",
238
55
  "lib:build-lib": "rm -rf dist && rollup -c rollup.config.mjs && size-limit",
239
56
  "lib:dev": "rollup -c rollup.config.mjs --watch",
@@ -251,38 +68,36 @@
251
68
  "@faker-js/faker": "^8.2.0",
252
69
  "@mui/icons-material": "^5.14.14",
253
70
  "@mui/material": "^5.14.14",
254
- "@mui/x-date-pickers": "^6.16.2",
255
- "@rollup/plugin-babel": "^6.0.4",
256
- "@rollup/plugin-node-resolve": "^15.2.3",
71
+ "@mui/x-date-pickers": "^6.16.3",
257
72
  "@rollup/plugin-typescript": "^11.1.5",
258
- "@size-limit/preset-small-lib": "^9.0.0",
259
- "@storybook/addon-a11y": "^7.5.0",
260
- "@storybook/addon-essentials": "^7.5.0",
261
- "@storybook/addon-interactions": "^7.5.0",
262
- "@storybook/addon-links": "^7.5.0",
263
- "@storybook/addon-storysource": "^7.5.0",
264
- "@storybook/blocks": "^7.5.0",
265
- "@storybook/react": "^7.5.0",
266
- "@storybook/react-vite": "^7.5.0",
73
+ "@size-limit/preset-small-lib": "^10.0.1",
74
+ "@storybook/addon-a11y": "^7.5.1",
75
+ "@storybook/addon-essentials": "^7.5.1",
76
+ "@storybook/addon-interactions": "^7.5.1",
77
+ "@storybook/addon-links": "^7.5.1",
78
+ "@storybook/addon-storysource": "^7.5.1",
79
+ "@storybook/blocks": "^7.5.1",
80
+ "@storybook/react": "^7.5.1",
81
+ "@storybook/react-vite": "^7.5.1",
267
82
  "@storybook/testing-library": "^0.2.2",
268
- "@types/node": "^20.8.7",
269
- "@types/react": "^18.2.29",
83
+ "@types/node": "^20.8.8",
84
+ "@types/react": "^18.2.31",
270
85
  "@types/react-dom": "^18.2.14",
271
- "@typescript-eslint/eslint-plugin": "^6.8.0",
272
- "@typescript-eslint/parser": "^6.8.0",
86
+ "@typescript-eslint/eslint-plugin": "^6.9.0",
87
+ "@typescript-eslint/parser": "^6.9.0",
273
88
  "@vitejs/plugin-react": "^4.1.0",
274
- "eslint": "^8.51.0",
89
+ "eslint": "^8.52.0",
275
90
  "eslint-plugin-mui-path-imports": "^0.0.15",
276
91
  "eslint-plugin-perfectionist": "^2.2.0",
277
92
  "prop-types": "^15.8.1",
278
93
  "react": "^18.2.0",
279
94
  "react-dom": "^18.2.0",
280
95
  "react-is": "^18.2.0",
281
- "rollup": "^4.1.4",
96
+ "rollup": "^2.79.1",
282
97
  "rollup-plugin-dts": "^6.1.0",
283
98
  "rollup-plugin-peer-deps-external": "^2.2.4",
284
- "size-limit": "^9.0.0",
285
- "storybook": "^7.5.0",
99
+ "size-limit": "^10.0.1",
100
+ "storybook": "^7.5.1",
286
101
  "storybook-dark-mode": "^3.0.1",
287
102
  "tslib": "^2.6.2",
288
103
  "typescript": "^5.2.2",
@@ -300,7 +115,7 @@
300
115
  "dependencies": {
301
116
  "@tanstack/match-sorter-utils": "8.8.4",
302
117
  "@tanstack/react-table": "8.10.7",
303
- "@tanstack/react-virtual": "3.0.0-beta.66",
118
+ "@tanstack/react-virtual": "3.0.0-beta.68",
304
119
  "highlight-words": "1.2.2"
305
120
  }
306
121
  }
@@ -60,7 +60,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
60
60
  layoutMode,
61
61
  muiSkeletonProps,
62
62
  muiTableBodyCellProps,
63
- rowNumberMode,
63
+ rowNumberDisplayMode,
64
64
  },
65
65
  refs: { editInputRefs },
66
66
  setEditingCell,
@@ -281,7 +281,7 @@ export const MRT_TableBodyCell = <TData extends MRT_RowData>({
281
281
  {...skeletonProps}
282
282
  />
283
283
  ) : enableRowNumbers &&
284
- rowNumberMode === 'static' &&
284
+ rowNumberDisplayMode === 'static' &&
285
285
  column.id === 'mrt-row-numbers' ? (
286
286
  rowIndex + 1
287
287
  ) : column.id === 'mrt-row-drag' ? (
@@ -348,3 +348,20 @@ export function createMRTColumnHelper<
348
348
  group: (column) => column as MRT_GroupColumnDef<TData>,
349
349
  };
350
350
  }
351
+
352
+ export const getValueAndLabel = (
353
+ option: { label?: string; text?: string; value: string } | string,
354
+ ): { label: string; value: string } => {
355
+ let label: string = '';
356
+ let value: string = '';
357
+ if (option) {
358
+ if (typeof option !== 'object') {
359
+ label = option;
360
+ value = option;
361
+ } else {
362
+ label = option.label ?? option.text ?? option.value;
363
+ value = option.value ?? label;
364
+ }
365
+ }
366
+ return { label, value };
367
+ };
@@ -0,0 +1,4 @@
1
+ export * from './useMRT_DisplayColumns';
2
+ export * from './useMRT_Effects';
3
+ export * from './useMRT_TableInstance';
4
+ export * from './useMRT_TableOptions';
@@ -86,7 +86,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
86
86
  positionPagination = 'bottom',
87
87
  positionToolbarAlertBanner = 'top',
88
88
  positionToolbarDropZone = 'top',
89
- rowNumberMode = 'static',
89
+ rowNumberDisplayMode = 'static',
90
90
  rowPinningDisplayMode = 'sticky',
91
91
  selectAllMode = 'page',
92
92
  sortingFns,
@@ -194,7 +194,7 @@ export const useMRT_TableOptions: <TData extends MRT_RowData>(
194
194
  positionPagination,
195
195
  positionToolbarAlertBanner,
196
196
  positionToolbarDropZone,
197
- rowNumberMode,
197
+ rowNumberDisplayMode,
198
198
  rowPinningDisplayMode,
199
199
  selectAllMode,
200
200
  sortingFns: _sortingFns,
package/src/index.ts CHANGED
@@ -6,6 +6,7 @@ export * from './column.utils';
6
6
  export * from './filterFns';
7
7
  export * from './footer';
8
8
  export * from './head';
9
+ export * from './hooks';
9
10
  export * from './inputs';
10
11
  export * from './menus';
11
12
  export * from './modals';
@@ -7,7 +7,7 @@ import {
7
7
  import MenuItem from '@mui/material/MenuItem';
8
8
  import TextField from '@mui/material/TextField';
9
9
  import { type TextFieldProps } from '@mui/material/TextField';
10
- import { parseFromValuesOrFunc } from '../column.utils';
10
+ import { getValueAndLabel, parseFromValuesOrFunc } from '../column.utils';
11
11
  import {
12
12
  type MRT_Cell,
13
13
  type MRT_RowData,
@@ -62,9 +62,9 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
62
62
  //@ts-ignore
63
63
  row._valuesCache[column.id] = newValue;
64
64
  if (isCreating) {
65
- setCreatingRow({ ...row });
65
+ setCreatingRow(row);
66
66
  } else if (isEditing) {
67
- setEditingRow({ ...row });
67
+ setEditingRow(row);
68
68
  }
69
69
  };
70
70
 
@@ -150,33 +150,23 @@ export const MRT_EditCellTextField = <TData extends MRT_RowData>({
150
150
  onKeyDown={handleEnterKeyDown}
151
151
  >
152
152
  {textFieldProps.children ??
153
- columnDef?.editSelectOptions?.map(
154
- (option: { text: string; value: string } | string) => {
155
- let value: string;
156
- let text: string;
157
- if (typeof option !== 'object') {
158
- value = option;
159
- text = option;
160
- } else {
161
- value = option.value;
162
- text = option.text;
163
- }
164
- return (
165
- <MenuItem
166
- key={value}
167
- sx={{
168
- alignItems: 'center',
169
- display: 'flex',
170
- gap: '0.5rem',
171
- m: 0,
172
- }}
173
- value={value}
174
- >
175
- {text}
176
- </MenuItem>
177
- );
178
- },
179
- )}
153
+ columnDef?.editSelectOptions?.map((option) => {
154
+ const { label, value } = getValueAndLabel(option);
155
+ return (
156
+ <MenuItem
157
+ key={value}
158
+ sx={{
159
+ alignItems: 'center',
160
+ display: 'flex',
161
+ gap: '0.5rem',
162
+ m: 0,
163
+ }}
164
+ value={value}
165
+ >
166
+ {label}
167
+ </MenuItem>
168
+ );
169
+ })}
180
170
  </TextField>
181
171
  );
182
172
  };
@@ -21,7 +21,7 @@ import {
21
21
  DatePicker,
22
22
  type DatePickerProps,
23
23
  } from '@mui/x-date-pickers/DatePicker';
24
- import { parseFromValuesOrFunc } from '../column.utils';
24
+ import { getValueAndLabel, parseFromValuesOrFunc } from '../column.utils';
25
25
  import { MRT_FilterOptionMenu } from '../menus/MRT_FilterOptionMenu';
26
26
  import {
27
27
  type MRT_Header,
@@ -309,6 +309,7 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
309
309
  </label>
310
310
  ) : null,
311
311
  inputProps: {
312
+ 'aria-label': filterPlaceholder,
312
313
  autoComplete: 'new-password', // disable autocomplete and autofill
313
314
  disabled: !!filterChipLabel,
314
315
  sx: {
@@ -373,9 +374,13 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
373
374
  ) : isAutocompleteFilter ? (
374
375
  <Autocomplete
375
376
  freeSolo
376
- getOptionLabel={(option) => option}
377
- onChange={(_e, newValue) => handleChange(newValue)}
378
- options={dropdownOptions ?? []}
377
+ getOptionLabel={(option) => getValueAndLabel(option).label}
378
+ onChange={(_e, newValue) =>
379
+ handleChange(getValueAndLabel(newValue).value)
380
+ }
381
+ options={
382
+ dropdownOptions?.map((option) => getValueAndLabel(option)) ?? []
383
+ }
379
384
  {...autocompleteProps}
380
385
  renderInput={(builtinTextFieldProps) => (
381
386
  <TextField
@@ -407,19 +412,13 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
407
412
  ) : (
408
413
  <Box sx={{ display: 'flex', flexWrap: 'wrap', gap: '2px' }}>
409
414
  {(selected as string[])?.map((value) => {
410
- const selectedValue = dropdownOptions?.find((option) =>
411
- option instanceof Object
412
- ? option.value === value
413
- : option === value,
415
+ const selectedValue = dropdownOptions?.find(
416
+ (option) => getValueAndLabel(option).value === value,
414
417
  );
415
418
  return (
416
419
  <Chip
417
420
  key={value}
418
- label={
419
- selectedValue instanceof Object
420
- ? selectedValue.text
421
- : selectedValue
422
- }
421
+ label={getValueAndLabel(selectedValue).label}
423
422
  />
424
423
  );
425
424
  })}
@@ -438,44 +437,33 @@ export const MRT_FilterTextField = <TData extends MRT_RowData>({
438
437
  </MenuItem>,
439
438
  ...[
440
439
  textFieldProps.children ??
441
- dropdownOptions?.map(
442
- (option: { text: string; value: string } | string, index) => {
443
- if (!option) return '';
444
- let value: string;
445
- let text: string;
446
- if (typeof option !== 'object') {
447
- value = option;
448
- text = option;
449
- } else {
450
- value = option.value;
451
- text = option.text;
452
- }
453
- return (
454
- <MenuItem
455
- key={`${index}-${value}`}
456
- sx={{
457
- alignItems: 'center',
458
- display: 'flex',
459
- gap: '0.5rem',
460
- m: 0,
461
- }}
462
- value={value}
463
- >
464
- {isMultiSelectFilter && (
465
- <Checkbox
466
- checked={(
467
- (column.getFilterValue() ?? []) as string[]
468
- ).includes(value)}
469
- sx={{ mr: '0.5rem' }}
470
- />
471
- )}
472
- {text}{' '}
473
- {!columnDef.filterSelectOptions &&
474
- `(${facetedUniqueValues.get(value)})`}
475
- </MenuItem>
476
- );
477
- },
478
- ),
440
+ dropdownOptions?.map((option, index) => {
441
+ const { label, value } = getValueAndLabel(option);
442
+ return (
443
+ <MenuItem
444
+ key={`${index}-${value}`}
445
+ sx={{
446
+ alignItems: 'center',
447
+ display: 'flex',
448
+ gap: '0.5rem',
449
+ m: 0,
450
+ }}
451
+ value={value}
452
+ >
453
+ {isMultiSelectFilter && (
454
+ <Checkbox
455
+ checked={(
456
+ (column.getFilterValue() ?? []) as string[]
457
+ ).includes(value)}
458
+ sx={{ mr: '0.5rem' }}
459
+ />
460
+ )}
461
+ {label}{' '}
462
+ {!columnDef.filterSelectOptions &&
463
+ `(${facetedUniqueValues.get(value)})`}
464
+ </MenuItem>
465
+ );
466
+ }),
479
467
  ],
480
468
  ]}
481
469
  </TextField>
@@ -1,7 +1,7 @@
1
1
  import { type MRT_Localization } from '..';
2
2
 
3
3
  export const MRT_Localization_ZH_HANS: MRT_Localization = {
4
- actions: '动作',
4
+ actions: '操作',
5
5
  and: '与',
6
6
  cancel: '取消',
7
7
  changeFilterMode: '更改过滤模式',
@@ -12,7 +12,7 @@ export const MRT_Localization_ZH_HANS: MRT_Localization = {
12
12
  clickToCopy: '点击以复制',
13
13
  collapse: '折叠',
14
14
  collapseAll: '全部折叠',
15
- columnActions: '列动作',
15
+ columnActions: '列操作',
16
16
  copiedToClipboard: '已复制至剪贴板',
17
17
  dropToGroupBy: '拖放以按 {column} 分组',
18
18
  edit: '编辑',
@@ -64,7 +64,7 @@ export const MRT_Localization_ZH_HANS: MRT_Localization = {
64
64
  pinToRight: '固定至右边',
65
65
  resetColumnSize: '重置列大小',
66
66
  resetOrder: '重置排序',
67
- rowActions: '行动作',
67
+ rowActions: '行操作',
68
68
  rowNumber: '#',
69
69
  rowNumbers: '行号码',
70
70
  rowsPerPage: '每页行数',
@@ -27,7 +27,7 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
27
27
  } = table;
28
28
  const { isFullScreen } = getState();
29
29
 
30
- const tablePaperProps = {
30
+ const paperProps = {
31
31
  ...parseFromValuesOrFunc(muiTablePaperProps, { table }),
32
32
  ...rest,
33
33
  };
@@ -35,12 +35,12 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
35
35
  return (
36
36
  <Paper
37
37
  elevation={2}
38
- {...tablePaperProps}
38
+ {...paperProps}
39
39
  ref={(ref: HTMLDivElement) => {
40
40
  tablePaperRef.current = ref;
41
- if (tablePaperProps?.ref) {
41
+ if (paperProps?.ref) {
42
42
  //@ts-ignore
43
- tablePaperProps.ref.current = ref;
43
+ paperProps.ref.current = ref;
44
44
  }
45
45
  }}
46
46
  style={{
@@ -60,14 +60,14 @@ export const MRT_TablePaper = <TData extends MRT_RowData>({
60
60
  zIndex: 999,
61
61
  }
62
62
  : {}),
63
- ...tablePaperProps?.style,
63
+ ...paperProps?.style,
64
64
  }}
65
65
  sx={(theme) => ({
66
66
  backgroundColor: getMRTTheme(table, theme).baseBackgroundColor,
67
67
  backgroundImage: 'unset',
68
68
  overflow: 'hidden',
69
69
  transition: 'all 100ms ease-in-out',
70
- ...(parseFromValuesOrFunc(tablePaperProps?.sx, theme) as any),
70
+ ...(parseFromValuesOrFunc(paperProps?.sx, theme) as any),
71
71
  })}
72
72
  >
73
73
  {enableTopToolbar &&