@db-ux/react-core-components 3.1.4 → 3.1.15
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.
|
@@ -156,13 +156,18 @@ function DBCustomSelectFn(props, component) {
|
|
|
156
156
|
}
|
|
157
157
|
return false;
|
|
158
158
|
}
|
|
159
|
-
function getTagRemoveLabel(
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
function getTagRemoveLabel(option) {
|
|
160
|
+
const removeTexts = props.removeTagsTexts;
|
|
161
|
+
const options = props.options;
|
|
162
|
+
if (removeTexts && options) {
|
|
163
|
+
// Find the index of the option in the original options array
|
|
164
|
+
const optionIndex = options.findIndex((opt) => opt.value === option.value);
|
|
165
|
+
if (optionIndex >= 0 && optionIndex < removeTexts.length) {
|
|
166
|
+
return removeTexts[optionIndex];
|
|
167
|
+
}
|
|
165
168
|
}
|
|
169
|
+
// Fallback to default behavior
|
|
170
|
+
return `${DEFAULT_REMOVE} ${getOptionLabel(option)}`;
|
|
166
171
|
}
|
|
167
172
|
function handleTagRemove(option, event) {
|
|
168
173
|
if (event) {
|
|
@@ -510,11 +515,14 @@ function DBCustomSelectFn(props, component) {
|
|
|
510
515
|
setSearchEnabled((_a = props.showSearch) !== null && _a !== void 0 ? _a : amountOptions > 9);
|
|
511
516
|
}, [props.showSearch, amountOptions]);
|
|
512
517
|
useEffect(() => {
|
|
513
|
-
|
|
514
|
-
if (
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
+
const v = props.values;
|
|
519
|
+
if (Array.isArray(v)) {
|
|
520
|
+
if (_values !== v) {
|
|
521
|
+
set_values(v);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
else if (v == null && (_values === null || _values === void 0 ? void 0 : _values.length) !== 0) {
|
|
525
|
+
set_values([]);
|
|
518
526
|
}
|
|
519
527
|
}, [props.values]);
|
|
520
528
|
useEffect(() => {
|
|
@@ -622,7 +630,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
622
630
|
props.options ? (React.createElement(React.Fragment, null,
|
|
623
631
|
React.createElement("summary", { className: "db-custom-select-form-field", id: _summaryId, "aria-disabled": getBooleanAsString(props.disabled), "aria-labelledby": _labelId },
|
|
624
632
|
(_selectedLabels === null || _selectedLabels === void 0 ? void 0 : _selectedLabels.length) ? (React.createElement("span", { "data-visually-hidden": getBooleanAsString(props.selectedType === "tag"), id: _selectedLabelsId }, _selectedLabels)) : null,
|
|
625
|
-
props.selectedType === "tag" ? (React.createElement("div", null, _selectedOptions === null || _selectedOptions === void 0 ? void 0 : _selectedOptions.map((option, index) => (React.createElement(DBTag, { emphasis: "strong", behavior: "removable", removeButton: getTagRemoveLabel(
|
|
633
|
+
props.selectedType === "tag" ? (React.createElement("div", null, _selectedOptions === null || _selectedOptions === void 0 ? void 0 : _selectedOptions.map((option, index) => (React.createElement(DBTag, { emphasis: "strong", behavior: "removable", removeButton: getTagRemoveLabel(option), onRemove: (event) => handleTagRemove(option, event), key: getOptionKey(option, "tag-") }, getOptionLabel(option)))))) : null),
|
|
626
634
|
React.createElement(DBCustomSelectDropdown, { width: props.dropdownWidth },
|
|
627
635
|
searchEnabled ? (React.createElement("div", null,
|
|
628
636
|
React.createElement(DBInput, { type: "search", ref: searchInputRef, name: _id, form: _id, showLabel: false, value: _searchValue, label: (_d = props.searchLabel) !== null && _d !== void 0 ? _d : DEFAULT_LABEL, placeholder: (_e = props.searchPlaceholder) !== null && _e !== void 0 ? _e : props.searchLabel, ariaDescribedBy: _hasNoOptions || props.showLoading
|
|
@@ -643,7 +651,7 @@ function DBCustomSelectFn(props, component) {
|
|
|
643
651
|
((_k = props.showClearSelection) !== null && _k !== void 0 ? _k : true) && (_values === null || _values === void 0 ? void 0 : _values.length) ? (React.createElement(DBButton, { icon: "cross", variant: "ghost", size: "small", noText: true, name: _id, form: _id, onClick: (event) => handleClearAll(event) },
|
|
644
652
|
props.clearSelectionText,
|
|
645
653
|
React.createElement(DBTooltip, { placement: "top" }, props.clearSelectionText))) : null,
|
|
646
|
-
React.createElement("span", { "aria-hidden": getBooleanAsString(true), id: _placeholderId }, (_l = props.placeholder) !== null && _l !== void 0 ? _l : props.label),
|
|
654
|
+
React.createElement("span", { className: "db-custom-select-placeholder", "aria-hidden": getBooleanAsString(true), id: _placeholderId }, (_l = props.placeholder) !== null && _l !== void 0 ? _l : props.label),
|
|
647
655
|
stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
|
|
648
656
|
hasValidState() ? (React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, props.validMessage || DEFAULT_VALID_MESSAGE)) : null,
|
|
649
657
|
React.createElement(DBInfotext, { size: "small", semantic: "critical", id: _invalidMessageId }, _invalidMessage),
|
|
@@ -194,7 +194,7 @@ export type DBCustomSelectDefaultState = {
|
|
|
194
194
|
getNativeSelectValue: () => string;
|
|
195
195
|
getOptionLabel: (option: CustomSelectOptionType) => string;
|
|
196
196
|
getOptionChecked: (value?: string) => boolean;
|
|
197
|
-
getTagRemoveLabel: (
|
|
197
|
+
getTagRemoveLabel: (option: CustomSelectOptionType) => string;
|
|
198
198
|
selectAllEnabled: boolean;
|
|
199
199
|
searchEnabled: boolean;
|
|
200
200
|
amountOptions: number;
|
|
@@ -134,7 +134,7 @@ function DBSelectFn(props, component) {
|
|
|
134
134
|
var _a;
|
|
135
135
|
return option.options ? (React.createElement("optgroup", { label: getOptionLabel(option), key: getOptionKey(option, "select-optgroup-") }, (_a = option.options) === null || _a === void 0 ? void 0 : _a.map((optgroupOption) => (React.createElement("option", { value: optgroupOption.value, disabled: optgroupOption.disabled, key: getOptionKey(optgroupOption, "select-optgroup-option-") }, getOptionLabel(optgroupOption)))))) : (React.createElement("option", { value: option.value, disabled: option.disabled, key: getOptionKey(option, "select-option-") }, getOptionLabel(option)));
|
|
136
136
|
}))) : (React.createElement(React.Fragment, null, props.children))),
|
|
137
|
-
props.placeholder ? (React.createElement("span", { id: _placeholderId }, props.placeholder)) : null,
|
|
137
|
+
props.placeholder ? (React.createElement("span", { className: "db-select-placeholder", id: _placeholderId }, props.placeholder)) : null,
|
|
138
138
|
stringPropVisible(props.message, props.showMessage) ? (React.createElement(DBInfotext, { size: "small", icon: props.messageIcon, id: _messageId }, props.message)) : null,
|
|
139
139
|
hasValidState() ? (React.createElement(DBInfotext, { size: "small", semantic: "successful", id: _validMessageId }, props.validMessage || DEFAULT_VALID_MESSAGE)) : null,
|
|
140
140
|
React.createElement(DBInfotext, { size: "small", semantic: "critical", id: _invalidMessageId }, _invalidMessage),
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
export const handleFrameworkEventAngular = (component, event, modelValue = 'value') => {
|
|
3
|
-
// Change event to work with reactive and template driven forms
|
|
4
3
|
component.propagateChange(event.target[modelValue]);
|
|
5
|
-
component.writeValue(event.target[modelValue]);
|
|
6
4
|
};
|
|
7
5
|
export const handleFrameworkEventVue = (emit, event, modelValue = 'value') => {
|
|
8
6
|
// TODO: Replace this with the solution out of https://github.com/BuilderIO/mitosis/issues/833 after this has been "solved"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@db-ux/react-core-components",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.15",
|
|
4
4
|
"description": "React components for @db-ux/core-components",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"tsc": "tsc --project . --sourceMap false"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@playwright/experimental-ct-react": "1.55.
|
|
30
|
+
"@playwright/experimental-ct-react": "1.55.1",
|
|
31
31
|
"@types/react": "18.3.13",
|
|
32
32
|
"react": "18.3.1",
|
|
33
33
|
"react-dom": "18.3.1"
|
|
@@ -36,9 +36,5 @@
|
|
|
36
36
|
"registry": "https://registry.npmjs.org/",
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"sideEffects": false
|
|
40
|
-
"dependencies": {
|
|
41
|
-
"@db-ux/core-components": "3.1.4",
|
|
42
|
-
"@db-ux/core-foundations": "3.1.4"
|
|
43
|
-
}
|
|
39
|
+
"sideEffects": false
|
|
44
40
|
}
|