@fctc/widget-logic 2.3.6 → 2.3.7
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 -2
- package/dist/hooks.d.ts +7 -2
- package/dist/hooks.js +85 -110
- package/dist/hooks.mjs +97 -131
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +250 -271
- package/dist/index.mjs +227 -270
- 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 +240 -265
- package/dist/widget.mjs +218 -266
- package/package.json +96 -96
package/dist/index.mjs
CHANGED
|
@@ -4087,7 +4087,6 @@ __export(index_exports, {
|
|
|
4087
4087
|
useMenu: () => useMenu,
|
|
4088
4088
|
useMenuItem: () => useMenuItem,
|
|
4089
4089
|
useProfile: () => useProfile,
|
|
4090
|
-
useSelectionState: () => useSelectionState,
|
|
4091
4090
|
useStorageState: () => useStorageState,
|
|
4092
4091
|
useUser: () => useUser,
|
|
4093
4092
|
useViewV2: () => useViewV2
|
|
@@ -4104,6 +4103,7 @@ __export(hooks_exports, {
|
|
|
4104
4103
|
useConfig: () => useConfig,
|
|
4105
4104
|
useDebounce: () => useDebounce,
|
|
4106
4105
|
useDetail: () => useDetail,
|
|
4106
|
+
useGetRowIds: () => useGetRowIds,
|
|
4107
4107
|
useListData: () => useListData,
|
|
4108
4108
|
useMenu: () => useMenu,
|
|
4109
4109
|
useMenuItem: () => useMenuItem,
|
|
@@ -4227,24 +4227,10 @@ var useDetail = (accessToken, sub) => {
|
|
|
4227
4227
|
};
|
|
4228
4228
|
|
|
4229
4229
|
// src/hooks/core/use-list-data.ts
|
|
4230
|
-
import { useMemo as
|
|
4231
|
-
|
|
4232
|
-
// src/utils/function.ts
|
|
4233
|
-
import {
|
|
4234
|
-
useCallback,
|
|
4235
|
-
useEffect as useEffect3,
|
|
4236
|
-
useMemo as useMemo2,
|
|
4237
|
-
useReducer,
|
|
4238
|
-
useRef,
|
|
4239
|
-
useState as useState2
|
|
4240
|
-
} from "react";
|
|
4241
|
-
|
|
4242
|
-
// src/store.ts
|
|
4243
|
-
var store_exports = {};
|
|
4244
|
-
__reExport(store_exports, store_star);
|
|
4245
|
-
import * as store_star from "@fctc/interface-logic/store";
|
|
4230
|
+
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
4246
4231
|
|
|
4247
4232
|
// src/utils/function.ts
|
|
4233
|
+
import { useCallback, useEffect as useEffect3, useReducer } from "react";
|
|
4248
4234
|
var countSum = (data, field) => {
|
|
4249
4235
|
if (!data || !field) return 0;
|
|
4250
4236
|
return data.reduce(
|
|
@@ -4263,91 +4249,6 @@ function mergeButtons(fields) {
|
|
|
4263
4249
|
}
|
|
4264
4250
|
return others;
|
|
4265
4251
|
}
|
|
4266
|
-
function isElementVisible(el) {
|
|
4267
|
-
const style = window.getComputedStyle(el);
|
|
4268
|
-
return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
|
|
4269
|
-
}
|
|
4270
|
-
function arraysAreEqual(a, b) {
|
|
4271
|
-
if (a.length !== b.length) return false;
|
|
4272
|
-
const setA = new Set(a);
|
|
4273
|
-
const setB = new Set(b);
|
|
4274
|
-
if (setA.size !== setB.size) return false;
|
|
4275
|
-
for (const val of setA) {
|
|
4276
|
-
if (!setB.has(val)) return false;
|
|
4277
|
-
}
|
|
4278
|
-
return true;
|
|
4279
|
-
}
|
|
4280
|
-
function useGetRowIds(tableRef) {
|
|
4281
|
-
const [rowIds, setRowIds] = useState2([]);
|
|
4282
|
-
const lastRowIdsRef = useRef([]);
|
|
4283
|
-
const updateVisibleRowIds = useCallback(() => {
|
|
4284
|
-
const table = tableRef?.current;
|
|
4285
|
-
if (!table) return;
|
|
4286
|
-
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
4287
|
-
const ids = [];
|
|
4288
|
-
rows.forEach((row) => {
|
|
4289
|
-
const el = row;
|
|
4290
|
-
if (isElementVisible(el)) {
|
|
4291
|
-
const id = el.getAttribute("data-row-id");
|
|
4292
|
-
if (id) ids.push(id);
|
|
4293
|
-
}
|
|
4294
|
-
});
|
|
4295
|
-
const uniqueIds = Array.from(new Set(ids));
|
|
4296
|
-
if (!arraysAreEqual(lastRowIdsRef.current, uniqueIds)) {
|
|
4297
|
-
lastRowIdsRef.current = uniqueIds;
|
|
4298
|
-
setRowIds(uniqueIds);
|
|
4299
|
-
}
|
|
4300
|
-
}, [tableRef]);
|
|
4301
|
-
useEffect3(() => {
|
|
4302
|
-
const table = tableRef?.current;
|
|
4303
|
-
if (!table) return;
|
|
4304
|
-
const observer = new MutationObserver(() => {
|
|
4305
|
-
updateVisibleRowIds();
|
|
4306
|
-
});
|
|
4307
|
-
observer.observe(table, {
|
|
4308
|
-
childList: true,
|
|
4309
|
-
subtree: true,
|
|
4310
|
-
attributes: true,
|
|
4311
|
-
attributeFilter: ["style", "class"]
|
|
4312
|
-
});
|
|
4313
|
-
updateVisibleRowIds();
|
|
4314
|
-
return () => {
|
|
4315
|
-
observer.disconnect();
|
|
4316
|
-
};
|
|
4317
|
-
}, [updateVisibleRowIds, tableRef]);
|
|
4318
|
-
return { rowIds, refresh: updateVisibleRowIds };
|
|
4319
|
-
}
|
|
4320
|
-
var useSelectionState = ({
|
|
4321
|
-
typeTable,
|
|
4322
|
-
tableRef,
|
|
4323
|
-
rows
|
|
4324
|
-
}) => {
|
|
4325
|
-
const { groupByDomain } = (0, store_exports.useAppSelector)(store_exports.selectSearch);
|
|
4326
|
-
const { selectedRowKeys } = (0, store_exports.useAppSelector)(store_exports.selectList);
|
|
4327
|
-
const { rowIds: recordIds } = useGetRowIds(tableRef);
|
|
4328
|
-
const selectedRowKeysRef = useRef(recordIds);
|
|
4329
|
-
const isGroupTable = typeTable === "group";
|
|
4330
|
-
const recordsCheckedGroup = useMemo2(() => {
|
|
4331
|
-
if (!rows || !groupByDomain) return 0;
|
|
4332
|
-
const groupBy = typeof groupByDomain === "object" ? groupByDomain?.contexts?.[0]?.group_by : void 0;
|
|
4333
|
-
return countSum(rows, groupBy);
|
|
4334
|
-
}, [rows, groupByDomain]);
|
|
4335
|
-
const isAllGroupChecked = useMemo2(() => {
|
|
4336
|
-
if (!isGroupTable || !selectedRowKeys?.length) return false;
|
|
4337
|
-
const selectedLength = selectedRowKeys.filter((id) => id !== -1).length;
|
|
4338
|
-
const allRecordsSelected = recordIds.length === selectedRowKeys.length ? recordIds.length === selectedLength : false;
|
|
4339
|
-
const allGroupsSelected = recordsCheckedGroup === selectedRowKeys.length;
|
|
4340
|
-
return allGroupsSelected || allRecordsSelected;
|
|
4341
|
-
}, [isGroupTable, selectedRowKeys, recordIds, recordsCheckedGroup]);
|
|
4342
|
-
const isAllNormalChecked = useMemo2(() => {
|
|
4343
|
-
if (isGroupTable || !selectedRowKeys?.length || !rows?.length) return false;
|
|
4344
|
-
return selectedRowKeys.length === rows.length && selectedRowKeys.every(
|
|
4345
|
-
(id) => rows.some((record) => record.id === id)
|
|
4346
|
-
);
|
|
4347
|
-
}, [isGroupTable, selectedRowKeys, rows]);
|
|
4348
|
-
const checkedAll = isAllGroupChecked || isAllNormalChecked;
|
|
4349
|
-
return { checkedAll, selectedRowKeysRef };
|
|
4350
|
-
};
|
|
4351
4252
|
var getDateRange = (currentDate, unit) => {
|
|
4352
4253
|
const date = new Date(currentDate);
|
|
4353
4254
|
let dateStart, dateEnd;
|
|
@@ -4489,9 +4390,9 @@ function useStorageState(key) {
|
|
|
4489
4390
|
// src/hooks/core/use-list-data.ts
|
|
4490
4391
|
import { useModel, useGetListData } from "@fctc/interface-logic/hooks";
|
|
4491
4392
|
import {
|
|
4492
|
-
useAppSelector
|
|
4493
|
-
selectSearch
|
|
4494
|
-
selectList
|
|
4393
|
+
useAppSelector,
|
|
4394
|
+
selectSearch,
|
|
4395
|
+
selectList
|
|
4495
4396
|
} from "@fctc/interface-logic/store";
|
|
4496
4397
|
import {
|
|
4497
4398
|
evalJSONDomain,
|
|
@@ -4502,13 +4403,13 @@ var useListData = ({
|
|
|
4502
4403
|
context,
|
|
4503
4404
|
viewResponse
|
|
4504
4405
|
}) => {
|
|
4505
|
-
const { groupByDomain } =
|
|
4406
|
+
const { groupByDomain } = useAppSelector(selectSearch);
|
|
4506
4407
|
const initModel = useModel();
|
|
4507
|
-
const [type, setType] =
|
|
4508
|
-
const [mode, setMode] =
|
|
4509
|
-
const [currentDate, setCurrentDate] =
|
|
4510
|
-
const { pageLimit, page, order } =
|
|
4511
|
-
const listDataProps =
|
|
4408
|
+
const [type, setType] = useState2("list");
|
|
4409
|
+
const [mode, setMode] = useState2("month");
|
|
4410
|
+
const [currentDate, setCurrentDate] = useState2(/* @__PURE__ */ new Date());
|
|
4411
|
+
const { pageLimit, page, order } = useAppSelector(selectList);
|
|
4412
|
+
const listDataProps = useMemo2(() => {
|
|
4512
4413
|
const actData = action?.result;
|
|
4513
4414
|
if (!viewResponse || !actData || !context) {
|
|
4514
4415
|
return null;
|
|
@@ -4569,7 +4470,7 @@ var useListData = ({
|
|
|
4569
4470
|
};
|
|
4570
4471
|
|
|
4571
4472
|
// src/hooks/core/use-menu.ts
|
|
4572
|
-
import { useEffect as useEffect4, useMemo as
|
|
4473
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState3 } from "react";
|
|
4573
4474
|
|
|
4574
4475
|
// src/utils/constants.ts
|
|
4575
4476
|
var languages = [
|
|
@@ -4589,9 +4490,9 @@ var API_APP_URL = {
|
|
|
4589
4490
|
import { useGetMenu } from "@fctc/interface-logic/hooks";
|
|
4590
4491
|
var useMenu = ({ context }) => {
|
|
4591
4492
|
const menuData = useGetMenu(context, !!context);
|
|
4592
|
-
const [menuid, setMenuId] =
|
|
4493
|
+
const [menuid, setMenuId] = useState3(void 0);
|
|
4593
4494
|
const [action, setAction] = useCallAction();
|
|
4594
|
-
const configedIconData =
|
|
4495
|
+
const configedIconData = useMemo3(() => {
|
|
4595
4496
|
const data = menuData.data;
|
|
4596
4497
|
return data?.map((item) => {
|
|
4597
4498
|
return {
|
|
@@ -4638,7 +4539,7 @@ var useMenu = ({ context }) => {
|
|
|
4638
4539
|
|
|
4639
4540
|
// src/hooks/core/use-profile.ts
|
|
4640
4541
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
4641
|
-
import { useEffect as useEffect5, useMemo as
|
|
4542
|
+
import { useEffect as useEffect5, useMemo as useMemo4 } from "react";
|
|
4642
4543
|
import { useTranslation } from "react-i18next";
|
|
4643
4544
|
import { getEnv as getEnv3 } from "@fctc/interface-logic/environment";
|
|
4644
4545
|
import { useGetProfile } from "@fctc/interface-logic/hooks";
|
|
@@ -4666,7 +4567,7 @@ var useProfile = (accessToken) => {
|
|
|
4666
4567
|
i18n2.changeLanguage(userLocale?.id.split("_")[0]);
|
|
4667
4568
|
}
|
|
4668
4569
|
}, [dispatch, userInfoQuery.data]);
|
|
4669
|
-
const context =
|
|
4570
|
+
const context = useMemo4(() => {
|
|
4670
4571
|
if (userInfoQuery.data?.sub && userInfoQuery.data?.locale) {
|
|
4671
4572
|
return {
|
|
4672
4573
|
uid: Number(userInfoQuery.data.sub),
|
|
@@ -4688,13 +4589,13 @@ var useUser = (accessToken) => {
|
|
|
4688
4589
|
};
|
|
4689
4590
|
|
|
4690
4591
|
// src/hooks/core/use-view-v2.ts
|
|
4691
|
-
import { useMemo as
|
|
4592
|
+
import { useMemo as useMemo5 } from "react";
|
|
4692
4593
|
import { useGetView } from "@fctc/interface-logic/hooks";
|
|
4693
4594
|
var useViewV2 = ({
|
|
4694
4595
|
action,
|
|
4695
4596
|
context
|
|
4696
4597
|
}) => {
|
|
4697
|
-
const viewParams =
|
|
4598
|
+
const viewParams = useMemo5(() => {
|
|
4698
4599
|
if (!action?.result) {
|
|
4699
4600
|
return void 0;
|
|
4700
4601
|
}
|
|
@@ -4769,11 +4670,11 @@ var useAuth = () => {
|
|
|
4769
4670
|
};
|
|
4770
4671
|
|
|
4771
4672
|
// src/hooks/core/use-app-provider.tsx
|
|
4772
|
-
import { createContext, useContext, useMemo as
|
|
4673
|
+
import { createContext, useContext, useMemo as useMemo7 } from "react";
|
|
4773
4674
|
|
|
4774
4675
|
// src/hooks/core/use-company.ts
|
|
4775
4676
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4776
|
-
import { useEffect as useEffect6, useMemo as
|
|
4677
|
+
import { useEffect as useEffect6, useMemo as useMemo6 } from "react";
|
|
4777
4678
|
import { getEnv as getEnv4 } from "@fctc/interface-logic/environment";
|
|
4778
4679
|
import {
|
|
4779
4680
|
useGetCurrentCompany,
|
|
@@ -4789,7 +4690,7 @@ var useCompany = (accessToken) => {
|
|
|
4789
4690
|
queryFn: fetchCurrentCompany,
|
|
4790
4691
|
enabled: !!accessToken
|
|
4791
4692
|
});
|
|
4792
|
-
const current_company_id =
|
|
4693
|
+
const current_company_id = useMemo6(() => {
|
|
4793
4694
|
return currentCompany.data?.current_company_id;
|
|
4794
4695
|
}, [currentCompany.data]);
|
|
4795
4696
|
useEffect6(() => {
|
|
@@ -4842,14 +4743,14 @@ var AppProvider = ({ children }) => {
|
|
|
4842
4743
|
const auth = useAuth();
|
|
4843
4744
|
const user = useUser(auth.accessToken);
|
|
4844
4745
|
const company = use_company_default(auth.accessToken);
|
|
4845
|
-
const menuContext =
|
|
4746
|
+
const menuContext = useMemo7(() => {
|
|
4846
4747
|
return combineContexts([user.context, company.context]);
|
|
4847
4748
|
}, [user.context, company.context]);
|
|
4848
4749
|
const menu = useMenu({ context: menuContext });
|
|
4849
|
-
const action =
|
|
4750
|
+
const action = useMemo7(() => {
|
|
4850
4751
|
return menu.state.action;
|
|
4851
4752
|
}, [menu.state.action]);
|
|
4852
|
-
const viewContext =
|
|
4753
|
+
const viewContext = useMemo7(() => {
|
|
4853
4754
|
return combineContexts([
|
|
4854
4755
|
menuContext,
|
|
4855
4756
|
{ ...evalJSONContext(action?.result?.context) }
|
|
@@ -4892,7 +4793,7 @@ var useAppProvider = () => {
|
|
|
4892
4793
|
// src/hooks/core/use-menu-item.tsx
|
|
4893
4794
|
import { getEnv as getEnv5 } from "@fctc/interface-logic/environment";
|
|
4894
4795
|
import { useGetActionDetail } from "@fctc/interface-logic/hooks";
|
|
4895
|
-
import { useState as
|
|
4796
|
+
import { useState as useState4 } from "react";
|
|
4896
4797
|
|
|
4897
4798
|
// src/utils.ts
|
|
4898
4799
|
var utils_exports = {};
|
|
@@ -4907,8 +4808,6 @@ __export(utils_exports, {
|
|
|
4907
4808
|
languages: () => languages,
|
|
4908
4809
|
mergeButtons: () => mergeButtons,
|
|
4909
4810
|
setStorageItemAsync: () => setStorageItemAsync,
|
|
4910
|
-
useGetRowIds: () => useGetRowIds,
|
|
4911
|
-
useSelectionState: () => useSelectionState,
|
|
4912
4811
|
useStorageState: () => useStorageState
|
|
4913
4812
|
});
|
|
4914
4813
|
__reExport(utils_exports, utils_star);
|
|
@@ -4929,7 +4828,7 @@ var useMenuItem = (props) => {
|
|
|
4929
4828
|
enabled: true,
|
|
4930
4829
|
queryKey: [`action-${aid}`]
|
|
4931
4830
|
}).data;
|
|
4932
|
-
const [path, setPath] =
|
|
4831
|
+
const [path, setPath] = useState4("");
|
|
4933
4832
|
const handleClick = () => {
|
|
4934
4833
|
if (location?.pathname === "/list/menu" && activeMenuId === menu?.id) {
|
|
4935
4834
|
return;
|
|
@@ -4951,8 +4850,74 @@ var useMenuItem = (props) => {
|
|
|
4951
4850
|
return { handleClick, path, queryActionDetail };
|
|
4952
4851
|
};
|
|
4953
4852
|
|
|
4853
|
+
// src/hooks/core/use-get-rowids.ts
|
|
4854
|
+
import { useCallback as useCallback2, useEffect as useEffect7, useRef, useState as useState5 } from "react";
|
|
4855
|
+
var useGetRowIds = (tableRef) => {
|
|
4856
|
+
function isElementVisible(el) {
|
|
4857
|
+
const style = window.getComputedStyle(el);
|
|
4858
|
+
return style.display !== "none" && style.visibility !== "hidden" && style.opacity !== "0";
|
|
4859
|
+
}
|
|
4860
|
+
function arraysAreEqual(a, b) {
|
|
4861
|
+
if (a.length !== b.length) return false;
|
|
4862
|
+
if (a.length === 0 && b.length === 0) return true;
|
|
4863
|
+
const setA = new Set(a);
|
|
4864
|
+
const setB = new Set(b);
|
|
4865
|
+
if (setA.size !== setB.size) return false;
|
|
4866
|
+
for (const val of setA) {
|
|
4867
|
+
if (!setB.has(val)) return false;
|
|
4868
|
+
}
|
|
4869
|
+
return true;
|
|
4870
|
+
}
|
|
4871
|
+
const [rowIds, setRowIds] = useState5([]);
|
|
4872
|
+
const lastRowIdsRef = useRef([]);
|
|
4873
|
+
const updateVisibleRowIds = useCallback2(() => {
|
|
4874
|
+
const table = tableRef.current;
|
|
4875
|
+
if (!table) return;
|
|
4876
|
+
const rows = table.querySelectorAll("tr[data-row-id]");
|
|
4877
|
+
const ids = [];
|
|
4878
|
+
rows.forEach((row) => {
|
|
4879
|
+
const el = row;
|
|
4880
|
+
if (isElementVisible(el)) {
|
|
4881
|
+
const id = el.getAttribute("data-row-id");
|
|
4882
|
+
if (id) ids.push(id);
|
|
4883
|
+
}
|
|
4884
|
+
});
|
|
4885
|
+
const uniqueIds = Array.from(new Set(ids));
|
|
4886
|
+
if (!arraysAreEqual(lastRowIdsRef.current, uniqueIds)) {
|
|
4887
|
+
lastRowIdsRef.current = uniqueIds;
|
|
4888
|
+
setRowIds(uniqueIds);
|
|
4889
|
+
}
|
|
4890
|
+
}, [tableRef]);
|
|
4891
|
+
useEffect7(() => {
|
|
4892
|
+
const table = tableRef.current;
|
|
4893
|
+
if (!table) return;
|
|
4894
|
+
const mutationObserver = new MutationObserver(() => {
|
|
4895
|
+
updateVisibleRowIds();
|
|
4896
|
+
});
|
|
4897
|
+
mutationObserver.observe(table, {
|
|
4898
|
+
childList: true,
|
|
4899
|
+
subtree: true,
|
|
4900
|
+
attributes: true,
|
|
4901
|
+
attributeFilter: ["style", "class"]
|
|
4902
|
+
});
|
|
4903
|
+
const resizeObserver = new ResizeObserver(() => {
|
|
4904
|
+
updateVisibleRowIds();
|
|
4905
|
+
});
|
|
4906
|
+
resizeObserver.observe(table);
|
|
4907
|
+
const handleScroll = () => updateVisibleRowIds();
|
|
4908
|
+
table.addEventListener("scroll", handleScroll, true);
|
|
4909
|
+
updateVisibleRowIds();
|
|
4910
|
+
return () => {
|
|
4911
|
+
mutationObserver.disconnect();
|
|
4912
|
+
resizeObserver.disconnect();
|
|
4913
|
+
table.removeEventListener("scroll", handleScroll, true);
|
|
4914
|
+
};
|
|
4915
|
+
}, [updateVisibleRowIds, tableRef?.current]);
|
|
4916
|
+
return { rowIds, refresh: updateVisibleRowIds };
|
|
4917
|
+
};
|
|
4918
|
+
|
|
4954
4919
|
// src/hooks/utils/use-click-outside.ts
|
|
4955
|
-
import { useEffect as
|
|
4920
|
+
import { useEffect as useEffect8, useRef as useRef2 } from "react";
|
|
4956
4921
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4957
4922
|
var useClickOutside = ({
|
|
4958
4923
|
handler,
|
|
@@ -4961,7 +4926,7 @@ var useClickOutside = ({
|
|
|
4961
4926
|
refs
|
|
4962
4927
|
}) => {
|
|
4963
4928
|
const ref = useRef2(null);
|
|
4964
|
-
|
|
4929
|
+
useEffect8(() => {
|
|
4965
4930
|
const listener = (event) => {
|
|
4966
4931
|
const { target } = event;
|
|
4967
4932
|
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
@@ -4983,10 +4948,10 @@ var useClickOutside = ({
|
|
|
4983
4948
|
};
|
|
4984
4949
|
|
|
4985
4950
|
// src/hooks/utils/use-debounce.ts
|
|
4986
|
-
import { useEffect as
|
|
4951
|
+
import { useEffect as useEffect9, useState as useState6 } from "react";
|
|
4987
4952
|
function useDebounce(value, delay) {
|
|
4988
4953
|
const [debouncedValue, setDebouncedValue] = useState6(value);
|
|
4989
|
-
|
|
4954
|
+
useEffect9(() => {
|
|
4990
4955
|
const handler = setTimeout(() => {
|
|
4991
4956
|
setDebouncedValue(value);
|
|
4992
4957
|
}, delay);
|
|
@@ -5243,7 +5208,7 @@ var ChevronBottomIcon = ({
|
|
|
5243
5208
|
};
|
|
5244
5209
|
|
|
5245
5210
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
5246
|
-
import { useEffect as
|
|
5211
|
+
import { useEffect as useEffect10, useRef as useRef3, useState as useState7 } from "react";
|
|
5247
5212
|
import { getEnv as getEnv6 } from "@fctc/interface-logic/environment";
|
|
5248
5213
|
import { useSave } from "@fctc/interface-logic/hooks";
|
|
5249
5214
|
var statusDropdownController = (props) => {
|
|
@@ -5256,7 +5221,7 @@ var statusDropdownController = (props) => {
|
|
|
5256
5221
|
};
|
|
5257
5222
|
const [isOpen, setIsOpen] = useState7(false);
|
|
5258
5223
|
const buttonRef = useRef3(null);
|
|
5259
|
-
|
|
5224
|
+
useEffect10(() => {
|
|
5260
5225
|
const handleClickOutside = (event) => {
|
|
5261
5226
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
5262
5227
|
setIsOpen(false);
|
|
@@ -5297,7 +5262,12 @@ var statusDropdownController = (props) => {
|
|
|
5297
5262
|
};
|
|
5298
5263
|
|
|
5299
5264
|
// src/widget/basic/many2one-field/controller.ts
|
|
5300
|
-
import { useCallback as
|
|
5265
|
+
import { useCallback as useCallback3, useEffect as useEffect11, useMemo as useMemo8, useState as useState8 } from "react";
|
|
5266
|
+
|
|
5267
|
+
// src/store.ts
|
|
5268
|
+
var store_exports = {};
|
|
5269
|
+
__reExport(store_exports, store_star);
|
|
5270
|
+
import * as store_star from "@fctc/interface-logic/store";
|
|
5301
5271
|
|
|
5302
5272
|
// src/provider.ts
|
|
5303
5273
|
var provider_exports = {};
|
|
@@ -5357,18 +5327,18 @@ var many2oneFieldController = (props) => {
|
|
|
5357
5327
|
queryKey,
|
|
5358
5328
|
enabled: false
|
|
5359
5329
|
});
|
|
5360
|
-
const selectOptions =
|
|
5330
|
+
const selectOptions = useMemo8(() => {
|
|
5361
5331
|
return dataOfSelection?.records?.map((val) => ({
|
|
5362
5332
|
value: val?.id,
|
|
5363
5333
|
label: val?.display_name || val?.name
|
|
5364
5334
|
})) || [];
|
|
5365
5335
|
}, [dataOfSelection]);
|
|
5366
|
-
|
|
5336
|
+
useEffect11(() => {
|
|
5367
5337
|
setOptions(selectOptions);
|
|
5368
5338
|
setDomainModal(domainObject);
|
|
5369
5339
|
if (relation === "student.subject") (0, store_exports.setListSubject)(selectOptions);
|
|
5370
5340
|
}, [selectOptions]);
|
|
5371
|
-
|
|
5341
|
+
useEffect11(() => {
|
|
5372
5342
|
setDomainObject(
|
|
5373
5343
|
(0, utils_exports.evalJSONDomain)(
|
|
5374
5344
|
domain,
|
|
@@ -5376,7 +5346,7 @@ var many2oneFieldController = (props) => {
|
|
|
5376
5346
|
)
|
|
5377
5347
|
);
|
|
5378
5348
|
}, [domain, formValues]);
|
|
5379
|
-
|
|
5349
|
+
useEffect11(() => {
|
|
5380
5350
|
if (!propValue && tempSelectedOption) {
|
|
5381
5351
|
methods.setValue(name, null);
|
|
5382
5352
|
setTempSelectedOption(null);
|
|
@@ -5387,10 +5357,10 @@ var many2oneFieldController = (props) => {
|
|
|
5387
5357
|
});
|
|
5388
5358
|
}
|
|
5389
5359
|
}, [propValue]);
|
|
5390
|
-
const fetchMoreOptions =
|
|
5360
|
+
const fetchMoreOptions = useCallback3(() => {
|
|
5391
5361
|
refetch();
|
|
5392
5362
|
}, [refetch]);
|
|
5393
|
-
|
|
5363
|
+
useEffect11(() => {
|
|
5394
5364
|
if (debouncedInputValue) {
|
|
5395
5365
|
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
5396
5366
|
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
@@ -5405,7 +5375,7 @@ var many2oneFieldController = (props) => {
|
|
|
5405
5375
|
}, 50);
|
|
5406
5376
|
}
|
|
5407
5377
|
}, [debouncedInputValue]);
|
|
5408
|
-
const handleChooseRecord =
|
|
5378
|
+
const handleChooseRecord = useCallback3(
|
|
5409
5379
|
(idRecord) => {
|
|
5410
5380
|
const newOption = options.find(
|
|
5411
5381
|
(option) => option.value === idRecord
|
|
@@ -5430,8 +5400,8 @@ var many2oneFieldController = (props) => {
|
|
|
5430
5400
|
},
|
|
5431
5401
|
[options, methods, name, onChange]
|
|
5432
5402
|
);
|
|
5433
|
-
const handleClose =
|
|
5434
|
-
const handleSelectChange =
|
|
5403
|
+
const handleClose = useCallback3(() => setIsShowModalMany2Many(false), []);
|
|
5404
|
+
const handleSelectChange = useCallback3(
|
|
5435
5405
|
(selectedOption) => {
|
|
5436
5406
|
if (!selectedOption) {
|
|
5437
5407
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5505,7 +5475,7 @@ var many2oneButtonController = (props) => {
|
|
|
5505
5475
|
};
|
|
5506
5476
|
|
|
5507
5477
|
// src/widget/basic/many2many-field/controller.ts
|
|
5508
|
-
import { useEffect as
|
|
5478
|
+
import { useEffect as useEffect12, useMemo as useMemo9, useState as useState9 } from "react";
|
|
5509
5479
|
import {
|
|
5510
5480
|
evalJSONContext as evalJSONContext4,
|
|
5511
5481
|
evalJSONDomain as evalJSONDomain4,
|
|
@@ -5524,7 +5494,7 @@ var many2manyFieldController = (props) => {
|
|
|
5524
5494
|
actionData
|
|
5525
5495
|
} = props;
|
|
5526
5496
|
const { env } = (0, provider_exports.useEnv)();
|
|
5527
|
-
const { useGetView: useGetView2, useGetListData:
|
|
5497
|
+
const { useGetView: useGetView2, useGetListData: useGetListData2, useGetFormView } = (0, provider_exports.useService)();
|
|
5528
5498
|
const [order, setOrder] = useState9();
|
|
5529
5499
|
const [page, setPage] = useState9(0);
|
|
5530
5500
|
const [domainMany2Many, setDomainMany2Many] = useState9(null);
|
|
@@ -5542,7 +5512,7 @@ var many2manyFieldController = (props) => {
|
|
|
5542
5512
|
context: contextObject
|
|
5543
5513
|
};
|
|
5544
5514
|
const { data: viewResponse } = useGetView2(viewParams, enabledCallAPI);
|
|
5545
|
-
const baseModel =
|
|
5515
|
+
const baseModel = useMemo9(
|
|
5546
5516
|
() => ({
|
|
5547
5517
|
name: String(relation),
|
|
5548
5518
|
view: viewResponse || {},
|
|
@@ -5555,13 +5525,13 @@ var many2manyFieldController = (props) => {
|
|
|
5555
5525
|
[relation, viewResponse]
|
|
5556
5526
|
);
|
|
5557
5527
|
const initModel = (0, hooks_exports.useModel)();
|
|
5558
|
-
const modelInstance =
|
|
5528
|
+
const modelInstance = useMemo9(() => {
|
|
5559
5529
|
if (viewResponse) {
|
|
5560
5530
|
return initModel.initModel(baseModel);
|
|
5561
5531
|
}
|
|
5562
5532
|
return null;
|
|
5563
5533
|
}, [baseModel, viewResponse]);
|
|
5564
|
-
const specification =
|
|
5534
|
+
const specification = useMemo9(() => {
|
|
5565
5535
|
if (modelInstance) {
|
|
5566
5536
|
return modelInstance.getSpecification();
|
|
5567
5537
|
}
|
|
@@ -5603,8 +5573,8 @@ var many2manyFieldController = (props) => {
|
|
|
5603
5573
|
isLoading,
|
|
5604
5574
|
isFetched,
|
|
5605
5575
|
isPlaceholderData
|
|
5606
|
-
} =
|
|
5607
|
-
|
|
5576
|
+
} = useGetListData2(data, queryKey, enabled);
|
|
5577
|
+
useEffect12(() => {
|
|
5608
5578
|
if (viewResponse) {
|
|
5609
5579
|
fetchData();
|
|
5610
5580
|
}
|
|
@@ -5657,7 +5627,7 @@ var many2manyFieldController = (props) => {
|
|
|
5657
5627
|
};
|
|
5658
5628
|
|
|
5659
5629
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5660
|
-
import { useMemo as
|
|
5630
|
+
import { useMemo as useMemo10 } from "react";
|
|
5661
5631
|
import { WIDGETAVATAR, WIDGETCOLOR } from "@fctc/interface-logic/constants";
|
|
5662
5632
|
import { evalJSONContext as evalJSONContext5, evalJSONDomain as evalJSONDomain5 } from "@fctc/interface-logic/utils";
|
|
5663
5633
|
var many2manyTagsController = (props) => {
|
|
@@ -5673,7 +5643,7 @@ var many2manyTagsController = (props) => {
|
|
|
5673
5643
|
const { env } = (0, provider_exports.useEnv)();
|
|
5674
5644
|
const { useGetSelection: useGetSelection2 } = (0, provider_exports.useService)();
|
|
5675
5645
|
const addtionalFields = optionsFields ? evalJSONContext5(optionsFields) : null;
|
|
5676
|
-
const domainObject =
|
|
5646
|
+
const domainObject = useMemo10(
|
|
5677
5647
|
() => evalJSONDomain5(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5678
5648
|
[domain, formValues]
|
|
5679
5649
|
);
|
|
@@ -5724,7 +5694,7 @@ var durationController = (props) => {
|
|
|
5724
5694
|
name: "",
|
|
5725
5695
|
fold: ""
|
|
5726
5696
|
};
|
|
5727
|
-
const { useGetListData:
|
|
5697
|
+
const { useGetListData: useGetListData2, useChangeStatus } = (0, provider_exports.useService)();
|
|
5728
5698
|
const { env } = (0, provider_exports.useEnv)();
|
|
5729
5699
|
const [disabled, setDisabled] = useState10(false);
|
|
5730
5700
|
const [modelStatus, setModalStatus] = useState10(false);
|
|
@@ -5742,7 +5712,7 @@ var durationController = (props) => {
|
|
|
5742
5712
|
},
|
|
5743
5713
|
sort: ""
|
|
5744
5714
|
};
|
|
5745
|
-
const { data: dataResponse } =
|
|
5715
|
+
const { data: dataResponse } = useGetListData2(
|
|
5746
5716
|
listDataProps,
|
|
5747
5717
|
queryKey,
|
|
5748
5718
|
enabled
|
|
@@ -6804,7 +6774,7 @@ var colorFieldController = (props) => {
|
|
|
6804
6774
|
};
|
|
6805
6775
|
|
|
6806
6776
|
// src/widget/basic/binary-field/controller.ts
|
|
6807
|
-
import { useEffect as
|
|
6777
|
+
import { useEffect as useEffect13, useId as useId2, useRef as useRef4, useState as useState13 } from "react";
|
|
6808
6778
|
import { isBase64Image } from "@fctc/interface-logic/utils";
|
|
6809
6779
|
var binaryFieldController = (props) => {
|
|
6810
6780
|
const { name, methods, readonly = false, value } = props;
|
|
@@ -6875,14 +6845,14 @@ var binaryFieldController = (props) => {
|
|
|
6875
6845
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
6876
6846
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
6877
6847
|
};
|
|
6878
|
-
|
|
6848
|
+
useEffect13(() => {
|
|
6879
6849
|
return () => {
|
|
6880
6850
|
if (selectedImage) {
|
|
6881
6851
|
URL.revokeObjectURL(selectedImage);
|
|
6882
6852
|
}
|
|
6883
6853
|
};
|
|
6884
6854
|
}, [selectedImage]);
|
|
6885
|
-
|
|
6855
|
+
useEffect13(() => {
|
|
6886
6856
|
if (binaryRef.current) {
|
|
6887
6857
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
6888
6858
|
setIsInsideTable(isInsideTable2);
|
|
@@ -6902,16 +6872,33 @@ var binaryFieldController = (props) => {
|
|
|
6902
6872
|
};
|
|
6903
6873
|
|
|
6904
6874
|
// src/widget/advance/table/table-head/controller.ts
|
|
6905
|
-
import {
|
|
6906
|
-
|
|
6907
|
-
useAppSelector as useAppSelector4,
|
|
6908
|
-
selectSearch as selectSearch3,
|
|
6909
|
-
setSelectedRowKeys
|
|
6910
|
-
} from "@fctc/interface-logic/store";
|
|
6875
|
+
import { useAppDispatch as useAppDispatch5, setSelectedRowKeys } from "@fctc/interface-logic/store";
|
|
6876
|
+
import { useMemo as useMemo11, useRef as useRef5 } from "react";
|
|
6911
6877
|
var tableHeadController = (props) => {
|
|
6912
|
-
const { typeTable, rows,
|
|
6878
|
+
const { typeTable, rows, tableRef, groupByList, selectedRowKeys } = props;
|
|
6913
6879
|
const appDispatch = useAppDispatch5();
|
|
6914
|
-
const {
|
|
6880
|
+
const { rowIds: recordIds } = useGetRowIds(tableRef);
|
|
6881
|
+
const selectedRowKeysRef = useRef5(recordIds);
|
|
6882
|
+
const isGroupTable = typeTable === "group";
|
|
6883
|
+
const recordsCheckedGroup = useMemo11(() => {
|
|
6884
|
+
if (!rows || !groupByList) return 0;
|
|
6885
|
+
const groupBy = typeof groupByList === "object" ? groupByList?.contexts?.[0]?.group_by : void 0;
|
|
6886
|
+
return countSum(rows, groupBy);
|
|
6887
|
+
}, [rows, groupByList]);
|
|
6888
|
+
const isAllGroupChecked = useMemo11(() => {
|
|
6889
|
+
if (!isGroupTable || !selectedRowKeys?.length) return false;
|
|
6890
|
+
const selectedLength = selectedRowKeys.filter((id) => id !== -1).length;
|
|
6891
|
+
const allRecordsSelected = recordIds.length === selectedRowKeys.length ? recordIds.length === selectedLength : false;
|
|
6892
|
+
const allGroupsSelected = recordsCheckedGroup === selectedRowKeys.length;
|
|
6893
|
+
return allGroupsSelected || allRecordsSelected;
|
|
6894
|
+
}, [isGroupTable, selectedRowKeys, recordIds, recordsCheckedGroup]);
|
|
6895
|
+
const isAllNormalChecked = useMemo11(() => {
|
|
6896
|
+
if (isGroupTable || !selectedRowKeys?.length || !rows?.length) return false;
|
|
6897
|
+
return selectedRowKeys.length === rows.length && selectedRowKeys.every(
|
|
6898
|
+
(id) => rows.some((record) => record.id === id)
|
|
6899
|
+
);
|
|
6900
|
+
}, [isGroupTable, selectedRowKeys, rows]);
|
|
6901
|
+
const checkedAll = isAllGroupChecked || isAllNormalChecked;
|
|
6915
6902
|
const handleCheckBoxAll = (event) => {
|
|
6916
6903
|
if (event?.target?.checked && typeTable === "list") {
|
|
6917
6904
|
const allRowKeys = Array.isArray(rows) ? rows.map((record) => record?.id) : [];
|
|
@@ -6926,7 +6913,7 @@ var tableHeadController = (props) => {
|
|
|
6926
6913
|
} else {
|
|
6927
6914
|
const sum = countSum(
|
|
6928
6915
|
rows,
|
|
6929
|
-
typeof
|
|
6916
|
+
typeof groupByList === "object" ? groupByList?.contexts?.[0]?.group_by : void 0
|
|
6930
6917
|
);
|
|
6931
6918
|
const keys = Array.from({ length: sum }, (_) => void 0);
|
|
6932
6919
|
appDispatch(setSelectedRowKeys(keys));
|
|
@@ -6939,22 +6926,19 @@ var tableHeadController = (props) => {
|
|
|
6939
6926
|
}
|
|
6940
6927
|
};
|
|
6941
6928
|
return {
|
|
6942
|
-
handleCheckBoxAll
|
|
6929
|
+
handleCheckBoxAll,
|
|
6930
|
+
checkedAll,
|
|
6931
|
+
selectedRowKeysRef
|
|
6943
6932
|
};
|
|
6944
6933
|
};
|
|
6945
6934
|
|
|
6946
6935
|
// src/widget/advance/table/table-view/controller.ts
|
|
6947
|
-
import { useEffect as
|
|
6948
|
-
import {
|
|
6949
|
-
useAppSelector as useAppSelector5,
|
|
6950
|
-
selectSearch as selectSearch4,
|
|
6951
|
-
selectList as selectList3
|
|
6952
|
-
} from "@fctc/interface-logic/store";
|
|
6936
|
+
import { useEffect as useEffect14, useState as useState14 } from "react";
|
|
6953
6937
|
import { domainHelper } from "@fctc/interface-logic/utils";
|
|
6954
6938
|
var tableController = ({ data }) => {
|
|
6955
|
-
const [rows, setRows] = useState14(
|
|
6956
|
-
const [columns, setColumns] = useState14(
|
|
6957
|
-
const dataModelFields = data
|
|
6939
|
+
const [rows, setRows] = useState14(null);
|
|
6940
|
+
const [columns, setColumns] = useState14(null);
|
|
6941
|
+
const dataModelFields = data?.fields?.map((field) => {
|
|
6958
6942
|
return {
|
|
6959
6943
|
...data.dataModel?.[field?.name],
|
|
6960
6944
|
...field,
|
|
@@ -6981,8 +6965,8 @@ var tableController = ({ data }) => {
|
|
|
6981
6965
|
return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
|
|
6982
6966
|
});
|
|
6983
6967
|
};
|
|
6984
|
-
|
|
6985
|
-
setRows(transformData(data.records
|
|
6968
|
+
useEffect14(() => {
|
|
6969
|
+
setRows(transformData(data.records));
|
|
6986
6970
|
}, [data.records]);
|
|
6987
6971
|
const handleGetColumns = () => {
|
|
6988
6972
|
let cols = [];
|
|
@@ -7002,10 +6986,11 @@ var tableController = ({ data }) => {
|
|
|
7002
6986
|
}
|
|
7003
6987
|
return cols;
|
|
7004
6988
|
};
|
|
7005
|
-
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
6989
|
+
useEffect14(() => {
|
|
6990
|
+
if (!columns) {
|
|
6991
|
+
setColumns(handleGetColumns());
|
|
6992
|
+
}
|
|
6993
|
+
}, [data]);
|
|
7009
6994
|
const onToggleColumnOptional = (item) => {
|
|
7010
6995
|
const tempColumn = [...columns]?.map((val) => {
|
|
7011
6996
|
if (item?.name === val?.name) {
|
|
@@ -7018,6 +7003,14 @@ var tableController = ({ data }) => {
|
|
|
7018
7003
|
});
|
|
7019
7004
|
setColumns(tempColumn);
|
|
7020
7005
|
};
|
|
7006
|
+
useEffect14(() => {
|
|
7007
|
+
setRows(null);
|
|
7008
|
+
setColumns(null);
|
|
7009
|
+
return () => {
|
|
7010
|
+
setRows(null);
|
|
7011
|
+
setColumns(null);
|
|
7012
|
+
};
|
|
7013
|
+
}, [data?.fields]);
|
|
7021
7014
|
return {
|
|
7022
7015
|
rows,
|
|
7023
7016
|
columns,
|
|
@@ -7027,57 +7020,35 @@ var tableController = ({ data }) => {
|
|
|
7027
7020
|
};
|
|
7028
7021
|
|
|
7029
7022
|
// src/widget/advance/table/table-group/controller.ts
|
|
7030
|
-
import { useEffect as
|
|
7031
|
-
import {
|
|
7032
|
-
useOdooDataTransform,
|
|
7033
|
-
useGetListData as useGetListData2
|
|
7034
|
-
} from "@fctc/interface-logic/hooks";
|
|
7023
|
+
import { useEffect as useEffect15, useMemo as useMemo12, useState as useState15 } from "react";
|
|
7035
7024
|
import {
|
|
7036
|
-
useAppSelector as
|
|
7037
|
-
|
|
7038
|
-
selectList as selectList4,
|
|
7039
|
-
useAppDispatch as useAppDispatch6,
|
|
7040
|
-
setSelectedRowKeys as setSelectedRowKeys2
|
|
7025
|
+
useAppSelector as useAppSelector3,
|
|
7026
|
+
selectList as selectList2
|
|
7041
7027
|
} from "@fctc/interface-logic/store";
|
|
7042
|
-
|
|
7043
|
-
// src/environment.ts
|
|
7044
|
-
var environment_exports = {};
|
|
7045
|
-
__reExport(environment_exports, environment_star);
|
|
7046
|
-
import * as environment_star from "@fctc/interface-logic/environment";
|
|
7047
|
-
|
|
7048
|
-
// src/widget/advance/table/table-group/controller.ts
|
|
7049
7028
|
var tableGroupController = (props) => {
|
|
7050
|
-
const env = (0,
|
|
7029
|
+
const { env } = (0, provider_exports.useEnv)();
|
|
7030
|
+
const { useGetListData: useGetListData2 } = (0, provider_exports.useService)();
|
|
7051
7031
|
const {
|
|
7052
|
-
rows,
|
|
7053
7032
|
columns,
|
|
7054
|
-
indexRow,
|
|
7055
7033
|
row,
|
|
7056
7034
|
model,
|
|
7057
7035
|
viewData,
|
|
7058
|
-
renderField,
|
|
7059
7036
|
level,
|
|
7060
7037
|
specification,
|
|
7061
|
-
domain,
|
|
7062
7038
|
context,
|
|
7063
7039
|
checkedAll,
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
setIsAutoSelect,
|
|
7067
|
-
selectedRowKeysRef
|
|
7040
|
+
groupByList,
|
|
7041
|
+
setSelectedRowKeys: setSelectedRowKeys3
|
|
7068
7042
|
} = props;
|
|
7069
7043
|
const [pageGroup, setPageGroup] = useState15(0);
|
|
7070
|
-
const {
|
|
7071
|
-
const { selectedRowKeys } = useAppSelector6(selectList4);
|
|
7072
|
-
const appDispatch = useAppDispatch6();
|
|
7073
|
-
const { toDataJS } = useOdooDataTransform();
|
|
7074
|
-
const initVal = toDataJS(row, viewData, model);
|
|
7044
|
+
const { selectedRowKeys } = useAppSelector3(selectList2);
|
|
7075
7045
|
const [isShowGroup, setIsShowGroup] = useState15(false);
|
|
7076
7046
|
const [colEmptyGroup, setColEmptyGroup] = useState15({
|
|
7077
7047
|
fromStart: 1,
|
|
7078
7048
|
fromEnd: 1
|
|
7079
7049
|
});
|
|
7080
|
-
const
|
|
7050
|
+
const domain = row?.__domain;
|
|
7051
|
+
const processedData = useMemo12(() => {
|
|
7081
7052
|
const calculateColSpanEmpty = () => {
|
|
7082
7053
|
const startIndex = columns.findIndex(
|
|
7083
7054
|
(col) => col.field.type === "monetary" && typeof row[col.key] === "number" || col.field.aggregator === "sum"
|
|
@@ -7092,7 +7063,7 @@ var tableGroupController = (props) => {
|
|
|
7092
7063
|
};
|
|
7093
7064
|
return calculateColSpanEmpty();
|
|
7094
7065
|
}, [columns, row]);
|
|
7095
|
-
const shouldFetchData =
|
|
7066
|
+
const shouldFetchData = useMemo12(() => {
|
|
7096
7067
|
return !!isShowGroup;
|
|
7097
7068
|
}, [isShowGroup]);
|
|
7098
7069
|
const enabled = shouldFetchData && !!processedData;
|
|
@@ -7102,21 +7073,21 @@ var tableGroupController = (props) => {
|
|
|
7102
7073
|
domain,
|
|
7103
7074
|
context,
|
|
7104
7075
|
offset: pageGroup * 10,
|
|
7105
|
-
fields:
|
|
7106
|
-
groupby: [
|
|
7076
|
+
fields: groupByList?.fields,
|
|
7077
|
+
groupby: [groupByList?.contexts[level]?.group_by]
|
|
7107
7078
|
};
|
|
7108
7079
|
const queryKey = [
|
|
7109
|
-
`data-${model}
|
|
7080
|
+
`data-${model}-level_${level}-row-${row?.id}`,
|
|
7110
7081
|
specification,
|
|
7111
7082
|
domain,
|
|
7112
7083
|
pageGroup
|
|
7113
7084
|
];
|
|
7114
7085
|
const {
|
|
7115
|
-
data:
|
|
7116
|
-
isFetched:
|
|
7117
|
-
isPlaceholderData,
|
|
7086
|
+
data: dataGroup,
|
|
7087
|
+
isFetched: isDataGroupFetched,
|
|
7118
7088
|
isLoading,
|
|
7119
|
-
isFetching
|
|
7089
|
+
isFetching,
|
|
7090
|
+
isPlaceholderData: isDataPlaceHolder
|
|
7120
7091
|
} = useGetListData2(listDataProps, queryKey, enabled);
|
|
7121
7092
|
const {
|
|
7122
7093
|
columns: columnsGroup,
|
|
@@ -7125,27 +7096,21 @@ var tableGroupController = (props) => {
|
|
|
7125
7096
|
} = tableController({
|
|
7126
7097
|
data: {
|
|
7127
7098
|
fields: viewData?.views?.list?.fields,
|
|
7128
|
-
records:
|
|
7099
|
+
records: dataGroup?.records ?? dataGroup?.groups,
|
|
7129
7100
|
dataModel: viewData?.models?.[model],
|
|
7130
7101
|
context: env.context,
|
|
7131
|
-
typeTable:
|
|
7102
|
+
typeTable: dataGroup?.groups ? "group" : "list"
|
|
7132
7103
|
}
|
|
7133
7104
|
});
|
|
7134
|
-
const
|
|
7135
|
-
useEffect14(() => {
|
|
7136
|
-
if (isShowGroup && selectedTags?.length > 0) {
|
|
7137
|
-
setIsShowGroup(false);
|
|
7138
|
-
}
|
|
7139
|
-
}, [selectedTags]);
|
|
7140
|
-
const group_by_field_name = groupByDomain?.contexts[level - 1]?.group_by;
|
|
7105
|
+
const group_by_field_name = groupByList?.contexts[level - 1]?.group_by;
|
|
7141
7106
|
const nameGroup = Array.isArray(row[group_by_field_name]) ? row?.string ?? row[`${group_by_field_name}`][1] : viewData?.models?.[model]?.[group_by_field_name]?.selection ? viewData.models[model][group_by_field_name].selection.find(
|
|
7142
7107
|
(selectItem) => selectItem?.[0] === row[group_by_field_name]
|
|
7143
7108
|
)?.[1] : row[group_by_field_name];
|
|
7144
7109
|
const nameGroupWithCount = `${typeof nameGroup === "string" ? nameGroup : typeof nameGroup === "boolean" && nameGroup ? i18n_default.t("yes") : i18n_default.t("no")} (${row[`${group_by_field_name?.split(":")?.[0]}_count`]})`;
|
|
7145
7110
|
const allIdsNull = selectedRowKeys?.every((item) => item === void 0);
|
|
7146
|
-
const
|
|
7111
|
+
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
7112
|
+
const onExpandChildGroup = () => {
|
|
7147
7113
|
if (isLoading || isFetching) return;
|
|
7148
|
-
const toggleShowGroup = () => setIsShowGroup((prev) => !prev);
|
|
7149
7114
|
if (allIdsNull || typeTableGroup === "group") {
|
|
7150
7115
|
toggleShowGroup();
|
|
7151
7116
|
return;
|
|
@@ -7155,53 +7120,39 @@ var tableGroupController = (props) => {
|
|
|
7155
7120
|
const filteredIds = selectedRowKeys.filter(
|
|
7156
7121
|
(id) => !ids.includes(id)
|
|
7157
7122
|
);
|
|
7158
|
-
|
|
7159
|
-
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull
|
|
7123
|
+
setSelectedRowKeys3(filteredIds);
|
|
7124
|
+
} else if (!isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && checkedAll && !allIdsNull) {
|
|
7160
7125
|
const clonedKeys = [...selectedRowKeys];
|
|
7161
|
-
|
|
7162
|
-
setTimeout(() =>
|
|
7126
|
+
setSelectedRowKeys3([...clonedKeys, -1]);
|
|
7127
|
+
setTimeout(() => setSelectedRowKeys3(clonedKeys), 500);
|
|
7163
7128
|
} else if (isShowGroup && selectedRowKeys?.length > 0 && typeTableGroup === "list" && !checkedAll && !allIdsNull) {
|
|
7129
|
+
console.log("abc");
|
|
7164
7130
|
const filteredKeys = selectedRowKeys.filter((id) => id > -1);
|
|
7165
|
-
|
|
7131
|
+
setSelectedRowKeys3(filteredKeys);
|
|
7166
7132
|
}
|
|
7167
7133
|
toggleShowGroup();
|
|
7168
7134
|
};
|
|
7169
|
-
|
|
7170
|
-
if (!
|
|
7135
|
+
useEffect15(() => {
|
|
7136
|
+
if (!isDataGroupFetched || !rowsGroup || !checkedAll || allIdsNull || typeTableGroup === "group") {
|
|
7171
7137
|
return;
|
|
7172
7138
|
}
|
|
7173
7139
|
const clonedKeys = [...selectedRowKeys];
|
|
7174
|
-
|
|
7175
|
-
setTimeout(() =>
|
|
7176
|
-
}, [
|
|
7140
|
+
setSelectedRowKeys3([...clonedKeys, -1]);
|
|
7141
|
+
setTimeout(() => setSelectedRowKeys3(clonedKeys), 500);
|
|
7142
|
+
}, [isDataGroupFetched]);
|
|
7177
7143
|
return {
|
|
7178
|
-
|
|
7144
|
+
onExpandChildGroup,
|
|
7179
7145
|
colEmptyGroup,
|
|
7180
|
-
leftPadding,
|
|
7181
7146
|
isShowGroup,
|
|
7182
|
-
|
|
7147
|
+
isDataGroupFetched,
|
|
7148
|
+
isDataPlaceHolder,
|
|
7183
7149
|
nameGroupWithCount,
|
|
7184
|
-
columns,
|
|
7185
|
-
row,
|
|
7186
|
-
isPlaceholderData,
|
|
7187
7150
|
columnsGroup,
|
|
7188
|
-
indexRow,
|
|
7189
7151
|
rowsGroup,
|
|
7190
|
-
|
|
7191
|
-
viewData,
|
|
7192
|
-
renderField,
|
|
7193
|
-
level,
|
|
7194
|
-
specification,
|
|
7195
|
-
context,
|
|
7196
|
-
checkedAll,
|
|
7197
|
-
isDisplayCheckbox,
|
|
7198
|
-
isAutoSelect,
|
|
7199
|
-
setIsAutoSelect,
|
|
7200
|
-
selectedRowKeysRef,
|
|
7201
|
-
initVal,
|
|
7202
|
-
dataResponse,
|
|
7152
|
+
dataGroup,
|
|
7203
7153
|
pageGroup,
|
|
7204
|
-
setPageGroup
|
|
7154
|
+
setPageGroup,
|
|
7155
|
+
typeTableGroup
|
|
7205
7156
|
};
|
|
7206
7157
|
};
|
|
7207
7158
|
|
|
@@ -7214,7 +7165,7 @@ import {
|
|
|
7214
7165
|
evalJSONDomain as evalJSONDomain7,
|
|
7215
7166
|
validateAndParseDate
|
|
7216
7167
|
} from "@fctc/interface-logic/utils";
|
|
7217
|
-
import { useCallback as
|
|
7168
|
+
import { useCallback as useCallback4, useEffect as useEffect16, useState as useState16 } from "react";
|
|
7218
7169
|
var searchController = ({
|
|
7219
7170
|
viewData,
|
|
7220
7171
|
model,
|
|
@@ -7275,7 +7226,7 @@ var searchController = ({
|
|
|
7275
7226
|
}
|
|
7276
7227
|
}
|
|
7277
7228
|
};
|
|
7278
|
-
|
|
7229
|
+
useEffect16(() => {
|
|
7279
7230
|
fetchData();
|
|
7280
7231
|
}, [model, viewData]);
|
|
7281
7232
|
const onChangeSearchInput = (search_string) => {
|
|
@@ -7357,7 +7308,7 @@ var searchController = ({
|
|
|
7357
7308
|
return [...domain2];
|
|
7358
7309
|
}
|
|
7359
7310
|
};
|
|
7360
|
-
const setTagSearch =
|
|
7311
|
+
const setTagSearch = useCallback4(
|
|
7361
7312
|
(updatedMap) => {
|
|
7362
7313
|
if (!updatedMap) return;
|
|
7363
7314
|
const tagsSearch = Object.entries(updatedMap).map(
|
|
@@ -7420,7 +7371,7 @@ var searchController = ({
|
|
|
7420
7371
|
},
|
|
7421
7372
|
[searchMap]
|
|
7422
7373
|
);
|
|
7423
|
-
|
|
7374
|
+
useEffect16(() => {
|
|
7424
7375
|
setTagSearch(searchMap);
|
|
7425
7376
|
}, [searchMap]);
|
|
7426
7377
|
const handleAddTagSearch = (tag) => {
|
|
@@ -7488,6 +7439,13 @@ import * as constants_star from "@fctc/interface-logic/constants";
|
|
|
7488
7439
|
|
|
7489
7440
|
// src/index.ts
|
|
7490
7441
|
__reExport(index_exports, constants_exports);
|
|
7442
|
+
|
|
7443
|
+
// src/environment.ts
|
|
7444
|
+
var environment_exports = {};
|
|
7445
|
+
__reExport(environment_exports, environment_star);
|
|
7446
|
+
import * as environment_star from "@fctc/interface-logic/environment";
|
|
7447
|
+
|
|
7448
|
+
// src/index.ts
|
|
7491
7449
|
__reExport(index_exports, environment_exports);
|
|
7492
7450
|
__reExport(index_exports, provider_exports);
|
|
7493
7451
|
|
|
@@ -7555,7 +7513,6 @@ export {
|
|
|
7555
7513
|
useMenu,
|
|
7556
7514
|
useMenuItem,
|
|
7557
7515
|
useProfile,
|
|
7558
|
-
useSelectionState,
|
|
7559
7516
|
useStorageState,
|
|
7560
7517
|
useUser,
|
|
7561
7518
|
useViewV2
|