@genesislcap/foundation-forms 14.4.0 → 14.5.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/dts/filters/filters.d.ts +98 -0
- package/dist/dts/filters/filters.d.ts.map +1 -0
- package/dist/dts/filters/filters.styles.d.ts +2 -0
- package/dist/dts/filters/filters.styles.d.ts.map +1 -0
- package/dist/dts/filters/filters.template.d.ts +3 -0
- package/dist/dts/filters/filters.template.d.ts.map +1 -0
- package/dist/dts/filters/index.d.ts +2 -0
- package/dist/dts/filters/index.d.ts.map +1 -0
- package/dist/dts/index.d.ts +1 -0
- package/dist/dts/index.d.ts.map +1 -1
- package/dist/dts/jsonforms/renderers/ControlWrapperRenderer.d.ts.map +1 -1
- package/dist/dts/jsonforms/renderers/FilterDateControlRenderer.d.ts +3 -0
- package/dist/dts/jsonforms/renderers/FilterDateControlRenderer.d.ts.map +1 -0
- package/dist/dts/jsonforms/renderers/FilterNumberControlRenderer.d.ts +3 -0
- package/dist/dts/jsonforms/renderers/FilterNumberControlRenderer.d.ts.map +1 -0
- package/dist/dts/utils/filters.d.ts +13 -0
- package/dist/dts/utils/filters.d.ts.map +1 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/utils/index.d.ts.map +1 -1
- package/dist/esm/filters/filters.js +144 -0
- package/dist/esm/filters/filters.styles.js +62 -0
- package/dist/esm/filters/filters.template.js +40 -0
- package/dist/esm/filters/index.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/jsonforms/renderers/ControlWrapperRenderer.js +1 -0
- package/dist/esm/jsonforms/renderers/FilterDateControlRenderer.js +67 -0
- package/dist/esm/jsonforms/renderers/FilterNumberControlRenderer.js +60 -0
- package/dist/esm/utils/filters.js +84 -0
- package/dist/esm/utils/index.js +1 -0
- package/dist/foundation-forms.api.json +363 -0
- package/dist/foundation-forms.d.ts +109 -0
- package/docs/api/foundation-forms.createexpressions.md +13 -0
- package/docs/api/foundation-forms.filters.clearfiltersdata.md +18 -0
- package/docs/api/foundation-forms.filters.data.md +13 -0
- package/docs/api/foundation-forms.filters.disconnectedcallback.md +18 -0
- package/docs/api/foundation-forms.filters.jsonschema.md +18 -0
- package/docs/api/foundation-forms.filters.md +37 -0
- package/docs/api/foundation-forms.filters.renderers.md +13 -0
- package/docs/api/foundation-forms.filters.resourcename.md +13 -0
- package/docs/api/foundation-forms.filters.uischema.md +50 -0
- package/docs/api/foundation-forms.filters.value.md +13 -0
- package/docs/api/foundation-forms.filters.valuechanged.md +18 -0
- package/docs/api/foundation-forms.filtersrenderers.md +12 -0
- package/docs/api/foundation-forms.md +3 -0
- package/docs/api-report.md +40 -0
- package/package.json +6 -5
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ExpressionBuilder, Serialisers } from '@genesislcap/foundation-criteria';
|
|
2
|
+
const hour = 23;
|
|
3
|
+
const minute = 59;
|
|
4
|
+
const sec = 999;
|
|
5
|
+
/**
|
|
6
|
+
* Creates a expressions/criteria from given payload
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export const createExpressions = (payload) => {
|
|
10
|
+
const expressions = {
|
|
11
|
+
options: [],
|
|
12
|
+
dateOptions: [],
|
|
13
|
+
numberOptions: [],
|
|
14
|
+
};
|
|
15
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
16
|
+
if ((value && !value.type) || (value && value.max) || (value && value.min)) {
|
|
17
|
+
if (Array.isArray(value)) {
|
|
18
|
+
const optionsExpressions = value.map((item) => {
|
|
19
|
+
return new ExpressionBuilder()
|
|
20
|
+
.withField(key)
|
|
21
|
+
.withValue(item)
|
|
22
|
+
.withSerialiser(Serialisers.EQ)
|
|
23
|
+
.build();
|
|
24
|
+
});
|
|
25
|
+
expressions.options = [...optionsExpressions, ...expressions.options];
|
|
26
|
+
}
|
|
27
|
+
else if (value && (value.min || value.max)) {
|
|
28
|
+
if (value.type == 'number') {
|
|
29
|
+
expressions.numberOptions = [
|
|
30
|
+
...dateNumberExpressions(key, value, 'number'),
|
|
31
|
+
...expressions.numberOptions,
|
|
32
|
+
];
|
|
33
|
+
}
|
|
34
|
+
if (value.type == 'date') {
|
|
35
|
+
expressions.dateOptions = [
|
|
36
|
+
...dateNumberExpressions(key, value, 'date'),
|
|
37
|
+
...expressions.dateOptions,
|
|
38
|
+
];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const stringOptions = new ExpressionBuilder()
|
|
43
|
+
.withField(key)
|
|
44
|
+
.withValue(value)
|
|
45
|
+
.withSerialiser(Serialisers.EQ)
|
|
46
|
+
.build();
|
|
47
|
+
expressions.options = [stringOptions, ...expressions.options];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return expressions;
|
|
52
|
+
};
|
|
53
|
+
const dateNumberExpressions = (key, value, type) => {
|
|
54
|
+
let startDay;
|
|
55
|
+
let endDay;
|
|
56
|
+
if (type == 'date') {
|
|
57
|
+
startDay = value.min ? convertTimestampToDate(value.min) : undefined;
|
|
58
|
+
endDay = value.max ? convertTimestampToDate(value.max) : undefined;
|
|
59
|
+
}
|
|
60
|
+
const expressions = [];
|
|
61
|
+
const startExpression = value.min
|
|
62
|
+
? new ExpressionBuilder()
|
|
63
|
+
.withField(key)
|
|
64
|
+
.withValue(startDay !== null && startDay !== void 0 ? startDay : value.min)
|
|
65
|
+
.withSerialiser(startDay ? Serialisers.dateIsGreaterEqual : Serialisers.GE)
|
|
66
|
+
.build()
|
|
67
|
+
: undefined;
|
|
68
|
+
const endExpression = value.max
|
|
69
|
+
? new ExpressionBuilder()
|
|
70
|
+
.withField(key)
|
|
71
|
+
.withValue(endDay !== null && endDay !== void 0 ? endDay : value.max)
|
|
72
|
+
.withSerialiser(endDay ? Serialisers.dateIsLessEqual : Serialisers.LE)
|
|
73
|
+
.build()
|
|
74
|
+
: undefined;
|
|
75
|
+
startExpression ? expressions.push(startExpression) : '';
|
|
76
|
+
endExpression ? expressions.push(endExpression) : '';
|
|
77
|
+
return expressions;
|
|
78
|
+
};
|
|
79
|
+
const convertTimestampToDate = (timestamp) => {
|
|
80
|
+
const months = (new Date(timestamp).getUTCMonth() + 1).toString().padStart(2, '0');
|
|
81
|
+
const days = new Date(timestamp).getUTCDate().toString().padStart(2, '0');
|
|
82
|
+
const year = new Date(timestamp).getUTCFullYear().toString();
|
|
83
|
+
return [year, months, days].join('');
|
|
84
|
+
};
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -172,6 +172,369 @@
|
|
|
172
172
|
"name": "",
|
|
173
173
|
"preserveMemberOrder": false,
|
|
174
174
|
"members": [
|
|
175
|
+
{
|
|
176
|
+
"kind": "Variable",
|
|
177
|
+
"canonicalReference": "@genesislcap/foundation-forms!createExpressions:var",
|
|
178
|
+
"docComment": "/**\n * Creates a expressions/criteria from given payload\n *\n * @public\n */\n",
|
|
179
|
+
"excerptTokens": [
|
|
180
|
+
{
|
|
181
|
+
"kind": "Content",
|
|
182
|
+
"text": "createExpressions: "
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"kind": "Content",
|
|
186
|
+
"text": "(payload: any) => "
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"kind": "Reference",
|
|
190
|
+
"text": "Expressions",
|
|
191
|
+
"canonicalReference": "@genesislcap/foundation-forms!~Expressions:type"
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"fileUrlPath": "src/utils/filters.ts",
|
|
195
|
+
"isReadonly": true,
|
|
196
|
+
"releaseTag": "Public",
|
|
197
|
+
"name": "createExpressions",
|
|
198
|
+
"variableTypeTokenRange": {
|
|
199
|
+
"startIndex": 1,
|
|
200
|
+
"endIndex": 3
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"kind": "Class",
|
|
205
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters:class",
|
|
206
|
+
"docComment": "/**\n * Foundation filters component for automatically generated filters based on json schema obtained from the api, supplied initial data or supplied JSON schema. Allowing customisable filters elements using UI schema and set of custom renderers\n *\n * @beta\n */\n",
|
|
207
|
+
"excerptTokens": [
|
|
208
|
+
{
|
|
209
|
+
"kind": "Content",
|
|
210
|
+
"text": "export declare class Filters extends "
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"kind": "Reference",
|
|
214
|
+
"text": "FoundationElement",
|
|
215
|
+
"canonicalReference": "@microsoft/fast-foundation!FoundationElement:class"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"kind": "Content",
|
|
219
|
+
"text": " "
|
|
220
|
+
}
|
|
221
|
+
],
|
|
222
|
+
"fileUrlPath": "src/filters/filters.ts",
|
|
223
|
+
"releaseTag": "Beta",
|
|
224
|
+
"isAbstract": false,
|
|
225
|
+
"name": "Filters",
|
|
226
|
+
"preserveMemberOrder": false,
|
|
227
|
+
"members": [
|
|
228
|
+
{
|
|
229
|
+
"kind": "Method",
|
|
230
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#clearFiltersData:member(1)",
|
|
231
|
+
"docComment": "",
|
|
232
|
+
"excerptTokens": [
|
|
233
|
+
{
|
|
234
|
+
"kind": "Content",
|
|
235
|
+
"text": "clearFiltersData(): "
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"kind": "Content",
|
|
239
|
+
"text": "void"
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
"kind": "Content",
|
|
243
|
+
"text": ";"
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
"isStatic": false,
|
|
247
|
+
"returnTypeTokenRange": {
|
|
248
|
+
"startIndex": 1,
|
|
249
|
+
"endIndex": 2
|
|
250
|
+
},
|
|
251
|
+
"releaseTag": "Beta",
|
|
252
|
+
"isProtected": false,
|
|
253
|
+
"overloadIndex": 1,
|
|
254
|
+
"parameters": [],
|
|
255
|
+
"isOptional": false,
|
|
256
|
+
"isAbstract": false,
|
|
257
|
+
"name": "clearFiltersData"
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"kind": "Property",
|
|
261
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#data:member",
|
|
262
|
+
"docComment": "/**\n * Initial data for the filters\n *\n * @public\n */\n",
|
|
263
|
+
"excerptTokens": [
|
|
264
|
+
{
|
|
265
|
+
"kind": "Content",
|
|
266
|
+
"text": "data: "
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
"kind": "Content",
|
|
270
|
+
"text": "any"
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
"kind": "Content",
|
|
274
|
+
"text": ";"
|
|
275
|
+
}
|
|
276
|
+
],
|
|
277
|
+
"isReadonly": false,
|
|
278
|
+
"isOptional": false,
|
|
279
|
+
"releaseTag": "Public",
|
|
280
|
+
"name": "data",
|
|
281
|
+
"propertyTypeTokenRange": {
|
|
282
|
+
"startIndex": 1,
|
|
283
|
+
"endIndex": 2
|
|
284
|
+
},
|
|
285
|
+
"isStatic": false,
|
|
286
|
+
"isProtected": false,
|
|
287
|
+
"isAbstract": false
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"kind": "Method",
|
|
291
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#disconnectedCallback:member(1)",
|
|
292
|
+
"docComment": "",
|
|
293
|
+
"excerptTokens": [
|
|
294
|
+
{
|
|
295
|
+
"kind": "Content",
|
|
296
|
+
"text": "disconnectedCallback(): "
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
"kind": "Content",
|
|
300
|
+
"text": "void"
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"kind": "Content",
|
|
304
|
+
"text": ";"
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
"isStatic": false,
|
|
308
|
+
"returnTypeTokenRange": {
|
|
309
|
+
"startIndex": 1,
|
|
310
|
+
"endIndex": 2
|
|
311
|
+
},
|
|
312
|
+
"releaseTag": "Beta",
|
|
313
|
+
"isProtected": false,
|
|
314
|
+
"overloadIndex": 1,
|
|
315
|
+
"parameters": [],
|
|
316
|
+
"isOptional": false,
|
|
317
|
+
"isAbstract": false,
|
|
318
|
+
"name": "disconnectedCallback"
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"kind": "Property",
|
|
322
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#jsonSchema:member",
|
|
323
|
+
"docComment": "/**\n * Alternatively to providing {@link Form.resourceName} you can hardcode the JSON schema on the client.\n *\n * @remarks\n *\n * Use this when you want to avoid fetching metadata from the server but be aware that it could get out of sync if metadata changes on the server\n *\n * @public\n */\n",
|
|
324
|
+
"excerptTokens": [
|
|
325
|
+
{
|
|
326
|
+
"kind": "Content",
|
|
327
|
+
"text": "jsonSchema: "
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
"kind": "Reference",
|
|
331
|
+
"text": "JSONSchema7",
|
|
332
|
+
"canonicalReference": "@types/json-schema!JSONSchema7:interface"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"kind": "Content",
|
|
336
|
+
"text": ";"
|
|
337
|
+
}
|
|
338
|
+
],
|
|
339
|
+
"isReadonly": false,
|
|
340
|
+
"isOptional": false,
|
|
341
|
+
"releaseTag": "Public",
|
|
342
|
+
"name": "jsonSchema",
|
|
343
|
+
"propertyTypeTokenRange": {
|
|
344
|
+
"startIndex": 1,
|
|
345
|
+
"endIndex": 2
|
|
346
|
+
},
|
|
347
|
+
"isStatic": false,
|
|
348
|
+
"isProtected": false,
|
|
349
|
+
"isAbstract": false
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"kind": "Property",
|
|
353
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#renderers:member",
|
|
354
|
+
"docComment": "/**\n * Allows to provide set of renderers used by the filters. If not provided it will default to text-field inputs\n *\n * @public\n */\n",
|
|
355
|
+
"excerptTokens": [
|
|
356
|
+
{
|
|
357
|
+
"kind": "Content",
|
|
358
|
+
"text": "renderers: "
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"kind": "Reference",
|
|
362
|
+
"text": "RendererEntry",
|
|
363
|
+
"canonicalReference": "@genesislcap/foundation-forms!RendererEntry:type"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"kind": "Content",
|
|
367
|
+
"text": "[]"
|
|
368
|
+
},
|
|
369
|
+
{
|
|
370
|
+
"kind": "Content",
|
|
371
|
+
"text": ";"
|
|
372
|
+
}
|
|
373
|
+
],
|
|
374
|
+
"isReadonly": false,
|
|
375
|
+
"isOptional": false,
|
|
376
|
+
"releaseTag": "Public",
|
|
377
|
+
"name": "renderers",
|
|
378
|
+
"propertyTypeTokenRange": {
|
|
379
|
+
"startIndex": 1,
|
|
380
|
+
"endIndex": 3
|
|
381
|
+
},
|
|
382
|
+
"isStatic": false,
|
|
383
|
+
"isProtected": false,
|
|
384
|
+
"isAbstract": false
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
"kind": "Property",
|
|
388
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#resourceName:member",
|
|
389
|
+
"docComment": "/**\n * Name of the backend resource which will provide metadata used to generate filters\n *\n * @public\n */\n",
|
|
390
|
+
"excerptTokens": [
|
|
391
|
+
{
|
|
392
|
+
"kind": "Content",
|
|
393
|
+
"text": "resourceName: "
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"kind": "Content",
|
|
397
|
+
"text": "string"
|
|
398
|
+
},
|
|
399
|
+
{
|
|
400
|
+
"kind": "Content",
|
|
401
|
+
"text": ";"
|
|
402
|
+
}
|
|
403
|
+
],
|
|
404
|
+
"isReadonly": false,
|
|
405
|
+
"isOptional": false,
|
|
406
|
+
"releaseTag": "Public",
|
|
407
|
+
"name": "resourceName",
|
|
408
|
+
"propertyTypeTokenRange": {
|
|
409
|
+
"startIndex": 1,
|
|
410
|
+
"endIndex": 2
|
|
411
|
+
},
|
|
412
|
+
"isStatic": false,
|
|
413
|
+
"isProtected": false,
|
|
414
|
+
"isAbstract": false
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
"kind": "Property",
|
|
418
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#uischema:member",
|
|
419
|
+
"docComment": "/**\n * UI schema used to define configuration of the layout and elements in the filters Check {@link UiSchemaElement} for possible options\n *\n * @remarks\n *\n * If not provided will be autogenerated based on json schema or initial data\n *\n * @example\n *\n * Here's a simple example:\n * ```\n * const sampleUISchema = {\n * type: 'VerticalLayout',\n * elements: [\n * {\n * type: 'Control',\n * scope: '#/properties/QUANTITY',\n * label: 'Quantity',\n * },\n * {\n * type: 'Control',\n * scope: '#/properties/INSTRUMENT_ID',\n * options: {\n * allOptionsResourceName: 'INSTRUMENT',\n * valueField: 'INSTRUMENT_ID',\n * labelField: 'INSTRUMENT_ID',\n * },\n * label: 'Instrument',\n * },\n * {\n * type: 'Control',\n * scope: '#/properties/SIDE',\n * label: 'Side',\n * },\n * ],\n * };\n * ```\n *\n * @public\n */\n",
|
|
420
|
+
"excerptTokens": [
|
|
421
|
+
{
|
|
422
|
+
"kind": "Content",
|
|
423
|
+
"text": "uischema: "
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"kind": "Reference",
|
|
427
|
+
"text": "UISchemaElement",
|
|
428
|
+
"canonicalReference": "@jsonforms/core!UISchemaElement:interface"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"kind": "Content",
|
|
432
|
+
"text": ";"
|
|
433
|
+
}
|
|
434
|
+
],
|
|
435
|
+
"isReadonly": false,
|
|
436
|
+
"isOptional": false,
|
|
437
|
+
"releaseTag": "Public",
|
|
438
|
+
"name": "uischema",
|
|
439
|
+
"propertyTypeTokenRange": {
|
|
440
|
+
"startIndex": 1,
|
|
441
|
+
"endIndex": 2
|
|
442
|
+
},
|
|
443
|
+
"isStatic": false,
|
|
444
|
+
"isProtected": false,
|
|
445
|
+
"isAbstract": false
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"kind": "Property",
|
|
449
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#value:member",
|
|
450
|
+
"docComment": "/**\n * Created criteria based on the given data that can be used to filter the data\n *\n * @public\n */\n",
|
|
451
|
+
"excerptTokens": [
|
|
452
|
+
{
|
|
453
|
+
"kind": "Content",
|
|
454
|
+
"text": "value: "
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"kind": "Content",
|
|
458
|
+
"text": "string"
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
"kind": "Content",
|
|
462
|
+
"text": ";"
|
|
463
|
+
}
|
|
464
|
+
],
|
|
465
|
+
"isReadonly": false,
|
|
466
|
+
"isOptional": false,
|
|
467
|
+
"releaseTag": "Public",
|
|
468
|
+
"name": "value",
|
|
469
|
+
"propertyTypeTokenRange": {
|
|
470
|
+
"startIndex": 1,
|
|
471
|
+
"endIndex": 2
|
|
472
|
+
},
|
|
473
|
+
"isStatic": false,
|
|
474
|
+
"isProtected": false,
|
|
475
|
+
"isAbstract": false
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"kind": "Method",
|
|
479
|
+
"canonicalReference": "@genesislcap/foundation-forms!Filters#valueChanged:member(1)",
|
|
480
|
+
"docComment": "",
|
|
481
|
+
"excerptTokens": [
|
|
482
|
+
{
|
|
483
|
+
"kind": "Content",
|
|
484
|
+
"text": "valueChanged(): "
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
"kind": "Content",
|
|
488
|
+
"text": "void"
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
"kind": "Content",
|
|
492
|
+
"text": ";"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
"isStatic": false,
|
|
496
|
+
"returnTypeTokenRange": {
|
|
497
|
+
"startIndex": 1,
|
|
498
|
+
"endIndex": 2
|
|
499
|
+
},
|
|
500
|
+
"releaseTag": "Beta",
|
|
501
|
+
"isProtected": false,
|
|
502
|
+
"overloadIndex": 1,
|
|
503
|
+
"parameters": [],
|
|
504
|
+
"isOptional": false,
|
|
505
|
+
"isAbstract": false,
|
|
506
|
+
"name": "valueChanged"
|
|
507
|
+
}
|
|
508
|
+
],
|
|
509
|
+
"extendsTokenRange": {
|
|
510
|
+
"startIndex": 1,
|
|
511
|
+
"endIndex": 2
|
|
512
|
+
},
|
|
513
|
+
"implementsTokenRanges": []
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"kind": "Variable",
|
|
517
|
+
"canonicalReference": "@genesislcap/foundation-forms!filtersRenderers:var",
|
|
518
|
+
"docComment": "/**\n * @public\n */\n",
|
|
519
|
+
"excerptTokens": [
|
|
520
|
+
{
|
|
521
|
+
"kind": "Content",
|
|
522
|
+
"text": "filtersRenderers: "
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
"kind": "Content",
|
|
526
|
+
"text": "any[]"
|
|
527
|
+
}
|
|
528
|
+
],
|
|
529
|
+
"fileUrlPath": "src/filters/filters.ts",
|
|
530
|
+
"isReadonly": true,
|
|
531
|
+
"releaseTag": "Public",
|
|
532
|
+
"name": "filtersRenderers",
|
|
533
|
+
"variableTypeTokenRange": {
|
|
534
|
+
"startIndex": 1,
|
|
535
|
+
"endIndex": 2
|
|
536
|
+
}
|
|
537
|
+
},
|
|
175
538
|
{
|
|
176
539
|
"kind": "Class",
|
|
177
540
|
"canonicalReference": "@genesislcap/foundation-forms!Form:class",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ErrorObject } from 'ajv';
|
|
2
2
|
import { ErrorTranslator } from '@jsonforms/core';
|
|
3
|
+
import { Expression } from '@genesislcap/foundation-criteria';
|
|
3
4
|
import { FASTElement } from '@microsoft/fast-element';
|
|
4
5
|
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
5
6
|
import { JsonFormsState } from '@jsonforms/core';
|
|
@@ -11,6 +12,12 @@ import { StatePropsOfControl } from '@jsonforms/core';
|
|
|
11
12
|
import { UISchemaElement } from '@jsonforms/core';
|
|
12
13
|
import { ViewTemplate } from '@microsoft/fast-element';
|
|
13
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Creates a expressions/criteria from given payload
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
export declare const createExpressions: (payload: any) => Expressions;
|
|
20
|
+
|
|
14
21
|
declare class DispatchRenderer extends FASTElement {
|
|
15
22
|
jsonforms: any;
|
|
16
23
|
jsonformsChanged(): void;
|
|
@@ -28,6 +35,108 @@ declare class DispatchRenderer extends FASTElement {
|
|
|
28
35
|
disconnectedCallback(): void;
|
|
29
36
|
}
|
|
30
37
|
|
|
38
|
+
declare type Expressions = {
|
|
39
|
+
options: Expression[];
|
|
40
|
+
numberOptions: Expression[];
|
|
41
|
+
dateOptions: Expression[];
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Foundation filters component for automatically generated filters based on json schema
|
|
46
|
+
* obtained from the api, supplied initial data or supplied JSON schema.
|
|
47
|
+
* Allowing customisable filters elements using UI schema and set of custom renderers
|
|
48
|
+
* @beta
|
|
49
|
+
*/
|
|
50
|
+
export declare class Filters extends FoundationElement {
|
|
51
|
+
/**
|
|
52
|
+
* Name of the backend resource which will provide metadata
|
|
53
|
+
* used to generate filters
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
resourceName: string;
|
|
57
|
+
private resourceNameChanged;
|
|
58
|
+
clearFiltersData(): void;
|
|
59
|
+
/**
|
|
60
|
+
* UI schema used to define configuration of the layout and elements in the filters
|
|
61
|
+
* Check {@link UiSchemaElement} for possible options
|
|
62
|
+
*
|
|
63
|
+
* @remarks
|
|
64
|
+
* If not provided will be autogenerated based on json schema or initial data
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* Here's a simple example:
|
|
68
|
+
* ```
|
|
69
|
+
* const sampleUISchema = {
|
|
70
|
+
* type: 'VerticalLayout',
|
|
71
|
+
* elements: [
|
|
72
|
+
* {
|
|
73
|
+
* type: 'Control',
|
|
74
|
+
* scope: '#/properties/QUANTITY',
|
|
75
|
+
* label: 'Quantity',
|
|
76
|
+
* },
|
|
77
|
+
* {
|
|
78
|
+
* type: 'Control',
|
|
79
|
+
* scope: '#/properties/INSTRUMENT_ID',
|
|
80
|
+
* options: {
|
|
81
|
+
* allOptionsResourceName: 'INSTRUMENT',
|
|
82
|
+
* valueField: 'INSTRUMENT_ID',
|
|
83
|
+
* labelField: 'INSTRUMENT_ID',
|
|
84
|
+
* },
|
|
85
|
+
* label: 'Instrument',
|
|
86
|
+
* },
|
|
87
|
+
* {
|
|
88
|
+
* type: 'Control',
|
|
89
|
+
* scope: '#/properties/SIDE',
|
|
90
|
+
* label: 'Side',
|
|
91
|
+
* },
|
|
92
|
+
* ],
|
|
93
|
+
* };
|
|
94
|
+
* ```
|
|
95
|
+
* @public
|
|
96
|
+
*/
|
|
97
|
+
uischema: UISchemaElement;
|
|
98
|
+
/**
|
|
99
|
+
* Allows to provide set of renderers used by the filters. If not provided it will default to text-field inputs
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
renderers: RendererEntry[];
|
|
103
|
+
/**
|
|
104
|
+
* Alternatively to providing {@link Form.resourceName} you can hardcode the JSON schema on the client.
|
|
105
|
+
* @public
|
|
106
|
+
* @remarks
|
|
107
|
+
* Use this when you want to avoid fetching metadata from the server but
|
|
108
|
+
* be aware that it could get out of sync if metadata changes on the server
|
|
109
|
+
*/
|
|
110
|
+
jsonSchema: JSONSchema7;
|
|
111
|
+
private connect;
|
|
112
|
+
/**
|
|
113
|
+
* Initial data for the filters
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
data: any;
|
|
117
|
+
/**
|
|
118
|
+
* Created criteria based on the given data that can be used to filter the data
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
value: string;
|
|
122
|
+
valueChanged(): void;
|
|
123
|
+
/**
|
|
124
|
+
* @internal
|
|
125
|
+
*/
|
|
126
|
+
searchFilters(): void;
|
|
127
|
+
/**
|
|
128
|
+
* @internal
|
|
129
|
+
*/
|
|
130
|
+
onChange(event: CustomEvent): void;
|
|
131
|
+
disconnectedCallback(): void;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/** @internal */
|
|
135
|
+
export declare const filtersLogger: Logger;
|
|
136
|
+
|
|
137
|
+
/** @public */
|
|
138
|
+
export declare const filtersRenderers: any[];
|
|
139
|
+
|
|
31
140
|
/**
|
|
32
141
|
* Foundation form component for automatically generated forms based on json schema
|
|
33
142
|
* obtained from the api, supplied initial data or supplied JSON schema.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-forms](./foundation-forms.md) > [createExpressions](./foundation-forms.createexpressions.md)
|
|
4
|
+
|
|
5
|
+
## createExpressions variable
|
|
6
|
+
|
|
7
|
+
Creates a expressions/criteria from given payload
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
createExpressions: (payload: any) => Expressions
|
|
13
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-forms](./foundation-forms.md) > [Filters](./foundation-forms.filters.md) > [clearFiltersData](./foundation-forms.filters.clearfiltersdata.md)
|
|
4
|
+
|
|
5
|
+
## Filters.clearFiltersData() method
|
|
6
|
+
|
|
7
|
+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
**Signature:**
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
clearFiltersData(): void;
|
|
14
|
+
```
|
|
15
|
+
**Returns:**
|
|
16
|
+
|
|
17
|
+
void
|
|
18
|
+
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-forms](./foundation-forms.md) > [Filters](./foundation-forms.filters.md) > [data](./foundation-forms.filters.data.md)
|
|
4
|
+
|
|
5
|
+
## Filters.data property
|
|
6
|
+
|
|
7
|
+
Initial data for the filters
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
data: any;
|
|
13
|
+
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-forms](./foundation-forms.md) > [Filters](./foundation-forms.filters.md) > [disconnectedCallback](./foundation-forms.filters.disconnectedcallback.md)
|
|
4
|
+
|
|
5
|
+
## Filters.disconnectedCallback() method
|
|
6
|
+
|
|
7
|
+
> This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
|
|
8
|
+
>
|
|
9
|
+
|
|
10
|
+
**Signature:**
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
disconnectedCallback(): void;
|
|
14
|
+
```
|
|
15
|
+
**Returns:**
|
|
16
|
+
|
|
17
|
+
void
|
|
18
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@genesislcap/foundation-forms](./foundation-forms.md) > [Filters](./foundation-forms.filters.md) > [jsonSchema](./foundation-forms.filters.jsonschema.md)
|
|
4
|
+
|
|
5
|
+
## Filters.jsonSchema property
|
|
6
|
+
|
|
7
|
+
Alternatively to providing [Form.resourceName](./foundation-forms.form.resourcename.md) you can hardcode the JSON schema on the client.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
jsonSchema: JSONSchema7;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Remarks
|
|
16
|
+
|
|
17
|
+
Use this when you want to avoid fetching metadata from the server but be aware that it could get out of sync if metadata changes on the server
|
|
18
|
+
|