oolib 2.108.1 → 2.108.3
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export function OptionsSingle({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, genCreateTagButton, invert, popOutOfOverflowHiddenParent, enableUseSetYOrientation, S, observerRef }: {
|
|
1
|
+
export function OptionsSingle({ lightboxHeight, lightboxStyle, optionsAnchor, value, id, optionsClassName, relativeToRef, showOptions, handleHideOptions, handleSelect, options, isSearchable, label, optionsModalLabel, searchString, setSearchString, SelectComp, genCreateTagButton, invert, popOutOfOverflowHiddenParent, enableUseSetYOrientation, S, observerRef, }: {
|
|
2
2
|
lightboxHeight: any;
|
|
3
3
|
lightboxStyle: any;
|
|
4
4
|
optionsAnchor: any;
|
|
@@ -58,17 +58,14 @@ var OptionsSingle = function (_a) {
|
|
|
58
58
|
relativeToRef = _a.relativeToRef, //the element that this lightbox is being rendered against. i.e top or bottom
|
|
59
59
|
showOptions = _a.showOptions, handleHideOptions = _a.handleHideOptions, handleSelect = _a.handleSelect, options = _a.options, isSearchable = _a.isSearchable, label = _a.label, optionsModalLabel = _a.optionsModalLabel, //label is just a fallback for optionsModalLabel. Don't know why both are needed
|
|
60
60
|
searchString = _a.searchString, setSearchString = _a.setSearchString, SelectComp = _a.SelectComp, genCreateTagButton = _a.genCreateTagButton, invert = _a.invert, popOutOfOverflowHiddenParent = _a.popOutOfOverflowHiddenParent, _b = _a.enableUseSetYOrientation, enableUseSetYOrientation = _b === void 0 ? true : _b, // if using this component standalone, this should be set to false ( if relativeToRef is not being passed thru)
|
|
61
|
-
S = _a.S, observerRef = _a.observerRef
|
|
62
|
-
//disabled only with this is being used for the RTEEmbedLightbox. Also this might be temp.
|
|
63
|
-
//ensure this is set to false, if you are not passing a 'relativeToRef'
|
|
64
|
-
;
|
|
61
|
+
S = _a.S, observerRef = _a.observerRef;
|
|
65
62
|
//INIT ORIENTATION STATE AND CUSTOM HOOK
|
|
66
63
|
var optionsRef = (0, react_1.useRef)(null);
|
|
67
64
|
var yOrientation = (0, useSetYOrientation_1.useSetYOrientation)({
|
|
68
65
|
showOptions: showOptions,
|
|
69
66
|
optionsRef: optionsRef,
|
|
70
67
|
relativeToRef: relativeToRef,
|
|
71
|
-
enabled: enableUseSetYOrientation
|
|
68
|
+
enabled: enableUseSetYOrientation,
|
|
72
69
|
}).yOrientation;
|
|
73
70
|
var _c = (0, useKeyboardControl_1.useKeyboardControl)({
|
|
74
71
|
showOptions: showOptions,
|
|
@@ -83,7 +80,12 @@ var OptionsSingle = function (_a) {
|
|
|
83
80
|
(0, react_1.useEffect)(function () {
|
|
84
81
|
setSearchBarFocus(showOptions);
|
|
85
82
|
}, [showOptions]);
|
|
86
|
-
var genSearchBar = function () { return (react_1.default.createElement("div", { style: {
|
|
83
|
+
var genSearchBar = function () { return (react_1.default.createElement("div", { style: {
|
|
84
|
+
position: "sticky",
|
|
85
|
+
top: 0,
|
|
86
|
+
zIndex: 1,
|
|
87
|
+
background: invert ? themes_1.colors.greyColor90 : themes_1.colors.white,
|
|
88
|
+
} },
|
|
87
89
|
react_1.default.createElement("div", { style: { padding: "1rem" } },
|
|
88
90
|
react_1.default.createElement(TextInputs_1.TextInput, { invert: invert, forceFocus: searchBarFocus, type: "text", icon: "MagnifyingGlass", value: searchString, onChange: function (k, v) { return setSearchString(v); }, S: S })),
|
|
89
91
|
react_1.default.createElement(Divider_1.Divider, { invert: invert }))); };
|
|
@@ -102,19 +104,25 @@ var OptionsSingle = function (_a) {
|
|
|
102
104
|
invert: invert,
|
|
103
105
|
relativeToRef: relativeToRef,
|
|
104
106
|
popOutOfOverflowHiddenParent: popOutOfOverflowHiddenParent,
|
|
105
|
-
S: S
|
|
107
|
+
S: S,
|
|
106
108
|
}),
|
|
107
109
|
isSearchable && genSearchBar(),
|
|
108
|
-
options.length === 0 ?
|
|
109
|
-
|
|
110
|
-
:
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
110
|
+
options.length === 0 ? (react_1.default.createElement(NoOptionResultsComp_1.NoOptionResultsComp, { S: S })) : (react_1.default.createElement(VirtualizedWrapper_1.VirtualizedWrapper, { options: options, lightboxHeight: lightboxHeight, searchString: searchString }, function (option, index, style) {
|
|
111
|
+
console.log({ totOps: options.length, observerRef: observerRef, index: index, observerRefCond: options.length === index + 1 ? observerRef : null, });
|
|
112
|
+
return (react_1.default.createElement(styled_1.StyledOption, { key: option.value, invert: invert, isSelected: !option.loading && (value === null || value === void 0 ? void 0 : value.value) === option.value, isFocussed: focussedOp === index, className: "OKE-Dropdown__option", ref: function (el) {
|
|
113
|
+
return focussedOp === index && el && scrollFocussedOpIntoView(el);
|
|
114
|
+
}, onClick: function (e) {
|
|
115
|
+
if (!option.loading)
|
|
116
|
+
handleSelect(option);
|
|
117
|
+
setSearchString && setSearchString("");
|
|
118
|
+
}, S: S, style: style && style }, option.loading ? (react_1.default.createElement(TextLoader_1.TextLoader, { style: { width: "8rem", height: "1.5rem" } })) : (react_1.default.createElement(OptionContent_1.OptionContent, __assign({}, {
|
|
119
|
+
option: option,
|
|
120
|
+
optionsClassName: optionsClassName,
|
|
121
|
+
invert: invert,
|
|
122
|
+
S: S,
|
|
123
|
+
observerRef: options.length === index + 1 ? observerRef : null,
|
|
124
|
+
})))));
|
|
125
|
+
})),
|
|
118
126
|
genCreateTagButton && genCreateTagButton(options))));
|
|
119
127
|
};
|
|
120
128
|
exports.OptionsSingle = OptionsSingle;
|