@tanstack/angular-table 9.0.0-beta.1 → 9.0.0-beta.11
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/dist/fesm2022/tanstack-angular-table.mjs +4 -47
- package/dist/fesm2022/tanstack-angular-table.mjs.map +1 -1
- package/dist/types/tanstack-angular-table.d.ts +8 -14
- package/package.json +3 -3
- package/skills/angular/angular-rendering-directives/SKILL.md +4 -4
- package/skills/angular/angular-rendering-directives/references/create-table-hook-registries.md +4 -4
- package/skills/angular/client-to-server/SKILL.md +22 -21
- package/skills/angular/compose-with-tanstack-query/SKILL.md +17 -13
- package/skills/angular/compose-with-tanstack-store/SKILL.md +16 -8
- package/skills/angular/compose-with-tanstack-virtual/SKILL.md +1 -2
- package/skills/angular/getting-started/SKILL.md +34 -43
- package/skills/angular/getting-started/references/feature-row-model-mapping.md +9 -6
- package/skills/angular/migrate-v8-to-v9/SKILL.md +43 -40
- package/skills/angular/migrate-v8-to-v9/references/v8-to-v9-mapping.md +21 -14
- package/skills/angular/production-readiness/SKILL.md +40 -37
- package/skills/angular/table-state/SKILL.md +19 -26
- package/skills/angular/table-state/references/external-atoms-and-app-hook.md +8 -7
- package/src/helpers/cell.ts +6 -2
- package/src/helpers/createTableHook.ts +11 -12
- package/src/helpers/header.ts +4 -2
- package/src/helpers/table.ts +4 -2
- package/src/injectTable.ts +8 -71
|
@@ -1187,43 +1187,6 @@ function angularReactivity(injector) {
|
|
|
1187
1187
|
};
|
|
1188
1188
|
}
|
|
1189
1189
|
|
|
1190
|
-
function createStateProxy(table) {
|
|
1191
|
-
const getSnapshot = () => {
|
|
1192
|
-
const snapshot = {};
|
|
1193
|
-
const stateKeys = Object.keys(table.initialState);
|
|
1194
|
-
for (const key of stateKeys) {
|
|
1195
|
-
snapshot[key] = table.atoms[key].get();
|
|
1196
|
-
}
|
|
1197
|
-
return snapshot;
|
|
1198
|
-
};
|
|
1199
|
-
const target = {};
|
|
1200
|
-
return new Proxy(target, {
|
|
1201
|
-
get(target, prop, receiver) {
|
|
1202
|
-
if (prop === 'toJSON') {
|
|
1203
|
-
return getSnapshot;
|
|
1204
|
-
}
|
|
1205
|
-
if (typeof prop === 'string' && prop in table.initialState) {
|
|
1206
|
-
return table.atoms[prop]?.get();
|
|
1207
|
-
}
|
|
1208
|
-
return Reflect.get(target, prop, receiver);
|
|
1209
|
-
},
|
|
1210
|
-
has(_, prop) {
|
|
1211
|
-
return typeof prop === 'string' && prop in table.initialState;
|
|
1212
|
-
},
|
|
1213
|
-
ownKeys() {
|
|
1214
|
-
return Reflect.ownKeys(table.initialState);
|
|
1215
|
-
},
|
|
1216
|
-
getOwnPropertyDescriptor(_, prop) {
|
|
1217
|
-
if (typeof prop !== 'string' || !(prop in table.initialState)) {
|
|
1218
|
-
return undefined;
|
|
1219
|
-
}
|
|
1220
|
-
return {
|
|
1221
|
-
enumerable: true,
|
|
1222
|
-
configurable: true,
|
|
1223
|
-
};
|
|
1224
|
-
},
|
|
1225
|
-
});
|
|
1226
|
-
}
|
|
1227
1190
|
/**
|
|
1228
1191
|
* Creates and returns an Angular-reactive table instance.
|
|
1229
1192
|
*
|
|
@@ -1285,24 +1248,19 @@ function injectTable(options) {
|
|
|
1285
1248
|
const injector = inject(Injector);
|
|
1286
1249
|
const ngZone = inject(NgZone);
|
|
1287
1250
|
return ngZone.runOutsideAngular(() => lazyInit(() => {
|
|
1251
|
+
// Explicit type arguments skip generic inference from the spread object
|
|
1252
|
+
// (a type-check hot spot); the spread only adds the angular reactivity
|
|
1253
|
+
// binding to `features`.
|
|
1288
1254
|
const table = constructTable({
|
|
1289
1255
|
...options(),
|
|
1290
1256
|
features: {
|
|
1291
|
-
|
|
1257
|
+
coreReactivityFeature: angularReactivity(injector),
|
|
1292
1258
|
...options().features,
|
|
1293
1259
|
},
|
|
1294
1260
|
});
|
|
1295
1261
|
injector.get(DestroyRef).onDestroy(() => {
|
|
1296
1262
|
table._reactivity.unmount?.();
|
|
1297
1263
|
});
|
|
1298
|
-
const stateProxy = createStateProxy(table);
|
|
1299
|
-
Object.defineProperty(table, 'state', {
|
|
1300
|
-
get() {
|
|
1301
|
-
return stateProxy;
|
|
1302
|
-
},
|
|
1303
|
-
configurable: true,
|
|
1304
|
-
enumerable: true,
|
|
1305
|
-
});
|
|
1306
1264
|
let isMount = true;
|
|
1307
1265
|
effect(() => {
|
|
1308
1266
|
const newOptions = options();
|
|
@@ -1331,7 +1289,6 @@ function injectTable(options) {
|
|
|
1331
1289
|
* ```ts
|
|
1332
1290
|
* const { injectAppTable, createAppColumnHelper } = createTableHook({
|
|
1333
1291
|
* features,
|
|
1334
|
-
* rowModels: {},
|
|
1335
1292
|
* tableComponents: {},
|
|
1336
1293
|
* cellComponents: {},
|
|
1337
1294
|
* headerComponents: {},
|