@abgov/jsonforms-components 2.4.4 → 2.4.6

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/index.esm.js CHANGED
@@ -2899,6 +2899,26 @@ $$n({ target: 'Iterator', proto: true, real: true }, {
2899
2899
  }
2900
2900
  });
2901
2901
 
2902
+ var $$m = _export;
2903
+ var iterate$6 = iterate$8;
2904
+ var aCallable$a = aCallable$g;
2905
+ var anObject$9 = anObject$o;
2906
+ var getIteratorDirect$5 = getIteratorDirect$7;
2907
+
2908
+ // `Iterator.prototype.forEach` method
2909
+ // https://github.com/tc39/proposal-iterator-helpers
2910
+ $$m({ target: 'Iterator', proto: true, real: true }, {
2911
+ forEach: function forEach(fn) {
2912
+ anObject$9(this);
2913
+ aCallable$a(fn);
2914
+ var record = getIteratorDirect$5(this);
2915
+ var counter = 0;
2916
+ iterate$6(record, function (value) {
2917
+ fn(value, counter++);
2918
+ }, { IS_RECORD: true });
2919
+ }
2920
+ });
2921
+
2902
2922
  var defineBuiltIn$3 = defineBuiltIn$9;
2903
2923
 
2904
2924
  var defineBuiltIns$1 = function (target, src, options) {
@@ -2982,28 +3002,28 @@ var iteratorCreateProxy = function (nextHandler, IS_ITERATOR) {
2982
3002
  return IteratorProxy;
2983
3003
  };
2984
3004
 
2985
- var anObject$9 = anObject$o;
3005
+ var anObject$8 = anObject$o;
2986
3006
  var iteratorClose = iteratorClose$3;
2987
3007
 
2988
3008
  // call something on iterator step with safe closing on error
2989
3009
  var callWithSafeIterationClosing$2 = function (iterator, fn, value, ENTRIES) {
2990
3010
  try {
2991
- return ENTRIES ? fn(anObject$9(value)[0], value[1]) : fn(value);
3011
+ return ENTRIES ? fn(anObject$8(value)[0], value[1]) : fn(value);
2992
3012
  } catch (error) {
2993
3013
  iteratorClose(iterator, 'throw', error);
2994
3014
  }
2995
3015
  };
2996
3016
 
2997
3017
  var call$6 = functionCall;
2998
- var aCallable$a = aCallable$g;
2999
- var anObject$8 = anObject$o;
3000
- var getIteratorDirect$5 = getIteratorDirect$7;
3018
+ var aCallable$9 = aCallable$g;
3019
+ var anObject$7 = anObject$o;
3020
+ var getIteratorDirect$4 = getIteratorDirect$7;
3001
3021
  var createIteratorProxy$1 = iteratorCreateProxy;
3002
3022
  var callWithSafeIterationClosing$1 = callWithSafeIterationClosing$2;
3003
3023
 
3004
3024
  var IteratorProxy$1 = createIteratorProxy$1(function () {
3005
3025
  var iterator = this.iterator;
3006
- var result = anObject$8(call$6(this.next, iterator));
3026
+ var result = anObject$7(call$6(this.next, iterator));
3007
3027
  var done = this.done = !!result.done;
3008
3028
  if (!done) return callWithSafeIterationClosing$1(iterator, this.mapper, [result.value, this.counter++], true);
3009
3029
  });
@@ -3011,20 +3031,20 @@ var IteratorProxy$1 = createIteratorProxy$1(function () {
3011
3031
  // `Iterator.prototype.map` method
3012
3032
  // https://github.com/tc39/proposal-iterator-helpers
3013
3033
  var iteratorMap = function map(mapper) {
3014
- anObject$8(this);
3015
- aCallable$a(mapper);
3016
- return new IteratorProxy$1(getIteratorDirect$5(this), {
3034
+ anObject$7(this);
3035
+ aCallable$9(mapper);
3036
+ return new IteratorProxy$1(getIteratorDirect$4(this), {
3017
3037
  mapper: mapper
3018
3038
  });
3019
3039
  };
3020
3040
 
3021
- var $$m = _export;
3041
+ var $$l = _export;
3022
3042
  var map = iteratorMap;
3023
3043
  var IS_PURE$1 = isPure;
3024
3044
 
3025
3045
  // `Iterator.prototype.map` method
3026
3046
  // https://github.com/tc39/proposal-iterator-helpers
3027
- $$m({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
3047
+ $$l({ target: 'Iterator', proto: true, real: true, forced: IS_PURE$1 }, {
3028
3048
  map: map
3029
3049
  });
3030
3050
 
@@ -3097,22 +3117,45 @@ const validateSinWithLuhn = input => {
3097
3117
  return sum % 10 === 0;
3098
3118
  };
3099
3119
  /**
3100
- * Gets the required field in the If/Then json schema condition.
3120
+ * Gets the required fields in the If/Then/Else json schema condition.
3101
3121
  * @param props - ControlProps
3102
3122
  * @returns - The required field name.
3103
3123
  */
3104
3124
  const getRequiredIfThen = props => {
3105
- var _a, _b, _c, _d;
3125
+ var _a, _b, _c, _d, _e, _f, _g;
3106
3126
  const {
3107
3127
  path
3108
3128
  } = props;
3109
3129
  const rootSchema = props.rootSchema;
3110
- let rootRequired = '';
3111
- if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.if) && rootSchema.then) {
3112
- if (((_a = rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.then) === null || _a === void 0 ? void 0 : _a.required) && Array.isArray((_b = rootSchema.then) === null || _b === void 0 ? void 0 : _b.required)) {
3130
+ let rootRequired = [];
3131
+ if (rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.allOf) {
3132
+ (_a = rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.allOf) === null || _a === void 0 ? void 0 : _a.forEach(el => {
3133
+ var _a, _b, _c, _d, _e;
3134
+ if (el.if && el.then && ((_a = el.then) === null || _a === void 0 ? void 0 : _a.required)) {
3135
+ const foundIfThenRequired = (_c = (_b = el.then) === null || _b === void 0 ? void 0 : _b.required) === null || _c === void 0 ? void 0 : _c.find(req => req === path);
3136
+ if (foundIfThenRequired !== undefined) {
3137
+ rootRequired = [...rootRequired, foundIfThenRequired];
3138
+ }
3139
+ }
3140
+ if (el.if && el.else) {
3141
+ const foundIfElseRequired = (_e = (_d = el.else) === null || _d === void 0 ? void 0 : _d.required) === null || _e === void 0 ? void 0 : _e.find(req => req === path);
3142
+ if (foundIfElseRequired !== undefined) {
3143
+ rootRequired = [...rootRequired, foundIfElseRequired];
3144
+ }
3145
+ }
3146
+ });
3147
+ }
3148
+ if (rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.if) {
3149
+ if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.then) && ((_b = rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.then) === null || _b === void 0 ? void 0 : _b.required)) {
3113
3150
  const foundRequired = (_d = (_c = rootSchema.then) === null || _c === void 0 ? void 0 : _c.required) === null || _d === void 0 ? void 0 : _d.find(req => req === path);
3114
3151
  if (foundRequired !== undefined) {
3115
- rootRequired = foundRequired;
3152
+ rootRequired = [...rootRequired, foundRequired];
3153
+ }
3154
+ if ((rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.else) && ((_e = rootSchema === null || rootSchema === void 0 ? void 0 : rootSchema.else) === null || _e === void 0 ? void 0 : _e.required)) {
3155
+ const foundIfElseRequired = (_g = (_f = rootSchema.else) === null || _f === void 0 ? void 0 : _f.required) === null || _g === void 0 ? void 0 : _g.find(req => req === path);
3156
+ if (foundIfElseRequired !== undefined) {
3157
+ rootRequired = [...rootRequired, foundIfElseRequired];
3158
+ }
3116
3159
  }
3117
3160
  }
3118
3161
  }
@@ -3212,11 +3255,11 @@ const convertToSentenceCase = input => {
3212
3255
  return firstWord.concat(newWords).join(' ');
3213
3256
  };
3214
3257
 
3215
- var $$l = _export;
3258
+ var $$k = _export;
3216
3259
  var call$5 = functionCall;
3217
- var aCallable$9 = aCallable$g;
3218
- var anObject$7 = anObject$o;
3219
- var getIteratorDirect$4 = getIteratorDirect$7;
3260
+ var aCallable$8 = aCallable$g;
3261
+ var anObject$6 = anObject$o;
3262
+ var getIteratorDirect$3 = getIteratorDirect$7;
3220
3263
  var createIteratorProxy = iteratorCreateProxy;
3221
3264
  var callWithSafeIterationClosing = callWithSafeIterationClosing$2;
3222
3265
  var IS_PURE = isPure;
@@ -3227,7 +3270,7 @@ var IteratorProxy = createIteratorProxy(function () {
3227
3270
  var next = this.next;
3228
3271
  var result, done, value;
3229
3272
  while (true) {
3230
- result = anObject$7(call$5(next, iterator));
3273
+ result = anObject$6(call$5(next, iterator));
3231
3274
  done = this.done = !!result.done;
3232
3275
  if (done) return;
3233
3276
  value = result.value;
@@ -3237,11 +3280,11 @@ var IteratorProxy = createIteratorProxy(function () {
3237
3280
 
3238
3281
  // `Iterator.prototype.filter` method
3239
3282
  // https://github.com/tc39/proposal-iterator-helpers
3240
- $$l({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
3283
+ $$k({ target: 'Iterator', proto: true, real: true, forced: IS_PURE }, {
3241
3284
  filter: function filter(predicate) {
3242
- anObject$7(this);
3243
- aCallable$9(predicate);
3244
- return new IteratorProxy(getIteratorDirect$4(this), {
3285
+ anObject$6(this);
3286
+ aCallable$8(predicate);
3287
+ return new IteratorProxy(getIteratorDirect$3(this), {
3245
3288
  predicate: predicate
3246
3289
  });
3247
3290
  }
@@ -3565,7 +3608,7 @@ var doesNotExceedSafeInteger$2 = function (it) {
3565
3608
  return it;
3566
3609
  };
3567
3610
 
3568
- var $$k = _export;
3611
+ var $$j = _export;
3569
3612
  var toObject$2 = toObject$8;
3570
3613
  var lengthOfArrayLike$3 = lengthOfArrayLike$7;
3571
3614
  var setArrayLength = arraySetLength;
@@ -3591,7 +3634,7 @@ var FORCED$2 = INCORRECT_TO_LENGTH || !properErrorOnNonWritableLength();
3591
3634
 
3592
3635
  // `Array.prototype.push` method
3593
3636
  // https://tc39.es/ecma262/#sec-array.prototype.push
3594
- $$k({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
3637
+ $$j({ target: 'Array', proto: true, arity: 1, forced: FORCED$2 }, {
3595
3638
  // eslint-disable-next-line no-unused-vars -- required for `.length`
3596
3639
  push: function push(item) {
3597
3640
  var O = toObject$2(this);
@@ -3642,7 +3685,7 @@ function registerReducer(state, action) {
3642
3685
  return state;
3643
3686
  }
3644
3687
 
3645
- var $$j = _export;
3688
+ var $$i = _export;
3646
3689
  var $includes = arrayIncludes.includes;
3647
3690
  var fails$7 = fails$t;
3648
3691
  var addToUnscopables$1 = addToUnscopables$4;
@@ -3655,7 +3698,7 @@ var BROKEN_ON_SPARSE = fails$7(function () {
3655
3698
 
3656
3699
  // `Array.prototype.includes` method
3657
3700
  // https://tc39.es/ecma262/#sec-array.prototype.includes
3658
- $$j({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3701
+ $$i({ target: 'Array', proto: true, forced: BROKEN_ON_SPARSE }, {
3659
3702
  includes: function includes(el /* , fromIndex = 0 */) {
3660
3703
  return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
3661
3704
  }
@@ -3698,7 +3741,7 @@ var getJsonReplacerFunction = function (replacer) {
3698
3741
  };
3699
3742
  };
3700
3743
 
3701
- var $$i = _export;
3744
+ var $$h = _export;
3702
3745
  var getBuiltIn$4 = getBuiltIn$9;
3703
3746
  var apply$1 = functionApply;
3704
3747
  var call$4 = functionCall;
@@ -3761,7 +3804,7 @@ var fixIllFormed = function (match, offset, string) {
3761
3804
  if ($stringify) {
3762
3805
  // `JSON.stringify` method
3763
3806
  // https://tc39.es/ecma262/#sec-json.stringify
3764
- $$i({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
3807
+ $$h({ target: 'JSON', stat: true, arity: 3, forced: WRONG_SYMBOLS_CONVERSION || ILL_FORMED_UNICODE }, {
3765
3808
  // eslint-disable-next-line no-unused-vars -- required for `.length`
3766
3809
  stringify: function stringify(it, replacer, space) {
3767
3810
  var args = arraySlice$1(arguments);
@@ -3857,7 +3900,7 @@ var aConstructor$1 = function (argument) {
3857
3900
  throw new $TypeError$5(tryToString(argument) + ' is not a constructor');
3858
3901
  };
3859
3902
 
3860
- var anObject$6 = anObject$o;
3903
+ var anObject$5 = anObject$o;
3861
3904
  var aConstructor = aConstructor$1;
3862
3905
  var isNullOrUndefined$1 = isNullOrUndefined$6;
3863
3906
  var wellKnownSymbol$4 = wellKnownSymbol$m;
@@ -3867,9 +3910,9 @@ var SPECIES$2 = wellKnownSymbol$4('species');
3867
3910
  // `SpeciesConstructor` abstract operation
3868
3911
  // https://tc39.es/ecma262/#sec-speciesconstructor
3869
3912
  var speciesConstructor$1 = function (O, defaultConstructor) {
3870
- var C = anObject$6(O).constructor;
3913
+ var C = anObject$5(O).constructor;
3871
3914
  var S;
3872
- return C === undefined || isNullOrUndefined$1(S = anObject$6(C)[SPECIES$2]) ? defaultConstructor : aConstructor(S);
3915
+ return C === undefined || isNullOrUndefined$1(S = anObject$5(C)[SPECIES$2]) ? defaultConstructor : aConstructor(S);
3873
3916
  };
3874
3917
 
3875
3918
  var $TypeError$4 = TypeError;
@@ -4202,7 +4245,7 @@ var promiseConstructorDetection = {
4202
4245
 
4203
4246
  var newPromiseCapability$2 = {};
4204
4247
 
4205
- var aCallable$8 = aCallable$g;
4248
+ var aCallable$7 = aCallable$g;
4206
4249
 
4207
4250
  var $TypeError$3 = TypeError;
4208
4251
 
@@ -4213,8 +4256,8 @@ var PromiseCapability = function (C) {
4213
4256
  resolve = $$resolve;
4214
4257
  reject = $$reject;
4215
4258
  });
4216
- this.resolve = aCallable$8(resolve);
4217
- this.reject = aCallable$8(reject);
4259
+ this.resolve = aCallable$7(resolve);
4260
+ this.reject = aCallable$7(reject);
4218
4261
  };
4219
4262
 
4220
4263
  // `NewPromiseCapability` abstract operation
@@ -4223,7 +4266,7 @@ newPromiseCapability$2.f = function (C) {
4223
4266
  return new PromiseCapability(C);
4224
4267
  };
4225
4268
 
4226
- var $$h = _export;
4269
+ var $$g = _export;
4227
4270
  var IS_NODE$1 = engineIsNode;
4228
4271
  var global$4 = global$q;
4229
4272
  var call$3 = functionCall;
@@ -4231,7 +4274,7 @@ var defineBuiltIn$2 = defineBuiltIn$9;
4231
4274
  var setPrototypeOf = objectSetPrototypeOf;
4232
4275
  var setToStringTag = setToStringTag$4;
4233
4276
  var setSpecies$1 = setSpecies$2;
4234
- var aCallable$7 = aCallable$g;
4277
+ var aCallable$6 = aCallable$g;
4235
4278
  var isCallable$2 = isCallable$r;
4236
4279
  var isObject$2 = isObject$e;
4237
4280
  var anInstance = anInstance$2;
@@ -4421,7 +4464,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
4421
4464
  // 25.4.3.1 Promise(executor)
4422
4465
  PromiseConstructor = function Promise(executor) {
4423
4466
  anInstance(this, PromisePrototype);
4424
- aCallable$7(executor);
4467
+ aCallable$6(executor);
4425
4468
  call$3(Internal, this);
4426
4469
  var state = getInternalPromiseState(this);
4427
4470
  try {
@@ -4503,7 +4546,7 @@ if (FORCED_PROMISE_CONSTRUCTOR$4) {
4503
4546
  }
4504
4547
  }
4505
4548
 
4506
- $$h({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
4549
+ $$g({ global: true, constructor: true, wrap: true, forced: FORCED_PROMISE_CONSTRUCTOR$4 }, {
4507
4550
  Promise: PromiseConstructor
4508
4551
  });
4509
4552
 
@@ -4559,28 +4602,28 @@ var promiseStaticsIncorrectIteration = FORCED_PROMISE_CONSTRUCTOR$3 || !checkCor
4559
4602
  NativePromiseConstructor$1.all(iterable).then(undefined, function () { /* empty */ });
4560
4603
  });
4561
4604
 
4562
- var $$g = _export;
4605
+ var $$f = _export;
4563
4606
  var call$2 = functionCall;
4564
- var aCallable$6 = aCallable$g;
4607
+ var aCallable$5 = aCallable$g;
4565
4608
  var newPromiseCapabilityModule$2 = newPromiseCapability$2;
4566
4609
  var perform$1 = perform$3;
4567
- var iterate$6 = iterate$8;
4610
+ var iterate$5 = iterate$8;
4568
4611
  var PROMISE_STATICS_INCORRECT_ITERATION$1 = promiseStaticsIncorrectIteration;
4569
4612
 
4570
4613
  // `Promise.all` method
4571
4614
  // https://tc39.es/ecma262/#sec-promise.all
4572
- $$g({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
4615
+ $$f({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION$1 }, {
4573
4616
  all: function all(iterable) {
4574
4617
  var C = this;
4575
4618
  var capability = newPromiseCapabilityModule$2.f(C);
4576
4619
  var resolve = capability.resolve;
4577
4620
  var reject = capability.reject;
4578
4621
  var result = perform$1(function () {
4579
- var $promiseResolve = aCallable$6(C.resolve);
4622
+ var $promiseResolve = aCallable$5(C.resolve);
4580
4623
  var values = [];
4581
4624
  var counter = 0;
4582
4625
  var remaining = 1;
4583
- iterate$6(iterable, function (promise) {
4626
+ iterate$5(iterable, function (promise) {
4584
4627
  var index = counter++;
4585
4628
  var alreadyCalled = false;
4586
4629
  remaining++;
@@ -4598,7 +4641,7 @@ $$g({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
4598
4641
  }
4599
4642
  });
4600
4643
 
4601
- var $$f = _export;
4644
+ var $$e = _export;
4602
4645
  var FORCED_PROMISE_CONSTRUCTOR$2 = promiseConstructorDetection.CONSTRUCTOR;
4603
4646
  var NativePromiseConstructor = promiseNativeConstructor;
4604
4647
  var getBuiltIn$1 = getBuiltIn$9;
@@ -4609,7 +4652,7 @@ var NativePromisePrototype = NativePromiseConstructor && NativePromiseConstructo
4609
4652
 
4610
4653
  // `Promise.prototype.catch` method
4611
4654
  // https://tc39.es/ecma262/#sec-promise.prototype.catch
4612
- $$f({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
4655
+ $$e({ target: 'Promise', proto: true, forced: FORCED_PROMISE_CONSTRUCTOR$2, real: true }, {
4613
4656
  'catch': function (onRejected) {
4614
4657
  return this.then(undefined, onRejected);
4615
4658
  }
@@ -4623,24 +4666,24 @@ if (isCallable$1(NativePromiseConstructor)) {
4623
4666
  }
4624
4667
  }
4625
4668
 
4626
- var $$e = _export;
4669
+ var $$d = _export;
4627
4670
  var call$1 = functionCall;
4628
- var aCallable$5 = aCallable$g;
4671
+ var aCallable$4 = aCallable$g;
4629
4672
  var newPromiseCapabilityModule$1 = newPromiseCapability$2;
4630
4673
  var perform = perform$3;
4631
- var iterate$5 = iterate$8;
4674
+ var iterate$4 = iterate$8;
4632
4675
  var PROMISE_STATICS_INCORRECT_ITERATION = promiseStaticsIncorrectIteration;
4633
4676
 
4634
4677
  // `Promise.race` method
4635
4678
  // https://tc39.es/ecma262/#sec-promise.race
4636
- $$e({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
4679
+ $$d({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION }, {
4637
4680
  race: function race(iterable) {
4638
4681
  var C = this;
4639
4682
  var capability = newPromiseCapabilityModule$1.f(C);
4640
4683
  var reject = capability.reject;
4641
4684
  var result = perform(function () {
4642
- var $promiseResolve = aCallable$5(C.resolve);
4643
- iterate$5(iterable, function (promise) {
4685
+ var $promiseResolve = aCallable$4(C.resolve);
4686
+ iterate$4(iterable, function (promise) {
4644
4687
  call$1($promiseResolve, C, promise).then(capability.resolve, reject);
4645
4688
  });
4646
4689
  });
@@ -4649,13 +4692,13 @@ $$e({ target: 'Promise', stat: true, forced: PROMISE_STATICS_INCORRECT_ITERATION
4649
4692
  }
4650
4693
  });
4651
4694
 
4652
- var $$d = _export;
4695
+ var $$c = _export;
4653
4696
  var newPromiseCapabilityModule = newPromiseCapability$2;
4654
4697
  var FORCED_PROMISE_CONSTRUCTOR$1 = promiseConstructorDetection.CONSTRUCTOR;
4655
4698
 
4656
4699
  // `Promise.reject` method
4657
4700
  // https://tc39.es/ecma262/#sec-promise.reject
4658
- $$d({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
4701
+ $$c({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
4659
4702
  reject: function reject(r) {
4660
4703
  var capability = newPromiseCapabilityModule.f(this);
4661
4704
  var capabilityReject = capability.reject;
@@ -4664,12 +4707,12 @@ $$d({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR$1 }, {
4664
4707
  }
4665
4708
  });
4666
4709
 
4667
- var anObject$5 = anObject$o;
4710
+ var anObject$4 = anObject$o;
4668
4711
  var isObject$1 = isObject$e;
4669
4712
  var newPromiseCapability = newPromiseCapability$2;
4670
4713
 
4671
4714
  var promiseResolve$1 = function (C, x) {
4672
- anObject$5(C);
4715
+ anObject$4(C);
4673
4716
  if (isObject$1(x) && x.constructor === C) return x;
4674
4717
  var promiseCapability = newPromiseCapability.f(C);
4675
4718
  var resolve = promiseCapability.resolve;
@@ -4677,7 +4720,7 @@ var promiseResolve$1 = function (C, x) {
4677
4720
  return promiseCapability.promise;
4678
4721
  };
4679
4722
 
4680
- var $$c = _export;
4723
+ var $$b = _export;
4681
4724
  var getBuiltIn = getBuiltIn$9;
4682
4725
  var FORCED_PROMISE_CONSTRUCTOR = promiseConstructorDetection.CONSTRUCTOR;
4683
4726
  var promiseResolve = promiseResolve$1;
@@ -4686,13 +4729,13 @@ getBuiltIn('Promise');
4686
4729
 
4687
4730
  // `Promise.resolve` method
4688
4731
  // https://tc39.es/ecma262/#sec-promise.resolve
4689
- $$c({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
4732
+ $$b({ target: 'Promise', stat: true, forced: FORCED_PROMISE_CONSTRUCTOR }, {
4690
4733
  resolve: function resolve(x) {
4691
4734
  return promiseResolve(this, x);
4692
4735
  }
4693
4736
  });
4694
4737
 
4695
- var $$b = _export;
4738
+ var $$a = _export;
4696
4739
  var uncurryThis$5 = functionUncurryThis;
4697
4740
  var notARegExp$1 = notARegexp;
4698
4741
  var requireObjectCoercible$3 = requireObjectCoercible$b;
@@ -4703,7 +4746,7 @@ var stringIndexOf$1 = uncurryThis$5(''.indexOf);
4703
4746
 
4704
4747
  // `String.prototype.includes` method
4705
4748
  // https://tc39.es/ecma262/#sec-string.prototype.includes
4706
- $$b({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
4749
+ $$a({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes') }, {
4707
4750
  includes: function includes(searchString /* , position = 0 */) {
4708
4751
  return !!~stringIndexOf$1(
4709
4752
  toString$6(requireObjectCoercible$3(this)),
@@ -4713,26 +4756,6 @@ $$b({ target: 'String', proto: true, forced: !correctIsRegExpLogic$1('includes')
4713
4756
  }
4714
4757
  });
4715
4758
 
4716
- var $$a = _export;
4717
- var iterate$4 = iterate$8;
4718
- var aCallable$4 = aCallable$g;
4719
- var anObject$4 = anObject$o;
4720
- var getIteratorDirect$3 = getIteratorDirect$7;
4721
-
4722
- // `Iterator.prototype.forEach` method
4723
- // https://github.com/tc39/proposal-iterator-helpers
4724
- $$a({ target: 'Iterator', proto: true, real: true }, {
4725
- forEach: function forEach(fn) {
4726
- anObject$4(this);
4727
- aCallable$4(fn);
4728
- var record = getIteratorDirect$3(this);
4729
- var counter = 0;
4730
- iterate$4(record, function (value) {
4731
- fn(value, counter++);
4732
- }, { IS_RECORD: true });
4733
- }
4734
- });
4735
-
4736
4759
  var $$9 = _export;
4737
4760
  var iterate$3 = iterate$8;
4738
4761
  var aCallable$3 = aCallable$g;
@@ -8466,7 +8489,6 @@ let _2 = t => t,
8466
8489
  _t3$2,
8467
8490
  _t4$2;
8468
8491
  const _excluded$3 = ["data", "path", "handleChange", "uischema"];
8469
- const DELAY_UPLOAD_TIMEOUT_MS = 5;
8470
8492
  const DELAY_DELETE_TIMEOUT_MS = 5;
8471
8493
  const FileUploaderReview = props => {
8472
8494
  return FileUploader(Object.assign({}, props, {
@@ -8476,6 +8498,7 @@ const FileUploaderReview = props => {
8476
8498
  const FileUploader = _ref => {
8477
8499
  let {
8478
8500
  data,
8501
+ path,
8479
8502
  handleChange,
8480
8503
  uischema
8481
8504
  } = _ref,
@@ -8503,15 +8526,17 @@ const FileUploader = _ref => {
8503
8526
  const variant = ((_d = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _d === void 0 ? void 0 : _d.variant) || 'button';
8504
8527
  const multiFileUploader = variant === 'dragdrop';
8505
8528
  const [deleteHide, setDeleteHide] = useState(false);
8529
+ const fileListLength = fileList && ((_e = fileList[props.i18nKeyPrefix]) === null || _e === void 0 ? void 0 : _e.length) || 0;
8506
8530
  function uploadFile(file) {
8507
8531
  if (uploadTrigger) {
8532
+ if (!multiFileUploader) {
8533
+ const fileInList = getFile(fileListLength - 1);
8534
+ if (fileInList) {
8535
+ deleteTrigger(fileInList, propertyId);
8536
+ }
8537
+ }
8508
8538
  uploadTrigger(file, propertyId);
8509
- const handleFunction = () => {
8510
- const value = ['Loading', Array.isArray(data) ? data[1] : file === null || file === void 0 ? void 0 : file.name];
8511
- handleChange(propertyId, value);
8512
- };
8513
8539
  setDeleteHide(false);
8514
- setTimeout(handleFunction, DELAY_UPLOAD_TIMEOUT_MS);
8515
8540
  }
8516
8541
  }
8517
8542
  function downloadFile(file) {
@@ -8526,30 +8551,39 @@ const FileUploader = _ref => {
8526
8551
  }
8527
8552
  function getFileName(index) {
8528
8553
  var _a;
8529
- return fileList && fileList[props.i18nKeyPrefix] && ((_a = fileList[props.i18nKeyPrefix][index]) === null || _a === void 0 ? void 0 : _a.filename);
8554
+ return (_a = getFile(index)) === null || _a === void 0 ? void 0 : _a.filename;
8530
8555
  }
8531
8556
  function getFile(index) {
8532
- return fileList && fileList[props.i18nKeyPrefix] && fileList[props.i18nKeyPrefix][index];
8557
+ var _a;
8558
+ return (_a = fileList === null || fileList === void 0 ? void 0 : fileList[props.i18nKeyPrefix]) === null || _a === void 0 ? void 0 : _a[index];
8533
8559
  }
8534
8560
  useEffect(() => {
8535
8561
  // UseEffect is required because not having it causes a react update error, but
8536
8562
  // it doesn't function correctly within jsonforms unless there is a minor delay here
8537
8563
  const delayedFunction = () => {
8538
- var _a;
8564
+ const files = [];
8565
+ for (let i = 0; i < fileListLength; i++) {
8566
+ files.push(getFile(i));
8567
+ }
8539
8568
  if (fileList) {
8540
- handleChange(propertyId, fileList && ((_a = fileList[propertyId]) === null || _a === void 0 ? void 0 : _a.urn));
8569
+ const data = files.map(f => f.urn).join(';');
8570
+ if (data === '') {
8571
+ handleChange(path, undefined);
8572
+ } else {
8573
+ handleChange(path, data);
8574
+ }
8541
8575
  }
8542
8576
  };
8543
8577
  const timeoutId = setTimeout(delayedFunction, 1);
8544
8578
  return () => clearTimeout(timeoutId);
8545
8579
  }, [handleChange, fileList, propertyId]);
8546
- const readOnly = ((_f = (_e = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _e === void 0 ? void 0 : _e.componentProps) === null || _f === void 0 ? void 0 : _f.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true || user === null;
8547
- const maxFileSize = (_j = (_h = (_g = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _g === void 0 ? void 0 : _g.componentProps) === null || _h === void 0 ? void 0 : _h.maxFileSize) !== null && _j !== void 0 ? _j : '';
8548
- const accept = (_m = (_l = (_k = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _k === void 0 ? void 0 : _k.componentProps) === null || _l === void 0 ? void 0 : _l.accept) !== null && _m !== void 0 ? _m : '';
8580
+ const readOnly = ((_g = (_f = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _f === void 0 ? void 0 : _f.componentProps) === null || _g === void 0 ? void 0 : _g.readOnly) === true || (props === null || props === void 0 ? void 0 : props.isStepperReview) === true || user === null;
8581
+ const maxFileSize = (_k = (_j = (_h = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _h === void 0 ? void 0 : _h.componentProps) === null || _j === void 0 ? void 0 : _j.maxFileSize) !== null && _k !== void 0 ? _k : '';
8582
+ const accept = (_o = (_m = (_l = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _l === void 0 ? void 0 : _l.componentProps) === null || _m === void 0 ? void 0 : _m.accept) !== null && _o !== void 0 ? _o : '';
8549
8583
  if (!enumerators) {
8550
8584
  return jsx(Fragment, {});
8551
8585
  }
8552
- const helpText = (_o = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _o === void 0 ? void 0 : _o.help;
8586
+ const helpText = (_p = uischema === null || uischema === void 0 ? void 0 : uischema.options) === null || _p === void 0 ? void 0 : _p.help;
8553
8587
  const sentenceCaseLabel = convertToSentenceCase(label);
8554
8588
  const DownloadFileWidget = ({
8555
8589
  index
@@ -8557,7 +8591,7 @@ const FileUploader = _ref => {
8557
8591
  var _a;
8558
8592
  const [showFileDeleteConfirmation, setShowFileDeleteConfirmation] = useState(false);
8559
8593
  return jsx("div", {
8560
- children: readOnly && index ? jsxs(AttachmentBorderDisabled, {
8594
+ children: readOnly ? jsxs(AttachmentBorderDisabled, {
8561
8595
  children: [getFileName(index), jsx(GoAContextMenuIcon, {
8562
8596
  testId: "download-icon",
8563
8597
  title: "Download",
@@ -8591,7 +8625,7 @@ const FileUploader = _ref => {
8591
8625
  deleteFile(getFile(index));
8592
8626
  setDeleteHide(true);
8593
8627
  const handleFunction = () => {
8594
- handleChange(propertyId, '');
8628
+ handleChange(path, undefined);
8595
8629
  };
8596
8630
  setTimeout(handleFunction, DELAY_DELETE_TIMEOUT_MS);
8597
8631
  }
@@ -8599,7 +8633,6 @@ const FileUploader = _ref => {
8599
8633
  })
8600
8634
  });
8601
8635
  };
8602
- const fileListLength = fileList && ((_p = fileList[props.i18nKeyPrefix]) === null || _p === void 0 ? void 0 : _p.length) || 0;
8603
8636
  return jsxs(FileUploaderStyle, {
8604
8637
  className: "FileUploader",
8605
8638
  children: [required ? jsx(GoAFormItem, {
@@ -10757,8 +10790,8 @@ const AddressLookUpControl = props => {
10757
10790
  setAddress(updatedAddress);
10758
10791
  handleChange(path, updatedAddress);
10759
10792
  };
10760
- const debouncedRenderAddress = useDebounce(searchTerm, 500);
10761
- const [selectedIndex, setSelectedIndex] = useState(0);
10793
+ const debouncedRenderAddress = useDebounce(searchTerm, 300);
10794
+ const [activeIndex, setActiveIndex] = useState(0);
10762
10795
  const dropdownRef = useRef(null);
10763
10796
  const handleInputChange = (field, value) => {
10764
10797
  var _a, _b;
@@ -10840,8 +10873,8 @@ const AddressLookUpControl = props => {
10840
10873
  };
10841
10874
  useEffect(() => {
10842
10875
  var _a;
10843
- if (dropdownRef.current && selectedIndex !== -1) {
10844
- const activeItem = (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`li[data-index="${selectedIndex}"]`);
10876
+ if (dropdownRef.current && activeIndex !== -1) {
10877
+ const activeItem = (_a = dropdownRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(`li[data-index="${activeIndex}"]`);
10845
10878
  if (activeItem) {
10846
10879
  activeItem.scrollIntoView({
10847
10880
  behavior: 'smooth',
@@ -10849,21 +10882,21 @@ const AddressLookUpControl = props => {
10849
10882
  });
10850
10883
  }
10851
10884
  }
10852
- }, [selectedIndex]);
10885
+ }, [activeIndex]);
10853
10886
  const handleKeyDown = (e, value, key) => {
10854
10887
  var _a;
10855
10888
  if (key === 'ArrowDown') {
10856
- setSelectedIndex(prevIndex => prevIndex < suggestions.length - 1 ? prevIndex + 1 : 0);
10889
+ setActiveIndex(prevIndex => prevIndex < suggestions.length - 1 ? prevIndex + 1 : 0);
10857
10890
  handleInputChange('addressLine1', value);
10858
10891
  } else if (key === 'ArrowUp') {
10859
- setSelectedIndex(prevIndex => prevIndex > 0 ? prevIndex - 1 : suggestions.length - 1);
10892
+ setActiveIndex(prevIndex => prevIndex > 0 ? prevIndex - 1 : suggestions.length - 1);
10860
10893
  handleInputChange('addressLine1', value);
10861
10894
  } else if (key === 'Enter') {
10862
10895
  handleInputChange('addressLine1', value);
10863
10896
  setLoading(false);
10864
- if (selectedIndex >= 0) {
10897
+ if (activeIndex >= 0) {
10865
10898
  (_a = document.getElementById('goaInput')) === null || _a === void 0 ? void 0 : _a.blur();
10866
- const suggestion = suggestions[selectedIndex];
10899
+ const suggestion = suggestions[activeIndex];
10867
10900
  if (suggestion) {
10868
10901
  setTimeout(() => {
10869
10902
  handleSuggestionClick(suggestion);
@@ -10922,7 +10955,7 @@ const AddressLookUpControl = props => {
10922
10955
  onClick: () => {
10923
10956
  handleSuggestionClick(suggestion);
10924
10957
  },
10925
- selectedIndex: selectedIndex,
10958
+ selectedIndex: activeIndex,
10926
10959
  index: index,
10927
10960
  children: `${suggestion.Text} ${suggestion.Description}`
10928
10961
  }, index))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abgov/jsonforms-components",
3
- "version": "2.4.4",
3
+ "version": "2.4.6",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
6
6
  "repository": "https://github.com/GovAlta/adsp-monorepo",
@@ -23,11 +23,11 @@ export declare const isEmptyBoolean: (schema: JsonSchema, data: unknown) => bool
23
23
  export declare const isEmptyNumber: (schema: JsonSchema, data: unknown) => boolean;
24
24
  export declare const validateSinWithLuhn: (input: number) => boolean;
25
25
  /**
26
- * Gets the required field in the If/Then json schema condition.
26
+ * Gets the required fields in the If/Then/Else json schema condition.
27
27
  * @param props - ControlProps
28
28
  * @returns - The required field name.
29
29
  */
30
- export declare const getRequiredIfThen: (props: ControlProps) => string;
30
+ export declare const getRequiredIfThen: (props: ControlProps) => string[];
31
31
  /**
32
32
  * Check if a required, defined input value is valid. Returns an appropriate
33
33
  * error message if not.