@gooddata/sdk-ui-metric-component 11.65.2-alpha.1 → 11.65.2-alpha.2

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.
@@ -10,7 +10,7 @@ export interface IEditableRowProps {
10
10
  useReferences?: boolean;
11
11
  separators?: ISeparators;
12
12
  }
13
- declare function EditableRowComponent({ value, onChange, placeholder, className, autoResize, onHeightChange, useReferences, separators, }: IEditableRowProps): import("react/jsx-runtime").JSX.Element;
13
+ declare function EditableRowComponent({ value, onChange, placeholder, className, readOnly, autoResize, onHeightChange, useReferences, separators, }: IEditableRowProps): import("react/jsx-runtime").JSX.Element | null;
14
14
  export declare const EditableRow: import("react").MemoExoticComponent<typeof EditableRowComponent>;
15
15
  export {};
16
16
  //# sourceMappingURL=EditableRow.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EditableRow.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/Form/EditableRow/EditableRow.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AA6DvD,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,iBAAS,oBAAoB,CAAC,EAC1B,KAAU,EACV,QAAQ,EACR,WAAgB,EAChB,SAAS,EACT,UAAU,EACV,cAAc,EACd,aAAqB,EACrB,UAAU,GACb,EAAE,iBAAiB,2CA+CnB;AAED,eAAO,MAAM,WAAW,kEAA6B,CAAC"}
1
+ {"version":3,"file":"EditableRow.d.ts","sourceRoot":"","sources":["../../../../src/MetricComponent/Form/EditableRow/EditableRow.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAmEvD,MAAM,WAAW,iBAAiB;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED,iBAAS,oBAAoB,CAAC,EAC1B,KAAU,EACV,QAAQ,EACR,WAAgB,EAChB,SAAS,EACT,QAAgB,EAChB,UAAU,EACV,cAAc,EACd,aAAqB,EACrB,UAAU,GACb,EAAE,iBAAiB,kDAuDnB;AAED,eAAO,MAAM,WAAW,kEAA6B,CAAC"}
@@ -25,6 +25,12 @@ const useStyles = makeStyles()((theme) => {
25
25
  "&:hover": {
26
26
  border: `1px solid ${theme.tabs.colors.border}`,
27
27
  },
28
+ "&.readOnly": {
29
+ cursor: "default",
30
+ "&:hover": {
31
+ borderColor: "transparent",
32
+ },
33
+ },
28
34
  textarea: {
29
35
  lineHeight: "19px",
30
36
  padding: 0,
@@ -58,12 +64,15 @@ const richTextTooltipAlignPoints = [
58
64
  { align: "bl tl", offset: { x: 6, y: 4 } },
59
65
  { align: "tl bl", offset: { x: 6, y: -4 } },
60
66
  ];
61
- function EditableRowComponent({ value = "", onChange, placeholder = "", className, autoResize, onHeightChange, useReferences = false, separators, }) {
67
+ function EditableRowComponent({ value = "", onChange, placeholder = "", className, readOnly = false, autoResize, onHeightChange, useReferences = false, separators, }) {
62
68
  const { classes } = useStyles();
63
69
  const [richTextEditMode, setRichTextEditMode] = useState(false);
70
+ const isEditing = !readOnly && richTextEditMode;
64
71
  const handleRichTextClick = useCallback(() => {
65
- setRichTextEditMode(true);
66
- }, []);
72
+ if (!readOnly) {
73
+ setRichTextEditMode(true);
74
+ }
75
+ }, [readOnly]);
67
76
  const handleRichTextBlur = useCallback(() => {
68
77
  setRichTextEditMode(false);
69
78
  }, []);
@@ -73,10 +82,14 @@ function EditableRowComponent({ value = "", onChange, placeholder = "", classNam
73
82
  onHeightChange(element.current.clientHeight);
74
83
  }
75
84
  });
85
+ if (readOnly && value.length === 0) {
86
+ return null;
87
+ }
76
88
  return (_jsx("div", { className: cx(classes.root, className), ref: element, children: _jsx("div", { className: cx(classes.richText, {
77
- active: richTextEditMode,
78
- [classes.richTextView]: !richTextEditMode && value,
89
+ active: isEditing,
90
+ readOnly,
91
+ [classes.richTextView]: !isEditing && value,
79
92
  [classes.richTextFit]: autoResize,
80
- }), onClick: handleRichTextClick, onBlur: handleRichTextBlur, children: _jsx(RichTextWithTooltip, { value: value, renderMode: richTextEditMode ? "edit" : "view", editRows: 5, autoResize: autoResize, showTooltip: richTextEditMode, editPlaceholder: placeholder, emptyElement: _jsx("div", { className: classes.richTextViewEmpty, children: placeholder }), tooltipAlignPoints: richTextTooltipAlignPoints, onChange: onChange, separators: separators, referencesEnabled: useReferences }) }) }));
93
+ }), onClick: handleRichTextClick, onBlur: handleRichTextBlur, children: _jsx(RichTextWithTooltip, { value: value, renderMode: isEditing ? "edit" : "view", editRows: 5, autoResize: autoResize, showTooltip: isEditing, editPlaceholder: placeholder, emptyElement: _jsx("div", { className: classes.richTextViewEmpty, children: placeholder }), tooltipAlignPoints: richTextTooltipAlignPoints, onChange: onChange, separators: separators, referencesEnabled: useReferences }) }) }));
81
94
  }
