ng-hub-ui-forms 22.37.0 → 22.38.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.
|
@@ -11800,6 +11800,25 @@ function hubMinFiles(min) {
|
|
|
11800
11800
|
function markEmbedded(element) {
|
|
11801
11801
|
element.style.setProperty('--hub-field-stack-gap', '0');
|
|
11802
11802
|
}
|
|
11803
|
+
/**
|
|
11804
|
+
* Names the control, out of whichever of the two the host supplied.
|
|
11805
|
+
*
|
|
11806
|
+
* A control built into somebody else's chrome — a table's toolbar, a paginator's row — has no room
|
|
11807
|
+
* for a label and, until now, got no name either: both `label` and `ariaLabel` were ignored here, so
|
|
11808
|
+
* the field rendered nameless whatever the host asked for. `visually-hidden` is the default because
|
|
11809
|
+
* that is the case this adapter exists for; a host that wants the label drawn says so.
|
|
11810
|
+
*
|
|
11811
|
+
* @param ref - The created control's component reference.
|
|
11812
|
+
* @param config - What the host asked for.
|
|
11813
|
+
*/
|
|
11814
|
+
function applyName(ref, config) {
|
|
11815
|
+
const text = config.label ?? config.ariaLabel;
|
|
11816
|
+
if (!text) {
|
|
11817
|
+
return;
|
|
11818
|
+
}
|
|
11819
|
+
ref.setInput('label', text);
|
|
11820
|
+
ref.setInput('labelType', config.labelType ?? 'visually-hidden');
|
|
11821
|
+
}
|
|
11803
11822
|
/**
|
|
11804
11823
|
* Ready-made {@link HubFormControlAdapter} backed by `HubInputComponent` /
|
|
11805
11824
|
* `HubSelectComponent`.
|
|
@@ -11817,6 +11836,7 @@ const hubFormControlAdapter = {
|
|
|
11817
11836
|
if (config.kind === 'select') {
|
|
11818
11837
|
const ref = container.createComponent(HubSelectComponent);
|
|
11819
11838
|
markEmbedded(ref.location.nativeElement);
|
|
11839
|
+
applyName(ref, config);
|
|
11820
11840
|
ref.setInput('items', (config.options ?? []).map((option) => ({ ...option })));
|
|
11821
11841
|
ref.setInput('bindLabel', 'label');
|
|
11822
11842
|
ref.setInput('bindValue', 'value');
|
|
@@ -11841,6 +11861,7 @@ const hubFormControlAdapter = {
|
|
|
11841
11861
|
}
|
|
11842
11862
|
const ref = container.createComponent(HubInputComponent);
|
|
11843
11863
|
markEmbedded(ref.location.nativeElement);
|
|
11864
|
+
applyName(ref, config);
|
|
11844
11865
|
ref.setInput('type', config.type ?? 'text');
|
|
11845
11866
|
if (config.placeholder) {
|
|
11846
11867
|
ref.setInput('placeholder', config.placeholder);
|