@fctc/sme-widget-ui 1.0.1 → 1.0.3
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 +70 -36
- package/dist/index.mjs +103 -69
- package/dist/widgets.d.mts +8 -4
- package/dist/widgets.d.ts +8 -4
- package/dist/widgets.js +70 -36
- package/dist/widgets.mjs +105 -71
- package/package.json +1 -1
package/dist/widgets.js
CHANGED
|
@@ -12157,7 +12157,10 @@ var TableFilter = ({ columns, onToggleColumnOptional }) => {
|
|
|
12157
12157
|
"div",
|
|
12158
12158
|
{
|
|
12159
12159
|
ref: filterRef,
|
|
12160
|
-
|
|
12160
|
+
style: {
|
|
12161
|
+
transform: "translateY(-50%)"
|
|
12162
|
+
},
|
|
12163
|
+
className: "w-fit absolute top-[50%] translate-y-[-50%] right-[10px] ms-auto z-[32] bg-[#eff1f2]",
|
|
12161
12164
|
children: [
|
|
12162
12165
|
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
|
|
12163
12166
|
"button",
|
|
@@ -12363,7 +12366,11 @@ var TableHead = (props) => {
|
|
|
12363
12366
|
columns && Array.isArray(columns) && columns?.some((column2) => column2?.optional) && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12364
12367
|
"th",
|
|
12365
12368
|
{
|
|
12366
|
-
|
|
12369
|
+
style: {
|
|
12370
|
+
minWidth: "40px",
|
|
12371
|
+
right: 0
|
|
12372
|
+
},
|
|
12373
|
+
className: `column whitespace-nowrap text-left p-3 text-sm font-medium capitalize text-[#121212] min-w-[40px] sticky right-[0px] bg-[#eff1f2]`,
|
|
12367
12374
|
children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
|
|
12368
12375
|
TableFilter,
|
|
12369
12376
|
{
|
|
@@ -14520,10 +14527,8 @@ var PopupFilter = ({
|
|
|
14520
14527
|
return;
|
|
14521
14528
|
}
|
|
14522
14529
|
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14523
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FilterIcon, {}),
|
|
14524
14530
|
name: item?.name,
|
|
14525
14531
|
value: item?.string ?? item?.help,
|
|
14526
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(FilterIcon, {}),
|
|
14527
14532
|
domain: item?.domain,
|
|
14528
14533
|
groupIndex: item?.group_index,
|
|
14529
14534
|
type: SearchType.FILTER
|
|
@@ -14562,10 +14567,8 @@ var PopupFilter = ({
|
|
|
14562
14567
|
return;
|
|
14563
14568
|
}
|
|
14564
14569
|
typeof handleAddTagSearch === "function" && handleAddTagSearch({
|
|
14565
|
-
title: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(GroupByIcon, {}),
|
|
14566
14570
|
name: item?.name,
|
|
14567
14571
|
value: item?.string,
|
|
14568
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(GroupByIcon, {}),
|
|
14569
14572
|
type: SearchType.GROUP,
|
|
14570
14573
|
context: JSON.parse(item?.context.replace(/'/g, '"')),
|
|
14571
14574
|
active: !isExist,
|
|
@@ -14608,7 +14611,7 @@ var TagSearch = ({
|
|
|
14608
14611
|
{
|
|
14609
14612
|
className: "flex min-h-full overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14610
14613
|
children: [
|
|
14611
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.title }),
|
|
14614
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: tag?.type === SearchType.SEARCH ? tag?.title : /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(FilterIcon, {}) }),
|
|
14612
14615
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "pl-2 align-middle text-[#495057] text-[14px]", children: tag.values.map((value, idx) => {
|
|
14613
14616
|
return /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_react17.Fragment, { children: [
|
|
14614
14617
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: value }),
|
|
@@ -14654,7 +14657,7 @@ var TagSearch = ({
|
|
|
14654
14657
|
{
|
|
14655
14658
|
className: "flex gap-2 overflow-hidden rounded bg-[#E9ECEF] hover:shadow-xl",
|
|
14656
14659
|
children: [
|
|
14657
|
-
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children:
|
|
14660
|
+
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("div", { className: "bg-primary flex items-center justify-center px-2 text-sm font-semibold leading-[1.5] text-white", children: /* @__PURE__ */ (0, import_jsx_runtime55.jsx)(GroupByIcon, {}) }),
|
|
14658
14661
|
value?.strings?.map((string, idx) => /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)(import_jsx_runtime55.Fragment, { children: [
|
|
14659
14662
|
/* @__PURE__ */ (0, import_jsx_runtime55.jsx)("span", { children: string }),
|
|
14660
14663
|
idx < value?.strings.length - 1 && /* @__PURE__ */ (0, import_jsx_runtime55.jsxs)("span", { className: "text-sm italic text-[#495057] text-opacity-50", children: [
|
|
@@ -14767,7 +14770,8 @@ var Search = ({
|
|
|
14767
14770
|
aid,
|
|
14768
14771
|
selectedRowKeys,
|
|
14769
14772
|
domainSearch,
|
|
14770
|
-
evalJSONContext
|
|
14773
|
+
evalJSONContext,
|
|
14774
|
+
clearSearch
|
|
14771
14775
|
}) => {
|
|
14772
14776
|
const [showPopupFilter, setShowPopupFilter] = (0, import_react18.useState)(false);
|
|
14773
14777
|
const popupFilterRef = useClickOutside({
|
|
@@ -14787,6 +14791,13 @@ var Search = ({
|
|
|
14787
14791
|
}
|
|
14788
14792
|
}
|
|
14789
14793
|
}, [selectedTags, isReadyFormatDomain]);
|
|
14794
|
+
(0, import_react18.useEffect)(() => {
|
|
14795
|
+
return () => {
|
|
14796
|
+
clearSearch();
|
|
14797
|
+
setDidInit(false);
|
|
14798
|
+
setIsReadyFormatDomain(false);
|
|
14799
|
+
};
|
|
14800
|
+
}, [viewData]);
|
|
14790
14801
|
(0, import_react18.useEffect)(() => {
|
|
14791
14802
|
if (didInit || selectedTags?.length > 0) return;
|
|
14792
14803
|
const searchDefaults = Object.entries(context || {}).filter(
|
|
@@ -17358,13 +17369,14 @@ var ButtonSelectFiles = ({
|
|
|
17358
17369
|
const MAX_TOTAL_SIZE = 50 * 1024 * 1024;
|
|
17359
17370
|
const { mutate: onUploadImage, isPending } = useUploadImage();
|
|
17360
17371
|
const { mutate: onUploadFile } = useUploadFile();
|
|
17361
|
-
const handleUploadImage = async ({
|
|
17372
|
+
const handleUploadImage = async ({ formData }) => {
|
|
17373
|
+
console.log("data", formData);
|
|
17362
17374
|
if (widget !== "many2many_binary") {
|
|
17363
17375
|
onUploadImage(
|
|
17364
|
-
{
|
|
17376
|
+
{ formData },
|
|
17365
17377
|
{
|
|
17366
|
-
onSuccess: (
|
|
17367
|
-
const formatData =
|
|
17378
|
+
onSuccess: (data) => {
|
|
17379
|
+
const formatData = data?.data?.["ir.attachment"]?.[0];
|
|
17368
17380
|
const files = [...selectedFiles, formatData];
|
|
17369
17381
|
setSelectedFiles(files);
|
|
17370
17382
|
y2.success(instance.t("upload_success"));
|
|
@@ -17376,10 +17388,10 @@ var ButtonSelectFiles = ({
|
|
|
17376
17388
|
);
|
|
17377
17389
|
} else {
|
|
17378
17390
|
onUploadFile(
|
|
17379
|
-
{
|
|
17391
|
+
{ formData },
|
|
17380
17392
|
{
|
|
17381
|
-
onSuccess: (
|
|
17382
|
-
const formatData =
|
|
17393
|
+
onSuccess: (data) => {
|
|
17394
|
+
const formatData = data?.data?.["ir.attachment"]?.[0];
|
|
17383
17395
|
const files = [...selectedFiles, formatData];
|
|
17384
17396
|
setSelectedFiles(files);
|
|
17385
17397
|
y2.success(i18n_default.t("upload_success"));
|
|
@@ -17422,10 +17434,10 @@ var ButtonSelectFiles = ({
|
|
|
17422
17434
|
setUploadError(false);
|
|
17423
17435
|
const formData = new FormData();
|
|
17424
17436
|
formData.append("ufile", file);
|
|
17425
|
-
formData.append("thread_model", model);
|
|
17437
|
+
formData.append("thread_model", String(model));
|
|
17426
17438
|
formData.append("thread_id", Number(id));
|
|
17427
17439
|
formData.append("is_pending", true);
|
|
17428
|
-
await handleUploadImage({
|
|
17440
|
+
await handleUploadImage({ formData });
|
|
17429
17441
|
}
|
|
17430
17442
|
};
|
|
17431
17443
|
return /* @__PURE__ */ (0, import_jsx_runtime66.jsxs)(import_jsx_runtime66.Fragment, { children: [
|
|
@@ -32659,9 +32671,6 @@ var import_react58 = require("react");
|
|
|
32659
32671
|
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
32660
32672
|
var InfomationField = (props) => {
|
|
32661
32673
|
const { value, isForm = false, showName = true, stringToColor } = props;
|
|
32662
|
-
if (isForm) {
|
|
32663
|
-
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { children: "abc" });
|
|
32664
|
-
}
|
|
32665
32674
|
if (!value || Array.isArray(value) && value.length === 0) {
|
|
32666
32675
|
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(import_jsx_runtime87.Fragment, {});
|
|
32667
32676
|
}
|
|
@@ -32692,7 +32701,7 @@ var InfomationField = (props) => {
|
|
|
32692
32701
|
|
|
32693
32702
|
// src/widgets/basic/many2many-tags-field/many2many-tags.tsx
|
|
32694
32703
|
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
32695
|
-
var CustomMultiValue = (props) => {
|
|
32704
|
+
var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
32696
32705
|
const { selectProps, data, menuList } = props;
|
|
32697
32706
|
const { relation } = selectProps;
|
|
32698
32707
|
const actionId = menuList?.flatMap(
|
|
@@ -32709,7 +32718,8 @@ var CustomMultiValue = (props) => {
|
|
|
32709
32718
|
relation,
|
|
32710
32719
|
isForm: false,
|
|
32711
32720
|
aid: actionId?.id,
|
|
32712
|
-
avatarSrc: data?.image_256
|
|
32721
|
+
avatarSrc: data?.image_256,
|
|
32722
|
+
stringToColor
|
|
32713
32723
|
}
|
|
32714
32724
|
),
|
|
32715
32725
|
/* @__PURE__ */ (0, import_jsx_runtime88.jsx)("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
|
|
@@ -32754,7 +32764,14 @@ var Many2ManyTagField = (props) => {
|
|
|
32754
32764
|
value: item.id,
|
|
32755
32765
|
label: item.name ?? item.display_name
|
|
32756
32766
|
})) : [];
|
|
32757
|
-
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
32767
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
32768
|
+
InfomationField,
|
|
32769
|
+
{
|
|
32770
|
+
value: optionValue || null,
|
|
32771
|
+
isForm,
|
|
32772
|
+
stringToColor
|
|
32773
|
+
}
|
|
32774
|
+
);
|
|
32758
32775
|
}
|
|
32759
32776
|
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
32760
32777
|
Controller,
|
|
@@ -32839,7 +32856,13 @@ var Many2ManyTagField = (props) => {
|
|
|
32839
32856
|
})
|
|
32840
32857
|
},
|
|
32841
32858
|
components: isUser ? {
|
|
32842
|
-
MultiValue:
|
|
32859
|
+
MultiValue: (multiValueProps) => /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(
|
|
32860
|
+
CustomMultiValue,
|
|
32861
|
+
{
|
|
32862
|
+
...multiValueProps,
|
|
32863
|
+
stringToColor
|
|
32864
|
+
}
|
|
32865
|
+
),
|
|
32843
32866
|
IndicatorSeparator: () => null
|
|
32844
32867
|
} : {
|
|
32845
32868
|
IndicatorSeparator: () => null
|
|
@@ -33570,14 +33593,12 @@ var Many2ManyField = (props) => {
|
|
|
33570
33593
|
page,
|
|
33571
33594
|
rows,
|
|
33572
33595
|
columns,
|
|
33573
|
-
typeTable,
|
|
33574
33596
|
renderField,
|
|
33575
33597
|
isDataLoading,
|
|
33576
33598
|
relation,
|
|
33577
33599
|
onToggleColumnOptional,
|
|
33578
33600
|
isDataFetched,
|
|
33579
33601
|
isPlaceholderData,
|
|
33580
|
-
isCheckBox,
|
|
33581
33602
|
optionsObject,
|
|
33582
33603
|
onChoose,
|
|
33583
33604
|
onAddNew,
|
|
@@ -33591,7 +33612,13 @@ var Many2ManyField = (props) => {
|
|
|
33591
33612
|
evalJSONContext,
|
|
33592
33613
|
searchController,
|
|
33593
33614
|
viewData,
|
|
33594
|
-
setDomain
|
|
33615
|
+
setDomain,
|
|
33616
|
+
isDisplayCheckbox,
|
|
33617
|
+
checkedAll,
|
|
33618
|
+
handleCheckBoxAll,
|
|
33619
|
+
selectedRowKeysRef,
|
|
33620
|
+
typeTable,
|
|
33621
|
+
setSelectedRowKeys
|
|
33595
33622
|
} = props;
|
|
33596
33623
|
const {
|
|
33597
33624
|
context,
|
|
@@ -33605,7 +33632,8 @@ var Many2ManyField = (props) => {
|
|
|
33605
33632
|
searchString,
|
|
33606
33633
|
selectedTags,
|
|
33607
33634
|
setFilterBy,
|
|
33608
|
-
setGroupBy
|
|
33635
|
+
setGroupBy,
|
|
33636
|
+
clearSearch
|
|
33609
33637
|
} = searchController;
|
|
33610
33638
|
return (0, import_react_dom8.createPortal)(
|
|
33611
33639
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[9999]", children: [
|
|
@@ -33630,8 +33658,6 @@ var Many2ManyField = (props) => {
|
|
|
33630
33658
|
groupBy,
|
|
33631
33659
|
showFiltersGroups: true,
|
|
33632
33660
|
setGroupBy,
|
|
33633
|
-
setSelectedRowKeys: (keys) => {
|
|
33634
|
-
},
|
|
33635
33661
|
setDomainList: setDomain,
|
|
33636
33662
|
setPage: (pages) => {
|
|
33637
33663
|
setPage?.(pages);
|
|
@@ -33641,12 +33667,14 @@ var Many2ManyField = (props) => {
|
|
|
33641
33667
|
(col) => col?.field?.type_co === "field" && col?.optional !== "hide"
|
|
33642
33668
|
)?.map((col) => ({ ...col.field })) ?? []
|
|
33643
33669
|
],
|
|
33670
|
+
setSelectedRowKeys,
|
|
33644
33671
|
viewData,
|
|
33645
33672
|
context,
|
|
33646
33673
|
selectedRowKeys,
|
|
33647
33674
|
aid,
|
|
33648
33675
|
domainSearch,
|
|
33649
|
-
evalJSONContext
|
|
33676
|
+
evalJSONContext,
|
|
33677
|
+
clearSearch
|
|
33650
33678
|
}
|
|
33651
33679
|
) }),
|
|
33652
33680
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -33684,7 +33712,9 @@ var Many2ManyField = (props) => {
|
|
|
33684
33712
|
{
|
|
33685
33713
|
columns,
|
|
33686
33714
|
onToggleColumnOptional,
|
|
33687
|
-
isDisplayCheckbox
|
|
33715
|
+
isDisplayCheckbox,
|
|
33716
|
+
checkedAll,
|
|
33717
|
+
handleCheckBoxAll
|
|
33688
33718
|
}
|
|
33689
33719
|
),
|
|
33690
33720
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
@@ -33693,7 +33723,7 @@ var Many2ManyField = (props) => {
|
|
|
33693
33723
|
columns,
|
|
33694
33724
|
rows,
|
|
33695
33725
|
rootField,
|
|
33696
|
-
isDisplayCheckbox
|
|
33726
|
+
isDisplayCheckbox,
|
|
33697
33727
|
model: relation,
|
|
33698
33728
|
renderField: ({
|
|
33699
33729
|
row,
|
|
@@ -33714,7 +33744,11 @@ var Many2ManyField = (props) => {
|
|
|
33714
33744
|
},
|
|
33715
33745
|
onRemoveRow: null,
|
|
33716
33746
|
onAddRow,
|
|
33717
|
-
onClickRow
|
|
33747
|
+
onClickRow,
|
|
33748
|
+
typeTable,
|
|
33749
|
+
selectedRowKeysRef,
|
|
33750
|
+
selectedRowKeys,
|
|
33751
|
+
setSelectedRowKeys
|
|
33718
33752
|
}
|
|
33719
33753
|
)
|
|
33720
33754
|
]
|
|
@@ -33725,7 +33759,7 @@ var Many2ManyField = (props) => {
|
|
|
33725
33759
|
}
|
|
33726
33760
|
) }) }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(LayerLoading, {}),
|
|
33727
33761
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "flex items-center gap-2 mt-auto", children: [
|
|
33728
|
-
|
|
33762
|
+
isDisplayCheckbox && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
33729
33763
|
"button",
|
|
33730
33764
|
{
|
|
33731
33765
|
disabled: selectedRowKeys?.length === 0,
|