@fctc/sme-widget-ui 1.5.5 → 1.5.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.js +60 -16
- package/dist/index.mjs +64 -20
- package/dist/widgets.d.mts +8 -1
- package/dist/widgets.d.ts +8 -1
- package/dist/widgets.js +60 -16
- package/dist/widgets.mjs +64 -20
- package/package.json +1 -1
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
|
-
|
|
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,31 +33467,41 @@ var Many2ManyTagField = (props) => {
|
|
|
33442
33467
|
clearErrors(name2);
|
|
33443
33468
|
}
|
|
33444
33469
|
}, [field.value]);
|
|
33445
|
-
const filteredValue = options2 && options2?.length > 0 && Array.isArray(field
|
|
33446
|
-
(option) => field
|
|
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 =
|
|
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
|
-
|
|
33484
|
+
StateManagedSelect$1,
|
|
33460
33485
|
{
|
|
33461
|
-
relation,
|
|
33462
33486
|
options: options2,
|
|
33463
|
-
noOptionsMessage:
|
|
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,
|
|
33504
|
+
menuPlacement: "auto",
|
|
33470
33505
|
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
33471
33506
|
classNames: isEditTable ? {
|
|
33472
33507
|
valueContainer: () => "overflow-unset !px-0",
|
|
@@ -33523,14 +33558,23 @@ var Many2ManyTagField = (props) => {
|
|
|
33523
33558
|
),
|
|
33524
33559
|
IndicatorSeparator: () => null
|
|
33525
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
|
+
),
|
|
33526
33571
|
IndicatorSeparator: () => null,
|
|
33527
33572
|
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(components.DropdownIndicator, { ...props2 })
|
|
33528
33573
|
},
|
|
33529
33574
|
required: !invisible && required
|
|
33530
|
-
}
|
|
33531
|
-
field?.value
|
|
33575
|
+
}
|
|
33532
33576
|
),
|
|
33533
|
-
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 })
|
|
33534
33578
|
] });
|
|
33535
33579
|
}
|
|
33536
33580
|
}
|
|
@@ -34561,7 +34605,7 @@ var Many2ManyField = (props) => {
|
|
|
34561
34605
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
34562
34606
|
var import_react64 = __toESM(require("react"));
|
|
34563
34607
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
34564
|
-
var
|
|
34608
|
+
var CustomMenuList2 = (props) => {
|
|
34565
34609
|
const { options: options2, children, selectProps } = props;
|
|
34566
34610
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
34567
34611
|
const limitedChildren = import_react64.default.Children.toArray(children).slice(0, 10);
|
|
@@ -34733,7 +34777,7 @@ var Many2OneField = (props) => {
|
|
|
34733
34777
|
},
|
|
34734
34778
|
components: {
|
|
34735
34779
|
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34736
|
-
|
|
34780
|
+
CustomMenuList2,
|
|
34737
34781
|
{
|
|
34738
34782
|
...menuListProps,
|
|
34739
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
|
-
|
|
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,31 +33348,41 @@ var Many2ManyTagField = (props) => {
|
|
|
33323
33348
|
clearErrors(name2);
|
|
33324
33349
|
}
|
|
33325
33350
|
}, [field.value]);
|
|
33326
|
-
const filteredValue = options2 && options2?.length > 0 && Array.isArray(field
|
|
33327
|
-
(option) => field
|
|
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 =
|
|
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
|
-
|
|
33365
|
+
StateManagedSelect$1,
|
|
33341
33366
|
{
|
|
33342
|
-
relation,
|
|
33343
33367
|
options: options2,
|
|
33344
|
-
noOptionsMessage:
|
|
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,
|
|
33385
|
+
menuPlacement: "auto",
|
|
33351
33386
|
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
33352
33387
|
classNames: isEditTable ? {
|
|
33353
33388
|
valueContainer: () => "overflow-unset !px-0",
|
|
@@ -33404,14 +33439,23 @@ var Many2ManyTagField = (props) => {
|
|
|
33404
33439
|
),
|
|
33405
33440
|
IndicatorSeparator: () => null
|
|
33406
33441
|
} : {
|
|
33442
|
+
MenuList: (menuListProps) => /* @__PURE__ */ jsx91(
|
|
33443
|
+
CustomMenuList,
|
|
33444
|
+
{
|
|
33445
|
+
...menuListProps,
|
|
33446
|
+
selectProps: {
|
|
33447
|
+
...menuListProps.selectProps,
|
|
33448
|
+
setIsShowModalMany2Many
|
|
33449
|
+
}
|
|
33450
|
+
}
|
|
33451
|
+
),
|
|
33407
33452
|
IndicatorSeparator: () => null,
|
|
33408
33453
|
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx91(components.DropdownIndicator, { ...props2 })
|
|
33409
33454
|
},
|
|
33410
33455
|
required: !invisible && required
|
|
33411
|
-
}
|
|
33412
|
-
field?.value
|
|
33456
|
+
}
|
|
33413
33457
|
),
|
|
33414
|
-
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 })
|
|
33415
33459
|
] });
|
|
33416
33460
|
}
|
|
33417
33461
|
}
|
|
@@ -33529,7 +33573,7 @@ var PaidBadgedField = () => {
|
|
|
33529
33573
|
};
|
|
33530
33574
|
|
|
33531
33575
|
// src/widgets/basic/priority-field/rating-star.tsx
|
|
33532
|
-
import
|
|
33576
|
+
import React17, { useEffect as useEffect21, useState as useState19 } from "react";
|
|
33533
33577
|
import { jsx as jsx94, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
33534
33578
|
var RatingStarField = (props) => {
|
|
33535
33579
|
const {
|
|
@@ -33575,7 +33619,7 @@ var RatingStarField = (props) => {
|
|
|
33575
33619
|
const starValue = index4 + 1;
|
|
33576
33620
|
const fillColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "white" : rating >= starValue ? "#f3cc00" : "white";
|
|
33577
33621
|
const strokeColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)" : rating >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)";
|
|
33578
|
-
return /* @__PURE__ */ jsxs64(
|
|
33622
|
+
return /* @__PURE__ */ jsxs64(React17.Fragment, { children: [
|
|
33579
33623
|
/* @__PURE__ */ jsx94(
|
|
33580
33624
|
"div",
|
|
33581
33625
|
{
|
|
@@ -34440,12 +34484,12 @@ var Many2ManyField = (props) => {
|
|
|
34440
34484
|
};
|
|
34441
34485
|
|
|
34442
34486
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
34443
|
-
import
|
|
34487
|
+
import React18, { useEffect as useEffect25, useMemo as useMemo9 } from "react";
|
|
34444
34488
|
import { Fragment as Fragment30, jsx as jsx104, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
34445
|
-
var
|
|
34489
|
+
var CustomMenuList2 = (props) => {
|
|
34446
34490
|
const { options: options2, children, selectProps } = props;
|
|
34447
34491
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
34448
|
-
const limitedChildren =
|
|
34492
|
+
const limitedChildren = React18.Children.toArray(children).slice(0, 10);
|
|
34449
34493
|
return /* @__PURE__ */ jsxs72(components.MenuList, { ...props, className: "z-[99]", children: [
|
|
34450
34494
|
limitedChildren,
|
|
34451
34495
|
options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ jsxs72(
|
|
@@ -34614,7 +34658,7 @@ var Many2OneField = (props) => {
|
|
|
34614
34658
|
},
|
|
34615
34659
|
components: {
|
|
34616
34660
|
MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
|
|
34617
|
-
|
|
34661
|
+
CustomMenuList2,
|
|
34618
34662
|
{
|
|
34619
34663
|
...menuListProps,
|
|
34620
34664
|
selectProps: {
|
package/dist/widgets.d.mts
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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,31 +33093,41 @@ var Many2ManyTagField = (props) => {
|
|
|
33068
33093
|
clearErrors(name2);
|
|
33069
33094
|
}
|
|
33070
33095
|
}, [field.value]);
|
|
33071
|
-
const filteredValue = options2 && options2?.length > 0 && Array.isArray(field
|
|
33072
|
-
(option) => field
|
|
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 =
|
|
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
|
-
|
|
33110
|
+
StateManagedSelect$1,
|
|
33086
33111
|
{
|
|
33087
|
-
relation,
|
|
33088
33112
|
options: options2,
|
|
33089
|
-
noOptionsMessage:
|
|
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,
|
|
33130
|
+
menuPlacement: "auto",
|
|
33096
33131
|
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
33097
33132
|
classNames: isEditTable ? {
|
|
33098
33133
|
valueContainer: () => "overflow-unset !px-0",
|
|
@@ -33149,14 +33184,23 @@ var Many2ManyTagField = (props) => {
|
|
|
33149
33184
|
),
|
|
33150
33185
|
IndicatorSeparator: () => null
|
|
33151
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
|
+
),
|
|
33152
33197
|
IndicatorSeparator: () => null,
|
|
33153
33198
|
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(components.DropdownIndicator, { ...props2 })
|
|
33154
33199
|
},
|
|
33155
33200
|
required: !invisible && required
|
|
33156
|
-
}
|
|
33157
|
-
field?.value
|
|
33201
|
+
}
|
|
33158
33202
|
),
|
|
33159
|
-
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 })
|
|
33160
33204
|
] });
|
|
33161
33205
|
}
|
|
33162
33206
|
}
|
|
@@ -34187,7 +34231,7 @@ var Many2ManyField = (props) => {
|
|
|
34187
34231
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
34188
34232
|
var import_react64 = __toESM(require("react"));
|
|
34189
34233
|
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
34190
|
-
var
|
|
34234
|
+
var CustomMenuList2 = (props) => {
|
|
34191
34235
|
const { options: options2, children, selectProps } = props;
|
|
34192
34236
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
34193
34237
|
const limitedChildren = import_react64.default.Children.toArray(children).slice(0, 10);
|
|
@@ -34359,7 +34403,7 @@ var Many2OneField = (props) => {
|
|
|
34359
34403
|
},
|
|
34360
34404
|
components: {
|
|
34361
34405
|
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
34362
|
-
|
|
34406
|
+
CustomMenuList2,
|
|
34363
34407
|
{
|
|
34364
34408
|
...menuListProps,
|
|
34365
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
|
-
|
|
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,31 +33030,41 @@ var Many2ManyTagField = (props) => {
|
|
|
33005
33030
|
clearErrors(name2);
|
|
33006
33031
|
}
|
|
33007
33032
|
}, [field.value]);
|
|
33008
|
-
const filteredValue = options2 && options2?.length > 0 && Array.isArray(field
|
|
33009
|
-
(option) => field
|
|
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 =
|
|
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
|
-
|
|
33047
|
+
StateManagedSelect$1,
|
|
33023
33048
|
{
|
|
33024
|
-
relation,
|
|
33025
33049
|
options: options2,
|
|
33026
|
-
noOptionsMessage:
|
|
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,
|
|
33067
|
+
menuPlacement: "auto",
|
|
33033
33068
|
placeholder: readonly ? "" : instance.t("choose_place"),
|
|
33034
33069
|
classNames: isEditTable ? {
|
|
33035
33070
|
valueContainer: () => "overflow-unset !px-0",
|
|
@@ -33086,14 +33121,23 @@ var Many2ManyTagField = (props) => {
|
|
|
33086
33121
|
),
|
|
33087
33122
|
IndicatorSeparator: () => null
|
|
33088
33123
|
} : {
|
|
33124
|
+
MenuList: (menuListProps) => /* @__PURE__ */ jsx91(
|
|
33125
|
+
CustomMenuList,
|
|
33126
|
+
{
|
|
33127
|
+
...menuListProps,
|
|
33128
|
+
selectProps: {
|
|
33129
|
+
...menuListProps.selectProps,
|
|
33130
|
+
setIsShowModalMany2Many
|
|
33131
|
+
}
|
|
33132
|
+
}
|
|
33133
|
+
),
|
|
33089
33134
|
IndicatorSeparator: () => null,
|
|
33090
33135
|
DropdownIndicator: (props2) => readonly ? null : /* @__PURE__ */ jsx91(components.DropdownIndicator, { ...props2 })
|
|
33091
33136
|
},
|
|
33092
33137
|
required: !invisible && required
|
|
33093
|
-
}
|
|
33094
|
-
field?.value
|
|
33138
|
+
}
|
|
33095
33139
|
),
|
|
33096
|
-
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 })
|
|
33097
33141
|
] });
|
|
33098
33142
|
}
|
|
33099
33143
|
}
|
|
@@ -33211,7 +33255,7 @@ var PaidBadgedField = () => {
|
|
|
33211
33255
|
};
|
|
33212
33256
|
|
|
33213
33257
|
// src/widgets/basic/priority-field/rating-star.tsx
|
|
33214
|
-
import
|
|
33258
|
+
import React17, { useEffect as useEffect21, useState as useState19 } from "react";
|
|
33215
33259
|
import { jsx as jsx94, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
33216
33260
|
var RatingStarField = (props) => {
|
|
33217
33261
|
const {
|
|
@@ -33257,7 +33301,7 @@ var RatingStarField = (props) => {
|
|
|
33257
33301
|
const starValue = index4 + 1;
|
|
33258
33302
|
const fillColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "white" : rating >= starValue ? "#f3cc00" : "white";
|
|
33259
33303
|
const strokeColor = hover > 0 ? hover >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)" : rating >= starValue ? "#f3cc00" : "rgba(73,80,87,0.76)";
|
|
33260
|
-
return /* @__PURE__ */ jsxs64(
|
|
33304
|
+
return /* @__PURE__ */ jsxs64(React17.Fragment, { children: [
|
|
33261
33305
|
/* @__PURE__ */ jsx94(
|
|
33262
33306
|
"div",
|
|
33263
33307
|
{
|
|
@@ -34122,12 +34166,12 @@ var Many2ManyField = (props) => {
|
|
|
34122
34166
|
};
|
|
34123
34167
|
|
|
34124
34168
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
34125
|
-
import
|
|
34169
|
+
import React18, { useEffect as useEffect25, useMemo as useMemo9 } from "react";
|
|
34126
34170
|
import { Fragment as Fragment30, jsx as jsx104, jsxs as jsxs72 } from "react/jsx-runtime";
|
|
34127
|
-
var
|
|
34171
|
+
var CustomMenuList2 = (props) => {
|
|
34128
34172
|
const { options: options2, children, selectProps } = props;
|
|
34129
34173
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
34130
|
-
const limitedChildren =
|
|
34174
|
+
const limitedChildren = React18.Children.toArray(children).slice(0, 10);
|
|
34131
34175
|
return /* @__PURE__ */ jsxs72(components.MenuList, { ...props, className: "z-[99]", children: [
|
|
34132
34176
|
limitedChildren,
|
|
34133
34177
|
options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ jsxs72(
|
|
@@ -34296,7 +34340,7 @@ var Many2OneField = (props) => {
|
|
|
34296
34340
|
},
|
|
34297
34341
|
components: {
|
|
34298
34342
|
MenuList: (menuListProps) => /* @__PURE__ */ jsx104(
|
|
34299
|
-
|
|
34343
|
+
CustomMenuList2,
|
|
34300
34344
|
{
|
|
34301
34345
|
...menuListProps,
|
|
34302
34346
|
selectProps: {
|