@apia/components 4.0.41 → 4.0.42
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.d.ts +20 -12
- package/dist/index.js +542 -539
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.js
CHANGED
|
@@ -4,10 +4,10 @@ import React__default, { createContext, useContext, useEffect, useMemo, useState
|
|
|
4
4
|
import parse, { domToReact, Element } from 'html-react-parser';
|
|
5
5
|
import { Spinner as Spinner$1, Box as Box$1 } from 'theme-ui';
|
|
6
6
|
import { uniqueId as uniqueId$3, cloneDeep, isFunction } from 'lodash-es';
|
|
7
|
-
import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles,
|
|
7
|
+
import { Box, getVariant, useBreakpointIndex, Close, responsive, spacing, Heading, Link, Button, Spinner, createElement, Select, Input, Flex, IconButton as IconButton$1, Image, injectStyles, Paragraph, Label as Label$1, Container, Progress, Form, focusOutline, makeStyledComponent, useThemeUI, Grid, Textarea } from '@apia/theme';
|
|
8
8
|
import { BarLoader } from 'react-spinners';
|
|
9
9
|
import uniqueId$2 from 'lodash-es/uniqueId';
|
|
10
|
-
import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, getLabel, isChild, EventEmitter, useUnmount, useMount, StatefulEmitter, shallowEqual as shallowEqual$1, getSpecificParent, getDateFormat, customEvents, uniqueId as uniqueId$4,
|
|
10
|
+
import { findScrollContainer, useUpdateEffect, focus, focusSelector, getFocusSelector, addBoundary, useCombinedRefs, usePrevious, getLabel, isChild, EventEmitter, useUnmount, useMount, StatefulEmitter, shallowEqual as shallowEqual$1, getSpecificParent, getDateFormat, customEvents, decodeBase64ToUtf8, uniqueId as uniqueId$4, AudioRecorder, persistentStorage, disableChildrenFocus, enableChildrenFocus, decodeHTMLEntities, useDebouncedCallback, getIndex, noNaN, useLatest, useSubscription, useMatchScrollDirection, arrayOrArray } from '@apia/util';
|
|
11
11
|
import usePortal from 'react-cool-portal';
|
|
12
12
|
import { CSSTransition } from 'react-transition-group';
|
|
13
13
|
import { uniqueId as uniqueId$1, defaultNotifier, NotificationsList } from '@apia/notifications';
|
|
@@ -5230,485 +5230,79 @@ const LabelBox = ({
|
|
|
5230
5230
|
);
|
|
5231
5231
|
};
|
|
5232
5232
|
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
}
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5256
|
-
if (messageType === "response")
|
|
5257
|
-
this.messageType = "system";
|
|
5258
|
-
if (typeof message === "string")
|
|
5259
|
-
this.message = message;
|
|
5260
|
-
makeObservable(this, {
|
|
5261
|
-
attachments: observable,
|
|
5262
|
-
message: observable,
|
|
5263
|
-
messageType: observable,
|
|
5264
|
-
reference: observable
|
|
5233
|
+
function importComponent(path) {
|
|
5234
|
+
return lazy(() => {
|
|
5235
|
+
return new Promise((resolve) => {
|
|
5236
|
+
import(
|
|
5237
|
+
/* webpackInclude: /\.tsx?$/ */
|
|
5238
|
+
`/customComponents/${path}`
|
|
5239
|
+
).then((result) => {
|
|
5240
|
+
if (result?.default?.default)
|
|
5241
|
+
resolve(result.default);
|
|
5242
|
+
else if (result?.default)
|
|
5243
|
+
resolve(result);
|
|
5244
|
+
else
|
|
5245
|
+
resolve({
|
|
5246
|
+
default: () => /* @__PURE__ */ jsx(Fragment, { children: "Something went wrong when importing component" })
|
|
5247
|
+
});
|
|
5248
|
+
}).catch((error) => {
|
|
5249
|
+
resolve({
|
|
5250
|
+
default: () => {
|
|
5251
|
+
console.error(error);
|
|
5252
|
+
return /* @__PURE__ */ jsx(Fragment, { children: "Error" });
|
|
5253
|
+
}
|
|
5254
|
+
});
|
|
5255
|
+
});
|
|
5265
5256
|
});
|
|
5266
|
-
}
|
|
5267
|
-
removeAttachment(attachment) {
|
|
5268
|
-
this.attachments = this.attachments.filter(
|
|
5269
|
-
(current) => current !== attachment
|
|
5270
|
-
);
|
|
5271
|
-
}
|
|
5272
|
-
addAttachmentDescription(attachment, description) {
|
|
5273
|
-
const a = this.attachments.find((current) => current === attachment);
|
|
5274
|
-
if (a) {
|
|
5275
|
-
a.description = description;
|
|
5276
|
-
}
|
|
5277
|
-
}
|
|
5257
|
+
});
|
|
5278
5258
|
}
|
|
5279
5259
|
|
|
5280
|
-
const
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
const isNearBottom = () => scrollEl.scrollHeight - (scrollEl.scrollTop + scrollEl.clientHeight) <= threshold;
|
|
5289
|
-
const onWheel = (e) => {
|
|
5290
|
-
if (e.deltaY < 0) {
|
|
5291
|
-
autoScrollEnabled.current = false;
|
|
5292
|
-
} else if (e.deltaY > 0 && isNearBottom()) {
|
|
5293
|
-
autoScrollEnabled.current = true;
|
|
5294
|
-
}
|
|
5295
|
-
};
|
|
5296
|
-
const onScroll = () => {
|
|
5297
|
-
if (isNearBottom()) {
|
|
5298
|
-
autoScrollEnabled.current = true;
|
|
5299
|
-
}
|
|
5300
|
-
};
|
|
5301
|
-
function enable() {
|
|
5302
|
-
autoScrollEnabled.current = true;
|
|
5303
|
-
}
|
|
5304
|
-
scrollEl.addEventListener("wheel", onWheel, { passive: true });
|
|
5305
|
-
scrollEl.addEventListener("scroll", onScroll, { passive: true });
|
|
5306
|
-
document.addEventListener("enableAutoScroll", enable);
|
|
5307
|
-
scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
|
|
5308
|
-
const mo = new MutationObserver(() => {
|
|
5309
|
-
if (autoScrollEnabled.current) {
|
|
5310
|
-
scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
|
|
5311
|
-
}
|
|
5312
|
-
});
|
|
5313
|
-
mo.observe(wrapper, { childList: true, subtree: true });
|
|
5314
|
-
return () => {
|
|
5315
|
-
scrollEl.removeEventListener("wheel", onWheel);
|
|
5316
|
-
scrollEl.removeEventListener("enableAutoScroll", enable);
|
|
5317
|
-
scrollEl.removeEventListener("scroll", onScroll);
|
|
5318
|
-
mo.disconnect();
|
|
5319
|
-
};
|
|
5320
|
-
}, [threshold]);
|
|
5321
|
-
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, className: `${className || ""} autoscrollContainer`, children });
|
|
5260
|
+
const MessageBlock = ({
|
|
5261
|
+
componentData
|
|
5262
|
+
}) => {
|
|
5263
|
+
if (typeof componentData.args === "string") {
|
|
5264
|
+
componentData.args = JSON.parse(componentData.args);
|
|
5265
|
+
}
|
|
5266
|
+
const Component = importComponent(componentData.path);
|
|
5267
|
+
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...componentData.args }) });
|
|
5322
5268
|
};
|
|
5269
|
+
var MessageBlock$1 = memo(MessageBlock);
|
|
5323
5270
|
|
|
5324
|
-
const
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
const [isDragOver, setIsDragOver] = useState(false);
|
|
5338
|
-
return /* @__PURE__ */ createElement(
|
|
5339
|
-
Box,
|
|
5340
|
-
{
|
|
5341
|
-
...getVariant("layout.common.components.fileCard"),
|
|
5342
|
-
sx: {
|
|
5343
|
-
...sx,
|
|
5344
|
-
width,
|
|
5345
|
-
...isDragOver && onDropFiles ? {
|
|
5346
|
-
border: "2px dashed #1976d2!important",
|
|
5347
|
-
backgroundColor: "#f5faff!important"
|
|
5348
|
-
} : {}
|
|
5349
|
-
},
|
|
5350
|
-
ref,
|
|
5351
|
-
key: name,
|
|
5352
|
-
className: `fileCard ${className ?? ""}`,
|
|
5353
|
-
onDoubleClick,
|
|
5354
|
-
onClick,
|
|
5355
|
-
title: name,
|
|
5356
|
-
tabIndex: 0,
|
|
5357
|
-
onDragOver: (e) => {
|
|
5358
|
-
e.preventDefault();
|
|
5359
|
-
e.stopPropagation();
|
|
5360
|
-
setIsDragOver(true);
|
|
5361
|
-
},
|
|
5362
|
-
onDragLeave: (e) => {
|
|
5363
|
-
e.preventDefault();
|
|
5364
|
-
e.stopPropagation();
|
|
5365
|
-
setIsDragOver(false);
|
|
5366
|
-
},
|
|
5367
|
-
onDrop: (e) => {
|
|
5368
|
-
e.preventDefault();
|
|
5369
|
-
e.stopPropagation();
|
|
5370
|
-
setIsDragOver(false);
|
|
5371
|
-
if (onDropFiles && e.dataTransfer?.files?.length) {
|
|
5372
|
-
const files = Array.from(e.dataTransfer.files);
|
|
5373
|
-
onDropFiles(files);
|
|
5374
|
-
}
|
|
5375
|
-
}
|
|
5376
|
-
},
|
|
5377
|
-
/* @__PURE__ */ jsxs(Box, { className: "fileCard__content", children: [
|
|
5378
|
-
/* @__PURE__ */ jsx(FileIcon, { docName: name, iconSize: iconsSize }),
|
|
5379
|
-
/* @__PURE__ */ jsx(Box, { as: "span", className: "fileCard__name", children: name })
|
|
5380
|
-
] }),
|
|
5381
|
-
/* @__PURE__ */ jsx(Box, { className: "fileCard__additionalButtons", children: additionalButtons?.map((c) => {
|
|
5382
|
-
return /* @__PURE__ */ jsx(
|
|
5383
|
-
IconButton,
|
|
5271
|
+
const AttributeParsers = [
|
|
5272
|
+
/**
|
|
5273
|
+
* Allows to pass javascript event handlers through the format
|
|
5274
|
+
* onEventDispatched, the main difficulty is that the html parser returns the
|
|
5275
|
+
* attributes with lowercase, that's why any attribute of the type
|
|
5276
|
+
* onEventDispatched will be passed to the component as onEventdispatched
|
|
5277
|
+
* (note the lowercase 'd').
|
|
5278
|
+
*/
|
|
5279
|
+
{
|
|
5280
|
+
match: /^(?:data-)?on(.*)$/i,
|
|
5281
|
+
parse([, originalAction], value) {
|
|
5282
|
+
if (value.match(/^__contextMethod/))
|
|
5283
|
+
return [
|
|
5384
5284
|
{
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5285
|
+
newName: `on${originalAction[0].toUpperCase()}${originalAction.slice(
|
|
5286
|
+
1
|
|
5287
|
+
)}`,
|
|
5288
|
+
newValue: value
|
|
5388
5289
|
}
|
|
5389
|
-
|
|
5390
|
-
})
|
|
5391
|
-
|
|
5392
|
-
|
|
5290
|
+
];
|
|
5291
|
+
let newName = `on${originalAction.charAt(0).toUpperCase()}${originalAction.slice(1)}`;
|
|
5292
|
+
const composedEvent = originalAction.match(/^(mouse|key|double)(.*)$/i);
|
|
5293
|
+
if (composedEvent) {
|
|
5294
|
+
newName = `on${composedEvent[1].charAt(0).toUpperCase()}${composedEvent[1].slice(1)}${composedEvent[2].charAt(0).toUpperCase()}${composedEvent[2].slice(1)}`;
|
|
5295
|
+
}
|
|
5296
|
+
return [
|
|
5393
5297
|
{
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
handleClose(name);
|
|
5298
|
+
newName,
|
|
5299
|
+
newValue: (ev) => {
|
|
5300
|
+
const evalString = value.replace(/return [^;\n\r]+/, "");
|
|
5301
|
+
const f = eval(evalString);
|
|
5302
|
+
f(ev);
|
|
5400
5303
|
}
|
|
5401
5304
|
}
|
|
5402
|
-
|
|
5403
|
-
);
|
|
5404
|
-
}
|
|
5405
|
-
);
|
|
5406
|
-
|
|
5407
|
-
const Dropzone = ({
|
|
5408
|
-
sx,
|
|
5409
|
-
className,
|
|
5410
|
-
messageError,
|
|
5411
|
-
progress = 0,
|
|
5412
|
-
defaultLabel = getLabel("btnUploadClass").text,
|
|
5413
|
-
draggingLabel = getLabel("lblDroping").text,
|
|
5414
|
-
onClick,
|
|
5415
|
-
onChange,
|
|
5416
|
-
handleInfoButton
|
|
5417
|
-
}) => {
|
|
5418
|
-
const innerSx = messageError ? { borderLeft: "2px solid", borderColor: "danger" } : {};
|
|
5419
|
-
const fileInputRef = useRef(null);
|
|
5420
|
-
const handleClick = (ev) => {
|
|
5421
|
-
onClick?.(ev);
|
|
5422
|
-
if (!ev.defaultPrevented) {
|
|
5423
|
-
fileInputRef.current?.click();
|
|
5424
|
-
}
|
|
5425
|
-
};
|
|
5426
|
-
const handleDragOver = (e) => {
|
|
5427
|
-
e.preventDefault();
|
|
5428
|
-
};
|
|
5429
|
-
const [isDragging, setIsDragging] = useState(false);
|
|
5430
|
-
const handleDragStart = (_e) => {
|
|
5431
|
-
setIsDragging(true);
|
|
5432
|
-
};
|
|
5433
|
-
const handleDragLeave = (e) => {
|
|
5434
|
-
e.preventDefault();
|
|
5435
|
-
setIsDragging(false);
|
|
5436
|
-
};
|
|
5437
|
-
return /* @__PURE__ */ jsxs(
|
|
5438
|
-
Box,
|
|
5439
|
-
{
|
|
5440
|
-
...getVariant("layout.execution.components.uploader.dropzone"),
|
|
5441
|
-
className: "dropzone__container",
|
|
5442
|
-
children: [
|
|
5443
|
-
/* @__PURE__ */ jsxs(
|
|
5444
|
-
Box,
|
|
5445
|
-
{
|
|
5446
|
-
tabIndex: 0,
|
|
5447
|
-
sx: { ...innerSx, sx },
|
|
5448
|
-
className: `dropzone ${className ?? ""}`,
|
|
5449
|
-
onClick: handleClick,
|
|
5450
|
-
onKeyDown: (ev) => {
|
|
5451
|
-
if (ev.code === "Enter" || ev.code === "Space") {
|
|
5452
|
-
handleClick(ev);
|
|
5453
|
-
}
|
|
5454
|
-
},
|
|
5455
|
-
onDrop: (e) => {
|
|
5456
|
-
e.preventDefault();
|
|
5457
|
-
const newFiles = Array.from(e.dataTransfer.files);
|
|
5458
|
-
setIsDragging(false);
|
|
5459
|
-
onChange?.(newFiles);
|
|
5460
|
-
},
|
|
5461
|
-
onDragEnter: handleDragStart,
|
|
5462
|
-
onDragLeave: handleDragLeave,
|
|
5463
|
-
onDragOver: handleDragOver,
|
|
5464
|
-
children: [
|
|
5465
|
-
progress > 0 && progress < 100 && /* @__PURE__ */ jsx(Progress, { max: 100, value: progress, className: "progressBar" }),
|
|
5466
|
-
messageError ? /* @__PURE__ */ jsx(Box, { color: "danger", children: messageError }) : isDragging ? draggingLabel : defaultLabel,
|
|
5467
|
-
/* @__PURE__ */ jsx(
|
|
5468
|
-
"input",
|
|
5469
|
-
{
|
|
5470
|
-
multiple: true,
|
|
5471
|
-
type: "file",
|
|
5472
|
-
ref: fileInputRef,
|
|
5473
|
-
style: { display: "none" },
|
|
5474
|
-
onChange: (e) => {
|
|
5475
|
-
e.preventDefault();
|
|
5476
|
-
if (e.target.files) {
|
|
5477
|
-
const newFiles = Array.from([...e.target.files]);
|
|
5478
|
-
onChange?.(newFiles);
|
|
5479
|
-
e.target.value = "";
|
|
5480
|
-
}
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
)
|
|
5484
|
-
]
|
|
5485
|
-
}
|
|
5486
|
-
),
|
|
5487
|
-
handleInfoButton && /* @__PURE__ */ jsx(
|
|
5488
|
-
IconButton,
|
|
5489
|
-
{
|
|
5490
|
-
className: "info",
|
|
5491
|
-
iconSize: "Sm",
|
|
5492
|
-
icon: "Info",
|
|
5493
|
-
onMouseEnter: handleInfoButton,
|
|
5494
|
-
onClick: handleClick
|
|
5495
|
-
}
|
|
5496
|
-
)
|
|
5497
|
-
]
|
|
5498
|
-
}
|
|
5499
|
-
);
|
|
5500
|
-
};
|
|
5501
|
-
|
|
5502
|
-
var __defProp$e = Object.defineProperty;
|
|
5503
|
-
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5504
|
-
var __publicField$e = (obj, key, value) => {
|
|
5505
|
-
__defNormalProp$e(obj, key + "" , value);
|
|
5506
|
-
return value;
|
|
5507
|
-
};
|
|
5508
|
-
class UploadHandler {
|
|
5509
|
-
constructor(props) {
|
|
5510
|
-
this.props = props;
|
|
5511
|
-
__publicField$e(this, "state", { inProgressFiles: [], uploadedFiles: [] });
|
|
5512
|
-
makeAutoObservable(this);
|
|
5513
|
-
this.state.uploadedFiles = this.props.initialFiles;
|
|
5514
|
-
}
|
|
5515
|
-
delete(file) {
|
|
5516
|
-
this.props.onDelete(file).then((res) => {
|
|
5517
|
-
if (res === true) {
|
|
5518
|
-
this.state.uploadedFiles = this.state.uploadedFiles.filter(
|
|
5519
|
-
(c) => c !== file
|
|
5520
|
-
);
|
|
5521
|
-
} else if (typeof res === "string") {
|
|
5522
|
-
ApiaUtil.instance.notifications.notify({
|
|
5523
|
-
message: res
|
|
5524
|
-
});
|
|
5525
|
-
}
|
|
5526
|
-
});
|
|
5527
|
-
}
|
|
5528
|
-
start(files) {
|
|
5529
|
-
files.forEach((file) => {
|
|
5530
|
-
const newUpload = {
|
|
5531
|
-
abortController: new AbortController(),
|
|
5532
|
-
id: uniqueId$4("file_upload"),
|
|
5533
|
-
file,
|
|
5534
|
-
progress: 0
|
|
5535
|
-
};
|
|
5536
|
-
this.state.inProgressFiles.push(newUpload);
|
|
5537
|
-
this.props.onUpload(newUpload).then((res) => {
|
|
5538
|
-
this.state.inProgressFiles = this.state.inProgressFiles.filter(
|
|
5539
|
-
(c) => c.id !== newUpload.id
|
|
5540
|
-
);
|
|
5541
|
-
if (typeof res === "string") {
|
|
5542
|
-
ApiaUtil.instance.notifications.notify({
|
|
5543
|
-
message: res,
|
|
5544
|
-
icon: ""
|
|
5545
|
-
});
|
|
5546
|
-
} else if (res) {
|
|
5547
|
-
this.state.uploadedFiles.push(res);
|
|
5548
|
-
}
|
|
5549
|
-
});
|
|
5550
|
-
});
|
|
5551
|
-
}
|
|
5552
|
-
}
|
|
5553
|
-
const Uploader = observer(({ handler }) => {
|
|
5554
|
-
return /* @__PURE__ */ jsxs(Box, { className: "file_uploader", children: [
|
|
5555
|
-
/* @__PURE__ */ jsx(Box, { className: "file_uploader__dropzone", children: (handler.props.isMultiple || handler.state.uploadedFiles.length === 0 && handler.state.inProgressFiles.length === 0) && /* @__PURE__ */ jsx(
|
|
5556
|
-
Dropzone,
|
|
5557
|
-
{
|
|
5558
|
-
onChange: (ev) => {
|
|
5559
|
-
handler.start(ev);
|
|
5560
|
-
}
|
|
5561
|
-
}
|
|
5562
|
-
) }),
|
|
5563
|
-
/* @__PURE__ */ jsx(Box, { className: "file_uploader__in_progress", children: handler.state.inProgressFiles.map((c) => /* @__PURE__ */ jsx(
|
|
5564
|
-
Dropzone,
|
|
5565
|
-
{
|
|
5566
|
-
progress: c.progress,
|
|
5567
|
-
messageError: c.error
|
|
5568
|
-
},
|
|
5569
|
-
c.file.name
|
|
5570
|
-
)) }),
|
|
5571
|
-
/* @__PURE__ */ jsx(Box, { className: "file_uploader__files_list", children: handler.state.uploadedFiles.map((c) => /* @__PURE__ */ jsx(
|
|
5572
|
-
FileCard,
|
|
5573
|
-
{
|
|
5574
|
-
name: c.name,
|
|
5575
|
-
handleClose: () => handler.delete(c)
|
|
5576
|
-
},
|
|
5577
|
-
c.id
|
|
5578
|
-
)) })
|
|
5579
|
-
] });
|
|
5580
|
-
});
|
|
5581
|
-
|
|
5582
|
-
const FileAttachment = observer(
|
|
5583
|
-
({
|
|
5584
|
-
attachment,
|
|
5585
|
-
onAddDescription,
|
|
5586
|
-
onRemove
|
|
5587
|
-
}) => {
|
|
5588
|
-
const { ref } = ApiaUtil.instance.tooltips.useHover({
|
|
5589
|
-
preferredOrientationX: "left",
|
|
5590
|
-
preferredOrientationY: "top",
|
|
5591
|
-
minSize: {
|
|
5592
|
-
width: 200,
|
|
5593
|
-
height: 400
|
|
5594
|
-
},
|
|
5595
|
-
attachToMousePosition: true,
|
|
5596
|
-
closeOnMouseLeaveAttachedElement: true,
|
|
5597
|
-
children: /* @__PURE__ */ jsxs(
|
|
5598
|
-
Box,
|
|
5599
|
-
{
|
|
5600
|
-
sx: {
|
|
5601
|
-
display: "flex",
|
|
5602
|
-
alignItems: "center",
|
|
5603
|
-
flexDirection: "column"
|
|
5604
|
-
},
|
|
5605
|
-
children: [
|
|
5606
|
-
/* @__PURE__ */ jsx("h1", { children: attachment.name }),
|
|
5607
|
-
/* @__PURE__ */ jsx("img", { src: attachment.base64 }),
|
|
5608
|
-
attachment.description && /* @__PURE__ */ jsx(Label$1, { children: attachment.description })
|
|
5609
|
-
]
|
|
5610
|
-
}
|
|
5611
|
-
)
|
|
5612
|
-
});
|
|
5613
|
-
return /* @__PURE__ */ jsx(
|
|
5614
|
-
FileCard,
|
|
5615
|
-
{
|
|
5616
|
-
ref,
|
|
5617
|
-
name: attachment.name,
|
|
5618
|
-
handleClose: onRemove,
|
|
5619
|
-
additionalButtons: onAddDescription ? [
|
|
5620
|
-
{
|
|
5621
|
-
icon: "Pencil",
|
|
5622
|
-
onClick: () => {
|
|
5623
|
-
const collector = new Collector();
|
|
5624
|
-
collector.add(
|
|
5625
|
-
new collector.fields.textarea(
|
|
5626
|
-
"desc",
|
|
5627
|
-
getLabel("lblDesc").text,
|
|
5628
|
-
{ initialValue: attachment.description }
|
|
5629
|
-
)
|
|
5630
|
-
);
|
|
5631
|
-
collector.show({
|
|
5632
|
-
onConfirm: (ev) => {
|
|
5633
|
-
if (ev) {
|
|
5634
|
-
onAddDescription(attachment, ev.desc);
|
|
5635
|
-
}
|
|
5636
|
-
return true;
|
|
5637
|
-
},
|
|
5638
|
-
title: getLabel("btnAddComment").text
|
|
5639
|
-
});
|
|
5640
|
-
},
|
|
5641
|
-
variant: "icon-only"
|
|
5642
|
-
}
|
|
5643
|
-
] : []
|
|
5644
|
-
}
|
|
5645
|
-
);
|
|
5646
|
-
}
|
|
5647
|
-
);
|
|
5648
|
-
|
|
5649
|
-
const Attachments = observer(
|
|
5650
|
-
({
|
|
5651
|
-
attachments,
|
|
5652
|
-
onRemove,
|
|
5653
|
-
onAddDescription,
|
|
5654
|
-
className
|
|
5655
|
-
}) => {
|
|
5656
|
-
if (!attachments.length)
|
|
5657
|
-
return null;
|
|
5658
|
-
return /* @__PURE__ */ jsx(
|
|
5659
|
-
Box,
|
|
5660
|
-
{
|
|
5661
|
-
className: `attachments ${className}`,
|
|
5662
|
-
...getVariant("layout.common.chat.attachments"),
|
|
5663
|
-
children: attachments.map((x) => /* @__PURE__ */ jsx(
|
|
5664
|
-
FileAttachment,
|
|
5665
|
-
{
|
|
5666
|
-
attachment: x,
|
|
5667
|
-
onRemove: onRemove ? () => onRemove(x) : void 0,
|
|
5668
|
-
onAddDescription
|
|
5669
|
-
},
|
|
5670
|
-
x.id
|
|
5671
|
-
))
|
|
5672
|
-
}
|
|
5673
|
-
);
|
|
5674
|
-
}
|
|
5675
|
-
);
|
|
5676
|
-
|
|
5677
|
-
const AttributeParsers = [
|
|
5678
|
-
/**
|
|
5679
|
-
* Allows to pass javascript event handlers through the format
|
|
5680
|
-
* onEventDispatched, the main difficulty is that the html parser returns the
|
|
5681
|
-
* attributes with lowercase, that's why any attribute of the type
|
|
5682
|
-
* onEventDispatched will be passed to the component as onEventdispatched
|
|
5683
|
-
* (note the lowercase 'd').
|
|
5684
|
-
*/
|
|
5685
|
-
{
|
|
5686
|
-
match: /^(?:data-)?on(.*)$/i,
|
|
5687
|
-
parse([, originalAction], value) {
|
|
5688
|
-
if (value.match(/^__contextMethod/))
|
|
5689
|
-
return [
|
|
5690
|
-
{
|
|
5691
|
-
newName: `on${originalAction[0].toUpperCase()}${originalAction.slice(
|
|
5692
|
-
1
|
|
5693
|
-
)}`,
|
|
5694
|
-
newValue: value
|
|
5695
|
-
}
|
|
5696
|
-
];
|
|
5697
|
-
let newName = `on${originalAction.charAt(0).toUpperCase()}${originalAction.slice(1)}`;
|
|
5698
|
-
const composedEvent = originalAction.match(/^(mouse|key|double)(.*)$/i);
|
|
5699
|
-
if (composedEvent) {
|
|
5700
|
-
newName = `on${composedEvent[1].charAt(0).toUpperCase()}${composedEvent[1].slice(1)}${composedEvent[2].charAt(0).toUpperCase()}${composedEvent[2].slice(1)}`;
|
|
5701
|
-
}
|
|
5702
|
-
return [
|
|
5703
|
-
{
|
|
5704
|
-
newName,
|
|
5705
|
-
newValue: (ev) => {
|
|
5706
|
-
const evalString = value.replace(/return [^;\n\r]+/, "");
|
|
5707
|
-
const f = eval(evalString);
|
|
5708
|
-
f(ev);
|
|
5709
|
-
}
|
|
5710
|
-
}
|
|
5711
|
-
];
|
|
5305
|
+
];
|
|
5712
5306
|
}
|
|
5713
5307
|
},
|
|
5714
5308
|
{
|
|
@@ -5980,10 +5574,10 @@ const CommentsParsers = [
|
|
|
5980
5574
|
}
|
|
5981
5575
|
];
|
|
5982
5576
|
|
|
5983
|
-
var __defProp$
|
|
5984
|
-
var __defNormalProp$
|
|
5985
|
-
var __publicField$
|
|
5986
|
-
__defNormalProp$
|
|
5577
|
+
var __defProp$f = Object.defineProperty;
|
|
5578
|
+
var __defNormalProp$f = (obj, key, value) => key in obj ? __defProp$f(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5579
|
+
var __publicField$f = (obj, key, value) => {
|
|
5580
|
+
__defNormalProp$f(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5987
5581
|
return value;
|
|
5988
5582
|
};
|
|
5989
5583
|
var __accessCheck$4 = (obj, member, msg) => {
|
|
@@ -6181,8 +5775,8 @@ const parseOptions = (customOptions, commentsData) => {
|
|
|
6181
5775
|
};
|
|
6182
5776
|
const _Templater = class _Templater {
|
|
6183
5777
|
constructor() {
|
|
6184
|
-
__publicField$
|
|
6185
|
-
__publicField$
|
|
5778
|
+
__publicField$f(this, "isDownloadingTemplate", false);
|
|
5779
|
+
__publicField$f(this, "templates", {});
|
|
6186
5780
|
__privateAdd$4(this, _actuallyParse, (html, options) => {
|
|
6187
5781
|
let actualHTML = html;
|
|
6188
5782
|
if (window.onPreParseTemplate) {
|
|
@@ -6327,71 +5921,477 @@ const _Templater = class _Templater {
|
|
|
6327
5921
|
return __privateGet$2(this, _actuallyParse).call(this, this.parseContent("parseStringTemplate", content2, options?.props), parseOptions(options));
|
|
6328
5922
|
}
|
|
6329
5923
|
};
|
|
6330
|
-
_actuallyParse = new WeakMap();
|
|
6331
|
-
__publicField$
|
|
6332
|
-
let Templater = _Templater;
|
|
5924
|
+
_actuallyParse = new WeakMap();
|
|
5925
|
+
__publicField$f(_Templater, "_instance", null);
|
|
5926
|
+
let Templater = _Templater;
|
|
5927
|
+
|
|
5928
|
+
const MDRenderer = ({ str }) => {
|
|
5929
|
+
return /* @__PURE__ */ jsx(Box, { ...getVariant("layout.common.markdown"), children: Templater.instance.parseString(
|
|
5930
|
+
new Remarkable({ linkTarget: "_blank" }).render(str)
|
|
5931
|
+
) });
|
|
5932
|
+
};
|
|
5933
|
+
var MDRenderer$1 = memo(MDRenderer);
|
|
5934
|
+
|
|
5935
|
+
const MessageBlocks = ({ str }) => {
|
|
5936
|
+
const parts = str.split(/(!!\[[^]+])/g).map((c, i) => {
|
|
5937
|
+
if (c.match(/^!!\[[^]+]$/)) {
|
|
5938
|
+
const definition = JSON.parse(
|
|
5939
|
+
decodeBase64ToUtf8(
|
|
5940
|
+
(c.match(/^!!\[([^]+)]$/) ?? [void 0, void 0])[1] ?? ""
|
|
5941
|
+
)
|
|
5942
|
+
);
|
|
5943
|
+
return /* @__PURE__ */ jsx(MessageBlock$1, { componentData: definition }, i);
|
|
5944
|
+
} else {
|
|
5945
|
+
return /* @__PURE__ */ jsx(MDRenderer$1, { str: c }, i);
|
|
5946
|
+
}
|
|
5947
|
+
});
|
|
5948
|
+
return parts;
|
|
5949
|
+
};
|
|
5950
|
+
var MessageBlocks$1 = memo(MessageBlocks);
|
|
5951
|
+
|
|
5952
|
+
var __defProp$e = Object.defineProperty;
|
|
5953
|
+
var __defNormalProp$e = (obj, key, value) => key in obj ? __defProp$e(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
5954
|
+
var __publicField$e = (obj, key, value) => {
|
|
5955
|
+
__defNormalProp$e(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5956
|
+
return value;
|
|
5957
|
+
};
|
|
5958
|
+
let maxId = 0;
|
|
5959
|
+
class ChatMessage {
|
|
5960
|
+
constructor(message = "", messageType = "user", attachments = [], reference = null) {
|
|
5961
|
+
this.message = message;
|
|
5962
|
+
this.messageType = messageType;
|
|
5963
|
+
this.attachments = attachments;
|
|
5964
|
+
this.reference = reference;
|
|
5965
|
+
__publicField$e(this, "id");
|
|
5966
|
+
__publicField$e(this, "clone", () => new ChatMessage(
|
|
5967
|
+
this.message,
|
|
5968
|
+
this.messageType,
|
|
5969
|
+
this.attachments.map((x) => {
|
|
5970
|
+
return { ...x };
|
|
5971
|
+
}),
|
|
5972
|
+
this.reference
|
|
5973
|
+
));
|
|
5974
|
+
this.id = maxId++;
|
|
5975
|
+
if (messageType === "response")
|
|
5976
|
+
this.messageType = "system";
|
|
5977
|
+
if (typeof message === "string")
|
|
5978
|
+
this.message = message;
|
|
5979
|
+
makeObservable(this, {
|
|
5980
|
+
attachments: observable,
|
|
5981
|
+
message: observable,
|
|
5982
|
+
messageType: observable,
|
|
5983
|
+
reference: observable
|
|
5984
|
+
});
|
|
5985
|
+
}
|
|
5986
|
+
removeAttachment(attachment) {
|
|
5987
|
+
this.attachments = this.attachments.filter(
|
|
5988
|
+
(current) => current !== attachment
|
|
5989
|
+
);
|
|
5990
|
+
}
|
|
5991
|
+
addAttachmentDescription(attachment, description) {
|
|
5992
|
+
const a = this.attachments.find((current) => current === attachment);
|
|
5993
|
+
if (a) {
|
|
5994
|
+
a.description = description;
|
|
5995
|
+
}
|
|
5996
|
+
}
|
|
5997
|
+
}
|
|
5998
|
+
|
|
5999
|
+
const AutoscrollContainer = ({ children, threshold = 150, className }) => {
|
|
6000
|
+
const wrapperRef = useRef(null);
|
|
6001
|
+
const autoScrollEnabled = useRef(true);
|
|
6002
|
+
useEffect(() => {
|
|
6003
|
+
const wrapper = wrapperRef.current;
|
|
6004
|
+
if (!wrapper)
|
|
6005
|
+
return;
|
|
6006
|
+
const scrollEl = findScrollContainer(wrapper);
|
|
6007
|
+
const isNearBottom = () => scrollEl.scrollHeight - (scrollEl.scrollTop + scrollEl.clientHeight) <= threshold;
|
|
6008
|
+
const onWheel = (e) => {
|
|
6009
|
+
if (e.deltaY < 0) {
|
|
6010
|
+
autoScrollEnabled.current = false;
|
|
6011
|
+
} else if (e.deltaY > 0 && isNearBottom()) {
|
|
6012
|
+
autoScrollEnabled.current = true;
|
|
6013
|
+
}
|
|
6014
|
+
};
|
|
6015
|
+
const onScroll = () => {
|
|
6016
|
+
if (isNearBottom()) {
|
|
6017
|
+
autoScrollEnabled.current = true;
|
|
6018
|
+
}
|
|
6019
|
+
};
|
|
6020
|
+
function enable() {
|
|
6021
|
+
autoScrollEnabled.current = true;
|
|
6022
|
+
}
|
|
6023
|
+
scrollEl.addEventListener("wheel", onWheel, { passive: true });
|
|
6024
|
+
scrollEl.addEventListener("scroll", onScroll, { passive: true });
|
|
6025
|
+
document.addEventListener("enableAutoScroll", enable);
|
|
6026
|
+
scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
|
|
6027
|
+
const mo = new MutationObserver(() => {
|
|
6028
|
+
if (autoScrollEnabled.current) {
|
|
6029
|
+
scrollEl.scrollTo({ top: scrollEl.scrollHeight, behavior: "smooth" });
|
|
6030
|
+
}
|
|
6031
|
+
});
|
|
6032
|
+
mo.observe(wrapper, { childList: true, subtree: true });
|
|
6033
|
+
return () => {
|
|
6034
|
+
scrollEl.removeEventListener("wheel", onWheel);
|
|
6035
|
+
scrollEl.removeEventListener("enableAutoScroll", enable);
|
|
6036
|
+
scrollEl.removeEventListener("scroll", onScroll);
|
|
6037
|
+
mo.disconnect();
|
|
6038
|
+
};
|
|
6039
|
+
}, [threshold]);
|
|
6040
|
+
return /* @__PURE__ */ jsx("div", { ref: wrapperRef, className: `${className || ""} autoscrollContainer`, children });
|
|
6041
|
+
};
|
|
6042
|
+
|
|
6043
|
+
const FileCard = forwardRef(
|
|
6044
|
+
({
|
|
6045
|
+
name,
|
|
6046
|
+
iconsSize,
|
|
6047
|
+
additionalButtons,
|
|
6048
|
+
className,
|
|
6049
|
+
sx,
|
|
6050
|
+
width = "fit-content",
|
|
6051
|
+
handleClose,
|
|
6052
|
+
onDoubleClick,
|
|
6053
|
+
onClick,
|
|
6054
|
+
onDropFiles
|
|
6055
|
+
}, ref) => {
|
|
6056
|
+
const [isDragOver, setIsDragOver] = useState(false);
|
|
6057
|
+
return /* @__PURE__ */ createElement(
|
|
6058
|
+
Box,
|
|
6059
|
+
{
|
|
6060
|
+
...getVariant("layout.common.components.fileCard"),
|
|
6061
|
+
sx: {
|
|
6062
|
+
...sx,
|
|
6063
|
+
width,
|
|
6064
|
+
...isDragOver && onDropFiles ? {
|
|
6065
|
+
border: "2px dashed #1976d2!important",
|
|
6066
|
+
backgroundColor: "#f5faff!important"
|
|
6067
|
+
} : {}
|
|
6068
|
+
},
|
|
6069
|
+
ref,
|
|
6070
|
+
key: name,
|
|
6071
|
+
className: `fileCard ${className ?? ""}`,
|
|
6072
|
+
onDoubleClick,
|
|
6073
|
+
onClick,
|
|
6074
|
+
title: name,
|
|
6075
|
+
tabIndex: 0,
|
|
6076
|
+
onDragOver: (e) => {
|
|
6077
|
+
e.preventDefault();
|
|
6078
|
+
e.stopPropagation();
|
|
6079
|
+
setIsDragOver(true);
|
|
6080
|
+
},
|
|
6081
|
+
onDragLeave: (e) => {
|
|
6082
|
+
e.preventDefault();
|
|
6083
|
+
e.stopPropagation();
|
|
6084
|
+
setIsDragOver(false);
|
|
6085
|
+
},
|
|
6086
|
+
onDrop: (e) => {
|
|
6087
|
+
e.preventDefault();
|
|
6088
|
+
e.stopPropagation();
|
|
6089
|
+
setIsDragOver(false);
|
|
6090
|
+
if (onDropFiles && e.dataTransfer?.files?.length) {
|
|
6091
|
+
const files = Array.from(e.dataTransfer.files);
|
|
6092
|
+
onDropFiles(files);
|
|
6093
|
+
}
|
|
6094
|
+
}
|
|
6095
|
+
},
|
|
6096
|
+
/* @__PURE__ */ jsxs(Box, { className: "fileCard__content", children: [
|
|
6097
|
+
/* @__PURE__ */ jsx(FileIcon, { docName: name, iconSize: iconsSize }),
|
|
6098
|
+
/* @__PURE__ */ jsx(Box, { as: "span", className: "fileCard__name", children: name })
|
|
6099
|
+
] }),
|
|
6100
|
+
/* @__PURE__ */ jsx(Box, { className: "fileCard__additionalButtons", children: additionalButtons?.map((c) => {
|
|
6101
|
+
return /* @__PURE__ */ jsx(
|
|
6102
|
+
IconButton,
|
|
6103
|
+
{
|
|
6104
|
+
iconSize: "Md",
|
|
6105
|
+
...c,
|
|
6106
|
+
className: `fileCard__additionalButton ${c.className ?? ""}`
|
|
6107
|
+
}
|
|
6108
|
+
);
|
|
6109
|
+
}) }),
|
|
6110
|
+
handleClose && /* @__PURE__ */ jsx(
|
|
6111
|
+
Close,
|
|
6112
|
+
{
|
|
6113
|
+
type: "button",
|
|
6114
|
+
className: "fileCard__delete",
|
|
6115
|
+
onClick: (e) => {
|
|
6116
|
+
e.stopPropagation();
|
|
6117
|
+
e.preventDefault();
|
|
6118
|
+
handleClose(name);
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
)
|
|
6122
|
+
);
|
|
6123
|
+
}
|
|
6124
|
+
);
|
|
6125
|
+
|
|
6126
|
+
const Dropzone = ({
|
|
6127
|
+
sx,
|
|
6128
|
+
className,
|
|
6129
|
+
messageError,
|
|
6130
|
+
progress = 0,
|
|
6131
|
+
defaultLabel = getLabel("btnUploadClass").text,
|
|
6132
|
+
draggingLabel = getLabel("lblDroping").text,
|
|
6133
|
+
onClick,
|
|
6134
|
+
onChange,
|
|
6135
|
+
handleInfoButton
|
|
6136
|
+
}) => {
|
|
6137
|
+
const innerSx = messageError ? { borderLeft: "2px solid", borderColor: "danger" } : {};
|
|
6138
|
+
const fileInputRef = useRef(null);
|
|
6139
|
+
const handleClick = (ev) => {
|
|
6140
|
+
onClick?.(ev);
|
|
6141
|
+
if (!ev.defaultPrevented) {
|
|
6142
|
+
fileInputRef.current?.click();
|
|
6143
|
+
}
|
|
6144
|
+
};
|
|
6145
|
+
const handleDragOver = (e) => {
|
|
6146
|
+
e.preventDefault();
|
|
6147
|
+
};
|
|
6148
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
6149
|
+
const handleDragStart = (_e) => {
|
|
6150
|
+
setIsDragging(true);
|
|
6151
|
+
};
|
|
6152
|
+
const handleDragLeave = (e) => {
|
|
6153
|
+
e.preventDefault();
|
|
6154
|
+
setIsDragging(false);
|
|
6155
|
+
};
|
|
6156
|
+
return /* @__PURE__ */ jsxs(
|
|
6157
|
+
Box,
|
|
6158
|
+
{
|
|
6159
|
+
...getVariant("layout.execution.components.uploader.dropzone"),
|
|
6160
|
+
className: "dropzone__container",
|
|
6161
|
+
children: [
|
|
6162
|
+
/* @__PURE__ */ jsxs(
|
|
6163
|
+
Box,
|
|
6164
|
+
{
|
|
6165
|
+
tabIndex: 0,
|
|
6166
|
+
sx: { ...innerSx, sx },
|
|
6167
|
+
className: `dropzone ${className ?? ""}`,
|
|
6168
|
+
onClick: handleClick,
|
|
6169
|
+
onKeyDown: (ev) => {
|
|
6170
|
+
if (ev.code === "Enter" || ev.code === "Space") {
|
|
6171
|
+
handleClick(ev);
|
|
6172
|
+
}
|
|
6173
|
+
},
|
|
6174
|
+
onDrop: (e) => {
|
|
6175
|
+
e.preventDefault();
|
|
6176
|
+
const newFiles = Array.from(e.dataTransfer.files);
|
|
6177
|
+
setIsDragging(false);
|
|
6178
|
+
onChange?.(newFiles);
|
|
6179
|
+
},
|
|
6180
|
+
onDragEnter: handleDragStart,
|
|
6181
|
+
onDragLeave: handleDragLeave,
|
|
6182
|
+
onDragOver: handleDragOver,
|
|
6183
|
+
children: [
|
|
6184
|
+
progress > 0 && progress < 100 && /* @__PURE__ */ jsx(Progress, { max: 100, value: progress, className: "progressBar" }),
|
|
6185
|
+
messageError ? /* @__PURE__ */ jsx(Box, { color: "danger", children: messageError }) : isDragging ? draggingLabel : defaultLabel,
|
|
6186
|
+
/* @__PURE__ */ jsx(
|
|
6187
|
+
"input",
|
|
6188
|
+
{
|
|
6189
|
+
multiple: true,
|
|
6190
|
+
type: "file",
|
|
6191
|
+
ref: fileInputRef,
|
|
6192
|
+
style: { display: "none" },
|
|
6193
|
+
onChange: (e) => {
|
|
6194
|
+
e.preventDefault();
|
|
6195
|
+
if (e.target.files) {
|
|
6196
|
+
const newFiles = Array.from([...e.target.files]);
|
|
6197
|
+
onChange?.(newFiles);
|
|
6198
|
+
e.target.value = "";
|
|
6199
|
+
}
|
|
6200
|
+
}
|
|
6201
|
+
}
|
|
6202
|
+
)
|
|
6203
|
+
]
|
|
6204
|
+
}
|
|
6205
|
+
),
|
|
6206
|
+
handleInfoButton && /* @__PURE__ */ jsx(
|
|
6207
|
+
IconButton,
|
|
6208
|
+
{
|
|
6209
|
+
className: "info",
|
|
6210
|
+
iconSize: "Sm",
|
|
6211
|
+
icon: "Info",
|
|
6212
|
+
onMouseEnter: handleInfoButton,
|
|
6213
|
+
onClick: handleClick
|
|
6214
|
+
}
|
|
6215
|
+
)
|
|
6216
|
+
]
|
|
6217
|
+
}
|
|
6218
|
+
);
|
|
6219
|
+
};
|
|
6333
6220
|
|
|
6334
|
-
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6221
|
+
var __defProp$d = Object.defineProperty;
|
|
6222
|
+
var __defNormalProp$d = (obj, key, value) => key in obj ? __defProp$d(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6223
|
+
var __publicField$d = (obj, key, value) => {
|
|
6224
|
+
__defNormalProp$d(obj, key + "" , value);
|
|
6225
|
+
return value;
|
|
6338
6226
|
};
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
});
|
|
6356
|
-
}).catch((error) => {
|
|
6357
|
-
resolve({
|
|
6358
|
-
default: () => {
|
|
6359
|
-
console.error(error);
|
|
6360
|
-
return /* @__PURE__ */ jsx(Fragment, { children: "Error" });
|
|
6361
|
-
}
|
|
6227
|
+
class UploadHandler {
|
|
6228
|
+
constructor(props) {
|
|
6229
|
+
this.props = props;
|
|
6230
|
+
__publicField$d(this, "state", { inProgressFiles: [], uploadedFiles: [] });
|
|
6231
|
+
makeAutoObservable(this);
|
|
6232
|
+
this.state.uploadedFiles = this.props.initialFiles;
|
|
6233
|
+
}
|
|
6234
|
+
delete(file) {
|
|
6235
|
+
this.props.onDelete(file).then((res) => {
|
|
6236
|
+
if (res === true) {
|
|
6237
|
+
this.state.uploadedFiles = this.state.uploadedFiles.filter(
|
|
6238
|
+
(c) => c !== file
|
|
6239
|
+
);
|
|
6240
|
+
} else if (typeof res === "string") {
|
|
6241
|
+
ApiaUtil.instance.notifications.notify({
|
|
6242
|
+
message: res
|
|
6362
6243
|
});
|
|
6244
|
+
}
|
|
6245
|
+
});
|
|
6246
|
+
}
|
|
6247
|
+
start(files) {
|
|
6248
|
+
files.forEach((file) => {
|
|
6249
|
+
const newUpload = {
|
|
6250
|
+
abortController: new AbortController(),
|
|
6251
|
+
id: uniqueId$4("file_upload"),
|
|
6252
|
+
file,
|
|
6253
|
+
progress: 0
|
|
6254
|
+
};
|
|
6255
|
+
this.state.inProgressFiles.push(newUpload);
|
|
6256
|
+
this.props.onUpload(newUpload).then((res) => {
|
|
6257
|
+
this.state.inProgressFiles = this.state.inProgressFiles.filter(
|
|
6258
|
+
(c) => c.id !== newUpload.id
|
|
6259
|
+
);
|
|
6260
|
+
if (typeof res === "string") {
|
|
6261
|
+
ApiaUtil.instance.notifications.notify({
|
|
6262
|
+
message: res,
|
|
6263
|
+
icon: ""
|
|
6264
|
+
});
|
|
6265
|
+
} else if (res) {
|
|
6266
|
+
this.state.uploadedFiles.push(res);
|
|
6267
|
+
}
|
|
6363
6268
|
});
|
|
6364
6269
|
});
|
|
6365
|
-
}
|
|
6270
|
+
}
|
|
6366
6271
|
}
|
|
6272
|
+
const Uploader = observer(({ handler }) => {
|
|
6273
|
+
return /* @__PURE__ */ jsxs(Box, { className: "file_uploader", children: [
|
|
6274
|
+
/* @__PURE__ */ jsx(Box, { className: "file_uploader__dropzone", children: (handler.props.isMultiple || handler.state.uploadedFiles.length === 0 && handler.state.inProgressFiles.length === 0) && /* @__PURE__ */ jsx(
|
|
6275
|
+
Dropzone,
|
|
6276
|
+
{
|
|
6277
|
+
onChange: (ev) => {
|
|
6278
|
+
handler.start(ev);
|
|
6279
|
+
}
|
|
6280
|
+
}
|
|
6281
|
+
) }),
|
|
6282
|
+
/* @__PURE__ */ jsx(Box, { className: "file_uploader__in_progress", children: handler.state.inProgressFiles.map((c) => /* @__PURE__ */ jsx(
|
|
6283
|
+
Dropzone,
|
|
6284
|
+
{
|
|
6285
|
+
progress: c.progress,
|
|
6286
|
+
messageError: c.error
|
|
6287
|
+
},
|
|
6288
|
+
c.file.name
|
|
6289
|
+
)) }),
|
|
6290
|
+
/* @__PURE__ */ jsx(Box, { className: "file_uploader__files_list", children: handler.state.uploadedFiles.map((c) => /* @__PURE__ */ jsx(
|
|
6291
|
+
FileCard,
|
|
6292
|
+
{
|
|
6293
|
+
name: c.name,
|
|
6294
|
+
handleClose: () => handler.delete(c)
|
|
6295
|
+
},
|
|
6296
|
+
c.id
|
|
6297
|
+
)) })
|
|
6298
|
+
] });
|
|
6299
|
+
});
|
|
6367
6300
|
|
|
6368
|
-
const
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6301
|
+
const FileAttachment = observer(
|
|
6302
|
+
({
|
|
6303
|
+
attachment,
|
|
6304
|
+
onAddDescription,
|
|
6305
|
+
onRemove
|
|
6306
|
+
}) => {
|
|
6307
|
+
const { ref } = ApiaUtil.instance.tooltips.useHover({
|
|
6308
|
+
preferredOrientationX: "left",
|
|
6309
|
+
preferredOrientationY: "top",
|
|
6310
|
+
minSize: {
|
|
6311
|
+
width: 200,
|
|
6312
|
+
height: 400
|
|
6313
|
+
},
|
|
6314
|
+
attachToMousePosition: true,
|
|
6315
|
+
closeOnMouseLeaveAttachedElement: true,
|
|
6316
|
+
children: /* @__PURE__ */ jsxs(
|
|
6317
|
+
Box,
|
|
6318
|
+
{
|
|
6319
|
+
sx: {
|
|
6320
|
+
display: "flex",
|
|
6321
|
+
alignItems: "center",
|
|
6322
|
+
flexDirection: "column"
|
|
6323
|
+
},
|
|
6324
|
+
children: [
|
|
6325
|
+
/* @__PURE__ */ jsx("h1", { children: attachment.name }),
|
|
6326
|
+
/* @__PURE__ */ jsx("img", { src: attachment.base64 }),
|
|
6327
|
+
attachment.description && /* @__PURE__ */ jsx(Label$1, { children: attachment.description })
|
|
6328
|
+
]
|
|
6329
|
+
}
|
|
6330
|
+
)
|
|
6331
|
+
});
|
|
6332
|
+
return /* @__PURE__ */ jsx(
|
|
6333
|
+
FileCard,
|
|
6334
|
+
{
|
|
6335
|
+
ref,
|
|
6336
|
+
name: attachment.name,
|
|
6337
|
+
handleClose: onRemove,
|
|
6338
|
+
additionalButtons: onAddDescription ? [
|
|
6339
|
+
{
|
|
6340
|
+
icon: "Pencil",
|
|
6341
|
+
onClick: () => {
|
|
6342
|
+
const collector = new Collector();
|
|
6343
|
+
collector.add(
|
|
6344
|
+
new collector.fields.textarea(
|
|
6345
|
+
"desc",
|
|
6346
|
+
getLabel("lblDesc").text,
|
|
6347
|
+
{ initialValue: attachment.description }
|
|
6348
|
+
)
|
|
6349
|
+
);
|
|
6350
|
+
collector.show({
|
|
6351
|
+
onConfirm: (ev) => {
|
|
6352
|
+
if (ev) {
|
|
6353
|
+
onAddDescription(attachment, ev.desc);
|
|
6354
|
+
}
|
|
6355
|
+
return true;
|
|
6356
|
+
},
|
|
6357
|
+
title: getLabel("btnAddComment").text
|
|
6358
|
+
});
|
|
6359
|
+
},
|
|
6360
|
+
variant: "icon-only"
|
|
6361
|
+
}
|
|
6362
|
+
] : []
|
|
6363
|
+
}
|
|
6364
|
+
);
|
|
6373
6365
|
}
|
|
6374
|
-
|
|
6375
|
-
return /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(Component, { ...componentData.args }) });
|
|
6376
|
-
};
|
|
6377
|
-
var MessageBlock$1 = memo(MessageBlock);
|
|
6366
|
+
);
|
|
6378
6367
|
|
|
6379
|
-
const
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
return
|
|
6388
|
-
|
|
6389
|
-
|
|
6390
|
-
|
|
6391
|
-
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6368
|
+
const Attachments = observer(
|
|
6369
|
+
({
|
|
6370
|
+
attachments,
|
|
6371
|
+
onRemove,
|
|
6372
|
+
onAddDescription,
|
|
6373
|
+
className
|
|
6374
|
+
}) => {
|
|
6375
|
+
if (!attachments.length)
|
|
6376
|
+
return null;
|
|
6377
|
+
return /* @__PURE__ */ jsx(
|
|
6378
|
+
Box,
|
|
6379
|
+
{
|
|
6380
|
+
className: `attachments ${className}`,
|
|
6381
|
+
...getVariant("layout.common.chat.attachments"),
|
|
6382
|
+
children: attachments.map((x) => /* @__PURE__ */ jsx(
|
|
6383
|
+
FileAttachment,
|
|
6384
|
+
{
|
|
6385
|
+
attachment: x,
|
|
6386
|
+
onRemove: onRemove ? () => onRemove(x) : void 0,
|
|
6387
|
+
onAddDescription
|
|
6388
|
+
},
|
|
6389
|
+
x.id
|
|
6390
|
+
))
|
|
6391
|
+
}
|
|
6392
|
+
);
|
|
6393
|
+
}
|
|
6394
|
+
);
|
|
6395
6395
|
|
|
6396
6396
|
const Message = observer(
|
|
6397
6397
|
({
|
|
@@ -8302,13 +8302,16 @@ const LinearSpinnerLock = ({ isLocked }) => isLocked ? /* @__PURE__ */ jsx(
|
|
|
8302
8302
|
className: "locker",
|
|
8303
8303
|
style: {
|
|
8304
8304
|
backgroundColor: "rgb(128 128 128 / 0%)",
|
|
8305
|
-
|
|
8305
|
+
top: 0,
|
|
8306
|
+
left: 0,
|
|
8307
|
+
right: 0,
|
|
8308
|
+
bottom: 0,
|
|
8306
8309
|
position: "fixed",
|
|
8307
8310
|
display: "flex",
|
|
8308
8311
|
alignItems: "center",
|
|
8309
8312
|
justifyContent: "center",
|
|
8310
|
-
zIndex:
|
|
8311
|
-
transition: "background-color
|
|
8313
|
+
zIndex: 1200,
|
|
8314
|
+
transition: "background-color 0.25s"
|
|
8312
8315
|
},
|
|
8313
8316
|
ref: (el) => {
|
|
8314
8317
|
if (el instanceof HTMLElement) {
|
|
@@ -8872,7 +8875,7 @@ const DefaultIconRendererNoMemo = (props) => {
|
|
|
8872
8875
|
return /* @__PURE__ */ jsxs(
|
|
8873
8876
|
Box,
|
|
8874
8877
|
{
|
|
8875
|
-
title: String(props.
|
|
8878
|
+
title: String(props.ariaLabel) || props.label,
|
|
8876
8879
|
className: "iconsList__icon__wrapper",
|
|
8877
8880
|
children: [
|
|
8878
8881
|
/* @__PURE__ */ jsxs(Box, { className: "iconsList__icon__image__wrapper", children: [
|
|
@@ -8887,7 +8890,7 @@ const DefaultIconRendererNoMemo = (props) => {
|
|
|
8887
8890
|
),
|
|
8888
8891
|
props.icon && /* @__PURE__ */ jsx(Icon$1, { icon: props.icon, title: props.ariaLabel })
|
|
8889
8892
|
] }),
|
|
8890
|
-
/* @__PURE__ */ jsx(Box, { className: "iconsList__icon__label", children: props.label })
|
|
8893
|
+
/* @__PURE__ */ jsx(Box, { className: "iconsList__icon__label", title: props.ariaLabel, children: props.label })
|
|
8891
8894
|
]
|
|
8892
8895
|
}
|
|
8893
8896
|
);
|
|
@@ -12014,5 +12017,5 @@ const _FiltersStore = class _FiltersStore {
|
|
|
12014
12017
|
__publicField(_FiltersStore, "instance", new _FiltersStore());
|
|
12015
12018
|
let FiltersStore = _FiltersStore;
|
|
12016
12019
|
|
|
12017
|
-
export { Accordion, AccordionAside, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, Aside, AsideLoader, AsidePanel, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, BodyAside, CalendarModal, Captcha, CenteredHeaderButtons, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DeadSessionModal, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FavoriteIcon, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingAside, FloatingChatController, FooterButtons, FooterResponsiveButtons, HamburguerMenu, Header, HeaderButtons, IconButton, IconInput, IconsList, Label, LabelBox, LinearLoader, LinearSpinnerLock, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, MDRenderer$1 as MDRenderer, Modal, NumberInput, Overlay, Pagination, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, ShowResponsive, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, UploadHandler, Uploader, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isFavoriteIcon, isImage, isParametersGroup, makeResponsiveComponent, menuController, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useCurrentTab, useMenu, useModal, useModalContext, useOtherTagButton, useTabsContext };
|
|
12020
|
+
export { Accordion, AccordionAside, AccordionContext, AccordionItem, AccordionItemButton, AccordionItemContent, AccordionItemContext, AlertModal, ApiaFilter, ApiaUtil, ApiaUtilModalHandler, ApiaUtilTooltip, Aside, AsideLoader, AsidePanel, AutoEllipsis, Autocomplete, AutocompleteController, AutogrowTextarea, AutoscrollContainer, BaseButton, BodyAside, CalendarModal, Captcha, CenteredHeaderButtons, ChatController, ChatMessage, Checkbox$1 as Checkbox, CollapsiblePanel, Confirm, ConfirmModal, ContainerWithHeader, DateInput, DeadSessionModal, DefaultIconRenderer, DefaultTabsLabelRenderer, DialogButtonBar, Dropzone, FavoriteIcon, FieldErrorMessage, FieldLabel, FileCard, FilterConditionDTO, FilterDTO, FiltersStore, FloatingAside, FloatingChatController, FooterButtons, FooterResponsiveButtons, HamburguerMenu, Header, HeaderButtons, IconButton, IconInput, IconsList, Label, LabelBox, LinearLoader, LinearSpinnerLock, ListSkeletonLoader, Listbox, ListboxItem, LoaderSpinner, MDRenderer$1 as MDRenderer, MessageBlock$1 as MessageBlock, MessageBlocks$1 as MessageBlocks, Modal, NumberInput, Overlay, Pagination, Parameter, ParameterRender, Parameters, ParametersGroup, ParametersStore, ParametersTable, ProgressBar, RequiredMark, ScreenLocker, ShowResponsive, SimpleButton, SortableList, SortableListItem, Tab, Tabs, TabsContent, TabsController, TabsList, Templater, Toolbar, ToolbarController, ToolbarIconButton, ToolbarInput, ToolbarSelect, ToolbarSeparator, ToolbarTextButton, UnstyledSortableList, UploadHandler, Uploader, WaiTypeAhead, getBase64FromBlob, getBase64FromFile, getFieldErrorStyles, getFieldTouchedStyles, getFileExtension, importComponent, isFavoriteIcon, isImage, isParametersGroup, makeResponsiveComponent, menuController, parseNumberInputValueToNumber, parseNumberValueToNumberInput, useAccordionContext, useCurrentTab, useMenu, useModal, useModalContext, useOtherTagButton, useTabsContext };
|
|
12018
12021
|
//# sourceMappingURL=index.js.map
|