@evoke-platform/ui-components 1.10.1-dev.3 → 1.10.1-dev.4

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.
@@ -65,6 +65,11 @@ export const Criteria = (props) => {
65
65
  name: `${prop.name} Zip Code`,
66
66
  type: 'string',
67
67
  },
68
+ {
69
+ id: `${prop.id}.country`,
70
+ name: `${prop.name} Country`,
71
+ type: 'string',
72
+ },
68
73
  ];
69
74
  }
70
75
  return prop;
@@ -8,7 +8,7 @@ import { FormField } from '../../../custom';
8
8
  import { FormComponentWrapper } from '../Common';
9
9
  import { isPropertyVisible } from '../utils';
10
10
  function isAddressProperties(key) {
11
- return /\.line1|\.line2|\.city|\.county|\.state|\.zipCode$/.test(key);
11
+ return /\.line1|\.line2|\.city|\.county|\.state|\.zipCode|\.country$/.test(key);
12
12
  }
13
13
  Handlebars.registerHelper('addDays', function (addend1, addend2) {
14
14
  const dateAddend1 = DateTime.fromISO(addend1);
@@ -76,6 +76,7 @@ export class FormFieldComponent extends ReactComponent {
76
76
  `${this.component.addressPropertyId}.county`,
77
77
  `${this.component.addressPropertyId}.state`,
78
78
  `${this.component.addressPropertyId}.zipCode`,
79
+ `${this.component.addressPropertyId}.country`,
79
80
  ].includes(comp.key))
80
81
  .forEach((comp) => {
81
82
  this.emit('changed-' + comp.key, value[comp.key.replace(`${this.component.addressPropertyId}.`, '')]);
@@ -159,7 +160,8 @@ export class FormFieldComponent extends ReactComponent {
159
160
  if (this.component.key.includes('.city') ||
160
161
  this.component.key.includes('.county') ||
161
162
  this.component.key.includes('.state') ||
162
- this.component.key.includes('.zipCode')) {
163
+ this.component.key.includes('.zipCode') ||
164
+ this.component.key.includes('.country')) {
163
165
  this.on('changed-' + this.component.key, (value) => {
164
166
  this.setValue(value ?? '');
165
167
  this.updateValue(value, { modified: true });
@@ -244,7 +246,7 @@ export class FormFieldComponent extends ReactComponent {
244
246
  }
245
247
  else if (/^{{.*}}$/.test(this.component.initialValue)) {
246
248
  if (isAddressProperties(this.component.key)) {
247
- const regex = /^{{input\.(?<relatedObjectProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<addressProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<nestedAddressProperty>line1|line2|city|county|state|zipCode)}}$/;
249
+ const regex = /^{{input\.(?<relatedObjectProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<addressProperty>[a-zA-Z][a-zA-Z0-9_]*)\.(?<nestedAddressProperty>line1|line2|city|county|state|zipCode|country)}}$/;
248
250
  const groups = regex.exec(this.component.initialValue)?.groups;
249
251
  if (groups?.relatedObjectProperty && groups?.addressProperty && groups?.nestedAddressProperty) {
250
252
  this.on(`changed-${groups.relatedObjectProperty}`, (value) => {
@@ -42,7 +42,7 @@ export class ObjectComponent extends ReactComponent {
42
42
  let compKey = compKeyFragments[0];
43
43
  const property = this.component.properties.find((c) => c.id === compKey);
44
44
  if (property?.type === 'address' &&
45
- ['line1', 'line2', 'city', 'state', 'zipCode'].includes(compKeyFragments[1])) {
45
+ ['line1', 'line2', 'city', 'state', 'zipCode', 'country'].includes(compKeyFragments[1])) {
46
46
  compKey = inputProp;
47
47
  }
48
48
  this.on(`changed-${compKey}`, async (value) => {
@@ -86,7 +86,7 @@ export class ObjectComponent extends ReactComponent {
86
86
  let compKey = compKeyFragments[0];
87
87
  const property = this.component.properties.find((c) => c.id === compKey);
88
88
  if (property?.type === 'address' &&
89
- ['line1', 'line2', 'city', 'state', 'zipCode'].includes(compKeyFragments[1])) {
89
+ ['line1', 'line2', 'city', 'state', 'zipCode', 'country'].includes(compKeyFragments[1])) {
90
90
  compKey = inputProp;
91
91
  }
92
92
  this.on(`changed-${compKey}`, async (value) => {
@@ -31,7 +31,7 @@ export class RepeatableFieldComponent extends ReactComponent {
31
31
  let compKey = compKeyFragments[0];
32
32
  const property = this.component.properties.find((c) => c.id === compKey);
33
33
  if (property?.type === 'address' &&
34
- ['line1', 'line2', 'city', 'state', 'zipCode'].includes(compKeyFragments[1])) {
34
+ ['line1', 'line2', 'city', 'state', 'zipCode', 'country'].includes(compKeyFragments[1])) {
35
35
  compKey = inputProp;
36
36
  }
37
37
  this.on(`changed-${compKey}`, async (value) => {
@@ -88,6 +88,7 @@ export type Address = {
88
88
  county?: string;
89
89
  state?: string;
90
90
  zipCode?: string;
91
+ country?: string;
91
92
  };
92
93
  export type User = {
93
94
  id: string;
@@ -554,6 +554,11 @@ formComponents, allCriteriaInputs, instance, objectPropertyInputProps, associate
554
554
  name: `${property.name} Zip Code`,
555
555
  type: 'string',
556
556
  },
557
+ {
558
+ id: `${property.id}.country`,
559
+ name: `${property.name} Country`,
560
+ type: 'string',
561
+ },
557
562
  ]
558
563
  : [property]);
559
564
  return [
@@ -1048,6 +1053,27 @@ export const buildComponentPropsFromObjectProperties = (properties, objectId, in
1048
1053
  fieldHeight,
1049
1054
  autoSave,
1050
1055
  },
1056
+ {
1057
+ type,
1058
+ key: `${property.id}.country`,
1059
+ label: `${property.name} Country`,
1060
+ inputMask: property.mask,
1061
+ readOnly: !hasActionPermissions || readOnly || !!property?.formula,
1062
+ instance: instance,
1063
+ defaultValue: instance ? instance[property.id]?.[`country`] : undefined,
1064
+ user: objectPropertyInputProps?.user,
1065
+ property: {
1066
+ id: `${property.id}.country`,
1067
+ name: `${property.name} Country`,
1068
+ type: 'string',
1069
+ },
1070
+ validate: {
1071
+ required: property.required,
1072
+ },
1073
+ objectId,
1074
+ fieldHeight,
1075
+ autoSave,
1076
+ },
1051
1077
  ];
1052
1078
  }
1053
1079
  let minDate = property.validation?.from ?? '';
@@ -20,6 +20,7 @@ it('displays matching addresses', async () => {
20
20
  county: 'Howard',
21
21
  state: 'Maryland',
22
22
  zipCode: '21046',
23
+ country: 'USA',
23
24
  },
24
25
  },
25
26
  {
@@ -29,6 +30,7 @@ it('displays matching addresses', async () => {
29
30
  county: 'Howard',
30
31
  state: 'Maryland',
31
32
  zipCode: '21046',
33
+ country: 'USA',
32
34
  },
33
35
  },
34
36
  ];
@@ -58,6 +60,7 @@ it('returns selected search result', async () => {
58
60
  county: 'Howard',
59
61
  state: 'Maryland',
60
62
  zipCode: '21046',
63
+ country: 'USA',
61
64
  },
62
65
  },
63
66
  ];
@@ -72,5 +75,6 @@ it('returns selected search result', async () => {
72
75
  county: 'Howard',
73
76
  state: 'Maryland',
74
77
  zipCode: '21046',
78
+ country: 'USA',
75
79
  }, addressProperty, undefined);
76
80
  });
@@ -8,6 +8,7 @@ export type Address = {
8
8
  county?: string;
9
9
  state?: string;
10
10
  zipCode?: string;
11
+ country?: string;
11
12
  };
12
13
  };
13
14
  declare const AddressFieldComponent: (props: FormFieldProps & {
@@ -25,9 +25,9 @@ const AddressFieldComponent = (props) => {
25
25
  setSelectOptions(addresses
26
26
  .filter((address) => address.address.line1)
27
27
  .map((address) => {
28
- const { line1, city, county, state, zipCode } = address.address;
28
+ const { line1, city, county, state, zipCode, country } = address.address;
29
29
  const label = line1 ?? '';
30
- let sublabel = [city, county, state].filter(Boolean).join(', ');
30
+ let sublabel = [city, county, state, country].filter(Boolean).join(', ');
31
31
  if (zipCode) {
32
32
  sublabel = sublabel ? `${sublabel} ${zipCode}` : zipCode;
33
33
  }
@@ -25,7 +25,7 @@ function AddressFields(props) {
25
25
  const handleAddressChange = async (name, value) => {
26
26
  try {
27
27
  if (addressField === 'line1' && typeof value === 'object' && value.line1) {
28
- const addressKeys = ['line1', 'city', 'county', 'state', 'zipCode'];
28
+ const addressKeys = ['line1', 'city', 'county', 'state', 'zipCode', 'country'];
29
29
  // Await each handleChange sequentially to ensure proper order
30
30
  for (const key of addressKeys) {
31
31
  const fullKey = `${addressObject}.${key}`;
@@ -7,6 +7,7 @@ export type FieldAddress = {
7
7
  county?: string;
8
8
  state?: string;
9
9
  zipCode?: string;
10
+ country?: string;
10
11
  };
11
12
  export type AccessCheck = {
12
13
  result: boolean;
@@ -63,7 +63,7 @@ const evaluateCondition = (condition, formValues, instance) => {
63
63
  }
64
64
  };
65
65
  export function isAddressProperty(key) {
66
- return /\.line1|\.line2|\.city|\.county|\.state|\.zipCode$/.test(key);
66
+ return /\.line1|\.line2|\.city|\.county|\.state|\.zipCode|\.country$/.test(key);
67
67
  }
68
68
  /**
69
69
  * Determine if a form entry is visible or not.
@@ -172,6 +172,11 @@ export function addressProperties(addressProperty) {
172
172
  name: `${addressProperty.name} Zip Code`,
173
173
  type: 'string',
174
174
  },
175
+ {
176
+ id: `${addressProperty.id}.country`,
177
+ name: `${addressProperty.name} Country`,
178
+ type: 'string',
179
+ },
175
180
  ];
176
181
  }
177
182
  export const normalizeDates = (instance, evokeObject) => {
@@ -414,7 +419,7 @@ export const convertPropertiesToParams = (object) => {
414
419
  return property.type === 'address'
415
420
  ? [
416
421
  ...acc,
417
- ...['city', 'county', 'state', 'line1', 'line2', 'zipCode'].map((field) => ({
422
+ ...['city', 'county', 'state', 'line1', 'line2', 'zipCode', 'country'].map((field) => ({
418
423
  id: `${property.id}.${field}`,
419
424
  name: `${property.name} ${startCase(field)}`,
420
425
  type: 'string',
@@ -322,6 +322,11 @@ CriteriaBuilderRelatedObject.args = {
322
322
  name: 'Applicant Address County',
323
323
  type: 'string',
324
324
  },
325
+ {
326
+ id: 'homeAddress.country',
327
+ name: 'Applicant Address Country',
328
+ type: 'string',
329
+ },
325
330
  ],
326
331
  actions: [],
327
332
  });
@@ -516,6 +521,11 @@ CriteriaBuilderRelatedObject.args = {
516
521
  name: 'Applicant Address County',
517
522
  type: 'string',
518
523
  },
524
+ {
525
+ id: 'homeAddress.country',
526
+ name: 'Applicant Address Country',
527
+ type: 'string',
528
+ },
519
529
  {
520
530
  id: 'name',
521
531
  name: 'Name',
@@ -634,6 +644,11 @@ CriteriaBuilderRelatedObject.args = {
634
644
  name: 'Applicant Address County',
635
645
  type: 'string',
636
646
  },
647
+ {
648
+ id: 'homeAddress.country',
649
+ name: 'Applicant Address Country',
650
+ type: 'string',
651
+ },
637
652
  {
638
653
  id: 'name',
639
654
  name: 'Name',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evoke-platform/ui-components",
3
- "version": "1.10.1-dev.3",
3
+ "version": "1.10.1-dev.4",
4
4
  "description": "",
5
5
  "main": "dist/published/index.js",
6
6
  "module": "dist/published/index.js",