@fctc/widget-logic 1.1.5 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -37,26 +37,24 @@ interface IMany2OneProps extends IInputFieldProps {
37
37
  }
38
38
 
39
39
  declare const many2oneFieldController: (props: IMany2OneProps) => {
40
- allowShowDetail: boolean;
40
+ allowShowDetail: any;
41
41
  handleClose: () => void;
42
42
  handleChooseRecord: (idRecord: number) => void;
43
43
  handleSelectChange: (selectedOption: any) => void;
44
44
  initValue: any;
45
45
  isFetching: boolean;
46
46
  isShowModalMany2Many: boolean;
47
- options: any[];
48
- fetchMoreOptions: () => void;
49
- domainModal: any;
47
+ options: never[];
48
+ domainModal: null;
50
49
  tempSelectedOption: any;
51
- setTempSelectedOption: React.Dispatch<React.SetStateAction<any>>;
52
- setDomainModal: React.Dispatch<React.SetStateAction<any>>;
50
+ setTempSelectedOption: react.Dispatch<any>;
51
+ setDomainModal: react.Dispatch<react.SetStateAction<null>>;
53
52
  dataOfSelection: any;
54
- refetch: () => void;
55
- selectOptions: any[];
56
- optionsObject: any;
53
+ selectOptions: any;
54
+ optionsObject: {};
57
55
  contextObject: any;
58
56
  actionId: any;
59
- setIsShowModalMany2Many: React.Dispatch<React.SetStateAction<boolean>>;
57
+ setIsShowModalMany2Many: react.Dispatch<react.SetStateAction<boolean>>;
60
58
  };
61
59
 
