@theseam/ui-common 1.0.1 → 1.0.2-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/ai/package.json +3 -0
- package/asset-reader/package.json +3 -0
- package/breadcrumbs/package.json +3 -0
- package/buttons/package.json +3 -0
- package/card/package.json +3 -0
- package/carousel/package.json +3 -0
- package/checkbox/package.json +3 -0
- package/confirm-dialog/package.json +3 -0
- package/core/package.json +3 -0
- package/data-exporter/package.json +3 -0
- package/data-filters/package.json +3 -0
- package/datatable/package.json +3 -0
- package/datatable-alterations-display/package.json +3 -0
- package/datatable-dynamic/package.json +3 -0
- package/dynamic/package.json +3 -0
- package/dynamic-component-loader/package.json +3 -0
- package/fesm2022/theseam-ui-common-graphql.mjs +849 -476
- package/fesm2022/theseam-ui-common-graphql.mjs.map +1 -1
- package/footer-bar/package.json +3 -0
- package/form-field/package.json +3 -0
- package/form-field-error/package.json +3 -0
- package/framework/package.json +3 -0
- package/google-maps/package.json +3 -0
- package/graphql/index.d.ts +265 -54
- package/graphql/package.json +3 -0
- package/icon/package.json +3 -0
- package/layout/package.json +3 -0
- package/loading/package.json +3 -0
- package/menu/package.json +3 -0
- package/modal/README.md +5 -5
- package/modal/package.json +3 -0
- package/models/package.json +3 -0
- package/navigation-reload/package.json +3 -0
- package/package.json +2 -2
- package/popover/package.json +3 -0
- package/progress/package.json +3 -0
- package/rich-text/package.json +3 -0
- package/scrollbar/package.json +3 -0
- package/services/package.json +3 -0
- package/shared/package.json +3 -0
- package/storage/package.json +3 -0
- package/story-helpers/package.json +3 -0
- package/tabbed/package.json +3 -0
- package/table/package.json +3 -0
- package/table-cell-type/package.json +3 -0
- package/table-cell-types/package.json +3 -0
- package/tel-input/README.md +27 -27
- package/tel-input/package.json +3 -0
- package/testing/package.json +3 -0
- package/tiled-select/package.json +3 -0
- package/toggle-edit/package.json +3 -0
- package/toggle-group/package.json +3 -0
- package/tooltip/package.json +3 -0
- package/unsaved-changes-dialog/package.json +3 -0
- package/utils/package.json +3 -0
- package/validators/package.json +3 -0
- package/vertical-list-filter/package.json +3 -0
- package/viewers/package.json +3 -0
- package/widget/package.json +3 -0
package/graphql/index.d.ts
CHANGED
|
@@ -1,19 +1,66 @@
|
|
|
1
|
+
import { ApolloLink, ApolloQueryResult, DocumentNode as DocumentNode$2, TypedDocumentNode } from '@apollo/client/core';
|
|
1
2
|
import { DocumentNode, ValueNode, Token } from 'graphql/language';
|
|
2
3
|
import * as graphql from 'graphql';
|
|
3
|
-
import { DocumentNode as DocumentNode$1, ValueNode as ValueNode$1, OperationDefinitionNode, VariableDefinitionNode, VariableNode, ArgumentNode, FieldNode, Token as Token$1, GraphQLSchema } from 'graphql';
|
|
4
|
-
import
|
|
5
|
-
import { Operation, InMemoryCache } from '@apollo/client';
|
|
4
|
+
import { DocumentNode as DocumentNode$1, ValueNode as ValueNode$1, OperationDefinitionNode, VariableDefinitionNode, VariableNode, ArgumentNode, FieldNode, Token as Token$1, GraphQLFormattedError, GraphQLSchema } from 'graphql';
|
|
5
|
+
import { Operation } from '@apollo/client';
|
|
6
6
|
import { Observable } from 'rxjs';
|
|
7
7
|
import { DatatableComponent, SortItem, TheSeamPageInfo, ColumnsDataFilterState, TheSeamColumnsDataFilterDateSearchFormState, TheSeamColumnsDataFilterDateSearchOptions, TheSeamColumnsDataFilterNumericSearchFormState, TheSeamColumnsDataFilterTextSearchFormState, SortEvent } from '@theseam/ui-common/datatable';
|
|
8
|
-
import { ApolloQueryResult, DocumentNode as DocumentNode$2, TypedDocumentNode } from '@apollo/client/core';
|
|
9
8
|
import * as apollo_angular from 'apollo-angular';
|
|
10
9
|
import { QueryRef, WatchQueryOptions, Apollo } from 'apollo-angular';
|
|
11
10
|
import { DataFilterState } from '@theseam/ui-common/data-filters';
|
|
12
11
|
import * as i0 from '@angular/core';
|
|
13
|
-
import { InjectionToken, EventEmitter } from '@angular/core';
|
|
12
|
+
import { InjectionToken, EventEmitter, Provider } from '@angular/core';
|
|
14
13
|
import { OperationVariables } from '@apollo/client/core/types';
|
|
15
14
|
import * as _theseam_ui_common_graphql from '@theseam/ui-common/graphql';
|
|
16
15
|
|
|
16
|
+
interface LogQueryLinkOptions {
|
|
17
|
+
beforeStyles?: string;
|
|
18
|
+
afterStyles?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Wraps an Apollo link and logs the operation state immediately before and
|
|
22
|
+
* after the wrapped link processes it.
|
|
23
|
+
*
|
|
24
|
+
* Useful for inspecting what `queryProcessingLink` does to a query:
|
|
25
|
+
*
|
|
26
|
+
* ```ts
|
|
27
|
+
* link: concat(
|
|
28
|
+
* logQueryLink(queryProcessingLink),
|
|
29
|
+
* httpLink,
|
|
30
|
+
* )
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* The output uses `console.log` with optional CSS styles so each snapshot
|
|
34
|
+
* is easy to distinguish in the browser console. Tree-shaking will remove
|
|
35
|
+
* this from production builds when it is not imported.
|
|
36
|
+
*/
|
|
37
|
+
declare function logQueryLink(inner: ApolloLink, options?: LogQueryLinkOptions): ApolloLink;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Apollo link that transforms GraphQL operations before they are sent.
|
|
41
|
+
*
|
|
42
|
+
* Two mechanisms are supported and can be combined freely:
|
|
43
|
+
*
|
|
44
|
+
* **Hint-based** — place `# @gql-hint: <name>` comments directly in the query.
|
|
45
|
+
* Supported hints:
|
|
46
|
+
* - `remove-not-defined` on the operation definition: removes every variable
|
|
47
|
+
* whose value is null/undefined (definition + argument usage).
|
|
48
|
+
* - `inline-variable` on a variable definition or usage: substitutes the
|
|
49
|
+
* variable's current value directly into the query AST and removes it from
|
|
50
|
+
* the variables map.
|
|
51
|
+
*
|
|
52
|
+
* **Config-based** — pass a `QueryProcessingConfig` via Apollo context under
|
|
53
|
+
* the key `queryProcessingConfig`. Supported options:
|
|
54
|
+
* - `variables.removeIfNotDefined`: remove named variables when null/undefined.
|
|
55
|
+
* - `variables.removeIfNotUsed`: remove named variable definitions when the
|
|
56
|
+
* variable is not referenced anywhere in the (possibly already-transformed)
|
|
57
|
+
* query body.
|
|
58
|
+
* - `variables.inline`: inline named variables into the query AST.
|
|
59
|
+
*
|
|
60
|
+
* Hints are applied first, then config-based processing.
|
|
61
|
+
*/
|
|
62
|
+
declare const queryProcessingLink: ApolloLink;
|
|
63
|
+
|
|
17
64
|
declare function containsVariable(node: DocumentNode | ValueNode, variableName: string): boolean;
|
|
18
65
|
|
|
19
66
|
declare function gqlVar(varName: string): {
|
|
@@ -78,7 +125,7 @@ declare class GQLVariable {
|
|
|
78
125
|
constructor(name: string, type: string);
|
|
79
126
|
}
|
|
80
127
|
|
|
81
|
-
type GqlDatatableAccessor = Pick<DatatableComponent, 'page' | 'sort' | 'sorts' | 'filterStates'> & {
|
|
128
|
+
type GqlDatatableAccessor = Pick<DatatableComponent, 'page' | 'sort' | 'sorts' | 'filterStates' | 'resize' | 'pageInfo' | 'externalSorting'> & {
|
|
82
129
|
ngxDatatable: {
|
|
83
130
|
offset: number;
|
|
84
131
|
pageSize: number;
|
|
@@ -129,20 +176,36 @@ type DatatableGraphQLVariables = {
|
|
|
129
176
|
skip?: number;
|
|
130
177
|
take?: number;
|
|
131
178
|
} & EmptyObject;
|
|
179
|
+
type DatatableGraphQLErrorHandler = (error: readonly GraphQLFormattedError[]) => void;
|
|
132
180
|
/**
|
|
133
|
-
*
|
|
134
|
-
|
|
135
|
-
|
|
181
|
+
* Maximum number of error recovery attempts before throwing.
|
|
182
|
+
*/
|
|
183
|
+
declare const MAX_ERROR_RECOVERY_ATTEMPTS = 10;
|
|
184
|
+
/**
|
|
185
|
+
* Partially wraps ApolloClient's QueryRef with datatable paging, loading
|
|
186
|
+
* state, error handling, and debounced variable updates.
|
|
136
187
|
*/
|
|
137
188
|
declare class DatatableGraphQLQueryRef<TData, TVariables extends DatatableGraphQLVariables = EmptyObject, TRow = EmptyObject> {
|
|
138
189
|
/** Original ApolloClient's QueryRef. */
|
|
139
190
|
private readonly _queryRef;
|
|
140
191
|
/**
|
|
141
|
-
* How long to wait before
|
|
192
|
+
* How long to wait (ms) before applying variable changes and refetching.
|
|
142
193
|
*/
|
|
143
194
|
private readonly _updatesPollDelay;
|
|
195
|
+
/**
|
|
196
|
+
* Default error handler used when no subscriber is listening to `error$`.
|
|
197
|
+
*/
|
|
198
|
+
private readonly _defaultErrorHandler?;
|
|
144
199
|
private readonly _variablesSubject;
|
|
145
200
|
private readonly _observingChangesSubject;
|
|
201
|
+
private readonly _errorSubject;
|
|
202
|
+
/**
|
|
203
|
+
* Used to manually trigger a pending/loading state when we know a request is
|
|
204
|
+
* coming but Apollo hasn't started it yet (e.g. after setVariables resolves to
|
|
205
|
+
* a non-paging variable change while a request is already in-flight).
|
|
206
|
+
*/
|
|
207
|
+
private readonly _manualPendingSubject;
|
|
208
|
+
private readonly _needToRequerySubject;
|
|
146
209
|
/**
|
|
147
210
|
* Temporary way of tracking total count when paging is disabled.
|
|
148
211
|
*/
|
|
@@ -152,17 +215,41 @@ declare class DatatableGraphQLQueryRef<TData, TVariables extends DatatableGraphQ
|
|
|
152
215
|
private _variablesUpdatePending;
|
|
153
216
|
private readonly _valueChanges;
|
|
154
217
|
readonly loading$: Observable<boolean>;
|
|
218
|
+
/**
|
|
219
|
+
* Emits whenever the query variables change.
|
|
220
|
+
*/
|
|
221
|
+
readonly variables$: Observable<TVariables>;
|
|
222
|
+
/**
|
|
223
|
+
* Emits when a GraphQL error occurs.
|
|
224
|
+
*
|
|
225
|
+
* If nothing is subscribed to this, the `_defaultErrorHandler` is used
|
|
226
|
+
* (if provided). Once subscribed, the subscriber is responsible for
|
|
227
|
+
* handling the error.
|
|
228
|
+
*/
|
|
229
|
+
readonly error$: Observable<readonly GraphQLFormattedError[]>;
|
|
155
230
|
get updatesPollDelay(): number;
|
|
156
231
|
get variablesUpdatePending(): boolean;
|
|
157
232
|
constructor(
|
|
158
233
|
/** Original ApolloClient's QueryRef. */
|
|
159
234
|
_queryRef: QueryRef<TData, TVariables>,
|
|
160
235
|
/**
|
|
161
|
-
* How long to wait before
|
|
236
|
+
* How long to wait (ms) before applying variable changes and refetching.
|
|
237
|
+
*/
|
|
238
|
+
_updatesPollDelay?: number,
|
|
239
|
+
/**
|
|
240
|
+
* Default error handler used when no subscriber is listening to `error$`.
|
|
162
241
|
*/
|
|
163
|
-
|
|
242
|
+
_defaultErrorHandler?: DatatableGraphQLErrorHandler | undefined);
|
|
164
243
|
rows(mapper: DatatableGraphQLDataMapper<TData, TRow>): Observable<TRow[]>;
|
|
165
244
|
private _rowsObservable;
|
|
245
|
+
/**
|
|
246
|
+
* Reads the result and returns it unchanged if no errors.
|
|
247
|
+
*
|
|
248
|
+
* On errors: emits them via `error$` and replaces any `null` data properties
|
|
249
|
+
* with an empty collection shape `{ items: [], totalCount: 0 }` so mapper
|
|
250
|
+
* functions can run safely without special-casing the error path.
|
|
251
|
+
*/
|
|
252
|
+
private _handleResult;
|
|
166
253
|
private _needsToRequeryWithAllRecords;
|
|
167
254
|
private _resolveRowMapper;
|
|
168
255
|
getVariables(): TVariables;
|
|
@@ -170,11 +257,19 @@ declare class DatatableGraphQLQueryRef<TData, TVariables extends DatatableGraphQ
|
|
|
170
257
|
private _patchVariablesImmediate;
|
|
171
258
|
setVariables(variables: TVariables): void;
|
|
172
259
|
patchVariables(variables: Partial<TVariables>): void;
|
|
173
|
-
refetch(variables?: TVariables): Promise<ApolloQueryResult<TData>>;
|
|
260
|
+
refetch(variables?: TVariables, showLoading?: boolean): Promise<ApolloQueryResult<TData>>;
|
|
174
261
|
setQuery(query: DocumentNode$2 | TypedDocumentNode<TData, TVariables>, triggerRefetch?: boolean): void;
|
|
175
262
|
getOptions(): WatchQueryOptions<TVariables, TData> | undefined;
|
|
176
263
|
getQueryProcessingConfig(): QueryProcessingConfig | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Returns the variables that were actually sent with the last request, read
|
|
266
|
+
* directly from Apollo's observable query. This is more accurate than
|
|
267
|
+
* `_variablesSubject.value` when variables can change between the debounce
|
|
268
|
+
* firing and the response arriving.
|
|
269
|
+
*/
|
|
270
|
+
private _getVariablesFromQueryRef;
|
|
177
271
|
private _withVariableOverrides;
|
|
272
|
+
private _emitError;
|
|
178
273
|
}
|
|
179
274
|
|
|
180
275
|
type MapperContext<TExtraVariables = EmptyObject> = {
|
|
@@ -187,12 +282,54 @@ interface FilterStateMapperVariables {
|
|
|
187
282
|
[name: string]: any;
|
|
188
283
|
}
|
|
189
284
|
interface FilterStateMapperFilter {
|
|
285
|
+
and?: FilterStateMapperFilter[];
|
|
286
|
+
or?: FilterStateMapperFilter[];
|
|
190
287
|
[name: string]: any;
|
|
191
288
|
}
|
|
192
289
|
type FilterStateMapperResult = {
|
|
193
290
|
filter: FilterStateMapperFilter;
|
|
194
291
|
variables: FilterStateMapperVariables;
|
|
195
292
|
} | null;
|
|
293
|
+
/**
|
|
294
|
+
* A filter input type constrained to the field names of `T`.
|
|
295
|
+
*
|
|
296
|
+
* Use this as the building block for {@link TypedFilterStateMapperResult}
|
|
297
|
+
* when you want compile-time checking that filter conditions only reference
|
|
298
|
+
* real fields in the corresponding GQL input type.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* type MyFilter = TypedFilterInput<'id' | 'name'>
|
|
302
|
+
* // { id?: any; name?: any }
|
|
303
|
+
*/
|
|
304
|
+
type TypedFilterInput<T extends string | number | symbol> = {
|
|
305
|
+
[name in T]?: any;
|
|
306
|
+
};
|
|
307
|
+
/**
|
|
308
|
+
* A type-safe alternative to {@link FilterStateMapperResult} that constrains
|
|
309
|
+
* filter field names to the union `T`.
|
|
310
|
+
*
|
|
311
|
+
* The filter can be either a direct field-condition object or a combined
|
|
312
|
+
* object with `or`/`and` arrays:
|
|
313
|
+
*
|
|
314
|
+
* ```ts
|
|
315
|
+
* // Direct field condition
|
|
316
|
+
* { filter: { status: { eq: 'active' } }, variables: {} }
|
|
317
|
+
*
|
|
318
|
+
* // Combined (OR)
|
|
319
|
+
* { filter: { or: [{ id: { lt: 30 } }, { name: { contains: 'foo' } }] }, variables: {} }
|
|
320
|
+
* ```
|
|
321
|
+
*
|
|
322
|
+
* Because TypeScript uses structural typing, a mapper that returns
|
|
323
|
+
* `TypedFilterStateMapperResult<'id' | 'name'>` is assignable to the
|
|
324
|
+
* untyped {@link FilterStateMapper} signature without any cast.
|
|
325
|
+
*/
|
|
326
|
+
type TypedFilterStateMapperResult<T extends string | number | symbol> = {
|
|
327
|
+
filter: {
|
|
328
|
+
or?: TypedFilterInput<T>[];
|
|
329
|
+
and?: TypedFilterInput<T>[];
|
|
330
|
+
} | TypedFilterInput<T>;
|
|
331
|
+
variables: FilterStateMapperVariables;
|
|
332
|
+
} | null;
|
|
196
333
|
type FilterStateMapper = (filterState: DataFilterState, context: MapperContext) => FilterStateMapperResult | Promise<FilterStateMapperResult> | Observable<FilterStateMapperResult>;
|
|
197
334
|
interface FilterStateMappers {
|
|
198
335
|
[filterName: string]: FilterStateMapper;
|
|
@@ -205,6 +342,56 @@ type SortsMapperResult = {
|
|
|
205
342
|
type SortsMapper = (sorts: SortItem[], context: MapperContext) => SortsMapperResult | Promise<SortsMapperResult> | Observable<SortsMapperResult>;
|
|
206
343
|
declare function observeRowsWithGqlInputsHandling<TData, TRow, GqlVariables extends EmptyObject>(queryRef: DatatableGraphQLQueryRef<TData, GqlVariables, TRow>, rows: Observable<TRow[]>, datatable: Observable<GqlDatatableAccessor | undefined> | Promise<GqlDatatableAccessor | undefined> | GqlDatatableAccessor, extraVariables: Observable<Partial<GqlVariables>> | Promise<Partial<GqlVariables>> | Partial<GqlVariables>, sortsMapper: SortsMapper, filterStateMappers: FilterStateMappers): Observable<TRow[]>;
|
|
207
344
|
|
|
345
|
+
/**
|
|
346
|
+
* A field mapping entry for {@link createSortsMapper}:
|
|
347
|
+
*
|
|
348
|
+
* - `string` – the GQL sort-field name to emit for this column
|
|
349
|
+
* - `null` – column is not sortable; the sort item will be dropped
|
|
350
|
+
* - `function` – `(prop, context) => string | null` for dynamic mapping
|
|
351
|
+
* with access to {@link MapperContext}
|
|
352
|
+
*/
|
|
353
|
+
type SortsMapperFieldEntry = string | null | ((prop: string, context: MapperContext) => string | null);
|
|
354
|
+
/**
|
|
355
|
+
* A map from every column prop name in `TColumns` to its GQL sort field.
|
|
356
|
+
*
|
|
357
|
+
* Requiring every key at compile time provides exhaustiveness checking
|
|
358
|
+
* without needing a switch statement.
|
|
359
|
+
*/
|
|
360
|
+
type SortsMapperFieldMap<TColumns extends string> = {
|
|
361
|
+
[K in TColumns]: SortsMapperFieldEntry;
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Creates a {@link SortsMapper} from a declarative field-name map.
|
|
365
|
+
*
|
|
366
|
+
* Each key must correspond to a datatable column `prop` value. The value
|
|
367
|
+
* controls how that column's sort is translated to a GQL sort object:
|
|
368
|
+
*
|
|
369
|
+
* - `string` – emits `{ [gqlField]: 'ASC' | 'DESC' }`
|
|
370
|
+
* - `null` – column is not sortable; the sort item is dropped
|
|
371
|
+
* - `function` – called with `(prop, context)` and may return a field
|
|
372
|
+
* name or `null` to drop the item dynamically
|
|
373
|
+
*
|
|
374
|
+
* In dev mode an error is thrown when a sort item's `prop` is not present
|
|
375
|
+
* in the map. In production the item is silently dropped.
|
|
376
|
+
*
|
|
377
|
+
* @example
|
|
378
|
+
* // Simple static mapping
|
|
379
|
+
* const mapSorts = createSortsMapper<'id' | 'name'>({
|
|
380
|
+
* id: 'id',
|
|
381
|
+
* name: 'name',
|
|
382
|
+
* })
|
|
383
|
+
*
|
|
384
|
+
* @example
|
|
385
|
+
* // Dynamic mapping with context access
|
|
386
|
+
* const mapSorts = createSortsMapper<'id' | 'name' | 'computed'>({
|
|
387
|
+
* id: 'id',
|
|
388
|
+
* name: 'name',
|
|
389
|
+
* computed: (prop, context) =>
|
|
390
|
+
* context.extraVariables.useAlt ? 'altField' : prop,
|
|
391
|
+
* })
|
|
392
|
+
*/
|
|
393
|
+
declare function createSortsMapper<TColumns extends string>(fieldMap: SortsMapperFieldMap<TColumns>): SortsMapper;
|
|
394
|
+
|
|
208
395
|
/**
|
|
209
396
|
* NOTE: Any of ApolloClient's WatchQueryOptions properties can be set, but I
|
|
210
397
|
* think our components should only be providing `query` and `variables`. The
|
|
@@ -237,8 +424,22 @@ declare const mapSearchNumericColumnsDataFilterStateToGql: (filterState: Columns
|
|
|
237
424
|
|
|
238
425
|
declare const mapSearchTextColumnsDataFilterStateToGql: (filterState: ColumnsDataFilterState<TheSeamColumnsDataFilterTextSearchFormState>, context: MapperContext<any>) => FilterStateMapperResult;
|
|
239
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Inlines the variable's current value directly into the query AST and removes
|
|
429
|
+
* the variable definition from the parameter list. The variable is also
|
|
430
|
+
* removed from the operation's variables map so it is not sent to the server.
|
|
431
|
+
*
|
|
432
|
+
* Applies to VariableDefinition (comment above the `$var` in the parameter
|
|
433
|
+
* list) or Variable (inline comment beside a `$var` usage in the query body).
|
|
434
|
+
*/
|
|
240
435
|
declare const inlineVariableTransformer: HintTransformer;
|
|
241
436
|
|
|
437
|
+
/**
|
|
438
|
+
* Removes every variable from the query that is null or undefined in the
|
|
439
|
+
* operation's variables map. Both the variable definition (from the parameter
|
|
440
|
+
* list) and any argument usages in the query body are removed so the resulting
|
|
441
|
+
* document remains valid.
|
|
442
|
+
*/
|
|
242
443
|
declare const removeNotDefinedTransformer: HintTransformer;
|
|
243
444
|
|
|
244
445
|
/**
|
|
@@ -254,23 +455,43 @@ declare const removeNotDefinedHintDef: HintDefinition;
|
|
|
254
455
|
|
|
255
456
|
declare const baseSchemaFragment: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
256
457
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
type WhereItem = WhereItemCollection | WhereItemField;
|
|
269
|
-
type WhereArg = WhereItem;
|
|
458
|
+
type WhereArg = Record<string, any>;
|
|
459
|
+
/**
|
|
460
|
+
* Filters an array using a HotChocolate-style where clause.
|
|
461
|
+
*
|
|
462
|
+
* Top-level field conditions are implicitly ANDed. Use `and`/`or` arrays for
|
|
463
|
+
* explicit logical grouping.
|
|
464
|
+
*
|
|
465
|
+
* @example
|
|
466
|
+
* filterWhere(records, { name: { contains: 'foo' }, id: { gt: 5 } })
|
|
467
|
+
* filterWhere(records, { or: [{ name: { eq: 'a' } }, { name: { eq: 'b' } }] })
|
|
468
|
+
*/
|
|
270
469
|
declare function filterWhere<T>(data: T[], where: WhereArg): T[];
|
|
271
470
|
|
|
272
471
|
declare function skipAndTake<T>(data: T[], skip: number, take: number): T[];
|
|
273
472
|
|
|
473
|
+
/**
|
|
474
|
+
* A single sort clause in HotChocolate's order format.
|
|
475
|
+
* Each object has exactly one key: the field name, with a value of 'ASC' or 'DESC'.
|
|
476
|
+
*
|
|
477
|
+
* @example { memberOrganizationName: 'ASC' }
|
|
478
|
+
*/
|
|
479
|
+
type SortClause = Record<string, 'ASC' | 'DESC'>;
|
|
480
|
+
/**
|
|
481
|
+
* Sorts an array by a HotChocolate-style `order` argument.
|
|
482
|
+
*
|
|
483
|
+
* Earlier entries in the array take higher sort precedence. When two records
|
|
484
|
+
* are equal on all sort clauses they retain their original relative order
|
|
485
|
+
* (stable sort).
|
|
486
|
+
*
|
|
487
|
+
* Handles strings (locale-aware), numbers/dates, booleans, and null/undefined
|
|
488
|
+
* values (nulls sort last for both ASC and DESC).
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* sortItems(records, [{ name: 'ASC' }, { id: 'DESC' }])
|
|
492
|
+
*/
|
|
493
|
+
declare function sortItems<T>(items: T[], order: SortClause[]): T[];
|
|
494
|
+
|
|
274
495
|
interface FilteredResultsPageInfo {
|
|
275
496
|
hasNextPage: boolean;
|
|
276
497
|
hasPreviousPage: boolean;
|
|
@@ -291,9 +512,12 @@ declare class MockDatatable implements GqlDatatableAccessor {
|
|
|
291
512
|
private _bodyHeight;
|
|
292
513
|
private _scrolledPosV;
|
|
293
514
|
page: EventEmitter<TheSeamPageInfo>;
|
|
515
|
+
resize: EventEmitter<any>;
|
|
516
|
+
externalSorting: boolean;
|
|
294
517
|
sort: EventEmitter<SortEvent>;
|
|
295
518
|
get sorts(): SortItem[];
|
|
296
519
|
set sorts(value: SortItem[]);
|
|
520
|
+
get pageInfo(): TheSeamPageInfo;
|
|
297
521
|
readonly filterStates: Observable<DataFilterState[]>;
|
|
298
522
|
static pageDefaults(dt: any, defaultPageSize?: number): TheSeamPageInfo;
|
|
299
523
|
get ngxDatatable(): {
|
|
@@ -324,36 +548,16 @@ declare class MockDatatable implements GqlDatatableAccessor {
|
|
|
324
548
|
declare function checkRecordsHaveValue(arr: any[] | null, indices: (number | [startIndex: number, endIndex: number])[], testValueCheckProp?: string | null, onlyCheckProvidedIndices?: boolean): void;
|
|
325
549
|
|
|
326
550
|
/**
|
|
327
|
-
* Creates
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
* necessary for tests. Since we use a C# GraphQL api, it would be a lot of
|
|
332
|
-
* overhead to use that implementation in this project's tests, but you can
|
|
333
|
-
* check our `graphQLLink` to find what features have been implemented to
|
|
334
|
-
* hopefully match the result our api would return.
|
|
551
|
+
* Creates Apollo providers configured like our apps, except with the Apollo
|
|
552
|
+
* HttpLink replaced with a custom GraphQL link that queries from the schema
|
|
553
|
+
* and root value provided. Responses match what our real API returns, but
|
|
554
|
+
* query features are limited to what `graphQLLink` implements.
|
|
335
555
|
*
|
|
336
556
|
* NOTE: This was created because `ApolloTestingModule` is very limited. We
|
|
337
557
|
* mostly use queries intended to emit more than once, but `ApolloTestingModule`
|
|
338
558
|
* can only emit a query response once.
|
|
339
559
|
*/
|
|
340
|
-
declare function createApolloTestingProvider(schema: GraphQLSchema, rootValue: any):
|
|
341
|
-
provide: i0.InjectionToken<_apollo_client.ApolloClientOptions<any>>;
|
|
342
|
-
useFactory: () => {
|
|
343
|
-
cache: InMemoryCache;
|
|
344
|
-
link: _apollo_client.ApolloLink;
|
|
345
|
-
defaultOptions: {
|
|
346
|
-
watchQuery: {
|
|
347
|
-
fetchPolicy: string;
|
|
348
|
-
errorPolicy: string;
|
|
349
|
-
};
|
|
350
|
-
query: {
|
|
351
|
-
fetchPolicy: string;
|
|
352
|
-
errorPolicy: string;
|
|
353
|
-
};
|
|
354
|
-
};
|
|
355
|
-
};
|
|
356
|
-
};
|
|
560
|
+
declare function createApolloTestingProvider(schema: GraphQLSchema, rootValue: any, delay?: number): Provider;
|
|
357
561
|
|
|
358
562
|
interface SimpleGqlTestRecord {
|
|
359
563
|
id: number;
|
|
@@ -365,14 +569,21 @@ declare function createSimpleGqlTestRoot(numRecords: number): {
|
|
|
365
569
|
simpleGqlTestRecords: (args?: any) => _theseam_ui_common_graphql.FilteredResults<SimpleGqlTestRecord>;
|
|
366
570
|
};
|
|
367
571
|
declare const SIMPLE_GQL_TEST_QUERY: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
572
|
+
/**
|
|
573
|
+
* Like {@link SIMPLE_GQL_TEST_QUERY} but includes `$search: String` for use
|
|
574
|
+
* with search filters that inline a `gqlVar('search')` reference via
|
|
575
|
+
* `queryProcessingConfig.variables.inline`.
|
|
576
|
+
*/
|
|
577
|
+
declare const SIMPLE_GQL_TEST_SEARCH_QUERY: apollo_angular.TypedDocumentNode<unknown, unknown>;
|
|
368
578
|
interface SimpleGqlTestExtraVariables {
|
|
369
579
|
}
|
|
370
580
|
interface SimpleGqlTestVariables extends SimpleGqlTestExtraVariables {
|
|
371
581
|
skip?: number;
|
|
372
582
|
take?: number;
|
|
373
|
-
order?:
|
|
583
|
+
order?: Partial<Record<keyof SimpleGqlTestRecord, 'ASC' | 'DESC'>>[];
|
|
374
584
|
where?: any;
|
|
585
|
+
search?: string;
|
|
375
586
|
}
|
|
376
587
|
|
|
377
|
-
export { DATATABLE_GRAPHQL_SERVICE_CONFIG, DEFAULT_PAGE_SIZE, DEFAULT_TO_REMOVE_ON_UNDEFINED, DatatableGraphQLQueryRef, DatatableGraphqlService, GQLDirection, GQLVariable, HINT_NAMES_CAPTURE_REGEX, HINT_PREFIX_REGEX, HintsKind, MockDatatable, SIMPLE_GQL_TEST_QUERY, baseSchemaFragment, checkRecordsHaveValue, containsVariable, createApolloTestingProvider, createHintsToken, createSimpleGqlTestRecord, createSimpleGqlTestRoot, filterWhere, filteredResults, getHintsToken, getPageInfo, getTokenAppliesTo, gqlVar, hintNamesFromHintToken, hintsTokensContainingHint, inlineVariable, inlineVariableHintDef, inlineVariableTransformer, isCommentToken, isHintToken, isInlineComment, mapFilterStates, mapSearchDateColumnsDataFilterStateToGql, mapSearchNumericColumnsDataFilterStateToGql, mapSearchTextColumnsDataFilterStateToGql, observeRowsWithGqlInputsHandling, parseAst, parseComments, parseHints, removeNotDefinedHintDef, removeNotDefinedTransformer, removeVariable, removeVariableDefinition, removeVariableDefinitionsNotDefined, simpleGqlTestSchema, skipAndTake, toGQL };
|
|
378
|
-
export type { DatatableGraphQLDataMapper, DatatableGraphQLDataMapperResult, DatatableGraphQLVariables, DatatableGraphqlServiceConfig, DatatableQueryOptions, EmptyObject, FilterStateMapper, FilterStateMapperFilter, FilterStateMapperResult, FilterStateMapperVariables, FilterStateMappers, FilteredResults, FilteredResultsPageInfo, GqlDatatableAccessor, HintDefinition, HintTransformOperation, HintTransformer, HintsToken, MapperContext, QueryProcessingConfig, QueryProcessingVariablesConfig, SimpleGqlTestExtraVariables, SimpleGqlTestRecord, SimpleGqlTestVariables, SortsMapper, SortsMapperResult, WhereArg };
|
|
588
|
+
export { DATATABLE_GRAPHQL_SERVICE_CONFIG, DEFAULT_PAGE_SIZE, DEFAULT_TO_REMOVE_ON_UNDEFINED, DatatableGraphQLQueryRef, DatatableGraphqlService, GQLDirection, GQLVariable, HINT_NAMES_CAPTURE_REGEX, HINT_PREFIX_REGEX, HintsKind, MAX_ERROR_RECOVERY_ATTEMPTS, MockDatatable, SIMPLE_GQL_TEST_QUERY, SIMPLE_GQL_TEST_SEARCH_QUERY, baseSchemaFragment, checkRecordsHaveValue, containsVariable, createApolloTestingProvider, createHintsToken, createSimpleGqlTestRecord, createSimpleGqlTestRoot, createSortsMapper, filterWhere, filteredResults, getHintsToken, getPageInfo, getTokenAppliesTo, gqlVar, hintNamesFromHintToken, hintsTokensContainingHint, inlineVariable, inlineVariableHintDef, inlineVariableTransformer, isCommentToken, isHintToken, isInlineComment, logQueryLink, mapFilterStates, mapSearchDateColumnsDataFilterStateToGql, mapSearchNumericColumnsDataFilterStateToGql, mapSearchTextColumnsDataFilterStateToGql, observeRowsWithGqlInputsHandling, parseAst, parseComments, parseHints, queryProcessingLink, removeNotDefinedHintDef, removeNotDefinedTransformer, removeVariable, removeVariableDefinition, removeVariableDefinitionsNotDefined, simpleGqlTestSchema, skipAndTake, sortItems, toGQL };
|
|
589
|
+
export type { DatatableGraphQLDataMapper, DatatableGraphQLDataMapperResult, DatatableGraphQLErrorHandler, DatatableGraphQLVariables, DatatableGraphqlServiceConfig, DatatableQueryOptions, EmptyObject, FilterStateMapper, FilterStateMapperFilter, FilterStateMapperResult, FilterStateMapperVariables, FilterStateMappers, FilteredResults, FilteredResultsPageInfo, GqlDatatableAccessor, HintDefinition, HintTransformOperation, HintTransformer, HintsToken, LogQueryLinkOptions, MapperContext, QueryProcessingConfig, QueryProcessingVariablesConfig, SimpleGqlTestExtraVariables, SimpleGqlTestRecord, SimpleGqlTestVariables, SortClause, SortsMapper, SortsMapperFieldEntry, SortsMapperFieldMap, SortsMapperResult, TypedFilterInput, TypedFilterStateMapperResult, WhereArg };
|
package/modal/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
# Modal
|
|
2
|
-
|
|
3
|
-
For now this module will be mostly using code from the `cdk-experimental` `dialog`.
|
|
4
|
-
|
|
5
|
-
When `cdk-experimental` gets moved to `cdk` we may just end up using it. If we have neccessary customizations for our use cases then this will just wrap it or extend neccessary parts.
|
|
1
|
+
# Modal
|
|
2
|
+
|
|
3
|
+
For now this module will be mostly using code from the `cdk-experimental` `dialog`.
|
|
4
|
+
|
|
5
|
+
When `cdk-experimental` gets moved to `cdk` we may just end up using it. If we have neccessary customizations for our use cases then this will just wrap it or extend neccessary parts.
|
package/package.json
CHANGED