@fctc/sme-widget-ui 1.0.1 → 1.0.2

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/widgets.d.ts CHANGED
@@ -66,7 +66,7 @@ declare const Row: (props: any) => JSX.Element;
66
66
 
67
67
  declare const Login: React__default.FC<LoginProps>;
68
68
 
69
- declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, }: any) => JSX.Element;
69
+ declare const Search: ({ removeSearchItems, selectedTags, filterBy, setFilterBy, searchString, onSearchString, handleAddTagSearch, searchBy, groupBy, showFiltersGroups, setGroupBy, setSelectedRowKeys, setDomainList, setPage, fieldsList, viewData, context, aid, selectedRowKeys, domainSearch, evalJSONContext, clearSearch, }: any) => JSX.Element;
70
70
 
71
71
  interface IActiveBadgeProps extends IInputFieldProps {
72
72
  type: any;
@@ -425,7 +425,7 @@ declare const LoadingSmall: () => JSX.Element;
425
425
 
426
426
  declare const RenderFiles: ({ selectedFiles, setSelectedFiles, useGetImage }: any) => JSX.Element;
427
427
 
428
- declare const ButtonSelectFiles: ({ fileInputRef, selectedFiles, setSelectedFiles, setUploadError, model, id, widget, useUploadImage, useUploadFile }: any) => JSX.Element;
428
+ declare const ButtonSelectFiles: ({ fileInputRef, selectedFiles, setSelectedFiles, setUploadError, model, id, widget, useUploadImage, useUploadFile, }: any) => JSX.Element;
429
429
 
430
430
  interface VideoPlayerProps {
431
431
  src: string;
package/dist/widgets.js CHANGED
@@ -12157,7 +12157,10 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
12157
12157
  "div",
12158
12158
  {
12159
12159
  ref: filterRef,
12160
- className: "w-fit absolute top-[8px] right-[10px] ms-auto z-[32] bg-[#eff1f2] pl-2 ",
12160
+ style: {
12161
+ transform: "translateY(-50%)"
12162
+ },
12163
+ className: "w-fit absolute top-[50%] translate-y-[-50%] right-[10px] ms-auto z-[32] bg-[#eff1f2]",
12161
12164
  children: [
12162
12165
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12163
12166
  "button",
@@ -12363,7 +12366,11 @@ var TableHead = (props) => {
12363
12366
  columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
12364
12367
  "th",
12365
12368
  {
12366
- className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212]`,
12369
+ style: {
12370
+ minWidth: "40px",
12371
+ right: 0
12372
+ },
12373
+ className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212] min-w-[40px] sticky right-[0px] bg-[#eff1f2]`,
12367
12374
  children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
12368
12375
  TableFilter,
12369
12376
  {
@@ -14520,10 +14527,8 @@ var PopupFilter = ({
14520
14527
  return;
14521
14528
  }
14522
14529
  typeof handleAddTagSearch === "function" && handleAddTagSearch({
14523
- title: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FilterIcon, {}),
14524
14530
  name: item?.name,
14525
14531
  value: item?.string ?? item?.help,
14526
- icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FilterIcon, {}),
14527
14532
  domain: item?.domain,
14528
14533
  groupIndex: item?.group_index,
14529
14534
  type: SearchType.FILTER
@@ -14562,10 +14567,8 @@ var PopupFilter = ({
14562
14567
  return;
14563
14568
  }
14564
14569
  typeof handleAddTagSearch === "function" && handleAddTagSearch({
14565
- title: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(GroupByIcon, {}),
14566
14570
  name: item?.name,
14567
14571
  value: item?.string,
14568
- icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(GroupByIcon, {}),
14569
14572
  type: SearchType.GROUP,
14570
14573
  context: JSON.parse(item?.context.replace(/'/g, '"')),
14571
14574
  active: !isExist,
@@ -14608,7 +14611,7 @@ var TagSearch = ({
14608
14611
  {
14609
14612
  className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14610
14613
  children: [
14611
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
14614
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FilterIcon, {}) }),
14612
14615
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
14613
14616
  return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react17.Fragment, { children: [
14614
14617
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: value }),
@@ -14654,7 +14657,7 @@ var TagSearch = ({
14654
14657
  {
14655
14658
  className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14656
14659
  children: [
14657
- /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
14660
+ /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(GroupByIcon, {}) }),
14658
14661
  value?.strings?.map((string, idx) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
14659
14662
  /* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: string }),
14660
14663
  idx < value?.strings.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
@@ -14767,7 +14770,8 @@ var Search = ({
14767
14770
  aid,
14768
14771
  selectedRowKeys,
14769
14772
  domainSearch,
14770
- evalJSONContext
14773
+ evalJSONContext,
14774
+ clearSearch
14771
14775
  }) => {
14772
14776
  const [showPopupFilter, setShowPopupFilter] = (0, import_react18.useState)(false);
14773
14777
  const popupFilterRef = useClickOutside({
@@ -14787,6 +14791,13 @@ var Search = ({
14787
14791
  }
14788
14792
  }
14789
14793
  }, [selectedTags, isReadyFormatDomain]);
14794
+ (0, import_react18.useEffect)(() => {
14795
+ return () => {
14796
+ clearSearch();
14797
+ setDidInit(false);
14798
+ setIsReadyFormatDomain(false);
14799
+ };
14800
+ }, [viewData]);
14790
14801
  (0, import_react18.useEffect)(() => {
14791
14802
  if (didInit || selectedTags?.length > 0) return;
14792
14803
  const searchDefaults = Object.entries(context || {}).filter(
@@ -17358,13 +17369,14 @@ var ButtonSelectFiles = ({
17358
17369
  const MAX_TOTAL_SIZE = 50 * 1024 * 1024;
17359
17370
  const { mutate: onUploadImage, isPending } = useUploadImage();
17360
17371
  const { mutate: onUploadFile } = useUploadFile();
17361
- const handleUploadImage = async ({ data }) => {
17372
+ const handleUploadImage = async ({ formData }) => {
17373
+ console.log("data", formData);
17362
17374
  if (widget !== "many2many_binary") {
17363
17375
  onUploadImage(
17364
- { data },
17376
+ { formData },
17365
17377
  {
17366
- onSuccess: (data2) => {
17367
- const formatData = data2?.data?.["ir.attachment"]?.[0];
17378
+ onSuccess: (data) => {
17379
+ const formatData = data?.data?.["ir.attachment"]?.[0];
17368
17380
  const files = [...selectedFiles, formatData];
17369
17381
  setSelectedFiles(files);
17370
17382
  y2.success(instance.t("upload_success"));
@@ -17376,10 +17388,10 @@ var ButtonSelectFiles = ({
17376
17388
  );
17377
17389
  } else {
17378
17390
  onUploadFile(
17379
- { data },
17391
+ { formData },
17380
17392
  {
17381
- onSuccess: (data2) => {
17382
- const formatData = data2?.data?.["ir.attachment"]?.[0];
17393
+ onSuccess: (data) => {
17394
+ const formatData = data?.data?.["ir.attachment"]?.[0];
17383
17395
  const files = [...selectedFiles, formatData];
17384
17396
  setSelectedFiles(files);
17385
17397
  y2.success(i18n_default.t("upload_success"));
@@ -17422,10 +17434,10 @@ var ButtonSelectFiles = ({
17422
17434
  setUploadError(false);
17423
17435
  const formData = new FormData();
17424
17436
  formData.append("ufile", file);
17425
- formData.append("thread_model", model);
17437
+ formData.append("thread_model", String(model));
17426
17438
  formData.append("thread_id", Number(id));
17427
17439
  formData.append("is_pending", true);
17428
- await handleUploadImage({ data: formData });
17440
+ await handleUploadImage({ formData });
17429
17441
  }
17430
17442
  };
17431
17443
  return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
@@ -32659,9 +32671,6 @@ var import_react58 = require("react");
32659
32671
  var import_jsx_runtime87 = require("react/jsx-runtime");
32660
32672
  var InfomationField = (props) => {
32661
32673
  const { value, isForm = false, showName = true, stringToColor } = props;
32662
- if (isForm) {
32663
- return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { children: "abc" });
32664
- }
32665
32674
  if (!value || Array.isArray(value) && value.length === 0) {
32666
32675
  return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, {});
32667
32676
  }
@@ -32692,7 +32701,7 @@ var InfomationField = (props) => {
32692
32701
 
32693
32702
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
32694
32703
  var import_jsx_runtime88 = require("react/jsx-runtime");
32695
- var CustomMultiValue = (props) => {
32704
+ var CustomMultiValue = ({ stringToColor, ...props }) => {
32696
32705
  const { selectProps, data, menuList } = props;
32697
32706
  const { relation } = selectProps;
32698
32707
  const actionId = menuList?.flatMap(
@@ -32709,7 +32718,8 @@ var CustomMultiValue = (props) => {
32709
32718
  relation,
32710
32719
  isForm: false,
32711
32720
  aid: actionId?.id,
32712
- avatarSrc: data?.image_256
32721
+ avatarSrc: data?.image_256,
32722
+ stringToColor
32713
32723
  }
32714
32724
  ),
32715
32725
  /* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
@@ -32754,7 +32764,14 @@ var Many2ManyTagField = (props) => {
32754
32764
  value: item.id,
32755
32765
  label: item.name ?? item.display_name
32756
32766
  })) : [];
32757
- return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(InfomationField, { value: optionValue || null, isForm, stringToColor });
32767
+ return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
32768
+ InfomationField,
32769
+ {
32770
+ value: optionValue || null,
32771
+ isForm,
32772
+ stringToColor
32773
+ }
32774
+ );
32758
32775
  }
32759
32776
  return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
32760
32777
  Controller,
@@ -32839,7 +32856,13 @@ var Many2ManyTagField = (props) => {
32839
32856
  })
32840
32857
  },
32841
32858
  components: isUser ? {
32842
- MultiValue: CustomMultiValue,
32859
+ MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
32860
+ CustomMultiValue,
32861
+ {
32862
+ ...multiValueProps,
32863
+ stringToColor
32864
+ }
32865
+ ),
32843
32866
  IndicatorSeparator: () => null
32844
32867
  } : {
32845
32868
  IndicatorSeparator: () => null
@@ -33605,7 +33628,8 @@ var Many2ManyField = (props) => {
33605
33628
  searchString,
33606
33629
  selectedTags,
33607
33630
  setFilterBy,
33608
- setGroupBy
33631
+ setGroupBy,
33632
+ clearSearch
33609
33633
  } = searchController;
33610
33634
  return (0, import_react_dom8.createPortal)(
33611
33635
  /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
@@ -33646,7 +33670,8 @@ var Many2ManyField = (props) => {
33646
33670
  selectedRowKeys,
33647
33671
  aid,
33648
33672
  domainSearch,
33649
- evalJSONContext
33673
+ evalJSONContext,
33674
+ clearSearch
33650
33675
  }
33651
33676
  ) }),
33652
33677
  /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
package/dist/widgets.mjs CHANGED
@@ -12023,11 +12023,11 @@ var TableBody = (props) => {
12023
12023
  };
12024
12024
 
12025
12025
  // src/widgets/advanced/table/table-filter.tsx
12026
- import { useEffect as useEffect4, useRef as useRef5, useState as useState3 } from "react";
12026
+ import { useEffect as useEffect4, useRef as useRef4, useState as useState3 } from "react";
12027
12027
  import { createPortal } from "react-dom";
12028
12028
 
12029
12029
  // src/hooks/use-click-outside.ts
12030
- import { useEffect as useEffect3, useRef as useRef4 } from "react";
12030
+ import { useEffect as useEffect3, useRef as useRef3 } from "react";
12031
12031
  var DEFAULT_EVENTS = ["mousedown", "touchstart"];
12032
12032
  var useClickOutside = ({
12033
12033
  handler,
@@ -12036,7 +12036,7 @@ var useClickOutside = ({
12036
12036
  // Default to empty array to avoid undefined errors
12037
12037
  refs
12038
12038
  }) => {
12039
- const ref = useRef4(null);
12039
+ const ref = useRef3(null);
12040
12040
  useEffect3(() => {
12041
12041
  const listener = (event) => {
12042
12042
  const { target } = event;
@@ -12063,7 +12063,7 @@ import { jsx as jsx43, jsxs as jsxs27 } from "react/jsx-runtime";
12063
12063
  var TableFilter = ({ columns, onToggleColumnOptional }) => {
12064
12064
  const [openTableFilter, setOpenTableFilter] = useState3();
12065
12065
  const [filterPosition, setFilterPosition] = useState3(null);
12066
- const filterPopupRef = useRef5(null);
12066
+ const filterPopupRef = useRef4(null);
12067
12067
  const filterRef = useClickOutside({
12068
12068
  handler: () => {
12069
12069
  if (openTableFilter) {
@@ -12095,7 +12095,10 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
12095
12095
  "div",
12096
12096
  {
12097
12097
  ref: filterRef,
12098
- className: "w-fit absolute top-[8px] right-[10px] ms-auto z-[32] bg-[#eff1f2] pl-2 ",
12098
+ style: {
12099
+ transform: "translateY(-50%)"
12100
+ },
12101
+ className: "w-fit absolute top-[50%] translate-y-[-50%] right-[10px] ms-auto z-[32] bg-[#eff1f2]",
12099
12102
  children: [
12100
12103
  /* @__PURE__ */ jsx43(
12101
12104
  "button",
@@ -12301,7 +12304,11 @@ var TableHead = (props) => {
12301
12304
  columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ jsx45(
12302
12305
  "th",
12303
12306
  {
12304
- className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212]`,
12307
+ style: {
12308
+ minWidth: "40px",
12309
+ right: 0
12310
+ },
12311
+ className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212] min-w-[40px] sticky right-[0px] bg-[#eff1f2]`,
12305
12312
  children: /* @__PURE__ */ jsx45(
12306
12313
  TableFilter,
12307
12314
  {
@@ -14458,10 +14465,8 @@ var PopupFilter = ({
14458
14465
  return;
14459
14466
  }
14460
14467
  typeof handleAddTagSearch === "function" && handleAddTagSearch({
14461
- title: /* @__PURE__ */ jsx54(FilterIcon, {}),
14462
14468
  name: item?.name,
14463
14469
  value: item?.string ?? item?.help,
14464
- icon: /* @__PURE__ */ jsx54(FilterIcon, {}),
14465
14470
  domain: item?.domain,
14466
14471
  groupIndex: item?.group_index,
14467
14472
  type: SearchType.FILTER
@@ -14500,10 +14505,8 @@ var PopupFilter = ({
14500
14505
  return;
14501
14506
  }
14502
14507
  typeof handleAddTagSearch === "function" && handleAddTagSearch({
14503
- title: /* @__PURE__ */ jsx54(GroupByIcon, {}),
14504
14508
  name: item?.name,
14505
14509
  value: item?.string,
14506
- icon: /* @__PURE__ */ jsx54(GroupByIcon, {}),
14507
14510
  type: SearchType.GROUP,
14508
14511
  context: JSON.parse(item?.context.replace(/'/g, '"')),
14509
14512
  active: !isExist,
@@ -14546,7 +14549,7 @@ var TagSearch = ({
14546
14549
  {
14547
14550
  className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14548
14551
  children: [
14549
- /* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
14552
+ /* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ jsx55(FilterIcon, {}) }),
14550
14553
  /* @__PURE__ */ jsx55("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
14551
14554
  return /* @__PURE__ */ jsxs37(Fragment7, { children: [
14552
14555
  /* @__PURE__ */ jsx55("span", { children: value }),
@@ -14592,7 +14595,7 @@ var TagSearch = ({
14592
14595
  {
14593
14596
  className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
14594
14597
  children: [
14595
- /* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
14598
+ /* @__PURE__ */ jsx55("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ jsx55(GroupByIcon, {}) }),
14596
14599
  value?.strings?.map((string, idx) => /* @__PURE__ */ jsxs37(Fragment8, { children: [
14597
14600
  /* @__PURE__ */ jsx55("span", { children: string }),
14598
14601
  idx < value?.strings.length - 1 && /* @__PURE__ */ jsxs37("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
@@ -14705,7 +14708,8 @@ var Search = ({
14705
14708
  aid,
14706
14709
  selectedRowKeys,
14707
14710
  domainSearch,
14708
- evalJSONContext
14711
+ evalJSONContext,
14712
+ clearSearch
14709
14713
  }) => {
14710
14714
  const [showPopupFilter, setShowPopupFilter] = useState5(false);
14711
14715
  const popupFilterRef = useClickOutside({
@@ -14725,6 +14729,13 @@ var Search = ({
14725
14729
  }
14726
14730
  }
14727
14731
  }, [selectedTags, isReadyFormatDomain]);
14732
+ useEffect6(() => {
14733
+ return () => {
14734
+ clearSearch();
14735
+ setDidInit(false);
14736
+ setIsReadyFormatDomain(false);
14737
+ };
14738
+ }, [viewData]);
14728
14739
  useEffect6(() => {
14729
14740
  if (didInit || selectedTags?.length > 0) return;
14730
14741
  const searchDefaults = Object.entries(context || {}).filter(
@@ -16913,11 +16924,11 @@ var LoadingSmall = () => {
16913
16924
  };
16914
16925
 
16915
16926
  // src/widgets/common/video-player.tsx
16916
- import { useRef as useRef6, useState as useState9 } from "react";
16927
+ import { useRef as useRef5, useState as useState9 } from "react";
16917
16928
  import { jsx as jsx64, jsxs as jsxs44 } from "react/jsx-runtime";
16918
16929
  var VideoPlayer = ({ src }) => {
16919
16930
  const [isPlaying, setIsPlaying] = useState9(false);
16920
- const videoRef = useRef6(null);
16931
+ const videoRef = useRef5(null);
16921
16932
  const handlePlayPause = () => {
16922
16933
  if (videoRef.current) {
16923
16934
  if (isPlaying) {
@@ -17296,13 +17307,14 @@ var ButtonSelectFiles = ({
17296
17307
  const MAX_TOTAL_SIZE = 50 * 1024 * 1024;
17297
17308
  const { mutate: onUploadImage, isPending } = useUploadImage();
17298
17309
  const { mutate: onUploadFile } = useUploadFile();
17299
- const handleUploadImage = async ({ data }) => {
17310
+ const handleUploadImage = async ({ formData }) => {
17311
+ console.log("data", formData);
17300
17312
  if (widget !== "many2many_binary") {
17301
17313
  onUploadImage(
17302
- { data },
17314
+ { formData },
17303
17315
  {
17304
- onSuccess: (data2) => {
17305
- const formatData = data2?.data?.["ir.attachment"]?.[0];
17316
+ onSuccess: (data) => {
17317
+ const formatData = data?.data?.["ir.attachment"]?.[0];
17306
17318
  const files = [...selectedFiles, formatData];
17307
17319
  setSelectedFiles(files);
17308
17320
  y2.success(instance.t("upload_success"));
@@ -17314,10 +17326,10 @@ var ButtonSelectFiles = ({
17314
17326
  );
17315
17327
  } else {
17316
17328
  onUploadFile(
17317
- { data },
17329
+ { formData },
17318
17330
  {
17319
- onSuccess: (data2) => {
17320
- const formatData = data2?.data?.["ir.attachment"]?.[0];
17331
+ onSuccess: (data) => {
17332
+ const formatData = data?.data?.["ir.attachment"]?.[0];
17321
17333
  const files = [...selectedFiles, formatData];
17322
17334
  setSelectedFiles(files);
17323
17335
  y2.success(i18n_default.t("upload_success"));
@@ -17360,10 +17372,10 @@ var ButtonSelectFiles = ({
17360
17372
  setUploadError(false);
17361
17373
  const formData = new FormData();
17362
17374
  formData.append("ufile", file);
17363
- formData.append("thread_model", model);
17375
+ formData.append("thread_model", String(model));
17364
17376
  formData.append("thread_id", Number(id));
17365
17377
  formData.append("is_pending", true);
17366
- await handleUploadImage({ data: formData });
17378
+ await handleUploadImage({ formData });
17367
17379
  }
17368
17380
  };
17369
17381
  return /* @__PURE__ */ jsxs46(Fragment13, { children: [
@@ -17809,7 +17821,7 @@ var CheckboxField = (props) => {
17809
17821
  };
17810
17822
 
17811
17823
  // src/widgets/basic/color-field/color-wrapper.tsx
17812
- import { useEffect as useEffect10, useRef as useRef7, useState as useState10 } from "react";
17824
+ import { useEffect as useEffect10, useRef as useRef6, useState as useState10 } from "react";
17813
17825
  import { Fragment as Fragment17, jsx as jsx73, jsxs as jsxs51 } from "react/jsx-runtime";
17814
17826
  var ColorWrapper = (props) => {
17815
17827
  const {
@@ -17819,7 +17831,7 @@ var ColorWrapper = (props) => {
17819
17831
  } = props;
17820
17832
  const [selectedColor, setSelectedColor] = useState10(colors2[defaultColor]);
17821
17833
  const [showFullColors, setIsShowFullColor] = useState10(false);
17822
- const pickColorsRef = useRef7(null);
17834
+ const pickColorsRef = useRef6(null);
17823
17835
  useEffect10(() => {
17824
17836
  setSelectedColor(colors2[defaultColor]);
17825
17837
  }, [defaultColor]);
@@ -18020,7 +18032,7 @@ var CopyLinkButtonField = (props) => {
18020
18032
  import { forwardRef as forwardRef6, useEffect as useEffect15 } from "react";
18021
18033
 
18022
18034
  // node_modules/react-datepicker/dist/index.es.js
18023
- import React9, { useRef as useRef11, useCallback as useCallback5, useEffect as useEffect13, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
18035
+ import React9, { useRef as useRef10, useCallback as useCallback5, useEffect as useEffect13, cloneElement as cloneElement3, Component, createRef, createElement as createElement5 } from "react";
18024
18036
 
18025
18037
  // node_modules/date-fns/constants.js
18026
18038
  var daysInYear = 365.2425;
@@ -22590,8 +22602,8 @@ var CalendarContainer = function(_a2) {
22590
22602
  return React9.createElement("div", { className, role: "dialog", "aria-label": ariaLabel, "aria-modal": "true" }, children);
22591
22603
  };
22592
22604
  var useDetectClickOutside = function(onClickOutside, ignoreClass) {
22593
- var ref = useRef11(null);
22594
- var onClickOutsideRef = useRef11(onClickOutside);
22605
+ var ref = useRef10(null);
22606
+ var onClickOutsideRef = useRef10(onClickOutside);
22595
22607
  onClickOutsideRef.current = onClickOutside;
22596
22608
  var handleClickOutside = useCallback5(function(event) {
22597
22609
  var _a2;
@@ -25845,7 +25857,7 @@ function withFloating(Component3) {
25845
25857
  var WithFloating = function(props) {
25846
25858
  var _a2;
25847
25859
  var hidePopper = typeof props.hidePopper === "boolean" ? props.hidePopper : true;
25848
- var arrowRef = useRef11(null);
25860
+ var arrowRef = useRef10(null);
25849
25861
  var floatingProps = useFloating2(_assign({ open: !hidePopper, whileElementsMounted: autoUpdate, placement: props.popperPlacement, middleware: __spreadArray([
25850
25862
  flip3({ padding: 15 }),
25851
25863
  offset3(10),
@@ -27024,7 +27036,7 @@ function _toConsumableArray(r4) {
27024
27036
 
27025
27037
  // node_modules/react-select/dist/Select-ef7c0426.esm.js
27026
27038
  import * as React13 from "react";
27027
- import { useMemo as useMemo7, Fragment as Fragment21, useRef as useRef14, useCallback as useCallback8, useEffect as useEffect14, Component as Component2 } from "react";
27039
+ import { useMemo as useMemo7, Fragment as Fragment21, useRef as useRef13, useCallback as useCallback8, useEffect as useEffect14, Component as Component2 } from "react";
27028
27040
 
27029
27041
  // node_modules/@emotion/react/dist/emotion-element-d59e098f.esm.js
27030
27042
  import * as React11 from "react";
@@ -28356,7 +28368,7 @@ function _taggedTemplateLiteral(e3, t3) {
28356
28368
  }
28357
28369
 
28358
28370
  // node_modules/react-select/dist/index-641ee5b8.esm.js
28359
- import { useContext as useContext8, useRef as useRef13, useState as useState14, useMemo as useMemo6, useCallback as useCallback7, createContext as createContext4 } from "react";
28371
+ import { useContext as useContext8, useRef as useRef12, useState as useState14, useMemo as useMemo6, useCallback as useCallback7, createContext as createContext4 } from "react";
28360
28372
  import { createPortal as createPortal4 } from "react-dom";
28361
28373
 
28362
28374
  // node_modules/use-isomorphic-layout-effect/dist/use-isomorphic-layout-effect.esm.js
@@ -28702,7 +28714,7 @@ var PortalPlacementContext = /* @__PURE__ */ createContext4(null);
28702
28714
  var MenuPlacer = function MenuPlacer2(props) {
28703
28715
  var children = props.children, minMenuHeight = props.minMenuHeight, maxMenuHeight = props.maxMenuHeight, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition, menuShouldScrollIntoView = props.menuShouldScrollIntoView, theme = props.theme;
28704
28716
  var _ref3 = useContext8(PortalPlacementContext) || {}, setPortalPlacement = _ref3.setPortalPlacement;
28705
- var ref = useRef13(null);
28717
+ var ref = useRef12(null);
28706
28718
  var _useState = useState14(maxMenuHeight), _useState2 = _slicedToArray(_useState, 2), maxHeight = _useState2[0], setMaxHeight = _useState2[1];
28707
28719
  var _useState3 = useState14(null), _useState4 = _slicedToArray(_useState3, 2), placement = _useState4[0], setPlacement = _useState4[1];
28708
28720
  var controlHeight2 = theme.spacing.controlHeight;
@@ -28806,8 +28818,8 @@ var menuPortalCSS = function menuPortalCSS2(_ref8) {
28806
28818
  };
28807
28819
  var MenuPortal = function MenuPortal2(props) {
28808
28820
  var appendTo = props.appendTo, children = props.children, controlElement = props.controlElement, innerProps = props.innerProps, menuPlacement = props.menuPlacement, menuPosition = props.menuPosition;
28809
- var menuPortalRef = useRef13(null);
28810
- var cleanupRef = useRef13(null);
28821
+ var menuPortalRef = useRef12(null);
28822
+ var cleanupRef = useRef12(null);
28811
28823
  var _useState5 = useState14(coercePlacement(menuPlacement)), _useState6 = _slicedToArray(_useState5, 2), placement = _useState6[0], setPortalPlacement = _useState6[1];
28812
28824
  var portalPlacementContext = useMemo6(function() {
28813
28825
  return {
@@ -29945,10 +29957,10 @@ var cancelScroll = function cancelScroll2(event) {
29945
29957
  };
29946
29958
  function useScrollCapture(_ref3) {
29947
29959
  var isEnabled = _ref3.isEnabled, onBottomArrive = _ref3.onBottomArrive, onBottomLeave = _ref3.onBottomLeave, onTopArrive = _ref3.onTopArrive, onTopLeave = _ref3.onTopLeave;
29948
- var isBottom = useRef14(false);
29949
- var isTop = useRef14(false);
29950
- var touchStart = useRef14(0);
29951
- var scrollTarget = useRef14(null);
29960
+ var isBottom = useRef13(false);
29961
+ var isTop = useRef13(false);
29962
+ var touchStart = useRef13(0);
29963
+ var scrollTarget = useRef13(null);
29952
29964
  var handleEventDelta = useCallback8(function(event, delta) {
29953
29965
  if (scrollTarget.current === null) return;
29954
29966
  var _scrollTarget$current = scrollTarget.current, scrollTop = _scrollTarget$current.scrollTop, scrollHeight = _scrollTarget$current.scrollHeight, clientHeight = _scrollTarget$current.clientHeight;
@@ -30055,8 +30067,8 @@ var listenerOptions = {
30055
30067
  };
30056
30068
  function useScrollLock(_ref3) {
30057
30069
  var isEnabled = _ref3.isEnabled, _ref$accountForScroll = _ref3.accountForScrollbars, accountForScrollbars = _ref$accountForScroll === void 0 ? true : _ref$accountForScroll;
30058
- var originalStyles = useRef14({});
30059
- var scrollTarget = useRef14(null);
30070
+ var originalStyles = useRef13({});
30071
+ var scrollTarget = useRef13(null);
30060
30072
  var addScrollLock = useCallback8(function(touchScrollTarget) {
30061
30073
  if (!canUseDOM) return;
30062
30074
  var target = document.body;
@@ -32180,11 +32192,11 @@ var FeeField = (props) => {
32180
32192
  };
32181
32193
 
32182
32194
  // src/widgets/basic/file-upload-field/file-upload.tsx
32183
- import { useEffect as useEffect16, useRef as useRef15, useState as useState16 } from "react";
32195
+ import { useEffect as useEffect16, useRef as useRef14, useState as useState16 } from "react";
32184
32196
  import { jsx as jsx84, jsxs as jsxs59 } from "react/jsx-runtime";
32185
32197
  var FileUploadField = (props) => {
32186
32198
  const { name: name2, methods, isForm, model, required, idForm, widget, useUploadImage, useUploadFile, useGetImage, isBase64File } = props;
32187
- const fileInputRef = useRef15(null);
32199
+ const fileInputRef = useRef14(null);
32188
32200
  const [selectedFiles, setSelectedFiles] = useState16([]);
32189
32201
  const [uploadError, setUploadError] = useState16();
32190
32202
  return /* @__PURE__ */ jsx84(
@@ -32245,7 +32257,7 @@ var FileUploadField = (props) => {
32245
32257
  };
32246
32258
 
32247
32259
  // src/widgets/basic/float-field/float.tsx
32248
- import { useEffect as useEffect17, useRef as useRef16, useState as useState17 } from "react";
32260
+ import { useEffect as useEffect17, useRef as useRef15, useState as useState17 } from "react";
32249
32261
  import { Fragment as Fragment24, jsx as jsx85, jsxs as jsxs60 } from "react/jsx-runtime";
32250
32262
  var FloatField = (props) => {
32251
32263
  const {
@@ -32286,9 +32298,9 @@ var FloatField = (props) => {
32286
32298
  setInputValue("");
32287
32299
  }
32288
32300
  }, [value, name2, clearErrors]);
32289
- const isDirtyRef = useRef16(false);
32290
- const inputRef = useRef16(null);
32291
- const lastCommittedValueRef = useRef16(null);
32301
+ const isDirtyRef = useRef15(false);
32302
+ const inputRef = useRef15(null);
32303
+ const lastCommittedValueRef = useRef15(null);
32292
32304
  const handleInputChange = (e3) => {
32293
32305
  const newValue = e3.target.value;
32294
32306
  const valueWithoutCommas = newValue.replace(/,/g, "");
@@ -32518,7 +32530,7 @@ var FloatTimeField = (props) => {
32518
32530
  };
32519
32531
 
32520
32532
  // src/widgets/basic/html-field/html.tsx
32521
- import { useEffect as useEffect18, useRef as useRef17 } from "react";
32533
+ import { useEffect as useEffect18, useRef as useRef16 } from "react";
32522
32534
  import { jsx as jsx87 } from "react/jsx-runtime";
32523
32535
  var HtmlField = (props) => {
32524
32536
  const {
@@ -32530,7 +32542,7 @@ var HtmlField = (props) => {
32530
32542
  onChange: onChange2,
32531
32543
  value
32532
32544
  } = props;
32533
- const divRef = useRef17(null);
32545
+ const divRef = useRef16(null);
32534
32546
  if (!isForm) {
32535
32547
  return /* @__PURE__ */ jsx87("div", { dangerouslySetInnerHTML: { __html: value || defaultValue || "" } });
32536
32548
  }
@@ -32597,9 +32609,6 @@ import { useEffect as useEffect19 } from "react";
32597
32609
  import { Fragment as Fragment26, jsx as jsx89, jsxs as jsxs62 } from "react/jsx-runtime";
32598
32610
  var InfomationField = (props) => {
32599
32611
  const { value, isForm = false, showName = true, stringToColor } = props;
32600
- if (isForm) {
32601
- return /* @__PURE__ */ jsx89("div", { children: "abc" });
32602
- }
32603
32612
  if (!value || Array.isArray(value) && value.length === 0) {
32604
32613
  return /* @__PURE__ */ jsx89(Fragment26, {});
32605
32614
  }
@@ -32630,7 +32639,7 @@ var InfomationField = (props) => {
32630
32639
 
32631
32640
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
32632
32641
  import { jsx as jsx90, jsxs as jsxs63 } from "react/jsx-runtime";
32633
- var CustomMultiValue = (props) => {
32642
+ var CustomMultiValue = ({ stringToColor, ...props }) => {
32634
32643
  const { selectProps, data, menuList } = props;
32635
32644
  const { relation } = selectProps;
32636
32645
  const actionId = menuList?.flatMap(
@@ -32647,7 +32656,8 @@ var CustomMultiValue = (props) => {
32647
32656
  relation,
32648
32657
  isForm: false,
32649
32658
  aid: actionId?.id,
32650
- avatarSrc: data?.image_256
32659
+ avatarSrc: data?.image_256,
32660
+ stringToColor
32651
32661
  }
32652
32662
  ),
32653
32663
  /* @__PURE__ */ jsx90("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
@@ -32692,7 +32702,14 @@ var Many2ManyTagField = (props) => {
32692
32702
  value: item.id,
32693
32703
  label: item.name ?? item.display_name
32694
32704
  })) : [];
32695
- return /* @__PURE__ */ jsx90(InfomationField, { value: optionValue || null, isForm, stringToColor });
32705
+ return /* @__PURE__ */ jsx90(
32706
+ InfomationField,
32707
+ {
32708
+ value: optionValue || null,
32709
+ isForm,
32710
+ stringToColor
32711
+ }
32712
+ );
32696
32713
  }
32697
32714
  return /* @__PURE__ */ jsx90(
32698
32715
  Controller,
@@ -32777,7 +32794,13 @@ var Many2ManyTagField = (props) => {
32777
32794
  })
32778
32795
  },
32779
32796
  components: isUser ? {
32780
- MultiValue: CustomMultiValue,
32797
+ MultiValue: (multiValueProps) => /* @__PURE__ */ jsx90(
32798
+ CustomMultiValue,
32799
+ {
32800
+ ...multiValueProps,
32801
+ stringToColor
32802
+ }
32803
+ ),
32781
32804
  IndicatorSeparator: () => null
32782
32805
  } : {
32783
32806
  IndicatorSeparator: () => null
@@ -33301,7 +33324,7 @@ var ToggleButtonField = (props) => {
33301
33324
  };
33302
33325
 
33303
33326
  // src/widgets/basic/integer-field/integer.tsx
33304
- import { useEffect as useEffect23, useRef as useRef18, useState as useState20 } from "react";
33327
+ import { useEffect as useEffect23, useRef as useRef17, useState as useState20 } from "react";
33305
33328
  import { Fragment as Fragment29, jsx as jsx100, jsxs as jsxs70 } from "react/jsx-runtime";
33306
33329
  var IntegerField = (props) => {
33307
33330
  const {
@@ -33336,9 +33359,9 @@ var IntegerField = (props) => {
33336
33359
  fieldState: { error: error2 }
33337
33360
  }) => {
33338
33361
  const { setError, clearErrors } = methods;
33339
- const isDirtyRef = useRef18(false);
33340
- const inputRef = useRef18(null);
33341
- const lastCommittedValueRef = useRef18(null);
33362
+ const isDirtyRef = useRef17(false);
33363
+ const inputRef = useRef17(null);
33364
+ const lastCommittedValueRef = useRef17(null);
33342
33365
  const [inputValue, setInputValue] = useState20(
33343
33366
  value2 !== void 0 && value2 !== null ? String(value2) : ""
33344
33367
  );
@@ -33543,7 +33566,8 @@ var Many2ManyField = (props) => {
33543
33566
  searchString,
33544
33567
  selectedTags,
33545
33568
  setFilterBy,
33546
- setGroupBy
33569
+ setGroupBy,
33570
+ clearSearch
33547
33571
  } = searchController;
33548
33572
  return createPortal5(
33549
33573
  /* @__PURE__ */ jsxs72("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
@@ -33584,7 +33608,8 @@ var Many2ManyField = (props) => {
33584
33608
  selectedRowKeys,
33585
33609
  aid,
33586
33610
  domainSearch,
33587
- evalJSONContext
33611
+ evalJSONContext,
33612
+ clearSearch
33588
33613
  }
33589
33614
  ) }),
33590
33615
  /* @__PURE__ */ jsx102(