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