@fctc/widget-logic 2.3.8 → 2.4.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/dist/hooks.d.mts +7 -3
- package/dist/hooks.d.ts +7 -3
- package/dist/hooks.js +87 -113
- package/dist/hooks.mjs +99 -134
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +254 -276
- package/dist/index.mjs +231 -275
- package/dist/utils.d.mts +1 -14
- package/dist/utils.d.ts +1 -14
- package/dist/utils.js +0 -95
- package/dist/utils.mjs +1 -116
- package/dist/widget.d.mts +15 -28
- package/dist/widget.d.ts +15 -28
- package/dist/widget.js +244 -270
- package/dist/widget.mjs +222 -271
- package/package.json +96 -96
package/dist/hooks.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { RefObject } from 'react';
|
|
4
|
+
import react__default, { RefObject } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
export * from '@fctc/interface-logic/hooks';
|
|
7
7
|
|
|
@@ -927,7 +927,6 @@ declare const useCompany: (accessToken: string | null) => {
|
|
|
927
927
|
allowed_company_ids: (number | undefined)[];
|
|
928
928
|
};
|
|
929
929
|
};
|
|
930
|
-
|
|
931
930
|
interface CompanyTuple extends Array<number | string> {
|
|
932
931
|
0: number;
|
|
933
932
|
1: string;
|
|
@@ -966,6 +965,11 @@ declare const useMenuItem: (props: any) => {
|
|
|
966
965
|
queryActionDetail: TActionDetailType;
|
|
967
966
|
};
|
|
968
967
|
|
|
968
|
+
declare const useGetRowIds: (tableRef: react__default.RefObject<HTMLTableElement | null>) => {
|
|
969
|
+
rowIds: string[];
|
|
970
|
+
refresh: () => void;
|
|
971
|
+
};
|
|
972
|
+
|
|
969
973
|
declare const DEFAULT_EVENTS: readonly ["mousedown", "touchstart"];
|
|
970
974
|
type EventType = (typeof DEFAULT_EVENTS)[number];
|
|
971
975
|
interface UseClickOutsideOptions {
|
|
@@ -978,4 +982,4 @@ declare const useClickOutside: ({ handler, events, nodes, refs, }: UseClickOutsi
|
|
|
978
982
|
|
|
979
983
|
declare function useDebounce<T>(value: T, delay: number): [T];
|
|
980
984
|
|
|
981
|
-
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useListData, type useListDataType, useMenu, useMenuItem, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
|
985
|
+
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useGetRowIds, useListData, type useListDataType, useMenu, useMenuItem, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
package/dist/hooks.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
2
|
import * as _tanstack_query_core from '@tanstack/query-core';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { RefObject } from 'react';
|
|
4
|
+
import react__default, { RefObject } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
6
6
|
export * from '@fctc/interface-logic/hooks';
|
|
7
7
|
|
|
@@ -927,7 +927,6 @@ declare const useCompany: (accessToken: string | null) => {
|
|
|
927
927
|
allowed_company_ids: (number | undefined)[];
|
|
928
928
|
};
|
|
929
929
|
};
|
|
930
|
-
|
|
931
930
|
interface CompanyTuple extends Array<number | string> {
|
|
932
931
|
0: number;
|
|
933
932
|
1: string;
|
|
@@ -966,6 +965,11 @@ declare const useMenuItem: (props: any) => {
|
|
|
966
965
|
queryActionDetail: TActionDetailType;
|
|
967
966
|
};
|
|
968
967
|
|
|
968
|
+
declare const useGetRowIds: (tableRef: react__default.RefObject<HTMLTableElement | null>) => {
|
|
969
|
+
rowIds: string[];
|
|
970
|
+
refresh: () => void;
|
|
971
|
+
};
|
|
972
|
+
|
|
969
973
|
declare const DEFAULT_EVENTS: readonly ["mousedown", "touchstart"];
|
|
970
974
|
type EventType = (typeof DEFAULT_EVENTS)[number];
|
|
971
975
|
interface UseClickOutsideOptions {
|
|
@@ -978,4 +982,4 @@ declare const useClickOutside: ({ handler, events, nodes, refs, }: UseClickOutsi
|
|
|
978
982
|
|
|
979
983
|
declare function useDebounce<T>(value: T, delay: number): [T];
|
|
980
984
|
|
|
981
|
-
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useListData, type useListDataType, useMenu, useMenuItem, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
|
985
|
+
export { type ActionResultType, AppProvider, type ContextProfile, type Record, type ViewResponse, useAppProvider, useAuth, type useAuthType, useCallAction, type useCallActionType, useClickOutside, useConfig, type useConfigType, useDebounce, useDetail, useGetRowIds, useListData, type useListDataType, useMenu, useMenuItem, type useMenuType, useProfile, useUser, type useUserType, useViewV2, type useViewV2Type };
|
package/dist/hooks.js
CHANGED
|
@@ -29,6 +29,7 @@ __export(hooks_exports, {
|
|
|
29
29
|
useConfig: () => useConfig,
|
|
30
30
|
useDebounce: () => useDebounce,
|
|
31
31
|
useDetail: () => useDetail,
|
|
32
|
+
useGetRowIds: () => useGetRowIds,
|
|
32
33
|
useListData: () => useListData,
|
|
33
34
|
useMenu: () => useMenu,
|
|
34
35
|
useMenuItem: () => useMenuItem,
|
|
@@ -157,12 +158,6 @@ var import_react5 = require("react");
|
|
|
157
158
|
|
|
158
159
|
// src/utils/function.ts
|
|
159
160
|
var import_react4 = require("react");
|
|
160
|
-
|
|
161
|
-
// src/store.ts
|
|
162
|
-
var store_exports = {};
|
|
163
|
-
__reExport(store_exports, require("@fctc/interface-logic/store"));
|
|
164
|
-
|
|
165
|
-
// src/utils/function.ts
|
|
166
161
|
var countSum = (data, field) => {
|
|
167
162
|
if (!data || !field) return 0;
|
|
168
163
|
return data.reduce(
|
|
@@ -181,91 +176,6 @@ function mergeButtons(fields) {
|
|
|
181
176
|
}
|
|
182
177
|
return others;
|
|
183
178
|
}
|
|
184
|
-
function isElementVisible(el) {
|
|
185
|
-
const style = window.getComputedStyle(el);
|
|
186
|
-
return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
|
|
187
|
-
}
|
|
188
|
-
function arraysAreEqual(a, b) {
|
|
189
|
-
if (a.length !== b.length) return false;
|
|
190
|
-
const setA = new Set(a);
|
|
191
|
-
const setB = new Set(b);
|
|
192
|
-
if (setA.size !== setB.size) return false;
|
|
193
|
-
for (const val of setA) {
|
|
194
|
-
if (!setB.has(val)) return false;
|
|
195
|
-
}
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
function useGetRowIds(tableRef) {
|
|
199
|
-
const [rowIds, setRowIds] = (0, import_react4.useState)([]);
|
|
200
|
-
const lastRowIdsRef = (0, import_react4.useRef)([]);
|
|
201
|
-
const updateVisibleRowIds = (0, import_react4.useCallback)(() => {
|
|
202
|
-
const table = tableRef?.current;
|
|
203
|
-
if (!table) return;
|
|
204
|
-
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
205
|
-
const ids = [];
|
|
206
|
-
rows.forEach((row) => {
|
|
207
|
-
const el = row;
|
|
208
|
-
if (isElementVisible(el)) {
|
|
209
|
-
const id = el.getAttribute("data-row-id");
|
|
210
|
-
if (id) ids.push(id);
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
const uniqueIds = Array.from(new Set(ids));
|
|
214
|
-
if (!arraysAreEqual(lastRowIdsRef.current, uniqueIds)) {
|
|
215
|
-
lastRowIdsRef.current = uniqueIds;
|
|
216
|
-
setRowIds(uniqueIds);
|
|
217
|
-
}
|
|
218
|
-
}, [tableRef]);
|
|
219
|
-
(0, import_react4.useEffect)(() => {
|
|
220
|
-
const table = tableRef?.current;
|
|
221
|
-
if (!table) return;
|
|
222
|
-
const observer = new MutationObserver(() => {
|
|
223
|
-
updateVisibleRowIds();
|
|
224
|
-
});
|
|
225
|
-
observer.observe(table, {
|
|
226
|
-
childList: true,
|
|
227
|
-
subtree: true,
|
|
228
|
-
attributes: true,
|
|
229
|
-
attributeFilter: ["style", "class"]
|
|
230
|
-
});
|
|
231
|
-
updateVisibleRowIds();
|
|
232
|
-
return () => {
|
|
233
|
-
observer.disconnect();
|
|
234
|
-
};
|
|
235
|
-
}, [updateVisibleRowIds, tableRef]);
|
|
236
|
-
return { rowIds, refresh: updateVisibleRowIds };
|
|
237
|
-
}
|
|
238
|
-
var useSelectionState = ({
|
|
239
|
-
typeTable,
|
|
240
|
-
tableRef,
|
|
241
|
-
rows
|
|
242
|
-
}) => {
|
|
243
|
-
const { groupByDomain } = (0, store_exports.useAppSelector)(store_exports.selectSearch);
|
|
244
|
-
const { selectedRowKeys } = (0, store_exports.useAppSelector)(store_exports.selectList);
|
|
245
|
-
const { rowIds: recordIds } = useGetRowIds(tableRef);
|
|
246
|
-
const selectedRowKeysRef = (0, import_react4.useRef)(recordIds);
|
|
247
|
-
const isGroupTable = typeTable === "group";
|
|
248
|
-
const recordsCheckedGroup = (0, import_react4.useMemo)(() => {
|
|
249
|
-
if (!rows || !groupByDomain) return 0;
|
|
250
|
-
const groupBy = typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0;
|
|
251
|
-
return countSum(rows, groupBy);
|
|
252
|
-
}, [rows, groupByDomain]);
|
|
253
|
-
const isAllGroupChecked = (0, import_react4.useMemo)(() => {
|
|
254
|
-
if (!isGroupTable || !selectedRowKeys?.length) return false;
|
|
255
|
-
const selectedLength = selectedRowKeys.filter((id) => id !== -1).length;
|
|
256
|
-
const allRecordsSelected = recordIds.length === selectedRowKeys.length ? recordIds.length === selectedLength : false;
|
|
257
|
-
const allGroupsSelected = recordsCheckedGroup === selectedRowKeys.length;
|
|
258
|
-
return allGroupsSelected || allRecordsSelected;
|
|
259
|
-
}, [isGroupTable, selectedRowKeys, recordIds, recordsCheckedGroup]);
|
|
260
|
-
const isAllNormalChecked = (0, import_react4.useMemo)(() => {
|
|
261
|
-
if (isGroupTable || !selectedRowKeys?.length || !rows?.length) return false;
|
|
262
|
-
return selectedRowKeys.length === rows.length && selectedRowKeys.every(
|
|
263
|
-
(id) => rows.some((record) => record.id === id)
|
|
264
|
-
);
|
|
265
|
-
}, [isGroupTable, selectedRowKeys, rows]);
|
|
266
|
-
const checkedAll = isAllGroupChecked || isAllNormalChecked;
|
|
267
|
-
return { checkedAll, selectedRowKeysRef };
|
|
268
|
-
};
|
|
269
179
|
var getDateRange = (currentDate, unit) => {
|
|
270
180
|
const date = new Date(currentDate);
|
|
271
181
|
let dateStart, dateEnd;
|
|
@@ -406,19 +316,19 @@ function useStorageState(key) {
|
|
|
406
316
|
|
|
407
317
|
// src/hooks/core/use-list-data.ts
|
|
408
318
|
var import_hooks3 = require("@fctc/interface-logic/hooks");
|
|
409
|
-
var
|
|
319
|
+
var import_store3 = require("@fctc/interface-logic/store");
|
|
410
320
|
var import_utils = require("@fctc/interface-logic/utils");
|
|
411
321
|
var useListData = ({
|
|
412
322
|
action,
|
|
413
323
|
context,
|
|
414
324
|
viewResponse
|
|
415
325
|
}) => {
|
|
416
|
-
const { groupByDomain } = (0,
|
|
326
|
+
const { groupByDomain } = (0, import_store3.useAppSelector)(import_store3.selectSearch);
|
|
417
327
|
const initModel = (0, import_hooks3.useModel)();
|
|
418
328
|
const [type, setType] = (0, import_react5.useState)("list");
|
|
419
329
|
const [mode, setMode] = (0, import_react5.useState)("month");
|
|
420
330
|
const [currentDate, setCurrentDate] = (0, import_react5.useState)(/* @__PURE__ */ new Date());
|
|
421
|
-
const { pageLimit, page, order } = (0,
|
|
331
|
+
const { pageLimit, page, order } = (0, import_store3.useAppSelector)(import_store3.selectList);
|
|
422
332
|
const listDataProps = (0, import_react5.useMemo)(() => {
|
|
423
333
|
const actData = action?.result;
|
|
424
334
|
if (!viewResponse || !actData || !context) {
|
|
@@ -553,10 +463,10 @@ var import_react7 = require("react");
|
|
|
553
463
|
var import_react_i18next = require("react-i18next");
|
|
554
464
|
var import_environment3 = require("@fctc/interface-logic/environment");
|
|
555
465
|
var import_hooks5 = require("@fctc/interface-logic/hooks");
|
|
556
|
-
var
|
|
466
|
+
var import_store4 = require("@fctc/interface-logic/store");
|
|
557
467
|
var useProfile = (accessToken) => {
|
|
558
468
|
const getProfile = (0, import_hooks5.useGetProfile)();
|
|
559
|
-
const dispatch = (0,
|
|
469
|
+
const dispatch = (0, import_store4.useAppDispatch)();
|
|
560
470
|
const { i18n } = (0, import_react_i18next.useTranslation)();
|
|
561
471
|
const fetchUserProfile = async () => {
|
|
562
472
|
return await getProfile.mutateAsync();
|
|
@@ -571,7 +481,7 @@ var useProfile = (accessToken) => {
|
|
|
571
481
|
const userInfo = userInfoQuery.data;
|
|
572
482
|
const env = (0, import_environment3.getEnv)();
|
|
573
483
|
env.setUid(userInfo?.sub);
|
|
574
|
-
dispatch((0,
|
|
484
|
+
dispatch((0, import_store4.setDataUser)(userInfo));
|
|
575
485
|
const userLocale = languages.find((lang) => lang?.id === userInfo?.locale);
|
|
576
486
|
env.setLang(userLocale?.id);
|
|
577
487
|
i18n.changeLanguage(userLocale?.id.split("_")[0]);
|
|
@@ -636,11 +546,11 @@ var useViewV2 = ({
|
|
|
636
546
|
|
|
637
547
|
// src/hooks/core/use-auth.ts
|
|
638
548
|
var import_hooks7 = require("@fctc/interface-logic/hooks");
|
|
639
|
-
var
|
|
549
|
+
var import_store5 = require("@fctc/interface-logic/store");
|
|
640
550
|
var useAuth = () => {
|
|
641
551
|
const [[isLoading, accessToken], setAccessToken] = useStorageState("TOKEN");
|
|
642
552
|
const loginMutate = (0, import_hooks7.useLoginCredential)();
|
|
643
|
-
const dispatch = (0,
|
|
553
|
+
const dispatch = (0, import_store5.useAppDispatch)();
|
|
644
554
|
const signIn = async (email, password) => {
|
|
645
555
|
try {
|
|
646
556
|
loginMutate.mutate(
|
|
@@ -661,9 +571,9 @@ var useAuth = () => {
|
|
|
661
571
|
}
|
|
662
572
|
};
|
|
663
573
|
const signOut = async () => {
|
|
664
|
-
dispatch((0,
|
|
665
|
-
dispatch((0,
|
|
666
|
-
dispatch((0,
|
|
574
|
+
dispatch((0, import_store5.setMenuList)([]));
|
|
575
|
+
dispatch((0, import_store5.setDataUser)({}));
|
|
576
|
+
dispatch((0, import_store5.setProfile)({}));
|
|
667
577
|
setAccessToken(null);
|
|
668
578
|
};
|
|
669
579
|
return {
|
|
@@ -676,6 +586,7 @@ var useAuth = () => {
|
|
|
676
586
|
|
|
677
587
|
// src/hooks/core/use-app-provider.tsx
|
|
678
588
|
var import_react10 = require("react");
|
|
589
|
+
var import_utils2 = require("@fctc/interface-logic/utils");
|
|
679
590
|
|
|
680
591
|
// src/hooks/core/use-company.ts
|
|
681
592
|
var import_react_query3 = require("@tanstack/react-query");
|
|
@@ -724,10 +635,8 @@ var useCompany = (accessToken) => {
|
|
|
724
635
|
context: { allowed_company_ids: [current_company_id] }
|
|
725
636
|
};
|
|
726
637
|
};
|
|
727
|
-
var use_company_default = useCompany;
|
|
728
638
|
|
|
729
639
|
// src/hooks/core/use-app-provider.tsx
|
|
730
|
-
var import_utils2 = require("@fctc/interface-logic/utils");
|
|
731
640
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
732
641
|
var AppProviderInitialValue = {
|
|
733
642
|
config: {},
|
|
@@ -744,7 +653,7 @@ var AppProvider = ({ children }) => {
|
|
|
744
653
|
const config = useConfig({});
|
|
745
654
|
const auth = useAuth();
|
|
746
655
|
const user = useUser(auth.accessToken);
|
|
747
|
-
const company =
|
|
656
|
+
const company = useCompany(auth.accessToken);
|
|
748
657
|
const menuContext = (0, import_react10.useMemo)(() => {
|
|
749
658
|
return combineContexts([user.context, company.context]);
|
|
750
659
|
}, [user.context, company.context]);
|
|
@@ -810,8 +719,6 @@ __export(utils_exports, {
|
|
|
810
719
|
languages: () => languages,
|
|
811
720
|
mergeButtons: () => mergeButtons,
|
|
812
721
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
813
|
-
useGetRowIds: () => useGetRowIds,
|
|
814
|
-
useSelectionState: () => useSelectionState,
|
|
815
722
|
useStorageState: () => useStorageState
|
|
816
723
|
});
|
|
817
724
|
__reExport(utils_exports, require("@fctc/interface-logic/utils"));
|
|
@@ -853,8 +760,74 @@ var useMenuItem = (props) => {
|
|
|
853
760
|
return { handleClick, path, queryActionDetail };
|
|
854
761
|
};
|
|
855
762
|
|
|
856
|
-
// src/hooks/
|
|
763
|
+
// src/hooks/core/use-get-rowids.ts
|
|
857
764
|
var import_react12 = require("react");
|
|
765
|
+
var useGetRowIds = (tableRef) => {
|
|
766
|
+
function isElementVisible(el) {
|
|
767
|
+
const style = window.getComputedStyle(el);
|
|
768
|
+
return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
|
|
769
|
+
}
|
|
770
|
+
function arraysAreEqual(a, b) {
|
|
771
|
+
if (a.length !== b.length) return false;
|
|
772
|
+
if (a.length === 0 && b.length === 0) return true;
|
|
773
|
+
const setA = new Set(a);
|
|
774
|
+
const setB = new Set(b);
|
|
775
|
+
if (setA.size !== setB.size) return false;
|
|
776
|
+
for (const val of setA) {
|
|
777
|
+
if (!setB.has(val)) return false;
|
|
778
|
+
}
|
|
779
|
+
return true;
|
|
780
|
+
}
|
|
781
|
+
const [rowIds, setRowIds] = (0, import_react12.useState)([]);
|
|
782
|
+
const lastRowIdsRef = (0, import_react12.useRef)([]);
|
|
783
|
+
const updateVisibleRowIds = (0, import_react12.useCallback)(() => {
|
|
784
|
+
const table = tableRef.current;
|
|
785
|
+
if (!table) return;
|
|
786
|
+
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
787
|
+
const ids = [];
|
|
788
|
+
rows.forEach((row) => {
|
|
789
|
+
const el = row;
|
|
790
|
+
if (isElementVisible(el)) {
|
|
791
|
+
const id = el.getAttribute("data-row-id");
|
|
792
|
+
if (id) ids.push(id);
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
const uniqueIds = Array.from(new Set(ids));
|
|
796
|
+
if (!arraysAreEqual(lastRowIdsRef.current, uniqueIds)) {
|
|
797
|
+
lastRowIdsRef.current = uniqueIds;
|
|
798
|
+
setRowIds(uniqueIds);
|
|
799
|
+
}
|
|
800
|
+
}, [tableRef]);
|
|
801
|
+
(0, import_react12.useEffect)(() => {
|
|
802
|
+
const table = tableRef.current;
|
|
803
|
+
if (!table) return;
|
|
804
|
+
const mutationObserver = new MutationObserver(() => {
|
|
805
|
+
updateVisibleRowIds();
|
|
806
|
+
});
|
|
807
|
+
mutationObserver.observe(table, {
|
|
808
|
+
childList: true,
|
|
809
|
+
subtree: true,
|
|
810
|
+
attributes: true,
|
|
811
|
+
attributeFilter: ["style", "class"]
|
|
812
|
+
});
|
|
813
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
814
|
+
updateVisibleRowIds();
|
|
815
|
+
});
|
|
816
|
+
resizeObserver.observe(table);
|
|
817
|
+
const handleScroll = () => updateVisibleRowIds();
|
|
818
|
+
table.addEventListener("scroll", handleScroll, true);
|
|
819
|
+
updateVisibleRowIds();
|
|
820
|
+
return () => {
|
|
821
|
+
mutationObserver.disconnect();
|
|
822
|
+
resizeObserver.disconnect();
|
|
823
|
+
table.removeEventListener("scroll", handleScroll, true);
|
|
824
|
+
};
|
|
825
|
+
}, [updateVisibleRowIds, tableRef?.current]);
|
|
826
|
+
return { rowIds, refresh: updateVisibleRowIds };
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
// src/hooks/utils/use-click-outside.ts
|
|
830
|
+
var import_react13 = require("react");
|
|
858
831
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
859
832
|
var useClickOutside = ({
|
|
860
833
|
handler,
|
|
@@ -862,8 +835,8 @@ var useClickOutside = ({
|
|
|
862
835
|
nodes = [],
|
|
863
836
|
refs
|
|
864
837
|
}) => {
|
|
865
|
-
const ref = (0,
|
|
866
|
-
(0,
|
|
838
|
+
const ref = (0, import_react13.useRef)(null);
|
|
839
|
+
(0, import_react13.useEffect)(() => {
|
|
867
840
|
const listener = (event) => {
|
|
868
841
|
const { target } = event;
|
|
869
842
|
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
@@ -885,10 +858,10 @@ var useClickOutside = ({
|
|
|
885
858
|
};
|
|
886
859
|
|
|
887
860
|
// src/hooks/utils/use-debounce.ts
|
|
888
|
-
var
|
|
861
|
+
var import_react14 = require("react");
|
|
889
862
|
function useDebounce(value, delay) {
|
|
890
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
891
|
-
(0,
|
|
863
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react14.useState)(value);
|
|
864
|
+
(0, import_react14.useEffect)(() => {
|
|
892
865
|
const handler = setTimeout(() => {
|
|
893
866
|
setDebouncedValue(value);
|
|
894
867
|
}, delay);
|
|
@@ -911,6 +884,7 @@ __reExport(hooks_exports, require("@fctc/interface-logic/hooks"), module.exports
|
|
|
911
884
|
useConfig,
|
|
912
885
|
useDebounce,
|
|
913
886
|
useDetail,
|
|
887
|
+
useGetRowIds,
|
|
914
888
|
useListData,
|
|
915
889
|
useMenu,
|
|
916
890
|
useMenuItem,
|