@fctc/widget-logic 1.1.6 → 1.1.8
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 +77 -1
- package/dist/hooks.d.ts +77 -1
- package/dist/hooks.js +268 -6
- package/dist/hooks.mjs +269 -4
- package/dist/index.d.mts +20 -71
- package/dist/index.d.ts +20 -71
- package/dist/index.js +425 -212
- package/dist/index.mjs +382 -180
- package/package.json +66 -66
package/dist/index.mjs
CHANGED
|
@@ -4646,8 +4646,129 @@ var useAuth = () => {
|
|
|
4646
4646
|
};
|
|
4647
4647
|
};
|
|
4648
4648
|
|
|
4649
|
+
// src/hooks/core/use-app-provider.tsx
|
|
4650
|
+
import { createContext, useContext, useMemo as useMemo7 } from "react";
|
|
4651
|
+
|
|
4652
|
+
// src/hooks/core/use-company.ts
|
|
4653
|
+
import {
|
|
4654
|
+
getEnv as getEnv4,
|
|
4655
|
+
useGetCompanyInfo,
|
|
4656
|
+
useGetCurrentCompany
|
|
4657
|
+
} from "@fctc/interface-logic";
|
|
4658
|
+
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4659
|
+
import { useEffect as useEffect6, useMemo as useMemo6 } from "react";
|
|
4660
|
+
var useCompany = (accessToken) => {
|
|
4661
|
+
const getCurrentCompany = useGetCurrentCompany();
|
|
4662
|
+
const fetchCurrentCompany = async () => {
|
|
4663
|
+
return await getCurrentCompany.mutateAsync();
|
|
4664
|
+
};
|
|
4665
|
+
const currentCompany = useQuery3({
|
|
4666
|
+
queryKey: ["currentCompany", accessToken],
|
|
4667
|
+
queryFn: fetchCurrentCompany,
|
|
4668
|
+
enabled: !!accessToken
|
|
4669
|
+
});
|
|
4670
|
+
const current_company_id = useMemo6(() => {
|
|
4671
|
+
return currentCompany.data?.current_company_id;
|
|
4672
|
+
}, [currentCompany.data]);
|
|
4673
|
+
useEffect6(() => {
|
|
4674
|
+
if (current_company_id) {
|
|
4675
|
+
const companyIDs = [current_company_id];
|
|
4676
|
+
const env = getEnv4();
|
|
4677
|
+
env.setAllowCompanies([...companyIDs]);
|
|
4678
|
+
env.setCompanies(companyIDs);
|
|
4679
|
+
}
|
|
4680
|
+
}, [current_company_id]);
|
|
4681
|
+
const getCompanyInfo = useGetCompanyInfo();
|
|
4682
|
+
const companyInfo = useQuery3({
|
|
4683
|
+
queryKey: ["companyInfoQuery", current_company_id, accessToken],
|
|
4684
|
+
queryFn: () => getCompanyInfo.mutateAsync(Number(current_company_id)),
|
|
4685
|
+
enabled: !!current_company_id && !!accessToken
|
|
4686
|
+
});
|
|
4687
|
+
useEffect6(() => {
|
|
4688
|
+
if (companyInfo.data) {
|
|
4689
|
+
const companyInfoData = companyInfo.data;
|
|
4690
|
+
if (companyInfoData?.length) {
|
|
4691
|
+
const env = getEnv4();
|
|
4692
|
+
env.setDefaultCompany(companyInfoData[0]);
|
|
4693
|
+
}
|
|
4694
|
+
}
|
|
4695
|
+
}, [companyInfo.data]);
|
|
4696
|
+
return {
|
|
4697
|
+
currentCompany,
|
|
4698
|
+
companyInfo,
|
|
4699
|
+
context: { allowed_company_ids: [current_company_id] }
|
|
4700
|
+
};
|
|
4701
|
+
};
|
|
4702
|
+
var use_company_default = useCompany;
|
|
4703
|
+
|
|
4704
|
+
// src/hooks/core/use-app-provider.tsx
|
|
4705
|
+
import { evalJSONContext } from "@fctc/interface-logic";
|
|
4706
|
+
import { jsx } from "react/jsx-runtime";
|
|
4707
|
+
var AppProviderInitialValue = {
|
|
4708
|
+
config: {},
|
|
4709
|
+
user: {},
|
|
4710
|
+
auth: {},
|
|
4711
|
+
company: {},
|
|
4712
|
+
action: {},
|
|
4713
|
+
menu: {},
|
|
4714
|
+
view: {},
|
|
4715
|
+
list: {}
|
|
4716
|
+
};
|
|
4717
|
+
var ReactContext = createContext(AppProviderInitialValue);
|
|
4718
|
+
var AppProvider = ({ children }) => {
|
|
4719
|
+
const config = useConfig({});
|
|
4720
|
+
const auth = useAuth();
|
|
4721
|
+
const user = useUser(auth.accessToken);
|
|
4722
|
+
const company = use_company_default(auth.accessToken);
|
|
4723
|
+
const menuContext = useMemo7(() => {
|
|
4724
|
+
return combineContexts([user.context, company.context]);
|
|
4725
|
+
}, [user.context, company.context]);
|
|
4726
|
+
const menu = useMenu({ context: menuContext });
|
|
4727
|
+
const action = useMemo7(() => {
|
|
4728
|
+
return menu.state.action;
|
|
4729
|
+
}, [menu.state.action]);
|
|
4730
|
+
const viewContext = useMemo7(() => {
|
|
4731
|
+
return combineContexts([
|
|
4732
|
+
menuContext,
|
|
4733
|
+
{ ...evalJSONContext(action?.result?.context) }
|
|
4734
|
+
]);
|
|
4735
|
+
}, [menuContext, action?.result?.context]);
|
|
4736
|
+
const view = useViewV2({
|
|
4737
|
+
action,
|
|
4738
|
+
context: viewContext
|
|
4739
|
+
});
|
|
4740
|
+
const list = useListData({
|
|
4741
|
+
action,
|
|
4742
|
+
viewResponse: view.data,
|
|
4743
|
+
context: viewContext
|
|
4744
|
+
});
|
|
4745
|
+
return /* @__PURE__ */ jsx(
|
|
4746
|
+
ReactContext.Provider,
|
|
4747
|
+
{
|
|
4748
|
+
value: {
|
|
4749
|
+
config,
|
|
4750
|
+
auth,
|
|
4751
|
+
user,
|
|
4752
|
+
company,
|
|
4753
|
+
menu,
|
|
4754
|
+
list,
|
|
4755
|
+
action,
|
|
4756
|
+
view
|
|
4757
|
+
},
|
|
4758
|
+
children
|
|
4759
|
+
}
|
|
4760
|
+
);
|
|
4761
|
+
};
|
|
4762
|
+
var useAppProvider = () => {
|
|
4763
|
+
const context = useContext(ReactContext);
|
|
4764
|
+
if (!context) {
|
|
4765
|
+
return AppProviderInitialValue;
|
|
4766
|
+
}
|
|
4767
|
+
return context;
|
|
4768
|
+
};
|
|
4769
|
+
|
|
4649
4770
|
// src/hooks/utils/use-click-outside.ts
|
|
4650
|
-
import { useEffect as
|
|
4771
|
+
import { useEffect as useEffect7, useRef as useRef2 } from "react";
|
|
4651
4772
|
var DEFAULT_EVENTS = ["mousedown", "touchstart"];
|
|
4652
4773
|
var useClickOutside = ({
|
|
4653
4774
|
handler,
|
|
@@ -4656,7 +4777,7 @@ var useClickOutside = ({
|
|
|
4656
4777
|
refs
|
|
4657
4778
|
}) => {
|
|
4658
4779
|
const ref = useRef2(null);
|
|
4659
|
-
|
|
4780
|
+
useEffect7(() => {
|
|
4660
4781
|
const listener = (event) => {
|
|
4661
4782
|
const { target } = event;
|
|
4662
4783
|
if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
|
|
@@ -4678,10 +4799,10 @@ var useClickOutside = ({
|
|
|
4678
4799
|
};
|
|
4679
4800
|
|
|
4680
4801
|
// src/hooks/utils/use-debounce.ts
|
|
4681
|
-
import { useEffect as
|
|
4802
|
+
import { useEffect as useEffect8, useState as useState5 } from "react";
|
|
4682
4803
|
function useDebounce(value, delay) {
|
|
4683
4804
|
const [debouncedValue, setDebouncedValue] = useState5(value);
|
|
4684
|
-
|
|
4805
|
+
useEffect8(() => {
|
|
4685
4806
|
const handler = setTimeout(() => {
|
|
4686
4807
|
setDebouncedValue(value);
|
|
4687
4808
|
}, delay);
|
|
@@ -4692,8 +4813,136 @@ function useDebounce(value, delay) {
|
|
|
4692
4813
|
return [debouncedValue];
|
|
4693
4814
|
}
|
|
4694
4815
|
|
|
4816
|
+
// src/hooks/api/use-switch-locale.ts
|
|
4817
|
+
import {
|
|
4818
|
+
getEnv as getEnv5,
|
|
4819
|
+
selectEnv,
|
|
4820
|
+
useAppSelector as useAppSelector2,
|
|
4821
|
+
useSwitchLocale
|
|
4822
|
+
} from "@fctc/interface-logic";
|
|
4823
|
+
import { useCallback as useCallback2 } from "react";
|
|
4824
|
+
var useSwitchLocaleHandler = () => {
|
|
4825
|
+
const switchUserLocale = useSwitchLocale();
|
|
4826
|
+
const env = getEnv5();
|
|
4827
|
+
const { context } = useAppSelector2(selectEnv);
|
|
4828
|
+
const switchLocale = useCallback2(
|
|
4829
|
+
async (langId) => {
|
|
4830
|
+
if (!langId) return;
|
|
4831
|
+
await switchUserLocale.mutateAsync({
|
|
4832
|
+
data: {
|
|
4833
|
+
id: parseInt(context?.uid),
|
|
4834
|
+
values: { lang: langId }
|
|
4835
|
+
}
|
|
4836
|
+
});
|
|
4837
|
+
env.setLang(langId);
|
|
4838
|
+
},
|
|
4839
|
+
[switchUserLocale]
|
|
4840
|
+
);
|
|
4841
|
+
return {
|
|
4842
|
+
switchLocale,
|
|
4843
|
+
isLoading: switchUserLocale.isPending,
|
|
4844
|
+
error: switchUserLocale.error
|
|
4845
|
+
};
|
|
4846
|
+
};
|
|
4847
|
+
|
|
4848
|
+
// src/hooks/api/use-login.ts
|
|
4849
|
+
import { useLoginCredential as useLoginCredential2 } from "@fctc/interface-logic";
|
|
4850
|
+
import { useCallback as useCallback3 } from "react";
|
|
4851
|
+
var useLoginHandler = () => {
|
|
4852
|
+
const loginMutate = useLoginCredential2();
|
|
4853
|
+
const login = useCallback3(
|
|
4854
|
+
({
|
|
4855
|
+
email,
|
|
4856
|
+
password,
|
|
4857
|
+
path
|
|
4858
|
+
}, {
|
|
4859
|
+
onSuccess,
|
|
4860
|
+
onError
|
|
4861
|
+
}) => {
|
|
4862
|
+
loginMutate.mutate(
|
|
4863
|
+
{
|
|
4864
|
+
email,
|
|
4865
|
+
password,
|
|
4866
|
+
path
|
|
4867
|
+
},
|
|
4868
|
+
{
|
|
4869
|
+
onSuccess,
|
|
4870
|
+
onError
|
|
4871
|
+
}
|
|
4872
|
+
);
|
|
4873
|
+
},
|
|
4874
|
+
[loginMutate]
|
|
4875
|
+
);
|
|
4876
|
+
return {
|
|
4877
|
+
login,
|
|
4878
|
+
isLoading: loginMutate.isPending,
|
|
4879
|
+
error: loginMutate.error
|
|
4880
|
+
};
|
|
4881
|
+
};
|
|
4882
|
+
|
|
4883
|
+
// src/hooks/api/use-forgot-password.ts
|
|
4884
|
+
import { useForgotPassword } from "@fctc/interface-logic";
|
|
4885
|
+
import { useCallback as useCallback4 } from "react";
|
|
4886
|
+
var useForgotPasswordHandler = () => {
|
|
4887
|
+
const forgotPasswordMutate = useForgotPassword();
|
|
4888
|
+
const sendForgotPassword = useCallback4(
|
|
4889
|
+
(email, {
|
|
4890
|
+
onSuccess,
|
|
4891
|
+
onError
|
|
4892
|
+
} = {}) => {
|
|
4893
|
+
forgotPasswordMutate.mutate(email, {
|
|
4894
|
+
onSuccess,
|
|
4895
|
+
onError
|
|
4896
|
+
});
|
|
4897
|
+
},
|
|
4898
|
+
[forgotPasswordMutate]
|
|
4899
|
+
);
|
|
4900
|
+
return {
|
|
4901
|
+
sendForgotPassword,
|
|
4902
|
+
isLoading: forgotPasswordMutate.isPending,
|
|
4903
|
+
error: forgotPasswordMutate.error
|
|
4904
|
+
};
|
|
4905
|
+
};
|
|
4906
|
+
|
|
4907
|
+
// src/hooks/api/use-reset-password.ts
|
|
4908
|
+
import { useResetPassword } from "@fctc/interface-logic";
|
|
4909
|
+
import { useCallback as useCallback5 } from "react";
|
|
4910
|
+
var useResetPasswordHandler = () => {
|
|
4911
|
+
const resetPasswordMutate = useResetPassword();
|
|
4912
|
+
const resetPassword = useCallback5(
|
|
4913
|
+
({
|
|
4914
|
+
password,
|
|
4915
|
+
confirmPassword,
|
|
4916
|
+
token
|
|
4917
|
+
}, {
|
|
4918
|
+
onSuccess,
|
|
4919
|
+
onError
|
|
4920
|
+
}) => {
|
|
4921
|
+
resetPasswordMutate.mutate(
|
|
4922
|
+
{
|
|
4923
|
+
data: {
|
|
4924
|
+
password,
|
|
4925
|
+
confirmPassword
|
|
4926
|
+
},
|
|
4927
|
+
token
|
|
4928
|
+
},
|
|
4929
|
+
{
|
|
4930
|
+
onSuccess,
|
|
4931
|
+
onError
|
|
4932
|
+
}
|
|
4933
|
+
);
|
|
4934
|
+
},
|
|
4935
|
+
[resetPasswordMutate]
|
|
4936
|
+
);
|
|
4937
|
+
return {
|
|
4938
|
+
resetPassword,
|
|
4939
|
+
isLoading: resetPasswordMutate.isPending,
|
|
4940
|
+
error: resetPasswordMutate.error
|
|
4941
|
+
};
|
|
4942
|
+
};
|
|
4943
|
+
|
|
4695
4944
|
// src/icons/eye-icon.tsx
|
|
4696
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4945
|
+
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
4697
4946
|
var EyeIcon = () => /* @__PURE__ */ jsxs(
|
|
4698
4947
|
"svg",
|
|
4699
4948
|
{
|
|
@@ -4703,7 +4952,7 @@ var EyeIcon = () => /* @__PURE__ */ jsxs(
|
|
|
4703
4952
|
fill: "none",
|
|
4704
4953
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4705
4954
|
children: [
|
|
4706
|
-
/* @__PURE__ */
|
|
4955
|
+
/* @__PURE__ */ jsx2(
|
|
4707
4956
|
"path",
|
|
4708
4957
|
{
|
|
4709
4958
|
d: "M2.72904 13.5776C2.02076 12.6574 1.66663 12.1974 1.66663 10.8312C1.66663 9.46507 2.02076 9.00499 2.72904 8.08483C4.14326 6.24752 6.51505 4.16455 9.99996 4.16455C13.4849 4.16455 15.8567 6.24752 17.2709 8.08483C17.9792 9.00499 18.3333 9.46507 18.3333 10.8312C18.3333 12.1974 17.9792 12.6574 17.2709 13.5776C15.8567 15.4149 13.4849 17.4979 9.99996 17.4979C6.51505 17.4979 4.14326 15.4149 2.72904 13.5776Z",
|
|
@@ -4711,7 +4960,7 @@ var EyeIcon = () => /* @__PURE__ */ jsxs(
|
|
|
4711
4960
|
strokeWidth: "1.5"
|
|
4712
4961
|
}
|
|
4713
4962
|
),
|
|
4714
|
-
/* @__PURE__ */
|
|
4963
|
+
/* @__PURE__ */ jsx2(
|
|
4715
4964
|
"path",
|
|
4716
4965
|
{
|
|
4717
4966
|
d: "M12.5 10.8311C12.5 12.2118 11.3807 13.3311 10 13.3311C8.61929 13.3311 7.5 12.2118 7.5 10.8311C7.5 9.45034 8.61929 8.33105 10 8.33105C11.3807 8.33105 12.5 9.45034 12.5 10.8311Z",
|
|
@@ -4724,13 +4973,13 @@ var EyeIcon = () => /* @__PURE__ */ jsxs(
|
|
|
4724
4973
|
);
|
|
4725
4974
|
|
|
4726
4975
|
// src/icons/loading-icon.tsx
|
|
4727
|
-
import { jsx as
|
|
4976
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
4728
4977
|
var LoadingIcon = ({
|
|
4729
4978
|
width = 15,
|
|
4730
4979
|
height = 15,
|
|
4731
4980
|
...props
|
|
4732
4981
|
}) => {
|
|
4733
|
-
return /* @__PURE__ */
|
|
4982
|
+
return /* @__PURE__ */ jsx3(
|
|
4734
4983
|
"svg",
|
|
4735
4984
|
{
|
|
4736
4985
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4746,7 +4995,7 @@ var LoadingIcon = ({
|
|
|
4746
4995
|
},
|
|
4747
4996
|
...props,
|
|
4748
4997
|
children: /* @__PURE__ */ jsxs2("g", { children: [
|
|
4749
|
-
/* @__PURE__ */
|
|
4998
|
+
/* @__PURE__ */ jsx3(
|
|
4750
4999
|
"circle",
|
|
4751
5000
|
{
|
|
4752
5001
|
strokeDasharray: "141.37166941154067 49.12388980384689",
|
|
@@ -4756,7 +5005,7 @@ var LoadingIcon = ({
|
|
|
4756
5005
|
fill: "none",
|
|
4757
5006
|
cy: "50",
|
|
4758
5007
|
cx: "50",
|
|
4759
|
-
children: /* @__PURE__ */
|
|
5008
|
+
children: /* @__PURE__ */ jsx3(
|
|
4760
5009
|
"animateTransform",
|
|
4761
5010
|
{
|
|
4762
5011
|
keyTimes: "0;1",
|
|
@@ -4769,16 +5018,16 @@ var LoadingIcon = ({
|
|
|
4769
5018
|
)
|
|
4770
5019
|
}
|
|
4771
5020
|
),
|
|
4772
|
-
/* @__PURE__ */
|
|
5021
|
+
/* @__PURE__ */ jsx3("g", {})
|
|
4773
5022
|
] })
|
|
4774
5023
|
}
|
|
4775
5024
|
);
|
|
4776
5025
|
};
|
|
4777
5026
|
|
|
4778
5027
|
// src/icons/close-icon.tsx
|
|
4779
|
-
import { jsx as
|
|
5028
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
4780
5029
|
var CloseIcon = ({ className = "" }) => {
|
|
4781
|
-
return /* @__PURE__ */
|
|
5030
|
+
return /* @__PURE__ */ jsx4(
|
|
4782
5031
|
"svg",
|
|
4783
5032
|
{
|
|
4784
5033
|
width: "24",
|
|
@@ -4787,7 +5036,7 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
4787
5036
|
fill: "none",
|
|
4788
5037
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4789
5038
|
className,
|
|
4790
|
-
children: /* @__PURE__ */
|
|
5039
|
+
children: /* @__PURE__ */ jsx4(
|
|
4791
5040
|
"path",
|
|
4792
5041
|
{
|
|
4793
5042
|
d: "M12.0001 10.7275L16.4551 6.27246L17.7277 7.54506L13.2727 12.0001L17.7277 16.4551L16.4551 17.7277L12.0001 13.2727L7.54506 17.7277L6.27246 16.4551L10.7275 12.0001L6.27246 7.54506L7.54506 6.27246L12.0001 10.7275Z",
|
|
@@ -4799,11 +5048,11 @@ var CloseIcon = ({ className = "" }) => {
|
|
|
4799
5048
|
};
|
|
4800
5049
|
|
|
4801
5050
|
// src/widget/basic/status-dropdown-field/controller.ts
|
|
4802
|
-
import { useEffect as
|
|
4803
|
-
import { getEnv as
|
|
5051
|
+
import { useEffect as useEffect9, useRef as useRef3, useState as useState6 } from "react";
|
|
5052
|
+
import { getEnv as getEnv6, useSave } from "@fctc/interface-logic";
|
|
4804
5053
|
var statusDropdownController = (props) => {
|
|
4805
5054
|
const { selection, isForm, id, model, name, state, onRefetch } = props;
|
|
4806
|
-
const env =
|
|
5055
|
+
const env = getEnv6();
|
|
4807
5056
|
const colors = {
|
|
4808
5057
|
normal: "bg-[#e9ecef]",
|
|
4809
5058
|
done: "bg-primary",
|
|
@@ -4811,7 +5060,7 @@ var statusDropdownController = (props) => {
|
|
|
4811
5060
|
};
|
|
4812
5061
|
const [isOpen, setIsOpen] = useState6(false);
|
|
4813
5062
|
const buttonRef = useRef3(null);
|
|
4814
|
-
|
|
5063
|
+
useEffect9(() => {
|
|
4815
5064
|
const handleClickOutside = (event) => {
|
|
4816
5065
|
if (buttonRef.current && !buttonRef.current.contains(event.target)) {
|
|
4817
5066
|
setIsOpen(false);
|
|
@@ -4852,14 +5101,14 @@ var statusDropdownController = (props) => {
|
|
|
4852
5101
|
};
|
|
4853
5102
|
|
|
4854
5103
|
// src/widget/basic/many2one-field/controller.ts
|
|
4855
|
-
import { useCallback as
|
|
5104
|
+
import { useCallback as useCallback6, useEffect as useEffect10, useMemo as useMemo8, useState as useState7 } from "react";
|
|
4856
5105
|
import {
|
|
4857
|
-
evalJSONContext,
|
|
5106
|
+
evalJSONContext as evalJSONContext2,
|
|
4858
5107
|
evalJSONDomain as evalJSONDomain2,
|
|
4859
|
-
selectEnv,
|
|
5108
|
+
selectEnv as selectEnv2,
|
|
4860
5109
|
selectNavbar,
|
|
4861
5110
|
setListSubject,
|
|
4862
|
-
useAppSelector as
|
|
5111
|
+
useAppSelector as useAppSelector3,
|
|
4863
5112
|
useGetSelection
|
|
4864
5113
|
} from "@fctc/interface-logic";
|
|
4865
5114
|
var many2oneFieldController = (props) => {
|
|
@@ -4879,21 +5128,21 @@ var many2oneFieldController = (props) => {
|
|
|
4879
5128
|
const [options, setOptions] = useState7([]);
|
|
4880
5129
|
const [isShowModalMany2Many, setIsShowModalMany2Many] = useState7(false);
|
|
4881
5130
|
const [tempSelectedOption, setTempSelectedOption] = useState7(null);
|
|
4882
|
-
const { menuList } =
|
|
4883
|
-
const { context } =
|
|
5131
|
+
const { menuList } = useAppSelector3(selectNavbar);
|
|
5132
|
+
const { context } = useAppSelector3(selectEnv2);
|
|
4884
5133
|
const [domainModal, setDomainModal] = useState7(null);
|
|
4885
5134
|
const initValue = methods?.getValues(name);
|
|
4886
|
-
const domainObject =
|
|
5135
|
+
const domainObject = useMemo8(
|
|
4887
5136
|
() => evalJSONDomain2(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
|
|
4888
5137
|
[domain, formValues]
|
|
4889
5138
|
);
|
|
4890
|
-
const optionsObject =
|
|
5139
|
+
const optionsObject = evalJSONContext2(fieldOptions) || {};
|
|
4891
5140
|
const contextObject = {
|
|
4892
|
-
...
|
|
5141
|
+
...evalJSONContext2(actionData?.context) || {},
|
|
4893
5142
|
...fieldContext,
|
|
4894
5143
|
...context
|
|
4895
5144
|
};
|
|
4896
|
-
const actionId =
|
|
5145
|
+
const actionId = useMemo8(
|
|
4897
5146
|
() => menuList?.flatMap(
|
|
4898
5147
|
(item) => item?.child_id.filter(
|
|
4899
5148
|
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
@@ -4914,25 +5163,25 @@ var many2oneFieldController = (props) => {
|
|
|
4914
5163
|
const queryKey = [`data_${relation}`, domainObject];
|
|
4915
5164
|
const {
|
|
4916
5165
|
data: dataOfSelection,
|
|
4917
|
-
|
|
5166
|
+
refetch,
|
|
4918
5167
|
isFetching
|
|
4919
5168
|
} = useGetSelection({
|
|
4920
5169
|
data,
|
|
4921
5170
|
queryKey,
|
|
4922
5171
|
enabled: false
|
|
4923
5172
|
});
|
|
4924
|
-
const selectOptions =
|
|
5173
|
+
const selectOptions = useMemo8(() => {
|
|
4925
5174
|
return dataOfSelection?.records?.map((val) => ({
|
|
4926
5175
|
value: val?.id,
|
|
4927
5176
|
label: val?.display_name || val?.name
|
|
4928
5177
|
})) || [];
|
|
4929
5178
|
}, [dataOfSelection]);
|
|
4930
|
-
|
|
5179
|
+
useEffect10(() => {
|
|
4931
5180
|
setOptions(selectOptions);
|
|
4932
5181
|
setDomainModal(domainObject);
|
|
4933
5182
|
if (relation === "student.subject") setListSubject(selectOptions);
|
|
4934
5183
|
}, [selectOptions]);
|
|
4935
|
-
|
|
5184
|
+
useEffect10(() => {
|
|
4936
5185
|
if (!propValue && tempSelectedOption) {
|
|
4937
5186
|
methods.setValue(name, null);
|
|
4938
5187
|
setTempSelectedOption(null);
|
|
@@ -4943,12 +5192,15 @@ var many2oneFieldController = (props) => {
|
|
|
4943
5192
|
});
|
|
4944
5193
|
}
|
|
4945
5194
|
}, [propValue]);
|
|
4946
|
-
|
|
5195
|
+
const fetchMoreOptions = useCallback6(() => {
|
|
5196
|
+
refetch();
|
|
5197
|
+
}, [refetch]);
|
|
5198
|
+
useEffect10(() => {
|
|
4947
5199
|
if (actionId) {
|
|
4948
5200
|
localStorage.setItem("aid", actionId);
|
|
4949
5201
|
}
|
|
4950
5202
|
}, [actionId]);
|
|
4951
|
-
const handleChooseRecord =
|
|
5203
|
+
const handleChooseRecord = useCallback6(
|
|
4952
5204
|
(idRecord) => {
|
|
4953
5205
|
const newOption = options.find(
|
|
4954
5206
|
(option) => option.value === idRecord
|
|
@@ -4973,8 +5225,8 @@ var many2oneFieldController = (props) => {
|
|
|
4973
5225
|
},
|
|
4974
5226
|
[options, methods, name, onChange]
|
|
4975
5227
|
);
|
|
4976
|
-
const handleClose =
|
|
4977
|
-
const handleSelectChange =
|
|
5228
|
+
const handleClose = useCallback6(() => setIsShowModalMany2Many(false), []);
|
|
5229
|
+
const handleSelectChange = useCallback6(
|
|
4978
5230
|
(selectedOption) => {
|
|
4979
5231
|
if (!selectedOption) {
|
|
4980
5232
|
methods.setValue(name, null, { shouldDirty: true });
|
|
@@ -5008,13 +5260,13 @@ var many2oneFieldController = (props) => {
|
|
|
5008
5260
|
isFetching,
|
|
5009
5261
|
isShowModalMany2Many,
|
|
5010
5262
|
options,
|
|
5011
|
-
|
|
5263
|
+
fetchMoreOptions,
|
|
5012
5264
|
domainModal,
|
|
5013
5265
|
tempSelectedOption,
|
|
5014
5266
|
setTempSelectedOption,
|
|
5015
5267
|
setDomainModal,
|
|
5016
5268
|
dataOfSelection,
|
|
5017
|
-
|
|
5269
|
+
refetch,
|
|
5018
5270
|
selectOptions,
|
|
5019
5271
|
optionsObject,
|
|
5020
5272
|
contextObject,
|
|
@@ -5025,22 +5277,22 @@ var many2oneFieldController = (props) => {
|
|
|
5025
5277
|
|
|
5026
5278
|
// src/widget/basic/many2one-button-field/controller.ts
|
|
5027
5279
|
import {
|
|
5028
|
-
evalJSONContext as
|
|
5280
|
+
evalJSONContext as evalJSONContext3,
|
|
5029
5281
|
evalJSONDomain as evalJSONDomain3,
|
|
5030
|
-
getEnv as
|
|
5282
|
+
getEnv as getEnv7,
|
|
5031
5283
|
useGetSelection as useGetSelection2
|
|
5032
5284
|
} from "@fctc/interface-logic";
|
|
5033
5285
|
var many2oneButtonController = (props) => {
|
|
5034
5286
|
const { domain, methods, relation } = props;
|
|
5035
5287
|
const actionDataString = sessionStorage.getItem("actionData");
|
|
5036
|
-
const env =
|
|
5288
|
+
const env = getEnv7();
|
|
5037
5289
|
const domainObject = evalJSONDomain3(domain, methods?.getValues() || {});
|
|
5038
5290
|
const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
|
|
5039
5291
|
const { data: dataOfSelection } = useGetSelection2({
|
|
5040
5292
|
data: {
|
|
5041
5293
|
model: relation ?? "",
|
|
5042
5294
|
domain: domainObject,
|
|
5043
|
-
context: { ...env.context, ...
|
|
5295
|
+
context: { ...env.context, ...evalJSONContext3(actionData?.context) }
|
|
5044
5296
|
},
|
|
5045
5297
|
queryKey: [`data_${relation}`, domainObject]
|
|
5046
5298
|
});
|
|
@@ -5054,44 +5306,32 @@ var many2oneButtonController = (props) => {
|
|
|
5054
5306
|
};
|
|
5055
5307
|
|
|
5056
5308
|
// src/widget/basic/many2many-field/controller.ts
|
|
5057
|
-
import { useEffect as
|
|
5309
|
+
import { useEffect as useEffect12, useMemo as useMemo10, useState as useState9 } from "react";
|
|
5058
5310
|
import {
|
|
5059
|
-
evalJSONContext as
|
|
5311
|
+
evalJSONContext as evalJSONContext4,
|
|
5060
5312
|
formatSortingString as formatSortingString2,
|
|
5061
|
-
getEnv as
|
|
5062
|
-
selectSearch as
|
|
5313
|
+
getEnv as getEnv8,
|
|
5314
|
+
selectSearch as selectSearch3,
|
|
5063
5315
|
setFirstDomain,
|
|
5064
5316
|
setGroupByDomain,
|
|
5065
5317
|
setPage,
|
|
5066
5318
|
setViewDataStore,
|
|
5067
|
-
useAppDispatch as
|
|
5068
|
-
useAppSelector as
|
|
5319
|
+
useAppDispatch as useAppDispatch5,
|
|
5320
|
+
useAppSelector as useAppSelector5,
|
|
5069
5321
|
useGetFormView,
|
|
5070
|
-
useGetListData as
|
|
5322
|
+
useGetListData as useGetListData2,
|
|
5071
5323
|
useGetView as useGetView2,
|
|
5072
5324
|
useModel as useModel2
|
|
5073
5325
|
} from "@fctc/interface-logic";
|
|
5074
5326
|
|
|
5075
|
-
// src/widget/advance/table/table-body/controller.ts
|
|
5076
|
-
import { setSelectedRowKeys, useAppDispatch as useAppDispatch5 } from "@fctc/interface-logic";
|
|
5077
|
-
import { useEffect as useEffect10, useMemo as useMemo7 } from "react";
|
|
5078
|
-
|
|
5079
|
-
// src/widget/advance/table/table-head/controller.ts
|
|
5080
|
-
import {
|
|
5081
|
-
selectSearch as selectSearch2,
|
|
5082
|
-
setSelectedRowKeys as setSelectedRowKeys2,
|
|
5083
|
-
useAppDispatch as useAppDispatch6,
|
|
5084
|
-
useAppSelector as useAppSelector3
|
|
5085
|
-
} from "@fctc/interface-logic";
|
|
5086
|
-
|
|
5087
5327
|
// src/widget/advance/table/table-view/controller.ts
|
|
5088
5328
|
import {
|
|
5089
5329
|
domainHelper,
|
|
5090
5330
|
selectList as selectList2,
|
|
5091
|
-
selectSearch as
|
|
5331
|
+
selectSearch as selectSearch2,
|
|
5092
5332
|
useAppSelector as useAppSelector4
|
|
5093
5333
|
} from "@fctc/interface-logic";
|
|
5094
|
-
import { useEffect as useEffect11, useMemo as
|
|
5334
|
+
import { useEffect as useEffect11, useMemo as useMemo9, useRef as useRef4, useState as useState8 } from "react";
|
|
5095
5335
|
var tableController = ({ data }) => {
|
|
5096
5336
|
const [rows, setRows] = useState8(data.records || []);
|
|
5097
5337
|
const [columns, setColumns] = useState8([]);
|
|
@@ -5167,41 +5407,6 @@ var tableController = ({ data }) => {
|
|
|
5167
5407
|
};
|
|
5168
5408
|
};
|
|
5169
5409
|
|
|
5170
|
-
// src/widget/advance/table/table-group/controller.ts
|
|
5171
|
-
import {
|
|
5172
|
-
getEnv as getEnv6,
|
|
5173
|
-
selectList as selectList3,
|
|
5174
|
-
selectSearch as selectSearch4,
|
|
5175
|
-
setSelectedRowKeys as setSelectedRowKeys3,
|
|
5176
|
-
useAppDispatch as useAppDispatch7,
|
|
5177
|
-
useAppSelector as useAppSelector5,
|
|
5178
|
-
useGetListData as useGetListData2,
|
|
5179
|
-
useOdooDataTransform
|
|
5180
|
-
} from "@fctc/interface-logic";
|
|
5181
|
-
import { useEffect as useEffect12, useMemo as useMemo9, useState as useState9 } from "react";
|
|
5182
|
-
|
|
5183
|
-
// src/utils/i18n.ts
|
|
5184
|
-
import { initReactI18next } from "react-i18next";
|
|
5185
|
-
import i18n from "i18next";
|
|
5186
|
-
import LanguageDetector from "i18next-browser-languagedetector";
|
|
5187
|
-
i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
5188
|
-
resources: {
|
|
5189
|
-
vi: { translation: vi },
|
|
5190
|
-
en: { translation: en }
|
|
5191
|
-
},
|
|
5192
|
-
fallbackLng: "vi",
|
|
5193
|
-
lng: "vi_VN",
|
|
5194
|
-
debug: false,
|
|
5195
|
-
nonExplicitSupportedLngs: true,
|
|
5196
|
-
interpolation: {
|
|
5197
|
-
escapeValue: false
|
|
5198
|
-
},
|
|
5199
|
-
detection: {
|
|
5200
|
-
caches: ["cookie"]
|
|
5201
|
-
}
|
|
5202
|
-
});
|
|
5203
|
-
var i18n_default = i18n;
|
|
5204
|
-
|
|
5205
5410
|
// src/widget/basic/many2many-field/controller.ts
|
|
5206
5411
|
var many2manyFieldController = (props) => {
|
|
5207
5412
|
const {
|
|
@@ -5211,7 +5416,7 @@ var many2manyFieldController = (props) => {
|
|
|
5211
5416
|
tab,
|
|
5212
5417
|
model,
|
|
5213
5418
|
aid,
|
|
5214
|
-
setSelectedRowKeys
|
|
5419
|
+
setSelectedRowKeys,
|
|
5215
5420
|
fields,
|
|
5216
5421
|
setFields,
|
|
5217
5422
|
groupByDomain,
|
|
@@ -5219,17 +5424,14 @@ var many2manyFieldController = (props) => {
|
|
|
5219
5424
|
options,
|
|
5220
5425
|
sessionStorageUtils
|
|
5221
5426
|
} = props;
|
|
5222
|
-
const appDispatch =
|
|
5427
|
+
const appDispatch = useAppDispatch5();
|
|
5223
5428
|
const actionData = sessionStorageUtils.getActionData();
|
|
5224
5429
|
const [debouncedPage] = useDebounce(page, 500);
|
|
5225
|
-
const [order, setOrder] =
|
|
5226
|
-
const [isLoadedData, setIsLoadedData] =
|
|
5227
|
-
const [domainMany2Many, setDomainMany2Many] =
|
|
5228
|
-
const env =
|
|
5229
|
-
const {
|
|
5230
|
-
// tableHead,
|
|
5231
|
-
selectedTags
|
|
5232
|
-
} = useAppSelector6(selectSearch5);
|
|
5430
|
+
const [order, setOrder] = useState9();
|
|
5431
|
+
const [isLoadedData, setIsLoadedData] = useState9(false);
|
|
5432
|
+
const [domainMany2Many, setDomainMany2Many] = useState9(domain);
|
|
5433
|
+
const env = getEnv8();
|
|
5434
|
+
const { selectedTags } = useAppSelector5(selectSearch3);
|
|
5233
5435
|
const viewParams = {
|
|
5234
5436
|
model: relation,
|
|
5235
5437
|
views: [
|
|
@@ -5268,7 +5470,7 @@ var many2manyFieldController = (props) => {
|
|
|
5268
5470
|
return null;
|
|
5269
5471
|
}, [modelInstance]);
|
|
5270
5472
|
const default_order = viewResponse && viewResponse?.views?.list?.default_order;
|
|
5271
|
-
const optionsObject = tab?.options ?
|
|
5473
|
+
const optionsObject = tab?.options ? evalJSONContext4(tab?.options) : (options ? evalJSONContext4(options) : {}) || {};
|
|
5272
5474
|
const fetchData = async () => {
|
|
5273
5475
|
try {
|
|
5274
5476
|
setDomainMany2Many(domain);
|
|
@@ -5314,8 +5516,8 @@ var many2manyFieldController = (props) => {
|
|
|
5314
5516
|
isLoading: isDataLoading,
|
|
5315
5517
|
isFetched: isDataResponseFetched,
|
|
5316
5518
|
isPlaceholderData
|
|
5317
|
-
} =
|
|
5318
|
-
|
|
5519
|
+
} = useGetListData2(data, queryKey, enabled);
|
|
5520
|
+
useEffect12(() => {
|
|
5319
5521
|
if (viewResponse) {
|
|
5320
5522
|
fetchData();
|
|
5321
5523
|
}
|
|
@@ -5326,7 +5528,7 @@ var many2manyFieldController = (props) => {
|
|
|
5326
5528
|
[`${aid}_${relation}_popupmany2many`]: null
|
|
5327
5529
|
}));
|
|
5328
5530
|
appDispatch(setPage(0));
|
|
5329
|
-
|
|
5531
|
+
setSelectedRowKeys([]);
|
|
5330
5532
|
setDomainMany2Many(null);
|
|
5331
5533
|
setIsLoadedData(false);
|
|
5332
5534
|
};
|
|
@@ -5354,13 +5556,13 @@ var many2manyFieldController = (props) => {
|
|
|
5354
5556
|
queryKey: [`form-view-action-${relation}`],
|
|
5355
5557
|
enabled: false
|
|
5356
5558
|
});
|
|
5357
|
-
|
|
5559
|
+
useEffect12(() => {
|
|
5358
5560
|
if (isSuccess && dataFormViewResponse) {
|
|
5359
5561
|
sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
|
|
5360
5562
|
window.location.href = `/form/menu?model=${relation}`;
|
|
5361
5563
|
}
|
|
5362
5564
|
}, [isSuccess]);
|
|
5363
|
-
|
|
5565
|
+
useEffect12(() => {
|
|
5364
5566
|
if (domainMany2Many && !isLoadedData) {
|
|
5365
5567
|
setIsLoadedData(true);
|
|
5366
5568
|
}
|
|
@@ -5372,45 +5574,15 @@ var many2manyFieldController = (props) => {
|
|
|
5372
5574
|
console.log(error);
|
|
5373
5575
|
}
|
|
5374
5576
|
};
|
|
5375
|
-
return {
|
|
5376
|
-
rows,
|
|
5377
|
-
columns,
|
|
5378
|
-
typeTable,
|
|
5379
|
-
handleCreateNewOnPage,
|
|
5380
|
-
isLoadedData,
|
|
5381
|
-
domainMany2Many,
|
|
5382
|
-
isDataLoading,
|
|
5383
|
-
isDataResponseFetched,
|
|
5384
|
-
isPlaceholderData,
|
|
5385
|
-
queryKey,
|
|
5386
|
-
data,
|
|
5387
|
-
specification,
|
|
5388
|
-
enabled,
|
|
5389
|
-
isViewReponseFetched,
|
|
5390
|
-
actionData,
|
|
5391
|
-
viewResponse,
|
|
5392
|
-
debouncedPage,
|
|
5393
|
-
order,
|
|
5394
|
-
default_order,
|
|
5395
|
-
optionsObject,
|
|
5396
|
-
setDomainMany2Many,
|
|
5397
|
-
// tableHead,
|
|
5398
|
-
selectedTags,
|
|
5399
|
-
initModel,
|
|
5400
|
-
modelInstance,
|
|
5401
|
-
baseModel,
|
|
5402
|
-
dataResponse,
|
|
5403
|
-
isLoading: isDataLoading,
|
|
5404
|
-
setOrder
|
|
5405
|
-
};
|
|
5577
|
+
return {};
|
|
5406
5578
|
};
|
|
5407
5579
|
|
|
5408
5580
|
// src/widget/basic/many2many-tags-field/controller.ts
|
|
5409
5581
|
import { useMemo as useMemo11 } from "react";
|
|
5410
5582
|
import {
|
|
5411
|
-
evalJSONContext as
|
|
5583
|
+
evalJSONContext as evalJSONContext5,
|
|
5412
5584
|
evalJSONDomain as evalJSONDomain4,
|
|
5413
|
-
getEnv as
|
|
5585
|
+
getEnv as getEnv9,
|
|
5414
5586
|
useGetSelection as useGetSelection3,
|
|
5415
5587
|
WIDGETAVATAR,
|
|
5416
5588
|
WIDGETCOLOR
|
|
@@ -5425,8 +5597,8 @@ var many2manyTagsController = (props) => {
|
|
|
5425
5597
|
placeholderNoOption
|
|
5426
5598
|
} = props;
|
|
5427
5599
|
const isUser = relation === "res.users" || relation === "res.partner";
|
|
5428
|
-
const env =
|
|
5429
|
-
const addtionalFields = optionsFields ?
|
|
5600
|
+
const env = getEnv9();
|
|
5601
|
+
const addtionalFields = optionsFields ? evalJSONContext5(optionsFields) : null;
|
|
5430
5602
|
const domainObject = useMemo11(
|
|
5431
5603
|
() => evalJSONDomain4(domain, JSON.parse(JSON.stringify(formValues || {}))),
|
|
5432
5604
|
[domain, formValues]
|
|
@@ -5470,13 +5642,13 @@ var many2manyTagsController = (props) => {
|
|
|
5470
5642
|
};
|
|
5471
5643
|
|
|
5472
5644
|
// src/widget/basic/status-bar-field/controller.ts
|
|
5473
|
-
import { useState as
|
|
5645
|
+
import { useState as useState10 } from "react";
|
|
5474
5646
|
import {
|
|
5475
5647
|
evalJSONDomain as evalJSONDomain5,
|
|
5476
|
-
selectEnv as
|
|
5477
|
-
useAppSelector as
|
|
5648
|
+
selectEnv as selectEnv3,
|
|
5649
|
+
useAppSelector as useAppSelector6,
|
|
5478
5650
|
useChangeStatus,
|
|
5479
|
-
useGetListData as
|
|
5651
|
+
useGetListData as useGetListData3
|
|
5480
5652
|
} from "@fctc/interface-logic";
|
|
5481
5653
|
var durationController = (props) => {
|
|
5482
5654
|
const {
|
|
@@ -5494,9 +5666,9 @@ var durationController = (props) => {
|
|
|
5494
5666
|
name: "",
|
|
5495
5667
|
fold: ""
|
|
5496
5668
|
};
|
|
5497
|
-
const [disabled, setDisabled] =
|
|
5498
|
-
const [modelStatus, setModalStatus] =
|
|
5499
|
-
const { context } =
|
|
5669
|
+
const [disabled, setDisabled] = useState10(false);
|
|
5670
|
+
const [modelStatus, setModalStatus] = useState10(false);
|
|
5671
|
+
const { context } = useAppSelector6(selectEnv3);
|
|
5500
5672
|
const queryKey = [`data-status-duration`, specification];
|
|
5501
5673
|
const listDataProps = {
|
|
5502
5674
|
model: relation,
|
|
@@ -5511,7 +5683,7 @@ var durationController = (props) => {
|
|
|
5511
5683
|
},
|
|
5512
5684
|
sort: ""
|
|
5513
5685
|
};
|
|
5514
|
-
const { data: dataResponse } =
|
|
5686
|
+
const { data: dataResponse } = useGetListData3(listDataProps, queryKey);
|
|
5515
5687
|
const { mutate: fetchChangeStatus } = useChangeStatus();
|
|
5516
5688
|
const handleClick = async (stage_id) => {
|
|
5517
5689
|
setDisabled(true);
|
|
@@ -5548,7 +5720,7 @@ var durationController = (props) => {
|
|
|
5548
5720
|
};
|
|
5549
5721
|
|
|
5550
5722
|
// src/widget/basic/priority-field/controller.ts
|
|
5551
|
-
import { evalJSONContext as
|
|
5723
|
+
import { evalJSONContext as evalJSONContext6, useSave as useSave2 } from "@fctc/interface-logic";
|
|
5552
5724
|
var priorityFieldController = (props) => {
|
|
5553
5725
|
const {
|
|
5554
5726
|
value,
|
|
@@ -5563,7 +5735,7 @@ var priorityFieldController = (props) => {
|
|
|
5563
5735
|
viewData,
|
|
5564
5736
|
context
|
|
5565
5737
|
} = props;
|
|
5566
|
-
const _context = { ...
|
|
5738
|
+
const _context = { ...evalJSONContext6(actionData?.context) };
|
|
5567
5739
|
const contextObject = { ...context, ..._context };
|
|
5568
5740
|
const defaultPriority = parseInt(value) + 1;
|
|
5569
5741
|
const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
|
|
@@ -5602,7 +5774,7 @@ var priorityFieldController = (props) => {
|
|
|
5602
5774
|
};
|
|
5603
5775
|
|
|
5604
5776
|
// src/widget/basic/float-time-field/controller.ts
|
|
5605
|
-
import { useState as
|
|
5777
|
+
import { useState as useState11 } from "react";
|
|
5606
5778
|
import { convertFloatToTime, convertTimeToFloat } from "@fctc/interface-logic";
|
|
5607
5779
|
var floatTimeFiledController = ({
|
|
5608
5780
|
onChange: fieldOnChange,
|
|
@@ -5612,11 +5784,11 @@ var floatTimeFiledController = ({
|
|
|
5612
5784
|
props
|
|
5613
5785
|
}) => {
|
|
5614
5786
|
const { name, defaultValue = 0, onChange } = props;
|
|
5615
|
-
const [input, setInput] =
|
|
5787
|
+
const [input, setInput] = useState11(
|
|
5616
5788
|
convertFloatToTime(value ?? defaultValue)
|
|
5617
5789
|
);
|
|
5618
|
-
const [formattedTime, setFormattedTime] =
|
|
5619
|
-
const [errors, setErrors] =
|
|
5790
|
+
const [formattedTime, setFormattedTime] = useState11("");
|
|
5791
|
+
const [errors, setErrors] = useState11("");
|
|
5620
5792
|
const handleInputChange = (e) => {
|
|
5621
5793
|
const raw = e.target.value.replace(/[^\d:]/g, "");
|
|
5622
5794
|
setInput(raw);
|
|
@@ -5689,7 +5861,31 @@ var floatTimeFiledController = ({
|
|
|
5689
5861
|
};
|
|
5690
5862
|
|
|
5691
5863
|
// src/widget/basic/float-field/controller.ts
|
|
5692
|
-
import { useEffect as
|
|
5864
|
+
import { useEffect as useEffect13, useRef as useRef5, useState as useState12 } from "react";
|
|
5865
|
+
|
|
5866
|
+
// src/utils/i18n.ts
|
|
5867
|
+
import { initReactI18next } from "react-i18next";
|
|
5868
|
+
import i18n from "i18next";
|
|
5869
|
+
import LanguageDetector from "i18next-browser-languagedetector";
|
|
5870
|
+
i18n.use(LanguageDetector).use(initReactI18next).init({
|
|
5871
|
+
resources: {
|
|
5872
|
+
vi: { translation: vi },
|
|
5873
|
+
en: { translation: en }
|
|
5874
|
+
},
|
|
5875
|
+
fallbackLng: "vi",
|
|
5876
|
+
lng: "vi_VN",
|
|
5877
|
+
debug: false,
|
|
5878
|
+
nonExplicitSupportedLngs: true,
|
|
5879
|
+
interpolation: {
|
|
5880
|
+
escapeValue: false
|
|
5881
|
+
},
|
|
5882
|
+
detection: {
|
|
5883
|
+
caches: ["cookie"]
|
|
5884
|
+
}
|
|
5885
|
+
});
|
|
5886
|
+
var i18n_default = i18n;
|
|
5887
|
+
|
|
5888
|
+
// src/widget/basic/float-field/controller.ts
|
|
5693
5889
|
var floatController = ({
|
|
5694
5890
|
onChange,
|
|
5695
5891
|
value,
|
|
@@ -5697,10 +5893,10 @@ var floatController = ({
|
|
|
5697
5893
|
}) => {
|
|
5698
5894
|
const { name, required, methods, onChange: handleOnchange, string } = props;
|
|
5699
5895
|
const { setError, clearErrors } = methods;
|
|
5700
|
-
const [inputValue, setInputValue] =
|
|
5896
|
+
const [inputValue, setInputValue] = useState12(
|
|
5701
5897
|
value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
|
|
5702
5898
|
);
|
|
5703
|
-
|
|
5899
|
+
useEffect13(() => {
|
|
5704
5900
|
if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
|
|
5705
5901
|
setInputValue(useFormatFloatNumber(value));
|
|
5706
5902
|
clearErrors(name);
|
|
@@ -5811,10 +6007,10 @@ var useFormatFloatNumber = (value) => {
|
|
|
5811
6007
|
};
|
|
5812
6008
|
|
|
5813
6009
|
// src/widget/basic/download-file-field/controller.ts
|
|
5814
|
-
import { useId, useState as
|
|
6010
|
+
import { useId, useState as useState13 } from "react";
|
|
5815
6011
|
var downloadFileController = () => {
|
|
5816
6012
|
const inputId = useId();
|
|
5817
|
-
const [file, setFile] =
|
|
6013
|
+
const [file, setFile] = useState13(null);
|
|
5818
6014
|
const handleFileChange = (e) => {
|
|
5819
6015
|
setFile(e.target.files[0]);
|
|
5820
6016
|
};
|
|
@@ -5984,11 +6180,11 @@ var dateFieldController = (props) => {
|
|
|
5984
6180
|
};
|
|
5985
6181
|
|
|
5986
6182
|
// src/widget/basic/copy-link-button/controller.ts
|
|
5987
|
-
import { useState as
|
|
6183
|
+
import { useState as useState14 } from "react";
|
|
5988
6184
|
import { copyTextToClipboard } from "@fctc/interface-logic";
|
|
5989
6185
|
var copyLinkButtonController = (props) => {
|
|
5990
6186
|
const { value, defaultValue } = props;
|
|
5991
|
-
const [isCopied, setIsCopied] =
|
|
6187
|
+
const [isCopied, setIsCopied] = useState14(false);
|
|
5992
6188
|
const handleCopyToClipboard = async (value2) => {
|
|
5993
6189
|
await copyTextToClipboard(value2);
|
|
5994
6190
|
setIsCopied(true);
|
|
@@ -6003,11 +6199,11 @@ var copyLinkButtonController = (props) => {
|
|
|
6003
6199
|
};
|
|
6004
6200
|
|
|
6005
6201
|
// src/widget/basic/color-field/color-controller.ts
|
|
6006
|
-
import { evalJSONContext as
|
|
6202
|
+
import { evalJSONContext as evalJSONContext7, getEnv as getEnv10, useSave as useSave3 } from "@fctc/interface-logic";
|
|
6007
6203
|
var colorFieldController = (props) => {
|
|
6008
6204
|
const { value, isForm, name, formValues, idForm, model, actionData } = props;
|
|
6009
|
-
const env =
|
|
6010
|
-
const _context = { ...
|
|
6205
|
+
const env = getEnv10();
|
|
6206
|
+
const _context = { ...evalJSONContext7(actionData?.context) || {} };
|
|
6011
6207
|
const contextObject = { ...env.context, ..._context };
|
|
6012
6208
|
const idDefault = isForm ? idForm : formValues?.id;
|
|
6013
6209
|
const { mutate: onSave } = useSave3();
|
|
@@ -6035,14 +6231,14 @@ var colorFieldController = (props) => {
|
|
|
6035
6231
|
};
|
|
6036
6232
|
|
|
6037
6233
|
// src/widget/basic/binary-field/controller.ts
|
|
6038
|
-
import { useEffect as
|
|
6234
|
+
import { useEffect as useEffect14, useId as useId2, useRef as useRef6, useState as useState15 } from "react";
|
|
6039
6235
|
import { isBase64Image } from "@fctc/interface-logic";
|
|
6040
6236
|
var binaryFieldController = (props) => {
|
|
6041
6237
|
const { name, methods, readonly = false, value } = props;
|
|
6042
6238
|
const inputId = useId2();
|
|
6043
|
-
const [selectedImage, setSelectedImage] =
|
|
6044
|
-
const [initialImage, setInitialImage] =
|
|
6045
|
-
const [isInsideTable, setIsInsideTable] =
|
|
6239
|
+
const [selectedImage, setSelectedImage] = useState15(null);
|
|
6240
|
+
const [initialImage, setInitialImage] = useState15(value || null);
|
|
6241
|
+
const [isInsideTable, setIsInsideTable] = useState15(false);
|
|
6046
6242
|
const { setValue } = methods;
|
|
6047
6243
|
const binaryRef = useRef6(null);
|
|
6048
6244
|
const convertUrlToBase64 = async (url) => {
|
|
@@ -6106,14 +6302,14 @@ var binaryFieldController = (props) => {
|
|
|
6106
6302
|
else if (base64.startsWith("UklGR")) mimeType = "image/webp";
|
|
6107
6303
|
return mimeType ? `data:${mimeType};base64,${base64}` : null;
|
|
6108
6304
|
};
|
|
6109
|
-
|
|
6305
|
+
useEffect14(() => {
|
|
6110
6306
|
return () => {
|
|
6111
6307
|
if (selectedImage) {
|
|
6112
6308
|
URL.revokeObjectURL(selectedImage);
|
|
6113
6309
|
}
|
|
6114
6310
|
};
|
|
6115
6311
|
}, [selectedImage]);
|
|
6116
|
-
|
|
6312
|
+
useEffect14(() => {
|
|
6117
6313
|
if (binaryRef.current) {
|
|
6118
6314
|
const isInsideTable2 = !!binaryRef.current.closest("table");
|
|
6119
6315
|
setIsInsideTable(isInsideTable2);
|
|
@@ -6134,6 +6330,7 @@ var binaryFieldController = (props) => {
|
|
|
6134
6330
|
export {
|
|
6135
6331
|
API_APP_URL,
|
|
6136
6332
|
API_PRESCHOOL_URL,
|
|
6333
|
+
AppProvider,
|
|
6137
6334
|
CloseIcon,
|
|
6138
6335
|
EyeIcon,
|
|
6139
6336
|
LoadingIcon,
|
|
@@ -6160,17 +6357,22 @@ export {
|
|
|
6160
6357
|
priorityFieldController,
|
|
6161
6358
|
setStorageItemAsync,
|
|
6162
6359
|
statusDropdownController,
|
|
6360
|
+
useAppProvider,
|
|
6163
6361
|
useAuth,
|
|
6164
6362
|
useCallAction,
|
|
6165
6363
|
useClickOutside,
|
|
6166
6364
|
useConfig,
|
|
6167
6365
|
useDebounce,
|
|
6168
6366
|
useDetail,
|
|
6367
|
+
useForgotPasswordHandler,
|
|
6169
6368
|
useGetRowIds,
|
|
6170
6369
|
useListData,
|
|
6370
|
+
useLoginHandler,
|
|
6171
6371
|
useMenu,
|
|
6172
6372
|
useProfile,
|
|
6373
|
+
useResetPasswordHandler,
|
|
6173
6374
|
useStorageState,
|
|
6375
|
+
useSwitchLocaleHandler,
|
|
6174
6376
|
useUser,
|
|
6175
6377
|
useViewV2
|
|
6176
6378
|
};
|