@abgov/jsonforms-components 1.36.0 → 1.37.0
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 +292 -122
- package/package.json +1 -1
- package/src/lib/Components/DropDownTypes.d.ts +33 -0
- package/src/lib/Components/Dropdown.d.ts +1 -14
- package/src/lib/Components/styled-components.d.ts +5 -0
- package/src/lib/Controls/AddressLookup/AddressLookupTester.d.ts +2 -2
- package/src/lib/common/tester.d.ts +3 -0
package/index.esm.js
CHANGED
|
@@ -4306,6 +4306,75 @@ const GoATimeControl = props => jsx(GoAInputBaseControl, Object.assign({}, props
|
|
|
4306
4306
|
const GoATimeControlTester = rankWith(4, isTimeControl);
|
|
4307
4307
|
const GoAInputTimeControl = withJsonFormsControlProps(GoATimeControl);
|
|
4308
4308
|
|
|
4309
|
+
// a string of all valid unicode whitespaces
|
|
4310
|
+
var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
4311
|
+
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
4312
|
+
|
|
4313
|
+
var uncurryThis$5 = functionUncurryThis;
|
|
4314
|
+
var requireObjectCoercible$1 = requireObjectCoercible$a;
|
|
4315
|
+
var toString$2 = toString$d;
|
|
4316
|
+
var whitespaces$1 = whitespaces$2;
|
|
4317
|
+
|
|
4318
|
+
var replace$1 = uncurryThis$5(''.replace);
|
|
4319
|
+
var ltrim = RegExp('^[' + whitespaces$1 + ']+');
|
|
4320
|
+
var rtrim = RegExp('(^|[^' + whitespaces$1 + '])[' + whitespaces$1 + ']+$');
|
|
4321
|
+
|
|
4322
|
+
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
4323
|
+
var createMethod$1 = function (TYPE) {
|
|
4324
|
+
return function ($this) {
|
|
4325
|
+
var string = toString$2(requireObjectCoercible$1($this));
|
|
4326
|
+
if (TYPE & 1) string = replace$1(string, ltrim, '');
|
|
4327
|
+
if (TYPE & 2) string = replace$1(string, rtrim, '$1');
|
|
4328
|
+
return string;
|
|
4329
|
+
};
|
|
4330
|
+
};
|
|
4331
|
+
|
|
4332
|
+
var stringTrim = {
|
|
4333
|
+
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
4334
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
4335
|
+
start: createMethod$1(1),
|
|
4336
|
+
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
4337
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
4338
|
+
end: createMethod$1(2),
|
|
4339
|
+
// `String.prototype.trim` method
|
|
4340
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
4341
|
+
trim: createMethod$1(3)
|
|
4342
|
+
};
|
|
4343
|
+
|
|
4344
|
+
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
4345
|
+
var fails$4 = fails$r;
|
|
4346
|
+
var whitespaces = whitespaces$2;
|
|
4347
|
+
|
|
4348
|
+
var non = '\u200B\u0085\u180E';
|
|
4349
|
+
|
|
4350
|
+
// check that a method works with the correct list
|
|
4351
|
+
// of whitespaces and has a correct name
|
|
4352
|
+
var stringTrimForced = function (METHOD_NAME) {
|
|
4353
|
+
return fails$4(function () {
|
|
4354
|
+
return !!whitespaces[METHOD_NAME]()
|
|
4355
|
+
|| non[METHOD_NAME]() !== non
|
|
4356
|
+
|| (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
|
|
4357
|
+
});
|
|
4358
|
+
};
|
|
4359
|
+
|
|
4360
|
+
var $$a = _export;
|
|
4361
|
+
var $trim = stringTrim.trim;
|
|
4362
|
+
var forcedStringTrimMethod = stringTrimForced;
|
|
4363
|
+
|
|
4364
|
+
// `String.prototype.trim` method
|
|
4365
|
+
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
4366
|
+
$$a({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
4367
|
+
trim: function trim() {
|
|
4368
|
+
return $trim(this);
|
|
4369
|
+
}
|
|
4370
|
+
});
|
|
4371
|
+
|
|
4372
|
+
const ENTER_KEY = 'Enter';
|
|
4373
|
+
const ESCAPE_KEY = 'Escape';
|
|
4374
|
+
const ARROW_DOWN_KEY = 'ArrowDown';
|
|
4375
|
+
const ARROW_UP_KEY = 'ArrowUp';
|
|
4376
|
+
const TAB_KEY = 'Tab';
|
|
4377
|
+
|
|
4309
4378
|
let _$7 = t => t,
|
|
4310
4379
|
_t$7,
|
|
4311
4380
|
_t2$4,
|
|
@@ -4341,23 +4410,55 @@ const GoADropdownListContainer = styled.div(_t3$3 || (_t3$3 = _$7`
|
|
|
4341
4410
|
width: 100%;
|
|
4342
4411
|
overflow-y: auto;
|
|
4343
4412
|
z-index: 1000;
|
|
4413
|
+
caret-color: transparent;
|
|
4344
4414
|
position: absolute;
|
|
4345
4415
|
line-height: 2rem;
|
|
4346
4416
|
max-height: ${0};
|
|
4417
|
+
|
|
4418
|
+
&:focus-visible {
|
|
4419
|
+
outline-color: var(--goa-color-interactive-default);
|
|
4420
|
+
}
|
|
4421
|
+
&:hover {
|
|
4422
|
+
background-color: var(--goa-color-interactive-hover) !important;
|
|
4423
|
+
color: white !important;
|
|
4424
|
+
}
|
|
4347
4425
|
`), p => p.optionListMaxHeight || '272px');
|
|
4348
4426
|
const GoADropdownListOption = styled.div(_t4$2 || (_t4$2 = _$7`
|
|
4349
4427
|
padding: 4px 12px;
|
|
4350
4428
|
text-overflow: ellipsis;
|
|
4351
4429
|
color: ${0} !important;
|
|
4352
|
-
border:
|
|
4430
|
+
border: 0px solid #f1f1f1;
|
|
4353
4431
|
z-index: 1001;
|
|
4432
|
+
cursor: pointer;
|
|
4354
4433
|
background: ${0};
|
|
4434
|
+
:has(div:focus) {
|
|
4435
|
+
background-color: ${0};
|
|
4436
|
+
color: ${0};
|
|
4437
|
+
}
|
|
4355
4438
|
&:hover {
|
|
4356
4439
|
background-color: ${0};
|
|
4440
|
+
color: ${0};
|
|
4441
|
+
}
|
|
4442
|
+
|
|
4443
|
+
&:focus-visible {
|
|
4444
|
+
caret-color: transparent;
|
|
4445
|
+
color: black !important;
|
|
4446
|
+
background-color: var(--goa-color-interactive-hover) !important;
|
|
4447
|
+
}
|
|
4448
|
+
&:focus-within {
|
|
4449
|
+
caret-color: transparent;
|
|
4357
4450
|
color: ${0} !important;
|
|
4451
|
+
background-color: var(--goa-color-interactive-hover) !important;
|
|
4358
4452
|
}
|
|
4359
|
-
|
|
4453
|
+
.dropDownListItem:focus-visible {
|
|
4454
|
+
caret-color: transparent;
|
|
4455
|
+
outline: none !important;
|
|
4456
|
+
color: ${0};
|
|
4457
|
+
}
|
|
4458
|
+
`), p => p.isSelected ? 'white' : 'var(--goa-color-greyscale-black)', p => p.isSelected ? 'var(--goa-color-interactive-default)' : '#fff', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-default)' : 'var(--goa-color-interactive-hover) !important', p => p.isSelected ? 'var(--goa-color-interactive-hover)' : 'var(--goa-color-greyscale-100) !important', p => p.isSelected ? 'var(--goa-color-interactive-default)' : 'var(--goa-color-interactive-hover) !important', p => p.isSelected ? 'white' : 'var(--goa-color-interactive-hover)', p => p.isSelected ? 'white' : 'var(--goa-color-interactive-hover) !important');
|
|
4459
|
+
|
|
4360
4460
|
const Dropdown = props => {
|
|
4461
|
+
var _a;
|
|
4361
4462
|
const {
|
|
4362
4463
|
label,
|
|
4363
4464
|
selected,
|
|
@@ -4368,14 +4469,135 @@ const Dropdown = props => {
|
|
|
4368
4469
|
} = props;
|
|
4369
4470
|
const [isOpen, setIsOpen] = useState(false);
|
|
4370
4471
|
const [selectedOption, setSelectedOption] = useState(selected);
|
|
4371
|
-
const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
|
|
4372
4472
|
const [items, setItems] = useState(props.items);
|
|
4373
4473
|
const [inputText, setInputText] = useState(selected);
|
|
4374
4474
|
const prevCountRef = useRef(props.items);
|
|
4475
|
+
const trailingIcon = isOpen ? 'chevron-up' : 'chevron-down';
|
|
4476
|
+
const textInputName = `dropdown-${label}`;
|
|
4477
|
+
const textInput = (_a = document.getElementsByName(textInputName)[0]) !== null && _a !== void 0 ? _a : null;
|
|
4478
|
+
const PREFIX = 'jsonforms-dropdown';
|
|
4375
4479
|
useEffect(() => {
|
|
4376
4480
|
setItems(props.items);
|
|
4377
4481
|
prevCountRef.current = props.items;
|
|
4482
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4378
4483
|
}, [isEqual(props.items, prevCountRef.current)]);
|
|
4484
|
+
useEffect(() => {
|
|
4485
|
+
if (textInput) {
|
|
4486
|
+
textInput.addEventListener('click', inputTextOnClick);
|
|
4487
|
+
textInput.addEventListener('keydown', handleKeyDown, false);
|
|
4488
|
+
}
|
|
4489
|
+
return () => {
|
|
4490
|
+
if (textInput) {
|
|
4491
|
+
textInput.removeEventListener('click', inputTextOnClick);
|
|
4492
|
+
textInput.removeEventListener('keydown', handleKeyDown);
|
|
4493
|
+
}
|
|
4494
|
+
};
|
|
4495
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4496
|
+
}, [textInput]);
|
|
4497
|
+
const inputTextOnClick = e => {
|
|
4498
|
+
setIsOpen(!isOpen);
|
|
4499
|
+
};
|
|
4500
|
+
const updateDropDownData = item => {
|
|
4501
|
+
onChange(item.value);
|
|
4502
|
+
setSelectedOption(item.value);
|
|
4503
|
+
setInputText(item.label);
|
|
4504
|
+
if (isAutocompletion) {
|
|
4505
|
+
const selectedItems = props.items.filter(filterItem => {
|
|
4506
|
+
return filterItem.label === item.label;
|
|
4507
|
+
});
|
|
4508
|
+
setItems(selectedItems);
|
|
4509
|
+
}
|
|
4510
|
+
setIsOpen(false);
|
|
4511
|
+
};
|
|
4512
|
+
const setElementFocus = (e, element, preventDefault) => {
|
|
4513
|
+
if (element) {
|
|
4514
|
+
element.focus();
|
|
4515
|
+
if (preventDefault) {
|
|
4516
|
+
e.preventDefault();
|
|
4517
|
+
}
|
|
4518
|
+
}
|
|
4519
|
+
};
|
|
4520
|
+
const handleKeyDown = e => {
|
|
4521
|
+
var _a, _b, _c;
|
|
4522
|
+
if (e.key === ENTER_KEY) {
|
|
4523
|
+
setIsOpen(!isOpen);
|
|
4524
|
+
const el = document.getElementById(`${PREFIX}-${label}-${(_a = items.at(0)) === null || _a === void 0 ? void 0 : _a.value}`);
|
|
4525
|
+
setElementFocus(e, el, false);
|
|
4526
|
+
} else if (e.key === ARROW_UP_KEY) {
|
|
4527
|
+
setIsOpen(true);
|
|
4528
|
+
const val = `${PREFIX}-${label}-${(_b = items.at(1)) === null || _b === void 0 ? void 0 : _b.value}`;
|
|
4529
|
+
const el = document.getElementById(val);
|
|
4530
|
+
setElementFocus(e, el, false);
|
|
4531
|
+
} else if (e.key === ARROW_DOWN_KEY) {
|
|
4532
|
+
setIsOpen(true);
|
|
4533
|
+
const firstItem = props.items.at(0);
|
|
4534
|
+
let index = 0;
|
|
4535
|
+
if ((firstItem === null || firstItem === void 0 ? void 0 : firstItem.label.trim()) === '') {
|
|
4536
|
+
index = 1;
|
|
4537
|
+
}
|
|
4538
|
+
let el = document.getElementById(`${PREFIX}-${label}-${(_c = props.items.at(index)) === null || _c === void 0 ? void 0 : _c.value}`);
|
|
4539
|
+
if (el === null) {
|
|
4540
|
+
const elements = document.querySelectorAll(`[id=${PREFIX}-dropDownList-${label}]`);
|
|
4541
|
+
const element = elements.item(0).children.item(1);
|
|
4542
|
+
el = document.getElementById(`${PREFIX}-${label}-${element.innerText}`);
|
|
4543
|
+
}
|
|
4544
|
+
setElementFocus(e, el, true);
|
|
4545
|
+
} else if (e.key === ESCAPE_KEY || e.key === TAB_KEY) {
|
|
4546
|
+
setIsOpen(false);
|
|
4547
|
+
}
|
|
4548
|
+
};
|
|
4549
|
+
const handDropDownItemOnKeyDown = (e, item) => {
|
|
4550
|
+
var _a, _b, _c, _d;
|
|
4551
|
+
if (e.key === ENTER_KEY) {
|
|
4552
|
+
updateDropDownData(item);
|
|
4553
|
+
const inputEl = document.getElementById(`${id}-input`);
|
|
4554
|
+
if (inputEl) {
|
|
4555
|
+
//The 'focused' property is part of the GoAInput component that is used to
|
|
4556
|
+
//set focus on the input field. We need to set it back to false once we set focus on the input field. Doing with just .focus() doesnt work.
|
|
4557
|
+
inputEl.focused = true;
|
|
4558
|
+
inputEl.focus();
|
|
4559
|
+
inputEl.focused = false;
|
|
4560
|
+
}
|
|
4561
|
+
}
|
|
4562
|
+
if (e.key === ESCAPE_KEY) {
|
|
4563
|
+
setIsOpen(false);
|
|
4564
|
+
}
|
|
4565
|
+
let index = items.findIndex(val => {
|
|
4566
|
+
return val.label === e.currentTarget.innerText;
|
|
4567
|
+
});
|
|
4568
|
+
//Prevent jumping to the next control/DOM element if
|
|
4569
|
+
//we are on the last item in the drop down list
|
|
4570
|
+
if (e.key === ARROW_DOWN_KEY) {
|
|
4571
|
+
if (item.label === ((_a = items.at(-1)) === null || _a === void 0 ? void 0 : _a.label)) {
|
|
4572
|
+
e.preventDefault();
|
|
4573
|
+
}
|
|
4574
|
+
if (index === -1 && item.label.trim() === '') {
|
|
4575
|
+
index = 0;
|
|
4576
|
+
}
|
|
4577
|
+
const el = document.getElementById(`${PREFIX}-${label}-${(_b = items.at(index + 1)) === null || _b === void 0 ? void 0 : _b.value}`);
|
|
4578
|
+
if (el) {
|
|
4579
|
+
setElementFocus(e, el, true);
|
|
4580
|
+
return;
|
|
4581
|
+
}
|
|
4582
|
+
}
|
|
4583
|
+
if (e.key === ARROW_UP_KEY) {
|
|
4584
|
+
if (index <= 0) {
|
|
4585
|
+
e.preventDefault();
|
|
4586
|
+
return;
|
|
4587
|
+
}
|
|
4588
|
+
const el = document.getElementById(`${PREFIX}-${label}-${(_c = items.at(index - 1)) === null || _c === void 0 ? void 0 : _c.value}`);
|
|
4589
|
+
if (el) {
|
|
4590
|
+
el.focus();
|
|
4591
|
+
}
|
|
4592
|
+
}
|
|
4593
|
+
if (e.key === TAB_KEY) {
|
|
4594
|
+
const val = `${PREFIX}-${label}-${(_d = items.at(index - 1)) === null || _d === void 0 ? void 0 : _d.value}`;
|
|
4595
|
+
const el = document.getElementById(val);
|
|
4596
|
+
if (el) {
|
|
4597
|
+
setIsOpen(false);
|
|
4598
|
+
}
|
|
4599
|
+
}
|
|
4600
|
+
};
|
|
4379
4601
|
return jsxs("div", {
|
|
4380
4602
|
"data-testid": id,
|
|
4381
4603
|
children: [jsx(GoAInput, {
|
|
@@ -4397,32 +4619,35 @@ const Dropdown = props => {
|
|
|
4397
4619
|
setIsOpen(true);
|
|
4398
4620
|
}
|
|
4399
4621
|
},
|
|
4400
|
-
trailingIcon: trailingIcon
|
|
4401
|
-
onFocus: () => {
|
|
4402
|
-
setIsOpen(!isOpen);
|
|
4403
|
-
}
|
|
4622
|
+
trailingIcon: trailingIcon
|
|
4404
4623
|
}), jsx(GoADropdownListContainerWrapper, {
|
|
4405
4624
|
isOpen: isOpen,
|
|
4625
|
+
id: `${PREFIX}-dropDownListContainerWrapper-${label}`,
|
|
4406
4626
|
children: jsx(GoADropdownListContainer, {
|
|
4627
|
+
id: `${PREFIX}-dropDownList-${label}`,
|
|
4407
4628
|
optionListMaxHeight: optionListMaxHeight,
|
|
4408
4629
|
children: items.map(item => {
|
|
4409
4630
|
return jsx(GoADropdownListOption, {
|
|
4410
|
-
|
|
4631
|
+
id: `${PREFIX}-option-${label}-${item.value}`,
|
|
4632
|
+
isSelected: item.value === selected || item.value === selectedOption,
|
|
4411
4633
|
children: jsx("div", {
|
|
4634
|
+
tabIndex: 0,
|
|
4635
|
+
className: "dropDownListItem",
|
|
4412
4636
|
"data-testid": `${id}-${item.label}-option`,
|
|
4637
|
+
id: `${PREFIX}-${label}-${item.value}`,
|
|
4638
|
+
onKeyDown: e => {
|
|
4639
|
+
handDropDownItemOnKeyDown(e, item);
|
|
4640
|
+
},
|
|
4413
4641
|
onClick: () => {
|
|
4414
|
-
|
|
4415
|
-
setSelectedOption(item.value);
|
|
4416
|
-
setInputText(item.label);
|
|
4417
|
-
setIsOpen(false);
|
|
4642
|
+
updateDropDownData(item);
|
|
4418
4643
|
},
|
|
4419
4644
|
children: item.label
|
|
4420
|
-
},
|
|
4421
|
-
});
|
|
4645
|
+
}, `${PREFIX}-${label}-${item.value}`)
|
|
4646
|
+
}, `${PREFIX}-option-${label}-${item.value}`);
|
|
4422
4647
|
})
|
|
4423
|
-
})
|
|
4424
|
-
})]
|
|
4425
|
-
});
|
|
4648
|
+
}, `${PREFIX}-dropDownList-${label}`)
|
|
4649
|
+
}, `${PREFIX}-dropDownListContainerWrapper-${label}`)]
|
|
4650
|
+
}, id);
|
|
4426
4651
|
};
|
|
4427
4652
|
|
|
4428
4653
|
function fetchRegisterConfigFromOptions(options) {
|
|
@@ -4455,7 +4680,7 @@ const EnumSelect = props => {
|
|
|
4455
4680
|
registerData = registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.selectRegisterData(registerConfig);
|
|
4456
4681
|
error = (registerCtx === null || registerCtx === void 0 ? void 0 : registerCtx.fetchErrors(registerConfig)) || '';
|
|
4457
4682
|
}
|
|
4458
|
-
const
|
|
4683
|
+
const autoCompletion = ((_d = (_c = props.uischema) === null || _c === void 0 ? void 0 : _c.options) === null || _d === void 0 ? void 0 : _d.autoComplete) === true;
|
|
4459
4684
|
const mergedOptions = useMemo(() => {
|
|
4460
4685
|
const newOptions = [...(options || []), ...((registerData === null || registerData === void 0 ? void 0 : registerData.map(d => {
|
|
4461
4686
|
if (typeof d === 'string') {
|
|
@@ -4492,11 +4717,11 @@ const EnumSelect = props => {
|
|
|
4492
4717
|
selected: data,
|
|
4493
4718
|
id: `jsonforms-${label}-dropdown`,
|
|
4494
4719
|
label: label,
|
|
4495
|
-
isAutocompletion:
|
|
4720
|
+
isAutocompletion: autoCompletion,
|
|
4496
4721
|
onChange: value => {
|
|
4497
4722
|
handleChange(path, value);
|
|
4498
4723
|
}
|
|
4499
|
-
})
|
|
4724
|
+
}, `jsonforms-${label}-dropdown`)
|
|
4500
4725
|
});
|
|
4501
4726
|
};
|
|
4502
4727
|
const enumControl = props => {
|
|
@@ -4861,10 +5086,10 @@ const RightAlignmentDiv = styled.div(_t10$1 || (_t10$1 = _$5`
|
|
|
4861
5086
|
margin-bottom: var(--goa-space-l);
|
|
4862
5087
|
`));
|
|
4863
5088
|
|
|
4864
|
-
var toString$
|
|
5089
|
+
var toString$1 = toString$d;
|
|
4865
5090
|
|
|
4866
5091
|
var normalizeStringArgument$1 = function (argument, $default) {
|
|
4867
|
-
return argument === undefined ? arguments.length < 2 ? '' : $default : toString$
|
|
5092
|
+
return argument === undefined ? arguments.length < 2 ? '' : $default : toString$1(argument);
|
|
4868
5093
|
};
|
|
4869
5094
|
|
|
4870
5095
|
var isObject$2 = isObject$d;
|
|
@@ -4878,10 +5103,10 @@ var installErrorCause$1 = function (O, options) {
|
|
|
4878
5103
|
}
|
|
4879
5104
|
};
|
|
4880
5105
|
|
|
4881
|
-
var uncurryThis$
|
|
5106
|
+
var uncurryThis$4 = functionUncurryThis;
|
|
4882
5107
|
|
|
4883
5108
|
var $Error = Error;
|
|
4884
|
-
var replace
|
|
5109
|
+
var replace = uncurryThis$4(''.replace);
|
|
4885
5110
|
|
|
4886
5111
|
var TEST = (function (arg) { return String(new $Error(arg).stack); })('zxcasd');
|
|
4887
5112
|
// eslint-disable-next-line redos/no-vulnerable -- safe
|
|
@@ -4890,14 +5115,14 @@ var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST);
|
|
|
4890
5115
|
|
|
4891
5116
|
var errorStackClear = function (stack, dropEntries) {
|
|
4892
5117
|
if (IS_V8_OR_CHAKRA_STACK && typeof stack == 'string' && !$Error.prepareStackTrace) {
|
|
4893
|
-
while (dropEntries--) stack = replace
|
|
5118
|
+
while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, '');
|
|
4894
5119
|
} return stack;
|
|
4895
5120
|
};
|
|
4896
5121
|
|
|
4897
|
-
var fails$
|
|
5122
|
+
var fails$3 = fails$r;
|
|
4898
5123
|
var createPropertyDescriptor$1 = createPropertyDescriptor$5;
|
|
4899
5124
|
|
|
4900
|
-
var errorStackInstallable = !fails$
|
|
5125
|
+
var errorStackInstallable = !fails$3(function () {
|
|
4901
5126
|
var error = new Error('a');
|
|
4902
5127
|
if (!('stack' in error)) return true;
|
|
4903
5128
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
@@ -4984,7 +5209,7 @@ var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_A
|
|
|
4984
5209
|
};
|
|
4985
5210
|
|
|
4986
5211
|
/* eslint-disable no-unused-vars -- required for functions `.length` */
|
|
4987
|
-
var $$
|
|
5212
|
+
var $$9 = _export;
|
|
4988
5213
|
var global$8 = global$o;
|
|
4989
5214
|
var apply$1 = functionApply;
|
|
4990
5215
|
var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
|
|
@@ -4998,14 +5223,14 @@ var FORCED$1 = new Error('e', { cause: 7 }).cause !== 7;
|
|
|
4998
5223
|
var exportGlobalErrorCauseWrapper = function (ERROR_NAME, wrapper) {
|
|
4999
5224
|
var O = {};
|
|
5000
5225
|
O[ERROR_NAME] = wrapErrorConstructorWithCause(ERROR_NAME, wrapper, FORCED$1);
|
|
5001
|
-
$$
|
|
5226
|
+
$$9({ global: true, constructor: true, arity: 1, forced: FORCED$1 }, O);
|
|
5002
5227
|
};
|
|
5003
5228
|
|
|
5004
5229
|
var exportWebAssemblyErrorCauseWrapper = function (ERROR_NAME, wrapper) {
|
|
5005
5230
|
if (WebAssembly && WebAssembly[ERROR_NAME]) {
|
|
5006
5231
|
var O = {};
|
|
5007
5232
|
O[ERROR_NAME] = wrapErrorConstructorWithCause(WEB_ASSEMBLY + '.' + ERROR_NAME, wrapper, FORCED$1);
|
|
5008
|
-
$$
|
|
5233
|
+
$$9({ target: WEB_ASSEMBLY, stat: true, constructor: true, arity: 1, forced: FORCED$1 }, O);
|
|
5009
5234
|
}
|
|
5010
5235
|
};
|
|
5011
5236
|
|
|
@@ -5788,20 +6013,20 @@ const FileUploaderStyle = styled.div(_t3$1 || (_t3$1 = _$3`
|
|
|
5788
6013
|
const FileUploaderTester = rankWith(3, and(schemaTypeIs('string'), formatIs('file-urn')));
|
|
5789
6014
|
|
|
5790
6015
|
var classofRaw = classofRaw$2;
|
|
5791
|
-
var uncurryThis$
|
|
6016
|
+
var uncurryThis$3 = functionUncurryThis;
|
|
5792
6017
|
|
|
5793
6018
|
var functionUncurryThisClause = function (fn) {
|
|
5794
6019
|
// Nashorn bug:
|
|
5795
6020
|
// https://github.com/zloirock/core-js/issues/1128
|
|
5796
6021
|
// https://github.com/zloirock/core-js/issues/1130
|
|
5797
|
-
if (classofRaw(fn) === 'Function') return uncurryThis$
|
|
6022
|
+
if (classofRaw(fn) === 'Function') return uncurryThis$3(fn);
|
|
5798
6023
|
};
|
|
5799
6024
|
|
|
5800
|
-
var uncurryThis$
|
|
6025
|
+
var uncurryThis$2 = functionUncurryThisClause;
|
|
5801
6026
|
var aCallable$6 = aCallable$9;
|
|
5802
6027
|
var NATIVE_BIND = functionBindNative;
|
|
5803
6028
|
|
|
5804
|
-
var bind$4 = uncurryThis$
|
|
6029
|
+
var bind$4 = uncurryThis$2(uncurryThis$2.bind);
|
|
5805
6030
|
|
|
5806
6031
|
// optional / simple context binding
|
|
5807
6032
|
var functionBindContext = function (fn, that) {
|
|
@@ -5952,13 +6177,13 @@ var createProperty$1 = function (object, key, value) {
|
|
|
5952
6177
|
else object[key] = value;
|
|
5953
6178
|
};
|
|
5954
6179
|
|
|
5955
|
-
var $$
|
|
6180
|
+
var $$8 = _export;
|
|
5956
6181
|
var iterate$2 = iterate$3;
|
|
5957
6182
|
var createProperty = createProperty$1;
|
|
5958
6183
|
|
|
5959
6184
|
// `Object.fromEntries` method
|
|
5960
6185
|
// https://github.com/tc39/proposal-object-from-entries
|
|
5961
|
-
$$
|
|
6186
|
+
$$8({ target: 'Object', stat: true }, {
|
|
5962
6187
|
fromEntries: function fromEntries(iterable) {
|
|
5963
6188
|
var obj = {};
|
|
5964
6189
|
iterate$2(iterable, function (k, v) {
|
|
@@ -7276,16 +7501,16 @@ const AddressInputs = ({
|
|
|
7276
7501
|
});
|
|
7277
7502
|
};
|
|
7278
7503
|
|
|
7279
|
-
var $$
|
|
7280
|
-
var uncurryThis$
|
|
7504
|
+
var $$7 = _export;
|
|
7505
|
+
var uncurryThis$1 = functionUncurryThisClause;
|
|
7281
7506
|
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
7282
7507
|
var toLength = toLength$4;
|
|
7283
|
-
var toString
|
|
7508
|
+
var toString = toString$d;
|
|
7284
7509
|
var notARegExp = notARegexp;
|
|
7285
|
-
var requireObjectCoercible
|
|
7510
|
+
var requireObjectCoercible = requireObjectCoercible$a;
|
|
7286
7511
|
var correctIsRegExpLogic = correctIsRegexpLogic;
|
|
7287
7512
|
|
|
7288
|
-
var slice = uncurryThis$
|
|
7513
|
+
var slice = uncurryThis$1(''.slice);
|
|
7289
7514
|
var min = Math.min;
|
|
7290
7515
|
|
|
7291
7516
|
var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith');
|
|
@@ -7297,81 +7522,18 @@ var MDN_POLYFILL_BUG = !CORRECT_IS_REGEXP_LOGIC && !!function () {
|
|
|
7297
7522
|
|
|
7298
7523
|
// `String.prototype.endsWith` method
|
|
7299
7524
|
// https://tc39.es/ecma262/#sec-string.prototype.endswith
|
|
7300
|
-
$$
|
|
7525
|
+
$$7({ target: 'String', proto: true, forced: !MDN_POLYFILL_BUG && !CORRECT_IS_REGEXP_LOGIC }, {
|
|
7301
7526
|
endsWith: function endsWith(searchString /* , endPosition = @length */) {
|
|
7302
|
-
var that = toString
|
|
7527
|
+
var that = toString(requireObjectCoercible(this));
|
|
7303
7528
|
notARegExp(searchString);
|
|
7304
7529
|
var endPosition = arguments.length > 1 ? arguments[1] : undefined;
|
|
7305
7530
|
var len = that.length;
|
|
7306
7531
|
var end = endPosition === undefined ? len : min(toLength(endPosition), len);
|
|
7307
|
-
var search = toString
|
|
7532
|
+
var search = toString(searchString);
|
|
7308
7533
|
return slice(that, end - search.length, end) === search;
|
|
7309
7534
|
}
|
|
7310
7535
|
});
|
|
7311
7536
|
|
|
7312
|
-
// a string of all valid unicode whitespaces
|
|
7313
|
-
var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' +
|
|
7314
|
-
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
7315
|
-
|
|
7316
|
-
var uncurryThis$1 = functionUncurryThis;
|
|
7317
|
-
var requireObjectCoercible = requireObjectCoercible$a;
|
|
7318
|
-
var toString = toString$d;
|
|
7319
|
-
var whitespaces$1 = whitespaces$2;
|
|
7320
|
-
|
|
7321
|
-
var replace = uncurryThis$1(''.replace);
|
|
7322
|
-
var ltrim = RegExp('^[' + whitespaces$1 + ']+');
|
|
7323
|
-
var rtrim = RegExp('(^|[^' + whitespaces$1 + '])[' + whitespaces$1 + ']+$');
|
|
7324
|
-
|
|
7325
|
-
// `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
|
|
7326
|
-
var createMethod$1 = function (TYPE) {
|
|
7327
|
-
return function ($this) {
|
|
7328
|
-
var string = toString(requireObjectCoercible($this));
|
|
7329
|
-
if (TYPE & 1) string = replace(string, ltrim, '');
|
|
7330
|
-
if (TYPE & 2) string = replace(string, rtrim, '$1');
|
|
7331
|
-
return string;
|
|
7332
|
-
};
|
|
7333
|
-
};
|
|
7334
|
-
|
|
7335
|
-
var stringTrim = {
|
|
7336
|
-
// `String.prototype.{ trimLeft, trimStart }` methods
|
|
7337
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trimstart
|
|
7338
|
-
start: createMethod$1(1),
|
|
7339
|
-
// `String.prototype.{ trimRight, trimEnd }` methods
|
|
7340
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trimend
|
|
7341
|
-
end: createMethod$1(2),
|
|
7342
|
-
// `String.prototype.trim` method
|
|
7343
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
7344
|
-
trim: createMethod$1(3)
|
|
7345
|
-
};
|
|
7346
|
-
|
|
7347
|
-
var PROPER_FUNCTION_NAME = functionName.PROPER;
|
|
7348
|
-
var fails$3 = fails$r;
|
|
7349
|
-
var whitespaces = whitespaces$2;
|
|
7350
|
-
|
|
7351
|
-
var non = '\u200B\u0085\u180E';
|
|
7352
|
-
|
|
7353
|
-
// check that a method works with the correct list
|
|
7354
|
-
// of whitespaces and has a correct name
|
|
7355
|
-
var stringTrimForced = function (METHOD_NAME) {
|
|
7356
|
-
return fails$3(function () {
|
|
7357
|
-
return !!whitespaces[METHOD_NAME]()
|
|
7358
|
-
|| non[METHOD_NAME]() !== non
|
|
7359
|
-
|| (PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME);
|
|
7360
|
-
});
|
|
7361
|
-
};
|
|
7362
|
-
|
|
7363
|
-
var $$7 = _export;
|
|
7364
|
-
var $trim = stringTrim.trim;
|
|
7365
|
-
var forcedStringTrimMethod = stringTrimForced;
|
|
7366
|
-
|
|
7367
|
-
// `String.prototype.trim` method
|
|
7368
|
-
// https://tc39.es/ecma262/#sec-string.prototype.trim
|
|
7369
|
-
$$7({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
7370
|
-
trim: function trim() {
|
|
7371
|
-
return $trim(this);
|
|
7372
|
-
}
|
|
7373
|
-
});
|
|
7374
|
-
|
|
7375
7537
|
const fetchAddressSuggestions = (formUrl, searchTerm, isAlbertaAddress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7376
7538
|
const params = {
|
|
7377
7539
|
country: 'CAN',
|
|
@@ -7765,29 +7927,37 @@ const AddressLookUpControl = props => {
|
|
|
7765
7927
|
});
|
|
7766
7928
|
};
|
|
7767
7929
|
|
|
7768
|
-
const
|
|
7930
|
+
const isPropertiesMatch = (obj, props, isExactMatch) => {
|
|
7769
7931
|
if (isObject$e(obj)) {
|
|
7770
7932
|
const keys = Object.keys(obj);
|
|
7771
|
-
|
|
7933
|
+
if (isExactMatch) {
|
|
7934
|
+
return props.every(attr => keys.includes(attr)) && keys.length === props.length;
|
|
7935
|
+
} else {
|
|
7936
|
+
return props.every(attr => keys.includes(attr));
|
|
7937
|
+
}
|
|
7772
7938
|
}
|
|
7773
7939
|
return false;
|
|
7774
7940
|
};
|
|
7775
|
-
const
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7941
|
+
const createSchemaMatchTester = (props, isExactMatch = false) => {
|
|
7942
|
+
return (uischema, schema, context) => {
|
|
7943
|
+
if (!isControl(uischema) || !isScoped(uischema)) {
|
|
7944
|
+
return false;
|
|
7945
|
+
}
|
|
7946
|
+
if ((schema === null || schema === void 0 ? void 0 : schema.properties) && isObject$e(schema === null || schema === void 0 ? void 0 : schema.properties)) {
|
|
7947
|
+
const propertyFromScope = uischema['scope'].split('/').pop();
|
|
7948
|
+
if (isObject$e(schema.properties[propertyFromScope]) && 'properties' in schema.properties[propertyFromScope]) {
|
|
7949
|
+
const objToTest = schema.properties[propertyFromScope]['properties'];
|
|
7950
|
+
if (objToTest && isPropertiesMatch(objToTest, props, isExactMatch)) {
|
|
7951
|
+
return true;
|
|
7952
|
+
}
|
|
7785
7953
|
}
|
|
7786
7954
|
}
|
|
7787
|
-
|
|
7788
|
-
|
|
7955
|
+
return false;
|
|
7956
|
+
};
|
|
7789
7957
|
};
|
|
7790
|
-
|
|
7958
|
+
|
|
7959
|
+
const isAddressLookup = createSchemaMatchTester(['addressLine2', 'municipality', 'addressLine1', 'subdivisionCode', 'postalCode']);
|
|
7960
|
+
const AddressLookUpTester = rankWith(4, isAddressLookup);
|
|
7791
7961
|
|
|
7792
7962
|
const GoATextCell = props => jsx(GoAInputText, Object.assign({}, props));
|
|
7793
7963
|
const GoATextCellTester = rankWith(1, isStringControl);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.37.0",
|
|
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",
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export interface Item {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DropdownProps {
|
|
6
|
+
items: Array<Item>;
|
|
7
|
+
label: string;
|
|
8
|
+
selected: string;
|
|
9
|
+
optionListMaxHeight?: string;
|
|
10
|
+
onChange: (value: string) => void;
|
|
11
|
+
isAutocompletion?: boolean;
|
|
12
|
+
id?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface GoADropdownTextboxProps {
|
|
15
|
+
isOpen: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface GoADropdownListContainerWrapperProps {
|
|
18
|
+
isOpen: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface GoADropdownListContainerProps {
|
|
21
|
+
optionListMaxHeight?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface GoADropdownListOptionProps {
|
|
24
|
+
isSelected: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface GoAInputDropDownProps {
|
|
27
|
+
isAutoCompletion: boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const ENTER_KEY = "Enter";
|
|
30
|
+
export declare const ESCAPE_KEY = "Escape";
|
|
31
|
+
export declare const ARROW_DOWN_KEY = "ArrowDown";
|
|
32
|
+
export declare const ARROW_UP_KEY = "ArrowUp";
|
|
33
|
+
export declare const TAB_KEY = "Tab";
|
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
label: string;
|
|
3
|
-
value: string;
|
|
4
|
-
}
|
|
5
|
-
interface DropdownProps {
|
|
6
|
-
items: Array<Item>;
|
|
7
|
-
label: string;
|
|
8
|
-
selected: string;
|
|
9
|
-
optionListMaxHeight?: string;
|
|
10
|
-
onChange: (value: string) => void;
|
|
11
|
-
isAutocompletion?: boolean;
|
|
12
|
-
id?: string;
|
|
13
|
-
}
|
|
1
|
+
import { DropdownProps } from './DropDownTypes';
|
|
14
2
|
export declare const Dropdown: (props: DropdownProps) => JSX.Element;
|
|
15
|
-
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { GoADropdownListContainerProps, GoADropdownListContainerWrapperProps, GoADropdownListOptionProps, GoADropdownTextboxProps } from './DropDownTypes';
|
|
2
|
+
export declare const GoADropdownTextbox: import("styled-components").StyledComponent<"div", any, GoADropdownTextboxProps, never>;
|
|
3
|
+
export declare const GoADropdownListContainerWrapper: import("styled-components").StyledComponent<"div", any, GoADropdownListContainerWrapperProps, never>;
|
|
4
|
+
export declare const GoADropdownListContainer: import("styled-components").StyledComponent<"div", any, GoADropdownListContainerProps, never>;
|
|
5
|
+
export declare const GoADropdownListOption: import("styled-components").StyledComponent<"div", any, GoADropdownListOptionProps, never>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { RankedTester
|
|
2
|
-
export declare const isAddressLookup: (
|
|
1
|
+
import { RankedTester } from '@jsonforms/core';
|
|
2
|
+
export declare const isAddressLookup: import("@jsonforms/core").Tester;
|
|
3
3
|
export declare const AddressLookUpTester: RankedTester;
|