Add option to allow duplicate values for single and each multi value fields
This commit is contained in:
@@ -12,6 +12,7 @@ interface RecordOptions extends Options {
|
||||
queryFields: Array<string>;
|
||||
selectType: string;
|
||||
multiDelimiter: string;
|
||||
isUniqueMultiValue: boolean;
|
||||
prefilter?: string;
|
||||
}
|
||||
|
||||
@@ -23,6 +24,7 @@ const defaults = (): Readonly<RecordOptions> => Object.freeze({
|
||||
queryFields: [],
|
||||
selectType: '',
|
||||
multiDelimiter: '\n',
|
||||
isUniqueMultiValue: false,
|
||||
prefilter: undefined,
|
||||
})
|
||||
|
||||
@@ -42,6 +44,7 @@ export class ModuleFieldRecord extends ModuleField {
|
||||
|
||||
Apply(this.options, o, CortezaID, 'moduleID')
|
||||
Apply(this.options, o, String, 'labelField', 'recordLabelField', 'selectType', 'multiDelimiter', 'prefilter')
|
||||
Apply(this.options, o, Boolean, 'isUniqueMultiValue')
|
||||
Apply(this.options, o, (o) => {
|
||||
if (!o) {
|
||||
return []
|
||||
|
||||
@@ -10,6 +10,7 @@ interface SelectOptions extends Options {
|
||||
options: Array<string | { value: string; text?: string }>;
|
||||
selectType: string;
|
||||
multiDelimiter: string;
|
||||
isUniqueMultiValue: boolean;
|
||||
}
|
||||
|
||||
const defaults = (): Readonly<SelectOptions> => Object.freeze({
|
||||
@@ -17,6 +18,7 @@ const defaults = (): Readonly<SelectOptions> => Object.freeze({
|
||||
options: [],
|
||||
selectType: 'default',
|
||||
multiDelimiter: '\n',
|
||||
isUniqueMultiValue: false,
|
||||
})
|
||||
|
||||
export class ModuleFieldSelect extends ModuleField {
|
||||
@@ -34,6 +36,7 @@ export class ModuleFieldSelect extends ModuleField {
|
||||
super.applyOptions(o)
|
||||
|
||||
Apply(this.options, o, String, 'selectType', 'multiDelimiter')
|
||||
Apply(this.options, o, Boolean, 'isUniqueMultiValue')
|
||||
|
||||
if (o.options) {
|
||||
let opt: Array<{ value: string; text: string }> = []
|
||||
|
||||
@@ -11,6 +11,7 @@ interface UserOptions extends Options {
|
||||
presetWithAuthenticated: boolean;
|
||||
selectType: string;
|
||||
multiDelimiter: string;
|
||||
isUniqueMultiValue: boolean;
|
||||
}
|
||||
|
||||
const defaults = (): Readonly<UserOptions> => Object.freeze({
|
||||
@@ -19,6 +20,7 @@ const defaults = (): Readonly<UserOptions> => Object.freeze({
|
||||
presetWithAuthenticated: false,
|
||||
selectType: 'default',
|
||||
multiDelimiter: '\n',
|
||||
isUniqueMultiValue: false,
|
||||
})
|
||||
|
||||
export class ModuleFieldUser extends ModuleField {
|
||||
@@ -35,7 +37,7 @@ export class ModuleFieldUser extends ModuleField {
|
||||
if (!o) return
|
||||
super.applyOptions(o)
|
||||
|
||||
Apply(this.options, o, Boolean, 'presetWithAuthenticated')
|
||||
Apply(this.options, o, Boolean, 'presetWithAuthenticated', 'isUniqueMultiValue')
|
||||
Apply(this.options, o, String, 'selectType', 'multiDelimiter')
|
||||
Apply(this.options, o, (o) => {
|
||||
if (!o) {
|
||||
|
||||
Reference in New Issue
Block a user