@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/widgets.js
CHANGED
|
@@ -31022,12 +31022,13 @@ var DateField = (props) => {
|
|
|
31022
31022
|
}
|
|
31023
31023
|
if (showTime) {
|
|
31024
31024
|
const formattedDate = adjustedDate.subtract(7, "hours").format(formatDateParse);
|
|
31025
|
+
field.onChange(adjustedDate.format(formatDateParse));
|
|
31025
31026
|
handleOnchange && handleOnchange(name ?? "", formattedDate);
|
|
31026
31027
|
} else {
|
|
31027
31028
|
const formattedDateWithoutTime = adjustedDate.format(formatDateParse);
|
|
31029
|
+
field.onChange(adjustedDate.format(formatDateParse));
|
|
31028
31030
|
handleOnchange && handleOnchange(name ?? "", formattedDateWithoutTime);
|
|
31029
31031
|
}
|
|
31030
|
-
field.onChange(adjustedDate.format(formatDateParse));
|
|
31031
31032
|
clearErrors(name);
|
|
31032
31033
|
} else {
|
|
31033
31034
|
field.onChange(null);
|
|
@@ -31963,6 +31964,8 @@ var Many2ManyTagField = (props) => {
|
|
|
31963
31964
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
31964
31965
|
},
|
|
31965
31966
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
31967
|
+
const [menuOpen, setMenuOpen] = (0, import_react62.useState)(false);
|
|
31968
|
+
const [hover, setHover] = (0, import_react62.useState)(false);
|
|
31966
31969
|
const { clearErrors } = methods;
|
|
31967
31970
|
(0, import_react62.useEffect)(() => {
|
|
31968
31971
|
if (field.value) {
|
|
@@ -31997,118 +32000,138 @@ var Many2ManyTagField = (props) => {
|
|
|
31997
32000
|
});
|
|
31998
32001
|
});
|
|
31999
32002
|
};
|
|
32000
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
32001
|
-
|
|
32002
|
-
|
|
32003
|
-
|
|
32004
|
-
|
|
32005
|
-
|
|
32006
|
-
|
|
32007
|
-
|
|
32008
|
-
|
|
32009
|
-
|
|
32010
|
-
|
|
32011
|
-
|
|
32012
|
-
|
|
32013
|
-
|
|
32014
|
-
|
|
32015
|
-
|
|
32016
|
-
|
|
32017
|
-
|
|
32018
|
-
|
|
32019
|
-
|
|
32020
|
-
|
|
32021
|
-
|
|
32022
|
-
|
|
32023
|
-
|
|
32024
|
-
|
|
32025
|
-
|
|
32026
|
-
|
|
32027
|
-
|
|
32028
|
-
|
|
32029
|
-
|
|
32030
|
-
|
|
32031
|
-
|
|
32032
|
-
|
|
32033
|
-
|
|
32034
|
-
|
|
32035
|
-
|
|
32036
|
-
|
|
32037
|
-
|
|
32038
|
-
|
|
32039
|
-
|
|
32040
|
-
|
|
32041
|
-
|
|
32042
|
-
|
|
32043
|
-
|
|
32044
|
-
|
|
32045
|
-
|
|
32046
|
-
|
|
32047
|
-
|
|
32048
|
-
|
|
32049
|
-
|
|
32050
|
-
|
|
32051
|
-
|
|
32052
|
-
|
|
32053
|
-
|
|
32054
|
-
|
|
32055
|
-
|
|
32056
|
-
|
|
32057
|
-
|
|
32058
|
-
|
|
32059
|
-
|
|
32060
|
-
|
|
32061
|
-
|
|
32062
|
-
|
|
32063
|
-
|
|
32064
|
-
|
|
32065
|
-
|
|
32066
|
-
|
|
32067
|
-
|
|
32068
|
-
|
|
32069
|
-
|
|
32070
|
-
|
|
32071
|
-
|
|
32072
|
-
|
|
32073
|
-
|
|
32074
|
-
|
|
32075
|
-
|
|
32076
|
-
|
|
32077
|
-
|
|
32078
|
-
|
|
32079
|
-
|
|
32080
|
-
|
|
32081
|
-
|
|
32082
|
-
|
|
32083
|
-
|
|
32084
|
-
|
|
32085
|
-
|
|
32086
|
-
|
|
32087
|
-
|
|
32088
|
-
|
|
32089
|
-
|
|
32090
|
-
|
|
32091
|
-
|
|
32092
|
-
|
|
32093
|
-
|
|
32094
|
-
|
|
32095
|
-
|
|
32096
|
-
|
|
32097
|
-
|
|
32098
|
-
|
|
32099
|
-
|
|
32100
|
-
|
|
32101
|
-
|
|
32102
|
-
|
|
32103
|
-
|
|
32104
|
-
|
|
32105
|
-
|
|
32106
|
-
|
|
32107
|
-
|
|
32108
|
-
|
|
32109
|
-
|
|
32110
|
-
|
|
32111
|
-
|
|
32003
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)(
|
|
32004
|
+
"div",
|
|
32005
|
+
{
|
|
32006
|
+
className: "group h-full",
|
|
32007
|
+
onMouseEnter: () => setHover(true),
|
|
32008
|
+
onMouseLeave: () => setHover(false),
|
|
32009
|
+
children: [
|
|
32010
|
+
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32011
|
+
StateManagedSelect$1,
|
|
32012
|
+
{
|
|
32013
|
+
options: options2,
|
|
32014
|
+
noOptionsMessage: () => t3(isFetching ? "loading" : "no-available"),
|
|
32015
|
+
isMulti: true,
|
|
32016
|
+
isDisabled: readonly,
|
|
32017
|
+
isSearchable: true,
|
|
32018
|
+
isClearable: menuOpen,
|
|
32019
|
+
menuShouldScrollIntoView: false,
|
|
32020
|
+
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
32021
|
+
value: filteredValue,
|
|
32022
|
+
onChange: handleChange,
|
|
32023
|
+
onMenuClose: () => {
|
|
32024
|
+
const filteredDomain = [...domainObject ?? []]?.filter(
|
|
32025
|
+
(d) => !(Array.isArray(d) && d[0] === "name" && d[1] === "ilike")
|
|
32026
|
+
) || [];
|
|
32027
|
+
setInputValue("");
|
|
32028
|
+
setDomainObject(filteredDomain);
|
|
32029
|
+
setMenuOpen(false);
|
|
32030
|
+
},
|
|
32031
|
+
onMenuOpen: () => {
|
|
32032
|
+
fetchMoreOptions();
|
|
32033
|
+
setMenuOpen(true);
|
|
32034
|
+
},
|
|
32035
|
+
onBlur: () => {
|
|
32036
|
+
setHover(false);
|
|
32037
|
+
},
|
|
32038
|
+
menuPlacement: "auto",
|
|
32039
|
+
placeholder,
|
|
32040
|
+
classNames: isEditTable ? {
|
|
32041
|
+
valueContainer: () => "overflow-unset !px-0",
|
|
32042
|
+
control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
|
|
32043
|
+
dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
|
|
32044
|
+
clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
|
|
32045
|
+
} : {
|
|
32046
|
+
valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
|
|
32047
|
+
control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
|
|
32048
|
+
singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
|
|
32049
|
+
input: () => "!m-0 !p-0",
|
|
32050
|
+
dropdownIndicator: () => "!m-0 !p-0"
|
|
32051
|
+
},
|
|
32052
|
+
styles: {
|
|
32053
|
+
container: (base) => ({
|
|
32054
|
+
...base,
|
|
32055
|
+
height: "100%"
|
|
32056
|
+
}),
|
|
32057
|
+
control: () => ({
|
|
32058
|
+
maxWidth: isEditTable ? "max-content" : "100%",
|
|
32059
|
+
minWidth: isEditTable ? "max-content" : "100%",
|
|
32060
|
+
background: isEditTable ? "transparent" : "initial"
|
|
32061
|
+
}),
|
|
32062
|
+
multiValue: (provided, state) => {
|
|
32063
|
+
const { color, id } = state?.data ?? {};
|
|
32064
|
+
const bgColor = color !== null ? COLORS[color]?.color : COLORS[id]?.color;
|
|
32065
|
+
return {
|
|
32066
|
+
...provided,
|
|
32067
|
+
display: "flex",
|
|
32068
|
+
backgroundColor: bgColor || "rgba(230.1375, 221.3625, 221.3625, 1)",
|
|
32069
|
+
borderRadius: "16px",
|
|
32070
|
+
color: "black",
|
|
32071
|
+
fontWeight: "600"
|
|
32072
|
+
};
|
|
32073
|
+
},
|
|
32074
|
+
multiValueRemove: (provided) => ({
|
|
32075
|
+
...provided,
|
|
32076
|
+
backgroundColor: "transparent !important",
|
|
32077
|
+
color: "black !important"
|
|
32078
|
+
}),
|
|
32079
|
+
option: (provided, { isFocused, isSelected }) => ({
|
|
32080
|
+
...provided,
|
|
32081
|
+
backgroundColor: isSelected || isFocused ? "rgba(66,66,66,0.08)" : "#FFF",
|
|
32082
|
+
color: isSelected ? "white" : "",
|
|
32083
|
+
cursor: "pointer",
|
|
32084
|
+
transition: "all 0.2s ease",
|
|
32085
|
+
borderRadius: "8px"
|
|
32086
|
+
}),
|
|
32087
|
+
menu: (base) => ({
|
|
32088
|
+
...base,
|
|
32089
|
+
zIndex: 9999,
|
|
32090
|
+
width: "100%",
|
|
32091
|
+
minWidth: "max-content",
|
|
32092
|
+
borderRadius: "10px"
|
|
32093
|
+
}),
|
|
32094
|
+
menuList: (base) => ({
|
|
32095
|
+
...base,
|
|
32096
|
+
padding: "4px"
|
|
32097
|
+
}),
|
|
32098
|
+
dropdownIndicator: (base) => ({
|
|
32099
|
+
...base,
|
|
32100
|
+
padding: "0",
|
|
32101
|
+
display: hover ? "flex" : "none"
|
|
32102
|
+
})
|
|
32103
|
+
},
|
|
32104
|
+
components: isUser ? {
|
|
32105
|
+
MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32106
|
+
CustomMultiValue,
|
|
32107
|
+
{
|
|
32108
|
+
...multiValueProps,
|
|
32109
|
+
stringToColor
|
|
32110
|
+
}
|
|
32111
|
+
),
|
|
32112
|
+
IndicatorSeparator: () => null
|
|
32113
|
+
} : {
|
|
32114
|
+
MenuList: (menuListProps) => /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
32115
|
+
CustomMenuList,
|
|
32116
|
+
{
|
|
32117
|
+
...menuListProps,
|
|
32118
|
+
selectProps: {
|
|
32119
|
+
...menuListProps.selectProps,
|
|
32120
|
+
setIsShowModalMany2Many
|
|
32121
|
+
}
|
|
32122
|
+
}
|
|
32123
|
+
),
|
|
32124
|
+
IndicatorSeparator: () => null,
|
|
32125
|
+
DropdownIndicator: (props2) => readonly || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.DropdownIndicator, { ...props2 }),
|
|
32126
|
+
ClearIndicator: (props2) => readonly ? null : /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(components.ClearIndicator, { ...props2 })
|
|
32127
|
+
},
|
|
32128
|
+
required: !invisible && required
|
|
32129
|
+
}
|
|
32130
|
+
),
|
|
32131
|
+
!isEditTable && error2 && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
32132
|
+
]
|
|
32133
|
+
}
|
|
32134
|
+
);
|
|
32112
32135
|
}
|
|
32113
32136
|
}
|
|
32114
32137
|
);
|
|
@@ -32432,6 +32455,7 @@ var RemainingDaysField = (props) => {
|
|
|
32432
32455
|
};
|
|
32433
32456
|
|
|
32434
32457
|
// src/widgets/basic/select-dropdown-field/select-dropdown.tsx
|
|
32458
|
+
var import_react66 = require("react");
|
|
32435
32459
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
32436
32460
|
var SelectDropdownField = (props) => {
|
|
32437
32461
|
const { t: t3 } = useI18n();
|
|
@@ -32466,6 +32490,8 @@ var SelectDropdownField = (props) => {
|
|
|
32466
32490
|
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
32467
32491
|
},
|
|
32468
32492
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
32493
|
+
const [menuOpen, setMenuOpen] = (0, import_react66.useState)(false);
|
|
32494
|
+
const [hover, setHover] = (0, import_react66.useState)(false);
|
|
32469
32495
|
const defaultValue = options2.find(
|
|
32470
32496
|
(option) => option.value === value
|
|
32471
32497
|
);
|
|
@@ -32476,13 +32502,23 @@ var SelectDropdownField = (props) => {
|
|
|
32476
32502
|
placeholder: readonly ? "" : placeholder || t3("choose_place"),
|
|
32477
32503
|
isSearchable: !readonly,
|
|
32478
32504
|
isDisabled: readonly,
|
|
32505
|
+
isClearable: menuOpen,
|
|
32479
32506
|
menuPlacement: "auto",
|
|
32480
32507
|
onChange: (selectedOption) => {
|
|
32481
32508
|
field.onChange(selectedOption.value);
|
|
32482
32509
|
onChange2 && onChange2(name ?? "", selectedOption.value);
|
|
32483
32510
|
},
|
|
32484
32511
|
value: defaultValue || null,
|
|
32485
|
-
required: !invisible && required
|
|
32512
|
+
required: !invisible && required,
|
|
32513
|
+
onMenuOpen: () => {
|
|
32514
|
+
setMenuOpen(true);
|
|
32515
|
+
},
|
|
32516
|
+
onMenuClose: () => {
|
|
32517
|
+
setMenuOpen(false);
|
|
32518
|
+
},
|
|
32519
|
+
onBlur: () => {
|
|
32520
|
+
setHover(false);
|
|
32521
|
+
}
|
|
32486
32522
|
};
|
|
32487
32523
|
return /* @__PURE__ */ (0, import_jsx_runtime104.jsxs)(import_jsx_runtime104.Fragment, { children: [
|
|
32488
32524
|
/* @__PURE__ */ (0, import_jsx_runtime104.jsx)("div", { className: `group ${isEditTable ? "h-full" : ""}`, children: /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(
|
|
@@ -32537,12 +32573,17 @@ var SelectDropdownField = (props) => {
|
|
|
32537
32573
|
menuList: (base) => ({
|
|
32538
32574
|
...base,
|
|
32539
32575
|
padding: "4px"
|
|
32576
|
+
}),
|
|
32577
|
+
dropdownIndicator: (base) => ({
|
|
32578
|
+
...base,
|
|
32579
|
+
padding: "0",
|
|
32580
|
+
display: hover ? "flex" : "none"
|
|
32540
32581
|
})
|
|
32541
32582
|
},
|
|
32542
32583
|
menuPortalTarget: typeof window !== "undefined" ? document.body : null,
|
|
32543
32584
|
components: {
|
|
32544
32585
|
IndicatorSeparator: () => null,
|
|
32545
|
-
DropdownIndicator: (props2) => readonly || !isEditTable ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
|
|
32586
|
+
DropdownIndicator: (props2) => readonly || !isEditTable || menuOpen ? null : /* @__PURE__ */ (0, import_jsx_runtime104.jsx)(components.DropdownIndicator, { ...props2 })
|
|
32546
32587
|
},
|
|
32547
32588
|
noOptionsMessage: () => t3("no-available")
|
|
32548
32589
|
}
|
|
@@ -32668,7 +32709,7 @@ var ToggleButtonField = (props) => {
|
|
|
32668
32709
|
};
|
|
32669
32710
|
|
|
32670
32711
|
// src/widgets/basic/integer-field/integer.tsx
|
|
32671
|
-
var
|
|
32712
|
+
var import_react67 = require("react");
|
|
32672
32713
|
var import_jsx_runtime107 = require("react/jsx-runtime");
|
|
32673
32714
|
var IntegerField = (props) => {
|
|
32674
32715
|
const {
|
|
@@ -32705,13 +32746,13 @@ var IntegerField = (props) => {
|
|
|
32705
32746
|
fieldState: { error: error2 }
|
|
32706
32747
|
}) => {
|
|
32707
32748
|
const { setError, clearErrors } = methods;
|
|
32708
|
-
const isDirtyRef = (0,
|
|
32709
|
-
const inputRef = (0,
|
|
32710
|
-
const lastCommittedValueRef = (0,
|
|
32711
|
-
const [inputValue, setInputValue] = (0,
|
|
32749
|
+
const isDirtyRef = (0, import_react67.useRef)(false);
|
|
32750
|
+
const inputRef = (0, import_react67.useRef)(null);
|
|
32751
|
+
const lastCommittedValueRef = (0, import_react67.useRef)(null);
|
|
32752
|
+
const [inputValue, setInputValue] = (0, import_react67.useState)(
|
|
32712
32753
|
value2 !== void 0 && value2 !== null ? String(value2) : ""
|
|
32713
32754
|
);
|
|
32714
|
-
(0,
|
|
32755
|
+
(0, import_react67.useEffect)(() => {
|
|
32715
32756
|
if (value2 !== void 0 && value2 !== null) {
|
|
32716
32757
|
setInputValue(String(value2));
|
|
32717
32758
|
clearErrors(name);
|
|
@@ -32867,7 +32908,7 @@ var StatusDropdownField = (props) => {
|
|
|
32867
32908
|
|
|
32868
32909
|
// src/widgets/basic/many2many-field/many2many.tsx
|
|
32869
32910
|
var import_react_dom8 = require("react-dom");
|
|
32870
|
-
var
|
|
32911
|
+
var import_react68 = require("react");
|
|
32871
32912
|
var import_jsx_runtime109 = require("react/jsx-runtime");
|
|
32872
32913
|
var Many2ManyField = (props) => {
|
|
32873
32914
|
const { t: t3 } = useI18n();
|
|
@@ -32922,7 +32963,7 @@ var Many2ManyField = (props) => {
|
|
|
32922
32963
|
setGroupBy,
|
|
32923
32964
|
clearSearch
|
|
32924
32965
|
} = searchController;
|
|
32925
|
-
(0,
|
|
32966
|
+
(0, import_react68.useEffect)(() => {
|
|
32926
32967
|
const groupItems = Array.isArray(selectedTags) ? selectedTags.filter((item) => item.type === "group_by") : [];
|
|
32927
32968
|
if (groupItems?.length > 0) {
|
|
32928
32969
|
typeof setPageLimit === "function" && setPageLimit(80);
|
|
@@ -33077,13 +33118,13 @@ var Many2ManyField = (props) => {
|
|
|
33077
33118
|
};
|
|
33078
33119
|
|
|
33079
33120
|
// src/widgets/basic/many2one-field/many2one.tsx
|
|
33080
|
-
var
|
|
33121
|
+
var import_react69 = __toESM(require("react"));
|
|
33081
33122
|
var import_jsx_runtime110 = require("react/jsx-runtime");
|
|
33082
33123
|
var CustomMenuList2 = (props) => {
|
|
33083
33124
|
const { t: t3 } = useI18n();
|
|
33084
33125
|
const { options: options2, children, selectProps } = props;
|
|
33085
33126
|
const { setIsShowModalMany2Many, searchable } = selectProps;
|
|
33086
|
-
const limitedChildren =
|
|
33127
|
+
const limitedChildren = import_react69.default.Children.toArray(children).slice(0, 10);
|
|
33087
33128
|
return /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(components.MenuList, { ...props, className: "z-[99]", children: [
|
|
33088
33129
|
limitedChildren,
|
|
33089
33130
|
options2?.length > 0 && (options2?.length > 10 || searchable) && /* @__PURE__ */ (0, import_jsx_runtime110.jsxs)(
|
|
@@ -33174,8 +33215,8 @@ var Many2OneField = (props) => {
|
|
|
33174
33215
|
} : false
|
|
33175
33216
|
},
|
|
33176
33217
|
render: ({ field, fieldState: { error: error2 } }) => {
|
|
33177
|
-
const [menuOpen, setMenuOpen] = (0,
|
|
33178
|
-
const [hover, setHover] = (0,
|
|
33218
|
+
const [menuOpen, setMenuOpen] = (0, import_react69.useState)(false);
|
|
33219
|
+
const [hover, setHover] = (0, import_react69.useState)(false);
|
|
33179
33220
|
const currentValue = field?.value ? {
|
|
33180
33221
|
value: field?.value?.id,
|
|
33181
33222
|
label: field?.value?.display_name,
|
|
@@ -33184,7 +33225,7 @@ var Many2OneField = (props) => {
|
|
|
33184
33225
|
const selectedOption = isForm && options2?.service && options2?.type && options2?.model ? tempSelectedOption : tempSelectedOption && options2?.length ? options2.find(
|
|
33185
33226
|
(o3) => o3?.value === tempSelectedOption.value
|
|
33186
33227
|
) ?? currentValue : currentValue ?? null;
|
|
33187
|
-
(0,
|
|
33228
|
+
(0, import_react69.useEffect)(() => {
|
|
33188
33229
|
if (error2 && selectedOption) {
|
|
33189
33230
|
methods?.clearErrors(name);
|
|
33190
33231
|
}
|
|
@@ -33409,11 +33450,11 @@ var StatusbarDurationField = (props) => {
|
|
|
33409
33450
|
};
|
|
33410
33451
|
|
|
33411
33452
|
// src/widgets/basic/status-bar-field/option/option.tsx
|
|
33412
|
-
var
|
|
33453
|
+
var import_react70 = require("react");
|
|
33413
33454
|
var import_jsx_runtime112 = require("react/jsx-runtime");
|
|
33414
33455
|
var StatusBarOptionField = (props) => {
|
|
33415
33456
|
const { selection, defaultValue } = props;
|
|
33416
|
-
const memoizedStatusOptions = (0,
|
|
33457
|
+
const memoizedStatusOptions = (0, import_react70.useMemo)(() => selection, [selection]);
|
|
33417
33458
|
const indexInProgress = memoizedStatusOptions?.findIndex(
|
|
33418
33459
|
(option) => option?.[0] === defaultValue
|
|
33419
33460
|
);
|