@deviceinsight/ng-ui-components 7.22.0 → 7.24.0
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/README.md +104 -9
- package/dist/index.cjs +161 -165
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +161 -165
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -3
- package/dist/types/__mocks__/i18n.d.ts.map +1 -1
- package/dist/types/components/chart/Chart.d.ts +11 -3
- package/dist/types/components/chart/Chart.d.ts.map +1 -1
- package/dist/types/components/chart/Chart.stories.d.ts +7 -7
- package/dist/types/components/chart/Chart.stories.d.ts.map +1 -1
- package/dist/types/components/colorpicker/ColorTextInput.d.ts.map +1 -1
- package/dist/types/components/colorpicker/GradientColorPicker.stories.d.ts.map +1 -1
- package/dist/types/components/colorpicker/GridColorPicker.stories.d.ts.map +1 -1
- package/dist/types/components/contentHeader/ContentHeader.d.ts.map +1 -1
- package/dist/types/components/contentHeader/ContentHeader.stories.d.ts.map +1 -1
- package/dist/types/components/infobox/InfoBox.d.ts.map +1 -1
- package/dist/types/components/infobox/InfoBox.stories.d.ts.map +1 -1
- package/dist/types/components/input/DateInput.d.ts.map +1 -1
- package/dist/types/components/input/DateInput.stories.d.ts +2 -1
- package/dist/types/components/input/DateInput.stories.d.ts.map +1 -1
- package/dist/types/components/input/DateTimeInput.d.ts.map +1 -1
- package/dist/types/components/input/DateTimeInput.stories.d.ts +12 -11
- package/dist/types/components/input/DateTimeInput.stories.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearch.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearch.stories.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearchAsync.d.ts +5 -1
- package/dist/types/components/input/SelectWithSearchAsync.d.ts.map +1 -1
- package/dist/types/components/input/SelectWithSearchAsync.stories.d.ts.map +1 -1
- package/dist/types/components/input/UrnInput.d.ts.map +1 -1
- package/dist/types/components/input/UrnInput.stories.d.ts.map +1 -1
- package/dist/types/components/input/ValidatedTextInput.d.ts.map +1 -1
- package/dist/types/components/input/ValidatedTextInput.stories.d.ts.map +1 -1
- package/dist/types/components/link/RouteLink.stories.d.ts.map +1 -1
- package/dist/types/components/multiMenu/MultiMenu.stories.d.ts.map +1 -1
- package/dist/types/components/multiMenu/components/MultiMenuContext.d.ts.map +1 -1
- package/dist/types/components/multiMenu/components/MultiMenuItem.d.ts.map +1 -1
- package/dist/types/components/pagination/Pagination.d.ts.map +1 -1
- package/dist/types/components/pagination/Pagination.stories.d.ts.map +1 -1
- package/dist/types/components/periodpicker/PeriodPicker.stories.d.ts.map +1 -1
- package/dist/types/components/periodpicker/components/MonthPicker.d.ts.map +1 -1
- package/dist/types/components/periodpicker/periods.d.ts.map +1 -1
- package/dist/types/components/prompt/Prompt.stories.d.ts.map +1 -1
- package/dist/types/components/reactable/Reactable.d.ts.map +1 -1
- package/dist/types/components/reactable/Reactable.stories.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableFilterRow.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableHeader.d.ts +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableHeader.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTableRow.d.ts.map +1 -1
- package/dist/types/components/reactable/helpers/ReactableTextFilter.d.ts.map +1 -1
- package/dist/types/components/reactableWithClientSidePagination/ReactableWithClientSidePagination.d.ts +7 -1
- package/dist/types/components/reactableWithClientSidePagination/ReactableWithClientSidePagination.d.ts.map +1 -1
- package/dist/types/components/reactableWithClientSidePagination/ReactableWithClientSidePagination.stories.d.ts.map +1 -1
- package/dist/types/components/slider/RcSliderWithTooltip.d.ts.map +1 -1
- package/dist/types/components/slider/Slider.d.ts.map +1 -1
- package/dist/types/components/slider/Slider.stories.d.ts.map +1 -1
- package/dist/types/components/svg/SvgImage.d.ts.map +1 -1
- package/dist/types/components/svg/SvgImage.stories.d.ts.map +1 -1
- package/dist/types/components/svg/utils/getMutableNodeList.d.ts.map +1 -1
- package/dist/types/components/svg/utils/getSvgElement.d.ts +1 -1
- package/dist/types/components/svg/utils/getSvgElement.d.ts.map +1 -1
- package/dist/types/components/svg/utils/transformPositionModifications.d.ts +1 -1
- package/dist/types/components/svg/utils/transformPositionModifications.d.ts.map +1 -1
- package/dist/types/components/svg/utils/validateSvg.d.ts +1 -1
- package/dist/types/components/svg/utils/validateSvg.d.ts.map +1 -1
- package/dist/types/components/tabs/RouteTabs.stories.d.ts.map +1 -1
- package/dist/types/components/treeview/TreeView.d.ts +9 -4
- package/dist/types/components/treeview/TreeView.d.ts.map +1 -1
- package/dist/types/components/treeview/TreeView.stories.d.ts.map +1 -1
- package/dist/types/components/treeview/components/Node.d.ts +2 -5
- package/dist/types/components/treeview/components/Node.d.ts.map +1 -1
- package/dist/types/components/treeview/components/NodeInfo.d.ts.map +1 -1
- package/dist/types/components/upload/FileUpload.d.ts.map +1 -1
- package/dist/types/components/upload/FileUpload.stories.d.ts.map +1 -1
- package/dist/types/components/upload/ImageUpload.d.ts +2 -2
- package/dist/types/components/upload/ImageUpload.d.ts.map +1 -1
- package/dist/types/components/upload/ImageUpload.stories.d.ts +11 -11
- package/dist/types/components/upload/ImageUpload.stories.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/messageBox/MessageBox.stories.d.ts.map +1 -1
- package/dist/types/modules/messageBox/messageBox.d.ts.map +1 -1
- package/dist/types/modules/utils/uuidGen.d.ts.map +1 -1
- package/package.json +24 -28
package/dist/index.cjs
CHANGED
|
@@ -17,7 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
21
21
|
value: mod,
|
|
22
22
|
enumerable: true
|
|
23
23
|
}) : target, mod));
|
|
@@ -94,8 +94,10 @@ var setGlobalErrorMessageBoxOptions = (options) => {
|
|
|
94
94
|
globalErrorMessageBoxOptions = options;
|
|
95
95
|
};
|
|
96
96
|
var storeGroupName = (groupName, toastId) => {
|
|
97
|
-
if (groupName)
|
|
98
|
-
|
|
97
|
+
if (groupName) {
|
|
98
|
+
if (groupNamesToToastIds[groupName]) groupNamesToToastIds[groupName] = [...groupNamesToToastIds[groupName], toastId];
|
|
99
|
+
else groupNamesToToastIds[groupName] = [toastId];
|
|
100
|
+
}
|
|
99
101
|
};
|
|
100
102
|
var messageBoxSuccess = (content, options, groupName) => {
|
|
101
103
|
const toastId = react_toastify_unstyled.toast.success(content, {
|
|
@@ -271,8 +273,10 @@ function convertToTree({ childNodeKey, idKey, displayNameKey, typeKey, lazyLoada
|
|
|
271
273
|
*/
|
|
272
274
|
function patchNode(node, patch) {
|
|
273
275
|
let patchedChildren;
|
|
274
|
-
if (patch.children !== void 0)
|
|
275
|
-
|
|
276
|
+
if (patch.children !== void 0) {
|
|
277
|
+
if (node.children !== void 0) patchedChildren = [...node.children, ...patch.children];
|
|
278
|
+
else patchedChildren = [...patch.children];
|
|
279
|
+
}
|
|
276
280
|
return {
|
|
277
281
|
...node,
|
|
278
282
|
...patch,
|
|
@@ -411,9 +415,11 @@ var ValidatedTextInput = class extends react.Component {
|
|
|
411
415
|
//#region src/components/colorpicker/ColorTextInput.tsx
|
|
412
416
|
function ColorTextInput({ value, pattern, onChange, placeholder, style }) {
|
|
413
417
|
const [text, setText] = (0, react.useState)(value);
|
|
414
|
-
(0, react.
|
|
418
|
+
const [lastValue, setLastValue] = (0, react.useState)(value);
|
|
419
|
+
if (value !== lastValue) {
|
|
420
|
+
setLastValue(value);
|
|
415
421
|
setText(value);
|
|
416
|
-
}
|
|
422
|
+
}
|
|
417
423
|
function handleChange(value, valid) {
|
|
418
424
|
setText(value);
|
|
419
425
|
if (valid) onChange(value);
|
|
@@ -544,9 +550,7 @@ function inputToTzDate(value, pattern, timezone) {
|
|
|
544
550
|
var DateInput = (0, react.forwardRef)(({ value, clearable, inline, readOnly, wrapperClassName, onChange, locale, timezone, ...otherProps }, ref) => {
|
|
545
551
|
const [pattern, setPattern] = (0, react.useState)(dayjs.default.localeData().longDateFormat("L"));
|
|
546
552
|
const { t } = useTranslation();
|
|
547
|
-
const [valid, setValid] = (0, react.useState)(false);
|
|
548
553
|
const [popupOpen, setPopupOpen] = (0, react.useState)(false);
|
|
549
|
-
const [inputText, setInputText] = (0, react.useState)("");
|
|
550
554
|
const debouncedSetPopupActive = (0, react.useMemo)(() => (0, lodash.debounce)(setPopupOpen, 30), []);
|
|
551
555
|
(0, react.useEffect)(() => {
|
|
552
556
|
const language = locale ?? i18next.default.language;
|
|
@@ -564,17 +568,22 @@ var DateInput = (0, react.forwardRef)(({ value, clearable, inline, readOnly, wra
|
|
|
564
568
|
t,
|
|
565
569
|
timezone
|
|
566
570
|
]);
|
|
567
|
-
(0, react.
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
571
|
+
const [valid, setValid] = (0, react.useState)(() => isInputValid(value, pattern));
|
|
572
|
+
const [inputText, setInputText] = (0, react.useState)(() => value == null ? "" : formattedDate(value));
|
|
573
|
+
const [lastInput, setLastInput] = (0, react.useState)({
|
|
574
|
+
value,
|
|
575
|
+
pattern,
|
|
576
|
+
timezone
|
|
577
|
+
});
|
|
578
|
+
if (!Object.is(value, lastInput.value) || pattern !== lastInput.pattern || timezone !== lastInput.timezone) {
|
|
579
|
+
setLastInput({
|
|
580
|
+
value,
|
|
581
|
+
pattern,
|
|
582
|
+
timezone
|
|
583
|
+
});
|
|
584
|
+
setInputText(value == null ? "" : formattedDate(value));
|
|
572
585
|
setValid(isInputValid(value, pattern));
|
|
573
|
-
}
|
|
574
|
-
(0, react.useEffect)(() => {
|
|
575
|
-
dayjs.default.locale(locale ?? i18next.default.language);
|
|
576
|
-
setPattern(dayjs.default.localeData().longDateFormat("L"));
|
|
577
|
-
}, [locale]);
|
|
586
|
+
}
|
|
578
587
|
const handleInputTextChange = (text) => {
|
|
579
588
|
setInputText(text);
|
|
580
589
|
if (text) {
|
|
@@ -837,8 +846,9 @@ function RouteLink({ to, confirm, className, title, children, keyboardShortcut,
|
|
|
837
846
|
pushRoute();
|
|
838
847
|
}
|
|
839
848
|
};
|
|
849
|
+
const href = history.createHref(typeof to === "string" ? { pathname: to } : to);
|
|
840
850
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
841
|
-
href
|
|
851
|
+
href,
|
|
842
852
|
onClick: handleClickEvent,
|
|
843
853
|
className: `di route-link ${className || ""}`,
|
|
844
854
|
title: title ? t(title.id, { defaultValue: title.defaultValue }) : void 0,
|
|
@@ -1079,8 +1089,9 @@ var NodeInfo = class extends react.PureComponent {
|
|
|
1079
1089
|
}
|
|
1080
1090
|
render() {
|
|
1081
1091
|
const { node, node: { name }, leafNode, expanded, isLastChild, onExpand, selectionState, isLoading } = this.props;
|
|
1092
|
+
const selected = selectionState === SelectionState.ALL;
|
|
1082
1093
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1083
|
-
className: `node-info ${
|
|
1094
|
+
className: `node-info ${selected ? "selected" : ""}`,
|
|
1084
1095
|
children: [
|
|
1085
1096
|
isLastChild !== void 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Skeleton, { lastChild: isLastChild }),
|
|
1086
1097
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeImage, {
|
|
@@ -1114,7 +1125,6 @@ var Node = class Node extends react.Component {
|
|
|
1114
1125
|
super(..._args);
|
|
1115
1126
|
this.state = {
|
|
1116
1127
|
expanded: false,
|
|
1117
|
-
selectionState: this.getSelectionState(),
|
|
1118
1128
|
isLoading: false
|
|
1119
1129
|
};
|
|
1120
1130
|
this.toggleExpand = () => {
|
|
@@ -1140,28 +1150,23 @@ var Node = class Node extends react.Component {
|
|
|
1140
1150
|
* @param {Props} prevProps
|
|
1141
1151
|
* @param {State} prevState
|
|
1142
1152
|
*/
|
|
1143
|
-
shouldComponentUpdate(
|
|
1144
|
-
const { selectedNodes:
|
|
1145
|
-
const { expanded:
|
|
1153
|
+
shouldComponentUpdate(nextProps, nextState) {
|
|
1154
|
+
const { selectedNodes: nextSelectedNodes, treeSize: nextTreeSize } = nextProps;
|
|
1155
|
+
const { expanded: nextExpanded, isLoading: nextIsLoading } = nextState;
|
|
1146
1156
|
const { selectedNodes, node, treeSize } = this.props;
|
|
1147
|
-
const { expanded,
|
|
1148
|
-
|
|
1149
|
-
if (
|
|
1150
|
-
if (
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
componentDidMount() {
|
|
1154
|
-
this.setState({ selectionState: this.getSelectionState() });
|
|
1155
|
-
}
|
|
1156
|
-
componentDidUpdate() {
|
|
1157
|
-
this.setState({ selectionState: this.getSelectionState() });
|
|
1157
|
+
const { expanded, isLoading } = this.state;
|
|
1158
|
+
const selectionStateChanged = this.getSelectionState(this.props) !== this.getSelectionState(nextProps);
|
|
1159
|
+
if (isLoading !== nextIsLoading) return true;
|
|
1160
|
+
if (treeSize !== nextTreeSize) return true;
|
|
1161
|
+
if (this.isLeaf()) return selectedNodes.includes(node.id) && !nextSelectedNodes.includes(node.id) || !selectedNodes.includes(node.id) && nextSelectedNodes.includes(node.id) || selectionStateChanged;
|
|
1162
|
+
else return selectedNodes.length !== nextSelectedNodes.length || expanded !== nextExpanded || selectionStateChanged;
|
|
1158
1163
|
}
|
|
1159
1164
|
isLeaf() {
|
|
1160
1165
|
const { node } = this.props;
|
|
1161
1166
|
return node.children === void 0;
|
|
1162
1167
|
}
|
|
1163
|
-
getSelectionState() {
|
|
1164
|
-
const { node, selectedNodes } =
|
|
1168
|
+
getSelectionState(props = this.props) {
|
|
1169
|
+
const { node, selectedNodes } = props;
|
|
1165
1170
|
if (this.isLeaf()) return selectedNodes.includes(node.id) ? SelectionState.ALL : SelectionState.NONE;
|
|
1166
1171
|
else {
|
|
1167
1172
|
const leafIds = getAllLeafIds(node);
|
|
@@ -1173,7 +1178,8 @@ var Node = class Node extends react.Component {
|
|
|
1173
1178
|
}
|
|
1174
1179
|
render() {
|
|
1175
1180
|
const { node, isLastChild, ...commonNodeProps } = this.props;
|
|
1176
|
-
const { expanded,
|
|
1181
|
+
const { expanded, isLoading } = this.state;
|
|
1182
|
+
const selectionState = this.getSelectionState();
|
|
1177
1183
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1178
1184
|
className: "node",
|
|
1179
1185
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(NodeInfo, {
|
|
@@ -1204,19 +1210,15 @@ var Node = class Node extends react.Component {
|
|
|
1204
1210
|
var TreeView = class extends react.Component {
|
|
1205
1211
|
constructor(..._args) {
|
|
1206
1212
|
super(..._args);
|
|
1213
|
+
this.convert = convertToTree(this.props.dataSetConfig);
|
|
1214
|
+
this.initialTree = this.initTree(this.props.treeData);
|
|
1207
1215
|
this.state = {
|
|
1208
1216
|
treeData: this.props.treeData,
|
|
1209
|
-
tree:
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
path: "/",
|
|
1214
|
-
originalNode: {}
|
|
1215
|
-
},
|
|
1216
|
-
treeSize: 0,
|
|
1217
|
-
selectedNodes: this.props.selectedNodes || []
|
|
1217
|
+
tree: this.initialTree,
|
|
1218
|
+
treeSize: getTreeSize(this.initialTree),
|
|
1219
|
+
selectedNodes: this.props.selectedNodes || [],
|
|
1220
|
+
lastSelectedNodes: this.props.selectedNodes || []
|
|
1218
1221
|
};
|
|
1219
|
-
this.convert = convertToTree(this.props.dataSetConfig);
|
|
1220
1222
|
this.selectNodes = (nodes) => {
|
|
1221
1223
|
const { onSelect } = this.props;
|
|
1222
1224
|
const { selectedNodes } = this.state;
|
|
@@ -1264,19 +1266,15 @@ var TreeView = class extends react.Component {
|
|
|
1264
1266
|
});
|
|
1265
1267
|
};
|
|
1266
1268
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
componentDidUpdate(prevProps) {
|
|
1277
|
-
const { selectedNodes: prevNodes } = prevProps;
|
|
1278
|
-
const { selectedNodes } = this.props;
|
|
1279
|
-
if (selectedNodes && prevNodes && prevNodes.length !== selectedNodes.length) this.setState({ selectedNodes });
|
|
1269
|
+
static {
|
|
1270
|
+
this.getDerivedStateFromProps = (props, state) => {
|
|
1271
|
+
const { selectedNodes } = props;
|
|
1272
|
+
if (selectedNodes && selectedNodes.length !== state.lastSelectedNodes.length) return {
|
|
1273
|
+
selectedNodes,
|
|
1274
|
+
lastSelectedNodes: selectedNodes
|
|
1275
|
+
};
|
|
1276
|
+
return null;
|
|
1277
|
+
};
|
|
1280
1278
|
}
|
|
1281
1279
|
initTree(treeData) {
|
|
1282
1280
|
return {
|
|
@@ -1353,9 +1351,11 @@ function Pagination({ onChangePage, page, totalPages, onChangeSize, size }) {
|
|
|
1353
1351
|
(0, react.useEffect)(() => {
|
|
1354
1352
|
changePageDebouncedRef.current = (0, lodash.debounce)(onChangePage, 500);
|
|
1355
1353
|
}, [onChangePage]);
|
|
1356
|
-
(0, react.
|
|
1354
|
+
const [lastPage, setLastPage] = (0, react.useState)(page);
|
|
1355
|
+
if (page !== lastPage) {
|
|
1356
|
+
setLastPage(page);
|
|
1357
1357
|
setPageRaw(`${page + 1}`);
|
|
1358
|
-
}
|
|
1358
|
+
}
|
|
1359
1359
|
function goToFirstPage() {
|
|
1360
1360
|
onChangePage(0);
|
|
1361
1361
|
}
|
|
@@ -1575,8 +1575,10 @@ var SelectWithSearch = class extends react.Component {
|
|
|
1575
1575
|
value: this.state.inputValue,
|
|
1576
1576
|
label: this.state.inputValue
|
|
1577
1577
|
};
|
|
1578
|
-
this.setState((prevState) => ({
|
|
1579
|
-
|
|
1578
|
+
this.setState((prevState) => ({
|
|
1579
|
+
options: [newItem, ...prevState.options],
|
|
1580
|
+
inputValue: null
|
|
1581
|
+
}));
|
|
1580
1582
|
onChange(newItem);
|
|
1581
1583
|
});
|
|
1582
1584
|
}
|
|
@@ -1783,10 +1785,12 @@ var ReactableTableHeader = class extends react.Component {
|
|
|
1783
1785
|
this.getClassName = (columnDef) => {
|
|
1784
1786
|
const { paginationSettings, tableName } = this.props;
|
|
1785
1787
|
const className = getClassName(tableName, columnDef.name);
|
|
1786
|
-
if (columnDef.sortable)
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1788
|
+
if (columnDef.sortable) {
|
|
1789
|
+
if (columnDef.name === paginationSettings.sort.property) {
|
|
1790
|
+
if (paginationSettings.sort.direction === "ASC") return `${className} sortable sortAsc`;
|
|
1791
|
+
else return `${className} sortable sortDes`;
|
|
1792
|
+
} else return `${className} sortable`;
|
|
1793
|
+
} else return `${className}`;
|
|
1790
1794
|
};
|
|
1791
1795
|
this.printLabel = (label) => {
|
|
1792
1796
|
if (isTranslationDescriptor(label)) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Trans, {
|
|
@@ -2074,17 +2078,19 @@ var ReactableWithClientSidePagination = class extends react.Component {
|
|
|
2074
2078
|
};
|
|
2075
2079
|
this.handleSelectChange = (selected, item) => {
|
|
2076
2080
|
const { onSelectedItemsChange, selectedItems = [], uniqueItemKey } = this.props;
|
|
2077
|
-
if (onSelectedItemsChange)
|
|
2078
|
-
|
|
2079
|
-
|
|
2081
|
+
if (onSelectedItemsChange) {
|
|
2082
|
+
if (selected) onSelectedItemsChange(selectedItems.concat(uniqueItemKey(item)));
|
|
2083
|
+
else onSelectedItemsChange(selectedItems.filter((key) => key !== uniqueItemKey(item)));
|
|
2084
|
+
} else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
|
|
2080
2085
|
};
|
|
2081
2086
|
this.handleSelectAllChange = (selectedAll) => {
|
|
2082
2087
|
const { onSelectedItemsChange, items, selectedItems = [], uniqueItemKey } = this.props;
|
|
2083
2088
|
const { filteredItems } = this.state;
|
|
2084
2089
|
const visibleItems = (filteredItems || items || []).map(uniqueItemKey);
|
|
2085
|
-
if (onSelectedItemsChange)
|
|
2086
|
-
|
|
2087
|
-
|
|
2090
|
+
if (onSelectedItemsChange) {
|
|
2091
|
+
if (selectedAll) onSelectedItemsChange((0, lodash.uniqWith)([...selectedItems, ...visibleItems], lodash.isEqual).sort());
|
|
2092
|
+
else onSelectedItemsChange((0, lodash.difference)(selectedItems, visibleItems));
|
|
2093
|
+
} else console.warn("ReactableWithClientSidePagination: onSelectedItemsChange property is missing");
|
|
2088
2094
|
};
|
|
2089
2095
|
this.areSelectedAll = () => {
|
|
2090
2096
|
const { items, selectedItems, uniqueItemKey } = this.props;
|
|
@@ -2100,21 +2106,33 @@ var ReactableWithClientSidePagination = class extends react.Component {
|
|
|
2100
2106
|
this.state = {
|
|
2101
2107
|
paginationSettings: paginationSettings || DEFAULT_PAGINATION_SETTINGS,
|
|
2102
2108
|
filterSettings: {},
|
|
2103
|
-
filteredItems: null
|
|
2109
|
+
filteredItems: null,
|
|
2110
|
+
lastSettings: paginationSettings
|
|
2104
2111
|
};
|
|
2105
2112
|
}
|
|
2106
2113
|
componentDidUpdate(prevProps) {
|
|
2107
2114
|
const { items } = this.props;
|
|
2108
2115
|
const { items: prevItems } = prevProps;
|
|
2109
|
-
const settings = this.props.paginationSettings || this.props.initialPaginationSettings;
|
|
2110
|
-
const prevSettings = prevProps.paginationSettings || prevProps.initialPaginationSettings;
|
|
2111
2116
|
if (items && prevItems && items.length !== prevItems.length) this.calculatePageNumber(items, this.state.paginationSettings);
|
|
2112
|
-
|
|
2117
|
+
}
|
|
2118
|
+
static {
|
|
2119
|
+
this.getDerivedStateFromProps = (props, state) => {
|
|
2120
|
+
const settings = props.paginationSettings || props.initialPaginationSettings;
|
|
2121
|
+
if (settings && !(0, lodash.isEqual)(settings, state.lastSettings)) return {
|
|
2122
|
+
lastSettings: settings,
|
|
2123
|
+
paginationSettings: {
|
|
2124
|
+
...settings,
|
|
2125
|
+
page: 0
|
|
2126
|
+
}
|
|
2127
|
+
};
|
|
2128
|
+
return null;
|
|
2129
|
+
};
|
|
2113
2130
|
}
|
|
2114
2131
|
render() {
|
|
2115
2132
|
const { uniqueItemKey, isLoading, columnDefs, rowDef, tableName, clickable, selectable, selectedItems, onChangeSize } = this.props;
|
|
2133
|
+
const finalColumnDefs = selectable ? extendColumnDefsWithCheckboxes(columnDefs, this.handleSelectChange, this.handleSelectAllChange, this.areSelectedAll(), selectedItems || [], uniqueItemKey) : columnDefs;
|
|
2116
2134
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Reactable, {
|
|
2117
|
-
columnDefs:
|
|
2135
|
+
columnDefs: finalColumnDefs,
|
|
2118
2136
|
rowDef,
|
|
2119
2137
|
uniqueItemKey,
|
|
2120
2138
|
paginationSettings: this.state.paginationSettings,
|
|
@@ -2292,20 +2310,17 @@ var ImageUpload = class extends react.Component {
|
|
|
2292
2310
|
constructor(..._args) {
|
|
2293
2311
|
super(..._args);
|
|
2294
2312
|
this.state = {
|
|
2295
|
-
|
|
2313
|
+
dragOverUrl: void 0,
|
|
2296
2314
|
file: null
|
|
2297
2315
|
};
|
|
2298
2316
|
this.handleDragOver = () => {
|
|
2299
|
-
this.setState({
|
|
2317
|
+
this.setState({ dragOverUrl: this.props.imageUrl });
|
|
2300
2318
|
};
|
|
2301
2319
|
}
|
|
2302
|
-
componentDidUpdate(prevProps) {
|
|
2303
|
-
if (prevProps.imageUrl !== this.props.imageUrl) this.setState({ dragOverPreview: false });
|
|
2304
|
-
}
|
|
2305
2320
|
render() {
|
|
2306
2321
|
const { accept, imageUrl, imageSize, onSelectFile, onRemoveFile, onDownloadFile, ...otherProps } = this.props;
|
|
2307
|
-
const {
|
|
2308
|
-
if (imageUrl && !
|
|
2322
|
+
const { dragOverUrl, file } = this.state;
|
|
2323
|
+
if (imageUrl && !(dragOverUrl !== void 0 && dragOverUrl === imageUrl) && file) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PreviewImage, {
|
|
2309
2324
|
url: imageUrl,
|
|
2310
2325
|
imageSize,
|
|
2311
2326
|
onRemoveFile: () => onRemoveFile?.(file),
|
|
@@ -2315,7 +2330,10 @@ var ImageUpload = class extends react.Component {
|
|
|
2315
2330
|
else return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FileUpload, {
|
|
2316
2331
|
...otherProps,
|
|
2317
2332
|
onRemoveFile: (file) => {
|
|
2318
|
-
this.setState({
|
|
2333
|
+
this.setState({
|
|
2334
|
+
file: null,
|
|
2335
|
+
dragOverUrl: void 0
|
|
2336
|
+
});
|
|
2319
2337
|
onRemoveFile?.(file);
|
|
2320
2338
|
},
|
|
2321
2339
|
onSelectFile: (file) => {
|
|
@@ -2394,9 +2412,17 @@ var formatTime = (timezone, date) => {
|
|
|
2394
2412
|
var DateTimeInput = (0, react.forwardRef)(({ timestamp, timezone, warning, readOnly = false, onChange, ...otherProps }, ref) => {
|
|
2395
2413
|
const [time, setTime] = (0, react.useState)(formatTime(timezone, timestamp));
|
|
2396
2414
|
const timeValue = time == null ? formatTime(timezone, timestamp) : time;
|
|
2397
|
-
(0, react.
|
|
2415
|
+
const [lastInput, setLastInput] = (0, react.useState)({
|
|
2416
|
+
timestamp,
|
|
2417
|
+
timezone
|
|
2418
|
+
});
|
|
2419
|
+
if (timestamp !== lastInput.timestamp || timezone !== lastInput.timezone) {
|
|
2420
|
+
setLastInput({
|
|
2421
|
+
timestamp,
|
|
2422
|
+
timezone
|
|
2423
|
+
});
|
|
2398
2424
|
setTime(formatTime(timezone, timestamp));
|
|
2399
|
-
}
|
|
2425
|
+
}
|
|
2400
2426
|
function handleChangeDate(date, fromTextField) {
|
|
2401
2427
|
const currentDate = dayjs.default.tz(timestamp, timezone);
|
|
2402
2428
|
onChange(dayjs.default.tz(date, timezone).set("hour", currentDate.hour()).set("minute", currentDate.minute()).set("second", currentDate.second()).set("millisecond", currentDate.millisecond()).valueOf(), fromTextField);
|
|
@@ -2515,7 +2541,13 @@ var SelectWithSearchAsync = class extends react.Component {
|
|
|
2515
2541
|
const { currentItem } = this.state;
|
|
2516
2542
|
if (value && (!currentItem || currentItem.value !== value)) {
|
|
2517
2543
|
if (!this.reloadItemFromCache()) searchById(value).then(this.addBackendItemToCache);
|
|
2518
|
-
}
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
static {
|
|
2547
|
+
this.getDerivedStateFromProps = (props, state) => {
|
|
2548
|
+
if (!props.value && state.currentItem) return { currentItem: null };
|
|
2549
|
+
return null;
|
|
2550
|
+
};
|
|
2519
2551
|
}
|
|
2520
2552
|
render() {
|
|
2521
2553
|
const { clearable, noResultsMessage, disabled, menuPortalTarget } = this.props;
|
|
@@ -2582,7 +2614,7 @@ var MultiMenuItem = class extends react.PureComponent {
|
|
|
2582
2614
|
};
|
|
2583
2615
|
//#endregion
|
|
2584
2616
|
//#region src/components/periodpicker/components/Inputs.tsx
|
|
2585
|
-
var ONE_HOUR =
|
|
2617
|
+
var ONE_HOUR = 36e5;
|
|
2586
2618
|
function Inputs({ period, onChange, readOnly, locale, timezone }) {
|
|
2587
2619
|
const [showWarningTarget, setShowWarningTarget] = (0, react.useState)("");
|
|
2588
2620
|
const warningTimeoutRef = (0, react.useRef)(void 0);
|
|
@@ -2791,7 +2823,7 @@ function createLastXDays(days, timezone) {
|
|
|
2791
2823
|
tsEnd: (0, dayjs.default)().endOf("day").valueOf()
|
|
2792
2824
|
};
|
|
2793
2825
|
}
|
|
2794
|
-
var DAY_TO_MILLIS =
|
|
2826
|
+
var DAY_TO_MILLIS = 864e5;
|
|
2795
2827
|
function periodToDays({ tsStart, tsEnd }) {
|
|
2796
2828
|
return Math.round((tsEnd - tsStart + 1) / DAY_TO_MILLIS);
|
|
2797
2829
|
}
|
|
@@ -2801,7 +2833,7 @@ function Menu({ onChange, onShowCustomPeriod, periodName, timezone }) {
|
|
|
2801
2833
|
const [visible, setVisible] = (0, react.useState)(false);
|
|
2802
2834
|
const [showDatePicker, setShowDatePicker] = (0, react.useState)(false);
|
|
2803
2835
|
const [showMonthPicker, setShowMonthPicker] = (0, react.useState)(false);
|
|
2804
|
-
const [datePickerDate, setDatePickerDate] = (0, react.useState)(Date.now());
|
|
2836
|
+
const [datePickerDate, setDatePickerDate] = (0, react.useState)(() => Date.now());
|
|
2805
2837
|
function setPeriod(period) {
|
|
2806
2838
|
onChange(period);
|
|
2807
2839
|
setVisible(false);
|
|
@@ -3227,17 +3259,18 @@ function sortModifications(modifications) {
|
|
|
3227
3259
|
//#endregion
|
|
3228
3260
|
//#region src/components/svg/SvgImage.tsx
|
|
3229
3261
|
function useGlobalStyleElement() {
|
|
3230
|
-
const
|
|
3262
|
+
const [styleElement] = (0, react.useState)(() => {
|
|
3263
|
+
const element = document.createElement("style");
|
|
3264
|
+
element.appendChild(document.createTextNode(""));
|
|
3265
|
+
return element;
|
|
3266
|
+
});
|
|
3231
3267
|
(0, react.useEffect)(() => {
|
|
3232
|
-
const styleElement = document.createElement("style");
|
|
3233
|
-
styleElement.appendChild(document.createTextNode(""));
|
|
3234
3268
|
if (document && document.head) document.head.appendChild(styleElement);
|
|
3235
|
-
styleElementRef.current = styleElement;
|
|
3236
3269
|
return () => {
|
|
3237
|
-
if (document && document.head
|
|
3270
|
+
if (document && document.head) document.head.removeChild(styleElement);
|
|
3238
3271
|
};
|
|
3239
|
-
}, []);
|
|
3240
|
-
return
|
|
3272
|
+
}, [styleElement]);
|
|
3273
|
+
return styleElement;
|
|
3241
3274
|
}
|
|
3242
3275
|
function SvgImage({ imageData, modifications, onConflict }) {
|
|
3243
3276
|
const svgWrapperRef = (0, react.useRef)(null);
|
|
@@ -3326,9 +3359,10 @@ var getClickConfiguration = (onClick) => {
|
|
|
3326
3359
|
var Chart = class extends react.Component {
|
|
3327
3360
|
constructor(..._args) {
|
|
3328
3361
|
super(..._args);
|
|
3329
|
-
this.state = {};
|
|
3362
|
+
this.state = { titleApplied: false };
|
|
3330
3363
|
this.chart = null;
|
|
3331
3364
|
this.ro = null;
|
|
3365
|
+
this.titleTimeoutId = void 0;
|
|
3332
3366
|
this.handleChart = (chart) => {
|
|
3333
3367
|
this.chart = chart;
|
|
3334
3368
|
this.ro = new ResizeObserver(() => {
|
|
@@ -3338,8 +3372,16 @@ var Chart = class extends react.Component {
|
|
|
3338
3372
|
};
|
|
3339
3373
|
}
|
|
3340
3374
|
componentDidMount() {
|
|
3375
|
+
this.titleTimeoutId = setTimeout(() => this.setState({ titleApplied: true }), 0);
|
|
3376
|
+
}
|
|
3377
|
+
/**
|
|
3378
|
+
* Builds the Highcharts configuration from the props. Everything here is derived, so it is
|
|
3379
|
+
* rebuilt while rendering rather than mirrored into state.
|
|
3380
|
+
*/
|
|
3381
|
+
buildOptions() {
|
|
3341
3382
|
const { type, title, items, tooltipTitle, valueFormatter, onClick } = this.props;
|
|
3342
|
-
this.
|
|
3383
|
+
const { titleApplied } = this.state;
|
|
3384
|
+
return {
|
|
3343
3385
|
...initialOptions,
|
|
3344
3386
|
plotOptions: {
|
|
3345
3387
|
...initialOptions.plotOptions,
|
|
@@ -3356,44 +3398,12 @@ var Chart = class extends react.Component {
|
|
|
3356
3398
|
...initialOptions.legend,
|
|
3357
3399
|
enabled: type === "pie"
|
|
3358
3400
|
},
|
|
3359
|
-
yAxis: {
|
|
3360
|
-
...initialOptions.yAxis,
|
|
3361
|
-
enabled: type === "column",
|
|
3362
|
-
title: { text: title || "" }
|
|
3363
|
-
},
|
|
3364
|
-
series: [{
|
|
3365
|
-
type,
|
|
3366
|
-
innerSize: "50%",
|
|
3367
|
-
data: items.map(({ label, value }) => [label, value])
|
|
3368
|
-
}]
|
|
3369
|
-
});
|
|
3370
|
-
setTimeout(() => {
|
|
3371
|
-
this.setState({ title: {
|
|
3372
|
-
...initialOptions.title,
|
|
3373
|
-
text: type === "column" ? "" : title || ""
|
|
3374
|
-
} });
|
|
3375
|
-
}, 0);
|
|
3376
|
-
}
|
|
3377
|
-
componentDidUpdate(prevProps) {
|
|
3378
|
-
const { type, title, items, tooltipTitle, valueFormatter, onClick } = this.props;
|
|
3379
|
-
if (title !== prevProps.title) this.setState({
|
|
3380
3401
|
title: {
|
|
3381
|
-
...
|
|
3382
|
-
text: type
|
|
3383
|
-
},
|
|
3384
|
-
yAxis: {
|
|
3385
|
-
...this.state.yAxis,
|
|
3386
|
-
title: { text: title || "" }
|
|
3387
|
-
}
|
|
3388
|
-
});
|
|
3389
|
-
if (type !== prevProps.type) this.setState({
|
|
3390
|
-
legend: {
|
|
3391
|
-
...this.state.legend,
|
|
3392
|
-
enabled: type === "pie"
|
|
3402
|
+
...initialOptions.title,
|
|
3403
|
+
text: titleApplied && type !== "column" ? title || "" : ""
|
|
3393
3404
|
},
|
|
3394
|
-
title: { text: type === "column" ? "" : title || "" },
|
|
3395
3405
|
yAxis: {
|
|
3396
|
-
...
|
|
3406
|
+
...initialOptions.yAxis,
|
|
3397
3407
|
enabled: type === "column",
|
|
3398
3408
|
title: { text: type === "column" ? title || "" : "" }
|
|
3399
3409
|
},
|
|
@@ -3402,35 +3412,20 @@ var Chart = class extends react.Component {
|
|
|
3402
3412
|
innerSize: "50%",
|
|
3403
3413
|
data: items.map(({ label, value }) => [label, value])
|
|
3404
3414
|
}]
|
|
3405
|
-
}
|
|
3406
|
-
if (!(0, lodash.isEqual)(items, prevProps.items)) this.setState({ series: [{
|
|
3407
|
-
type,
|
|
3408
|
-
innerSize: "50%",
|
|
3409
|
-
data: items.map(({ label, value }) => [label, value])
|
|
3410
|
-
}] });
|
|
3411
|
-
if (tooltipTitle !== prevProps.tooltipTitle || valueFormatter !== prevProps.valueFormatter || onClick !== prevProps.onClick) this.setState({
|
|
3412
|
-
tooltip: {
|
|
3413
|
-
...initialOptions.tooltip,
|
|
3414
|
-
formatter() {
|
|
3415
|
-
const format = valueFormatter || ((value) => value);
|
|
3416
|
-
return createTooltip(tooltipTitle || "", this.point.name, format(this.point.y));
|
|
3417
|
-
}
|
|
3418
|
-
},
|
|
3419
|
-
plotOptions: {
|
|
3420
|
-
...initialOptions.plotOptions,
|
|
3421
|
-
...getClickConfiguration(onClick)
|
|
3422
|
-
}
|
|
3423
|
-
});
|
|
3415
|
+
};
|
|
3424
3416
|
}
|
|
3425
3417
|
componentWillUnmount() {
|
|
3418
|
+
clearTimeout(this.titleTimeoutId);
|
|
3426
3419
|
if (this.ro && this.chart?.renderTo) this.ro.unobserve(this.chart.renderTo);
|
|
3427
3420
|
this.chart = null;
|
|
3428
3421
|
this.ro = null;
|
|
3429
3422
|
}
|
|
3430
3423
|
render() {
|
|
3424
|
+
const built = this.buildOptions();
|
|
3425
|
+
const options = this.props.updateOptions ? this.props.updateOptions(built) : built;
|
|
3431
3426
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(highcharts_react_official.default, {
|
|
3432
3427
|
highcharts: highcharts.default,
|
|
3433
|
-
options
|
|
3428
|
+
options,
|
|
3434
3429
|
containerProps: { className: this.props.className },
|
|
3435
3430
|
callback: this.handleChart
|
|
3436
3431
|
});
|
|
@@ -3527,12 +3522,13 @@ function useLimitStyling(limit, min, max) {
|
|
|
3527
3522
|
if (!containerEl) throw new Error(".rc-slider-rail element missing");
|
|
3528
3523
|
const disabledAreaEl = containerEl?.querySelector(`.disabled-area-element`);
|
|
3529
3524
|
const sliderWidth = containerEl.getBoundingClientRect().width;
|
|
3530
|
-
if (disabledAreaEl)
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3525
|
+
if (disabledAreaEl) {
|
|
3526
|
+
if (limit == null) disabledAreaEl.remove();
|
|
3527
|
+
else {
|
|
3528
|
+
const width = Math.round((max - limit) / (max - min) * sliderWidth);
|
|
3529
|
+
disabledAreaEl.style.width = `${width}px`;
|
|
3530
|
+
}
|
|
3531
|
+
} else if (limit != null) {
|
|
3536
3532
|
const width = Math.round((max - limit) / (max - min) * sliderWidth);
|
|
3537
3533
|
const disabledAreaEl = document.createElement("div");
|
|
3538
3534
|
disabledAreaEl.classList.add("disabled-area-element");
|