62
60
  type Option = {
package/dist/index.d.ts CHANGED
@@ -37,26 +37,24 @@ interface IMany2OneProps extends IInputFieldProps {
37
37
  }
38
38
 
39
39
  declare const many2oneFieldController: (props: IMany2OneProps) => {
40
- allowShowDetail: boolean;
40
+ allowShowDetail: any;
41
41
  handleClose: () => void;
42
42
  handleChooseRecord: (idRecord: number) => void;
43
43
  handleSelectChange: (selectedOption: any) => void;
44
44
  initValue: any;
45
45
  isFetching: boolean;
46
46
  isShowModalMany2Many: boolean;
47
- options: any[];
48
- fetchMoreOptions: () => void;
49
- domainModal: any;
47
+ options: never[];
48
+ domainModal: null;
50
49
  tempSelectedOption: any;
51
- setTempSelectedOption: React.Dispatch<React.SetStateAction<any>>;
52
- setDomainModal: React.Dispatch<React.SetStateAction<any>>;
50
+ setTempSelectedOption: react.Dispatch<any>;
51
+ setDomainModal: react.Dispatch<react.SetStateAction<null>>;
53
52
  dataOfSelection: any;
54
- refetch: () => void;
55
- selectOptions: any[];
56
- optionsObject: any;
53
+ selectOptions: any;
54
+ optionsObject: {};
57
55
  contextObject: any;
58
56
  actionId: any;
59
- setIsShowModalMany2Many: React.Dispatch<React.SetStateAction<boolean>>;
57
+ setIsShowModalMany2Many: react.Dispatch<react.SetStateAction<boolean>>;
60
58
  };
61
59
 
62
60
  type Option = {
package/dist/index.js CHANGED
@@ -4930,7 +4930,7 @@ var many2oneFieldController = (props) => {
4930
4930
  const queryKey = [`data_${relation}`, domainObject];
4931
4931
  const {
4932
4932
  data: dataOfSelection,
4933
- refetch,
4933
+ // refetch,
4934
4934
  isFetching
4935
4935
  } = (0, import_interface_logic10.useGetSelection)({
4936
4936
  data,
@@ -4959,9 +4959,6 @@ var many2oneFieldController = (props) => {
4959
4959
  });
4960
4960
  }
4961
4961
  }, [propValue]);
4962
- const fetchMoreOptions = (0, import_react12.useCallback)(() => {
4963
- refetch();
4964
- }, [refetch]);
4965
4962
  (0, import_react12.useEffect)(() => {
4966
4963
  if (actionId) {
4967
4964
  localStorage.setItem("aid", actionId);
@@ -5027,13 +5024,13 @@ var many2oneFieldController = (props) => {
5027
5024
  isFetching,
5028
5025
  isShowModalMany2Many,
5029
5026
  options,
5030
- fetchMoreOptions,
5027
+ // fetchMoreOptions,
5031
5028
  domainModal,
5032
5029
  tempSelectedOption,
5033
5030
  setTempSelectedOption,
5034
5031
  setDomainModal,
5035
5032
  dataOfSelection,
5036
- refetch,
5033
+ // refetch,
5037
5034
  selectOptions,
5038
5035
  optionsObject,
5039
5036
  contextObject,
@@ -5068,15 +5065,22 @@ var many2oneButtonController = (props) => {
5068
5065
  };
5069
5066
 
5070
5067
  // src/widget/basic/many2many-field/controller.ts
5071
- var import_react14 = require("react");
5072
- var import_interface_logic13 = require("@fctc/interface-logic");
5068
+ var import_react16 = require("react");
5069
+ var import_interface_logic16 = require("@fctc/interface-logic");
5073
5070
 
5074
- // src/widget/advance/table/table-view/controller.ts
5071
+ // src/widget/advance/table/table-body/controller.ts
5075
5072
  var import_interface_logic12 = require("@fctc/interface-logic");
5076
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");
5077
+
5078
+ // src/widget/advance/table/table-view/controller.ts
5079
+ var import_interface_logic14 = require("@fctc/interface-logic");
5080
+ var import_react14 = require("react");
5077
5081
  var tableController = ({ data }) => {
5078
- const [rows, setRows] = (0, import_react13.useState)(data.records || []);
5079
- const [columns, setColumns] = (0, import_react13.useState)([]);
5082
+ const [rows, setRows] = (0, import_react14.useState)(data.records || []);
5083
+ const [columns, setColumns] = (0, import_react14.useState)([]);
5080
5084
  const dataModelFields = data.fields?.map((field) => {
5081
5085
  return {
5082
5086
  ...data.dataModel?.[field?.name],
@@ -5104,14 +5108,14 @@ var tableController = ({ data }) => {
5104
5108
  return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
5105
5109
  });
5106
5110
  };
5107
- (0, import_react13.useEffect)(() => {
5111
+ (0, import_react14.useEffect)(() => {
5108
5112
  setRows(transformData(data.records || null));
5109
5113
  }, [data.records]);
5110
5114
  const handleGetColumns = () => {
5111
5115
  let cols = [];
5112
5116
  try {
5113
5117
  cols = mergeFields?.filter((item) => {
5114
- return item?.widget !== "details_Receive_money" && !(item?.column_invisible ? import_interface_logic12.domainHelper.matchDomains(data.context, item?.column_invisible) : item?.invisible ? import_interface_logic12.domainHelper.matchDomains(data.context, item?.invisible) : false);
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);
5115
5119
  })?.map((field) => {
5116
5120
  return {
5117
5121
  name: field?.name,
@@ -5125,7 +5129,7 @@ var tableController = ({ data }) => {
5125
5129
  }
5126
5130
  return cols;
5127
5131
  };
5128
- (0, import_react13.useEffect)(() => {
5132
+ (0, import_react14.useEffect)(() => {
5129
5133
  const columns2 = handleGetColumns();
5130
5134
  setColumns(columns2);
5131
5135
  }, [data.records]);
@@ -5149,6 +5153,32 @@ var tableController = ({ data }) => {
5149
5153
  };
5150
5154
  };
5151
5155
 
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
+
5152
5182
  // src/widget/basic/many2many-field/controller.ts
5153
5183
  var many2manyFieldController = (props) => {
5154
5184
  const {
@@ -5158,7 +5188,7 @@ var many2manyFieldController = (props) => {
5158
5188
  tab,
5159
5189
  model,
5160
5190
  aid,
5161
- setSelectedRowKeys,
5191
+ setSelectedRowKeys: setSelectedRowKeys4,
5162
5192
  fields,
5163
5193
  setFields,
5164
5194
  groupByDomain,
@@ -5166,14 +5196,14 @@ var many2manyFieldController = (props) => {
5166
5196
  options,
5167
5197
  sessionStorageUtils
5168
5198
  } = props;
5169
- const appDispatch = (0, import_interface_logic13.useAppDispatch)();
5199
+ const appDispatch = (0, import_interface_logic16.useAppDispatch)();
5170
5200
  const actionData = sessionStorageUtils.getActionData();
5171
5201
  const [debouncedPage] = useDebounce(page, 500);
5172
- const [order, setOrder] = (0, import_react14.useState)();
5173
- const [isLoadedData, setIsLoadedData] = (0, import_react14.useState)(false);
5174
- const [domainMany2Many, setDomainMany2Many] = (0, import_react14.useState)(domain);
5175
- const env = (0, import_interface_logic13.getEnv)();
5176
- const { selectedTags } = (0, import_interface_logic13.useAppSelector)(import_interface_logic13.selectSearch);
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 { selectedTags } = (0, import_interface_logic16.useAppSelector)(import_interface_logic16.selectSearch);
5177
5207
  const viewParams = {
5178
5208
  model: relation,
5179
5209
  views: [
@@ -5182,11 +5212,11 @@ var many2manyFieldController = (props) => {
5182
5212
  ],
5183
5213
  context
5184
5214
  };
5185
- const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic13.useGetView)(
5215
+ const { data: viewResponse, isFetched: isViewReponseFetched } = (0, import_interface_logic16.useGetView)(
5186
5216
  viewParams,
5187
5217
  actionData
5188
5218
  );
5189
- const baseModel = (0, import_react14.useMemo)(
5219
+ const baseModel = (0, import_react16.useMemo)(
5190
5220
  () => ({
5191
5221
  name: String(relation),
5192
5222
  view: viewResponse || {},
@@ -5198,26 +5228,26 @@ var many2manyFieldController = (props) => {
5198
5228
  }),
5199
5229
  [model, viewResponse]
5200
5230
  );
5201
- const initModel = (0, import_interface_logic13.useModel)();
5202
- const modelInstance = (0, import_react14.useMemo)(() => {
5231
+ const initModel = (0, import_interface_logic16.useModel)();
5232
+ const modelInstance = (0, import_react16.useMemo)(() => {
5203
5233
  if (viewResponse) {
5204
5234
  return initModel.initModel(baseModel);
5205
5235
  }
5206
5236
  return null;
5207
5237
  }, [baseModel, viewResponse]);
5208
- const specification = (0, import_react14.useMemo)(() => {
5238
+ const specification = (0, import_react16.useMemo)(() => {
5209
5239
  if (modelInstance) {
5210
5240
  return modelInstance.getSpecification();
5211
5241
  }
5212
5242
  return null;
5213
5243
  }, [modelInstance]);
5214
5244
  const default_order = viewResponse && viewResponse?.views?.list?.default_order;
5215
- const optionsObject = tab?.options ? (0, import_interface_logic13.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic13.evalJSONContext)(options) : {}) || {};
5245
+ const optionsObject = tab?.options ? (0, import_interface_logic16.evalJSONContext)(tab?.options) : (options ? (0, import_interface_logic16.evalJSONContext)(options) : {}) || {};
5216
5246
  const fetchData = async () => {
5217
5247
  try {
5218
5248
  setDomainMany2Many(domain);
5219
- appDispatch((0, import_interface_logic13.setFirstDomain)(domain));
5220
- appDispatch((0, import_interface_logic13.setViewDataStore)(viewResponse));
5249
+ appDispatch((0, import_interface_logic16.setFirstDomain)(domain));
5250
+ appDispatch((0, import_interface_logic16.setViewDataStore)(viewResponse));
5221
5251
  const modalData = viewResponse?.views?.list?.fields.map((field) => ({
5222
5252
  ...viewResponse?.models?.[String(model)]?.[field?.name],
5223
5253
  ...field
@@ -5228,7 +5258,7 @@ var many2manyFieldController = (props) => {
5228
5258
  [`${aid}_${relation}_popupmany2many`]: modalData
5229
5259
  });
5230
5260
  }
5231
- appDispatch((0, import_interface_logic13.setPage)(0));
5261
+ appDispatch((0, import_interface_logic16.setPage)(0));
5232
5262
  } catch (err) {
5233
5263
  console.log(err);
5234
5264
  }
@@ -5250,7 +5280,7 @@ var many2manyFieldController = (props) => {
5250
5280
  context,
5251
5281
  fields: groupByDomain?.fields,
5252
5282
  groupby: [groupByDomain?.contexts[0]?.group_by],
5253
- sort: order ? order : default_order ? (0, import_interface_logic13.formatSortingString)(default_order) : ""
5283
+ sort: order ? order : default_order ? (0, import_interface_logic16.formatSortingString)(default_order) : ""
5254
5284
  };
5255
5285
  const enabled = isLoadedData && !!specification && !!relation && !!domainMany2Many && !!viewResponse;
5256
5286
  const {
@@ -5258,19 +5288,19 @@ var many2manyFieldController = (props) => {
5258
5288
  isLoading: isDataLoading,
5259
5289
  isFetched: isDataResponseFetched,
5260
5290
  isPlaceholderData
5261
- } = (0, import_interface_logic13.useGetListData)(data, queryKey, enabled);
5262
- (0, import_react14.useEffect)(() => {
5291
+ } = (0, import_interface_logic16.useGetListData)(data, queryKey, enabled);
5292
+ (0, import_react16.useEffect)(() => {
5263
5293
  if (viewResponse) {
5264
5294
  fetchData();
5265
5295
  }
5266
5296
  return () => {
5267
- appDispatch((0, import_interface_logic13.setGroupByDomain)(null));
5297
+ appDispatch((0, import_interface_logic16.setGroupByDomain)(null));
5268
5298
  setFields((prevFields) => ({
5269
5299
  ...prevFields,
5270
5300
  [`${aid}_${relation}_popupmany2many`]: null
5271
5301
  }));
5272
- appDispatch((0, import_interface_logic13.setPage)(0));
5273
- setSelectedRowKeys([]);
5302
+ appDispatch((0, import_interface_logic16.setPage)(0));
5303
+ setSelectedRowKeys4([]);
5274
5304
  setDomainMany2Many(null);
5275
5305
  setIsLoadedData(false);
5276
5306
  };
@@ -5293,18 +5323,18 @@ var many2manyFieldController = (props) => {
5293
5323
  refetch,
5294
5324
  data: dataFormViewResponse,
5295
5325
  isSuccess
5296
- } = (0, import_interface_logic13.useGetFormView)({
5326
+ } = (0, import_interface_logic16.useGetFormView)({
5297
5327
  data: dataFormView,
5298
5328
  queryKey: [`form-view-action-${relation}`],
5299
5329
  enabled: false
5300
5330
  });
5301
- (0, import_react14.useEffect)(() => {
5331
+ (0, import_react16.useEffect)(() => {
5302
5332
  if (isSuccess && dataFormViewResponse) {
5303
5333
  sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
5304
5334
  window.location.href = `/form/menu?model=${relation}`;
5305
5335
  }
5306
5336
  }, [isSuccess]);
5307
- (0, import_react14.useEffect)(() => {
5337
+ (0, import_react16.useEffect)(() => {
5308
5338
  if (domainMany2Many && !isLoadedData) {
5309
5339
  setIsLoadedData(true);
5310
5340
  }
@@ -5320,8 +5350,8 @@ var many2manyFieldController = (props) => {
5320
5350
  };
5321
5351
 
5322
5352
  // src/widget/basic/many2many-tags-field/controller.ts
5323
- var import_react15 = require("react");
5324
- var import_interface_logic14 = require("@fctc/interface-logic");
5353
+ var import_react17 = require("react");
5354
+ var import_interface_logic17 = require("@fctc/interface-logic");
5325
5355
  var many2manyTagsController = (props) => {
5326
5356
  const {
5327
5357
  relation,
@@ -5332,10 +5362,10 @@ var many2manyTagsController = (props) => {
5332
5362
  placeholderNoOption
5333
5363
  } = props;
5334
5364
  const isUser = relation === "res.users" || relation === "res.partner";
5335
- const env = (0, import_interface_logic14.getEnv)();
5336
- const addtionalFields = optionsFields ? (0, import_interface_logic14.evalJSONContext)(optionsFields) : null;
5337
- const domainObject = (0, import_react15.useMemo)(
5338
- () => (0, import_interface_logic14.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5365
+ const env = (0, import_interface_logic17.getEnv)();
5366
+ const addtionalFields = optionsFields ? (0, import_interface_logic17.evalJSONContext)(optionsFields) : null;
5367
+ const domainObject = (0, import_react17.useMemo)(
5368
+ () => (0, import_interface_logic17.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues || {}))),
5339
5369
  [domain, formValues]
5340
5370
  );
5341
5371
  const data = {
@@ -5345,13 +5375,13 @@ var many2manyTagsController = (props) => {
5345
5375
  id: {},
5346
5376
  name: {},
5347
5377
  display_name: {},
5348
- ...widget && import_interface_logic14.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5349
- ...widget && import_interface_logic14.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5378
+ ...widget && import_interface_logic17.WIDGETAVATAR[widget] ? { image_256: {} } : {},
5379
+ ...widget && import_interface_logic17.WIDGETCOLOR[widget] && addtionalFields?.color_field ? { color: {} } : {}
5350
5380
  },
5351
5381
  enabled: true,
5352
5382
  context: env.context
5353
5383
  };
5354
- const { data: dataOfSelection } = (0, import_interface_logic14.useGetSelection)({
5384
+ const { data: dataOfSelection } = (0, import_interface_logic17.useGetSelection)({
5355
5385
  data,
5356
5386
  queryKey: [`data_${relation}`, domainObject]
5357
5387
  });
@@ -5377,8 +5407,8 @@ var many2manyTagsController = (props) => {
5377
5407
  };
5378
5408
 
5379
5409
  // src/widget/basic/status-bar-field/controller.ts
5380
- var import_react16 = require("react");
5381
- var import_interface_logic15 = require("@fctc/interface-logic");
5410
+ var import_react18 = require("react");
5411
+ var import_interface_logic18 = require("@fctc/interface-logic");
5382
5412
  var durationController = (props) => {
5383
5413
  const {
5384
5414
  relation,
@@ -5395,14 +5425,14 @@ var durationController = (props) => {
5395
5425
  name: "",
5396
5426
  fold: ""
5397
5427
  };
5398
- const [disabled, setDisabled] = (0, import_react16.useState)(false);
5399
- const [modelStatus, setModalStatus] = (0, import_react16.useState)(false);
5400
- const { context } = (0, import_interface_logic15.useAppSelector)(import_interface_logic15.selectEnv);
5428
+ const [disabled, setDisabled] = (0, import_react18.useState)(false);
5429
+ const [modelStatus, setModalStatus] = (0, import_react18.useState)(false);
5430
+ const { context } = (0, import_interface_logic18.useAppSelector)(import_interface_logic18.selectEnv);
5401
5431
  const queryKey = [`data-status-duration`, specification];
5402
5432
  const listDataProps = {
5403
5433
  model: relation,
5404
5434
  specification,
5405
- domain: (0, import_interface_logic15.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5435
+ domain: (0, import_interface_logic18.evalJSONDomain)(domain, JSON.parse(JSON.stringify(formValues))),
5406
5436
  limit: 10,
5407
5437
  offset: 0,
5408
5438
  fields: "",
@@ -5412,8 +5442,8 @@ var durationController = (props) => {
5412
5442
  },
5413
5443
  sort: ""
5414
5444
  };
5415
- const { data: dataResponse } = (0, import_interface_logic15.useGetListData)(listDataProps, queryKey);
5416
- const { mutate: fetchChangeStatus } = (0, import_interface_logic15.useChangeStatus)();
5445
+ const { data: dataResponse } = (0, import_interface_logic18.useGetListData)(listDataProps, queryKey);
5446
+ const { mutate: fetchChangeStatus } = (0, import_interface_logic18.useChangeStatus)();
5417
5447
  const handleClick = async (stage_id) => {
5418
5448
  setDisabled(true);
5419
5449
  if (stage_id) {
@@ -5449,7 +5479,7 @@ var durationController = (props) => {
5449
5479
  };
5450
5480
 
5451
5481
  // src/widget/basic/priority-field/controller.ts
5452
- var import_interface_logic16 = require("@fctc/interface-logic");
5482
+ var import_interface_logic19 = require("@fctc/interface-logic");
5453
5483
  var priorityFieldController = (props) => {
5454
5484
  const {
5455
5485
  value,
@@ -5464,11 +5494,11 @@ var priorityFieldController = (props) => {
5464
5494
  viewData,
5465
5495
  context
5466
5496
  } = props;
5467
- const _context = { ...(0, import_interface_logic16.evalJSONContext)(actionData?.context) };
5497
+ const _context = { ...(0, import_interface_logic19.evalJSONContext)(actionData?.context) };
5468
5498
  const contextObject = { ...context, ..._context };
5469
5499
  const defaultPriority = parseInt(value) + 1;
5470
5500
  const label = viewData?.models?.[model]?.[name ?? ""]?.string ?? name;
5471
- const { mutateAsync: fetchSave } = (0, import_interface_logic16.useSave)();
5501
+ const { mutateAsync: fetchSave } = (0, import_interface_logic19.useSave)();
5472
5502
  const savePriorities = async ({
5473
5503
  value: value2,
5474
5504
  resetPriority
@@ -5503,8 +5533,8 @@ var priorityFieldController = (props) => {
5503
5533
  };
5504
5534
 
5505
5535
  // src/widget/basic/float-time-field/controller.ts
5506
- var import_react17 = require("react");
5507
- var import_interface_logic17 = require("@fctc/interface-logic");
5536
+ var import_react19 = require("react");
5537
+ var import_interface_logic20 = require("@fctc/interface-logic");
5508
5538
  var floatTimeFiledController = ({
5509
5539
  onChange: fieldOnChange,
5510
5540
  onBlur,
@@ -5513,11 +5543,11 @@ var floatTimeFiledController = ({
5513
5543
  props
5514
5544
  }) => {
5515
5545
  const { name, defaultValue = 0, onChange } = props;
5516
- const [input, setInput] = (0, import_react17.useState)(
5517
- (0, import_interface_logic17.convertFloatToTime)(value ?? defaultValue)
5546
+ const [input, setInput] = (0, import_react19.useState)(
5547
+ (0, import_interface_logic20.convertFloatToTime)(value ?? defaultValue)
5518
5548
  );
5519
- const [formattedTime, setFormattedTime] = (0, import_react17.useState)("");
5520
- const [errors, setErrors] = (0, import_react17.useState)("");
5549
+ const [formattedTime, setFormattedTime] = (0, import_react19.useState)("");
5550
+ const [errors, setErrors] = (0, import_react19.useState)("");
5521
5551
  const handleInputChange = (e) => {
5522
5552
  const raw = e.target.value.replace(/[^\d:]/g, "");
5523
5553
  setInput(raw);
@@ -5547,7 +5577,7 @@ var floatTimeFiledController = ({
5547
5577
  if (!isDirty) return;
5548
5578
  if (formattedTime) {
5549
5579
  setInput(formattedTime);
5550
- const floatVal = (0, import_interface_logic17.convertTimeToFloat)(formattedTime);
5580
+ const floatVal = (0, import_interface_logic20.convertTimeToFloat)(formattedTime);
5551
5581
  fieldOnChange(floatVal);
5552
5582
  if (onChange) {
5553
5583
  onChange(name ?? "", floatVal);
@@ -5590,31 +5620,7 @@ var floatTimeFiledController = ({
5590
5620
  };
5591
5621
 
5592
5622
  // src/widget/basic/float-field/controller.ts
5593
- var import_react18 = require("react");
5594
-
5595
- // src/utils/i18n.ts
5596
- var import_react_i18next2 = require("react-i18next");
5597
- var import_i18next = __toESM(require("i18next"));
5598
- var import_i18next_browser_languagedetector = __toESM(require("i18next-browser-languagedetector"));
5599
- import_i18next.default.use(import_i18next_browser_languagedetector.default).use(import_react_i18next2.initReactI18next).init({
5600
- resources: {
5601
- vi: { translation: vi },
5602
- en: { translation: en }
5603
- },
5604
- fallbackLng: "vi",
5605
- lng: "vi_VN",
5606
- debug: false,
5607
- nonExplicitSupportedLngs: true,
5608
- interpolation: {
5609
- escapeValue: false
5610
- },
5611
- detection: {
5612
- caches: ["cookie"]
5613
- }
5614
- });
5615
- var i18n_default = import_i18next.default;
5616
-
5617
- // src/widget/basic/float-field/controller.ts
5623
+ var import_react20 = require("react");
5618
5624
  var floatController = ({
5619
5625
  onChange,
5620
5626
  value,
@@ -5622,10 +5628,10 @@ var floatController = ({
5622
5628
  }) => {
5623
5629
  const { name, required, methods, onChange: handleOnchange, string } = props;
5624
5630
  const { setError, clearErrors } = methods;
5625
- const [inputValue, setInputValue] = (0, import_react18.useState)(
5631
+ const [inputValue, setInputValue] = (0, import_react20.useState)(
5626
5632
  value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
5627
5633
  );
5628
- (0, import_react18.useEffect)(() => {
5634
+ (0, import_react20.useEffect)(() => {
5629
5635
  if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
5630
5636
  setInputValue(useFormatFloatNumber(value));
5631
5637
  clearErrors(name);
@@ -5633,9 +5639,9 @@ var floatController = ({
5633
5639
  setInputValue("");
5634
5640
  }
5635
5641
  }, [value, name, clearErrors]);
5636
- const isDirtyRef = (0, import_react18.useRef)(false);
5637
- const inputRef = (0, import_react18.useRef)(null);
5638
- const lastCommittedValueRef = (0, import_react18.useRef)(null);
5642
+ const isDirtyRef = (0, import_react20.useRef)(false);
5643
+ const inputRef = (0, import_react20.useRef)(null);
5644
+ const lastCommittedValueRef = (0, import_react20.useRef)(null);
5639
5645
  const handleInputChange = (e) => {
5640
5646
  const newValue = e.target.value;
5641
5647
  const valueWithoutCommas = newValue.replace(/,/g, "");
@@ -5736,10 +5742,10 @@ var useFormatFloatNumber = (value) => {
5736
5742
  };
5737
5743
 
5738
5744
  // src/widget/basic/download-file-field/controller.ts
5739
- var import_react19 = require("react");
5745
+ var import_react21 = require("react");
5740
5746
  var downloadFileController = () => {
5741
- const inputId = (0, import_react19.useId)();
5742
- const [file, setFile] = (0, import_react19.useState)(null);
5747
+ const inputId = (0, import_react21.useId)();
5748
+ const [file, setFile] = (0, import_react21.useState)(null);
5743
5749
  const handleFileChange = (e) => {
5744
5750
  setFile(e.target.files[0]);
5745
5751
  };
@@ -5909,13 +5915,13 @@ var dateFieldController = (props) => {
5909
5915
  };
5910
5916
 
5911
5917
  // src/widget/basic/copy-link-button/controller.ts
5912
- var import_react20 = require("react");
5913
- var import_interface_logic18 = require("@fctc/interface-logic");
5918
+ var import_react22 = require("react");
5919
+ var import_interface_logic21 = require("@fctc/interface-logic");
5914
5920
  var copyLinkButtonController = (props) => {
5915
5921
  const { value, defaultValue } = props;
5916
- const [isCopied, setIsCopied] = (0, import_react20.useState)(false);
5922
+ const [isCopied, setIsCopied] = (0, import_react22.useState)(false);
5917
5923
  const handleCopyToClipboard = async (value2) => {
5918
- await (0, import_interface_logic18.copyTextToClipboard)(value2);
5924
+ await (0, import_interface_logic21.copyTextToClipboard)(value2);
5919
5925
  setIsCopied(true);
5920
5926
  setTimeout(() => setIsCopied(false), 2e3);
5921
5927
  };
@@ -5928,14 +5934,14 @@ var copyLinkButtonController = (props) => {
5928
5934
  };
5929
5935
 
5930
5936
  // src/widget/basic/color-field/color-controller.ts
5931
- var import_interface_logic19 = require("@fctc/interface-logic");
5937
+ var import_interface_logic22 = require("@fctc/interface-logic");
5932
5938
  var colorFieldController = (props) => {
5933
5939
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
5934
- const env = (0, import_interface_logic19.getEnv)();
5935
- const _context = { ...(0, import_interface_logic19.evalJSONContext)(actionData?.context) || {} };
5940
+ const env = (0, import_interface_logic22.getEnv)();
5941
+ const _context = { ...(0, import_interface_logic22.evalJSONContext)(actionData?.context) || {} };
5936
5942
  const contextObject = { ...env.context, ..._context };
5937
5943
  const idDefault = isForm ? idForm : formValues?.id;
5938
- const { mutate: onSave } = (0, import_interface_logic19.useSave)();
5944
+ const { mutate: onSave } = (0, import_interface_logic22.useSave)();
5939
5945
  const savePickColor = async (colorObject) => {
5940
5946
  const { id } = colorObject;
5941
5947
  if (value === id) return;
@@ -5960,16 +5966,16 @@ var colorFieldController = (props) => {
5960
5966
  };
5961
5967
 
5962
5968
  // src/widget/basic/binary-field/controller.ts
5963
- var import_react21 = require("react");
5964
- var import_interface_logic20 = require("@fctc/interface-logic");
5969
+ var import_react23 = require("react");
5970
+ var import_interface_logic23 = require("@fctc/interface-logic");
5965
5971
  var binaryFieldController = (props) => {
5966
5972
  const { name, methods, readonly = false, value } = props;
5967
- const inputId = (0, import_react21.useId)();
5968
- const [selectedImage, setSelectedImage] = (0, import_react21.useState)(null);
5969
- const [initialImage, setInitialImage] = (0, import_react21.useState)(value || null);
5970
- const [isInsideTable, setIsInsideTable] = (0, import_react21.useState)(false);
5973
+ const inputId = (0, import_react23.useId)();
5974
+ const [selectedImage, setSelectedImage] = (0, import_react23.useState)(null);
5975
+ const [initialImage, setInitialImage] = (0, import_react23.useState)(value || null);
5976
+ const [isInsideTable, setIsInsideTable] = (0, import_react23.useState)(false);
5971
5977
  const { setValue } = methods;
5972
- const binaryRef = (0, import_react21.useRef)(null);
5978
+ const binaryRef = (0, import_react23.useRef)(null);
5973
5979
  const convertUrlToBase64 = async (url) => {
5974
5980
  try {
5975
5981
  const response = await fetch(url);
@@ -6018,11 +6024,11 @@ var binaryFieldController = (props) => {
6018
6024
  };
6019
6025
  const checkIsImageLink = (url) => {
6020
6026
  const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|tiff|ico)$/i;
6021
- return imageExtensions.test(url) || (0, import_interface_logic20.isBase64Image)(url) || isBlobUrl(url);
6027
+ return imageExtensions.test(url) || (0, import_interface_logic23.isBase64Image)(url) || isBlobUrl(url);
6022
6028
  };
6023
6029
  const getImageBase64WithMimeType = (base64) => {
6024
6030
  if (typeof base64 !== "string" || base64.length < 10) return null;
6025
- if ((0, import_interface_logic20.isBase64Image)(base64)) return base64;
6031
+ if ((0, import_interface_logic23.isBase64Image)(base64)) return base64;
6026
6032
  let mimeType = null;
6027
6033
  if (base64.startsWith("iVBORw0KGgo")) mimeType = "image/png";
6028
6034
  else if (base64.startsWith("/9j/")) mimeType = "image/jpeg";
@@ -6031,14 +6037,14 @@ var binaryFieldController = (props) => {
6031
6037
  else if (base64.startsWith("UklGR")) mimeType = "image/webp";
6032
6038
  return mimeType ? `data:${mimeType};base64,${base64}` : null;
6033
6039
  };
6034
- (0, import_react21.useEffect)(() => {
6040
+ (0, import_react23.useEffect)(() => {
6035
6041
  return () => {
6036
6042
  if (selectedImage) {
6037
6043
  URL.revokeObjectURL(selectedImage);
6038
6044
  }
6039
6045
  };
6040
6046
  }, [selectedImage]);
6041
- (0, import_react21.useEffect)(() => {
6047
+ (0, import_react23.useEffect)(() => {
6042
6048
  if (binaryRef.current) {
6043
6049
  const isInsideTable2 = !!binaryRef.current.closest("table");
6044
6050
  setIsInsideTable(isInsideTable2);
package/dist/index.mjs CHANGED
@@ -4914,7 +4914,7 @@ var many2oneFieldController = (props) => {
4914
4914
  const queryKey = [`data_${relation}`, domainObject];
4915
4915
  const {
4916
4916
  data: dataOfSelection,
4917
- refetch,
4917
+ // refetch,
4918
4918
  isFetching
4919
4919
  } = useGetSelection({
4920
4920
  data,
@@ -4943,9 +4943,6 @@ var many2oneFieldController = (props) => {
4943
4943
  });
4944
4944
  }
4945
4945
  }, [propValue]);
4946
- const fetchMoreOptions = useCallback2(() => {
4947
- refetch();
4948
- }, [refetch]);
4949
4946
  useEffect9(() => {
4950
4947
  if (actionId) {
4951
4948
  localStorage.setItem("aid", actionId);
@@ -5011,13 +5008,13 @@ var many2oneFieldController = (props) => {
5011
5008
  isFetching,
5012
5009
  isShowModalMany2Many,
5013
5010
  options,
5014
- fetchMoreOptions,
5011
+ // fetchMoreOptions,
5015
5012
  domainModal,
5016
5013
  tempSelectedOption,
5017
5014
  setTempSelectedOption,
5018
5015
  setDomainModal,
5019
5016
  dataOfSelection,
5020
- refetch,
5017
+ // refetch,
5021
5018
  selectOptions,
5022
5019
  optionsObject,
5023
5020
  contextObject,
@@ -5057,32 +5054,44 @@ var many2oneButtonController = (props) => {
5057
5054
  };
5058
5055
 
5059
5056
  // src/widget/basic/many2many-field/controller.ts
5060
- import { useEffect as useEffect11, useMemo as useMemo8, useState as useState9 } from "react";
5057
+ import { useEffect as useEffect13, useMemo as useMemo10, useState as useState10 } from "react";
5061
5058
  import {
5062
5059
  evalJSONContext as evalJSONContext3,
5063
5060
  formatSortingString as formatSortingString2,
5064
- getEnv as getEnv6,
5065
- selectSearch as selectSearch3,
5061
+ getEnv as getEnv7,
5062
+ selectSearch as selectSearch5,
5066
5063
  setFirstDomain,
5067
5064
  setGroupByDomain,
5068
5065
  setPage,
5069
5066
  setViewDataStore,
5070
- useAppDispatch as useAppDispatch5,
5071
- useAppSelector as useAppSelector4,
5067
+ useAppDispatch as useAppDispatch8,
5068
+ useAppSelector as useAppSelector6,
5072
5069
  useGetFormView,
5073
- useGetListData as useGetListData2,
5070
+ useGetListData as useGetListData3,
5074
5071
  useGetView as useGetView2,
5075
5072
  useModel as useModel2
5076
5073
  } from "@fctc/interface-logic";
5077
5074
 
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
+
5078
5087
  // src/widget/advance/table/table-view/controller.ts
5079
5088
  import {
5080
5089
  domainHelper,
5081
5090
  selectList as selectList2,
5082
- selectSearch as selectSearch2,
5083
- useAppSelector as useAppSelector3
5091
+ selectSearch as selectSearch3,
5092
+ useAppSelector as useAppSelector4
5084
5093
  } from "@fctc/interface-logic";
5085
- import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef4, useState as useState8 } from "react";
5094
+ import { useEffect as useEffect11, useMemo as useMemo8, useRef as useRef4, useState as useState8 } from "react";
5086
5095
  var tableController = ({ data }) => {
5087
5096
  const [rows, setRows] = useState8(data.records || []);
5088
5097
  const [columns, setColumns] = useState8([]);
@@ -5113,7 +5122,7 @@ var tableController = ({ data }) => {
5113
5122
  return item.display_name ? { ...transformedItem, item: item.display_name } : transformedItem;
5114
5123
  });
5115
5124
  };
5116
- useEffect10(() => {
5125
+ useEffect11(() => {
5117
5126
  setRows(transformData(data.records || null));
5118
5127
  }, [data.records]);
5119
5128
  const handleGetColumns = () => {
@@ -5134,7 +5143,7 @@ var tableController = ({ data }) => {
5134
5143
  }
5135
5144
  return cols;
5136
5145
  };
5137
- useEffect10(() => {
5146
+ useEffect11(() => {
5138
5147
  const columns2 = handleGetColumns();
5139
5148
  setColumns(columns2);
5140
5149
  }, [data.records]);
@@ -5158,6 +5167,41 @@ var tableController = ({ data }) => {
5158
5167
  };
5159
5168
  };
5160
5169
 
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
+
5161
5205
  // src/widget/basic/many2many-field/controller.ts
5162
5206
  var many2manyFieldController = (props) => {
5163
5207
  const {
@@ -5167,7 +5211,7 @@ var many2manyFieldController = (props) => {
5167
5211
  tab,
5168
5212
  model,
5169
5213
  aid,
5170
- setSelectedRowKeys,
5214
+ setSelectedRowKeys: setSelectedRowKeys4,
5171
5215
  fields,
5172
5216
  setFields,
5173
5217
  groupByDomain,
@@ -5175,14 +5219,14 @@ var many2manyFieldController = (props) => {
5175
5219
  options,
5176
5220
  sessionStorageUtils
5177
5221
  } = props;
5178
- const appDispatch = useAppDispatch5();
5222
+ const appDispatch = useAppDispatch8();
5179
5223
  const actionData = sessionStorageUtils.getActionData();
5180
5224
  const [debouncedPage] = useDebounce(page, 500);
5181
- const [order, setOrder] = useState9();
5182
- const [isLoadedData, setIsLoadedData] = useState9(false);
5183
- const [domainMany2Many, setDomainMany2Many] = useState9(domain);
5184
- const env = getEnv6();
5185
- const { selectedTags } = useAppSelector4(selectSearch3);
5225
+ const [order, setOrder] = useState10();
5226
+ const [isLoadedData, setIsLoadedData] = useState10(false);
5227
+ const [domainMany2Many, setDomainMany2Many] = useState10(domain);
5228
+ const env = getEnv7();
5229
+ const { selectedTags } = useAppSelector6(selectSearch5);
5186
5230
  const viewParams = {
5187
5231
  model: relation,
5188
5232
  views: [
@@ -5195,7 +5239,7 @@ var many2manyFieldController = (props) => {
5195
5239
  viewParams,
5196
5240
  actionData
5197
5241
  );
5198
- const baseModel = useMemo8(
5242
+ const baseModel = useMemo10(
5199
5243
  () => ({
5200
5244
  name: String(relation),
5201
5245
  view: viewResponse || {},
@@ -5208,13 +5252,13 @@ var many2manyFieldController = (props) => {
5208
5252
  [model, viewResponse]
5209
5253
  );
5210
5254
  const initModel = useModel2();
5211
- const modelInstance = useMemo8(() => {
5255
+ const modelInstance = useMemo10(() => {
5212
5256
  if (viewResponse) {
5213
5257
  return initModel.initModel(baseModel);
5214
5258
  }
5215
5259
  return null;
5216
5260
  }, [baseModel, viewResponse]);
5217
- const specification = useMemo8(() => {
5261
+ const specification = useMemo10(() => {
5218
5262
  if (modelInstance) {
5219
5263
  return modelInstance.getSpecification();
5220
5264
  }
@@ -5267,8 +5311,8 @@ var many2manyFieldController = (props) => {
5267
5311
  isLoading: isDataLoading,
5268
5312
  isFetched: isDataResponseFetched,
5269
5313
  isPlaceholderData
5270
- } = useGetListData2(data, queryKey, enabled);
5271
- useEffect11(() => {
5314
+ } = useGetListData3(data, queryKey, enabled);
5315
+ useEffect13(() => {
5272
5316
  if (viewResponse) {
5273
5317
  fetchData();
5274
5318
  }
@@ -5279,7 +5323,7 @@ var many2manyFieldController = (props) => {
5279
5323
  [`${aid}_${relation}_popupmany2many`]: null
5280
5324
  }));
5281
5325
  appDispatch(setPage(0));
5282
- setSelectedRowKeys([]);
5326
+ setSelectedRowKeys4([]);
5283
5327
  setDomainMany2Many(null);
5284
5328
  setIsLoadedData(false);
5285
5329
  };
@@ -5307,13 +5351,13 @@ var many2manyFieldController = (props) => {
5307
5351
  queryKey: [`form-view-action-${relation}`],
5308
5352
  enabled: false
5309
5353
  });
5310
- useEffect11(() => {
5354
+ useEffect13(() => {
5311
5355
  if (isSuccess && dataFormViewResponse) {
5312
5356
  sessionStorage.setItem("actionData", JSON.stringify(dataFormViewResponse));
5313
5357
  window.location.href = `/form/menu?model=${relation}`;
5314
5358
  }
5315
5359
  }, [isSuccess]);
5316
- useEffect11(() => {
5360
+ useEffect13(() => {
5317
5361
  if (domainMany2Many && !isLoadedData) {
5318
5362
  setIsLoadedData(true);
5319
5363
  }
@@ -5329,11 +5373,11 @@ var many2manyFieldController = (props) => {
5329
5373
  };
5330
5374
 
5331
5375
  // src/widget/basic/many2many-tags-field/controller.ts
5332
- import { useMemo as useMemo9 } from "react";
5376
+ import { useMemo as useMemo11 } from "react";
5333
5377
  import {
5334
5378
  evalJSONContext as evalJSONContext4,
5335
5379
  evalJSONDomain as evalJSONDomain4,
5336
- getEnv as getEnv7,
5380
+ getEnv as getEnv8,
5337
5381
  useGetSelection as useGetSelection3,
5338
5382
  WIDGETAVATAR,
5339
5383
  WIDGETCOLOR
@@ -5348,9 +5392,9 @@ var many2manyTagsController = (props) => {
5348
5392
  placeholderNoOption
5349
5393
  } = props;
5350
5394
  const isUser = relation === "res.users" || relation === "res.partner";
5351
- const env = getEnv7();
5395
+ const env = getEnv8();
5352
5396
  const addtionalFields = optionsFields ? evalJSONContext4(optionsFields) : null;
5353
- const domainObject = useMemo9(
5397
+ const domainObject = useMemo11(
5354
5398
  () => evalJSONDomain4(domain, JSON.parse(JSON.stringify(formValues || {}))),
5355
5399
  [domain, formValues]
5356
5400
  );
@@ -5393,13 +5437,13 @@ var many2manyTagsController = (props) => {
5393
5437
  };
5394
5438
 
5395
5439
  // src/widget/basic/status-bar-field/controller.ts
5396
- import { useState as useState10 } from "react";
5440
+ import { useState as useState11 } from "react";
5397
5441
  import {
5398
5442
  evalJSONDomain as evalJSONDomain5,
5399
5443
  selectEnv as selectEnv2,
5400
- useAppSelector as useAppSelector5,
5444
+ useAppSelector as useAppSelector7,
5401
5445
  useChangeStatus,
5402
- useGetListData as useGetListData3
5446
+ useGetListData as useGetListData4
5403
5447
  } from "@fctc/interface-logic";
5404
5448
  var durationController = (props) => {
5405
5449
  const {
@@ -5417,9 +5461,9 @@ var durationController = (props) => {
5417
5461
  name: "",
5418
5462
  fold: ""
5419
5463
  };
5420
- const [disabled, setDisabled] = useState10(false);
5421
- const [modelStatus, setModalStatus] = useState10(false);
5422
- const { context } = useAppSelector5(selectEnv2);
5464
+ const [disabled, setDisabled] = useState11(false);
5465
+ const [modelStatus, setModalStatus] = useState11(false);
5466
+ const { context } = useAppSelector7(selectEnv2);
5423
5467
  const queryKey = [`data-status-duration`, specification];
5424
5468
  const listDataProps = {
5425
5469
  model: relation,
@@ -5434,7 +5478,7 @@ var durationController = (props) => {
5434
5478
  },
5435
5479
  sort: ""
5436
5480
  };
5437
- const { data: dataResponse } = useGetListData3(listDataProps, queryKey);
5481
+ const { data: dataResponse } = useGetListData4(listDataProps, queryKey);
5438
5482
  const { mutate: fetchChangeStatus } = useChangeStatus();
5439
5483
  const handleClick = async (stage_id) => {
5440
5484
  setDisabled(true);
@@ -5525,7 +5569,7 @@ var priorityFieldController = (props) => {
5525
5569
  };
5526
5570
 
5527
5571
  // src/widget/basic/float-time-field/controller.ts
5528
- import { useState as useState11 } from "react";
5572
+ import { useState as useState12 } from "react";
5529
5573
  import { convertFloatToTime, convertTimeToFloat } from "@fctc/interface-logic";
5530
5574
  var floatTimeFiledController = ({
5531
5575
  onChange: fieldOnChange,
@@ -5535,11 +5579,11 @@ var floatTimeFiledController = ({
5535
5579
  props
5536
5580
  }) => {
5537
5581
  const { name, defaultValue = 0, onChange } = props;
5538
- const [input, setInput] = useState11(
5582
+ const [input, setInput] = useState12(
5539
5583
  convertFloatToTime(value ?? defaultValue)
5540
5584
  );
5541
- const [formattedTime, setFormattedTime] = useState11("");
5542
- const [errors, setErrors] = useState11("");
5585
+ const [formattedTime, setFormattedTime] = useState12("");
5586
+ const [errors, setErrors] = useState12("");
5543
5587
  const handleInputChange = (e) => {
5544
5588
  const raw = e.target.value.replace(/[^\d:]/g, "");
5545
5589
  setInput(raw);
@@ -5612,31 +5656,7 @@ var floatTimeFiledController = ({
5612
5656
  };
5613
5657
 
5614
5658
  // src/widget/basic/float-field/controller.ts
5615
- import { useEffect as useEffect12, useRef as useRef5, useState as useState12 } from "react";
5616
-
5617
- // src/utils/i18n.ts
5618
- import { initReactI18next } from "react-i18next";
5619
- import i18n from "i18next";
5620
- import LanguageDetector from "i18next-browser-languagedetector";
5621
- i18n.use(LanguageDetector).use(initReactI18next).init({
5622
- resources: {
5623
- vi: { translation: vi },
5624
- en: { translation: en }
5625
- },
5626
- fallbackLng: "vi",
5627
- lng: "vi_VN",
5628
- debug: false,
5629
- nonExplicitSupportedLngs: true,
5630
- interpolation: {
5631
- escapeValue: false
5632
- },
5633
- detection: {
5634
- caches: ["cookie"]
5635
- }
5636
- });
5637
- var i18n_default = i18n;
5638
-
5639
- // src/widget/basic/float-field/controller.ts
5659
+ import { useEffect as useEffect14, useRef as useRef5, useState as useState13 } from "react";
5640
5660
  var floatController = ({
5641
5661
  onChange,
5642
5662
  value,
@@ -5644,10 +5664,10 @@ var floatController = ({
5644
5664
  }) => {
5645
5665
  const { name, required, methods, onChange: handleOnchange, string } = props;
5646
5666
  const { setError, clearErrors } = methods;
5647
- const [inputValue, setInputValue] = useState12(
5667
+ const [inputValue, setInputValue] = useState13(
5648
5668
  value !== void 0 && value !== null ? useFormatFloatNumber(value) : ""
5649
5669
  );
5650
- useEffect12(() => {
5670
+ useEffect14(() => {
5651
5671
  if (value !== void 0 && value !== null && value !== parseFloat(inputValue?.replace(/,/g, ""))) {
5652
5672
  setInputValue(useFormatFloatNumber(value));
5653
5673
  clearErrors(name);
@@ -5758,10 +5778,10 @@ var useFormatFloatNumber = (value) => {
5758
5778
  };
5759
5779
 
5760
5780
  // src/widget/basic/download-file-field/controller.ts
5761
- import { useId, useState as useState13 } from "react";
5781
+ import { useId, useState as useState14 } from "react";
5762
5782
  var downloadFileController = () => {
5763
5783
  const inputId = useId();
5764
- const [file, setFile] = useState13(null);
5784
+ const [file, setFile] = useState14(null);
5765
5785
  const handleFileChange = (e) => {
5766
5786
  setFile(e.target.files[0]);
5767
5787
  };
@@ -5931,11 +5951,11 @@ var dateFieldController = (props) => {
5931
5951
  };
5932
5952
 
5933
5953
  // src/widget/basic/copy-link-button/controller.ts
5934
- import { useState as useState14 } from "react";
5954
+ import { useState as useState15 } from "react";
5935
5955
  import { copyTextToClipboard } from "@fctc/interface-logic";
5936
5956
  var copyLinkButtonController = (props) => {
5937
5957
  const { value, defaultValue } = props;
5938
- const [isCopied, setIsCopied] = useState14(false);
5958
+ const [isCopied, setIsCopied] = useState15(false);
5939
5959
  const handleCopyToClipboard = async (value2) => {
5940
5960
  await copyTextToClipboard(value2);
5941
5961
  setIsCopied(true);
@@ -5950,10 +5970,10 @@ var copyLinkButtonController = (props) => {
5950
5970
  };
5951
5971
 
5952
5972
  // src/widget/basic/color-field/color-controller.ts
5953
- import { evalJSONContext as evalJSONContext6, getEnv as getEnv8, useSave as useSave3 } from "@fctc/interface-logic";
5973
+ import { evalJSONContext as evalJSONContext6, getEnv as getEnv9, useSave as useSave3 } from "@fctc/interface-logic";
5954
5974
  var colorFieldController = (props) => {
5955
5975
  const { value, isForm, name, formValues, idForm, model, actionData } = props;
5956
- const env = getEnv8();
5976
+ const env = getEnv9();
5957
5977
  const _context = { ...evalJSONContext6(actionData?.context) || {} };
5958
5978
  const contextObject = { ...env.context, ..._context };
5959
5979
  const idDefault = isForm ? idForm : formValues?.id;
@@ -5982,14 +6002,14 @@ var colorFieldController = (props) => {
5982
6002
  };
5983
6003
 
5984
6004
  // src/widget/basic/binary-field/controller.ts
5985
- import { useEffect as useEffect13, useId as useId2, useRef as useRef6, useState as useState15 } from "react";
6005
+ import { useEffect as useEffect15, useId as useId2, useRef as useRef6, useState as useState16 } from "react";
5986
6006
  import { isBase64Image } from "@fctc/interface-logic";
5987
6007
  var binaryFieldController = (props) => {
5988
6008
  const { name, methods, readonly = false, value } = props;
5989
6009
  const inputId = useId2();
5990
- const [selectedImage, setSelectedImage] = useState15(null);
5991
- const [initialImage, setInitialImage] = useState15(value || null);
5992
- const [isInsideTable, setIsInsideTable] = useState15(false);
6010
+ const [selectedImage, setSelectedImage] = useState16(null);
6011
+ const [initialImage, setInitialImage] = useState16(value || null);
6012
+ const [isInsideTable, setIsInsideTable] = useState16(false);
5993
6013
  const { setValue } = methods;
5994
6014
  const binaryRef = useRef6(null);
5995
6015
  const convertUrlToBase64 = async (url) => {
@@ -6053,14 +6073,14 @@ var binaryFieldController = (props) => {
6053
6073
  else if (base64.startsWith("UklGR")) mimeType = "image/webp";
6054
6074
  return mimeType ? `data:${mimeType};base64,${base64}` : null;
6055
6075
  };
6056
- useEffect13(() => {
6076
+ useEffect15(() => {
6057
6077
  return () => {
6058
6078
  if (selectedImage) {
6059
6079
  URL.revokeObjectURL(selectedImage);
6060
6080
  }
6061
6081
  };
6062
6082
  }, [selectedImage]);
6063
- useEffect13(() => {
6083
+ useEffect15(() => {
6064
6084
  if (binaryRef.current) {
6065
6085
  const isInsideTable2 = !!binaryRef.current.closest("table");
6066
6086
  setIsInsideTable(isInsideTable2);
package/package.json CHANGED
@@ -1,66 +1,66 @@
1
- {
2
- "name": "@fctc/widget-logic",
3
- "version": "1.1.5",
4
- "types": "dist/index.d.ts",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- },
13
- "./hooks": {
14
- "types": "./dist/hooks.d.ts",
15
- "import": "./dist/hooks.mjs",
16
- "require": "./dist/hooks.cjs"
17
- },
18
- "./types": {
19
- "types": "./dist/types.d.ts",
20
- "import": "./dist/types.mjs",
21
- "require": "./dist/types.cjs"
22
- },
23
- "./widget": {
24
- "types": "./dist/widget.d.ts",
25
- "import": "./dist/widget.mjs",
26
- "require": "./dist/widget.cjs"
27
- },
28
- "./icons": {
29
- "types": "./dist/icons.d.ts",
30
- "import": "./dist/icons.mjs",
31
- "require": "./dist/icons.cjs"
32
- },
33
- "./utils": {
34
- "types": "./dist/utils.d.ts",
35
- "import": "./dist/utils.mjs",
36
- "require": "./dist/utils.cjs"
37
- }
38
- },
39
- "files": [
40
- "dist"
41
- ],
42
- "scripts": {
43
- "build": "tsup",
44
- "test": "jest"
45
- },
46
- "dependencies": {
47
- "@fctc/interface-logic": "^1.0.4",
48
- "@headlessui/react": "^2.2.6",
49
- "@tanstack/react-query": "^5.84.0",
50
- "@types/react-dom": "^19.1.7",
51
- "i18next": "^25.3.2",
52
- "i18next-browser-languagedetector": "^8.2.0",
53
- "react-datepicker": "^8.4.0",
54
- "react-dom": "^19.1.1",
55
- "react-i18next": "^15.6.1",
56
- "react-tooltip": "^5.29.1"
57
- },
58
- "devDependencies": {
59
- "@types/react": "18.0.0",
60
- "jest": "^29.7.0",
61
- "react": "18.0.0",
62
- "tsup": "^8.0.0",
63
- "typescript": "^5.8.2"
64
- },
65
- "packageManager": "yarn@1.22.0"
66
- }
1
+ {
2
+ "name": "@fctc/widget-logic",
3
+ "version": "1.1.7",
4
+ "types": "dist/index.d.ts",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./hooks": {
14
+ "types": "./dist/hooks.d.ts",
15
+ "import": "./dist/hooks.mjs",
16
+ "require": "./dist/hooks.cjs"
17
+ },
18
+ "./types": {
19
+ "types": "./dist/types.d.ts",
20
+ "import": "./dist/types.mjs",
21
+ "require": "./dist/types.cjs"
22
+ },
23
+ "./widget": {
24
+ "types": "./dist/widget.d.ts",
25
+ "import": "./dist/widget.mjs",
26
+ "require": "./dist/widget.cjs"
27
+ },
28
+ "./icons": {
29
+ "types": "./dist/icons.d.ts",
30
+ "import": "./dist/icons.mjs",
31
+ "require": "./dist/icons.cjs"
32
+ },
33
+ "./utils": {
34
+ "types": "./dist/utils.d.ts",
35
+ "import": "./dist/utils.mjs",
36
+ "require": "./dist/utils.cjs"
37
+ }
38
+ },
39
+ "files": [
40
+ "dist"
41
+ ],
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "test": "jest"
45
+ },
46
+ "dependencies": {
47
+ "@fctc/interface-logic": "^1.0.4",
48
+ "@headlessui/react": "^2.2.6",
49
+ "@tanstack/react-query": "^5.84.0",
50
+ "@types/react-dom": "^19.1.7",
51
+ "i18next": "^25.3.2",
52
+ "i18next-browser-languagedetector": "^8.2.0",
53
+ "react-datepicker": "^8.4.0",
54
+ "react-dom": "^19.1.1",
55
+ "react-i18next": "^15.6.1",
56
+ "react-tooltip": "^5.29.1"
57
+ },
58
+ "devDependencies": {
59
+ "@types/react": "18.0.0",
60
+ "jest": "^29.7.0",
61
+ "react": "18.0.0",
62
+ "tsup": "^8.0.0",
63
+ "typescript": "^5.8.2"
64
+ },
65
+ "packageManager": "yarn@1.22.0"
66
+ }