@gooddata/sdk-ui-metric-component 11.68.0-alpha.2 → 11.68.0-alpha.4
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/NOTICE +3 -3
- package/esm/MetricComponent/Form/Header/MetricIdField.d.ts.map +1 -1
- package/esm/MetricComponent/Form/Header/MetricIdField.js +5 -5
- package/esm/MetricComponent/Form/MaqlEditorField/MaqlEditorEditor.d.ts.map +1 -1
- package/esm/MetricComponent/Form/MaqlEditorField/MaqlEditorEditor.js +2 -2
- package/esm/MetricComponent/Form/MaqlResult/components/AttributesSelect.d.ts.map +1 -1
- package/esm/MetricComponent/Form/MaqlResult/components/AttributesSelect.js +3 -2
- package/esm/MetricComponent/Form/MaqlResult/components/LimitSelect.d.ts.map +1 -1
- package/esm/MetricComponent/Form/MaqlResult/components/LimitSelect.js +2 -2
- package/esm/MetricComponent/Form/hooks/useUniqIdGenerator.js +3 -3
- package/esm/MetricComponent/MetricState/hooks/useOnChangeCallback.d.ts.map +1 -1
- package/esm/MetricComponent/MetricState/hooks/useOnChangeCallback.js +4 -4
- package/esm/MetricComponent/hooks/useInitialValueMetric.js +2 -2
- package/esm/MetricComponent/hooks/useOnCloseOrCancel.d.ts.map +1 -1
- package/esm/MetricComponent/hooks/useOnCloseOrCancel.js +2 -2
- package/esm/shared/Form/Form.js +2 -2
- package/esm/shared/Form/utils.js +2 -2
- package/esm/shared/metrics/useMetricListData.events.d.ts.map +1 -1
- package/esm/shared/metrics/useMetricListData.events.js +3 -2
- package/package.json +17 -17
package/NOTICE
CHANGED
|
@@ -11,9 +11,9 @@ This product includes a number of subcomponents with separate copyright notices
|
|
|
11
11
|
|
|
12
12
|
The following 3rd-party software packages may be used by or distributed with gooddata-ui-sdk. Any information relevant to third-party vendors listed below are collected using common, reasonable means.
|
|
13
13
|
|
|
14
|
-
Date generated: 2026-11-
|
|
14
|
+
Date generated: 2026-11-6
|
|
15
15
|
|
|
16
|
-
Revision ID:
|
|
16
|
+
Revision ID: d5b83a8355edc9eec2ad7787276b02a1a676cb3f
|
|
17
17
|
|
|
18
18
|
================================================================================
|
|
19
19
|
================================================================================
|
|
@@ -69383,4 +69383,4 @@ MIT
|
|
|
69383
69383
|
--------------------------------------------------------------------------------
|
|
69384
69384
|
--------------------------------------------------------------------------------
|
|
69385
69385
|
|
|
69386
|
-
Report Generated by FOSSA on 2026-11-
|
|
69386
|
+
Report Generated by FOSSA on 2026-11-6
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MetricIdField.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/Form/Header/MetricIdField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MetricIdField.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/Form/Header/MetricIdField.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,OAAO,CAAC;AAmCvD,MAAM,WAAW,mBAAmB;IAChC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,aAAa,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,mBAAmB,GAAG,YAAY,GAAG,IAAI,CA0CnG;AAED,6FAA6F;AAC7F,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOjE"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2021-2026 GoodData Corporation
|
|
3
3
|
import { useCallback } from "react";
|
|
4
|
-
import { isEmpty } from "lodash-es";
|
|
5
4
|
import { useIntl } from "react-intl";
|
|
5
|
+
import { _isEmpty } from "@gooddata/util";
|
|
6
6
|
import { useEvents } from "../../../shared/eventing/useEvents.js";
|
|
7
7
|
import { makeStyles } from "../../../shared/theme/index.js";
|
|
8
8
|
import { validateIdPattern } from "../../metric/idValidator.js";
|
|
@@ -39,7 +39,7 @@ export function MetricIdField({ className, regenerateId }) {
|
|
|
39
39
|
const { trimOrSetDefaultIfEmpty } = useIdSanitizers(defaultId);
|
|
40
40
|
// The row holds before an id exists, so it fills in as the title is typed. Nothing to
|
|
41
41
|
// show and nothing to type into would render a bare "ID:".
|
|
42
|
-
if (
|
|
42
|
+
if (_isEmpty(value) && _isEmpty(defaultId) && (isLocked || isReadOnly)) {
|
|
43
43
|
return null;
|
|
44
44
|
}
|
|
45
45
|
return (_jsxs("div", { className: cx(classes.root, className, "s-edit_dialog_id"), children: ["ID:", " ", _jsx(InlineEditableValue, { prefix: prefix.value, className: classes.idRow, size: "small", minWidth: ID_MIN_WIDTH, revealOnHover: false, placeholder: defaultId, ariaLabel: intl.formatMessage({ id: "metricComponent.editMetric.id.ariaLabel" }), onChangeValueTransformer: passOnlyValidOrEmpty, onEditEndsValueTransformer: trimOrSetDefaultIfEmpty, readOnly: isLocked || isReadOnly, errorMessage: error?.message, showError: !valid, value: value, onBlur: onBlurHandler, onChange: onChange, ref: element })] }));
|
|
@@ -47,7 +47,7 @@ export function MetricIdField({ className, regenerateId }) {
|
|
|
47
47
|
/** Trimmed value if the id pattern allows it or it is empty, otherwise null to reject it. */
|
|
48
48
|
export function passOnlyValidOrEmpty(value) {
|
|
49
49
|
const idValue = value.trim();
|
|
50
|
-
if (
|
|
50
|
+
if (_isEmpty(idValue) || validateIdPattern(idValue)) {
|
|
51
51
|
return idValue;
|
|
52
52
|
}
|
|
53
53
|
return null;
|
|
@@ -55,7 +55,7 @@ export function passOnlyValidOrEmpty(value) {
|
|
|
55
55
|
function useIdSanitizers(defaultId) {
|
|
56
56
|
const trimOrSetDefaultIfEmpty = useCallback((value) => {
|
|
57
57
|
const idValue = value.trim();
|
|
58
|
-
if (
|
|
58
|
+
if (_isEmpty(idValue)) {
|
|
59
59
|
return defaultId;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
@@ -67,7 +67,7 @@ function useIdSanitizers(defaultId) {
|
|
|
67
67
|
function useBlurEventsCallback(id, onBlur) {
|
|
68
68
|
const { metricIdCreatedEvent, metricIdEditEvent } = useEvents(events);
|
|
69
69
|
return useCallback((e) => {
|
|
70
|
-
if (
|
|
70
|
+
if (_isEmpty(id)) {
|
|
71
71
|
metricIdCreatedEvent();
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MaqlEditorEditor.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/Form/MaqlEditorField/MaqlEditorEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,GAAG,EAQX,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MaqlEditorEditor.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/Form/MaqlEditorField/MaqlEditorEditor.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGH,KAAK,GAAG,EAQX,MAAM,OAAO,CAAC;AAOf,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAkB3D,OAAO,EAAE,KAAK,cAAc,EAAc,MAAM,wCAAwC,CAAC;AAuBzF,MAAM,WAAW,sBAAsB;IACnC,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;IACjD,KAAK,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAyCD,eAAO,MAAM,gBAAgB,gIAsD3B,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2021-2026 GoodData Corporation
|
|
3
3
|
import { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useState, } from "react";
|
|
4
|
-
import { isEmpty } from "lodash-es";
|
|
5
4
|
import { flushSync } from "react-dom";
|
|
6
5
|
import { createRoot } from "react-dom/client";
|
|
7
6
|
import { useIntl } from "react-intl";
|
|
8
7
|
import { IconArrowDown, IconArrowUp, IconAttribute, IconClose, IconDataset, IconFact, IconFunction, IconKeyword, IconLabel, IconMetric, IconQuestionMark, } from "@gooddata/sdk-ui-kit";
|
|
8
|
+
import { _isEmpty } from "@gooddata/util";
|
|
9
9
|
import { MaqlEditor } from "../../../MaqlEditor/maql/MaqlEditor.js";
|
|
10
10
|
import { useEvents } from "../../../shared/eventing/useEvents.js";
|
|
11
11
|
import { makeStyles } from "../../../shared/theme/index.js";
|
|
@@ -63,7 +63,7 @@ export const MaqlEditorEditor = forwardRef(function MaqlEditorEditor({ onMetricO
|
|
|
63
63
|
const { value, valid, element, isReadOnly, onBlur, onChange } = useMetricFormField(FormField.expression);
|
|
64
64
|
const [autofocus, setAutofocus] = useState(false);
|
|
65
65
|
const [autohints, setAutoHints] = useAutohint(!valid);
|
|
66
|
-
const isMaqlEditorEmpty =
|
|
66
|
+
const isMaqlEditorEmpty = _isEmpty(getMaqlValue(value));
|
|
67
67
|
const [onChanged, onValidation] = useMaqlField(value, onChange);
|
|
68
68
|
const onBlurHandler = useBlur(value, onBlur, setAutoHints, setAutofocus);
|
|
69
69
|
const onMetricOpenHandler = useCallback((_editor, object) => onMetricOpen?.(object), [onMetricOpen]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttributesSelect.d.ts","sourceRoot":"","sources":["../../../../../src/MetricComponent/Form/MaqlResult/components/AttributesSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAM1F,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAkC,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"AttributesSelect.d.ts","sourceRoot":"","sources":["../../../../../src/MetricComponent/Form/MaqlResult/components/AttributesSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAkC,MAAM,OAAO,CAAC;AAM1F,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EAAkC,KAAK,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAqEvG,MAAM,MAAM,sBAAsB,GAAG;IACjC,MAAM,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAC;IACzD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAC1B,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,iBAAiB,EAAE,CAAC;IAClC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,KAAK,IAAI,CAAC;IAC/C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAWF,wBAAgB,gBAAgB,CAAC,EAC7B,GAAQ,EACR,UAAe,EACf,WAAgB,EAChB,OAAO,EACP,MAAM,EACN,OAAO,EACP,QAAQ,EACR,MAAM,GACT,EAAE,sBAAsB,GAAG,YAAY,CAgGvC"}
|
|
@@ -2,10 +2,11 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
// (C) 2022-2026 GoodData Corporation
|
|
3
3
|
import { useCallback, useMemo, useState } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
import { debounce
|
|
5
|
+
import { debounce } from "lodash-es";
|
|
6
6
|
import { defineMessages, useIntl } from "react-intl";
|
|
7
7
|
import { LoadingComponent } from "@gooddata/sdk-ui";
|
|
8
8
|
import { Button, Dropdown, DropdownList } from "@gooddata/sdk-ui-kit";
|
|
9
|
+
import { _isEqual } from "@gooddata/util";
|
|
9
10
|
import { useProp } from "../../../../shared/hooks/useProp.js";
|
|
10
11
|
import { makeStyles } from "../../../../shared/theme/index.js";
|
|
11
12
|
import { AttributeDropdownListItem } from "./AttributesSelectItem.js";
|
|
@@ -118,7 +119,7 @@ function useSearch(attributes) {
|
|
|
118
119
|
}
|
|
119
120
|
function useSelected(preselected) {
|
|
120
121
|
const [selected, setSelected] = useProp(preselected);
|
|
121
|
-
const changed = useMemo(() => !
|
|
122
|
+
const changed = useMemo(() => !_isEqual(selected.slice().sort(), preselected.slice().sort()), [preselected, selected]);
|
|
122
123
|
const toggleSelected = useCallback((attr) => {
|
|
123
124
|
if (selected.includes(attr)) {
|
|
124
125
|
setSelected(selected.filter((attribute) => attr !== attribute));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LimitSelect.d.ts","sourceRoot":"","sources":["../../../../../src/MetricComponent/Form/MaqlResult/components/LimitSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"LimitSelect.d.ts","sourceRoot":"","sources":["../../../../../src/MetricComponent/Form/MaqlResult/components/LimitSelect.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,SAAS,EAAwB,MAAM,OAAO,CAAC;AAKhF,OAAO,EAKH,KAAK,0BAA0B,EAElC,MAAM,sBAAsB,CAAC;AAoD9B,MAAM,MAAM,iBAAiB,GAAG;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,SAAS,CAAC;IACzD,KAAK,CAAC,EAAE,EAAE,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;IAC3B,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,GAAG,GAAG,IAAI,GAAG,KAAK,EAAE,OAAO,EAAE,KAAK,GAAG,QAAQ,KAAK,IAAI,CAAC;IAC9E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EACxB,OAAe,EACf,KAAU,EACV,MAAM,EACN,OAAO,EACP,QAAQ,GACX,EAAE,iBAAiB,GAAG,YAAY,CAuGlC"}
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
// (C) 2022-2026 GoodData Corporation
|
|
3
3
|
import { useCallback, useMemo } from "react";
|
|
4
4
|
import classNames from "classnames";
|
|
5
|
-
import { isEqual } from "lodash-es";
|
|
6
5
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
7
6
|
import { Button, Dropdown, DropdownButton, DropdownList, SingleSelectListItem, } from "@gooddata/sdk-ui-kit";
|
|
7
|
+
import { _isEqual } from "@gooddata/util";
|
|
8
8
|
import { useProp } from "../../../../shared/hooks/useProp.js";
|
|
9
9
|
import { makeStyles } from "../../../../shared/theme/index.js";
|
|
10
10
|
const useStyles = makeStyles()((theme) => ({
|
|
@@ -99,7 +99,7 @@ function SimpleSelect({ items, selected, onSelect }) {
|
|
|
99
99
|
function useSelected(preselectedLimit, preselectedRanking) {
|
|
100
100
|
const [selectedLimit, setLimit] = useProp(preselectedLimit);
|
|
101
101
|
const [selectedRanking, setRanking] = useProp(preselectedRanking);
|
|
102
|
-
const changed = useMemo(() => !
|
|
102
|
+
const changed = useMemo(() => !_isEqual(selectedLimit, preselectedLimit) || !_isEqual(selectedRanking, preselectedRanking), [preselectedLimit, preselectedRanking, selectedLimit, selectedRanking]);
|
|
103
103
|
const resetSelected = useCallback(() => {
|
|
104
104
|
setLimit(preselectedLimit);
|
|
105
105
|
setRanking(preselectedRanking);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2021-2026 GoodData Corporation
|
|
2
2
|
import { useEffect, useMemo, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { _isEmpty } from "@gooddata/util";
|
|
4
4
|
import { generateUniqId } from "../../metric/nameGenerators.js";
|
|
5
5
|
import { FormField } from "../data.js";
|
|
6
6
|
import { useOtherMetrics } from "../OtherMetrics/useOtherMetrics.js";
|
|
@@ -29,7 +29,7 @@ function useGenerateId(title, defaultId, regenerateId = false) {
|
|
|
29
29
|
const { otherMetrics } = useOtherMetrics();
|
|
30
30
|
const { parents } = usePrefixes();
|
|
31
31
|
useEffect(() => {
|
|
32
|
-
if (!changed && (
|
|
32
|
+
if (!changed && (_isEmpty(defaultId) || regenerateId)) {
|
|
33
33
|
setValue(generateUniqId(title, prefix.value, otherMetrics, parents));
|
|
34
34
|
}
|
|
35
35
|
}, [defaultId, changed, otherMetrics, title, regenerateId, setValue, prefix.value, parents]);
|
|
@@ -40,7 +40,7 @@ function useDefaultIdByTitle(title, defaultId) {
|
|
|
40
40
|
const { parents } = usePrefixes();
|
|
41
41
|
const [defaultIdByTitle, setId] = useState(generateUniqId(title, prefix.value, otherMetrics, parents));
|
|
42
42
|
useEffect(() => {
|
|
43
|
-
if (
|
|
43
|
+
if (_isEmpty(defaultId)) {
|
|
44
44
|
setId(generateUniqId(title, prefix.value, otherMetrics, parents));
|
|
45
45
|
}
|
|
46
46
|
}, [defaultId, otherMetrics, setId, title, prefix.value, parents]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnChangeCallback.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/MetricState/hooks/useOnChangeCallback.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOnChangeCallback.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/MetricState/hooks/useOnChangeCallback.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,EAAE,KAAK,IAAI,EAAY,MAAM,6BAA6B,CAAC;AAElE,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,+BAA+B,CAAC;AACvF,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAI1D,UAAU,0BAA0B;IAChC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;IACvB,SAAS,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,KAAK,IAAI,CAAC;IAC/E,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAChE,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACjE;AAED,eAAO,MAAM,mBAAmB,mDAK7B,0BAA0B,KAAG;IAC5B,cAAc,EAAE,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9D,eAAe,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC;IAC7D,mBAAmB,EAAE,CAAC,WAAW,EAAE,iBAAiB,GAAG,SAAS,KAAK,IAAI,CAAC;CAiD7E,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// (C) 2021-2026 GoodData Corporation
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { _isEqual } from "@gooddata/util";
|
|
4
4
|
import { TabState } from "../../../shared/Tabs/Tab.js";
|
|
5
5
|
import { emptyMetricWithId } from "../../metric/emptyMetric.js";
|
|
6
6
|
import { updateTabDataFromMetric, updateTabDataFromSetting, updateTabFromMetric } from "./useTabsData.js";
|
|
@@ -8,9 +8,9 @@ export const useOnChangeCallback = ({ tab, updateTab, updateData, onValueChange,
|
|
|
8
8
|
const onChangeMetric = useCallback((metric, valid) => {
|
|
9
9
|
const states = tab.states || {};
|
|
10
10
|
const { initial, current } = tab.data;
|
|
11
|
-
const isChanged = !
|
|
12
|
-
const isUpdate = !
|
|
13
|
-
const isEmpty =
|
|
11
|
+
const isChanged = !_isEqual(metric, initial);
|
|
12
|
+
const isUpdate = !_isEqual(metric, current);
|
|
13
|
+
const isEmpty = _isEqual(metric, emptyMetricWithId);
|
|
14
14
|
const isInvalid = !valid && !isEmpty;
|
|
15
15
|
updateTab(tab, updateTabFromMetric(tab, metric, isChanged, isInvalid));
|
|
16
16
|
if (states[TabState.Dirty] !== isChanged || states[TabState.Invalid] !== isInvalid) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// (C) 2021-2026 GoodData Corporation
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
|
-
import {
|
|
3
|
+
import { _isEqual } from "@gooddata/util";
|
|
4
4
|
export function useInitialValueMetric(metric) {
|
|
5
5
|
const [initialValueMetric, setInitialValueMetric] = useState(metric);
|
|
6
6
|
useEffect(() => {
|
|
7
|
-
if (!
|
|
7
|
+
if (!_isEqual(initialValueMetric, metric)) {
|
|
8
8
|
setInitialValueMetric(metric);
|
|
9
9
|
}
|
|
10
10
|
}, [initialValueMetric, metric]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOnCloseOrCancel.d.ts","sourceRoot":"","sources":["../../../src/MetricComponent/hooks/useOnCloseOrCancel.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useOnCloseOrCancel.d.ts","sourceRoot":"","sources":["../../../src/MetricComponent/hooks/useOnCloseOrCancel.ts"],"names":[],"mappings":"AAOA,OAAO,EAAc,KAAK,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAE9D,wBAAgB,kBAAkB,CAC9B,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,uBAAuB,CAAC,UAAU,CAAC,EAC7C,eAAe,EAAE,CAAC,MAAM,EAAE,WAAW,GAAG,SAAS,KAAK,IAAI,EAC1D,kCAAkC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAC7D;IACC,eAAe,EAAE,CAAC,MAAM,EAAE,OAAO,CAAC,WAAW,CAAC,EAAE,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACxE,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAChC,CAuBA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// (C) 2021-2026 GoodData Corporation
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import { isEmpty } from "lodash-es";
|
|
4
3
|
import { isMeasureMetadataObject, isMeasureMetadataObjectDefinition } from "@gooddata/sdk-model";
|
|
4
|
+
import { _isEmpty } from "@gooddata/util";
|
|
5
5
|
import { CancelMode } from "../Content/EditMetricContent.data.js";
|
|
6
6
|
export function useOnCloseOrCancel(dirty, onCancel, setMetricToSave, setShowUnsavedChangesConfirmDialog) {
|
|
7
7
|
return useMemo(() => {
|
|
8
8
|
function onCloseCallback(metric, valid) {
|
|
9
|
-
if (
|
|
9
|
+
if (_isEmpty(metric.expression?.trim()) || !dirty) {
|
|
10
10
|
onCancel({ cancelMode: CancelMode.Cross });
|
|
11
11
|
return;
|
|
12
12
|
}
|
package/esm/shared/Form/Form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
// (C) 2022-2026 GoodData Corporation
|
|
3
3
|
import { forwardRef, useEffect, useRef, } from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { _isEqual } from "@gooddata/util";
|
|
5
5
|
import { FormApi } from "./FormApi.js";
|
|
6
6
|
import { FormContext } from "./FormContext.js";
|
|
7
7
|
import { useChanged } from "./hooks/useChanged.js";
|
|
@@ -32,7 +32,7 @@ export const FormProvider = forwardRef(function FormProvider(props, ref) {
|
|
|
32
32
|
setFocus,
|
|
33
33
|
setBlur,
|
|
34
34
|
setSaving,
|
|
35
|
-
},
|
|
35
|
+
}, _isEqual);
|
|
36
36
|
return (_jsxs(FormContext.Provider, { value: value, children: [_jsx(FormApi, { ref: ref }), children] }));
|
|
37
37
|
});
|
|
38
38
|
function useMemoCompare(next, compare) {
|
package/esm/shared/Form/utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// (C) 2022-2026 GoodData Corporation
|
|
2
|
-
import {
|
|
2
|
+
import { _isEqual } from "@gooddata/util";
|
|
3
3
|
export function isChanged(defaultValues, currentValues, transformer) {
|
|
4
|
-
return !
|
|
4
|
+
return !_isEqual(transformer(defaultValues), transformer(currentValues));
|
|
5
5
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMetricListData.events.d.ts","sourceRoot":"","sources":["../../../src/shared/metrics/useMetricListData.events.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useMetricListData.events.d.ts","sourceRoot":"","sources":["../../../src/shared/metrics/useMetricListData.events.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAGlE,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAG1D,MAAM,MAAM,oBAAoB,GAAG;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uBAAuB,EAAE,MAAM,CAAC;CACnC,CAAC;AAmBF,iBAAS,wBAAwB,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,MAAM,GAAG,IAAI,CAO/E;AAED,eAAO,MAAM,MAAM;;CAElB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// (C) 2021-2026 GoodData Corporation
|
|
2
|
-
import { groupBy
|
|
2
|
+
import { groupBy } from "lodash-es";
|
|
3
|
+
import { _isEqual } from "@gooddata/util";
|
|
3
4
|
import { EventCategories, Events } from "../eventing/events.js";
|
|
4
5
|
function getSameItemNumber(collection, iteratee) {
|
|
5
6
|
const groups = groupBy(collection, iteratee);
|
|
@@ -13,7 +14,7 @@ function calculateWorkspaceMetricStats(data) {
|
|
|
13
14
|
let workspaceMetricStats = null;
|
|
14
15
|
function workspaceMetricDataEvent(data) {
|
|
15
16
|
const stats = calculateWorkspaceMetricStats(data);
|
|
16
|
-
if (workspaceMetricStats && !
|
|
17
|
+
if (workspaceMetricStats && !_isEqual(stats, workspaceMetricStats)) {
|
|
17
18
|
return workspaceMetricStatsChangedEvent(stats);
|
|
18
19
|
}
|
|
19
20
|
workspaceMetricStats = stats;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gooddata/sdk-ui-metric-component",
|
|
3
|
-
"version": "11.68.0-alpha.
|
|
3
|
+
"version": "11.68.0-alpha.4",
|
|
4
4
|
"license": "LicenseRef-LICENSE",
|
|
5
5
|
"author": "GoodData Corporation",
|
|
6
6
|
"repository": {
|
|
@@ -38,17 +38,17 @@
|
|
|
38
38
|
"vscode-languageserver-textdocument": "1.0.12",
|
|
39
39
|
"vscode-languageserver-types": "3.17.5",
|
|
40
40
|
"yup": "0.32.11",
|
|
41
|
-
"@gooddata/
|
|
42
|
-
"@gooddata/
|
|
43
|
-
"@gooddata/sdk-backend-
|
|
44
|
-
"@gooddata/sdk-
|
|
45
|
-
"@gooddata/sdk-
|
|
46
|
-
"@gooddata/sdk-
|
|
47
|
-
"@gooddata/sdk-ui-charts": "11.68.0-alpha.
|
|
48
|
-
"@gooddata/sdk-ui-ext": "11.68.0-alpha.
|
|
49
|
-
"@gooddata/sdk-ui-kit": "11.68.0-alpha.
|
|
50
|
-
"@gooddata/sdk-ui-pivot": "11.68.0-alpha.
|
|
51
|
-
"@gooddata/util": "11.68.0-alpha.
|
|
41
|
+
"@gooddata/sdk-backend-spi": "11.68.0-alpha.4",
|
|
42
|
+
"@gooddata/api-client-tiger": "11.68.0-alpha.4",
|
|
43
|
+
"@gooddata/sdk-backend-tiger": "11.68.0-alpha.4",
|
|
44
|
+
"@gooddata/sdk-ui": "11.68.0-alpha.4",
|
|
45
|
+
"@gooddata/sdk-maql-language-server": "11.68.0-alpha.4",
|
|
46
|
+
"@gooddata/sdk-model": "11.68.0-alpha.4",
|
|
47
|
+
"@gooddata/sdk-ui-charts": "11.68.0-alpha.4",
|
|
48
|
+
"@gooddata/sdk-ui-ext": "11.68.0-alpha.4",
|
|
49
|
+
"@gooddata/sdk-ui-kit": "11.68.0-alpha.4",
|
|
50
|
+
"@gooddata/sdk-ui-pivot": "11.68.0-alpha.4",
|
|
51
|
+
"@gooddata/util": "11.68.0-alpha.4"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@microsoft/api-documenter": "7.30.20",
|
|
@@ -81,11 +81,11 @@
|
|
|
81
81
|
"react-dom": "19.1.1",
|
|
82
82
|
"typescript": "7.0.2",
|
|
83
83
|
"vitest": "5.0.4",
|
|
84
|
-
"@gooddata/eslint-config": "11.68.0-alpha.
|
|
85
|
-
"@gooddata/
|
|
86
|
-
"@gooddata/
|
|
87
|
-
"@gooddata/sdk-backend-base": "11.68.0-alpha.
|
|
88
|
-
"@gooddata/
|
|
84
|
+
"@gooddata/eslint-config": "11.68.0-alpha.4",
|
|
85
|
+
"@gooddata/i18n-toolkit": "11.68.0-alpha.4",
|
|
86
|
+
"@gooddata/oxlint-config": "11.68.0-alpha.4",
|
|
87
|
+
"@gooddata/sdk-backend-base": "11.68.0-alpha.4",
|
|
88
|
+
"@gooddata/sdk-ui-theme-provider": "11.68.0-alpha.4"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
91
|
"react": "^18.0.0 || ^19.0.0",
|