@oliasoft-open-source/react-ui-library 4.15.1-beta-9 → 4.15.1-beta-10
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/dist/index.js +34 -14
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -20886,6 +20886,7 @@ const Trigger = ({
|
|
|
20886
20886
|
maxTooltipWidth,
|
|
20887
20887
|
placeholder: placeholder3,
|
|
20888
20888
|
right: right2,
|
|
20889
|
+
isMounted,
|
|
20889
20890
|
testId
|
|
20890
20891
|
}) => {
|
|
20891
20892
|
var _a2;
|
|
@@ -20932,7 +20933,9 @@ const Trigger = ({
|
|
|
20932
20933
|
onClickTrigger(evt);
|
|
20933
20934
|
if (typeof setInputFocus === "function") {
|
|
20934
20935
|
requestAnimationFrame(() => {
|
|
20935
|
-
|
|
20936
|
+
if (isMounted == null ? void 0 : isMounted.current) {
|
|
20937
|
+
setInputFocus();
|
|
20938
|
+
}
|
|
20936
20939
|
});
|
|
20937
20940
|
}
|
|
20938
20941
|
},
|
|
@@ -21188,21 +21191,27 @@ const useCustomSelectLogic = ({
|
|
|
21188
21191
|
firstSelectedOptionIndex,
|
|
21189
21192
|
createAble,
|
|
21190
21193
|
listRef,
|
|
21191
|
-
autoLayerWidth
|
|
21194
|
+
autoLayerWidth,
|
|
21195
|
+
isMounted
|
|
21192
21196
|
}) => {
|
|
21197
|
+
const safeDispatch = (action2) => {
|
|
21198
|
+
if (isMounted.current) {
|
|
21199
|
+
dispatch(action2);
|
|
21200
|
+
}
|
|
21201
|
+
};
|
|
21193
21202
|
const closeLayer = () => {
|
|
21194
21203
|
if (state.isLayerOpen) {
|
|
21195
|
-
|
|
21204
|
+
safeDispatch({ type: ActionTypes.CLOSE_LAYER });
|
|
21196
21205
|
}
|
|
21197
21206
|
setTriggerFocus();
|
|
21198
21207
|
};
|
|
21199
|
-
const openLayer = () =>
|
|
21208
|
+
const openLayer = () => safeDispatch({ type: ActionTypes.OPEN_LAYER });
|
|
21200
21209
|
const isFirstRun = useRef(true);
|
|
21201
21210
|
useEffect(() => {
|
|
21202
21211
|
if (isFirstRun.current) {
|
|
21203
21212
|
isFirstRun.current = false;
|
|
21204
21213
|
} else {
|
|
21205
|
-
|
|
21214
|
+
safeDispatch({ type: ActionTypes.SET_VISIBLE_OPTIONS, options });
|
|
21206
21215
|
}
|
|
21207
21216
|
}, [options]);
|
|
21208
21217
|
const onSelectOption = (evt, option2, close2) => {
|
|
@@ -21240,7 +21249,7 @@ const useCustomSelectLogic = ({
|
|
|
21240
21249
|
}
|
|
21241
21250
|
}
|
|
21242
21251
|
}
|
|
21243
|
-
|
|
21252
|
+
safeDispatch({ type: ActionTypes.CLEAR_SEARCH, options });
|
|
21244
21253
|
setTriggerFocus();
|
|
21245
21254
|
}
|
|
21246
21255
|
};
|
|
@@ -21276,7 +21285,7 @@ const useCustomSelectLogic = ({
|
|
|
21276
21285
|
closeLayer();
|
|
21277
21286
|
return;
|
|
21278
21287
|
}
|
|
21279
|
-
|
|
21288
|
+
safeDispatch({
|
|
21280
21289
|
type: ActionTypes.RESET_LAYER_FOCUS,
|
|
21281
21290
|
options,
|
|
21282
21291
|
firstSelectedOptionIndex
|
|
@@ -21289,7 +21298,7 @@ const useCustomSelectLogic = ({
|
|
|
21289
21298
|
isFirstRender.current = false;
|
|
21290
21299
|
} else {
|
|
21291
21300
|
if (!state.isLayerOpen) {
|
|
21292
|
-
|
|
21301
|
+
safeDispatch({ type: ActionTypes.CLEAR_SEARCH, options });
|
|
21293
21302
|
}
|
|
21294
21303
|
}
|
|
21295
21304
|
}, [state.isLayerOpen]);
|
|
@@ -21305,7 +21314,7 @@ const useCustomSelectLogic = ({
|
|
|
21305
21314
|
onChange(evt, newSelectedOptions);
|
|
21306
21315
|
}
|
|
21307
21316
|
};
|
|
21308
|
-
const onChangeSearch = (value) =>
|
|
21317
|
+
const onChangeSearch = (value) => safeDispatch({
|
|
21309
21318
|
type: ActionTypes.ON_CHANGE_SEARCH,
|
|
21310
21319
|
options,
|
|
21311
21320
|
value,
|
|
@@ -21313,7 +21322,7 @@ const useCustomSelectLogic = ({
|
|
|
21313
21322
|
});
|
|
21314
21323
|
const clickTrigger = () => {
|
|
21315
21324
|
openLayer();
|
|
21316
|
-
|
|
21325
|
+
safeDispatch({ type: ActionTypes.BLUR_TRIGGER_INPUTS });
|
|
21317
21326
|
};
|
|
21318
21327
|
const scrollToItem = (index2) => {
|
|
21319
21328
|
if (listRef.current && Number.isInteger(index2)) {
|
|
@@ -21322,11 +21331,14 @@ const useCustomSelectLogic = ({
|
|
|
21322
21331
|
};
|
|
21323
21332
|
const focusNextLayerOption = (ICustomSelectDirection2) => {
|
|
21324
21333
|
const next2 = nextLayerFocus(ICustomSelectDirection2, state.layerFocus);
|
|
21325
|
-
|
|
21334
|
+
safeDispatch({
|
|
21335
|
+
type: ActionTypes.FOCUS_LAYER_OPTIONS,
|
|
21336
|
+
nextLayerFocus: next2
|
|
21337
|
+
});
|
|
21326
21338
|
scrollToItem(next2.current);
|
|
21327
21339
|
};
|
|
21328
21340
|
const focusTriggerInputs = (ICustomSelectDirection2) => {
|
|
21329
|
-
|
|
21341
|
+
safeDispatch({
|
|
21330
21342
|
type: ActionTypes.FOCUS_TRIGGER_INPUTS,
|
|
21331
21343
|
ICustomSelectDirection: ICustomSelectDirection2,
|
|
21332
21344
|
selectedOptions
|
|
@@ -21447,6 +21459,12 @@ const CustomSelect = (props) => {
|
|
|
21447
21459
|
isLayerOpen: false
|
|
21448
21460
|
})
|
|
21449
21461
|
);
|
|
21462
|
+
const isMounted = useRef(true);
|
|
21463
|
+
useEffect(() => {
|
|
21464
|
+
return () => {
|
|
21465
|
+
isMounted.current = false;
|
|
21466
|
+
};
|
|
21467
|
+
}, []);
|
|
21450
21468
|
const {
|
|
21451
21469
|
getTriggerWidth,
|
|
21452
21470
|
onKeyEvent,
|
|
@@ -21470,7 +21488,8 @@ const CustomSelect = (props) => {
|
|
|
21470
21488
|
disabledContext,
|
|
21471
21489
|
isFontLoaded,
|
|
21472
21490
|
createAble,
|
|
21473
|
-
listRef
|
|
21491
|
+
listRef,
|
|
21492
|
+
isMounted
|
|
21474
21493
|
});
|
|
21475
21494
|
return /* @__PURE__ */ jsx("div", { style: { width: getTriggerWidth() }, children: /* @__PURE__ */ jsxs(
|
|
21476
21495
|
KeyboardEventHandler,
|
|
@@ -21506,7 +21525,8 @@ const CustomSelect = (props) => {
|
|
|
21506
21525
|
maxTooltipWidth,
|
|
21507
21526
|
placeholder: placeholder3,
|
|
21508
21527
|
right: right2,
|
|
21509
|
-
testId
|
|
21528
|
+
testId,
|
|
21529
|
+
isMounted
|
|
21510
21530
|
}
|
|
21511
21531
|
),
|
|
21512
21532
|
state.isLayerOpen && renderLayer(
|