@fctc/sme-widget-ui 1.5.6 → 1.5.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
@@ -33319,7 +33319,7 @@ var ImageField = (props) => {
33319
33319
  };
33320
33320
 
33321
33321
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
33322
- var import_react58 = require("react");
33322
+ var import_react58 = __toESM(require("react"));
33323
33323
 
33324
33324
  // src/widgets/basic/information-field/information.tsx
33325
33325
  var import_jsx_runtime88 = require("react/jsx-runtime");
@@ -33390,6 +33390,26 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
33390
33390
  )
33391
33391
  ] });
33392
33392
  };
33393
+ var CustomMenuList = (props) => {
33394
+ const { options: options2, children, selectProps } = props;
33395
+ const { setIsShowModalMany2Many, searchable } = selectProps;
33396
+ const limitedChildren = import_react58.default.Children.toArray(children).slice(0, 10);
33397
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
33398
+ limitedChildren,
33399
+ options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
33400
+ "button",
33401
+ {
33402
+ type: "button",
33403
+ onClick: () => setIsShowModalMany2Many(true),
33404
+ className: "searh-more text-primary text-sm text-left w-full italic font-medium py-1 px-3",
33405
+ children: [
33406
+ instance.t("search_more"),
33407
+ "..."
33408
+ ]
33409
+ }
33410
+ )
33411
+ ] });
33412
+ };
33393
33413
  var Many2ManyTagField = (props) => {
33394
33414
  const {
33395
33415
  relation,
@@ -33404,10 +33424,15 @@ var Many2ManyTagField = (props) => {
33404
33424
  readonly,
33405
33425
  isEditTable,
33406
33426
  options: options2,
33407
- customNoOptionsMessage,
33408
- tranfer,
33427
+ transfer,
33409
33428
  isUser,
33410
- stringToColor
33429
+ stringToColor,
33430
+ fetchMoreOptions,
33431
+ setInputValue,
33432
+ setDomainObject,
33433
+ domainObject,
33434
+ isFetching,
33435
+ setIsShowModalMany2Many
33411
33436
  } = props;
33412
33437
  const CustomSelect = ({ ...rest }) => {
33413
33438
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(StateManagedSelect$1, { relation, ...rest });
@@ -33442,41 +33467,50 @@ var Many2ManyTagField = (props) => {
33442
33467
  clearErrors(name2);
33443
33468
  }
33444
33469
  }, [field.value]);
33445
- const filteredValue = options2 && options2?.length > 0 && Array.isArray(field.value) ? options2.filter(
33446
- (option) => field.value.some((item) => item?.id === option.value)
33470
+ const filteredValue = options2 && options2?.length > 0 && Array.isArray(field?.value) ? options2?.filter(
33471
+ (option) => field?.value?.some((item) => item?.id === option?.value)
33447
33472
  ) : options2?.length === 0 && Array.isArray(field?.value) ? field?.value?.map((value2) => ({
33448
33473
  value: value2?.id,
33449
33474
  label: value2?.display_name
33450
33475
  })) : null;
33451
33476
  const handleChange = (selectedOptions) => {
33452
- const newValue = tranfer(selectedOptions);
33477
+ const newValue = transfer(selectedOptions);
33453
33478
  field.onChange(newValue);
33454
33479
  onChange2?.(name2 ?? "", newValue);
33455
33480
  clearErrors(name2);
33456
33481
  };
33457
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "group", children: [
33482
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "group h-full", children: [
33458
33483
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
33459
- CustomSelect,
33484
+ StateManagedSelect$1,
33460
33485
  {
33461
- relation,
33462
33486
  options: options2,
33463
- noOptionsMessage: customNoOptionsMessage,
33487
+ noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available"),
33464
33488
  isMulti: true,
33465
33489
  isDisabled: readonly,
33490
+ isSearchable: true,
33491
+ isClearable: true,
33466
33492
  menuShouldScrollIntoView: false,
33467
33493
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
33468
33494
  value: filteredValue,
33469
33495
  onChange: handleChange,
33496
+ onMenuClose: () => {
33497
+ const filteredDomain = [...domainObject ?? []]?.filter(
33498
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
33499
+ ) || [];
33500
+ setInputValue("");
33501
+ setDomainObject(filteredDomain);
33502
+ },
33503
+ onMenuOpen: fetchMoreOptions,
33470
33504
  menuPlacement: "auto",
33471
33505
  placeholder: readonly ? "" : instance.t("choose_place"),
33472
33506
  classNames: isEditTable ? {
33473
33507
  valueContainer: () => "overflow-unset !px-0",
33474
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "cursor-not-allowed" : ""}`,
33508
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33475
33509
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33476
33510
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33477
33511
  } : {
33478
33512
  valueContainer: () => "overflow-unset !m-0 !p-0",
33479
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "cursor-not-allowed"}`,
33513
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33480
33514
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33481
33515
  input: () => "!m-0 !p-0",
33482
33516
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33524,14 +33558,23 @@ var Many2ManyTagField = (props) => {
33524
33558
  ),
33525
33559
  IndicatorSeparator: () => null
33526
33560
  } : {
33561
+ MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
33562
+ CustomMenuList,
33563
+ {
33564
+ ...menuListProps,
33565
+ selectProps: {
33566
+ ...menuListProps.selectProps,
33567
+ setIsShowModalMany2Many
33568
+ }
33569
+ }
33570
+ ),
33527
33571
  IndicatorSeparator: () => null,
33528
33572
  DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(components.DropdownIndicator, { ...props2 })
33529
33573
  },
33530
33574
  required: !invisible && required
33531
- },
33532
- field?.value
33575
+ }
33533
33576
  ),
