@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/index.js CHANGED
@@ -4036,6 +4036,7 @@ var index_exports = {};
4036
4036
  __export(index_exports, {
4037
4037
  API_APP_URL: () => API_APP_URL,
4038
4038
  API_PRESCHOOL_URL: () => API_PRESCHOOL_URL,
4039
+ AppProvider: () => AppProvider,
4039
4040
  CloseIcon: () => CloseIcon,
4040
4041
  EyeIcon: () => EyeIcon,
4041
4042
  LoadingIcon: () => LoadingIcon,
@@ -4062,17 +4063,22 @@ __export(index_exports, {
4062
4063
  priorityFieldController: () => priorityFieldController,
4063
4064
  setStorageItemAsync: () => setStorageItemAsync,
4064
4065
  statusDropdownController: () => statusDropdownController,
4066
+ useAppProvider: () => useAppProvider,
4065
4067
  useAuth: () => useAuth,
4066
4068
  useCallAction: () => useCallAction,
4067
4069
  useClickOutside: () => useClickOutside,
4068
4070
  useConfig: () => useConfig,
4069
4071
  useDebounce: () => useDebounce,
4070
4072
  useDetail: () => useDetail,
4073
+ useForgotPasswordHandler: () => useForgotPasswordHandler,
4071
4074
  useGetRowIds: () => useGetRowIds,
4072
4075
  useListData: () => useListData,
4076
+ useLoginHandler: () => useLoginHandler,
4073
4077
  useMenu: () => useMenu,
4074
4078
  useProfile: () => useProfile,
4079
+ useResetPasswordHandler: () => useResetPasswordHandler,
4075
4080
  useStorageState: () => useStorageState,
4081
+ useSwitchLocaleHandler: () => useSwitchLocaleHandler,
4076
4082
  useUser: () => useUser,
4077
4083
  useViewV2: () => useViewV2
4078
4084
  });
@@ -4670,8 +4676,125 @@ var useAuth = () => {
4670
4676
  };
4671
4677
  };
4672
4678
 
4673
- // src/hooks/utils/use-click-outside.ts
4679
+ // src/hooks/core/use-app-provider.tsx
4680
+ var import_react10 = require("react");
4681
+
4682
+ // src/hooks/core/use-company.ts
4683
+ var import_interface_logic9 = require("@fctc/interface-logic");
4684
+ var import_react_query3 = require("@tanstack/react-query");
4674
4685
  var import_react9 = require("react");
4686
+ var useCompany = (accessToken) => {
4687
+ const getCurrentCompany = (0, import_interface_logic9.useGetCurrentCompany)();
4688
+ const fetchCurrentCompany = async () => {
4689
+ return await getCurrentCompany.mutateAsync();
4690
+ };
4691
+ const currentCompany = (0, import_react_query3.useQuery)({
4692
+ queryKey: ["currentCompany", accessToken],
4693
+ queryFn: fetchCurrentCompany,
4694
+ enabled: !!accessToken
4695
+ });
4696
+ const current_company_id = (0, import_react9.useMemo)(() => {
4697
+ return currentCompany.data?.current_company_id;
4698
+ }, [currentCompany.data]);
4699
+ (0, import_react9.useEffect)(() => {
4700
+ if (current_company_id) {
4701
+ const companyIDs = [current_company_id];
4702
+ const env = (0, import_interface_logic9.getEnv)();
4703
+ env.setAllowCompanies([...companyIDs]);
4704
+ env.setCompanies(companyIDs);
4705
+ }
4706
+ }, [current_company_id]);
4707
+ const getCompanyInfo = (0, import_interface_logic9.useGetCompanyInfo)();
4708
+ const companyInfo = (0, import_react_query3.useQuery)({
4709
+ queryKey: ["companyInfoQuery", current_company_id, accessToken],
4710
+ queryFn: () => getCompanyInfo.mutateAsync(Number(current_company_id)),
4711
+ enabled: !!current_company_id && !!accessToken
4712
+ });
4713
+ (0, import_react9.useEffect)(() => {
4714
+ if (companyInfo.data) {
4715
+ const companyInfoData = companyInfo.data;
4716
+ if (companyInfoData?.length) {
4717
+ const env = (0, import_interface_logic9.getEnv)();
4718
+ env.setDefaultCompany(companyInfoData[0]);
4719
+ }
4720
+ }
4721
+ }, [companyInfo.data]);
4722
+ return {
4723
+ currentCompany,
4724
+ companyInfo,
4725
+ context: { allowed_company_ids: [current_company_id] }
4726
+ };
4727
+ };
4728
+ var use_company_default = useCompany;
4729
+
4730
+ // src/hooks/core/use-app-provider.tsx
4731
+ var import_interface_logic10 = require("@fctc/interface-logic");
4732
+ var import_jsx_runtime = require("react/jsx-runtime");
4733
+ var AppProviderInitialValue = {
4734
+ config: {},
4735
+ user: {},
4736
+ auth: {},
4737
+ company: {},
4738
+ action: {},
4739
+ menu: {},
4740
+ view: {},
4741
+ list: {}
4742
+ };
4743
+ var ReactContext = (0, import_react10.createContext)(AppProviderInitialValue);
4744
+ var AppProvider = ({ children }) => {
4745
+ const config = useConfig({});
4746
+ const auth = useAuth();
4747
+ const user = useUser(auth.accessToken);
4748
+ const company = use_company_default(auth.accessToken);
4749
+ const menuContext = (0, import_react10.useMemo)(() => {
4750
+ return combineContexts([user.context, company.context]);
4751
+ }, [user.context, company.context]);
4752
+ const menu = useMenu({ context: menuContext });
4753
+ const action = (0, import_react10.useMemo)(() => {
4754
+ return menu.state.action;
4755
+ }, [menu.state.action]);
4756
+ const viewContext = (0, import_react10.useMemo)(() => {
4757
+ return combineContexts([
4758
+ menuContext,
4759
+ { ...(0, import_interface_logic10.evalJSONContext)(action?.result?.context) }
4760
+ ]);
4761
+ }, [menuContext, action?.result?.context]);
4762
+ const view = useViewV2({
4763
+ action,
4764
+ context: viewContext
4765
+ });
4766
+ const list = useListData({
4767
+ action,
4768
+ viewResponse: view.data,
4769
+ context: viewContext
4770
+ });
4771
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4772
+ ReactContext.Provider,
4773
+ {
4774
+ value: {
4775
+ config,
4776
+ auth,
4777
+ user,
4778
+ company,
4779
+ menu,
4780
+ list,
4781
+ action,
4782
+ view
4783
+ },
4784
+ children
4785
+ }
4786
+ );
4787
+ };
4788
+ var useAppProvider = () => {
4789
+ const context = (0, import_react10.useContext)(ReactContext);
4790
+ if (!context) {
4791
+ return AppProviderInitialValue;
4792
+ }
4793
+ return context;
4794
+ };
4795
+
4796
+ // src/hooks/utils/use-click-outside.ts
4797
+ var import_react11 = require("react");
4675
4798
  var DEFAULT_EVENTS = ["mousedown", "touchstart"];
