Skip to content

Commit 637914d

Browse files
committed
fix ordering of filter options
1 parent f64d10b commit 637914d

20 files changed

Lines changed: 94 additions & 80 deletions

packages/components/src/internal/components/domainproperties/AdvancedSettings.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ import {
2121
DOMAIN_FIELD_UNIQUECONSTRAINT,
2222
DOMAIN_LAST_ENTERED_DEFAULT,
2323
DOMAIN_NON_EDITABLE_DEFAULT,
24-
INT_RANGE_URI, MULTI_CHOICE_RANGE_URI,
24+
INT_RANGE_URI,
25+
MULTI_CHOICE_RANGE_URI,
2526
PHILEVEL_FULL_PHI,
2627
PHILEVEL_LIMITED_PHI,
2728
} from './constants';

packages/components/src/internal/components/domainproperties/AdvancedSettings.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
543543
</LabelHelpTip>
544544
</CheckboxLK>
545545
)}
546-
{!field.isMultiChoiceField() &&
546+
{!field.isMultiChoiceField() && (
547547
<CheckboxLK
548548
checked={recommendedVariable}
549549
id={createFormInputId(DOMAIN_FIELD_RECOMMENDEDVARIABLE, domainIndex, index)}
@@ -558,7 +558,7 @@ export class AdvancedSettings extends React.PureComponent<AdvancedSettingsProps,
558558
</div>
559559
</LabelHelpTip>
560560
</CheckboxLK>
561-
}
561+
)}
562562
{PropDescType.isMvEnableable(field.dataType.rangeURI) && !field.isCalculatedField() && !isApp() && (
563563
<CheckboxLK
564564
checked={mvEnabled}

packages/components/src/internal/components/domainproperties/CalculatedFieldOptions.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ describe('CalculatedFieldOptions', () => {
2020
renderWithAppContext(
2121
<CalculatedFieldOptions
2222
domainIndex={0}
23+
field={DomainField.create({ rangeURI: STRING_RANGE_URI })}
2324
getDomainFields={jest.fn()}
2425
index={0}
2526
onChange={jest.fn()}
26-
field={DomainField.create({ rangeURI: STRING_RANGE_URI })}
2727
/>
2828
);
2929
});
@@ -41,10 +41,10 @@ describe('CalculatedFieldOptions', () => {
4141
renderWithAppContext(
4242
<CalculatedFieldOptions
4343
domainIndex={0}
44+
field={DomainField.create({ valueExpression: '1=0', rangeURI: INT_RANGE_URI })}
4445
getDomainFields={jest.fn()}
4546
index={0}
4647
onChange={jest.fn()}
47-
field={DomainField.create({ valueExpression: '1=0', rangeURI: INT_RANGE_URI })}
4848
/>
4949
);
5050
});
@@ -62,10 +62,10 @@ describe('CalculatedFieldOptions', () => {
6262
renderWithAppContext(
6363
<CalculatedFieldOptions
6464
domainIndex={0}
65+
field={DomainField.create({ valueExpression: '1=0', lockType: DOMAIN_FIELD_PARTIALLY_LOCKED })}
6566
getDomainFields={jest.fn()}
6667
index={0}
6768
onChange={jest.fn()}
68-
field={DomainField.create({ valueExpression: '1=0', lockType: DOMAIN_FIELD_PARTIALLY_LOCKED })}
6969
/>
7070
);
7171
});

packages/components/src/internal/components/domainproperties/DomainRow.tsx

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -385,10 +385,7 @@ export class DomainRow extends React.PureComponent<DomainRowProps, DomainRowStat
385385
const draggableId = createFormInputId('domaindrag', domainIndex, index);
386386
// Use undefined instead of false to allow for css to handle the highlight color for hover
387387
const highlighted = dragging ? true : isDragDisabled ? false : undefined;
388-
const showAdvancedSettingsButton =
389-
expanded &&
390-
!isFieldFullyLocked(field.lockType) &&
391-
!appPropertiesOnly;
388+
const showAdvancedSettingsButton = expanded && !isFieldFullyLocked(field.lockType) && !appPropertiesOnly;
392389

393390
return (
394391
<Draggable
@@ -532,17 +529,17 @@ export class DomainRow extends React.PureComponent<DomainRowProps, DomainRowStat
532529
className={expanded ? 'domain-field-buttons-expanded' : 'domain-field-buttons'}
533530
>
534531
{showAdvancedSettingsButton && (
535-
<button
536-
className="domain-row-button btn btn-default"
537-
disabled={isFieldFullyLocked(field.lockType)}
538-
id={createFormInputId(DOMAIN_FIELD_ADV, domainIndex, index)}
539-
name={createFormInputName(DOMAIN_FIELD_ADV)}
540-
onClick={this.onShowAdvanced}
541-
type="button"
542-
>
543-
Advanced Settings
544-
</button>
545-
)}
532+
<button
533+
className="domain-row-button btn btn-default"
534+
disabled={isFieldFullyLocked(field.lockType)}
535+
id={createFormInputId(DOMAIN_FIELD_ADV, domainIndex, index)}
536+
name={createFormInputName(DOMAIN_FIELD_ADV)}
537+
onClick={this.onShowAdvanced}
538+
type="button"
539+
>
540+
Advanced Settings
541+
</button>
542+
)}
546543
{isFieldDeletable(field) && (
547544
<DeleteIcon
548545
iconCls="domain-field-delete-icon"

packages/components/src/internal/components/domainproperties/DomainRowExpandedOptions.test.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
DATETIME_TYPE,
1515
DOUBLE_TYPE,
1616
FLAG_TYPE,
17-
INTEGER_TYPE, MULTI_CHOICE_TYPE,
17+
INTEGER_TYPE,
18+
MULTI_CHOICE_TYPE,
1819
MULTILINE_TYPE,
1920
ONTOLOGY_LOOKUP_TYPE,
2021
SAMPLE_TYPE,
@@ -142,10 +143,10 @@ describe('DomainRowExpandedOptions', () => {
142143
render(
143144
<DomainRowExpandedOptions
144145
{...DEFAULT_PROPS}
145-
field={field}
146146
domainFormDisplayOptions={{
147147
hideTextOptions: true,
148148
}}
149+
field={field}
149150
/>
150151
);
151152

packages/components/src/internal/components/domainproperties/PropDescType.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ export class PropDescType
134134
}
135135

136136
static isMeasure(rangeURI: string): boolean {
137-
return rangeURI !== ATTACHMENT_RANGE_URI && rangeURI !== FILELINK_RANGE_URI && rangeURI !== MULTI_CHOICE_RANGE_URI;
137+
return (
138+
rangeURI !== ATTACHMENT_RANGE_URI && rangeURI !== FILELINK_RANGE_URI && rangeURI !== MULTI_CHOICE_RANGE_URI
139+
);
138140
}
139141

140142
static isDimension(rangeURI: string): boolean {
@@ -147,7 +149,12 @@ export class PropDescType
147149
}
148150

149151
static isMvEnableable(rangeURI: string): boolean {
150-
return rangeURI !== ATTACHMENT_RANGE_URI && rangeURI !== FILELINK_RANGE_URI && rangeURI !== MULTILINE_RANGE_URI && rangeURI !== MULTI_CHOICE_RANGE_URI;
152+
return (
153+
rangeURI !== ATTACHMENT_RANGE_URI &&
154+
rangeURI !== FILELINK_RANGE_URI &&
155+
rangeURI !== MULTILINE_RANGE_URI &&
156+
rangeURI !== MULTI_CHOICE_RANGE_URI
157+
);
151158
}
152159

153160
static isAutoIncrement(dataType: PropDescType): boolean {

packages/components/src/internal/components/domainproperties/actions.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ describe('domain properties actions', () => {
372372
allowTextChoiceProperties: true,
373373
allowSampleSubjectProperties: true,
374374
allowCalculatedFields: true,
375-
allowMultiChoiceProperties: true
375+
allowMultiChoiceProperties: true,
376376
});
377377
const available = getAvailableTypes(domain);
378378
expect(available.contains(FLAG_TYPE)).toBeTruthy();

packages/components/src/internal/components/domainproperties/actions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -873,8 +873,8 @@ export function updateDataType(field: DomainField, value: any): DomainField {
873873
conceptLabelColumn: undefined,
874874
conceptImportColumn: undefined,
875875
scannable: undefined,
876-
textChoiceValidator: isTextChoice ? field.textChoiceValidator: undefined,
877-
valueExpression: isTextChoice ? field.valueExpression: undefined,
876+
textChoiceValidator: isTextChoice ? field.textChoiceValidator : undefined,
877+
valueExpression: isTextChoice ? field.valueExpression : undefined,
878878
}) as DomainField;
879879

880880
if (field.isNew()) {

packages/components/src/internal/components/domainproperties/models.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ import {
3535
FLAG_TYPE,
3636
INTEGER_TYPE,
3737
LOOKUP_TYPE,
38+
MULTI_CHOICE_TYPE,
3839
MULTILINE_TYPE,
3940
ONTOLOGY_LOOKUP_TYPE,
4041
PARTICIPANT_TYPE,
4142
PropDescType,
4243
SAMPLE_TYPE,
4344
TEXT_CHOICE_TYPE,
44-
MULTI_CHOICE_TYPE,
4545
TEXT_TYPE,
4646
TIME_TYPE,
4747
UNIQUE_ID_TYPE,

packages/components/src/internal/components/domainproperties/models.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ import {
8080
FILE_TYPE,
8181
FLAG_TYPE,
8282
INTEGER_TYPE,
83-
LOOKUP_TYPE, MULTI_CHOICE_TYPE,
83+
LOOKUP_TYPE,
84+
MULTI_CHOICE_TYPE,
8485
ONTOLOGY_LOOKUP_TYPE,
8586
PROP_DESC_TYPES,
8687
PropDescType,
@@ -814,10 +815,7 @@ export class PropertyValidator
814815
const isChoice = type === 'TextChoice';
815816

816817
// if we are loading a textChoiceValidator from JSON, we need to set the properties.validValues
817-
if (
818-
isChoice &&
819-
!rawPropertyValidator[i]?.properties?.validValues
820-
) {
818+
if (isChoice && !rawPropertyValidator[i]?.properties?.validValues) {
821819
rawPropertyValidator[i].properties.validValues =
822820
PropertyValidator.splitValidValues(expressionStr);
823821
}

0 commit comments

Comments
 (0)