@gooddata/sdk-ui-kit 11.56.0 → 11.57.0-alpha.1
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/esm/@ui/UiPagedVirtualList/UiPagedVirtualList.d.ts +2 -2
- package/esm/@ui/UiPagedVirtualList/UiPagedVirtualList.d.ts.map +1 -1
- package/esm/DescriptionPanel/DescriptionPanel.d.ts +3 -1
- package/esm/DescriptionPanel/DescriptionPanel.d.ts.map +1 -1
- package/esm/DescriptionPanel/DescriptionPanel.js +2 -2
- package/esm/List/InsightListItem.d.ts +4 -2
- package/esm/List/InsightListItem.d.ts.map +1 -1
- package/esm/List/InsightListItem.js +2 -2
- package/esm/RichText/RichText.d.ts +7 -1
- package/esm/RichText/RichText.d.ts.map +1 -1
- package/esm/RichText/RichText.js +5 -5
- package/esm/RichText/RichTextWithTooltip.d.ts.map +1 -1
- package/esm/RichText/RichTextWithTooltip.js +3 -2
- package/esm/RichText/helpers/references.d.ts +5 -0
- package/esm/RichText/helpers/references.d.ts.map +1 -1
- package/esm/RichText/helpers/references.js +11 -0
- package/esm/RichText/hooks/useEvaluatedReferences.d.ts +2 -2
- package/esm/RichText/hooks/useEvaluatedReferences.d.ts.map +1 -1
- package/esm/RichText/hooks/useEvaluatedReferences.js +5 -3
- package/esm/RichText/plugins/rehype-references.d.ts +2 -2
- package/esm/RichText/plugins/rehype-references.d.ts.map +1 -1
- package/esm/RichText/plugins/rehype-references.js +24 -1
- package/esm/responsive/interfaces.d.ts +19 -19
- package/esm/responsive/interfaces.d.ts.map +1 -1
- package/esm/responsive/useMediaQuery.d.ts +2 -1
- package/esm/responsive/useMediaQuery.d.ts.map +1 -1
- package/esm/responsive/useMediaQuery.js +46 -5
- package/esm/sdk-ui-kit.d.ts +34 -23
- package/esm/typings/slots.d.ts +1 -1
- package/package.json +12 -12
- package/styles/css/main.css +9 -0
- package/styles/css/main.css.map +1 -1
- package/styles/css/richText.css +9 -0
- package/styles/css/richText.css.map +1 -1
- package/styles/scss/richText.scss +11 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ComponentType, type KeyboardEvent, type ReactNode } from "react";
|
|
1
|
+
import { type ComponentType, type FocusEvent, type KeyboardEvent, type ReactNode } from "react";
|
|
2
2
|
/**
|
|
3
3
|
* @internal
|
|
4
4
|
*/
|
|
@@ -48,7 +48,7 @@ export interface IUiPagedVirtualListProps<T> {
|
|
|
48
48
|
getIsItemSelected?: (item: T) => boolean;
|
|
49
49
|
itemHeightGetter?: (index: number) => number;
|
|
50
50
|
onScroll?: () => void;
|
|
51
|
-
onFocus?: (e:
|
|
51
|
+
onFocus?: (e: FocusEvent) => void;
|
|
52
52
|
handleFocusIndexChange?: boolean;
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiPagedVirtualList.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiPagedVirtualList/UiPagedVirtualList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,SAAS,EAQjB,MAAM,OAAO,CAAC;AAcf;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACjD,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,+BAA+B,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC1E,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACpC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,KAAK,OAAO,CAAC;IACxG,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAC;IACxD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACnE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"UiPagedVirtualList.d.ts","sourceRoot":"","sources":["../../../src/@ui/UiPagedVirtualList/UiPagedVirtualList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,aAAa,EAClB,KAAK,SAAS,EAQjB,MAAM,OAAO,CAAC;AAcf;;GAEG;AACH,MAAM,WAAW,oCAAoC;IACjD,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,+BAA+B,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,KAAK,IAAI,CAAC;IAC1E,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACpC,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;IACrC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB;;;;OAIG;IACH,wBAAwB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,GAAG,MAAM,CAAC;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,KAAK,OAAO,CAAC;IACxG,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,SAAS,CAAC;IACxD,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,YAAY,CAAC,EAAE,aAAa,CAAC,oCAAoC,CAAC,CAAC;IACnE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,CAAC,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,OAAO,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC7C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC,sBAAsB,CAAC,EAAE,OAAO,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,mCAAmC,CAAC,CAAC;IAClD,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC;CACnC;AAkND;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAnNO,CAAC,0HAmN+C,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType } from "react";
|
|
2
|
-
import { type IExecutionConfig, type IFilter, type ISeparators } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IExecutionConfig, type IFilter, type ISeparators, type ObjRef } from "@gooddata/sdk-model";
|
|
3
3
|
import { type ArrowOffsets } from "../Bubble/typings.js";
|
|
4
4
|
/**
|
|
5
5
|
* @internal
|
|
@@ -45,6 +45,8 @@ export interface IDescriptionPanelProps {
|
|
|
45
45
|
LoadingComponent?: ComponentType;
|
|
46
46
|
filters?: IFilter[];
|
|
47
47
|
separators?: ISeparators;
|
|
48
|
+
/** References the current user is not allowed to read; each renders as a marker in place of its value. */
|
|
49
|
+
restrictedReferences?: ObjRef[];
|
|
48
50
|
execConfig?: IExecutionConfig;
|
|
49
51
|
id?: string;
|
|
50
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DescriptionPanel.d.ts","sourceRoot":"","sources":["../../src/DescriptionPanel/DescriptionPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"DescriptionPanel.d.ts","sourceRoot":"","sources":["../../src/DescriptionPanel/DescriptionPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,OAAO,CAAC;AAK3C,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAMzG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAKzD;;GAEG;AACH,eAAO,MAAM,8BAA8B;;GAgB1C,CAAC;AACF;;GAEG;AACH,eAAO,MAAM,+BAA+B;IACxC,OAAO;IACP,OAAO;IACP,OAAO;IAEP,OAAO;IACP,OAAO;IACP,OAAO;IAEP,OAAO;IACP,OAAO;IACP,OAAO;IAEP,OAAO;IACP,OAAO;IACP,OAAO;CACV,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AAEH,MAAM,WAAW,sBAAsB;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,aAAa,CAAC;IACjC,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,WAAW,CAAC;IACzB,0GAA0G;IAC1G,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,sBAAsB,2CAM7D;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,sBAAsB,2CAMpE;AACD;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAAE,SAAS,EAAE,EAAE,wBAAwB,2CAgBtE"}
|
|
@@ -68,10 +68,10 @@ function DescriptionPanelCore(props) {
|
|
|
68
68
|
const { arrowOffsets = DESCRIPTION_PANEL_ARROW_OFFSETS } = props;
|
|
69
69
|
return (_jsxs(BubbleHoverTrigger, { onBubbleOpen: props.onBubbleOpen, showDelay: 0, eventsOnBubble: true, children: [_jsx(DescriptionIcon, { className: props.className }), _jsx(Bubble, { className: "bubble-light gd-description-panel-bubble", alignPoints: DESCRIPTION_PANEL_ALIGN_POINTS, arrowOffsets: arrowOffsets, arrowStyle: { display: "none" }, ensureVisibility: true, children: _jsx(DescriptionPanelContentCore, { ...props }) })] }));
|
|
70
70
|
}
|
|
71
|
-
function DescriptionPanelContentCore({ title, description, isLocked, useReferences = false, LoadingComponent, filters, separators, execConfig, id, }) {
|
|
71
|
+
function DescriptionPanelContentCore({ title, description, isLocked, useReferences = false, LoadingComponent, filters, separators, restrictedReferences, execConfig, id, }) {
|
|
72
72
|
const isZoomed = useIsZoomed(ZOOM_THRESHOLD); // ignore slight zoom in
|
|
73
73
|
const className = cx("gd-description-panel s-gd-description-panel", {
|
|
74
74
|
zoomed: isZoomed,
|
|
75
75
|
});
|
|
76
|
-
return (_jsxs("div", { className: className, id: id, children: [!isEmpty(title) && (_jsxs("div", { className: "gd-description-panel-title", children: [isLocked ? _jsx(UiIcon, { type: "lock", size: 16, color: "complementary-6" }) : null, title] })), !isEmpty(description) && (_jsx("div", { className: "gd-description-panel-content", children: _jsx(RichText, { value: description ?? "", renderMode: "view", referencesEnabled: useReferences, filters: filters, separators: separators, LoadingComponent: LoadingComponent, execConfig: execConfig }) }))] }));
|
|
76
|
+
return (_jsxs("div", { className: className, id: id, children: [!isEmpty(title) && (_jsxs("div", { className: "gd-description-panel-title", children: [isLocked ? _jsx(UiIcon, { type: "lock", size: 16, color: "complementary-6" }) : null, title] })), !isEmpty(description) && (_jsx("div", { className: "gd-description-panel-content", children: _jsx(RichText, { value: description ?? "", renderMode: "view", referencesEnabled: useReferences, filters: filters, separators: separators, restrictedReferences: restrictedReferences, LoadingComponent: LoadingComponent, execConfig: execConfig }) }))] }));
|
|
77
77
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType } from "react";
|
|
2
|
-
import { type IExecutionConfig, type IFilter, type ISeparators } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IExecutionConfig, type IFilter, type ISeparators, type ObjRef } from "@gooddata/sdk-model";
|
|
3
3
|
/**
|
|
4
4
|
* @internal
|
|
5
5
|
*/
|
|
@@ -19,6 +19,8 @@ export interface IInsightListItemProps {
|
|
|
19
19
|
onDescriptionPanelOpen?: () => void;
|
|
20
20
|
showDescriptionPanel?: boolean;
|
|
21
21
|
useReferences?: boolean;
|
|
22
|
+
/** References the current user is not allowed to read; each renders as a marker in place of its value. */
|
|
23
|
+
restrictedReferences?: ObjRef[];
|
|
22
24
|
metadataTimeZone?: string;
|
|
23
25
|
richTextExecConfig?: IExecutionConfig;
|
|
24
26
|
LoadingComponent?: ComponentType;
|
|
@@ -26,7 +28,7 @@ export interface IInsightListItemProps {
|
|
|
26
28
|
/**
|
|
27
29
|
* @internal
|
|
28
30
|
*/
|
|
29
|
-
export declare function InsightListItem({ title, description, updated, type, isSelected, isLoading, filters, separators, LoadingComponent, onClick, onDescriptionPanelOpen, showDescriptionPanel, useReferences, richTextExecConfig, width, isLocked, onDelete, metadataTimeZone, }: IInsightListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
31
|
+
export declare function InsightListItem({ title, description, updated, type, isSelected, isLoading, filters, separators, LoadingComponent, onClick, onDescriptionPanelOpen, showDescriptionPanel, useReferences, restrictedReferences, richTextExecConfig, width, isLocked, onDelete, metadataTimeZone, }: IInsightListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
30
32
|
/**
|
|
31
33
|
* @internal
|
|
32
34
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InsightListItem.d.ts","sourceRoot":"","sources":["../../src/List/InsightListItem.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAmD,MAAM,OAAO,CAAC;AAK5F,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"InsightListItem.d.ts","sourceRoot":"","sources":["../../src/List/InsightListItem.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAmD,MAAM,OAAO,CAAC;AAK5F,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAkCzG;;GAEG;AACH,MAAM,WAAW,qBAAqB;IAClC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,WAAW,CAAC;IAEzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,sBAAsB,CAAC,EAAE,MAAM,IAAI,CAAC;IAEpC,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,0GAA0G;IAC1G,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,gBAAgB,CAAC;IAEtC,gBAAgB,CAAC,EAAE,aAAa,CAAC;CACpC;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC5B,KAAK,EACL,WAAW,EACX,OAAO,EACP,IAAiC,EACjC,UAAU,EACV,SAAS,EACT,OAAO,EACP,UAAU,EACV,gBAAgB,EAChB,OAAO,EACP,sBAAsB,EACtB,oBAA4B,EAC5B,aAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,GACnB,EAAE,qBAAqB,2CAiFvB;AAuBD;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,2CAQjE"}
|
|
@@ -32,7 +32,7 @@ const modifiedArrowOffsets = {
|
|
|
32
32
|
/**
|
|
33
33
|
* @internal
|
|
34
34
|
*/
|
|
35
|
-
export function InsightListItem({ title, description, updated, type = VISUALIZATION_TYPE_UNKNOWN, isSelected, isLoading, filters, separators, LoadingComponent, onClick, onDescriptionPanelOpen, showDescriptionPanel = false, useReferences = false, richTextExecConfig, width, isLocked, onDelete, metadataTimeZone, }) {
|
|
35
|
+
export function InsightListItem({ title, description, updated, type = VISUALIZATION_TYPE_UNKNOWN, isSelected, isLoading, filters, separators, LoadingComponent, onClick, onDescriptionPanelOpen, showDescriptionPanel = false, useReferences = false, restrictedReferences, richTextExecConfig, width, isLocked, onDelete, metadataTimeZone, }) {
|
|
36
36
|
const intl = useIntl();
|
|
37
37
|
const shortenedTextRef = useRef(null);
|
|
38
38
|
const currentWidthRef = useRef(width);
|
|
@@ -49,7 +49,7 @@ export function InsightListItem({ title, description, updated, type = VISUALIZAT
|
|
|
49
49
|
onDelete();
|
|
50
50
|
}
|
|
51
51
|
}, [onDelete]);
|
|
52
|
-
return (_jsxs("div", { className: cx("gd-visualizations-list-item", `s-${simplifyText(title ?? "")}`, isSelected && "is-selected"), onClick: onClick, children: [shouldRenderActions ? (_jsx("div", { className: "gd-visualizations-list-item-actions", children: _jsx(Button, { className: "gd-button-link gd-button-icon-only gd-button-small\n gd-icon-trash gd-visualizations-list-item-action-delete s-delete-item", onClick: handleClickDelete }) })) : null, showDescriptionPanel ? (_jsx("div", { className: "gd-visualizations-list-item-description", children: _jsx(DescriptionPanel, { onBubbleOpen: onDescriptionPanelOpen, title: title, description: description, isLocked: isLocked, arrowOffsets: shouldRenderActions ? modifiedArrowOffsets : undefined, useReferences: useReferences, filters: filters, separators: separators, LoadingComponent: LoadingComponent, execConfig: richTextExecConfig }) })) : null, _jsxs("div", { className: "gd-visualizations-list-item-content", children: [_jsxs("div", { className: "gd-visualizations-list-item-content-name", children: [isLocked ? _jsx(UiIcon, { type: "lock", size: 14, color: "complementary-6" }) : null, _jsx("div", { style: { maxWidth: "100%", whiteSpace: "nowrap" }, children: _jsx(ShortenedText, { ref: shortenedTextRef, tooltipAlignPoints: tooltipAlignPoints, displayTooltip: !showDescriptionPanel, children: isLoading
|
|
52
|
+
return (_jsxs("div", { className: cx("gd-visualizations-list-item", `s-${simplifyText(title ?? "")}`, isSelected && "is-selected"), onClick: onClick, children: [shouldRenderActions ? (_jsx("div", { className: "gd-visualizations-list-item-actions", children: _jsx(Button, { className: "gd-button-link gd-button-icon-only gd-button-small\n gd-icon-trash gd-visualizations-list-item-action-delete s-delete-item", onClick: handleClickDelete }) })) : null, showDescriptionPanel ? (_jsx("div", { className: "gd-visualizations-list-item-description", children: _jsx(DescriptionPanel, { onBubbleOpen: onDescriptionPanelOpen, title: title, description: description, isLocked: isLocked, arrowOffsets: shouldRenderActions ? modifiedArrowOffsets : undefined, useReferences: useReferences, filters: filters, separators: separators, restrictedReferences: restrictedReferences, LoadingComponent: LoadingComponent, execConfig: richTextExecConfig }) })) : null, _jsxs("div", { className: "gd-visualizations-list-item-content", children: [_jsxs("div", { className: "gd-visualizations-list-item-content-name", children: [isLocked ? _jsx(UiIcon, { type: "lock", size: 14, color: "complementary-6" }) : null, _jsx("div", { style: { maxWidth: "100%", whiteSpace: "nowrap" }, children: _jsx(ShortenedText, { ref: shortenedTextRef, tooltipAlignPoints: tooltipAlignPoints, displayTooltip: !showDescriptionPanel, children: isLoading
|
|
53
53
|
? intl.formatMessage({ id: "gs.visualizationsList.loading" })
|
|
54
54
|
: (title ?? "") }) })] }), _jsx("div", { className: "gd-visualizations-list-item-content-date", children: _jsx(UpdatedDateTime, { date: updated, type: type, metadataTimeZone: metadataTimeZone }) })] }), _jsx(InsightListItemTypeIcon, { type: type })] }));
|
|
55
55
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ComponentType, type ReactElement } from "react";
|
|
2
|
-
import { type IExecutionConfig, type IFilter, type ISeparators } from "@gooddata/sdk-model";
|
|
2
|
+
import { type IExecutionConfig, type IFilter, type ISeparators, type ObjRef } from "@gooddata/sdk-model";
|
|
3
3
|
import { type OnError, type OnLoadingChanged } from "@gooddata/sdk-ui";
|
|
4
4
|
import { type RichTextFeature } from "./plugins/remark-markdown-features.js";
|
|
5
5
|
/**
|
|
@@ -47,6 +47,12 @@ export interface IRichTextProps {
|
|
|
47
47
|
* Filters to be used for rendering references.
|
|
48
48
|
*/
|
|
49
49
|
filters?: IFilter[];
|
|
50
|
+
/**
|
|
51
|
+
* References the current user is not allowed to read. Each of them renders as a marker in place
|
|
52
|
+
* of its value, and is left out of the execution that resolves the remaining references — one
|
|
53
|
+
* execution serves them all, and it fails as a whole if it asks for a restricted object.
|
|
54
|
+
*/
|
|
55
|
+
restrictedReferences?: ObjRef[];
|
|
50
56
|
/**
|
|
51
57
|
* If true, the filters are loading.
|
|
52
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/RichText/RichText.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,aAAa,EAGlB,KAAK,YAAY,EAIpB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"RichText.d.ts","sourceRoot":"","sources":["../../src/RichText/RichText.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEH,KAAK,aAAa,EAGlB,KAAK,YAAY,EAIpB,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACzG,OAAO,EAAiC,KAAK,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAItG,OAAO,EAAE,KAAK,eAAe,EAA0B,MAAM,uCAAuC,CAAC;AAoBrG;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;;;;;;;;;OAaG;IACH,eAAe,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IAC7C;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE;QACT,IAAI,EAAE,OAAO,CAAC;QACd,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC3C,CAAC;IAEF;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IAEpB;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;IAEhC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAGlB,gBAAgB,CAAC,EAAE,aAAa,CAAC;CACpC;AAqND;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,cAAc,2CAM7C"}
|
package/esm/RichText/RichText.js
CHANGED
|
@@ -23,7 +23,7 @@ const RICH_TEXT_PLACEHOLDER = `
|
|
|
23
23
|
function DefaultLoadingComponent() {
|
|
24
24
|
return _jsx(LoadingComponent, {});
|
|
25
25
|
}
|
|
26
|
-
function RichTextCore({ value, execConfig, onChange, referencesEnabled, allowedMarkdown, renderMode = "view", editPlaceholder, editRows, emptyElement, className, autoResize, rawContent, filters, isFiltersLoading, separators, onLoadingChanged, onError, LoadingComponent, }) {
|
|
26
|
+
function RichTextCore({ value, execConfig, onChange, referencesEnabled, allowedMarkdown, renderMode = "view", editPlaceholder, editRows, emptyElement, className, autoResize, rawContent, filters, isFiltersLoading, separators, restrictedReferences, onLoadingChanged, onError, LoadingComponent, }) {
|
|
27
27
|
return (_jsxs("div", { className: cx([
|
|
28
28
|
"gd-rich-text-content",
|
|
29
29
|
`gd-rich-text-content-${renderMode}`,
|
|
@@ -31,7 +31,7 @@ function RichTextCore({ value, execConfig, onChange, referencesEnabled, allowedM
|
|
|
31
31
|
`s-rich-text-${renderMode}`,
|
|
32
32
|
{ "gd-visible-scrollbar": renderMode === "view" },
|
|
33
33
|
className,
|
|
34
|
-
]), children: [renderMode === "edit" ? (_jsx(RichTextEdit, { value: value, onChange: (updatedValue) => onChange?.(updatedValue), placeholder: editPlaceholder, rows: editRows, autoResize: autoResize })) : (_jsx(RichTextView, { value: value, filters: filters, isFiltersLoading: isFiltersLoading, separators: separators, referencesEnabled: referencesEnabled, allowedMarkdown: allowedMarkdown, LoadingComponent: LoadingComponent, onLoadingChanged: onLoadingChanged, onError: onError, emptyElement: emptyElement, execConfig: execConfig })), rawContent?.show ? _jsx("input", { type: "hidden", value: value, ...rawContent.dataAttributes }) : null] }));
|
|
34
|
+
]), children: [renderMode === "edit" ? (_jsx(RichTextEdit, { value: value, onChange: (updatedValue) => onChange?.(updatedValue), placeholder: editPlaceholder, rows: editRows, autoResize: autoResize })) : (_jsx(RichTextView, { value: value, filters: filters, isFiltersLoading: isFiltersLoading, separators: separators, restrictedReferences: restrictedReferences, referencesEnabled: referencesEnabled, allowedMarkdown: allowedMarkdown, LoadingComponent: LoadingComponent, onLoadingChanged: onLoadingChanged, onError: onError, emptyElement: emptyElement, execConfig: execConfig })), rawContent?.show ? _jsx("input", { type: "hidden", value: value, ...rawContent.dataAttributes }) : null] }));
|
|
35
35
|
}
|
|
36
36
|
function RichTextEdit({ value, onChange, placeholder, rows = 10, autoResize = false }) {
|
|
37
37
|
const textareaRef = useRef(null);
|
|
@@ -72,13 +72,13 @@ function ImageComponent(props) {
|
|
|
72
72
|
function AnchorComponent(props) {
|
|
73
73
|
return _jsx("a", { target: "_blank", rel: "noopener noreferrer", ...props });
|
|
74
74
|
}
|
|
75
|
-
function RichTextView({ value, referencesEnabled, allowedMarkdown, emptyElement, filters, isFiltersLoading, separators, execConfig, onError, onLoadingChanged, LoadingComponent = DefaultLoadingComponent, }) {
|
|
75
|
+
function RichTextView({ value, referencesEnabled, allowedMarkdown, emptyElement, filters, isFiltersLoading, separators, restrictedReferences, execConfig, onError, onLoadingChanged, LoadingComponent = DefaultLoadingComponent, }) {
|
|
76
76
|
const intl = useIntl();
|
|
77
77
|
const { loading, metrics, isEmptyValue, error } = useEvaluatedReferences(value, filters ?? [], {
|
|
78
78
|
enabled: referencesEnabled ?? false,
|
|
79
79
|
isFiltersLoading,
|
|
80
80
|
...execConfig,
|
|
81
|
-
});
|
|
81
|
+
}, restrictedReferences);
|
|
82
82
|
useEffect(() => {
|
|
83
83
|
onLoadingChanged?.({
|
|
84
84
|
isLoading: loading,
|
|
@@ -98,7 +98,7 @@ function RichTextView({ value, referencesEnabled, allowedMarkdown, emptyElement,
|
|
|
98
98
|
return (_jsx(Markdown, { components: { img: ImageComponent, a: AnchorComponent }, remarkPlugins: [
|
|
99
99
|
...(allowedMarkdown === undefined ? [] : [remarkMarkdownFeatures(allowedMarkdown)]),
|
|
100
100
|
...(referencesEnabled ? [remarkReferences()] : []),
|
|
101
|
-
], rehypePlugins: referencesEnabled ? [rehypeReferences(intl, metrics, separators)] : [], children: value }));
|
|
101
|
+
], rehypePlugins: referencesEnabled ? [rehypeReferences(intl, metrics, separators, restrictedReferences)] : [], children: value }));
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* @internal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RichTextWithTooltip.d.ts","sourceRoot":"","sources":["../../src/RichText/RichTextWithTooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAW,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,eAAe,CAAC;AAoB9D;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,YAAY,CAAC;CAClC;
|
|
1
|
+
{"version":3,"file":"RichTextWithTooltip.d.ts","sourceRoot":"","sources":["../../src/RichText/RichTextWithTooltip.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAW,MAAM,OAAO,CAAC;AAQnD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,eAAe,CAAC;AAoB9D;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,cAAc;IAC7D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kBAAkB,CAAC,EAAE,WAAW,EAAE,CAAC;IACnC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,eAAe,CAAC,EAAE,YAAY,CAAC;CAClC;AAqGD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,yBAAyB,2CAMnE"}
|
|
@@ -8,11 +8,11 @@ import { BubbleHoverTrigger } from "../Bubble/BubbleHoverTrigger.js";
|
|
|
8
8
|
import { RichText } from "./RichText.js";
|
|
9
9
|
const alignPoints = [{ align: "bc tc" }, { align: "tc bc" }];
|
|
10
10
|
const descriptionMarkdown = (_jsxs(_Fragment, { children: [_jsx("br", {}), "# Heading 1", _jsx("br", {}), "**Bold**", _jsx("br", {}), "* List", _jsx("br", {}), "[link](http://thisisalink.com)", _jsx("br", {}), "", _jsx("br", {}), "{metric/metric_id}", _jsx("br", {}), "{label/label_id}"] }));
|
|
11
|
-
function RichTextWithTooltipCore({ value, onChange, renderMode, editPlaceholder, editRows, emptyElement, className, showTooltip = true, tooltipAlignPoints = alignPoints, tooltipDescription, tooltipMarkdown = descriptionMarkdown, autoResize, referencesEnabled, allowedMarkdown, filters, separators, onLoadingChanged, onError, LoadingComponent, rawContent, execConfig, }) {
|
|
11
|
+
function RichTextWithTooltipCore({ value, onChange, renderMode, editPlaceholder, editRows, emptyElement, className, showTooltip = true, tooltipAlignPoints = alignPoints, tooltipDescription, tooltipMarkdown = descriptionMarkdown, autoResize, referencesEnabled, allowedMarkdown, filters, separators, restrictedReferences, onLoadingChanged, onError, LoadingComponent, rawContent, execConfig, }) {
|
|
12
12
|
const intl = useIntl();
|
|
13
13
|
const description = tooltipDescription ?? intl.formatMessage({ id: "richText.tooltip" });
|
|
14
14
|
const Component = useMemo(() => {
|
|
15
|
-
return (_jsx(RichText, { value: value, onChange: onChange, renderMode: renderMode, editPlaceholder: editPlaceholder, editRows: editRows, emptyElement: emptyElement, className: className, autoResize: autoResize, referencesEnabled: referencesEnabled, allowedMarkdown: allowedMarkdown, filters: filters, separators: separators, LoadingComponent: LoadingComponent, onLoadingChanged: onLoadingChanged, onError: onError, rawContent: rawContent, execConfig: {
|
|
15
|
+
return (_jsx(RichText, { value: value, onChange: onChange, renderMode: renderMode, editPlaceholder: editPlaceholder, editRows: editRows, emptyElement: emptyElement, className: className, autoResize: autoResize, referencesEnabled: referencesEnabled, allowedMarkdown: allowedMarkdown, filters: filters, separators: separators, restrictedReferences: restrictedReferences, LoadingComponent: LoadingComponent, onLoadingChanged: onLoadingChanged, onError: onError, rawContent: rawContent, execConfig: {
|
|
16
16
|
timestamp: execConfig?.timestamp,
|
|
17
17
|
dataSamplingPercentage: execConfig?.dataSamplingPercentage,
|
|
18
18
|
// omit when undefined so it does not bust the execution's defFingerprint
|
|
@@ -30,6 +30,7 @@ function RichTextWithTooltipCore({ value, onChange, renderMode, editPlaceholder,
|
|
|
30
30
|
referencesEnabled,
|
|
31
31
|
allowedMarkdown,
|
|
32
32
|
filters,
|
|
33
|
+
restrictedReferences,
|
|
33
34
|
LoadingComponent,
|
|
34
35
|
onLoadingChanged,
|
|
35
36
|
onError,
|
|
@@ -4,6 +4,11 @@ export type ReferenceMap = Record<string, {
|
|
|
4
4
|
type: ObjectType;
|
|
5
5
|
}>;
|
|
6
6
|
export declare function collectReferences(content: string): ReferenceMap;
|
|
7
|
+
/**
|
|
8
|
+
* The references without those pointing at the given objects. The caller resolves the remaining ones
|
|
9
|
+
* in a single execution, which fails as a whole if it asks for an object the user may not read.
|
|
10
|
+
*/
|
|
11
|
+
export declare function excludeReferences(references: ReferenceMap, excluded: ObjRef[]): ReferenceMap;
|
|
7
12
|
export declare function createReference(parts: RegExpExecArray): {
|
|
8
13
|
id: string;
|
|
9
14
|
ref: IdentifierRef | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/RichText/helpers/references.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../../src/RichText/helpers/references.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,MAAM,EAAE,KAAK,UAAU,EAAmB,MAAM,qBAAqB,CAAC;AAIxG,MAAM,MAAM,YAAY,GAAG,MAAM,CAC7B,MAAM,EACN;IACI,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,UAAU,CAAC;CACpB,CACJ,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,gBAkBhD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,YAAY,CAS5F;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,aAAa,GAAG,IAAI,CAAA;CAAE,CAkBjG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// (C) 2022-2025 GoodData Corporation
|
|
2
|
+
import { areObjRefsEqual } from "@gooddata/sdk-model";
|
|
2
3
|
import { REFERENCE_REGEX_MATCH } from "../plugins/types.js";
|
|
3
4
|
export function collectReferences(content) {
|
|
4
5
|
const map = {};
|
|
@@ -16,6 +17,16 @@ export function collectReferences(content) {
|
|
|
16
17
|
}
|
|
17
18
|
return map;
|
|
18
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* The references without those pointing at the given objects. The caller resolves the remaining ones
|
|
22
|
+
* in a single execution, which fails as a whole if it asks for an object the user may not read.
|
|
23
|
+
*/
|
|
24
|
+
export function excludeReferences(references, excluded) {
|
|
25
|
+
if (excluded.length === 0) {
|
|
26
|
+
return references;
|
|
27
|
+
}
|
|
28
|
+
return Object.fromEntries(Object.entries(references).filter(([, reference]) => !excluded.some((ref) => areObjRefsEqual(ref, reference.ref))));
|
|
29
|
+
}
|
|
19
30
|
export function createReference(parts) {
|
|
20
31
|
const id = parts[2];
|
|
21
32
|
const type = normalizeType(parts[3]);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type IExecutionConfig, type IFilter } from "@gooddata/sdk-model";
|
|
1
|
+
import { type IExecutionConfig, type IFilter, type ObjRef } from "@gooddata/sdk-model";
|
|
2
2
|
export declare function useEvaluatedReferences(value: string, filters: IFilter[], config: IExecutionConfig & {
|
|
3
3
|
enabled: boolean;
|
|
4
4
|
isFiltersLoading?: boolean;
|
|
5
|
-
}): {
|
|
5
|
+
}, restrictedReferences?: ObjRef[]): {
|
|
6
6
|
isEmptyValue: boolean;
|
|
7
7
|
loading: boolean;
|
|
8
8
|
metrics: import("./useEvaluatedMetricsAndAttributes.js").EvaluatedMetric[] | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEvaluatedReferences.d.ts","sourceRoot":"","sources":["../../../src/RichText/hooks/useEvaluatedReferences.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"useEvaluatedReferences.d.ts","sourceRoot":"","sources":["../../../src/RichText/hooks/useEvaluatedReferences.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AASvF,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,OAAO,EAAE,EAClB,MAAM,EAAE,gBAAgB,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAA;CAAE,EAC3E,oBAAoB,GAAE,MAAM,EAA6B;;;;;EAyB5D"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// (C) 2025-2026 GoodData Corporation
|
|
2
2
|
import { useMemo } from "react";
|
|
3
|
-
import { collectReferences } from "../helpers/references.js";
|
|
3
|
+
import { collectReferences, excludeReferences } from "../helpers/references.js";
|
|
4
4
|
import { useEvaluatedMetricsAndAttributes } from "./useEvaluatedMetricsAndAttributes.js";
|
|
5
|
-
|
|
5
|
+
/** A stable default, so a caller that has nothing restricted does not churn the memo below. */
|
|
6
|
+
const NO_RESTRICTED_REFERENCES = [];
|
|
7
|
+
export function useEvaluatedReferences(value, filters, config, restrictedReferences = NO_RESTRICTED_REFERENCES) {
|
|
6
8
|
const isEmptyValue = useMemo(() => !value?.replace(/\s/g, ""), [value]);
|
|
7
|
-
const references = useMemo(() => collectReferences(value), [value]);
|
|
9
|
+
const references = useMemo(() => excludeReferences(collectReferences(value), restrictedReferences), [value, restrictedReferences]);
|
|
8
10
|
const { loading, result: metrics, error: metricsError, } = useEvaluatedMetricsAndAttributes(references, filters, {
|
|
9
11
|
...config,
|
|
10
12
|
// Mark filters as loaded when there are no references to resolve to speed up loading.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Root } from "mdast";
|
|
2
2
|
import { type IntlShape } from "react-intl";
|
|
3
|
-
import { type ISeparators } from "@gooddata/sdk-model";
|
|
3
|
+
import { type ISeparators, type ObjRef } from "@gooddata/sdk-model";
|
|
4
4
|
import { type EvaluatedMetric } from "../hooks/useEvaluatedMetricsAndAttributes.js";
|
|
5
|
-
export declare function rehypeReferences(intl: IntlShape, metrics?: EvaluatedMetric[], separators?: ISeparators): () => (tree: Root) => Root;
|
|
5
|
+
export declare function rehypeReferences(intl: IntlShape, metrics?: EvaluatedMetric[], separators?: ISeparators, restrictedReferences?: ObjRef[]): () => (tree: Root) => Root;
|
|
6
6
|
//# sourceMappingURL=rehype-references.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rehype-references.d.ts","sourceRoot":"","sources":["../../../src/RichText/plugins/rehype-references.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,EAAE,KAAK,WAAW,
|
|
1
|
+
{"version":3,"file":"rehype-references.d.ts","sourceRoot":"","sources":["../../../src/RichText/plugins/rehype-references.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,IAAI,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,OAAO,EAAE,KAAK,WAAW,EAAsB,KAAK,MAAM,EAAmB,MAAM,qBAAqB,CAAC;AAGzG,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,8CAA8C,CAAC;AAIpF,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,SAAS,EACf,OAAO,CAAC,EAAE,eAAe,EAAE,EAC3B,UAAU,CAAC,EAAE,WAAW,EACxB,oBAAoB,CAAC,EAAE,MAAM,EAAE,gBAMJ,IAAI,UAuBlC"}
|
|
@@ -4,16 +4,24 @@ import { ClientFormatterFacade } from "@gooddata/number-formatter";
|
|
|
4
4
|
import { areObjRefsEqual } from "@gooddata/sdk-model";
|
|
5
5
|
import { createReference } from "../helpers/references.js";
|
|
6
6
|
import { REFERENCE_REGEX_MATCH, REFERENCE_REGEX_SPLIT } from "./types.js";
|
|
7
|
-
export function rehypeReferences(intl, metrics, separators) {
|
|
7
|
+
export function rehypeReferences(intl, metrics, separators, restrictedReferences) {
|
|
8
|
+
const isRestricted = (ref) => !!restrictedReferences?.some((restricted) => areObjRefsEqual(restricted, ref));
|
|
8
9
|
return function () {
|
|
9
10
|
return function (tree) {
|
|
10
11
|
iterateTree(tree, {
|
|
11
12
|
onTextNodeReference: (text, ref) => {
|
|
13
|
+
if (isRestricted(ref)) {
|
|
14
|
+
return [createRestrictedMarker(intl, text)];
|
|
15
|
+
}
|
|
12
16
|
const metric = metrics?.find((m) => areObjRefsEqual(m.ref, ref));
|
|
13
17
|
const { metricDef } = createMetricValue(intl, text, metric, separators);
|
|
14
18
|
return [metricDef];
|
|
15
19
|
},
|
|
16
20
|
onTextRawReference: (ref) => {
|
|
21
|
+
// markup cannot be nested in a URL or an alt text, so the marker is its word alone
|
|
22
|
+
if (isRestricted(ref)) {
|
|
23
|
+
return intl.formatMessage({ id: "richText.restricted" });
|
|
24
|
+
}
|
|
17
25
|
const metric = metrics?.find((m) => areObjRefsEqual(m.ref, ref));
|
|
18
26
|
const { value, formattedValue } = createMetricValue(intl, null, metric, separators);
|
|
19
27
|
return value === null ? "" : formattedValue;
|
|
@@ -23,6 +31,21 @@ export function rehypeReferences(intl, metrics, separators) {
|
|
|
23
31
|
};
|
|
24
32
|
};
|
|
25
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Stands in for a reference the user is not allowed to read. It never names the object, because the
|
|
36
|
+
* reference is the object's identifier; the rest of the text keeps its own values.
|
|
37
|
+
*/
|
|
38
|
+
function createRestrictedMarker(intl, text) {
|
|
39
|
+
return {
|
|
40
|
+
type: "element",
|
|
41
|
+
tagName: "span",
|
|
42
|
+
properties: {
|
|
43
|
+
className: "gd-rich-text-metric-restricted gd-icon-lock",
|
|
44
|
+
},
|
|
45
|
+
position: text?.position ?? undefined,
|
|
46
|
+
children: [{ type: "text", value: intl.formatMessage({ id: "richText.restricted" }) }],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
26
49
|
function iterateTree(node, callbacks) {
|
|
27
50
|
//Text type
|
|
28
51
|
if (node.type === "text") {
|
|
@@ -18,79 +18,79 @@ export type IBreakpointsConfig = {
|
|
|
18
18
|
*
|
|
19
19
|
* @internal
|
|
20
20
|
*/
|
|
21
|
-
export interface IMediaQueries {
|
|
21
|
+
export interface IMediaQueries<T> {
|
|
22
22
|
/**
|
|
23
23
|
* Is screen classified as smaller than 'sm'?
|
|
24
24
|
*/
|
|
25
|
-
"<sm":
|
|
25
|
+
"<sm": T;
|
|
26
26
|
/**
|
|
27
27
|
* Is screen classified as 'sm' or larger?
|
|
28
28
|
*/
|
|
29
|
-
">=sm":
|
|
29
|
+
">=sm": T;
|
|
30
30
|
/**
|
|
31
31
|
* Is screen classified as 'sm'?
|
|
32
32
|
*/
|
|
33
|
-
sm:
|
|
33
|
+
sm: T;
|
|
34
34
|
/**
|
|
35
35
|
* Is screen classified as 'md' or larger?
|
|
36
36
|
*/
|
|
37
|
-
">=md":
|
|
37
|
+
">=md": T;
|
|
38
38
|
/**
|
|
39
39
|
* Is screen classified as 'md' or smaller?
|
|
40
40
|
*/
|
|
41
|
-
"<=md":
|
|
41
|
+
"<=md": T;
|
|
42
42
|
/**
|
|
43
43
|
* Is screen classified as 'md'?
|
|
44
44
|
*/
|
|
45
|
-
md:
|
|
45
|
+
md: T;
|
|
46
46
|
/**
|
|
47
47
|
* Is screen classified as 'lg' or larger?
|
|
48
48
|
*/
|
|
49
|
-
">=lg":
|
|
49
|
+
">=lg": T;
|
|
50
50
|
/**
|
|
51
51
|
* Is screen classified as 'lg' or smaller?
|
|
52
52
|
*/
|
|
53
|
-
"<=lg":
|
|
53
|
+
"<=lg": T;
|
|
54
54
|
/**
|
|
55
55
|
* Is screen classified as 'lg'?
|
|
56
56
|
*/
|
|
57
|
-
lg:
|
|
57
|
+
lg: T;
|
|
58
58
|
/**
|
|
59
59
|
* Is screen classified as 'xl' or smaller?
|
|
60
60
|
*/
|
|
61
|
-
"<=xl":
|
|
61
|
+
"<=xl": T;
|
|
62
62
|
/**
|
|
63
63
|
* Is screen classified as 'xl' or larger?
|
|
64
64
|
*/
|
|
65
|
-
">=xl":
|
|
65
|
+
">=xl": T;
|
|
66
66
|
/**
|
|
67
67
|
* Is screen classified as 'xl'?
|
|
68
68
|
*/
|
|
69
|
-
xl:
|
|
69
|
+
xl: T;
|
|
70
70
|
/**
|
|
71
71
|
* Is screen classified as 'xxl' or larger?
|
|
72
72
|
*/
|
|
73
|
-
">=xxl":
|
|
73
|
+
">=xxl": T;
|
|
74
74
|
/**
|
|
75
75
|
* Is screen classified as 'xxl'?
|
|
76
76
|
*/
|
|
77
|
-
xxl:
|
|
77
|
+
xxl: T;
|
|
78
78
|
/**
|
|
79
79
|
* Is screen classified as a mobile device?
|
|
80
80
|
*/
|
|
81
|
-
mobileDevice:
|
|
81
|
+
mobileDevice: T;
|
|
82
82
|
/**
|
|
83
83
|
* Is screen classified as other than mobile device?
|
|
84
84
|
*/
|
|
85
|
-
"!mobileDevice":
|
|
85
|
+
"!mobileDevice": T;
|
|
86
86
|
/**
|
|
87
87
|
* Is screen classified as a desktop device?
|
|
88
88
|
*/
|
|
89
|
-
desktop:
|
|
89
|
+
desktop: T;
|
|
90
90
|
/**
|
|
91
91
|
* Is screen classified as smaller than desktop device?
|
|
92
92
|
*/
|
|
93
|
-
"<desktop":
|
|
93
|
+
"<desktop": T;
|
|
94
94
|
}
|
|
95
95
|
/**
|
|
96
96
|
* The responsive configuration serves to configure breakpoints and other constants
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/responsive/interfaces.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;KAC5B,CAAC,IAAI,oBAAoB,GAAG,MAAM;CACtC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,aAAa;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/responsive/interfaces.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,KAAK,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAE5E;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;KAC5B,CAAC,IAAI,oBAAoB,GAAG,MAAM;CACtC,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC5B;;OAEG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,EAAE,EAAE,CAAC,CAAC;IAEN;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,EAAE,EAAE,CAAC,CAAC;IAEN;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,EAAE,EAAE,CAAC,CAAC;IAEN;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IAEV;;OAEG;IACH,EAAE,EAAE,CAAC,CAAC;IAEN;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,GAAG,EAAE,CAAC,CAAC;IAEP;;OAEG;IACH,YAAY,EAAE,CAAC,CAAC;IAEhB;;OAEG;IACH,eAAe,EAAE,CAAC,CAAC;IAEnB;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC;IAEX;;OAEG;IACH,UAAU,EAAE,CAAC,CAAC;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,kBAAkB,CAAC;CACnC"}
|
|
@@ -4,7 +4,8 @@ import { type IMediaQueries } from "./interfaces.js";
|
|
|
4
4
|
*
|
|
5
5
|
* @internal
|
|
6
6
|
* @param mediaQueryName - media query name to test
|
|
7
|
+
* @param anchor - anchor point for the media query. If provided, the media query will be tested against the anchor point.
|
|
7
8
|
* @returns boolean
|
|
8
9
|
*/
|
|
9
|
-
export declare const useMediaQuery: (mediaQueryName: keyof IMediaQueries) => boolean;
|
|
10
|
+
export declare const useMediaQuery: (mediaQueryName: keyof IMediaQueries<string>, anchor?: number) => boolean;
|
|
10
11
|
//# sourceMappingURL=useMediaQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../src/responsive/useMediaQuery.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"useMediaQuery.d.ts","sourceRoot":"","sources":["../../src/responsive/useMediaQuery.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAmCrD;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,mBAAoB,MAAM,aAAa,CAAC,MAAM,CAAC,WAAW,MAAM,KAAG,OA+F5F,CAAC"}
|
|
@@ -3,17 +3,33 @@ import { useMediaQuery as useReactResponsiveMediaQuery } from "react-responsive"
|
|
|
3
3
|
import { invariant } from "ts-invariant";
|
|
4
4
|
import { useResponsiveContext } from "./ResponsiveContext.js";
|
|
5
5
|
const SCREEN = "only screen";
|
|
6
|
-
const getQueryMatching = (range) =>
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const getQueryMatching = (range) => {
|
|
7
|
+
return `${SCREEN} and (min-width:${range.lower}px) and (max-width:${range.upper}px)`;
|
|
8
|
+
};
|
|
9
|
+
const getQueryMatchingOrGreater = (range) => {
|
|
10
|
+
return `${SCREEN} and (min-width:${range.lower}px)`;
|
|
11
|
+
};
|
|
12
|
+
const getQueryMatchingOrSmaller = (range) => {
|
|
13
|
+
return `${SCREEN} and (max-width:${range.upper}px)`;
|
|
14
|
+
};
|
|
15
|
+
const getAnchorMatching = (range, anchor = -1) => {
|
|
16
|
+
return range.lower <= anchor && anchor <= range.upper;
|
|
17
|
+
};
|
|
18
|
+
const getAnchorMatchingOrGreater = (range, anchor = -1) => {
|
|
19
|
+
return range.lower <= anchor && anchor >= 0;
|
|
20
|
+
};
|
|
21
|
+
const getAnchorMatchingOrSmaller = (range, anchor = -1) => {
|
|
22
|
+
return range.upper >= anchor && anchor >= 0;
|
|
23
|
+
};
|
|
9
24
|
/**
|
|
10
25
|
* Hook, testing whether screen width matches provided media query.
|
|
11
26
|
*
|
|
12
27
|
* @internal
|
|
13
28
|
* @param mediaQueryName - media query name to test
|
|
29
|
+
* @param anchor - anchor point for the media query. If provided, the media query will be tested against the anchor point.
|
|
14
30
|
* @returns boolean
|
|
15
31
|
*/
|
|
16
|
-
export const useMediaQuery = (mediaQueryName) => {
|
|
32
|
+
export const useMediaQuery = (mediaQueryName, anchor) => {
|
|
17
33
|
const { breakpoints } = useResponsiveContext();
|
|
18
34
|
const smallRange = {
|
|
19
35
|
lower: 0,
|
|
@@ -68,7 +84,32 @@ export const useMediaQuery = (mediaQueryName) => {
|
|
|
68
84
|
desktop: getQueryMatching(desktopRange),
|
|
69
85
|
"<desktop": getQueryMatching(smallerThanDesktop),
|
|
70
86
|
};
|
|
87
|
+
const mediaAnchors = {
|
|
88
|
+
"<sm": getAnchorMatching(smallRange, anchor),
|
|
89
|
+
">=sm": getAnchorMatchingOrGreater(smallRange, anchor),
|
|
90
|
+
sm: getAnchorMatching(smallRange, anchor),
|
|
91
|
+
">=md": getAnchorMatchingOrGreater(mediumRange, anchor),
|
|
92
|
+
"<=md": getAnchorMatchingOrSmaller(mediumRange, anchor),
|
|
93
|
+
md: getAnchorMatching(mediumRange, anchor),
|
|
94
|
+
">=lg": getAnchorMatchingOrGreater(largeRange, anchor),
|
|
95
|
+
"<=lg": getAnchorMatchingOrSmaller(largeRange, anchor),
|
|
96
|
+
lg: getAnchorMatching(largeRange, anchor),
|
|
97
|
+
"<=xl": getAnchorMatchingOrSmaller(xlargeRange, anchor),
|
|
98
|
+
">=xl": getAnchorMatchingOrGreater(xlargeRange, anchor),
|
|
99
|
+
xl: getAnchorMatching(xlargeRange, anchor),
|
|
100
|
+
">=xxl": getAnchorMatchingOrGreater(xxlargeRange, anchor),
|
|
101
|
+
xxl: getAnchorMatching(xxlargeRange, anchor),
|
|
102
|
+
mobileDevice: getAnchorMatching(mobileRange, anchor),
|
|
103
|
+
"!mobileDevice": getAnchorMatching(notMobileRange, anchor),
|
|
104
|
+
desktop: getAnchorMatching(desktopRange, anchor),
|
|
105
|
+
"<desktop": getAnchorMatching(smallerThanDesktop, anchor),
|
|
106
|
+
};
|
|
71
107
|
const mediaQuery = mediaQueries[mediaQueryName];
|
|
72
108
|
invariant(mediaQuery, `Please provide valid media query name! Actual: ${mediaQuery}`);
|
|
73
|
-
|
|
109
|
+
const query = useReactResponsiveMediaQuery({ query: mediaQuery });
|
|
110
|
+
const anchored = mediaAnchors[mediaQueryName];
|
|
111
|
+
if (anchor) {
|
|
112
|
+
return anchored;
|
|
113
|
+
}
|
|
114
|
+
return query;
|
|
74
115
|
};
|