82
95
  export const EditableRow = memo(EditableRowComponent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/sdk-ui-metric-component",
3
- "version": "11.65.2-alpha.1",
3
+ "version": "11.65.2-alpha.2",
4
4
  "license": "LicenseRef-LICENSE",
5
5
  "author": "GoodData Corporation",
6
6
  "repository": {
@@ -33,17 +33,17 @@
33
33
  "vscode-languageserver-textdocument": "1.0.12",
34
34
  "vscode-languageserver-types": "3.17.5",
35
35
  "yup": "0.32.11",
36
- "@gooddata/api-client-tiger": "11.65.2-alpha.1",
37
- "@gooddata/sdk-backend-spi": "11.65.2-alpha.1",
38
- "@gooddata/sdk-backend-tiger": "11.65.2-alpha.1",
39
- "@gooddata/sdk-maql-language-server": "11.65.2-alpha.1",
40
- "@gooddata/sdk-ui": "11.65.2-alpha.1",
41
- "@gooddata/sdk-model": "11.65.2-alpha.1",
42
- "@gooddata/sdk-ui-charts": "11.65.2-alpha.1",
43
- "@gooddata/sdk-ui-kit": "11.65.2-alpha.1",
44
- "@gooddata/sdk-ui-pivot": "11.65.2-alpha.1",
45
- "@gooddata/util": "11.65.2-alpha.1",
46
- "@gooddata/sdk-ui-ext": "11.65.2-alpha.1"
36
+ "@gooddata/api-client-tiger": "11.65.2-alpha.2",
37
+ "@gooddata/sdk-backend-spi": "11.65.2-alpha.2",
38
+ "@gooddata/sdk-maql-language-server": "11.65.2-alpha.2",
39
+ "@gooddata/sdk-backend-tiger": "11.65.2-alpha.2",
40
+ "@gooddata/sdk-model": "11.65.2-alpha.2",
41
+ "@gooddata/sdk-ui": "11.65.2-alpha.2",
42
+ "@gooddata/sdk-ui-charts": "11.65.2-alpha.2",
43
+ "@gooddata/sdk-ui-ext": "11.65.2-alpha.2",
44
+ "@gooddata/sdk-ui-kit": "11.65.2-alpha.2",
45
+ "@gooddata/util": "11.65.2-alpha.2",
46
+ "@gooddata/sdk-ui-pivot": "11.65.2-alpha.2"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@microsoft/api-documenter": "7.30.16",
@@ -66,7 +66,7 @@
66
66
  "eslint-plugin-regexp": "1.15.0",
67
67
  "eslint-plugin-sonarjs": "3.0.6",
68
68
  "eslint-plugin-tsdoc": "0.2.14",
69
- "happy-dom": "20.12.0",
69
+ "happy-dom": "21.0.4",
70
70
  "jiti": "2.6.1",
71
71
  "npm-run-all": "4.1.5",
72
72
  "oxfmt": "0.68.0",
@@ -75,14 +75,14 @@
75
75
  "oxlint-tsgolint": "7.0.2001",
76
76
  "react": "19.1.1",
77
77
  "react-dom": "19.1.1",
78
- "rolldown": "1.0.3",
78
+ "rolldown": "1.2.14",
79
79
  "typescript": "7.0.2",
80
80
  "vitest": "5.0.4",
81
- "@gooddata/eslint-config": "11.65.2-alpha.1",
82
- "@gooddata/oxlint-config": "11.65.2-alpha.1",
83
- "@gooddata/i18n-toolkit": "11.65.2-alpha.1",
84
- "@gooddata/sdk-backend-base": "11.65.2-alpha.1",
85
- "@gooddata/sdk-ui-theme-provider": "11.65.2-alpha.1"
81
+ "@gooddata/eslint-config": "11.65.2-alpha.2",
82
+ "@gooddata/i18n-toolkit": "11.65.2-alpha.2",
83
+ "@gooddata/oxlint-config": "11.65.2-alpha.2",
84
+ "@gooddata/sdk-backend-base": "11.65.2-alpha.2",
85
+ "@gooddata/sdk-ui-theme-provider": "11.65.2-alpha.2"
86
86
  },
87
87
  "peerDependencies": {
88
88
  "react": "^18.0.0 || ^19.0.0",