33534
- isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33577
+ !isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33535
33578
  ] });
33536
33579
  }
33537
33580
  }
@@ -34562,7 +34605,7 @@ var Many2ManyField = (props) => {
34562
34605
  // src/widgets/basic/many2one-field/many2one.tsx
34563
34606
  var import_react64 = __toESM(require("react"));
34564
34607
  var import_jsx_runtime102 = require("react/jsx-runtime");
34565
- var CustomMenuList = (props) => {
34608
+ var CustomMenuList2 = (props) => {
34566
34609
  const { options: options2, children, selectProps } = props;
34567
34610
  const { setIsShowModalMany2Many, searchable } = selectProps;
34568
34611
  const limitedChildren = import_react64.default.Children.toArray(children).slice(0, 10);
@@ -34734,7 +34777,7 @@ var Many2OneField = (props) => {
34734
34777
  },
34735
34778
  components: {
34736
34779
  MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
34737
- CustomMenuList,
34780
+ CustomMenuList2,
34738
34781
  {
34739
34782
  ...menuListProps,
34740
34783
  selectProps: {
package/dist/index.mjs CHANGED
@@ -33200,7 +33200,7 @@ var ImageField = (props) => {
33200
33200
  };
33201
33201
 
33202
33202
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
33203
- import { useEffect as useEffect19 } from "react";
33203
+ import React16, { useEffect as useEffect19 } from "react";
33204
33204
 
33205
33205
  // src/widgets/basic/information-field/information.tsx
33206
33206
  import { Fragment as Fragment26, jsx as jsx90, jsxs as jsxs61 } from "react/jsx-runtime";
@@ -33271,6 +33271,26 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
33271
33271
  )
33272
33272
  ] });
33273
33273
  };
33274
+ var CustomMenuList = (props) => {
33275
+ const { options: options2, children, selectProps } = props;
33276
+ const { setIsShowModalMany2Many, searchable } = selectProps;
33277
+ const limitedChildren = React16.Children.toArray(children).slice(0, 10);
33278
+ return /* @__PURE__ */ jsxs62(components.MenuList, { ...props, className: "z-[99]", children: [
33279
+ limitedChildren,
33280
+ options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ jsxs62(
33281
+ "button",
33282
+ {
33283
+ type: "button",
33284
+ onClick: () => setIsShowModalMany2Many(true),
33285
+ className: "searh-more text-primary text-sm text-left w-full italic font-medium py-1 px-3",
33286
+ children: [
33287
+ instance.t("search_more"),
33288
+ "..."
33289
+ ]
33290
+ }
33291
+ )
33292
+ ] });
33293
+ };
33274
33294
  var Many2ManyTagField = (props) => {
33275
33295
  const {
33276
33296
  relation,
@@ -33285,10 +33305,15 @@ var Many2ManyTagField = (props) => {
33285
33305
  readonly,
33286
33306
  isEditTable,
33287
33307
  options: options2,
33288
- customNoOptionsMessage,
33289
- tranfer,
33308
+ transfer,
33290
33309
  isUser,
33291
- stringToColor
33310
+ stringToColor,
33311
+ fetchMoreOptions,
33312
+ setInputValue,
33313
+ setDomainObject,
33314
+ domainObject,
33315
+ isFetching,
33316
+ setIsShowModalMany2Many
33292
33317
  } = props;
33293
33318
  const CustomSelect = ({ ...rest }) => {
33294
33319
  return /* @__PURE__ */ jsx91(StateManagedSelect$1, { relation, ...rest });
@@ -33323,41 +33348,50 @@ var Many2ManyTagField = (props) => {
33323
33348
  clearErrors(name2);
33324
33349
  }
33325
33350
  }, [field.value]);
33326
- const filteredValue = options2 && options2?.length > 0 && Array.isArray(field.value) ? options2.filter(
33327
- (option) => field.value.some((item) => item?.id === option.value)
33351
+ const filteredValue = options2 && options2?.length > 0 && Array.isArray(field?.value) ? options2?.filter(
33352
+ (option) => field?.value?.some((item) => item?.id === option?.value)
33328
33353
  ) : options2?.length === 0 && Array.isArray(field?.value) ? field?.value?.map((value2) => ({
33329
33354
  value: value2?.id,
33330
33355
  label: value2?.display_name
33331
33356
  })) : null;
33332
33357
  const handleChange = (selectedOptions) => {
33333
- const newValue = tranfer(selectedOptions);
33358
+ const newValue = transfer(selectedOptions);
33334
33359
  field.onChange(newValue);
33335
33360
  onChange2?.(name2 ?? "", newValue);
33336
33361
  clearErrors(name2);
33337
33362
  };
33338
- return /* @__PURE__ */ jsxs62("div", { className: "group", children: [
33363
+ return /* @__PURE__ */ jsxs62("div", { className: "group h-full", children: [
33339
33364
  /* @__PURE__ */ jsx91(
33340
- CustomSelect,
33365
+ StateManagedSelect$1,
33341
33366
  {
33342
- relation,
33343
33367
  options: options2,
33344
- noOptionsMessage: customNoOptionsMessage,
33368
+ noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available"),
33345
33369
  isMulti: true,
33346
33370
  isDisabled: readonly,
33371
+ isSearchable: true,
33372
+ isClearable: true,
33347
33373
  menuShouldScrollIntoView: false,
33348
33374
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
33349
33375
  value: filteredValue,
33350
33376
  onChange: handleChange,
33377
+ onMenuClose: () => {
33378
+ const filteredDomain = [...domainObject ?? []]?.filter(
33379
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
33380
+ ) || [];
33381
+ setInputValue("");
33382
+ setDomainObject(filteredDomain);
33383
+ },
33384
+ onMenuOpen: fetchMoreOptions,
33351
33385
  menuPlacement: "auto",
33352
33386
  placeholder: readonly ? "" : instance.t("choose_place"),
33353
33387
  classNames: isEditTable ? {
33354
33388
  valueContainer: () => "overflow-unset !px-0",
33355
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "cursor-not-allowed" : ""}`,
33389
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33356
33390
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33357
33391
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33358
33392
  } : {
33359
33393
  valueContainer: () => "overflow-unset !m-0 !p-0",
33360
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "cursor-not-allowed"}`,
33394
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33361
33395
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33362
33396
  input: () => "!m-0 !p-0",
33363
33397
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33405,14 +33439,23 @@ var Many2ManyTagField = (props) => {
33405
33439
  ),
33406
33440
  IndicatorSeparator: () => null
33407
33441
  } : {
33442
+ MenuList: (menuListProps) => /* @__PURE__ */ jsx91(
33443
+ CustomMenuList,
33444
+ {
33445
+ ...menuListProps,
33446
+ selectProps: {
33447
+ ...menuListProps.selectProps,
33448
+ setIsShowModalMany2Many
33449
+ }
33450
+ }
33451
+ ),
33408
33452
  IndicatorSeparator: () => null,
33409
33453
  DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx91(components.DropdownIndicator, { ...props2 })
33410
33454
  },
33411
33455
  required: !invisible && required
33412
- },
33413
- field?.value
33456
+ }
33414
33457
  ),
33415
- isEditTable && error2 && /* @__PURE__ */ jsx91("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33458
+ !isEditTable && error2 && /* @__PURE__ */ jsx91("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33416
33459
  ] });
33417
33460
  }
33418
33461
  }
@@ -33530,7 +33573,7 @@ var PaidBadgedField = () => {
33530
33573
  };
33531
33574
 
33532
33575
  // src/widgets/basic/priority-field/rating-star.tsx
33533
- import React16, { useEffect as useEffect21, useState as useState19 } from "react";
33576
+ import React17, { useEffect as useEffect21, useState as useState19 } from "react";
33534
33577
  import { jsx as jsx94, jsxs as jsxs64 } from "react/jsx-runtime";
33535
33578
  var RatingStarField = (props) => {
33536
33579
  const {
@@ -33576,7 +33619,7 @@ var RatingStarField = (props) => {
33576
33619
  const starValue = index4 + 1;
33577
33620
  const fillColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "white" : rating >= starValue ? "#f3cc00" : "white";
33578
33621
  const strokeColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)" : rating >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)";
33579
- return /* @__PURE__ */ jsxs64(React16.Fragment, { children: [
33622
+ return /* @__PURE__ */ jsxs64(React17.Fragment, { children: [
33580
33623
  /* @__PURE__ */ jsx94(
33581
33624
  "div",
33582
33625
  {
@@ -34441,12 +34484,12 @@ var Many2ManyField = (props) => {
34441
34484
  };
34442
34485
 
34443
34486
  // src/widgets/basic/many2one-field/many2one.tsx
34444
- import React17, { useEffect as useEffect25, useMemo as useMemo9 } from "react";
34487
+ import React18, { useEffect as useEffect25, useMemo as useMemo9 } from "react";
34445
34488
  import { Fragment as Fragment30, jsx as jsx104, jsxs as jsxs72 } from "react/jsx-runtime";
34446
- var CustomMenuList = (props) => {
34489
+ var CustomMenuList2 = (props) => {
34447
34490
  const { options: options2, children, selectProps } = props;
34448
34491
  const { setIsShowModalMany2Many, searchable } = selectProps;
34449
- const limitedChildren = React17.Children.toArray(children).slice(0, 10);
34492
+ const limitedChildren = React18.Children.toArray(children).slice(0, 10);
34450
34493
  return /* @__PURE__ */ jsxs72(components.MenuList, { ...props, className: "z-[99]", children: [
34451
34494
  limitedChildren,
34452
34495
  options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ jsxs72(
@@ -34615,7 +34658,7 @@ var Many2OneField = (props) => {
34615
34658
  },
34616
34659
  components: {
34617
34660
  MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
34618
- CustomMenuList,
34661
+ CustomMenuList2,
34619
34662
  {
34620
34663
  ...menuListProps,
34621
34664
  selectProps: {
@@ -298,9 +298,16 @@ declare const ImageField: (props: IInputFieldProps) => JSX.Element | null;
298
298
  interface IMany2ManyTagsProps extends IInputFieldProps {
299
299
  options: any[];
300
300
  customNoOptionsMessage: any;
301
- tranfer: any;
301
+ transfer: any;
302
302
  isUser: any;
303
303
  stringToColor?: any;
304
+ fetchMoreOptions?: any;
305
+ handleSelectChange?: any;
306
+ isFetching?: any;
307
+ domainObject?: any;
308
+ setIsShowModalMany2Many?: any;
309
+ setInputValue?: any;
310
+ setDomainObject?: any;
304
311
  }
305
312
 
306
313
  declare const Many2ManyTagField: (props: IMany2ManyTagsProps) => JSX.Element;
package/dist/widgets.d.ts CHANGED
@@ -298,9 +298,16 @@ declare const ImageField: (props: IInputFieldProps) => JSX.Element | null;
298
298
  interface IMany2ManyTagsProps extends IInputFieldProps {
299
299
  options: any[];
300
300
  customNoOptionsMessage: any;
301
- tranfer: any;
301
+ transfer: any;
302
302
  isUser: any;
303
303
  stringToColor?: any;
304
+ fetchMoreOptions?: any;
305
+ handleSelectChange?: any;
306
+ isFetching?: any;
307
+ domainObject?: any;
308
+ setIsShowModalMany2Many?: any;
309
+ setInputValue?: any;
310
+ setDomainObject?: any;
304
311
  }
305
312
 
306
313
  declare const Many2ManyTagField: (props: IMany2ManyTagsProps) => JSX.Element;
package/dist/widgets.js CHANGED
@@ -32945,7 +32945,7 @@ var ImageField = (props) => {
32945
32945
  };
32946
32946
 
32947
32947
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
32948
- var import_react58 = require("react");
32948
+ var import_react58 = __toESM(require("react"));
32949
32949
 
32950
32950
  // src/widgets/basic/information-field/information.tsx
32951
32951
  var import_jsx_runtime88 = require("react/jsx-runtime");
@@ -33016,6 +33016,26 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
33016
33016
  )
33017
33017
  ] });
33018
33018
  };
33019
+ var CustomMenuList = (props) => {
33020
+ const { options: options2, children, selectProps } = props;
33021
+ const { setIsShowModalMany2Many, searchable } = selectProps;
33022
+ const limitedChildren = import_react58.default.Children.toArray(children).slice(0, 10);
33023
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
33024
+ limitedChildren,
33025
+ options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
33026
+ "button",
33027
+ {
33028
+ type: "button",
33029
+ onClick: () => setIsShowModalMany2Many(true),
33030
+ className: "searh-more text-primary text-sm text-left w-full italic font-medium py-1 px-3",
33031
+ children: [
33032
+ instance.t("search_more"),
33033
+ "..."
33034
+ ]
33035
+ }
33036
+ )
33037
+ ] });
33038
+ };
33019
33039
  var Many2ManyTagField = (props) => {
33020
33040
  const {
33021
33041
  relation,
@@ -33030,10 +33050,15 @@ var Many2ManyTagField = (props) => {
33030
33050
  readonly,
33031
33051
  isEditTable,
33032
33052
  options: options2,
33033
- customNoOptionsMessage,
33034
- tranfer,
33053
+ transfer,
33035
33054
  isUser,
33036
- stringToColor
33055
+ stringToColor,
33056
+ fetchMoreOptions,
33057
+ setInputValue,
33058
+ setDomainObject,
33059
+ domainObject,
33060
+ isFetching,
33061
+ setIsShowModalMany2Many
33037
33062
  } = props;
33038
33063
  const CustomSelect = ({ ...rest }) => {
33039
33064
  return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(StateManagedSelect$1, { relation, ...rest });
@@ -33068,41 +33093,50 @@ var Many2ManyTagField = (props) => {
33068
33093
  clearErrors(name2);
33069
33094
  }
33070
33095
  }, [field.value]);
33071
- const filteredValue = options2 && options2?.length > 0 && Array.isArray(field.value) ? options2.filter(
33072
- (option) => field.value.some((item) => item?.id === option.value)
33096
+ const filteredValue = options2 && options2?.length > 0 && Array.isArray(field?.value) ? options2?.filter(
33097
+ (option) => field?.value?.some((item) => item?.id === option?.value)
33073
33098
  ) : options2?.length === 0 && Array.isArray(field?.value) ? field?.value?.map((value2) => ({
33074
33099
  value: value2?.id,
33075
33100
  label: value2?.display_name
33076
33101
  })) : null;
33077
33102
  const handleChange = (selectedOptions) => {
33078
- const newValue = tranfer(selectedOptions);
33103
+ const newValue = transfer(selectedOptions);
33079
33104
  field.onChange(newValue);
33080
33105
  onChange2?.(name2 ?? "", newValue);
33081
33106
  clearErrors(name2);
33082
33107
  };
33083
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "group", children: [
33108
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "group h-full", children: [
33084
33109
  /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
33085
- CustomSelect,
33110
+ StateManagedSelect$1,
33086
33111
  {
33087
- relation,
33088
33112
  options: options2,
33089
- noOptionsMessage: customNoOptionsMessage,
33113
+ noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available"),
33090
33114
  isMulti: true,
33091
33115
  isDisabled: readonly,
33116
+ isSearchable: true,
33117
+ isClearable: true,
33092
33118
  menuShouldScrollIntoView: false,
33093
33119
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
33094
33120
  value: filteredValue,
33095
33121
  onChange: handleChange,
33122
+ onMenuClose: () => {
33123
+ const filteredDomain = [...domainObject ?? []]?.filter(
33124
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
33125
+ ) || [];
33126
+ setInputValue("");
33127
+ setDomainObject(filteredDomain);
33128
+ },
33129
+ onMenuOpen: fetchMoreOptions,
33096
33130
  menuPlacement: "auto",
33097
33131
  placeholder: readonly ? "" : instance.t("choose_place"),
33098
33132
  classNames: isEditTable ? {
33099
33133
  valueContainer: () => "overflow-unset !px-0",
33100
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "cursor-not-allowed" : ""}`,
33134
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33101
33135
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33102
33136
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33103
33137
  } : {
33104
33138
  valueContainer: () => "overflow-unset !m-0 !p-0",
33105
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "cursor-not-allowed"}`,
33139
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33106
33140
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33107
33141
  input: () => "!m-0 !p-0",
33108
33142
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33150,14 +33184,23 @@ var Many2ManyTagField = (props) => {
33150
33184
  ),
33151
33185
  IndicatorSeparator: () => null
33152
33186
  } : {
33187
+ MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
33188
+ CustomMenuList,
33189
+ {
33190
+ ...menuListProps,
33191
+ selectProps: {
33192
+ ...menuListProps.selectProps,
33193
+ setIsShowModalMany2Many
33194
+ }
33195
+ }
33196
+ ),
33153
33197
  IndicatorSeparator: () => null,
33154
33198
  DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(components.DropdownIndicator, { ...props2 })
33155
33199
  },
33156
33200
  required: !invisible && required
33157
- },
33158
- field?.value
33201
+ }
33159
33202
  ),
33160
- isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33203
+ !isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33161
33204
  ] });
33162
33205
  }
33163
33206
  }
@@ -34188,7 +34231,7 @@ var Many2ManyField = (props) => {
34188
34231
  // src/widgets/basic/many2one-field/many2one.tsx
34189
34232
  var import_react64 = __toESM(require("react"));
34190
34233
  var import_jsx_runtime102 = require("react/jsx-runtime");
34191
- var CustomMenuList = (props) => {
34234
+ var CustomMenuList2 = (props) => {
34192
34235
  const { options: options2, children, selectProps } = props;
34193
34236
  const { setIsShowModalMany2Many, searchable } = selectProps;
34194
34237
  const limitedChildren = import_react64.default.Children.toArray(children).slice(0, 10);
@@ -34360,7 +34403,7 @@ var Many2OneField = (props) => {
34360
34403
  },
34361
34404
  components: {
34362
34405
  MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
34363
- CustomMenuList,
34406
+ CustomMenuList2,
34364
34407
  {
34365
34408
  ...menuListProps,
34366
34409
  selectProps: {
package/dist/widgets.mjs CHANGED
@@ -32882,7 +32882,7 @@ var ImageField = (props) => {
32882
32882
  };
32883
32883
 
32884
32884
  // src/widgets/basic/many2many-tags-field/many2many-tags.tsx
32885
- import { useEffect as useEffect19 } from "react";
32885
+ import React16, { useEffect as useEffect19 } from "react";
32886
32886
 
32887
32887
  // src/widgets/basic/information-field/information.tsx
32888
32888
  import { Fragment as Fragment26, jsx as jsx90, jsxs as jsxs61 } from "react/jsx-runtime";
@@ -32953,6 +32953,26 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
32953
32953
  )
32954
32954
  ] });
32955
32955
  };
32956
+ var CustomMenuList = (props) => {
32957
+ const { options: options2, children, selectProps } = props;
32958
+ const { setIsShowModalMany2Many, searchable } = selectProps;
32959
+ const limitedChildren = React16.Children.toArray(children).slice(0, 10);
32960
+ return /* @__PURE__ */ jsxs62(components.MenuList, { ...props, className: "z-[99]", children: [
32961
+ limitedChildren,
32962
+ options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ jsxs62(
32963
+ "button",
32964
+ {
32965
+ type: "button",
32966
+ onClick: () => setIsShowModalMany2Many(true),
32967
+ className: "searh-more text-primary text-sm text-left w-full italic font-medium py-1 px-3",
32968
+ children: [
32969
+ instance.t("search_more"),
32970
+ "..."
32971
+ ]
32972
+ }
32973
+ )
32974
+ ] });
32975
+ };
32956
32976
  var Many2ManyTagField = (props) => {
32957
32977
  const {
32958
32978
  relation,
@@ -32967,10 +32987,15 @@ var Many2ManyTagField = (props) => {
32967
32987
  readonly,
32968
32988
  isEditTable,
32969
32989
  options: options2,
32970
- customNoOptionsMessage,
32971
- tranfer,
32990
+ transfer,
32972
32991
  isUser,
32973
- stringToColor
32992
+ stringToColor,
32993
+ fetchMoreOptions,
32994
+ setInputValue,
32995
+ setDomainObject,
32996
+ domainObject,
32997
+ isFetching,
32998
+ setIsShowModalMany2Many
32974
32999
  } = props;
32975
33000
  const CustomSelect = ({ ...rest }) => {
32976
33001
  return /* @__PURE__ */ jsx91(StateManagedSelect$1, { relation, ...rest });
@@ -33005,41 +33030,50 @@ var Many2ManyTagField = (props) => {
33005
33030
  clearErrors(name2);
33006
33031
  }
33007
33032
  }, [field.value]);
33008
- const filteredValue = options2 && options2?.length > 0 && Array.isArray(field.value) ? options2.filter(
33009
- (option) => field.value.some((item) => item?.id === option.value)
33033
+ const filteredValue = options2 && options2?.length > 0 && Array.isArray(field?.value) ? options2?.filter(
33034
+ (option) => field?.value?.some((item) => item?.id === option?.value)
33010
33035
  ) : options2?.length === 0 && Array.isArray(field?.value) ? field?.value?.map((value2) => ({
33011
33036
  value: value2?.id,
33012
33037
  label: value2?.display_name
33013
33038
  })) : null;
33014
33039
  const handleChange = (selectedOptions) => {
33015
- const newValue = tranfer(selectedOptions);
33040
+ const newValue = transfer(selectedOptions);
33016
33041
  field.onChange(newValue);
33017
33042
  onChange2?.(name2 ?? "", newValue);
33018
33043
  clearErrors(name2);
33019
33044
  };
33020
- return /* @__PURE__ */ jsxs62("div", { className: "group", children: [
33045
+ return /* @__PURE__ */ jsxs62("div", { className: "group h-full", children: [
33021
33046
  /* @__PURE__ */ jsx91(
33022
- CustomSelect,
33047
+ StateManagedSelect$1,
33023
33048
  {
33024
- relation,
33025
33049
  options: options2,
33026
- noOptionsMessage: customNoOptionsMessage,
33050
+ noOptionsMessage: () => instance.t(isFetching ? "loading" : "no-available"),
33027
33051
  isMulti: true,
33028
33052
  isDisabled: readonly,
33053
+ isSearchable: true,
33054
+ isClearable: true,
33029
33055
  menuShouldScrollIntoView: false,
33030
33056
  menuPortalTarget: typeof window !== "undefined" ? document.body : null,
33031
33057
  value: filteredValue,
33032
33058
  onChange: handleChange,
33059
+ onMenuClose: () => {
33060
+ const filteredDomain = [...domainObject ?? []]?.filter(
33061
+ (d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
33062
+ ) || [];
33063
+ setInputValue("");
33064
+ setDomainObject(filteredDomain);
33065
+ },
33066
+ onMenuOpen: fetchMoreOptions,
33033
33067
  menuPlacement: "auto",
33034
33068
  placeholder: readonly ? "" : instance.t("choose_place"),
33035
33069
  classNames: isEditTable ? {
33036
33070
  valueContainer: () => "overflow-unset !px-0",
33037
- control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "cursor-not-allowed" : ""}`,
33071
+ control: () => `w-full flex ring-0 cursor-pointer outline-0 md:!min-w-[300px] max-w-[300px] !shadow-none p-2 pl-3 text-sm text-[#1A1A1B] font-normal gap-2 opacity-100 leading-5 resize-none overflow-hidden border border-transparent border-b border-[#f7f7f7] hover:border-b-primary ${readonly ? "!cursor-not-allowed" : ""}`,
33038
33072
  dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
33039
33073
  clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
33040
33074
  } : {
33041
33075
  valueContainer: () => "overflow-unset !m-0 !p-0",
33042
- control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "cursor-not-allowed"}`,
33076
+ control: ({ isFocused }) => `w-full h-full flex ring-0 cursor-pointer outline-0 bg-white shadow-none rounded-lg p-2 pl-3 text-sm text-[#1A1A1B] font-normal cursor-pointer gap-2 opacity-100 leading-5 resize-none overflow-hidden field-sizing-content ${isFocused ? "border-[1px] border-primary ring-0 outline-none" : "border border-[rgba(66,66,66,0.12)]"} ${readonly && "!cursor-not-allowed"}`,
33043
33077
  singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
33044
33078
  input: () => "!m-0 !p-0",
33045
33079
  dropdownIndicator: () => "!m-0 !p-0"
@@ -33087,14 +33121,23 @@ var Many2ManyTagField = (props) => {
33087
33121
  ),
33088
33122
  IndicatorSeparator: () => null
33089
33123
  } : {
33124
+ MenuList: (menuListProps) => /* @__PURE__ */ jsx91(
33125
+ CustomMenuList,
33126
+ {
33127
+ ...menuListProps,
33128
+ selectProps: {
33129
+ ...menuListProps.selectProps,
33130
+ setIsShowModalMany2Many
33131
+ }
33132
+ }
33133
+ ),
33090
33134
  IndicatorSeparator: () => null,
33091
33135
  DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx91(components.DropdownIndicator, { ...props2 })
33092
33136
  },
33093
33137
  required: !invisible && required
33094
- },
33095
- field?.value
33138
+ }
33096
33139
  ),
33097
- isEditTable && error2 && /* @__PURE__ */ jsx91("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33140
+ !isEditTable && error2 && /* @__PURE__ */ jsx91("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
33098
33141
  ] });
33099
33142
  }
33100
33143
  }
@@ -33212,7 +33255,7 @@ var PaidBadgedField = () => {
33212
33255
  };
33213
33256
 
33214
33257
  // src/widgets/basic/priority-field/rating-star.tsx
33215
- import React16, { useEffect as useEffect21, useState as useState19 } from "react";
33258
+ import React17, { useEffect as useEffect21, useState as useState19 } from "react";
33216
33259
  import { jsx as jsx94, jsxs as jsxs64 } from "react/jsx-runtime";
33217
33260
  var RatingStarField = (props) => {
33218
33261
  const {
@@ -33258,7 +33301,7 @@ var RatingStarField = (props) => {
33258
33301
  const starValue = index4 + 1;
33259
33302
  const fillColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "white" : rating >= starValue ? "#f3cc00" : "white";
33260
33303
  const strokeColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)" : rating >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)";
33261
- return /* @__PURE__ */ jsxs64(React16.Fragment, { children: [
33304
+ return /* @__PURE__ */ jsxs64(React17.Fragment, { children: [
33262
33305
  /* @__PURE__ */ jsx94(
33263
33306
  "div",
33264
33307
  {
@@ -34123,12 +34166,12 @@ var Many2ManyField = (props) => {
34123
34166
  };
34124
34167
 
34125
34168
  // src/widgets/basic/many2one-field/many2one.tsx
34126
- import React17, { useEffect as useEffect25, useMemo as useMemo9 } from "react";
34169
+ import React18, { useEffect as useEffect25, useMemo as useMemo9 } from "react";
34127
34170
  import { Fragment as Fragment30, jsx as jsx104, jsxs as jsxs72 } from "react/jsx-runtime";
34128
- var CustomMenuList = (props) => {
34171
+ var CustomMenuList2 = (props) => {
34129
34172
  const { options: options2, children, selectProps } = props;
34130
34173
  const { setIsShowModalMany2Many, searchable } = selectProps;
34131
- const limitedChildren = React17.Children.toArray(children).slice(0, 10);
34174
+ const limitedChildren = React18.Children.toArray(children).slice(0, 10);
34132
34175
  return /* @__PURE__ */ jsxs72(components.MenuList, { ...props, className: "z-[99]", children: [
34133
34176
  limitedChildren,
34134
34177
  options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ jsxs72(
@@ -34297,7 +34340,7 @@ var Many2OneField = (props) => {
34297
34340
  },
34298
34341
  components: {
34299
34342
  MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
34300
- CustomMenuList,
34343
+ CustomMenuList2,
34301
34344
  {
34302
34345
  ...menuListProps,
34303
34346
  selectProps: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fctc/sme-widget-ui",
3
- "version": "1.5.6",
3
+ "version": "1.5.8",
4
4
  "main": "dist/index.cjs",
5
5
  "module": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",