@platforma-sdk/model 1.44.14 → 1.45.17
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/annotations/converter.cjs +29 -0
- package/dist/annotations/converter.cjs.map +1 -0
- package/dist/annotations/converter.d.ts +3 -0
- package/dist/annotations/converter.d.ts.map +1 -0
- package/dist/annotations/converter.js +27 -0
- package/dist/annotations/converter.js.map +1 -0
- package/dist/annotations/index.d.ts +3 -0
- package/dist/annotations/index.d.ts.map +1 -0
- package/dist/annotations/types.d.ts +22 -0
- package/dist/annotations/types.d.ts.map +1 -0
- package/dist/components/PFrameForGraphs.cjs +5 -22
- package/dist/components/PFrameForGraphs.cjs.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +0 -2
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.js +7 -22
- package/dist/components/PFrameForGraphs.js.map +1 -1
- package/dist/components/PlAnnotations/filter.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.cjs +1 -372
- package/dist/components/PlAnnotations/filters_ui.cjs.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.d.ts +11 -756
- package/dist/components/PlAnnotations/filters_ui.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.js +2 -370
- package/dist/components/PlAnnotations/filters_ui.js.map +1 -1
- package/dist/components/PlAnnotations/index.d.ts.map +1 -1
- package/dist/components/PlAnnotations/types.d.ts.map +1 -1
- package/dist/components/PlDataTable.cjs +6 -38
- package/dist/components/PlDataTable.cjs.map +1 -1
- package/dist/components/PlDataTable.d.ts +1 -4
- package/dist/components/PlDataTable.d.ts.map +1 -1
- package/dist/components/PlDataTable.js +7 -38
- package/dist/components/PlDataTable.js.map +1 -1
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/filters/converter.cjs +101 -0
- package/dist/filters/converter.cjs.map +1 -0
- package/dist/filters/converter.d.ts +5 -0
- package/dist/filters/converter.d.ts.map +1 -0
- package/dist/filters/converter.js +98 -0
- package/dist/filters/converter.js.map +1 -0
- package/dist/filters/index.d.ts +3 -0
- package/dist/filters/index.d.ts.map +1 -0
- package/dist/filters/types.d.ts +102 -0
- package/dist/filters/types.d.ts.map +1 -0
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/render/api.cjs +7 -1
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +3 -3
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +7 -1
- package/dist/render/api.js.map +1 -1
- package/dist/render/util/column_collection.cjs +2 -2
- package/dist/render/util/column_collection.cjs.map +1 -1
- package/dist/render/util/column_collection.d.ts +2 -2
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/column_collection.js +2 -2
- package/dist/render/util/column_collection.js.map +1 -1
- package/dist/render/util/pcolumn_data.cjs +21 -0
- package/dist/render/util/pcolumn_data.cjs.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +4 -1
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.js +21 -2
- package/dist/render/util/pcolumn_data.js.map +1 -1
- package/package.json +7 -6
- package/src/annotations/converter.test.ts +74 -0
- package/src/annotations/converter.ts +28 -0
- package/src/annotations/index.ts +2 -0
- package/src/annotations/types.ts +23 -0
- package/src/components/PFrameForGraphs.ts +5 -23
- package/src/components/PlAnnotations/filter.ts +1 -0
- package/src/components/PlAnnotations/filters_ui.test.ts +1 -0
- package/src/components/PlAnnotations/filters_ui.ts +56 -439
- package/src/components/PlAnnotations/index.ts +1 -0
- package/src/components/PlAnnotations/types.ts +1 -0
- package/src/components/PlDataTable.ts +5 -40
- package/src/components/index.ts +1 -1
- package/src/filters/converter.test.ts +336 -0
- package/src/filters/converter.ts +119 -0
- package/src/filters/index.ts +2 -0
- package/src/filters/types.ts +47 -0
- package/src/index.ts +2 -0
- package/src/render/api.ts +9 -5
- package/src/render/util/column_collection.ts +19 -19
- package/src/render/util/pcolumn_data.ts +24 -0
|
@@ -1,64 +1,59 @@
|
|
|
1
|
+
// @DEPRECATED - use sdk/model/src/filters + sdk/model/src/annotations
|
|
1
2
|
import type { SUniversalPColumnId } from '@milaboratories/pl-model-common';
|
|
3
|
+
import type { FilterSpecUi } from '../../annotations';
|
|
4
|
+
import type { FilterSpec } from '../../filters';
|
|
2
5
|
import type { AnnotationFilter, AnnotationMode, AnnotationScript, IsNA, NotFilter, NumericalComparisonFilter, PatternFilter, PatternPredicate, ValueRank } from './filter';
|
|
3
|
-
import type { SimplifiedPColumnSpec } from './types';
|
|
4
6
|
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
|
22
|
-
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
| { type: 'isNotNA'; column: SUniversalPColumnId }
|
|
26
|
-
| { type: 'patternEquals'; column: SUniversalPColumnId; value: string }
|
|
27
|
-
| { type: 'patternNotEquals'; column: SUniversalPColumnId; value: string }
|
|
28
|
-
| { type: 'patternContainSubsequence'; column: SUniversalPColumnId; value: string }
|
|
29
|
-
| { type: 'patternNotContainSubsequence'; column: SUniversalPColumnId; value: string }
|
|
30
|
-
| { type: 'topN'; column: SUniversalPColumnId; n: number }
|
|
31
|
-
| { type: 'bottomN'; column: SUniversalPColumnId; n: number }
|
|
32
|
-
| { type: 'lessThan'; column: SUniversalPColumnId; x: number }
|
|
33
|
-
| { type: 'greaterThan'; column: SUniversalPColumnId; x: number }
|
|
34
|
-
| { type: 'lessThanOrEqual'; column: SUniversalPColumnId; x: number }
|
|
35
|
-
| { type: 'greaterThanOrEqual'; column: SUniversalPColumnId; x: number }
|
|
36
|
-
| { type: 'lessThanColumn'; column: SUniversalPColumnId; rhs: SUniversalPColumnId; minDiff?: number }
|
|
37
|
-
| { type: 'lessThanColumnOrEqual'; column: SUniversalPColumnId; rhs: SUniversalPColumnId; minDiff?: number });
|
|
7
|
+
export type FilterUi = FilterSpec<Extract<
|
|
8
|
+
FilterSpec,
|
|
9
|
+
// supported filters
|
|
10
|
+
{ type:
|
|
11
|
+
| 'lessThan'
|
|
12
|
+
| 'greaterThan'
|
|
13
|
+
| 'lessThanOrEqual'
|
|
14
|
+
| 'greaterThanOrEqual'
|
|
15
|
+
| 'lessThanColumn'
|
|
16
|
+
| 'lessThanColumnOrEqual'
|
|
17
|
+
| 'patternContainSubsequence'
|
|
18
|
+
| 'patternNotContainSubsequence'
|
|
19
|
+
| 'patternEquals'
|
|
20
|
+
| 'patternNotEquals'
|
|
21
|
+
| 'topN'
|
|
22
|
+
| 'bottomN'
|
|
23
|
+
| 'isNA'
|
|
24
|
+
| 'isNotNA';
|
|
25
|
+
}
|
|
26
|
+
>, { id?: number; name?: string; isExpanded?: boolean }>;
|
|
38
27
|
|
|
39
28
|
export type FilterUiType = Exclude<FilterUi, { type: undefined }>['type'];
|
|
40
29
|
|
|
41
30
|
export type FilterUiOfType<T extends FilterUiType> = Extract<FilterUi, { type: T }>;
|
|
42
31
|
|
|
32
|
+
// DEPRECATED - use lib/ui/uikit/src/composition/filters
|
|
33
|
+
export function unreachable(x: never): never {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
35
|
+
throw new Error('Unexpected object: ' + x);
|
|
36
|
+
}
|
|
37
|
+
|
|
43
38
|
export type TypeToLiteral<T> =
|
|
44
|
-
[T] extends [FilterUiType] ? 'FilterUiType' :
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
39
|
+
[T] extends [FilterUiType] ? 'FilterUiType' :
|
|
40
|
+
[T] extends [SUniversalPColumnId] ? 'SUniversalPColumnId' :
|
|
41
|
+
[T] extends [PatternPredicate] ? 'PatternPredicate' :
|
|
42
|
+
[T] extends [AnnotationFilter[]] ? 'AnnotationFilter[]' :
|
|
43
|
+
[T] extends [AnnotationFilter] ? 'AnnotationFilter' :
|
|
44
|
+
[T] extends [number] ? 'number' :
|
|
45
|
+
[T] extends [number | undefined] ? 'number?' :
|
|
46
|
+
[T] extends [string] ? 'string' :
|
|
47
|
+
[T] extends [string | undefined] ? 'string?' :
|
|
48
|
+
[T] extends [boolean] ? 'boolean' :
|
|
49
|
+
[T] extends [boolean | undefined] ? 'boolean?' :
|
|
50
|
+
[T] extends [unknown[]] ? 'unknown[]' :
|
|
51
|
+
// this is special
|
|
52
|
+
T extends number ? 'number' :
|
|
53
|
+
T extends string ? 'string' :
|
|
54
|
+
T extends boolean ? 'boolean' :
|
|
55
|
+
T extends Record<string, unknown> ? 'form' :
|
|
56
|
+
'unknown';
|
|
62
57
|
|
|
63
58
|
// @TODO: "parse" option
|
|
64
59
|
export type TypeField<V> = {
|
|
@@ -67,7 +62,7 @@ export type TypeField<V> = {
|
|
|
67
62
|
defaultValue: () => V | undefined;
|
|
68
63
|
};
|
|
69
64
|
|
|
70
|
-
export type TypeFieldRecord<T> = { [K in keyof T]: TypeField<T[K]>; };
|
|
65
|
+
export type TypeFieldRecord<T extends FilterUi> = { [K in keyof T]: TypeField<T[K]>; };
|
|
71
66
|
|
|
72
67
|
export type TypeForm<T> = {
|
|
73
68
|
[P in keyof T]: T[P] extends Record<string, unknown> ? {
|
|
@@ -94,377 +89,16 @@ export type FormField =
|
|
|
94
89
|
|
|
95
90
|
export type AnyForm = Record<string, FormField>;
|
|
96
91
|
|
|
97
|
-
type
|
|
98
|
-
|
|
99
|
-
label: string;
|
|
100
|
-
form: TypeForm<FilterUiOfType<T>>; // TODO: simplify this to `TypeField<T>`
|
|
101
|
-
supportedFor: (spec1: SimplifiedPColumnSpec, spec2: SimplifiedPColumnSpec | undefined) => boolean;
|
|
102
|
-
}
|
|
92
|
+
export type AnnotationStepUi = FilterSpecUi<FilterUi> & {
|
|
93
|
+
id?: number;
|
|
103
94
|
};
|
|
104
95
|
|
|
105
|
-
export
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
fieldType: 'SUniversalPColumnId',
|
|
112
|
-
defaultValue: () => undefined,
|
|
113
|
-
},
|
|
114
|
-
type: {
|
|
115
|
-
label: 'Predicate',
|
|
116
|
-
fieldType: 'FilterUiType',
|
|
117
|
-
defaultValue: () => 'lessThan',
|
|
118
|
-
},
|
|
119
|
-
x: {
|
|
120
|
-
label: 'X',
|
|
121
|
-
fieldType: 'number',
|
|
122
|
-
defaultValue: () => 0,
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
supportedFor: isNumericValueType,
|
|
126
|
-
},
|
|
127
|
-
greaterThan: {
|
|
128
|
-
label: 'Col > X (Greater Than)',
|
|
129
|
-
form: {
|
|
130
|
-
column: {
|
|
131
|
-
label: 'Column',
|
|
132
|
-
fieldType: 'SUniversalPColumnId',
|
|
133
|
-
defaultValue: () => undefined,
|
|
134
|
-
},
|
|
135
|
-
type: {
|
|
136
|
-
label: 'Predicate',
|
|
137
|
-
fieldType: 'FilterUiType',
|
|
138
|
-
defaultValue: () => 'greaterThan',
|
|
139
|
-
},
|
|
140
|
-
x: {
|
|
141
|
-
label: 'X',
|
|
142
|
-
fieldType: 'number',
|
|
143
|
-
defaultValue: () => 0,
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
supportedFor: isNumericValueType,
|
|
147
|
-
},
|
|
148
|
-
lessThanOrEqual: {
|
|
149
|
-
label: 'Col ≤ X (Less Than or Equal)',
|
|
150
|
-
form: {
|
|
151
|
-
column: {
|
|
152
|
-
label: 'Column',
|
|
153
|
-
fieldType: 'SUniversalPColumnId',
|
|
154
|
-
defaultValue: () => undefined,
|
|
155
|
-
},
|
|
156
|
-
type: {
|
|
157
|
-
label: 'Predicate',
|
|
158
|
-
fieldType: 'FilterUiType',
|
|
159
|
-
defaultValue: () => 'lessThanOrEqual',
|
|
160
|
-
},
|
|
161
|
-
x: {
|
|
162
|
-
label: 'X',
|
|
163
|
-
fieldType: 'number',
|
|
164
|
-
defaultValue: () => 0,
|
|
165
|
-
},
|
|
166
|
-
},
|
|
167
|
-
supportedFor: isNumericValueType,
|
|
168
|
-
},
|
|
169
|
-
greaterThanOrEqual: {
|
|
170
|
-
label: 'Col ≥ X (Greater Than or Equal)',
|
|
171
|
-
form: {
|
|
172
|
-
column: {
|
|
173
|
-
label: 'Column',
|
|
174
|
-
fieldType: 'SUniversalPColumnId',
|
|
175
|
-
defaultValue: () => undefined,
|
|
176
|
-
},
|
|
177
|
-
type: {
|
|
178
|
-
label: 'Predicate',
|
|
179
|
-
fieldType: 'FilterUiType',
|
|
180
|
-
defaultValue: () => 'greaterThanOrEqual',
|
|
181
|
-
},
|
|
182
|
-
x: {
|
|
183
|
-
label: 'X',
|
|
184
|
-
fieldType: 'number',
|
|
185
|
-
defaultValue: () => 0,
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
supportedFor: isNumericValueType,
|
|
189
|
-
},
|
|
190
|
-
lessThanColumn: {
|
|
191
|
-
label: 'Col₁ < Col₂ (Compare Columns)',
|
|
192
|
-
form: {
|
|
193
|
-
column: {
|
|
194
|
-
label: 'Col₁',
|
|
195
|
-
fieldType: 'SUniversalPColumnId',
|
|
196
|
-
defaultValue: () => undefined,
|
|
197
|
-
},
|
|
198
|
-
type: {
|
|
199
|
-
label: 'Predicate',
|
|
200
|
-
fieldType: 'FilterUiType',
|
|
201
|
-
defaultValue: () => 'lessThanColumn',
|
|
202
|
-
},
|
|
203
|
-
rhs: {
|
|
204
|
-
label: 'Col₂',
|
|
205
|
-
fieldType: 'SUniversalPColumnId',
|
|
206
|
-
defaultValue: () => undefined,
|
|
207
|
-
},
|
|
208
|
-
minDiff: {
|
|
209
|
-
label: 'Margin (positive)',
|
|
210
|
-
fieldType: 'number?',
|
|
211
|
-
defaultValue: () => undefined,
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
supportedFor: (spec1: SimplifiedPColumnSpec, spec2?: SimplifiedPColumnSpec): boolean => {
|
|
215
|
-
return isNumericValueType(spec1) && (spec2 === undefined || isNumericValueType(spec2));
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
lessThanColumnOrEqual: {
|
|
219
|
-
label: 'Col₁ ≤ Col₂ (Compare Columns)',
|
|
220
|
-
form: {
|
|
221
|
-
column: {
|
|
222
|
-
label: 'Col₁',
|
|
223
|
-
fieldType: 'SUniversalPColumnId',
|
|
224
|
-
defaultValue: () => undefined,
|
|
225
|
-
},
|
|
226
|
-
type: {
|
|
227
|
-
label: 'Predicate',
|
|
228
|
-
fieldType: 'FilterUiType',
|
|
229
|
-
defaultValue: () => 'lessThanColumnOrEqual',
|
|
230
|
-
},
|
|
231
|
-
rhs: {
|
|
232
|
-
label: 'Col₂',
|
|
233
|
-
fieldType: 'SUniversalPColumnId',
|
|
234
|
-
defaultValue: () => undefined,
|
|
235
|
-
},
|
|
236
|
-
minDiff: {
|
|
237
|
-
label: 'Margin (positive)',
|
|
238
|
-
fieldType: 'number?',
|
|
239
|
-
defaultValue: () => undefined,
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
supportedFor: (spec1: SimplifiedPColumnSpec, spec2?: SimplifiedPColumnSpec): boolean => {
|
|
243
|
-
return isNumericValueType(spec1) && (spec2 === undefined || isNumericValueType(spec2));
|
|
244
|
-
},
|
|
245
|
-
},
|
|
246
|
-
topN: {
|
|
247
|
-
label: 'Top N',
|
|
248
|
-
form: {
|
|
249
|
-
column: {
|
|
250
|
-
label: 'Rank By Column',
|
|
251
|
-
fieldType: 'SUniversalPColumnId',
|
|
252
|
-
defaultValue: () => undefined,
|
|
253
|
-
},
|
|
254
|
-
type: {
|
|
255
|
-
label: 'Predicate',
|
|
256
|
-
fieldType: 'FilterUiType',
|
|
257
|
-
defaultValue: () => 'topN',
|
|
258
|
-
},
|
|
259
|
-
n: {
|
|
260
|
-
label: 'N',
|
|
261
|
-
fieldType: 'number',
|
|
262
|
-
defaultValue: () => 10,
|
|
263
|
-
},
|
|
264
|
-
},
|
|
265
|
-
supportedFor: isNumericValueType,
|
|
266
|
-
},
|
|
267
|
-
bottomN: {
|
|
268
|
-
label: 'Bottom N',
|
|
269
|
-
form: {
|
|
270
|
-
column: {
|
|
271
|
-
label: 'Rank By Column',
|
|
272
|
-
fieldType: 'SUniversalPColumnId',
|
|
273
|
-
defaultValue: () => undefined,
|
|
274
|
-
},
|
|
275
|
-
type: {
|
|
276
|
-
label: 'Predicate',
|
|
277
|
-
fieldType: 'FilterUiType',
|
|
278
|
-
defaultValue: () => 'bottomN',
|
|
279
|
-
},
|
|
280
|
-
n: {
|
|
281
|
-
label: 'N',
|
|
282
|
-
fieldType: 'number',
|
|
283
|
-
defaultValue: () => 10,
|
|
284
|
-
},
|
|
285
|
-
},
|
|
286
|
-
supportedFor: isNumericValueType,
|
|
287
|
-
},
|
|
288
|
-
patternContainSubsequence: {
|
|
289
|
-
label: 'Col ~ Seq (Contain Subsequence)',
|
|
290
|
-
form: {
|
|
291
|
-
column: {
|
|
292
|
-
label: 'Column',
|
|
293
|
-
fieldType: 'SUniversalPColumnId',
|
|
294
|
-
defaultValue: () => undefined,
|
|
295
|
-
},
|
|
296
|
-
type: {
|
|
297
|
-
label: 'Predicate',
|
|
298
|
-
fieldType: 'FilterUiType',
|
|
299
|
-
defaultValue: () => 'patternContainSubsequence',
|
|
300
|
-
},
|
|
301
|
-
value: {
|
|
302
|
-
label: 'Seq',
|
|
303
|
-
fieldType: 'string',
|
|
304
|
-
defaultValue: () => '',
|
|
305
|
-
},
|
|
306
|
-
},
|
|
307
|
-
supportedFor: isStringValueType,
|
|
308
|
-
},
|
|
309
|
-
patternNotContainSubsequence: {
|
|
310
|
-
label: 'Col ≁ Seq (Not Contain Subsequence)',
|
|
311
|
-
form: {
|
|
312
|
-
column: {
|
|
313
|
-
label: 'Column',
|
|
314
|
-
fieldType: 'SUniversalPColumnId',
|
|
315
|
-
defaultValue: () => undefined,
|
|
316
|
-
},
|
|
317
|
-
type: {
|
|
318
|
-
label: 'Predicate',
|
|
319
|
-
fieldType: 'FilterUiType',
|
|
320
|
-
defaultValue: () => 'patternNotContainSubsequence',
|
|
321
|
-
},
|
|
322
|
-
value: {
|
|
323
|
-
label: 'Seq',
|
|
324
|
-
fieldType: 'string',
|
|
325
|
-
defaultValue: () => '',
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
supportedFor: isStringValueType,
|
|
329
|
-
},
|
|
330
|
-
patternEquals: {
|
|
331
|
-
label: 'Col = Seq (Equals)',
|
|
332
|
-
form: {
|
|
333
|
-
column: {
|
|
334
|
-
label: 'Column',
|
|
335
|
-
fieldType: 'SUniversalPColumnId',
|
|
336
|
-
defaultValue: () => undefined,
|
|
337
|
-
},
|
|
338
|
-
type: {
|
|
339
|
-
label: 'Predicate',
|
|
340
|
-
fieldType: 'FilterUiType',
|
|
341
|
-
defaultValue: () => 'patternEquals',
|
|
342
|
-
},
|
|
343
|
-
value: {
|
|
344
|
-
label: 'Seq',
|
|
345
|
-
fieldType: 'string',
|
|
346
|
-
defaultValue: () => '',
|
|
347
|
-
},
|
|
348
|
-
},
|
|
349
|
-
supportedFor: isStringValueType,
|
|
350
|
-
},
|
|
351
|
-
patternNotEquals: {
|
|
352
|
-
label: 'Col ≠ Seq (Not Equal)',
|
|
353
|
-
form: {
|
|
354
|
-
column: {
|
|
355
|
-
label: 'Column',
|
|
356
|
-
fieldType: 'SUniversalPColumnId',
|
|
357
|
-
defaultValue: () => undefined,
|
|
358
|
-
},
|
|
359
|
-
type: {
|
|
360
|
-
label: 'Predicate',
|
|
361
|
-
fieldType: 'FilterUiType',
|
|
362
|
-
defaultValue: () => 'patternNotEquals',
|
|
363
|
-
},
|
|
364
|
-
value: {
|
|
365
|
-
label: 'Seq',
|
|
366
|
-
fieldType: 'string',
|
|
367
|
-
defaultValue: () => '',
|
|
368
|
-
},
|
|
369
|
-
},
|
|
370
|
-
supportedFor: isStringValueType,
|
|
371
|
-
},
|
|
372
|
-
isNA: {
|
|
373
|
-
label: 'Is NA',
|
|
374
|
-
form: {
|
|
375
|
-
column: {
|
|
376
|
-
label: 'Column',
|
|
377
|
-
fieldType: 'SUniversalPColumnId',
|
|
378
|
-
defaultValue: () => undefined,
|
|
379
|
-
},
|
|
380
|
-
type: {
|
|
381
|
-
label: 'Predicate',
|
|
382
|
-
fieldType: 'FilterUiType',
|
|
383
|
-
defaultValue: () => 'isNA',
|
|
384
|
-
},
|
|
385
|
-
},
|
|
386
|
-
supportedFor: () => true,
|
|
387
|
-
},
|
|
388
|
-
isNotNA: {
|
|
389
|
-
label: 'Is Not NA',
|
|
390
|
-
form: {
|
|
391
|
-
column: {
|
|
392
|
-
label: 'Column',
|
|
393
|
-
fieldType: 'SUniversalPColumnId',
|
|
394
|
-
defaultValue: () => undefined,
|
|
395
|
-
},
|
|
396
|
-
type: {
|
|
397
|
-
label: 'Predicate',
|
|
398
|
-
fieldType: 'FilterUiType',
|
|
399
|
-
defaultValue: () => 'isNotNA',
|
|
400
|
-
},
|
|
401
|
-
},
|
|
402
|
-
supportedFor: () => true,
|
|
403
|
-
},
|
|
404
|
-
or: {
|
|
405
|
-
label: 'Or',
|
|
406
|
-
form: {
|
|
407
|
-
type: {
|
|
408
|
-
fieldType: 'FilterUiType',
|
|
409
|
-
label: 'Predicate',
|
|
410
|
-
defaultValue: () => 'or',
|
|
411
|
-
},
|
|
412
|
-
filters: {
|
|
413
|
-
fieldType: 'unknown[]',
|
|
414
|
-
label: 'Filters',
|
|
415
|
-
defaultValue: () => [],
|
|
416
|
-
},
|
|
417
|
-
},
|
|
418
|
-
supportedFor: () => false,
|
|
419
|
-
},
|
|
420
|
-
and: {
|
|
421
|
-
label: 'And',
|
|
422
|
-
form: {
|
|
423
|
-
type: {
|
|
424
|
-
fieldType: 'FilterUiType',
|
|
425
|
-
label: 'Predicate',
|
|
426
|
-
defaultValue: () => 'and',
|
|
427
|
-
},
|
|
428
|
-
filters: {
|
|
429
|
-
fieldType: 'unknown[]',
|
|
430
|
-
label: 'Filters',
|
|
431
|
-
defaultValue: () => [],
|
|
432
|
-
},
|
|
433
|
-
},
|
|
434
|
-
supportedFor: () => false,
|
|
435
|
-
},
|
|
436
|
-
not: {
|
|
437
|
-
label: 'Not',
|
|
438
|
-
form: {
|
|
439
|
-
type: {
|
|
440
|
-
fieldType: 'FilterUiType',
|
|
441
|
-
label: 'Predicate',
|
|
442
|
-
defaultValue: () => 'not',
|
|
443
|
-
},
|
|
444
|
-
filter: {
|
|
445
|
-
fieldType: 'form',
|
|
446
|
-
label: 'Filter',
|
|
447
|
-
defaultValue: () => undefined as unknown as FilterUi, // TODO:
|
|
448
|
-
},
|
|
449
|
-
},
|
|
450
|
-
supportedFor: () => false,
|
|
451
|
-
},
|
|
452
|
-
} satisfies CreateFilterUiMetadataMap<FilterUiType>;
|
|
453
|
-
|
|
454
|
-
export function getFilterUiTypeOptions(columnSpec?: SimplifiedPColumnSpec) {
|
|
455
|
-
if (!columnSpec) {
|
|
456
|
-
return [];
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
return Object.entries(filterUiMetadata).filter(([_, metadata]) => metadata.supportedFor(columnSpec)).map(([type, metadata]) => ({
|
|
460
|
-
label: metadata.label,
|
|
461
|
-
value: type,
|
|
462
|
-
}));
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
export function getFilterUiMetadata(type: FilterUiType) {
|
|
466
|
-
return filterUiMetadata[type];
|
|
467
|
-
}
|
|
96
|
+
export type AnnotationScriptUi = {
|
|
97
|
+
isCreated?: boolean;
|
|
98
|
+
title: string;
|
|
99
|
+
mode: AnnotationMode;
|
|
100
|
+
steps: AnnotationStepUi[];
|
|
101
|
+
};
|
|
468
102
|
|
|
469
103
|
export function compileFilter(ui: FilterUi): AnnotationFilter {
|
|
470
104
|
if (ui.type === 'or') {
|
|
@@ -626,10 +260,6 @@ export function compileFilter(ui: FilterUi): AnnotationFilter {
|
|
|
626
260
|
};
|
|
627
261
|
}
|
|
628
262
|
|
|
629
|
-
if (ui.type === undefined) {
|
|
630
|
-
throw new Error('Filter type is undefined, this should not happen');
|
|
631
|
-
}
|
|
632
|
-
|
|
633
263
|
unreachable(ui);
|
|
634
264
|
}
|
|
635
265
|
|
|
@@ -637,19 +267,6 @@ export function compileFilters(uiFilters: FilterUi[]): AnnotationFilter[] {
|
|
|
637
267
|
return uiFilters.filter((f) => f.type !== undefined).map(compileFilter);
|
|
638
268
|
}
|
|
639
269
|
|
|
640
|
-
export type AnnotationStepUi = {
|
|
641
|
-
id?: number;
|
|
642
|
-
label: string;
|
|
643
|
-
filter: Extract<FilterUi, { type: 'and' | 'or' }>;
|
|
644
|
-
};
|
|
645
|
-
|
|
646
|
-
export type AnnotationScriptUi = {
|
|
647
|
-
isCreated?: boolean;
|
|
648
|
-
title: string;
|
|
649
|
-
mode: AnnotationMode;
|
|
650
|
-
steps: AnnotationStepUi[];
|
|
651
|
-
};
|
|
652
|
-
|
|
653
270
|
export function compileAnnotationScript(uiScript: AnnotationScriptUi): AnnotationScript {
|
|
654
271
|
return {
|
|
655
272
|
title: uiScript.title,
|
|
@@ -34,10 +34,11 @@ import type {
|
|
|
34
34
|
ColumnProvider,
|
|
35
35
|
PColumnDataUniversal,
|
|
36
36
|
RenderCtx,
|
|
37
|
+
TreeNodeAccessor,
|
|
37
38
|
} from '../render';
|
|
38
39
|
import {
|
|
40
|
+
allPColumnsReady,
|
|
39
41
|
PColumnCollection,
|
|
40
|
-
TreeNodeAccessor,
|
|
41
42
|
} from '../render';
|
|
42
43
|
import { isLinkerColumn } from './PFrameForGraphs';
|
|
43
44
|
|
|
@@ -576,44 +577,6 @@ export function getMatchingLabelColumns(
|
|
|
576
577
|
return labelColumns;
|
|
577
578
|
}
|
|
578
579
|
|
|
579
|
-
/** Check if all columns are computed */
|
|
580
|
-
export function allColumnsComputed(
|
|
581
|
-
columns: PColumn<PColumnValues | TreeNodeAccessor | DataInfo<TreeNodeAccessor>>[],
|
|
582
|
-
): boolean {
|
|
583
|
-
type Data = typeof columns[number]['data'];
|
|
584
|
-
const isValues = (d: Data): d is PColumnValues => Array.isArray(d);
|
|
585
|
-
const isAccessor = (d: Data): d is TreeNodeAccessor => d instanceof TreeNodeAccessor;
|
|
586
|
-
const isDataInfo = (d: Data): d is DataInfo<TreeNodeAccessor> =>
|
|
587
|
-
typeof d === 'object' && 'type' in d;
|
|
588
|
-
|
|
589
|
-
return columns
|
|
590
|
-
.map((c) => c.data)
|
|
591
|
-
.every((d): boolean => {
|
|
592
|
-
if (isValues(d)) {
|
|
593
|
-
return true;
|
|
594
|
-
} else if (isAccessor(d)) {
|
|
595
|
-
return d.getIsReadyOrError();
|
|
596
|
-
} else if (isDataInfo(d)) {
|
|
597
|
-
const type = d.type;
|
|
598
|
-
switch (type) {
|
|
599
|
-
case 'Json':
|
|
600
|
-
return true;
|
|
601
|
-
case 'JsonPartitioned':
|
|
602
|
-
return Object.values(d.parts).every((p) => p.getIsReadyOrError());
|
|
603
|
-
case 'BinaryPartitioned':
|
|
604
|
-
return Object.values(d.parts)
|
|
605
|
-
.every((p) => p.index.getIsReadyOrError() && p.values.getIsReadyOrError());
|
|
606
|
-
case 'ParquetPartitioned':
|
|
607
|
-
return Object.values(d.parts)
|
|
608
|
-
.every((p) => p.getIsReadyOrError());
|
|
609
|
-
}
|
|
610
|
-
} else {
|
|
611
|
-
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
612
|
-
throw Error(`unsupported column data type: ${d satisfies never}`);
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
|
|
617
580
|
function createPTableDef(params: {
|
|
618
581
|
columns: PColumn<PColumnDataUniversal>[];
|
|
619
582
|
labelColumns: PColumn<PColumnDataUniversal>[];
|
|
@@ -745,6 +708,7 @@ export function createPlDataTableV2<A, U>(
|
|
|
745
708
|
coreColumnPredicate: ops?.coreColumnPredicate,
|
|
746
709
|
});
|
|
747
710
|
const fullHandle = ctx.createPTable(fullDef);
|
|
711
|
+
if (!fullHandle) return undefined;
|
|
748
712
|
|
|
749
713
|
const hiddenColumns = new Set<PObjectId>(((): PObjectId[] => {
|
|
750
714
|
// Inner join works as a filter - all columns must be present
|
|
@@ -779,7 +743,7 @@ export function createPlDataTableV2<A, U>(
|
|
|
779
743
|
const visibleLabelColumns = getMatchingLabelColumns(visibleColumns.map(getColumnIdAndSpec), allLabelColumns);
|
|
780
744
|
|
|
781
745
|
// if at least one column is not yet computed, we can't show the table
|
|
782
|
-
if (!
|
|
746
|
+
if (!allPColumnsReady([...visibleColumns, ...visibleLabelColumns])) return undefined;
|
|
783
747
|
|
|
784
748
|
const visibleDef = createPTableDef({
|
|
785
749
|
columns: visibleColumns,
|
|
@@ -791,6 +755,7 @@ export function createPlDataTableV2<A, U>(
|
|
|
791
755
|
coreColumnPredicate,
|
|
792
756
|
});
|
|
793
757
|
const visibleHandle = ctx.createPTable(visibleDef);
|
|
758
|
+
if (!visibleHandle) return undefined;
|
|
794
759
|
|
|
795
760
|
return {
|
|
796
761
|
sourceId: tableStateNormalized.pTableParams.sourceId,
|