@fctc/sme-widget-ui 2.9.5 → 2.9.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 +207 -226
- package/dist/index.mjs +268 -287
- package/dist/utils.js +4 -2
- package/dist/utils.mjs +4 -2
- package/dist/widgets.d.mts +9 -8
- package/dist/widgets.d.ts +9 -8
- package/dist/widgets.js +207 -247
- package/dist/widgets.mjs +268 -308
- package/package.json +1 -1
package/dist/widgets.js
CHANGED
|
@@ -7788,7 +7788,8 @@ var vi_default = {
|
|
|
7788
7788
|
"message-text-error": " kh\xF4ng \u0111\u01B0\u1EE3c v\u01B0\u1EE3t qu\xE1 {{max}} k\xFD t\u1EF1",
|
|
7789
7789
|
upcase: ", {{count}} ch\u1EEF in hoa",
|
|
7790
7790
|
digit: ", {{count}} s\u1ED1",
|
|
7791
|
-
special: ", {{count}} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t"
|
|
7791
|
+
special: ", {{count}} k\xFD t\u1EF1 \u0111\u1EB7c bi\u1EC7t",
|
|
7792
|
+
upload_files_accept: "Ch\u1EC9 ch\u1EA5p nh\u1EADn c\xE1c \u0111\u1ECBnh d\u1EA1ng JPEG, PNG, PDF, MP4, XLS, XLXS, ZIP"
|
|
7792
7793
|
};
|
|
7793
7794
|
|
|
7794
7795
|
// src/locales/en.json
|
|
@@ -7847,7 +7848,8 @@ var en_default = {
|
|
|
7847
7848
|
"message-text-error": " must not exceed {{max}} characters",
|
|
7848
7849
|
upcase: ", {{count}} uppercase letter",
|
|
7849
7850
|
digit: ", {{count}} digit",
|
|
7850
|
-
special: ", {{count}} special character"
|
|
7851
|
+
special: ", {{count}} special character",
|
|
7852
|
+
upload_files_accept: "Only JPEG, PNG, PDF, MP4, XLS, XLXS, ZIP, JSON formats are allowed"
|
|
7851
7853
|
};
|
|
7852
7854
|
|
|
7853
7855
|
// src/utils/i18n.ts
|
|
@@ -9527,27 +9529,6 @@ var PaidIcon = () => /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
|
|
|
9527
9529
|
|
|
9528
9530
|
// src/icons/placeholder-icon.tsx
|
|
9529
9531
|
var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
9530
|
-
var PlaceHolderIcon = () => {
|
|
9531
|
-
return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9532
|
-
"svg",
|
|
9533
|
-
{
|
|
9534
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
9535
|
-
version: "1.0",
|
|
9536
|
-
width: "256.000000pt",
|
|
9537
|
-
height: "256.000000pt",
|
|
9538
|
-
viewBox: "0 0 256.000000 256.000000",
|
|
9539
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
9540
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
9541
|
-
"g",
|
|
9542
|
-
{
|
|
9543
|
-
transform: "translate(0.000000,256.000000) scale(0.100000,-0.100000)",
|
|
9544
|
-
fill: "#000000",
|
|
9545
|
-
stroke: "none"
|
|
9546
|
-
}
|
|
9547
|
-
)
|
|
9548
|
-
}
|
|
9549
|
-
);
|
|
9550
|
-
};
|
|
9551
9532
|
|
|
9552
9533
|
// src/icons/google-icon.tsx
|
|
9553
9534
|
var import_jsx_runtime38 = require("react/jsx-runtime");
|
|
@@ -12116,7 +12097,7 @@ var TableHead = (props) => {
|
|
|
12116
12097
|
return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
|
|
12117
12098
|
"th",
|
|
12118
12099
|
{
|
|
12119
|
-
style: {
|
|
12100
|
+
style: { width: "100px" },
|
|
12120
12101
|
className: `column handle whitespace-nowrap text-left p-0 text-sm font-semibold capitalize text-[#060606]`
|
|
12121
12102
|
},
|
|
12122
12103
|
"table-head-" + index4
|
|
@@ -15913,7 +15894,7 @@ var ButtonSelectFiles = ({
|
|
|
15913
15894
|
isText
|
|
15914
15895
|
}) => {
|
|
15915
15896
|
const { t: t3 } = useI18n();
|
|
15916
|
-
const
|
|
15897
|
+
const ALLOWED_TYPES2 = [
|
|
15917
15898
|
"image/jpeg",
|
|
15918
15899
|
"image/png",
|
|
15919
15900
|
"application/pdf",
|
|
@@ -15930,7 +15911,7 @@ var ButtonSelectFiles = ({
|
|
|
15930
15911
|
const { mutate, isPending } = isBinary ? useUploadFile() : useUploadImage();
|
|
15931
15912
|
const dataUser = user?.userProfile?.data;
|
|
15932
15913
|
const validateFile = (file) => {
|
|
15933
|
-
if (!
|
|
15914
|
+
if (!ALLOWED_TYPES2.includes(file.type)) {
|
|
15934
15915
|
setUploadError(t3("file_accept_single"));
|
|
15935
15916
|
return false;
|
|
15936
15917
|
}
|
|
@@ -16145,123 +16126,115 @@ var AvatarField = (props) => {
|
|
|
16145
16126
|
// src/widgets/basic/binary-field/binary.tsx
|
|
16146
16127
|
var import_react39 = require("react");
|
|
16147
16128
|
var import_jsx_runtime75 = require("react/jsx-runtime");
|
|
16129
|
+
var ALLOWED_TYPES = [
|
|
16130
|
+
"image/jpeg",
|
|
16131
|
+
"image/png",
|
|
16132
|
+
"application/pdf",
|
|
16133
|
+
"video/mp4",
|
|
16134
|
+
"application/zip",
|
|
16135
|
+
"application/x-zip-compressed",
|
|
16136
|
+
"application/vnd.ms-excel",
|
|
16137
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
16138
|
+
"application/json"
|
|
16139
|
+
];
|
|
16148
16140
|
var BinaryField = (props) => {
|
|
16149
16141
|
const {
|
|
16142
|
+
value,
|
|
16150
16143
|
name,
|
|
16151
|
-
methods,
|
|
16152
|
-
readonly = false,
|
|
16153
|
-
placeholder,
|
|
16154
|
-
required = false,
|
|
16155
|
-
invisible = false,
|
|
16156
|
-
filename,
|
|
16157
|
-
formValues,
|
|
16158
16144
|
isEditTable,
|
|
16159
16145
|
widget,
|
|
16160
|
-
|
|
16161
|
-
value,
|
|
16162
|
-
// from hook
|
|
16146
|
+
readonly,
|
|
16163
16147
|
placeHolderImage,
|
|
16164
|
-
|
|
16165
|
-
|
|
16166
|
-
|
|
16167
|
-
|
|
16168
|
-
|
|
16169
|
-
|
|
16148
|
+
placeholder,
|
|
16149
|
+
required,
|
|
16150
|
+
invisible,
|
|
16151
|
+
methods,
|
|
16152
|
+
string,
|
|
16153
|
+
isForm,
|
|
16170
16154
|
onDownload,
|
|
16171
|
-
|
|
16155
|
+
onUploadFile,
|
|
16156
|
+
onDeleteFile,
|
|
16157
|
+
url,
|
|
16158
|
+
fileInfor
|
|
16172
16159
|
} = props;
|
|
16173
16160
|
const { t: t3 } = useI18n();
|
|
16174
|
-
const [
|
|
16161
|
+
const [loading, setLoading] = (0, import_react39.useState)(false);
|
|
16162
|
+
const hasFetchedMeta = (0, import_react39.useRef)(false);
|
|
16175
16163
|
const onlyImage = widget === "image" || widget === "image_url";
|
|
16176
|
-
|
|
16177
|
-
|
|
16178
|
-
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
|
|
16184
|
-
|
|
16185
|
-
}
|
|
16186
|
-
try {
|
|
16187
|
-
let type = "application/octet-stream";
|
|
16188
|
-
let size4 = 0;
|
|
16189
|
-
let name2 = formValues?.[filename ?? ""] || initialFile.split("/").pop() || "unknown_file";
|
|
16190
|
-
if (checkIsImageLink2(initialFile) || onlyImage) {
|
|
16191
|
-
type = "image/*";
|
|
16192
|
-
} else {
|
|
16193
|
-
const response = await fetch(initialFile);
|
|
16194
|
-
console.log("responsessss", response);
|
|
16195
|
-
const responseBlob = await response.blob();
|
|
16196
|
-
if (responseBlob) {
|
|
16197
|
-
type = responseBlob?.type;
|
|
16198
|
-
size4 = responseBlob.size;
|
|
16199
|
-
}
|
|
16200
|
-
}
|
|
16201
|
-
setFileInfo({
|
|
16202
|
-
name: name2,
|
|
16203
|
-
type,
|
|
16204
|
-
url: initialFile,
|
|
16205
|
-
size: size4,
|
|
16206
|
-
source: "link"
|
|
16207
|
-
});
|
|
16208
|
-
} catch (error2) {
|
|
16209
|
-
console.warn("Cannot load link info:", error2);
|
|
16210
|
-
}
|
|
16211
|
-
};
|
|
16212
|
-
loadFromLink();
|
|
16213
|
-
}, [initialFile]);
|
|
16214
|
-
const handleChange = (e3, onChange2) => {
|
|
16215
|
-
const file = e3.target.files?.[0];
|
|
16164
|
+
const acceptType = !onlyImage ? `.pdf,.json,.mp4,.zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel,.jpeg,.jpg,.png` : ".jpeg,.jpg,.png";
|
|
16165
|
+
const validateFile = (file) => {
|
|
16166
|
+
if (!ALLOWED_TYPES.includes(file.type)) {
|
|
16167
|
+
return t3("upload_files_accept");
|
|
16168
|
+
}
|
|
16169
|
+
return true;
|
|
16170
|
+
};
|
|
16171
|
+
const handleUpload = async (e3) => {
|
|
16172
|
+
const file = e3.target.files[0];
|
|
16216
16173
|
if (!file) return;
|
|
16217
16174
|
if (onlyImage && !file.type.startsWith("image/")) {
|
|
16218
|
-
methods?.setError(
|
|
16175
|
+
methods?.setError(name, {
|
|
16176
|
+
type: "manual",
|
|
16177
|
+
message: t3("only_image_accept")
|
|
16178
|
+
});
|
|
16219
16179
|
e3.target.value = "";
|
|
16220
16180
|
return;
|
|
16221
16181
|
}
|
|
16222
|
-
const
|
|
16223
|
-
|
|
16224
|
-
|
|
16225
|
-
|
|
16226
|
-
|
|
16227
|
-
|
|
16228
|
-
|
|
16229
|
-
|
|
16230
|
-
|
|
16231
|
-
|
|
16232
|
-
|
|
16233
|
-
|
|
16234
|
-
|
|
16182
|
+
const valid = validateFile(file);
|
|
16183
|
+
if (valid !== true) {
|
|
16184
|
+
methods?.setError(name, { type: "manual", message: valid });
|
|
16185
|
+
return;
|
|
16186
|
+
}
|
|
16187
|
+
methods?.clearErrors(name);
|
|
16188
|
+
const formData = new FormData();
|
|
16189
|
+
formData.append("file", file);
|
|
16190
|
+
setLoading(true);
|
|
16191
|
+
try {
|
|
16192
|
+
onUploadFile?.(formData);
|
|
16193
|
+
} catch (error2) {
|
|
16194
|
+
console.error(error2);
|
|
16195
|
+
}
|
|
16196
|
+
setLoading(false);
|
|
16235
16197
|
};
|
|
16236
|
-
const
|
|
16237
|
-
|
|
16238
|
-
|
|
16239
|
-
|
|
16240
|
-
|
|
16241
|
-
|
|
16242
|
-
|
|
16243
|
-
|
|
16244
|
-
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16198
|
+
const handleDelete = () => {
|
|
16199
|
+
onDeleteFile && onDeleteFile();
|
|
16200
|
+
hasFetchedMeta.current = false;
|
|
16201
|
+
};
|
|
16202
|
+
const renderPreview = () => {
|
|
16203
|
+
if (!url) return null;
|
|
16204
|
+
const type = fileInfor?.type;
|
|
16205
|
+
const date = fileInfor?.date;
|
|
16206
|
+
const size4 = fileInfor?.size;
|
|
16207
|
+
if (type?.includes("image")) {
|
|
16208
|
+
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
16209
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16210
|
+
"img",
|
|
16211
|
+
{
|
|
16212
|
+
src: url,
|
|
16213
|
+
alt: name,
|
|
16214
|
+
className: `image-value w-full h-full object-contain ${onlyImage ? "rounded-lg" : "rounded-[4px]"} ${isEditTable ? "max-h-10 max-w-10 h-10 w-10" : "max-w-32 max-h-32"}`,
|
|
16215
|
+
style: {
|
|
16216
|
+
maxWidth: isEditTable ? "40px" : "128px",
|
|
16217
|
+
maxHeight: isEditTable ? "40px" : "128px",
|
|
16218
|
+
height: isEditTable ? "40px" : "128px",
|
|
16219
|
+
width: isEditTable ? "40px" : "128px"
|
|
16220
|
+
}
|
|
16249
16221
|
}
|
|
16250
|
-
|
|
16251
|
-
|
|
16252
|
-
|
|
16253
|
-
|
|
16254
|
-
|
|
16255
|
-
|
|
16256
|
-
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16260
|
-
|
|
16261
|
-
|
|
16262
|
-
|
|
16263
|
-
}
|
|
16264
|
-
);
|
|
16222
|
+
),
|
|
16223
|
+
!onlyImage && /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { children: [
|
|
16224
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16225
|
+
"p",
|
|
16226
|
+
{
|
|
16227
|
+
style: {
|
|
16228
|
+
maxWidth: "120px"
|
|
16229
|
+
},
|
|
16230
|
+
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16231
|
+
children: url?.split("/").pop()
|
|
16232
|
+
}
|
|
16233
|
+
),
|
|
16234
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-xs text-[#666] font-semibold", children: size4 })
|
|
16235
|
+
] })
|
|
16236
|
+
] });
|
|
16237
|
+
}
|
|
16265
16238
|
const getFileIcon = () => {
|
|
16266
16239
|
if (type === "application/pdf") return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(PdfIcon, {});
|
|
16267
16240
|
if (type?.includes("excel") || type?.includes("spreadsheet"))
|
|
@@ -16270,7 +16243,6 @@ var BinaryField = (props) => {
|
|
|
16270
16243
|
if (type === "application/json") return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(JSONFileIcon, {});
|
|
16271
16244
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DefaultFileIcon, {});
|
|
16272
16245
|
};
|
|
16273
|
-
const isShowSize = !isNaN(size4);
|
|
16274
16246
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
16275
16247
|
getFileIcon(),
|
|
16276
16248
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)("div", { children: [
|
|
@@ -16281,10 +16253,10 @@ var BinaryField = (props) => {
|
|
|
16281
16253
|
maxWidth: "120px"
|
|
16282
16254
|
},
|
|
16283
16255
|
className: "text-sm font-medium text-gray-600 truncate max-w-[120px]",
|
|
16284
|
-
children:
|
|
16256
|
+
children: url?.split("/").pop()
|
|
16285
16257
|
}
|
|
16286
16258
|
),
|
|
16287
|
-
|
|
16259
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { className: "text-xs text-[#666] font-semibold", children: size4 })
|
|
16288
16260
|
] })
|
|
16289
16261
|
] });
|
|
16290
16262
|
};
|
|
@@ -16294,136 +16266,124 @@ var BinaryField = (props) => {
|
|
|
16294
16266
|
name: name ?? "",
|
|
16295
16267
|
control: methods?.control,
|
|
16296
16268
|
rules: {
|
|
16297
|
-
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false
|
|
16269
|
+
required: required && !invisible ? { value: true, message: `${string} ${t3("must_required")}` } : false,
|
|
16270
|
+
validate: {
|
|
16271
|
+
fileValidate: (value2) => {
|
|
16272
|
+
if (!value2) return true;
|
|
16273
|
+
return validateFile(value2);
|
|
16274
|
+
}
|
|
16275
|
+
}
|
|
16298
16276
|
},
|
|
16299
|
-
render: ({
|
|
16300
|
-
|
|
16277
|
+
render: ({ fieldState: { error: error2 } }) => {
|
|
16278
|
+
console.log("error", error2);
|
|
16301
16279
|
return /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(import_jsx_runtime75.Fragment, { children: [
|
|
16302
16280
|
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16303
16281
|
"div",
|
|
16304
16282
|
{
|
|
16305
|
-
|
|
16306
|
-
|
|
16307
|
-
children: hasFile ? /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16283
|
+
className: `widget binary-field flex w-fit items-center gap-4 ${onlyImage ? "shadow-md rounded-[12px]" : ""} ${isEditTable ? "p-2" : ""}`,
|
|
16284
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("div", { className: "relative group", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
16308
16285
|
"div",
|
|
16309
16286
|
{
|
|
16310
|
-
className: `relative
|
|
16311
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
16312
|
-
"div",
|
|
16313
|
-
{
|
|
16314
|
-
className: `flex gap-2 items-center bg-[#FAFAFA] rounded-[8px] p-[6px] ${onlyImage ? "h-32 w-32" : "max-h-fit max-w-fit"}`,
|
|
16315
|
-
children: [
|
|
16316
|
-
renderPreview(fileInfo),
|
|
16317
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
16318
|
-
"div",
|
|
16319
|
-
{
|
|
16320
|
-
style: {
|
|
16321
|
-
display: "flex",
|
|
16322
|
-
alignItems: "center",
|
|
16323
|
-
borderRadius: "8px",
|
|
16324
|
-
padding: "4px",
|
|
16325
|
-
gap: "8px",
|
|
16326
|
-
backgroundColor: onlyImage ? "rgba(0,0,0,0.03)" : "white",
|
|
16327
|
-
boxShadow: "0 2px 4px 0 rgba(27, 28, 29, 0.04)",
|
|
16328
|
-
position: onlyImage ? "absolute" : "relative",
|
|
16329
|
-
bottom: onlyImage ? "0" : "none",
|
|
16330
|
-
right: onlyImage ? "0" : "none"
|
|
16331
|
-
},
|
|
16332
|
-
children: [
|
|
16333
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16334
|
-
"span",
|
|
16335
|
-
{
|
|
16336
|
-
className: "cursor-pointer",
|
|
16337
|
-
onClick: () => onDownload && onDownload(
|
|
16338
|
-
fileInfo?.url || fileInfo?.data,
|
|
16339
|
-
fileInfo?.name || fileInfo?.display_name
|
|
16340
|
-
),
|
|
16341
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DownloadIcon, {})
|
|
16342
|
-
}
|
|
16343
|
-
),
|
|
16344
|
-
!readonly && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16345
|
-
"span",
|
|
16346
|
-
{
|
|
16347
|
-
className: "cursor-pointer",
|
|
16348
|
-
onClick: () => {
|
|
16349
|
-
setFileInfo(null);
|
|
16350
|
-
handleRemoveFile(field.onChange);
|
|
16351
|
-
},
|
|
16352
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DeleteIconDanger, {})
|
|
16353
|
-
}
|
|
16354
|
-
)
|
|
16355
|
-
]
|
|
16356
|
-
}
|
|
16357
|
-
)
|
|
16358
|
-
]
|
|
16359
|
-
}
|
|
16360
|
-
)
|
|
16361
|
-
}
|
|
16362
|
-
) : /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
16363
|
-
"label",
|
|
16364
|
-
{
|
|
16365
|
-
htmlFor: inputId,
|
|
16366
|
-
className: `relative p-2 flex cursor-pointer items-center justify-center rounded-[12px] transition-colors duration-300 ${readonly && "pointer-events-none"} ${onlyImage ? "h-32 w-32 border border-gray-300 hover:border-primary bg-white" : "w-fit h-fit "}`,
|
|
16287
|
+
className: `flex items-center gap-2 bg-[#FAFAFA] relative ${onlyImage ? `h-32 w-32 rounded-[12px] ${value ? "" : "p-2"}` : `max-h-fit max-w-fit rounded-[8px] border ${!value ? "hover:border-[var(--color-primary)]" : ""} ${isEditTable && value ? "p-2" : ""}`} ${error2 && isForm && isEditTable && "widget-error"} `,
|
|
16367
16288
|
children: [
|
|
16368
|
-
|
|
16369
|
-
|
|
16370
|
-
{
|
|
16371
|
-
id: inputId,
|
|
16372
|
-
type: "file",
|
|
16373
|
-
readOnly: readonly,
|
|
16374
|
-
placeholder,
|
|
16375
|
-
required: !invisible && required,
|
|
16376
|
-
onChange: (e3) => handleChange(e3, field.onChange),
|
|
16377
|
-
className: "hidden",
|
|
16378
|
-
accept: ".jpeg,.jpg,.png,.pdf,.json,.mp4,.zip,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
|
|
16379
|
-
}
|
|
16380
|
-
),
|
|
16381
|
-
onlyImage && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16382
|
-
"img",
|
|
16383
|
-
{
|
|
16384
|
-
src: placeHolderImage,
|
|
16385
|
-
alt: "",
|
|
16386
|
-
className: "z-0 relative"
|
|
16387
|
-
}
|
|
16388
|
-
),
|
|
16389
|
-
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16289
|
+
renderPreview(),
|
|
16290
|
+
value ? /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
16390
16291
|
"div",
|
|
16391
16292
|
{
|
|
16392
|
-
className: "
|
|
16293
|
+
className: "widget",
|
|
16393
16294
|
style: {
|
|
16295
|
+
display: "flex",
|
|
16296
|
+
alignItems: "center",
|
|
16297
|
+
borderRadius: "8px",
|
|
16298
|
+
padding: "4px",
|
|
16299
|
+
gap: "8px",
|
|
16300
|
+
backgroundColor: onlyImage ? "rgba(0,0,0,0.03)" : "white",
|
|
16301
|
+
boxShadow: "0 2px 4px 0 rgba(27, 28, 29, 0.04)",
|
|
16394
16302
|
position: onlyImage ? "absolute" : "relative",
|
|
16395
|
-
bottom: onlyImage ? "
|
|
16396
|
-
|
|
16397
|
-
boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
|
|
16398
|
-
width: "2rem",
|
|
16399
|
-
height: "2rem",
|
|
16400
|
-
border: onlyImage ? "1px solid transparent" : "1px solid var(--color-primary)",
|
|
16401
|
-
borderRadius: onlyImage ? "100%" : "8px"
|
|
16303
|
+
bottom: onlyImage ? "0" : "none",
|
|
16304
|
+
right: onlyImage ? "0" : "none"
|
|
16402
16305
|
},
|
|
16403
|
-
children:
|
|
16404
|
-
|
|
16405
|
-
|
|
16406
|
-
|
|
16407
|
-
|
|
16408
|
-
|
|
16409
|
-
|
|
16410
|
-
|
|
16411
|
-
|
|
16412
|
-
|
|
16413
|
-
|
|
16414
|
-
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16306
|
+
children: [
|
|
16307
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16308
|
+
"span",
|
|
16309
|
+
{
|
|
16310
|
+
onClick: () => onDownload && onDownload(url || "", url?.split("/").pop()),
|
|
16311
|
+
className: "cursor-pointer",
|
|
16312
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DownloadIcon, {})
|
|
16313
|
+
}
|
|
16314
|
+
),
|
|
16315
|
+
!readonly && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("span", { onClick: handleDelete, className: "cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(DeleteIconDanger, {}) })
|
|
16316
|
+
]
|
|
16317
|
+
}
|
|
16318
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime75.jsxs)(
|
|
16319
|
+
"label",
|
|
16320
|
+
{
|
|
16321
|
+
style: {
|
|
16322
|
+
maxWidth: "180px",
|
|
16323
|
+
maxHeight: "180px"
|
|
16324
|
+
},
|
|
16325
|
+
className: `relative flex cursor-pointer items-center justify-center rounded-[12px] transition-colors duration-300 ${readonly && "pointer-events-none"} ${onlyImage ? "border border-gray-300 hover:border-primary bg-white" : "w-fit h-fit "}`,
|
|
16326
|
+
children: [
|
|
16327
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16328
|
+
"input",
|
|
16329
|
+
{
|
|
16330
|
+
type: "file",
|
|
16331
|
+
readOnly: readonly,
|
|
16332
|
+
placeholder,
|
|
16333
|
+
required: !invisible && required,
|
|
16334
|
+
onChange: handleUpload,
|
|
16335
|
+
className: "hidden",
|
|
16336
|
+
accept: acceptType
|
|
16337
|
+
}
|
|
16338
|
+
),
|
|
16339
|
+
onlyImage && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16340
|
+
"img",
|
|
16341
|
+
{
|
|
16342
|
+
src: placeHolderImage,
|
|
16343
|
+
alt: "",
|
|
16344
|
+
className: "z-0 relative"
|
|
16345
|
+
}
|
|
16346
|
+
),
|
|
16347
|
+
/* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16348
|
+
"div",
|
|
16349
|
+
{
|
|
16350
|
+
className: " size-8 bg-white rounded-lg flex justify-center items-center z-20",
|
|
16351
|
+
style: {
|
|
16352
|
+
position: onlyImage ? "absolute" : "relative",
|
|
16353
|
+
bottom: onlyImage ? "-8px" : "auto",
|
|
16354
|
+
left: onlyImage ? "-8px" : "auto",
|
|
16355
|
+
boxShadow: "0 1px 2px 0 rgba(228, 229, 231, 0.24)",
|
|
16356
|
+
width: "2rem",
|
|
16357
|
+
height: "2rem",
|
|
16358
|
+
borderRadius: onlyImage ? "100%" : "8px"
|
|
16359
|
+
},
|
|
16360
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16361
|
+
"svg",
|
|
16362
|
+
{
|
|
16363
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
16364
|
+
width: "14",
|
|
16365
|
+
height: "14",
|
|
16366
|
+
viewBox: "0 0 14 14",
|
|
16367
|
+
fill: "none",
|
|
16368
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime75.jsx)(
|
|
16369
|
+
"path",
|
|
16370
|
+
{
|
|
16371
|
+
"fill-rule": "evenodd",
|
|
16372
|
+
"clip-rule": "evenodd",
|
|
16373
|
+
d: "M13.1868 0.813097C12.7961 0.422532 12.2663 0.203125 11.7139 0.203125C11.1615 0.203125 10.6317 0.422532 10.241 0.813097L9.35765 1.69726L12.3035 4.64393L12.0085 4.9381L11.7143 5.2331L8.76765 2.28643L1.40182 9.65226C1.34395 9.7104 1.30452 9.78432 1.28848 9.86476L0.698483 12.8114C0.685057 12.8787 0.688459 12.9483 0.708387 13.014C0.728316 13.0796 0.764154 13.1394 0.812719 13.1878C0.861283 13.2363 0.92107 13.2721 0.986769 13.2919C1.05247 13.3117 1.12204 13.315 1.18932 13.3014L4.13515 12.7123C4.21599 12.6961 4.29023 12.6564 4.34848 12.5981L13.1868 3.75976C13.3803 3.5663 13.5338 3.33661 13.6386 3.08381C13.7433 2.83102 13.7972 2.56006 13.7972 2.28643C13.7972 2.0128 13.7433 1.74184 13.6386 1.48905C13.5338 1.23625 13.3803 1.00656 13.1868 0.813097Z",
|
|
16374
|
+
fill: "black"
|
|
16375
|
+
}
|
|
16376
|
+
)
|
|
16377
|
+
}
|
|
16378
|
+
)
|
|
16379
|
+
}
|
|
16380
|
+
)
|
|
16381
|
+
]
|
|
16422
16382
|
}
|
|
16423
16383
|
)
|
|
16424
16384
|
]
|
|
16425
16385
|
}
|
|
16426
|
-
)
|
|
16386
|
+
) })
|
|
16427
16387
|
}
|
|
16428
16388
|
),
|
|
16429
16389
|
error2 && !isEditTable && /* @__PURE__ */ (0, import_jsx_runtime75.jsx)("p", { className: "text-[#de4747] text-sm mt-1", children: error2.message })
|
|
@@ -31895,7 +31855,7 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
|
31895
31855
|
(childItem) => childItem?.is_display && childItem?.action?.res_model === relation
|
|
31896
31856
|
)
|
|
31897
31857
|
)?.[0]?.action?.id;
|
|
31898
|
-
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center gap-2 relative
|
|
31858
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "flex items-center gap-2 mr-2 relative border-[1px] border-solid border-[rgba(66,66,66,0.12)] py-1 px-2 rounded", children: [
|
|
31899
31859
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
31900
31860
|
AvatarField,
|
|
31901
31861
|
{
|
|
@@ -31910,9 +31870,10 @@ var CustomMultiValue = ({ stringToColor, ...props }) => {
|
|
|
31910
31870
|
),
|
|
31911
31871
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)("span", { className: "capitalize", children: data?.label ?? data?.display_name }),
|
|
31912
31872
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
31913
|
-
"
|
|
31873
|
+
"button",
|
|
31914
31874
|
{
|
|
31915
|
-
|
|
31875
|
+
type: "button",
|
|
31876
|
+
className: "ml-1 flex items-center justify-center rounded-full !cursor-pointer",
|
|
31916
31877
|
onClick: (e3) => {
|
|
31917
31878
|
e3.stopPropagation();
|
|
31918
31879
|
props.removeProps.onClick();
|
|
@@ -31945,7 +31906,6 @@ var CustomMenuList = (props) => {
|
|
|
31945
31906
|
};
|
|
31946
31907
|
var Many2ManyTagField = (props) => {
|
|
31947
31908
|
const {
|
|
31948
|
-
relation,
|
|
31949
31909
|
value,
|
|
31950
31910
|
name,
|
|
31951
31911
|
methods,
|
|
@@ -32058,7 +32018,7 @@ var Many2ManyTagField = (props) => {
|
|
|
32058
32018
|
dropdownIndicator: () => "invisible group-hover:visible !m-0 !p-0",
|
|
32059
32019
|
clearIndicator: () => "invisible group-hover:visible !m-0 !p-0"
|
|
32060
32020
|
} : {
|
|
32061
|
-
valueContainer: () => "overflow-unset !m-0 !p-0",
|
|
32021
|
+
valueContainer: () => "overflow-unset !m-0 !p-0 flex gap-1",
|
|
32062
32022
|
control: ({ isFocused }) => `widget many2many-tags-widget ${baseClassName} ${isFocused ? "focused" : ""} ${filteredValue?.length === 0 && "no-values"}`,
|
|
32063
32023
|
singleValue: () => `!m-0 ${readonly ? "!text-[#5c5a5a]" : ""}`,
|
|
32064
32024
|
input: () => "!m-0 !p-0",
|