@fctc/sme-widget-ui 3.10.5 → 3.10.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 +171 -131
- package/dist/index.mjs +165 -125
- package/dist/widgets.js +171 -131
- package/dist/widgets.mjs +165 -125
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17861,8 +17861,8 @@ var CopyLinkButtonField = (props) => {
|
|
|
17861
17861
|
baseClassName
|
|
17862
17862
|
} = props;
|
|
17863
17863
|
const { t: t3 } = useI18n();
|
|
17864
|
-
if (!isForm) {
|
|
17865
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "truncate max-w-[300px]", children: propValue && typeof propValue === "object" ? propValue.display_name : propValue });
|
|
17864
|
+
if (!isForm && !isEditTable) {
|
|
17865
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: "truncate max-w-[300px]", children: maskingValue || (propValue && typeof propValue === "object" ? propValue.display_name : propValue) });
|
|
17866
17866
|
}
|
|
17867
17867
|
return /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
17868
17868
|
Controller,
|
|
@@ -32736,6 +32736,8 @@ var Many2ManyTagField = (props) => {
|
|
|
32736
32736
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
32737
32737
|
},
|
|
32738
32738
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
32739
|
+
const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
|
|
32740
|
+
const [hover, setHover] = (0, import_react62.useState)(false);
|
|
32739
32741
|
const { clearErrors } = methods;
|
|
32740
32742
|
(0, import_react62.useEffect)(() => {
|
|
32741
32743
|
if (field.value) {
|
|
@@ -32770,118 +32772,138 @@ var Many2ManyTagField = (props) => {
|
|
|
32770
32772
|
});
|
|
32771
32773
|
});
|
|
32772
32774
|
};
|
|
32773
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
32774
|
-
|
|
32775
|
-
|
|
32776
|
-
|
|
32777
|
-
|
|
32778
|
-
|
|
32779
|
-
|
|
32780
|
-
|
|
32781
|
-
|
|
32782
|
-
|
|
32783
|
-
|
|
32784
|
-
|
|
32785
|
-
|
|
32786
|
-
|
|
32787
|
-
|
|
32788
|
-
|
|
32789
|
-
|
|
32790
|
-
|
|
32791
|
-
|
|
32792
|
-
|
|
32793
|
-
|
|
32794
|
-
|
|
32795
|
-
|
|
32796
|
-
|
|
32797
|
-
|
|
32798
|
-
|
|
32799
|
-
|
|
32800
|
-
|
|
32801
|
-
|
|
32802
|
-
|
|
32803
|
-
|
|
32804
|
-
|
|
32805
|
-
|
|
32806
|
-
|
|
32807
|
-
|
|
32808
|
-
|
|
32809
|
-
|
|
32810
|
-
|
|
32811
|
-
|
|
32812
|
-
|
|
32813
|
-
|
|
32814
|
-
|
|
32815
|
-
|
|
32816
|
-
|
|
32817
|
-
|
|
32818
|
-
|
|
32819
|
-
|
|
32820
|
-
|
|
32821
|
-
|
|
32822
|
-
|
|
32823
|
-
|
|
32824
|
-
|
|
32825
|
-
|
|
32826
|
-
|
|
32827
|
-
|
|
32828
|
-
|
|
32829
|
-
|
|
32830
|
-
|
|
32831
|
-
|
|
32832
|
-
|
|
32833
|
-
|
|
32834
|
-
|
|
32835
|
-
|
|
32836
|
-
|
|
32837
|
-
|
|
32838
|
-
|
|
32839
|
-
|
|
32840
|
-
|
|
32841
|
-
|
|
32842
|
-
|
|
32843
|
-
|
|
32844
|
-
|
|
32845
|
-
|
|
32846
|
-
|
|
32847
|
-
|
|
32848
|
-
|
|
32849
|
-
|
|
32850
|
-
|
|
32851
|
-
|
|
32852
|
-
|
|
32853
|
-
|
|
32854
|
-
|
|
32855
|
-
|
|
32856
|
-
|
|
32857
|
-
|
|
32858
|
-
|
|
32859
|
-
|
|
32860
|
-
|
|
32861
|
-
|
|
32862
|
-
|
|
32863
|
-
|
|
32864
|
-
|
|
32865
|
-
|
|
32866
|
-
|
|
32867
|
-
|
|
32868
|
-
|
|
32869
|
-
|
|
32870
|
-
|
|
32871
|
-
|
|
32872
|
-
|
|
32873
|
-
|
|
32874
|
-
|
|
32875
|
-
|
|
32876
|
-
|
|
32877
|
-
|
|
32878
|
-
|
|
32879
|
-
|
|
32880
|
-
|
|
32881
|
-
|
|
32882
|
-
|
|
32883
|
-
|
|
32884
|
-
|
|
32775
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
32776
|
+
"div",
|
|
32777
|
+
{
|
|
32778
|
+
className: "group h-full",
|
|
32779
|
+
onMouseEnter: () => setHover(true),
|
|
32780
|
+
onMouseLeave: () => setHover(false),
|
|
32781
|
+
children: [
|
|
32782
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32783
|
+
StateManagedSelect$1,
|
|
32784
|
+
{
|
|
32785
|
+
options: options2,
|
|
32786
|
+
noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
|
|
32787
|
+
isMulti: true,
|
|
32788
|
+
isDisabled: readonly,
|
|
32789
|
+
isSearchable: true,
|
|
32790
|
+
isClearable: menuOpen,
|
|
32791
|
+
menuShouldScrollIntoView: false,
|
|
32792
|
+
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
32793
|
+
value: filteredValue,
|
|
32794
|
+
onChange: handleChange,
|
|
32795
|
+
onMenuClose: () => {
|
|
32796
|
+
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
32797
|
+
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
32798
|
+
) || [];
|
|
32799
|
+
setInputValue("");
|
|
32800
|
+
setDomainObject(filteredDomain);
|
|
32801
|
+
setMenuOpen(false);
|
|
32802
|
+
},
|
|
32803
|
+
onMenuOpen: () => {
|
|
32804
|
+
fetchMoreOptions();
|
|
32805
|
+
setMenuOpen(true);
|
|
32806
|
+
},
|
|
32807
|
+
onBlur: () => {
|
|
32808
|
+
setHover(false);
|
|
32809
|
+
},
|
|
32810
|
+
menuPlacement: "auto",
|
|
32811
|
+
placeholder,
|
|
32812
|
+
classNames: isEditTable ? {
|
|
32813
|
+
valueContainer: () => "overflow-unset !px-0",
|
|
32814
|
+
control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
|
|
32815
|
+
dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
|
|
32816
|
+
clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
|
|
32817
|
+
} : {
|
|
32818
|
+
valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
|
|
32819
|
+
control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
|
|
32820
|
+
singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
|
|
32821
|
+
input: () => "!m-0 !p-0",
|
|
32822
|
+
dropdownIndicator: () => "!m-0 !p-0"
|
|
32823
|
+
},
|
|
32824
|
+
styles: {
|
|
32825
|
+
container: (base) => ({
|
|
32826
|
+
...base,
|
|
32827
|
+
height: "100%"
|
|
32828
|
+
}),
|
|
32829
|
+
control: () => ({
|
|
32830
|
+
maxWidth: isEditTable ? "max-content" : "100%",
|
|
32831
|
+
minWidth: isEditTable ? "max-content" : "100%",
|
|
32832
|
+
background: isEditTable ? "transparent" : "initial"
|
|
32833
|
+
}),
|
|
32834
|
+
multiValue: (provided, state) => {
|
|
32835
|
+
const { color, id } = state?.data ?? {};
|
|
32836
|
+
const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
|
|
32837
|
+
return {
|
|
32838
|
+
...provided,
|
|
32839
|
+
display: "flex",
|
|
32840
|
+
backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
|
|
32841
|
+
borderRadius: "16px",
|
|
32842
|
+
color: "black",
|
|
32843
|
+
fontWeight: "600"
|
|
32844
|
+
};
|
|
32845
|
+
},
|
|
32846
|
+
multiValueRemove: (provided) => ({
|
|
32847
|
+
...provided,
|
|
32848
|
+
backgroundColor: "transparent !important",
|
|
32849
|
+
color: "black !important"
|
|
32850
|
+
}),
|
|
32851
|
+
option: (provided, { isFocused, isSelected }) => ({
|
|
32852
|
+
...provided,
|
|
32853
|
+
backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
|
|
32854
|
+
color: isSelected ? "white" : "",
|
|
32855
|
+
cursor: "pointer",
|
|
32856
|
+
transition: "all 0.2s ease",
|
|
32857
|
+
borderRadius: "8px"
|
|
32858
|
+
}),
|
|
32859
|
+
menu: (base) => ({
|
|
32860
|
+
...base,
|
|
32861
|
+
zIndex: 9999,
|
|
32862
|
+
width: "100%",
|
|
32863
|
+
minWidth: "max-content",
|
|
32864
|
+
borderRadius: "10px"
|
|
32865
|
+
}),
|
|
32866
|
+
menuList: (base) => ({
|
|
32867
|
+
...base,
|
|
32868
|
+
padding: "4px"
|
|
32869
|
+
}),
|
|
32870
|
+
dropdownIndicator: (base) => ({
|
|
32871
|
+
...base,
|
|
32872
|
+
padding: "0",
|
|
32873
|
+
display: hover ? "flex" : "none"
|
|
32874
|
+
})
|
|
32875
|
+
},
|
|
32876
|
+
components: isUser ? {
|
|
32877
|
+
MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32878
|
+
CustomMultiValue,
|
|
32879
|
+
{
|
|
32880
|
+
...multiValueProps,
|
|
32881
|
+
stringToColor
|
|
32882
|
+
}
|
|
32883
|
+
),
|
|
32884
|
+
IndicatorSeparator: () => null
|
|
32885
|
+
} : {
|
|
32886
|
+
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32887
|
+
CustomMenuList,
|
|
32888
|
+
{
|
|
32889
|
+
...menuListProps,
|
|
32890
|
+
selectProps: {
|
|
32891
|
+
...menuListProps.selectProps,
|
|
32892
|
+
setIsShowModalMany2Many
|
|
32893
|
+
}
|
|
32894
|
+
}
|
|
32895
|
+
),
|
|
32896
|
+
IndicatorSeparator: () => null,
|
|
32897
|
+
DropdownIndicator: (props2) => readonly || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.DropdownIndicator, { ...props2 }),
|
|
32898
|
+
ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.ClearIndicator, { ...props2 })
|
|
32899
|
+
},
|
|
32900
|
+
required: !invisible && required
|
|
32901
|
+
}
|
|
32902
|
+
),
|
|
32903
|
+
!isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
32904
|
+
]
|
|
32905
|
+
}
|
|
32906
|
+
);
|
|
32885
32907
|
}
|
|
32886
32908
|
}
|
|
32887
32909
|
);
|
|
@@ -33205,6 +33227,7 @@ var RemainingDaysField = (props) => {
|
|
|
33205
33227
|
};
|
|
33206
33228
|
|
|
33207
33229
|
// src/widgets/basic/select-dropdown-field/select-dropdown.tsx
|
|
33230
|
+
var import_react66 = require("react");
|
|
33208
33231
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
33209
33232
|
var SelectDropdownField = (props) => {
|
|
33210
33233
|
const { t: t3 } = useI18n();
|
|
@@ -33239,6 +33262,8 @@ var SelectDropdownField = (props) => {
|
|
|
33239
33262
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
33240
33263
|
},
|
|
33241
33264
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
33265
|
+
const [menuOpen, setMenuOpen] = (0, import_react66.useState)(false);
|
|
33266
|
+
const [hover, setHover] = (0, import_react66.useState)(false);
|
|
33242
33267
|
const defaultValue = options2.find(
|
|
33243
33268
|
(option) => option.value === value
|
|
33244
33269
|
);
|
|
@@ -33249,13 +33274,23 @@ var SelectDropdownField = (props) => {
|
|
|
33249
33274
|
placeholder: readonly ? "" : placeholder || t3("choose_place"),
|
|
33250
33275
|
isSearchable: !readonly,
|
|
33251
33276
|
isDisabled: readonly,
|
|
33277
|
+
isClearable: menuOpen,
|
|
33252
33278
|
menuPlacement: "auto",
|
|
33253
33279
|
onChange: (selectedOption) => {
|
|
33254
33280
|
field.onChange(selectedOption.value);
|
|
33255
33281
|
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
33256
33282
|
},
|
|
33257
33283
|
value: defaultValue || null,
|
|
33258
|
-
required: !invisible && required
|
|
33284
|
+
required: !invisible && required,
|
|
33285
|
+
onMenuOpen: () => {
|
|
33286
|
+
setMenuOpen(true);
|
|
33287
|
+
},
|
|
33288
|
+
onMenuClose: () => {
|
|
33289
|
+
setMenuOpen(false);
|
|
33290
|
+
},
|
|
33291
|
+
onBlur: () => {
|
|
33292
|
+
setHover(false);
|
|
33293
|
+
}
|
|
33259
33294
|
};
|
|
33260
33295
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [
|
|
33261
33296
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -33310,12 +33345,17 @@ var SelectDropdownField = (props) => {
|
|
|
33310
33345
|
menuList: (base) => ({
|
|
33311
33346
|
...base,
|
|
33312
33347
|
padding: "4px"
|
|
33348
|
+
}),
|
|
33349
|
+
dropdownIndicator: (base) => ({
|
|
33350
|
+
...base,
|
|
33351
|
+
padding: "0",
|
|
33352
|
+
display: hover ? "flex" : "none"
|
|
33313
33353
|
})
|
|
33314
33354
|
},
|
|
33315
33355
|
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
33316
33356
|
components: {
|
|
33317
33357
|
IndicatorSeparator: () => null,
|
|
33318
|
-
DropdownIndicator: (props2) => readonly || !isEditTable ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
|
|
33358
|
+
DropdownIndicator: (props2) => readonly || !isEditTable || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
|
|
33319
33359
|
},
|
|
33320
33360
|
noOptionsMessage: () => t3("no-available")
|
|
33321
33361
|
}
|
|
@@ -33441,7 +33481,7 @@ var ToggleButtonField = (props) => {
|
|
|
33441
33481
|
};
|
|
33442
33482
|
|
|
33443
33483
|
// src/widgets/basic/integer-field/integer.tsx
|
|
33444
|
-
var
|
|
33484
|
+
var import_react67 = require("react");
|
|
33445
33485
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
33446
33486
|
var IntegerField = (props) => {
|
|
33447
33487
|
const {
|
|
@@ -33478,13 +33518,13 @@ var IntegerField = (props) => {
|
|
|
33478
33518
|
fieldState: { error: error2 }
|
|
33479
33519
|
}) => {
|
|
33480
33520
|
const { setError, clearErrors } = methods;
|
|
33481
|
-
const isDirtyRef = (0,
|
|
33482
|
-
const inputRef = (0,
|
|
33483
|
-
const lastCommittedValueRef = (0,
|
|
33484
|
-
const [inputValue, setInputValue] = (0,
|
|
33521
|
+
const isDirtyRef = (0, import_react67.useRef)(false);
|
|
33522
|
+
const inputRef = (0, import_react67.useRef)(null);
|
|
33523
|
+
const lastCommittedValueRef = (0, import_react67.useRef)(null);
|
|
33524
|
+
const [inputValue, setInputValue] = (0, import_react67.useState)(
|
|
33485
33525
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
33486
33526
|
);
|
|
33487
|
-
(0,
|
|
33527
|
+
(0, import_react67.useEffect)(() => {
|
|
33488
33528
|
if (value2 !== void 0 && value2 !== null) {
|
|
33489
33529
|
setInputValue(String(value2));
|
|
33490
33530
|
clearErrors(name);
|
|
@@ -33640,7 +33680,7 @@ var StatusDropdownField = (props) => {
|
|
|
33640
33680
|
|
|
33641
33681
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
33642
33682
|
var import_react_dom8 = require("react-dom");
|
|
33643
|
-
var
|
|
33683
|
+
var import_react68 = require("react");
|
|
33644
33684
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
33645
33685
|
var Many2ManyField = (props) => {
|
|
33646
33686
|
const { t: t3 } = useI18n();
|
|
@@ -33695,7 +33735,7 @@ var Many2ManyField = (props) => {
|
|
|
33695
33735
|
setGroupBy,
|
|
33696
33736
|
clearSearch
|
|
33697
33737
|
} = searchController;
|
|
33698
|
-
(0,
|
|
33738
|
+
(0, import_react68.useEffect)(() => {
|
|
33699
33739
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
33700
33740
|
if (groupItems?.length > 0) {
|
|
33701
33741
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33850,13 +33890,13 @@ var Many2ManyField = (props) => {
|
|
|
33850
33890
|
};
|
|
33851
33891
|
|
|
33852
33892
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33853
|
-
var
|
|
33893
|
+
var import_react69 = __toESM(require("react"));
|
|
33854
33894
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
33855
33895
|
var CustomMenuList2 = (props) => {
|
|
33856
33896
|
const { t: t3 } = useI18n();
|
|
33857
33897
|
const { options: options2, children, selectProps } = props;
|
|
33858
33898
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
33859
|
-
const limitedChildren =
|
|
33899
|
+
const limitedChildren = import_react69.default.Children.toArray(children).slice(0, 10);
|
|
33860
33900
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
|
|
33861
33901
|
limitedChildren,
|
|
33862
33902
|
options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -33947,8 +33987,8 @@ var Many2OneField = (props) => {
|
|
|
33947
33987
|
} : false
|
|
33948
33988
|
},
|
|
33949
33989
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
33950
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
33951
|
-
const [hover, setHover] = (0,
|
|
33990
|
+
const [menuOpen, setMenuOpen] = (0, import_react69.useState)(false);
|
|
33991
|
+
const [hover, setHover] = (0, import_react69.useState)(false);
|
|
33952
33992
|
const currentValue = field?.value ? {
|
|
33953
33993
|
value: field?.value?.id,
|
|
33954
33994
|
label: field?.value?.display_name,
|
|
@@ -33957,7 +33997,7 @@ var Many2OneField = (props) => {
|
|
|
33957
33997
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33958
33998
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33959
33999
|
) ?? currentValue : currentValue ?? null;
|
|
33960
|
-
(0,
|
|
34000
|
+
(0, import_react69.useEffect)(() => {
|
|
33961
34001
|
if (error2 && selectedOption) {
|
|
33962
34002
|
methods?.clearErrors(name);
|
|
33963
34003
|
}
|
|
@@ -34182,11 +34222,11 @@ var StatusbarDurationField = (props) => {
|
|
|
34182
34222
|
};
|
|
34183
34223
|
|
|
34184
34224
|
// src/widgets/basic/status-bar-field/option/option.tsx
|
|
34185
|
-
var
|
|
34225
|
+
var import_react70 = require("react");
|
|
34186
34226
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
34187
34227
|
var StatusBarOptionField = (props) => {
|
|
34188
34228
|
const { selection, defaultValue } = props;
|
|
34189
|
-
const memoizedStatusOptions = (0,
|
|
34229
|
+
const memoizedStatusOptions = (0, import_react70.useMemo)(() => selection, [selection]);
|
|
34190
34230
|
const indexInProgress = memoizedStatusOptions?.findIndex(
|
|
34191
34231
|
(option) => option?.[0] === defaultValue
|
|
34192
34232
|
);
|