@fctc/sme-widget-ui 3.10.4 → 3.10.6
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 -130
- package/dist/index.mjs +165 -124
- package/dist/widgets.js +171 -130
- package/dist/widgets.mjs +165 -124
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31794,12 +31794,13 @@ var DateField = (props) => {
|
|
|
31794
31794
|
}
|
|
31795
31795
|
if (showTime) {
|
|
31796
31796
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31797
|
+
field.onChange(adjustedDate.format(formatDateParse));
|
|
31797
31798
|
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31798
31799
|
} else {
|
|
31799
31800
|
const formattedDateWithoutTime = adjustedDate.format(formatDateParse);
|
|
31801
|
+
field.onChange(adjustedDate.format(formatDateParse));
|
|
31800
31802
|
handleOnchange && handleOnchange(name ?? "", formattedDateWithoutTime);
|
|
31801
31803
|
}
|
|
31802
|
-
field.onChange(adjustedDate.format(formatDateParse));
|
|
31803
31804
|
clearErrors(name);
|
|
31804
31805
|
} else {
|
|
31805
31806
|
field.onChange(null);
|
|
@@ -32735,6 +32736,8 @@ var Many2ManyTagField = (props) => {
|
|
|
32735
32736
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
32736
32737
|
},
|
|
32737
32738
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
32739
|
+
const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
|
|
32740
|
+
const [hover, setHover] = (0, import_react62.useState)(false);
|
|
32738
32741
|
const { clearErrors } = methods;
|
|
32739
32742
|
(0, import_react62.useEffect)(() => {
|
|
32740
32743
|
if (field.value) {
|
|
@@ -32769,118 +32772,138 @@ var Many2ManyTagField = (props) => {
|
|
|
32769
32772
|
});
|
|
32770
32773
|
});
|
|
32771
32774
|
};
|
|
32772
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
32773
|
-
|
|
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
|
-
|
|
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
|
+
);
|
|
32884
32907
|
}
|
|
32885
32908
|
}
|
|
32886
32909
|
);
|
|
@@ -33204,6 +33227,7 @@ var RemainingDaysField = (props) => {
|
|
|
33204
33227
|
};
|
|
33205
33228
|
|
|
33206
33229
|
// src/widgets/basic/select-dropdown-field/select-dropdown.tsx
|
|
33230
|
+
var import_react66 = require("react");
|
|
33207
33231
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
33208
33232
|
var SelectDropdownField = (props) => {
|
|
33209
33233
|
const { t: t3 } = useI18n();
|
|
@@ -33238,6 +33262,8 @@ var SelectDropdownField = (props) => {
|
|
|
33238
33262
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
33239
33263
|
},
|
|
33240
33264
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
33265
|
+
const [menuOpen, setMenuOpen] = (0, import_react66.useState)(false);
|
|
33266
|
+
const [hover, setHover] = (0, import_react66.useState)(false);
|
|
33241
33267
|
const defaultValue = options2.find(
|
|
33242
33268
|
(option) => option.value === value
|
|
33243
33269
|
);
|
|
@@ -33248,13 +33274,23 @@ var SelectDropdownField = (props) => {
|
|
|
33248
33274
|
placeholder: readonly ? "" : placeholder || t3("choose_place"),
|
|
33249
33275
|
isSearchable: !readonly,
|
|
33250
33276
|
isDisabled: readonly,
|
|
33277
|
+
isClearable: menuOpen,
|
|
33251
33278
|
menuPlacement: "auto",
|
|
33252
33279
|
onChange: (selectedOption) => {
|
|
33253
33280
|
field.onChange(selectedOption.value);
|
|
33254
33281
|
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
33255
33282
|
},
|
|
33256
33283
|
value: defaultValue || null,
|
|
33257
|
-
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
|
+
}
|
|
33258
33294
|
};
|
|
33259
33295
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [
|
|
33260
33296
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -33309,12 +33345,17 @@ var SelectDropdownField = (props) => {
|
|
|
33309
33345
|
menuList: (base) => ({
|
|
33310
33346
|
...base,
|
|
33311
33347
|
padding: "4px"
|
|
33348
|
+
}),
|
|
33349
|
+
dropdownIndicator: (base) => ({
|
|
33350
|
+
...base,
|
|
33351
|
+
padding: "0",
|
|
33352
|
+
display: hover ? "flex" : "none"
|
|
33312
33353
|
})
|
|
33313
33354
|
},
|
|
33314
33355
|
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
33315
33356
|
components: {
|
|
33316
33357
|
IndicatorSeparator: () => null,
|
|
33317
|
-
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 })
|
|
33318
33359
|
},
|
|
33319
33360
|
noOptionsMessage: () => t3("no-available")
|
|
33320
33361
|
}
|
|
@@ -33440,7 +33481,7 @@ var ToggleButtonField = (props) => {
|
|
|
33440
33481
|
};
|
|
33441
33482
|
|
|
33442
33483
|
// src/widgets/basic/integer-field/integer.tsx
|
|
33443
|
-
var
|
|
33484
|
+
var import_react67 = require("react");
|
|
33444
33485
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
33445
33486
|
var IntegerField = (props) => {
|
|
33446
33487
|
const {
|
|
@@ -33477,13 +33518,13 @@ var IntegerField = (props) => {
|
|
|
33477
33518
|
fieldState: { error: error2 }
|
|
33478
33519
|
}) => {
|
|
33479
33520
|
const { setError, clearErrors } = methods;
|
|
33480
|
-
const isDirtyRef = (0,
|
|
33481
|
-
const inputRef = (0,
|
|
33482
|
-
const lastCommittedValueRef = (0,
|
|
33483
|
-
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)(
|
|
33484
33525
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
33485
33526
|
);
|
|
33486
|
-
(0,
|
|
33527
|
+
(0, import_react67.useEffect)(() => {
|
|
33487
33528
|
if (value2 !== void 0 && value2 !== null) {
|
|
33488
33529
|
setInputValue(String(value2));
|
|
33489
33530
|
clearErrors(name);
|
|
@@ -33639,7 +33680,7 @@ var StatusDropdownField = (props) => {
|
|
|
33639
33680
|
|
|
33640
33681
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
33641
33682
|
var import_react_dom8 = require("react-dom");
|
|
33642
|
-
var
|
|
33683
|
+
var import_react68 = require("react");
|
|
33643
33684
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
33644
33685
|
var Many2ManyField = (props) => {
|
|
33645
33686
|
const { t: t3 } = useI18n();
|
|
@@ -33694,7 +33735,7 @@ var Many2ManyField = (props) => {
|
|
|
33694
33735
|
setGroupBy,
|
|
33695
33736
|
clearSearch
|
|
33696
33737
|
} = searchController;
|
|
33697
|
-
(0,
|
|
33738
|
+
(0, import_react68.useEffect)(() => {
|
|
33698
33739
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
33699
33740
|
if (groupItems?.length > 0) {
|
|
33700
33741
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33849,13 +33890,13 @@ var Many2ManyField = (props) => {
|
|
|
33849
33890
|
};
|
|
33850
33891
|
|
|
33851
33892
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33852
|
-
var
|
|
33893
|
+
var import_react69 = __toESM(require("react"));
|
|
33853
33894
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
33854
33895
|
var CustomMenuList2 = (props) => {
|
|
33855
33896
|
const { t: t3 } = useI18n();
|
|
33856
33897
|
const { options: options2, children, selectProps } = props;
|
|
33857
33898
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
33858
|
-
const limitedChildren =
|
|
33899
|
+
const limitedChildren = import_react69.default.Children.toArray(children).slice(0, 10);
|
|
33859
33900
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
|
|
33860
33901
|
limitedChildren,
|
|
33861
33902
|
options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -33946,8 +33987,8 @@ var Many2OneField = (props) => {
|
|
|
33946
33987
|
} : false
|
|
33947
33988
|
},
|
|
33948
33989
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
33949
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
33950
|
-
const [hover, setHover] = (0,
|
|
33990
|
+
const [menuOpen, setMenuOpen] = (0, import_react69.useState)(false);
|
|
33991
|
+
const [hover, setHover] = (0, import_react69.useState)(false);
|
|
33951
33992
|
const currentValue = field?.value ? {
|
|
33952
33993
|
value: field?.value?.id,
|
|
33953
33994
|
label: field?.value?.display_name,
|
|
@@ -33956,7 +33997,7 @@ var Many2OneField = (props) => {
|
|
|
33956
33997
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33957
33998
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33958
33999
|
) ?? currentValue : currentValue ?? null;
|
|
33959
|
-
(0,
|
|
34000
|
+
(0, import_react69.useEffect)(() => {
|
|
33960
34001
|
if (error2 && selectedOption) {
|
|
33961
34002
|
methods?.clearErrors(name);
|
|
33962
34003
|
}
|
|
@@ -34181,11 +34222,11 @@ var StatusbarDurationField = (props) => {
|
|
|
34181
34222
|
};
|
|
34182
34223
|
|
|
34183
34224
|
// src/widgets/basic/status-bar-field/option/option.tsx
|
|
34184
|
-
var
|
|
34225
|
+
var import_react70 = require("react");
|
|
34185
34226
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
34186
34227
|
var StatusBarOptionField = (props) => {
|
|
34187
34228
|
const { selection, defaultValue } = props;
|
|
34188
|
-
const memoizedStatusOptions = (0,
|
|
34229
|
+
const memoizedStatusOptions = (0, import_react70.useMemo)(() => selection, [selection]);
|
|
34189
34230
|
const indexInProgress = memoizedStatusOptions?.findIndex(
|
|
34190
34231
|
(option) => option?.[0] === defaultValue
|
|
34191
34232
|
);
|