@platforma-sdk/model 1.20.27 → 1.21.0
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/components/PlDataTable.d.ts +27 -2
- package/dist/components/PlDataTable.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +624 -615
- package/dist/index.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/PlDataTable.ts +67 -6
package/dist/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PlatformaSDKVersion = "1.
|
|
1
|
+
export declare const PlatformaSDKVersion = "1.21.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/dist/version.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mBAAmB,WAAW,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
matchAxisId,
|
|
7
7
|
PColumn,
|
|
8
8
|
PColumnIdAndSpec,
|
|
9
|
+
PColumnSpec,
|
|
9
10
|
PColumnValues,
|
|
10
11
|
PObjectId,
|
|
11
12
|
PTableHandle,
|
|
@@ -282,6 +283,31 @@ export type PlTableFiltersModel = {
|
|
|
282
283
|
filters?: PTableRecordFilter[];
|
|
283
284
|
};
|
|
284
285
|
|
|
286
|
+
export type CreatePlDataTableOps = {
|
|
287
|
+
/** Table filters, should contain */
|
|
288
|
+
filters?: PTableRecordFilter[];
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Selects columns for which will be inner-joined to the table.
|
|
292
|
+
*
|
|
293
|
+
* Default behaviour: all columns are considered to be core
|
|
294
|
+
*/
|
|
295
|
+
coreColumnPredicate?: (spec: PColumnSpec) => boolean;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Determines how core columns should be joined together:
|
|
299
|
+
* inner - so user will only see records present in all core columns
|
|
300
|
+
* full - so user will only see records present in any of the core columns
|
|
301
|
+
*
|
|
302
|
+
* All non-core columns will be left joined to the table produced by the core
|
|
303
|
+
* columns, in other words records form the pool of non-core columns will only
|
|
304
|
+
* make their way into the final table if core table contins corresponding key.
|
|
305
|
+
*
|
|
306
|
+
* Default: 'full'
|
|
307
|
+
*/
|
|
308
|
+
coreJoinType?: 'inner' | 'full';
|
|
309
|
+
};
|
|
310
|
+
|
|
285
311
|
/**
|
|
286
312
|
* Create p-table handle given ui table state
|
|
287
313
|
*
|
|
@@ -293,9 +319,32 @@ export type PlTableFiltersModel = {
|
|
|
293
319
|
export function createPlDataTable<A, U>(
|
|
294
320
|
ctx: RenderCtx<A, U>,
|
|
295
321
|
columns: PColumn<TreeNodeAccessor | PColumnValues>[],
|
|
296
|
-
tableState
|
|
297
|
-
|
|
322
|
+
tableState: PlDataTableState | undefined
|
|
323
|
+
): PTableHandle | undefined;
|
|
324
|
+
export function createPlDataTable<A, U>(
|
|
325
|
+
ctx: RenderCtx<A, U>,
|
|
326
|
+
columns: PColumn<TreeNodeAccessor | PColumnValues>[],
|
|
327
|
+
tableState: PlDataTableState | undefined,
|
|
328
|
+
ops: CreatePlDataTableOps
|
|
329
|
+
): PTableHandle | undefined;
|
|
330
|
+
/** @deprecated use method with extended ops as the last argument */
|
|
331
|
+
export function createPlDataTable<A, U>(
|
|
332
|
+
ctx: RenderCtx<A, U>,
|
|
333
|
+
columns: PColumn<TreeNodeAccessor | PColumnValues>[],
|
|
334
|
+
tableState: PlDataTableState | undefined,
|
|
335
|
+
filters: PTableRecordFilter[]
|
|
336
|
+
): PTableHandle | undefined;
|
|
337
|
+
export function createPlDataTable<A, U>(
|
|
338
|
+
ctx: RenderCtx<A, U>,
|
|
339
|
+
columns: PColumn<TreeNodeAccessor | PColumnValues>[],
|
|
340
|
+
tableState: PlDataTableState | undefined,
|
|
341
|
+
ops?: PTableRecordFilter[] | CreatePlDataTableOps
|
|
298
342
|
): PTableHandle | undefined {
|
|
343
|
+
// ops migration for backward compatibility with previous deprecated API
|
|
344
|
+
if (Array.isArray(ops)) {
|
|
345
|
+
ops = { filters: ops };
|
|
346
|
+
}
|
|
347
|
+
|
|
299
348
|
const allLabelCols = ctx.resultPool
|
|
300
349
|
.getData()
|
|
301
350
|
.entries.map((d) => d.obj)
|
|
@@ -351,16 +400,28 @@ export function createPlDataTable<A, U>(
|
|
|
351
400
|
)
|
|
352
401
|
return undefined;
|
|
353
402
|
|
|
403
|
+
let coreColumns = columns;
|
|
404
|
+
const secondaryColumns: typeof columns = [];
|
|
405
|
+
|
|
406
|
+
if (ops?.coreColumnPredicate) {
|
|
407
|
+
coreColumns = [];
|
|
408
|
+
for (const c of columns)
|
|
409
|
+
if (ops.coreColumnPredicate(c.spec)) coreColumns.push(c);
|
|
410
|
+
else secondaryColumns.push(c);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
secondaryColumns.push(...labelColumns.values());
|
|
414
|
+
|
|
354
415
|
return ctx.createPTable({
|
|
355
416
|
src: {
|
|
356
417
|
type: 'outer',
|
|
357
418
|
primary: {
|
|
358
|
-
type: 'full',
|
|
359
|
-
entries:
|
|
419
|
+
type: ops?.coreJoinType ?? 'full',
|
|
420
|
+
entries: coreColumns.map((c) => ({ type: 'column', column: c }))
|
|
360
421
|
},
|
|
361
|
-
secondary:
|
|
422
|
+
secondary: secondaryColumns.map((c) => ({ type: 'column', column: c }))
|
|
362
423
|
},
|
|
363
|
-
filters: [...(
|
|
424
|
+
filters: [...(ops?.filters ?? []), ...(tableState?.pTableParams?.filters ?? [])],
|
|
364
425
|
sorting: tableState?.pTableParams?.sorting ?? []
|
|
365
426
|
});
|
|
366
427
|
}
|