4676
4799
  var useClickOutside = ({
4677
4800
  handler,
@@ -4679,8 +4802,8 @@ var useClickOutside = ({
4679
4802
  nodes = [],
4680
4803
  refs
4681
4804
  }) => {
4682
- const ref = (0, import_react9.useRef)(null);
4683
- (0, import_react9.useEffect)(() => {
4805
+ const ref = (0, import_react11.useRef)(null);
4806
+ (0, import_react11.useEffect)(() => {
4684
4807
  const listener = (event) => {
4685
4808
  const { target } = event;
4686
4809
  if (refs && refs?.length > 0 && refs?.some((r) => r.current?.contains(target))) {
@@ -4702,10 +4825,10 @@ var useClickOutside = ({
4702
4825
  };
4703
4826
 
4704
4827
  // src/hooks/utils/use-debounce.ts
4705
- var import_react10 = require("react");
4828
+ var import_react12 = require("react");
4706
4829
  function useDebounce(value, delay) {
4707
- const [debouncedValue, setDebouncedValue] = (0, import_react10.useState)(value);
4708
- (0, import_react10.useEffect)(() => {
4830
+ const [debouncedValue, setDebouncedValue] = (0, import_react12.useState)(value);
4831
+ (0, import_react12.useEffect)(() => {
4709
4832
  const handler = setTimeout(() => {
4710
4833
  setDebouncedValue(value);
4711
4834
  }, delay);
@@ -4716,9 +4839,132 @@ function useDebounce(value, delay) {
4716
4839
  return [debouncedValue];
4717
4840
  }
4718
4841
 
4842
+ // src/hooks/api/use-switch-locale.ts
4843
+ var import_interface_logic11 = require("@fctc/interface-logic");
4844
+ var import_react13 = require("react");
4845
+ var useSwitchLocaleHandler = () => {
4846
+ const switchUserLocale = (0, import_interface_logic11.useSwitchLocale)();
4847
+ const env = (0, import_interface_logic11.getEnv)();
4848
+ const { context } = (0, import_interface_logic11.useAppSelector)(import_interface_logic11.selectEnv);
4849
+ const switchLocale = (0, import_react13.useCallback)(
4850
+ async (langId) => {
4851
+ if (!langId) return;
4852
+ await switchUserLocale.mutateAsync({
4853
+ data: {
4854
+ id: parseInt(context?.uid),
4855
+ values: { lang: langId }
4856
+ }
4857
+ });
4858
+ env.setLang(langId);
4859
+ },
4860
+ [switchUserLocale]
4861
+ );
4862
+ return {
4863
+ switchLocale,
4864
+ isLoading: switchUserLocale.isPending,
4865
+ error: switchUserLocale.error
4866
+ };
4867
+ };
4868
+
4869
+ // src/hooks/api/use-login.ts
4870
+ var import_interface_logic12 = require("@fctc/interface-logic");
4871
+ var import_react14 = require("react");
4872
+ var useLoginHandler = () => {
4873
+ const loginMutate = (0, import_interface_logic12.useLoginCredential)();
4874
+ const login = (0, import_react14.useCallback)(
4875
+ ({
4876
+ email,
4877
+ password,
4878
+ path
4879
+ }, {
4880
+ onSuccess,
4881
+ onError
4882
+ }) => {
4883
+ loginMutate.mutate(
4884
+ {
4885
+ email,
4886
+ password,
4887
+ path
4888
+ },
4889
+ {
4890
+ onSuccess,
4891
+ onError
4892
+ }
4893
+ );
4894
+ },
4895
+ [loginMutate]
4896
+ );
4897
+ return {
4898
+ login,
4899
+ isLoading: loginMutate.isPending,
4900
+ error: loginMutate.error
4901
+ };
4902
+ };
4903
+
4904
+ // src/hooks/api/use-forgot-password.ts
4905
+ var import_interface_logic13 = require("@fctc/interface-logic");
4906
+ var import_react15 = require("react");
4907
+ var useForgotPasswordHandler = () => {
4908
+ const forgotPasswordMutate = (0, import_interface_logic13.useForgotPassword)();
4909
+ const sendForgotPassword = (0, import_react15.useCallback)(
4910
+ (email, {
4911
+ onSuccess,
4912
+ onError
4913
+ } = {}) => {
4914
+ forgotPasswordMutate.mutate(email, {
4915
+ onSuccess,
4916
+ onError
4917
+ });
4918
+ },
4919
+ [forgotPasswordMutate]
4920
+ );
4921
+ return {
4922
+ sendForgotPassword,
4923
+ isLoading: forgotPasswordMutate.isPending,
4924
+ error: forgotPasswordMutate.error
4925
+ };
4926
+ };
4927
+
4928
+ // src/hooks/api/use-reset-password.ts
4929
+ var import_interface_logic14 = require("@fctc/interface-logic");
4930
+ var import_react16 = require("react");
4931
+ var useResetPasswordHandler = () => {
4932
+ const resetPasswordMutate = (0, import_interface_logic14.useResetPassword)();
4933
+ const resetPassword = (0, import_react16.useCallback)(
4934
+ ({
4935
+ password,
4936
+ confirmPassword,
4937
+ token
4938
+ }, {
4939
+ onSuccess,
4940
+ onError
4941
+ }) => {
4942
+ resetPasswordMutate.mutate(
4943
+ {
4944
+ data: {
4945
+ password,
4946
+ confirmPassword
4947
+ },
4948
+ token
4949
+ },
4950
+ {
4951
+ onSuccess,
4952
+ onError
4953
+ }
4954
+ );
4955
+ },
4956
+ [resetPasswordMutate]
4957
+ );
4958
+ return {
4959
+ resetPassword,
4960
+ isLoading: resetPasswordMutate.isPending,
4961
+ error: resetPasswordMutate.error
4962
+ };
4963
+ };
4964
+
4719
4965
  // src/icons/eye-icon.tsx
4720
- var import_jsx_runtime = require("react/jsx-runtime");
4721
- var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4966
+ var import_jsx_runtime2 = require("react/jsx-runtime");
4967
+ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4722
4968
  "svg",
4723
4969
  {
4724
4970
  width: "20",
@@ -4727,7 +4973,7 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4727
4973
  fill: "none",
4728
4974
  xmlns: "http://www.w3.org/2000/svg",
4729
4975
  children: [
4730
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4976
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4731
4977
  "path",
4732
4978
  {
4733
4979
  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",
@@ -4735,7 +4981,7 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4735
4981
  strokeWidth: "1.5"
4736
4982
  }
4737
4983
  ),
4738
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
4984
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4739
4985
  "path",
4740
4986
  {
4741
4987
  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",
@@ -4748,13 +4994,13 @@ var EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
4748
4994
  );
4749
4995
 
4750
4996
  // src/icons/loading-icon.tsx
4751
- var import_jsx_runtime2 = require("react/jsx-runtime");
4997
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4752
4998
  var LoadingIcon = ({
4753
4999
  width = 15,
4754
5000
  height = 15,
4755
5001
  ...props
4756
5002
  }) => {
4757
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5003
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4758
5004
  "svg",
4759
5005
  {
4760
5006
  xmlns: "http://www.w3.org/2000/svg",
@@ -4769,8 +5015,8 @@ var LoadingIcon = ({
4769
5015
  background: "transparent"
4770
5016
  },
4771
5017
  ...props,
4772
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("g", { children: [
4773
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5018
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { children: [
5019
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4774
5020
  "circle",
4775
5021
  {
4776
5022
  strokeDasharray: "141.37166941154067 49.12388980384689",
@@ -4780,7 +5026,7 @@ var LoadingIcon = ({
4780
5026
  fill: "none",
4781
5027
  cy: "50",
4782
5028
  cx: "50",
4783
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
5029
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4784
5030
  "animateTransform",
4785
5031
  {
4786
5032
  keyTimes: "0;1",
@@ -4793,16 +5039,16 @@ var LoadingIcon = ({
4793
5039
  )
4794
5040
  }
4795
5041
  ),
4796
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("g", {})
5042
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("g", {})
4797
5043
  ] })
4798
5044
  }
4799
5045
  );
4800
5046
  };
4801
5047
 
4802
5048
  // src/icons/close-icon.tsx
4803
- var import_jsx_runtime3 = require("react/jsx-runtime");
5049
+ var import_jsx_runtime4 = require("react/jsx-runtime");
4804
5050
  var CloseIcon = ({ className = "" }) => {
4805
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5051
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4806
5052
  "svg",
4807
5053
  {
4808
5054
  width: "24",
@@ -4811,7 +5057,7 @@ var CloseIcon = ({ className = "" }) => {
4811
5057
  fill: "none",
4812
5058
  xmlns: "http://www.w3.org/2000/svg",
4813
5059
  className,
4814
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5060
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4815
5061
  "path",
4816
5062
  {
4817
5063
  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",
@@ -4823,19 +5069,19 @@ var CloseIcon = ({ className = "" }) => {
4823
5069
  };
4824
5070
 
4825
5071
  // src/widget/basic/status-dropdown-field/controller.ts
4826
- var import_react11 = require("react");
4827
- var import_interface_logic9 = require("@fctc/interface-logic");
5072
+ var import_react17 = require("react");
5073
+ var import_interface_logic15 = require("@fctc/interface-logic");
4828
5074
  var statusDropdownController = (props) => {
4829
5075
  const { selection, isForm, id, model, name, state, onRefetch } = props;
4830
- const env = (0, import_interface_logic9.getEnv)();
5076
+ const env = (0, import_interface_logic15.getEnv)();
4831
5077
  const colors = {
4832
5078
  normal: "bg-[#e9ecef]",
4833
5079
  done: "bg-primary",
4834
5080
  blocked: "bg-red-500"
4835
5081
  };
4836
- const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
4837
- const buttonRef = (0, import_react11.useRef)(null);
4838
- (0, import_react11.useEffect)(() => {
5082
+ const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
5083
+ const buttonRef = (0, import_react17.useRef)(null);
5084
+ (0, import_react17.useEffect)(() => {
4839
5085
  const handleClickOutside = (event) => {
4840
5086
  if (buttonRef.current && !buttonRef.current.contains(event.target)) {
4841
5087
  setIsOpen(false);
@@ -4846,7 +5092,7 @@ var statusDropdownController = (props) => {
4846
5092
  document.removeEventListener("mousedown", handleClickOutside);
4847
5093
  };
4848
5094
  }, []);
4849
- const { mutate: onSave } = (0, import_interface_logic9.useSave)();
5095
+ const { mutate: onSave } = (0, import_interface_logic15.useSave)();
4850
5096
  const handleClick = async (status) => {
4851
5097
  setIsOpen(!isOpen);
4852
5098
  onSave(
@@ -4876,8 +5122,8 @@ var statusDropdownController = (props) => {
4876
5122
  };
4877
5123
 
4878
5124
  // src/widget/basic/many2one-field/controller.ts
4879
- var import_react12 = require("react");
4880
- var import_interface_logic10 = require("@fctc/interface-logic");
5125
+ var import_react18 = require("react");
5126
+ var import_interface_logic16 = require("@fctc/interface-logic");
4881
5127
  var many2oneFieldController = (props) => {
4882
5128
  const {
4883
5129
  name,
@@ -4892,24 +5138,24 @@ var many2oneFieldController = (props) => {
4892
5138
  showDetail = true,
4893
5139
  actionData
4894
5140
  } = props;
4895
- const [options, setOptions] = (0, import_react12.useState)([]);
4896
- const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react12.useState)(false);
4897
- const [tempSelectedOption, setTempSelectedOption] = (0, import_react12.useState)(null);
4898
- const { menuList } = (0, import_interface_logic10.useAppSelector)(import_interface_logic10.selectNavbar);
4899
- const { context } = (0, import_interface_logic10.useAppSelector)(import_interface_logic10.selectEnv);
4900
- const [domainModal, setDomainModal] = (0, import_react12.useState)(null);
5141
+ const [options, setOptions] = (0, import_react18.useState)([]);
5142
+ const [isShowModalMany2Many, setIsShowModalMany2Many] = (0, import_react18.useState)(false);
5143
+ const [tempSelectedOption, setTempSelectedOption] = (0, import_react18.useState)(null);
5144
+ const { menuList } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectNavbar);
5145
+ const { context } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectEnv);
5146
+ const [domainModal, setDomainModal] = (0, import_react18.useState)(null);
4901
5147
  const initValue = methods?.getValues(name);
4902
- const domainObject = (0, import_react12.useMemo)(
4903
- () => (0, import_interface_logic10.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
5148
+ const domainObject = (0, import_react18.useMemo)(
5149
+ () => (0, import_interface_logic16.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues)) ?? {}),
4904
5150
  [domain, formValues]
4905
5151
  );
4906
- const optionsObject = (0, import_interface_logic10.evalJSONContext)(fieldOptions) || {};
5152
+ const optionsObject = (0, import_interface_logic16.evalJSONContext)(fieldOptions) || {};
4907
5153
  const contextObject = {
4908
- ...(0, import_interface_logic10.evalJSONContext)(actionData?.context) || {},
5154
+ ...(0, import_interface_logic16.evalJSONContext)(actionData?.context) || {},
4909
5155
  ...fieldContext,
4910
5156
  ...context
4911
5157
  };
4912
- const actionId = (0, import_react12.useMemo)(
5158
+ const actionId = (0, import_react18.useMemo)(
4913
5159
  () => menuList?.flatMap(
4914
5160
  (item) => item?.child_id.filter(
4915
5161
  (childItem) => childItem?.is_display && childItem?.action?.res_model === relation
@@ -4930,25 +5176,25 @@ var many2oneFieldController = (props) => {
4930
5176
  const queryKey = [`data_${relation}`, domainObject];
4931
5177
  const {
4932
5178
  data: dataOfSelection,
4933
- // refetch,
5179
+ refetch,
4934
5180
  isFetching
4935
- } = (0, import_interface_logic10.useGetSelection)({
5181
+ } = (0, import_interface_logic16.useGetSelection)({
4936
5182
  data,
4937
5183
  queryKey,
4938
5184
  enabled: false
4939
5185
  });
4940
- const selectOptions = (0, import_react12.useMemo)(() => {
5186
+ const selectOptions = (0, import_react18.useMemo)(() => {
4941
5187
  return dataOfSelection?.records?.map((val) => ({
4942
5188
  value: val?.id,
4943
5189
  label: val?.display_name || val?.name
4944
5190
  })) || [];
4945
5191
  }, [dataOfSelection]);
4946
- (0, import_react12.useEffect)(() => {
5192
+ (0, import_react18.useEffect)(() => {
4947
5193
  setOptions(selectOptions);
4948
5194
  setDomainModal(domainObject);
4949
- if (relation === "student.subject") (0, import_interface_logic10.setListSubject)(selectOptions);
5195
+ if (relation === "student.subject") (0, import_interface_logic16.setListSubject)(selectOptions);
4950
5196
  }, [selectOptions]);
4951
- (0, import_react12.useEffect)(() => {
5197
+ (0, import_react18.useEffect)(() => {
4952
5198
  if (!propValue && tempSelectedOption) {
4953
5199
  methods.setValue(name, null);
4954
5200
  setTempSelectedOption(null);
@@ -4959,12 +5205,15 @@ var many2oneFieldController = (props) => {
4959
5205
  });
4960
5206
  }
4961
5207
  }, [propValue]);
4962
- (0, import_react12.useEffect)(() => {
5208
+ const fetchMoreOptions = (0, import_react18.useCallback)(() => {
5209
+ refetch();
5210
+ }, [refetch]);
5211
+ (0, import_react18.useEffect)(() => {
4963
5212
  if (actionId) {
4964
5213
  localStorage.setItem("aid", actionId);
4965
5214
  }
4966
5215
  }, [actionId]);
4967
- const handleChooseRecord = (0, import_react12.useCallback)(
5216
+ const handleChooseRecord = (0, import_react18.useCallback)(
4968
5217
  (idRecord) => {
4969
5218
  const newOption = options.find(
4970
5219
  (option) => option.value === idRecord
@@ -4989,8 +5238,8 @@ var many2oneFieldController = (props) => {
4989
5238
  },
4990
5239
  [options, methods, name, onChange]
4991
5240
  );
4992
- const handleClose = (0, import_react12.useCallback)(() => setIsShowModalMany2Many(false), []);
4993
- const handleSelectChange = (0, import_react12.useCallback)(
5241
+ const handleClose = (0, import_react18.useCallback)(() => setIsShowModalMany2Many(false), []);
5242
+ const handleSelectChange = (0, import_react18.useCallback)(
4994
5243
  (selectedOption) => {
4995
5244
  if (!selectedOption) {
4996
5245
  methods.setValue(name, null, { shouldDirty: true });
@@ -5024,13 +5273,13 @@ var many2oneFieldController = (props) => {
5024
5273
  isFetching,
5025
5274
  isShowModalMany2Many,
5026
5275
  options,
5027
- // fetchMoreOptions,
5276
+ fetchMoreOptions,
5028
5277
  domainModal,
5029
5278
  tempSelectedOption,
5030
5279
  setTempSelectedOption,
5031
5280
  setDomainModal,
5032
5281
  dataOfSelection,
5033
- // refetch,
5282
+ refetch,
5034
5283
  selectOptions,
5035
5284
  optionsObject,
5036
5285
  contextObject,
@@ -5040,18 +5289,18 @@ var many2oneFieldController = (props) => {
5040
5289
  };
5041
5290
 
5042
5291
  // src/widget/basic/many2one-button-field/controller.ts
5043
- var import_interface_logic11 = require("@fctc/interface-logic");
5292
+ var import_interface_logic17 = require("@fctc/interface-logic");
5044
5293
  var many2oneButtonController = (props) => {
5045
5294
  const { domain, methods, relation } = props;
5046
5295
  const actionDataString = sessionStorage.getItem("actionData");
5047
- const env = (0, import_interface_logic11.getEnv)();
5048
- const domainObject = (0, import_interface_logic11.evalJSONDomain)(domain, methods?.getValues() || {});
5296
+ const env = (0, import_interface_logic17.getEnv)();
5297
+ const domainObject = (0, import_interface_logic17.evalJSONDomain)(domain, methods?.getValues() || {});
5049
5298
  const actionData = actionDataString && actionDataString !== "undefined" ? JSON.parse(actionDataString) : {};
5050
- const { data: dataOfSelection } = (0, import_interface_logic11.useGetSelection)({
5299
+ const { data: dataOfSelection } = (0, import_interface_logic17.useGetSelection)({
5051
5300
  data: {
5052
5301
  model: relation ?? "",
5053
5302
  domain: domainObject,
5054
- context: { ...env.context, ...(0, import_interface_logic11.evalJSONContext)(actionData?.context) }
5303
+ context: { ...env.context, ...(0, import_interface_logic17.evalJSONContext)(actionData?.context) }
5055
5304
  },
5056
5305
  queryKey: [`data_${relation}`, domainObject]
5057
5306
  });
@@ -5065,22 +5314,15 @@ var many2oneButtonController = (props) => {
5065
5314
  };
5066
5315
 
5067
5316
  // src/widget/basic/many2many-field/controller.ts
5068
- var import_react16 = require("react");
5069
- var import_interface_logic16 = require("@fctc/interface-logic");
5070
-
5071
- // src/widget/advance/table/table-body/controller.ts
5072
- var import_interface_logic12 = require("@fctc/interface-logic");
5073
- var import_react13 = require("react");
5074
-
5075
- // src/widget/advance/table/table-head/controller.ts
5076
- var import_interface_logic13 = require("@fctc/interface-logic");
5317
+ var import_react20 = require("react");
5318
+ var import_interface_logic19 = require("@fctc/interface-logic");
5077
5319
 
5078
5320
  // src/widget/advance/table/table-view/controller.ts
5079
- var import_interface_logic14 = require("@fctc/interface-logic");
5080
- var import_react14 = require("react");
5321
+ var import_interface_logic18 = require("@fctc/interface-logic");
5322
+ var import_react19 = require("react");
5081
5323
  var tableController = ({ data }) => {
5082
- const [rows, setRows] = (0, import_react14.useState)(data.records || []);
5083
- const [columns, setColumns] = (0, import_react14.useState)([]);
5324
+ const [rows, setRows] = (0, import_react19.useState)(data.records || []);
5325
+ const [columns, setColumns] = (0, import_react19.useState)([]);
5084
5326
  const dataModelFields = data.fields?.map((field) => {
5085
5327
  return {
5086
5328
  ...data.dataModel?.[field?.name],
@@ -5108,14 +5350,14 @@ var tableController = ({ data }) => {
5108
5350
  return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
5109
5351
  });
5110
5352
  };
5111
- (0, import_react14.useEffect)(() => {
5353
+ (0, import_react19.useEffect)(() => {
5112
5354
  setRows(transformData(data.records || null));
5113
5355
  }, [data.records]);
5114
5356
  const handleGetColumns = () => {
5115
5357
  let cols = [];
5116
5358
  try {
5117
5359
  cols = mergeFields?.filter((item) => {
5118
- return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic14.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic14.domainHelper.matchDomains(data.context, item?.invisible) : false);
5360
+ return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic18.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic18.domainHelper.matchDomains(data.context, item?.invisible) : false);
5119
5361
  })?.map((field) => {
5120
5362
  return {
5121
5363
  name: field?.name,
@@ -5129,7 +5371,7 @@ var tableController = ({ data }) => {
5129
5371
  }
5130
5372
  return cols;
5131
5373
  };
5132
- (0, import_react14.useEffect)(() => {
5374
+ (0, import_react19.useEffect)(() => {
5133
5375
  const columns2 = handleGetColumns();
5134
5376
  setColumns(columns2);
5135
5377
  }, [data.records]);
@@ -5153,32 +5395,6 @@ var tableController = ({ data }) => {
5153
5395
  };
5154
5396
  };
5155
5397
 
5156
- // src/widget/advance/table/table-group/controller.ts
5157
- var import_interface_logic15 = require("@fctc/interface-logic");
5158
- var import_react15 = require("react");
5159
-
5160
- // src/utils/i18n.ts
5161
- var import_react_i18next2 = require("react-i18next");
5162
- var import_i18next = __toESM(require("i18next"));
5163
- var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5164
- import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
5165
- resources: {
5166
- vi: { translation: vi },
5167
- en: { translation: en }
5168
- },
5169
- fallbackLng: "vi",
5170
- lng: "vi_VN",
5171
- debug: false,
5172
- nonExplicitSupportedLngs: true,
5173
- interpolation: {
5174
- escapeValue: false
5175
- },
5176
- detection: {
5177
- caches: ["cookie"]
5178
- }
5179
- });
5180
- var i18n_default = import_i18next.default;
5181
-
5182
5398
  // src/widget/basic/many2many-field/controller.ts
5183
5399
  var many2manyFieldController = (props) => {
5184
5400
  const {
@@ -5188,7 +5404,7 @@ var many2manyFieldController = (props) => {
5188
5404
  tab,
5189
5405
  model,
5190
5406
  aid,
5191
- setSelectedRowKeys: setSelectedRowKeys4,
5407
+ setSelectedRowKeys,
5192
5408
  fields,
5193
5409
  setFields,
5194
5410
  groupByDomain,
@@ -5196,17 +5412,14 @@ var many2manyFieldController = (props) => {
5196
5412
  options,
5197
5413
  sessionStorageUtils
5198
5414
  } = props;
5199
- const appDispatch = (0, import_interface_logic16.useAppDispatch)();
5415
+ const appDispatch = (0, import_interface_logic19.useAppDispatch)();
5200
5416
  const actionData = sessionStorageUtils.getActionData();
5201
5417
  const [debouncedPage] = useDebounce(page, 500);
5202
- const [order, setOrder] = (0, import_react16.useState)();
5203
- const [isLoadedData, setIsLoadedData] = (0, import_react16.useState)(false);
5204
- const [domainMany2Many, setDomainMany2Many] = (0, import_react16.useState)(domain);
5205
- const env = (0, import_interface_logic16.getEnv)();
5206
- const {
5207
- // tableHead,
5208
- selectedTags
5209
- } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectSearch);
5418
+ const [order, setOrder] = (0, import_react20.useState)();
5419
+ const [isLoadedData, setIsLoadedData] = (0, import_react20.useState)(false);
5420
+ const [domainMany2Many, setDomainMany2Many] = (0, import_react20.useState)(domain);
5421
+ const env = (0, import_interface_logic19.getEnv)();
5422
+ const { selectedTags } = (0, import_interface_logic19.useAppSelector)(import_interface_logic19.selectSearch);
5210
5423
  const viewParams = {
5211
5424
  model: relation,
5212
5425
  views: [
@@ -5215,11 +5428,11 @@ var many2manyFieldController = (props) => {
5215
5428
  ],
5216
5429
  context
5217
5430
  };
5218
- const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic16.useGetView)(
5431
+ const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic19.useGetView)(
5219
5432
  viewParams,
5220
5433
  actionData
5221
5434
  );
5222
- const baseModel = (0, import_react16.useMemo)(
5435
+ const baseModel = (0, import_react20.useMemo)(
5223
5436
  () => ({
5224
5437
  name: String(relation),
5225
5438
  view: viewResponse || {},
@@ -5231,26 +5444,26 @@ var many2manyFieldController = (props) => {
5231
5444
  }),
5232
5445
  [model, viewResponse]
5233
5446
  );
5234
- const initModel = (0, import_interface_logic16.useModel)();
5235
- const modelInstance = (0, import_react16.useMemo)(() => {
5447
+ const initModel = (0, import_interface_logic19.useModel)();
5448
+ const modelInstance = (0, import_react20.useMemo)(() => {
5236
5449
  if (viewResponse) {
5237
5450
  return initModel.initModel(baseModel);
5238
5451
  }
5239
5452
  return null;
5240
5453
  }, [baseModel, viewResponse]);
5241
- const specification = (0, import_react16.useMemo)(() => {
5454
+ const specification = (0, import_react20.useMemo)(() => {
5242
5455
  if (modelInstance) {
5243
5456
  return modelInstance.getSpecification();
5244
5457
  }
5245
5458
  return null;
5246
5459
  }, [modelInstance]);
5247
5460
  const default_order = viewResponse && viewResponse?.views?.list?.default_order;
5248
- const optionsObject = tab?.options ? (0, import_interface_logic16.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic16.evalJSONContext)(options) : {}) || {};
5461
+ const optionsObject = tab?.options ? (0, import_interface_logic19.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic19.evalJSONContext)(options) : {}) || {};
5249
5462
  const fetchData = async () => {
5250
5463
  try {
5251
5464
  setDomainMany2Many(domain);
5252
- appDispatch((0, import_interface_logic16.setFirstDomain)(domain));
5253
- appDispatch((0, import_interface_logic16.setViewDataStore)(viewResponse));
5465
+ appDispatch((0, import_interface_logic19.setFirstDomain)(domain));
5466
+ appDispatch((0, import_interface_logic19.setViewDataStore)(viewResponse));
5254
5467
  const modalData = viewResponse?.views?.list?.fields.map((field) => ({
5255
5468
  ...viewResponse?.models?.[String(model)]?.[field?.name],
5256
5469
  ...field
@@ -5261,7 +5474,7 @@ var many2manyFieldController = (props) => {
5261
5474
  [`${aid}_${relation}_popupmany2many`]: modalData
5262
5475
  });
5263
5476
  }
5264
- appDispatch((0, import_interface_logic16.setPage)(0));
5477
+ appDispatch((0, import_interface_logic19.setPage)(0));
5265
5478
  } catch (err) {
5266
5479
  console.log(err);
5267
5480
  }
@@ -5283,7 +5496,7 @@ var many2manyFieldController = (props) => {
5283
5496
  context,
5284
5497
  fields: groupByDomain?.fields,
5285
5498
  groupby: [groupByDomain?.contexts[0]?.group_by],
5286
- sort: order ? order : default_order ? (0, import_interface_logic16.formatSortingString)(default_order) : ""
5499
+ sort: order ? order : default_order ? (0, import_interface_logic19.formatSortingString)(default_order) : ""
5287
5500
  };
5288
5501
  const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
5289
5502
  const {
@@ -5291,19 +5504,19 @@ var many2manyFieldController = (props) => {
5291
5504
  isLoading: isDataLoading,
5292
5505
  isFetched: isDataResponseFetched,
5293
5506
  isPlaceholderData
5294
- } = (0, import_interface_logic16.useGetListData)(data, queryKey, enabled);
5295
- (0, import_react16.useEffect)(() => {
5507
+ } = (0, import_interface_logic19.useGetListData)(data, queryKey, enabled);
5508
+ (0, import_react20.useEffect)(() => {
5296
5509
  if (viewResponse) {
5297
5510
  fetchData();
5298
5511
  }
5299
5512
  return () => {
5300
- appDispatch((0, import_interface_logic16.setGroupByDomain)(null));
5513
+ appDispatch((0, import_interface_logic19.setGroupByDomain)(null));
5301
5514
  setFields((prevFields) => ({
5302
5515
  ...prevFields,
5303
5516
  [`${aid}_${relation}_popupmany2many`]: null
5304
5517
  }));
5305
- appDispatch((0, import_interface_logic16.setPage)(0));
5306
- setSelectedRowKeys4([]);
5518
+ appDispatch((0, import_interface_logic19.setPage)(0));
5519
+ setSelectedRowKeys([]);
5307
5520
  setDomainMany2Many(null);
5308
5521
  setIsLoadedData(false);
5309
5522
  };
@@ -5326,18 +5539,18 @@ var many2manyFieldController = (props) => {
5326
5539
  refetch,
5327
5540
  data: dataFormViewResponse,
5328
5541
  isSuccess
5329
- } = (0, import_interface_logic16.useGetFormView)({
5542
+ } = (0, import_interface_logic19.useGetFormView)({
5330
5543
  data: dataFormView,
5331
5544
  queryKey: [`form-view-action-${relation}`],
5332
5545
  enabled: false
5333
5546
  });
5334
- (0, import_react16.useEffect)(() => {
5547
+ (0, import_react20.useEffect)(() => {
5335
5548
  if (isSuccess && dataFormViewResponse) {
5336
5549
  sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
5337
5550
  window.location.href = `/form/menu?model=${relation}`;
5338
5551
  }
5339
5552
  }, [isSuccess]);
5340
- (0, import_react16.useEffect)(() => {
5553
+ (0, import_react20.useEffect)(() => {
5341
5554
  if (domainMany2Many && !isLoadedData) {
5342
5555
  setIsLoadedData(true);
5343
5556
  }
@@ -5349,42 +5562,12 @@ var many2manyFieldController = (props) => {
5349
5562
  console.log(error);
5350
5563
  }
5351
5564
  };
5352
- return {
5353
- rows,
5354
- columns,
5355
- typeTable,
5356
- handleCreateNewOnPage,
5357
- isLoadedData,
5358
- domainMany2Many,
5359
- isDataLoading,
5360
- isDataResponseFetched,
5361
- isPlaceholderData,
5362
- queryKey,
5363
- data,
5364
- specification,
5365
- enabled,
5366
- isViewReponseFetched,
5367
- actionData,
5368
- viewResponse,
5369
- debouncedPage,
5370
- order,
5371
- default_order,
5372
- optionsObject,
5373
- setDomainMany2Many,
5374
- // tableHead,
5375
- selectedTags,
5376
- initModel,
5377
- modelInstance,
5378
- baseModel,
5379
- dataResponse,
5380
- isLoading: isDataLoading,
5381
- setOrder
5382
- };
5565
+ return {};
5383
5566
  };
5384
5567
 
5385
5568
  // src/widget/basic/many2many-tags-field/controller.ts
5386
- var import_react17 = require("react");
5387
- var import_interface_logic17 = require("@fctc/interface-logic");
5569
+ var import_react21 = require("react");
5570
+ var import_interface_logic20 = require("@fctc/interface-logic");
5388
5571
  var many2manyTagsController = (props) => {
5389
5572
  const {
5390
5573
  relation,
@@ -5395,10 +5578,10 @@ var many2manyTagsController = (props) => {
5395
5578
  placeholderNoOption
5396
5579
  } = props;
5397
5580
  const isUser = relation === "res.users" || relation === "res.partner";
5398
- const env = (0, import_interface_logic17.getEnv)();
5399
- const addtionalFields = optionsFields ? (0, import_interface_logic17.evalJSONContext)(optionsFields) : null;
5400
- const domainObject = (0, import_react17.useMemo)(
5401
- () => (0, import_interface_logic17.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5581
+ const env = (0, import_interface_logic20.getEnv)();
5582
+ const addtionalFields = optionsFields ? (0, import_interface_logic20.evalJSONContext)(optionsFields) : null;
5583
+ const domainObject = (0, import_react21.useMemo)(
5584
+ () => (0, import_interface_logic20.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5402
5585
  [domain, formValues]
5403
5586
  );
5404
5587
  const data = {
@@ -5408,13 +5591,13 @@ var many2manyTagsController = (props) => {
5408
5591
  id: {},
5409
5592
  name: {},
5410
5593
  display_name: {},
5411
- ...widget && import_interface_logic17.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5412
- ...widget && import_interface_logic17.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5594
+ ...widget && import_interface_logic20.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5595
+ ...widget && import_interface_logic20.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5413
5596
  },
5414
5597
  enabled: true,
5415
5598
  context: env.context
5416
5599
  };
5417
- const { data: dataOfSelection } = (0, import_interface_logic17.useGetSelection)({
5600
+ const { data: dataOfSelection } = (0, import_interface_logic20.useGetSelection)({
5418
5601
  data,
5419
5602
  queryKey: [`data_${relation}`, domainObject]
5420
5603
  });
@@ -5440,8 +5623,8 @@ var many2manyTagsController = (props) => {
5440
5623
  };
5441
5624
 
5442
5625
  // src/widget/basic/status-bar-field/controller.ts
5443
- var import_react18 = require("react");
5444
- var import_interface_logic18 = require("@fctc/interface-logic");
5626
+ var import_react22 = require("react");
5627
+ var import_interface_logic21 = require("@fctc/interface-logic");
5445
5628
  var durationController = (props) => {
5446
5629
  const {
5447
5630
  relation,
@@ -5458,14 +5641,14 @@ var durationController = (props) => {
5458
5641
  name: "",
5459
5642
  fold: ""
5460
5643
  };
5461
- const [disabled, setDisabled] = (0, import_react18.useState)(false);
5462
- const [modelStatus, setModalStatus] = (0, import_react18.useState)(false);
5463
- const { context } = (0, import_interface_logic18.useAppSelector)(import_interface_logic18.selectEnv);
5644
+ const [disabled, setDisabled] = (0, import_react22.useState)(false);
5645
+ const [modelStatus, setModalStatus] = (0, import_react22.useState)(false);
5646
+ const { context } = (0, import_interface_logic21.useAppSelector)(import_interface_logic21.selectEnv);
5464
5647
  const queryKey = [`data-status-duration`, specification];
5465
5648
  const listDataProps = {
5466
5649
  model: relation,
5467
5650
  specification,
5468
- domain: (0, import_interface_logic18.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5651
+ domain: (0, import_interface_logic21.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5469
5652
  limit: 10,
5470
5653
  offset: 0,
5471
5654
  fields: "",
@@ -5475,8 +5658,8 @@ var durationController = (props) => {
5475
5658
  },
5476
5659
  sort: ""
5477
5660
  };
5478
- const { data: dataResponse } = (0, import_interface_logic18.useGetListData)(listDataProps, queryKey);
5479
- const { mutate: fetchChangeStatus } = (0, import_interface_logic18.useChangeStatus)();
5661
+ const { data: dataResponse } = (0, import_interface_logic21.useGetListData)(listDataProps, queryKey);
5662
+ const { mutate: fetchChangeStatus } = (0, import_interface_logic21.useChangeStatus)();
5480
5663
  const handleClick = async (stage_id) => {
5481
5664
  setDisabled(true);
5482
5665
  if (stage_id) {
@@ -5512,7 +5695,7 @@ var durationController = (props) => {
5512
5695
  };
5513
5696
 
5514
5697
  // src/widget/basic/priority-field/controller.ts
5515
- var import_interface_logic19 = require("@fctc/interface-logic");
5698
+ var import_interface_logic22 = require("@fctc/interface-logic");
5516
5699
  var priorityFieldController = (props) => {
5517
5700
  const {
5518
5701
  value,
@@ -5527,11 +5710,11 @@ var priorityFieldController = (props) => {
5527
5710
  viewData,
5528
5711
  context
5529
5712
  } = props;
5530
- const _context = { ...(0, import_interface_logic19.evalJSONContext)(actionData?.context) };
5713
+ const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) };
5531
5714
  const contextObject = { ...context, ..._context };
5532
5715
  const defaultPriority = parseInt(value) + 1;
5533
5716
  const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
5534
- const { mutateAsync: fetchSave } = (0, import_interface_logic19.useSave)();
5717
+ const { mutateAsync: fetchSave } = (0, import_interface_logic22.useSave)();
5535
5718
  const savePriorities = async ({
5536
5719
  value: value2,
5537
5720
  resetPriority
@@ -5566,8 +5749,8 @@ var priorityFieldController = (props) => {
5566
5749
  };
5567
5750
 
5568
5751
  // src/widget/basic/float-time-field/controller.ts
5569
- var import_react19 = require("react");
5570
- var import_interface_logic20 = require("@fctc/interface-logic");
5752
+ var import_react23 = require("react");
5753
+ var import_interface_logic23 = require("@fctc/interface-logic");
5571
5754
  var floatTimeFiledController = ({
5572
5755
  onChange: fieldOnChange,
5573
5756
  onBlur,
@@ -5576,11 +5759,11 @@ var floatTimeFiledController = ({
5576
5759
  props
5577
5760
  }) => {
5578
5761
  const { name, defaultValue = 0, onChange } = props;
5579
- const [input, setInput] = (0, import_react19.useState)(
5580
- (0, import_interface_logic20.convertFloatToTime)(value ?? defaultValue)
5762
+ const [input, setInput] = (0, import_react23.useState)(
5763
+ (0, import_interface_logic23.convertFloatToTime)(value ?? defaultValue)
5581
5764
  );
5582
- const [formattedTime, setFormattedTime] = (0, import_react19.useState)("");
5583
- const [errors, setErrors] = (0, import_react19.useState)("");
5765
+ const [formattedTime, setFormattedTime] = (0, import_react23.useState)("");
5766
+ const [errors, setErrors] = (0, import_react23.useState)("");
5584
5767
  const handleInputChange = (e) => {
5585
5768
  const raw = e.target.value.replace(/[^\d:]/g, "");
5586
5769
  setInput(raw);
@@ -5610,7 +5793,7 @@ var floatTimeFiledController = ({
5610
5793
  if (!isDirty) return;
5611
5794
  if (formattedTime) {
5612
5795
  setInput(formattedTime);
5613
- const floatVal = (0, import_interface_logic20.convertTimeToFloat)(formattedTime);
5796
+ const floatVal = (0, import_interface_logic23.convertTimeToFloat)(formattedTime);
5614
5797
  fieldOnChange(floatVal);
5615
5798
  if (onChange) {
5616
5799
  onChange(name ?? "", floatVal);
@@ -5653,7 +5836,31 @@ var floatTimeFiledController = ({
5653
5836
  };
5654
5837
 
5655
5838
  // src/widget/basic/float-field/controller.ts
5656
- var import_react20 = require("react");
5839
+ var import_react24 = require("react");
5840
+
5841
+ // src/utils/i18n.ts
5842
+ var import_react_i18next2 = require("react-i18next");
5843
+ var import_i18next = __toESM(require("i18next"));
5844
+ var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5845
+ import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
5846
+ resources: {
5847
+ vi: { translation: vi },
5848
+ en: { translation: en }
5849
+ },
5850
+ fallbackLng: "vi",
5851
+ lng: "vi_VN",
5852
+ debug: false,
5853
+ nonExplicitSupportedLngs: true,
5854
+ interpolation: {
5855
+ escapeValue: false
5856
+ },
5857
+ detection: {
5858
+ caches: ["cookie"]
5859
+ }
5860
+ });
5861
+ var i18n_default = import_i18next.default;
5862
+
5863
+ // src/widget/basic/float-field/controller.ts
5657
5864
  var floatController = ({
5658
5865
  onChange,
5659
5866
  value,
@@ -5661,10 +5868,10 @@ var floatController = ({
5661
5868
  }) => {
5662
5869
  const { name, required, methods, onChange: handleOnchange, string } = props;
5663
5870
  const { setError, clearErrors } = methods;
5664
- const [inputValue, setInputValue] = (0, import_react20.useState)(
5871
+ const [inputValue, setInputValue] = (0, import_react24.useState)(
5665
5872
  value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
5666
5873
  );
5667
- (0, import_react20.useEffect)(() => {
5874
+ (0, import_react24.useEffect)(() => {
5668
5875
  if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
5669
5876
  setInputValue(useFormatFloatNumber(value));
5670
5877
  clearErrors(name);
@@ -5672,9 +5879,9 @@ var floatController = ({
5672
5879
  setInputValue("");
5673
5880
  }
5674
5881
  }, [value, name, clearErrors]);
5675
- const isDirtyRef = (0, import_react20.useRef)(false);
5676
- const inputRef = (0, import_react20.useRef)(null);
5677
- const lastCommittedValueRef = (0, import_react20.useRef)(null);
5882
+ const isDirtyRef = (0, import_react24.useRef)(false);
5883
+ const inputRef = (0, import_react24.useRef)(null);
5884
+ const lastCommittedValueRef = (0, import_react24.useRef)(null);
5678
5885
  const handleInputChange = (e) => {
5679
5886
  const newValue = e.target.value;
5680
5887
  const valueWithoutCommas = newValue.replace(/,/g, "");
@@ -5775,10 +5982,10 @@ var useFormatFloatNumber = (value) => {
5775
5982
  };
5776
5983
 
5777
5984
  // src/widget/basic/download-file-field/controller.ts
5778
- var import_react21 = require("react");
5985
+ var import_react25 = require("react");
5779
5986
  var downloadFileController = () => {
5780
- const inputId = (0, import_react21.useId)();
5781
- const [file, setFile] = (0, import_react21.useState)(null);
5987
+ const inputId = (0, import_react25.useId)();
5988
+ const [file, setFile] = (0, import_react25.useState)(null);
5782
5989
  const handleFileChange = (e) => {
5783
5990
  setFile(e.target.files[0]);
5784
5991
  };
@@ -5948,13 +6155,13 @@ var dateFieldController = (props) => {
5948
6155
  };
5949
6156
 
5950
6157
  // src/widget/basic/copy-link-button/controller.ts
5951
- var import_react22 = require("react");
5952
- var import_interface_logic21 = require("@fctc/interface-logic");
6158
+ var import_react26 = require("react");
6159
+ var import_interface_logic24 = require("@fctc/interface-logic");
5953
6160
  var copyLinkButtonController = (props) => {
5954
6161
  const { value, defaultValue } = props;
5955
- const [isCopied, setIsCopied] = (0, import_react22.useState)(false);
6162
+ const [isCopied, setIsCopied] = (0, import_react26.useState)(false);
5956
6163
  const handleCopyToClipboard = async (value2) => {
5957
- await (0, import_interface_logic21.copyTextToClipboard)(value2);
6164
+ await (0, import_interface_logic24.copyTextToClipboard)(value2);
5958
6165
  setIsCopied(true);
5959
6166
  setTimeout(() => setIsCopied(false), 2e3);
5960
6167
  };
@@ -5967,14 +6174,14 @@ var copyLinkButtonController = (props) => {
5967
6174
  };
5968
6175
 
5969
6176
  // src/widget/basic/color-field/color-controller.ts
5970
- var import_interface_logic22 = require("@fctc/interface-logic");
6177
+ var import_interface_logic25 = require("@fctc/interface-logic");
5971
6178
  var colorFieldController = (props) => {
5972
6179
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
5973
- const env = (0, import_interface_logic22.getEnv)();
5974
- const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) || {} };
6180
+ const env = (0, import_interface_logic25.getEnv)();
6181
+ const _context = { ...(0, import_interface_logic25.evalJSONContext)(actionData?.context) || {} };
5975
6182
  const contextObject = { ...env.context, ..._context };
5976
6183
  const idDefault = isForm ? idForm : formValues?.id;
5977
- const { mutate: onSave } = (0, import_interface_logic22.useSave)();
6184
+ const { mutate: onSave } = (0, import_interface_logic25.useSave)();
5978
6185
  const savePickColor = async (colorObject) => {
5979
6186
  const { id } = colorObject;
5980
6187
  if (value === id) return;
@@ -5999,16 +6206,16 @@ var colorFieldController = (props) => {
5999
6206
  };
6000
6207
 
6001
6208
  // src/widget/basic/binary-field/controller.ts
6002
- var import_react23 = require("react");
6003
- var import_interface_logic23 = require("@fctc/interface-logic");
6209
+ var import_react27 = require("react");
6210
+ var import_interface_logic26 = require("@fctc/interface-logic");
6004
6211
  var binaryFieldController = (props) => {
6005
6212
  const { name, methods, readonly = false, value } = props;
6006
- const inputId = (0, import_react23.useId)();
6007
- const [selectedImage, setSelectedImage] = (0, import_react23.useState)(null);
6008
- const [initialImage, setInitialImage] = (0, import_react23.useState)(value || null);
6009
- const [isInsideTable, setIsInsideTable] = (0, import_react23.useState)(false);
6213
+ const inputId = (0, import_react27.useId)();
6214
+ const [selectedImage, setSelectedImage] = (0, import_react27.useState)(null);
6215
+ const [initialImage, setInitialImage] = (0, import_react27.useState)(value || null);
6216
+ const [isInsideTable, setIsInsideTable] = (0, import_react27.useState)(false);
6010
6217
  const { setValue } = methods;
6011
- const binaryRef = (0, import_react23.useRef)(null);
6218
+ const binaryRef = (0, import_react27.useRef)(null);
6012
6219
  const convertUrlToBase64 = async (url) => {
6013
6220
  try {
6014
6221
  const response = await fetch(url);
@@ -6057,11 +6264,11 @@ var binaryFieldController = (props) => {
6057
6264
  };
6058
6265
  const checkIsImageLink = (url) => {
6059
6266
  const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
6060
- return imageExtensions.test(url) || (0, import_interface_logic23.isBase64Image)(url) || isBlobUrl(url);
6267
+ return imageExtensions.test(url) || (0, import_interface_logic26.isBase64Image)(url) || isBlobUrl(url);
6061
6268
  };
6062
6269
  const getImageBase64WithMimeType = (base64) => {
6063
6270
  if (typeof base64 !== "string" || base64.length < 10) return null;
6064
- if ((0, import_interface_logic23.isBase64Image)(base64)) return base64;
6271
+ if ((0, import_interface_logic26.isBase64Image)(base64)) return base64;
6065
6272
  let mimeType = null;
6066
6273
  if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
6067
6274
  else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
@@ -6070,14 +6277,14 @@ var binaryFieldController = (props) => {
6070
6277
  else if (base64.startsWith("UklGR")) mimeType = "image/webp";
6071
6278
  return mimeType ? `data:${mimeType};base64,${base64}` : null;
6072
6279
  };
6073
- (0, import_react23.useEffect)(() => {
6280
+ (0, import_react27.useEffect)(() => {
6074
6281
  return () => {
6075
6282
  if (selectedImage) {
6076
6283
  URL.revokeObjectURL(selectedImage);
6077
6284
  }
6078
6285
  };
6079
6286
  }, [selectedImage]);
6080
- (0, import_react23.useEffect)(() => {
6287
+ (0, import_react27.useEffect)(() => {
6081
6288
  if (binaryRef.current) {
6082
6289
  const isInsideTable2 = !!binaryRef.current.closest("table");
6083
6290
  setIsInsideTable(isInsideTable2);
@@ -6099,6 +6306,7 @@ var binaryFieldController = (props) => {
6099
6306
  0 && (module.exports = {
6100
6307
  API_APP_URL,
6101
6308
  API_PRESCHOOL_URL,
6309
+ AppProvider,
6102
6310
  CloseIcon,
6103
6311
  EyeIcon,
6104
6312
  LoadingIcon,
@@ -6125,17 +6333,22 @@ var binaryFieldController = (props) => {
6125
6333
  priorityFieldController,
6126
6334
  setStorageItemAsync,
6127
6335
  statusDropdownController,
6336
+ useAppProvider,
6128
6337
  useAuth,
6129
6338
  useCallAction,
6130
6339
  useClickOutside,
6131
6340
  useConfig,
6132
6341
  useDebounce,
6133
6342
  useDetail,
6343
+ useForgotPasswordHandler,
6134
6344
  useGetRowIds,
6135
6345
  useListData,
6346
+ useLoginHandler,
6136
6347
  useMenu,
6137
6348
  useProfile,
6349
+ useResetPasswordHandler,
6138
6350
  useStorageState,
6351
+ useSwitchLocaleHandler,
6139
6352
  useUser,
6140
6353
  useViewV2
6141
6354
  });