-
Notifications
You must be signed in to change notification settings - Fork 1
/
FKSelector.js
862 lines (727 loc) · 32.4 KB
/
FKSelector.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
/**
* Filter Mode: When a search filter is defined (with the searchFilter prop), do not offer the same search filter in the modal.
*/
import React, { useCallback, useEffect, useMemo, useState } from "react"
import cx from "classnames"
import PropTypes from "prop-types"
import {
Addon,
Field,
FieldMode,
FormContext,
FormGroup,
GlobalConfig,
Icon,
InputSchema,
unwrapType,
} from "domainql-form"
import i18n from "../i18n";
import { action, toJS } from "mobx"
import { observer as fnObserver } from "mobx-react-lite";
import GraphQLQuery from "../GraphQLQuery";
import InteractiveQuery, { getFirstValue } from "../model/InteractiveQuery";
import config from "../config"
import { getGenericType, INTERACTIVE_QUERY } from "../domain";
import autoSubmitHack from "../util/autoSubmitHack";
import FkSelectorModal from "./FkSelectorModal";
import { useDebouncedCallback } from "use-debounce"
import get from "lodash.get"
import {
getGraphQLMethodType,
getIQueryPayloadType,
getOutputTypeName,
getParentObjectType,
lookupType,
unwrapAll,
unwrapNonNull
} from "../util/type-utils"
import {field, Type, value, condition, component, Condition} from "../FilterDSL"
import { isNonNull } from "domainql-form/lib/InputSchema";
import { SCALAR } from "domainql-form/lib/kind";
import CachedQuery from "../model/CachedQuery";
import updateComponentCondition from "../util/updateComponentCondition"
import {and} from "../../filter";
import OfflineQuery from "../model/OfflineQuery";
import { buildCustomFilter } from "../util/filter/CustomFilter";
export const NO_SEARCH_FILTER = "NO_SEARCH_FILTER";
/**
* Filter Mode: Do not offer a column filter by default.
*/
export const NO_FILTER = "NO_FILTER";
/**
* Filter Mode: Offer a column filter even if a search filter is defined (with the searchFilter prop).
*/
export const COLUMN_FILTER = "COLUMN_FILTER";
/**
* Creates a filter condition for the given type, searchFilter prop and search term
*
* @param {String} type GraphQL base type
* @param {function|String}searchFilter searchFilter prop
* @param {String} searchTerm current search value
* @return {object} condition graph or null
*/
export function createSearchFilter(type, searchFilter, searchTerm)
{
if (!searchFilter)
{
return null;
}
let condition;
if (typeof searchFilter === "function")
{
condition = searchFilter(searchTerm)
}
else
{
condition = buildCustomFilter("likePattern", searchFilter, searchTerm);
}
return condition;
}
function toggleOpen(modalState)
{
return {
... modalState,
isOpen: !modalState.isOpen
};
}
const updateRelatedObject = action(
"FkSelector.updateRelatedObject",
(root, path, field, row) => {
if (path.length > 1)
{
root = get(root, path.slice(0,-1))
}
const oldRow = root[field];
root[field] = row;
return oldRow;
}
)
const MODAL_STATE_CLOSED = {
iQuery: null,
columns: null,
columnTypes: null,
visibleColumns: null,
isOpen: false
};
function isSelected(fieldValue)
{
return fieldValue !== null && fieldValue !== undefined && fieldValue !== "";
}
let checkUserFilter;
if (__DEV)
{
checkUserFilter = (objectType, relation, searchFilter) => {
const { inputSchema } = config;
const validateReference = name => {
//console.log("validateReference (objectType = ", objectType, "): ", name );
let relatedType;
try
{
relatedType = unwrapNonNull(inputSchema.resolveType(objectType, relation.leftSideObjectName + "." + name));
}
catch(e)
{
console.error("Error resolving searchFilter field '" + name + "'", e)
}
if (relatedType.kind !== SCALAR)
{
console.error("searchFilter field '" + name + "' is not a scalar field", relatedType);
}
};
const validateFieldRefs = cond => {
if (cond.type === Type.COMPONENT)
{
validateFieldRefs(cond.condition);
}
else if (cond.type === Type.CONDITION || cond.type === Type.OPERATION)
{
const { operands } = cond;
if (operands)
{
for (let i = 0; i < operands.length; i++)
{
const operand = operands[i];
validateFieldRefs(operand)
}
}
}
else if (cond.type === Type.FIELD)
{
validateReference(cond.name);
}
}
// if we have a function, we check an example filter
if (typeof searchFilter === "function")
{
const condition = searchFilter("AAA")
validateFieldRefs(condition);
}
else
{
// otherwise we only check the static field reference
validateReference(searchFilter);
}
};
}
let fkSelectorCounter = 0
/**
* Renders the current value of foreign key references and allows changing of references via text-input and selection from
* modal grid.
*/
const FKSelector = fnObserver(props => {
const [fkSelectorId] = useState("fkSelector-"+ fkSelectorCounter++)
const [modalState, setModalState] = useState(MODAL_STATE_CLOSED);
const [ isLoading, setIsLoading ] = useState(false);
const {
display,
query: queryFromProps,
queryCondition: queryConditionFromProps,
catalogueRootType,
catalogueFieldQualifiedName,
searchFilter,
modalTitle,
fade,
searchTimeout,
modalFilter,
cachedPageSize,
children,
onChange,
selectButtonContentRenderer,
visibleColumns,
alignPagination,
paginationPageSizes,
... fieldProps
} = props;
const haveUserInput = !!searchFilter;
const queryCondition = typeof queryConditionFromProps === "function" ?
queryConditionFromProps() :
queryConditionFromProps;
const iQueryDoc = useMemo(
() => {
if (queryFromProps instanceof CachedQuery || queryFromProps instanceof OfflineQuery)
{
return queryFromProps;
}
else if (queryFromProps instanceof InteractiveQuery)
{
return new CachedQuery(
queryFromProps, {
pageSize: cachedPageSize
});
}
else
{
return null;
}
},
[ FormContext.getUniqueId(queryFromProps) ]
)
const query = iQueryDoc ? iQueryDoc._query : queryFromProps;
return (
<Field
{... fieldProps }
addons={ Addon.filterAddons(children) }
>
{
(formConfig, ctx) => {
const { fieldId, fieldType, qualifiedName, mode, autoFocus, inputClass, tooltip, placeholder, addons, path } = ctx;
const errorMessages = formConfig.getErrors(ctx.qualifiedName);
const haveErrors = errorMessages.length > 0;
const rootType = catalogueRootType ?? getOutputTypeName(formConfig.type);
const sourcePath = catalogueFieldQualifiedName?.split(".") ?? path;
const relation = useMemo(
() => {
const { inputSchema } = config;
let objectType;
let fieldName;
if (sourcePath.length === 1)
{
// simple case
objectType = rootType;
fieldName = sourcePath[0];
}
else
{
// path is more than 1 element long, we need to figure out the correct object type and field
objectType = getParentObjectType(rootType, sourcePath);
fieldName = sourcePath[sourcePath.length - 1];
}
const relations = inputSchema.getRelations().filter(
r => r.sourceType === objectType && r.sourceFields[0] === fieldName
);
if (!relations.length)
{
throw new Error("No relation found starting at '" + objectType + "' and source field '" + fieldName + "'")
}
const relation = relations[0];
if (__DEV)
{
if (relation.sourceField !== "OBJECT_AND_SCALAR")
{
throw new Error("Relation has invalid source field type: " + JSON.stringify(relation))
}
if (searchFilter)
{
checkUserFilter(objectType, relation, searchFilter);
}
}
//console.log("FKSelector relation", relation);
return relation;
},
[ rootType, qualifiedName ]
)
const getFieldValue = () => {
let fieldValue;
if (display)
{
fieldValue = typeof display === "function" ? display(formConfig, ctx) : get(formConfig.root, display);
}
else
{
const scalarType = unwrapType(ctx.fieldType).name;
fieldValue = Field.getValue(formConfig, ctx, errorMessages);
fieldValue = fieldValue !== null ? InputSchema.scalarToValue(scalarType, fieldValue) : "";
}
if (!isSelected(fieldValue))
{
fieldValue = haveUserInput ? "" : GlobalConfig.none();
}
return fieldValue;
};
const [inputValue, setInputValue] = useState(getFieldValue);
const [userIsTyping, setUserIsTyping] = useState(false);
const [isAmbiguousMatch, setIsAmbiguousMatch] = useState(false);
const queryDef = query.getQueryDefinition();
const aliases = queryDef.aliases;
const name = queryDef.methodCalls[0];
const gqlMethodName = aliases ? aliases[name] || name : name;
const iQueryType = useMemo(
() => getGraphQLMethodType(gqlMethodName).name,
[ gqlMethodName ]
);
const fieldValue = Field.getValue(formConfig, ctx, errorMessages);
useEffect(
() => {
if (!haveErrors && !userIsTyping)
{
const fieldValue = getFieldValue();
//console.log("SEARCH FIELD EFFECT", fieldValue, inputValue);
if (fieldValue !== inputValue)
{
//console.log("CHANGE TO ", fieldValue);
// formConfig.handleChange(ctx, fieldValue);
setInputValue(fieldValue);
}
}
},
[fieldValue]
);
const debouncedInputValidation = useDebouncedCallback(
val => {
if (val === "")
{
if (isNonNull(ctx.fieldType))
{
const { root, formContext } = formConfig;
formContext.updateErrors(root, ctx.qualifiedName, [ val, formConfig.formContext.getRequiredErrorMessage(ctx) ]);
setUserIsTyping(false);
return;
}
const type = getIQueryPayloadType(iQueryType);
if (!type)
{
throw new Error("Could not determine payload type of " + iQueryType + ". It does not seem to be an InteractiveQuery-based class.");
}
selectRow(null);
setUserIsTyping(false);
return;
}
//console.log("FK-CONTEXT", ctx);
//console.log("QUERY", query);
const condition = createSearchFilter(iQueryType, searchFilter, val);
setIsLoading(true);
const composite = updateComponentCondition(
query.defaultVars && query.defaultVars.config && query.defaultVars.config.condition || component(fkSelectorId, null),
condition,
fkSelectorId
)
query.defaultVars.config = {
... query.defaultVars.config,
offset: 0,
pageSize: query.defaultVars.config?.pageSize ?? 10
};
query.execute({
config: {
condition : queryCondition ? and(composite, queryCondition) : composite,
offset: 0,
// we only want to know if there's more than one match. We don't care how many
pageSize: 2
}
})
.then(result => {
const iQuery = getFirstValue(result);
//console.log("Received search result: ", toJS(iQuery));
//console.log("inputValidation: UPDATE CONFIG", query.defaultVars.config)
const { length } = iQuery.rows;
if (length === 1)
{
selectRow(iQuery.rows[0]);
setIsAmbiguousMatch(false);
}
else if (length === 0)
{
formConfig.formContext.updateErrors(formConfig.root, ctx.qualifiedName, [ val, i18n("FKSelector:No match") ]);
setIsAmbiguousMatch(false);
}
else
{
formConfig.formContext.updateErrors(formConfig.root, ctx.qualifiedName, [ val, i18n("FKSelector:Ambiguous match") ]);
setIsAmbiguousMatch(true);
}
setIsLoading(false);
setUserIsTyping(false);
//console.log("ERRORS", formConfig.errors);
},
err => {
console.error("Error searching for foreign key target", err);
setUserIsTyping(false);
setIsLoading(false);
}
);
},
searchTimeout
);
const selectRow = row => {
const { qualifiedName, path } = ctx;
let oldValue = null;
let value = null;
if (qualifiedName)
{
oldValue = Field.getValue(formConfig, ctx, errorMessages);
value = row ? row[relation.targetFields[0]] : "";
formConfig.handleChange(ctx, value);
setIsAmbiguousMatch(false);
}
const oldRow = updateRelatedObject(
formConfig.root,
path,
relation.leftSideObjectName,
row
)
if (onChange)
{
onChange({ oldValue, oldRow, row, fieldContext: ctx}, value)
}
setInputValue(getFieldValue());
autoSubmitHack(formConfig);
if (modalState.isOpen)
{
setModalState(MODAL_STATE_CLOSED);
}
};
const selectFromModal = () => {
// if we have an ambiguous match but are configured to show no search filter, we can still preselect the column filter if we have a simple search filter
const shouldPreselectColumnFilter = modalFilter && modalFilter !== NO_FILTER && searchFilter;
const shouldPreselectSearchFilter = !shouldPreselectColumnFilter && modalFilter !== NO_SEARCH_FILTER && typeof searchFilter === "string";
const columnFilterCond = shouldPreselectColumnFilter || shouldPreselectSearchFilter ? createSearchFilter(iQueryType, searchFilter, inputValue) : null
const composite = updateComponentCondition(
query.defaultVars && query.defaultVars.config && query.defaultVars.config.condition || component(fkSelectorId, null),
columnFilterCond,
shouldPreselectColumnFilter ? "fk-selector-grid" : shouldPreselectSearchFilter ? fkSelectorId : null
)
query.defaultVars.config = {
... query.defaultVars.config,
offset: 0,
pageSize: query.defaultVars.config?.pageSize ?? 10
};
query.execute(
{
config: {
... iQueryDoc ? iQueryDoc.queryConfig : query.defaultVars.config,
condition : queryCondition ? and(composite, queryCondition) : composite
}
}
)
.then(
result => {
const iQuery = getFirstValue(result);
if (getGenericType(iQuery._type) !== INTERACTIVE_QUERY)
{
throw new Error("Result is no interactive query object");
}
//console.log("selectFromModal: UPDATE CONFIG", query.defaultVars.config)
try
{
const { inputSchema } = config;
const rawVisibleColumns = visibleColumns ?? inputSchema.getTypeMeta(iQuery.type, "fkSelektorVisibleColumns");
const convertedVisibleColumns = typeof rawVisibleColumns === "string" ?
rawVisibleColumns.split(",") :
rawVisibleColumns;
const columns = iQuery.columnStates
.filter(
cs => cs.enabled && cs.name !== "id" && (convertedVisibleColumns?.includes(cs.name) ?? true)
)
.map(
cs => {
const heading = inputSchema.getFieldMeta(iQuery.type, cs.name, "heading");
return { name: cs.name, heading }
}
);
const columnTypes = columns.map(({name}) => unwrapAll(lookupType(iQuery.type, name)).name)
//console.log(JSON.stringify(query.defaultVars, null, 4));
setModalState({
iQuery,
columns,
columnTypes,
// XXX: There is only one situation where it makes sense to have a preselection within the modal filter
// if we just had an ambiguous match, the modal can show us the matches
// for every other match outcome or other selection, we don't want a filter that is retricting the results
// to the current state
filter: shouldPreselectSearchFilter ? inputValue : "",
isOpen: true
});
} catch (e)
{
console.error("ERROR", e);
}
}
);
};
const toggle = useCallback(
() => setModalState(toggleOpen),
[]
);
const newAddons = addons.slice();
if (haveUserInput)
{
newAddons.push(
<Addon placement={ Addon.LEFT } text={ true }>
<Icon style={{ width: "1.8ex" }} className={ isLoading ? "text-muted fa-hourglass-half" : "fa-search" }/>
</Addon>
)
}
newAddons.push(
<Addon placement={ Addon.RIGHT }>
<button
className="btn btn-light"
type="button"
title={ modalTitle }
disabled={mode !== FieldMode.NORMAL }
onClick={ selectFromModal }
>
…
</button>
</Addon>
)
return (
<FormGroup
{ ... ctx }
formConfig={ formConfig }
errorMessages={ errorMessages }
>
{
Addon.renderWithAddons(
<input
id={ fieldId }
name={ qualifiedName }
className={
cx(
inputClass,
"fks-display form-control pl-2",
mode !== FieldMode.NORMAL && "disabled",
haveErrors && "is-invalid"
)
}
type="text"
placeholder={ placeholder }
title={ tooltip }
disabled={ mode === FieldMode.DISABLED }
readOnly={ !haveUserInput || mode === FieldMode.READ_ONLY }
value={ inputValue }
onKeyPress={ ctx.handleKeyPress }
onChange={
ev => {
const value = ev.target.value;
setUserIsTyping(true);
setInputValue(value);
debouncedInputValidation(value);
}
}
autoFocus={autoFocus ? true : null}
/>,
newAddons
)
}
<FkSelectorModal
{ ... modalState }
iQueryType={ iQueryType }
title={ modalTitle }
fieldType={ fieldType }
selectRow={ selectRow }
toggle={ toggle }
fade={ fade }
modalFilter={ modalFilter }
searchFilter={ searchFilter }
searchTimeout={ searchTimeout }
fkSelectorId={ fkSelectorId }
selectButtonContentRenderer={ selectButtonContentRenderer }
alignPagination={ alignPagination }
paginationPageSizes={ paginationPageSizes }
markGridRow={ (row) => {
return row.id === fieldValue;
} }
/>
</FormGroup>
);
}
}
</Field>
);
});
FKSelector.propTypes = {
/**
* Property to use as display value or render function for the current value ( formConfig => ReactElement ). Can be used to extend on simple property rendering.
*/
display: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func
]),
/**
* iQuery GraphQL query to fetch the current list of target objects or iQuery document containing all values
*/
query: PropTypes.oneOfType([
PropTypes.instanceOf(GraphQLQuery),
PropTypes.instanceOf(InteractiveQuery)
]).isRequired,
/**
* Optional FilterDSL condition to be applied to the execution of the FKSelector's query
*/
queryCondition: PropTypes.oneOfType([
PropTypes.instanceOf(Condition),
PropTypes.func
]),
/**
* Title for the modal dialog selecting the target object
*/
modalTitle: PropTypes.string,
// FIELD PROP TYPES
/**
* Name / path for the foreign key value (e.g. "name", but also "foos.0.name").
*/
name: PropTypes.string.isRequired,
/**
* Mode for this foreign key selector. If not set or set to null, the mode will be inherited from the <Form/> or <FormBlock>.
*/
mode: PropTypes.oneOf(FieldMode.values()),
/**
* Filter mode for the selector modal. Controls display of column and repeated search filter in interaction with the searchFilter prop,
*/
modalFilter: PropTypes.oneOf([
NO_SEARCH_FILTER,
NO_FILTER,
COLUMN_FILTER
]),
/**
* Additional help text for this field. Is rendered for non-erroneous fields in place of the error. If a function
* is given, it should be a stable reference ( e.g. with useCallback()) to prevent creating the field context over
* and over. The same considerations apply to using elements. ( The expression <Bla/> recreates that element on every
* invocation, use static element references)
*/
helpText: PropTypes.oneOfType([PropTypes.string, PropTypes.func, PropTypes.element]),
/**
* Tooltip / title attribute for the input element
*/
tooltip: PropTypes.string,
/**
* Label for the field. Must be defined if name is missing.
*/
label: PropTypes.string,
/**
* Additional HTML classes for the display value.
*/
inputClass: PropTypes.string,
/**
* Additional HTML classes for the label element.
*/
labelClass: PropTypes.string,
/**
* Additional HTML classes for the form group element.
*/
formGroupClass: PropTypes.string,
/**
* Whether to do the modal fade animation on selection (default is true)
*/
fade: PropTypes.bool,
/**
* True to focus the fk selector input (See `searchFilter` )
*/
autoFocus: PropTypes.bool,
/**
* Field name or function returning a filter expression used to allow and
* validate text-input changes of the selected value.
*
* The field or filter must match exactly one element from the current `query`.
*
* (Function must be of the form `value => ...` and must return a Filter DSL condition.)
*
*/
searchFilter: PropTypes.oneOfType([
PropTypes.string,
PropTypes.func
]),
/**
* Timeout in ms after which the input will do the validation query ( default: 350).
*/
searchTimeout: PropTypes.number,
/**
* Placeholder for input (See `searchFilter`)
*/
placeholder: PropTypes.string,
/**
* Page size to use when using an in-memory iQuery document as data source. (Default is 5)
*/
cachedPageSize: PropTypes.number,
/**
* Optional validation handler ( (ctx, value) => error(s) ).
*/
validate: PropTypes.func,
/**
* Optional async validation handler ( (ctx, value) => Promise<error(s)> ).
*/
validateAsync: PropTypes.func,
/**
* Optional extended local on-change handler ({oldValue, oldRow, row, fieldContext)}, value => ...)
*/
onChange: PropTypes.func,
/**
* Optional override for visible columns definition.
*
* By default every column returned by the query is visible.
* The FKSelector then checks for a "fkSelektorVisibleColumns" definition in the type metadata to filter out unneeded columns.
*
* This property overrides the type metadata value for a single FKSelector field.
*/
visibleColumns: PropTypes.oneOfType([
PropTypes.string,
PropTypes.arrayOf(PropTypes.string)
]),
/**
* set the pagination alignment of the datagrid in the modal ("left" [default], "center", "right")
*/
alignPagination: PropTypes.string,
/**
* set the available page sizes for the datagrid pagination
*/
paginationPageSizes: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.string, PropTypes.number]))
};
FKSelector.defaultProps = {
modalTitle: i18n("Select Target Object"),
fade: false,
searchTimeout: 350,
cachedPageSize: 5
};
FKSelector.displayName = "FKSelector";
FKSelector.NO_SEARCH_FILTER = NO_SEARCH_FILTER;
FKSelector.NO_FILTER = NO_FILTER;
FKSelector.COLUMN_FILTER = COLUMN_FILTER;
export default FKSelector;