@tint-ui/data-table 0.3.13 → 0.3.14

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.
@@ -29,11 +29,12 @@ const rowButtonMenu = (info, menu) => {
29
29
  } = item;
30
30
  const {
31
31
  disabled,
32
- onClick
32
+ onClick,
33
+ getLabel
33
34
  } = rowHandler(item);
34
35
  return /*#__PURE__*/React.createElement(_tooltip.TooltipText, {
35
36
  key: id,
36
- tooltip: label,
37
+ tooltip: getLabel(label),
37
38
  asChild: true
38
39
  }, /*#__PURE__*/React.createElement(_button.Button, {
39
40
  disabled: disabled || loading,
@@ -37,7 +37,8 @@ const rowPopoverMenu = (info, menu) => {
37
37
  } = item;
38
38
  const {
39
39
  disabled,
40
- onClick
40
+ onClick,
41
+ getLabel
41
42
  } = rowMenu(item);
42
43
  return /*#__PURE__*/React.createElement(_dropdownMenu.DropdownMenuItem, {
43
44
  key: id,
@@ -46,7 +47,7 @@ const rowPopoverMenu = (info, menu) => {
46
47
  onSelect: onClick
47
48
  }, icon != null && /*#__PURE__*/React.createElement(_svgIcon.SvgThemeIcon, {
48
49
  icon: icon
49
- }), label);
50
+ }), getLabel(label));
50
51
  }))));
51
52
  };
52
53
  exports.rowPopoverMenu = rowPopoverMenu;
@@ -45,6 +45,9 @@ const useRowMenu = info => {
45
45
  }
46
46
  return {
47
47
  disabled,
48
+ getLabel(label) {
49
+ return label.includes("{{") ? app.replace(label, data) : label;
50
+ },
48
51
  onClick() {
49
52
  if (confirmation) {
50
53
  const message = app.replace(confirmation, data);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tint-ui/data-table",
3
- "version": "0.3.13",
3
+ "version": "0.3.14",
4
4
  "author": "phragon@websoftlab.com",
5
5
  "license": "MIT",
6
6
  "dependencies": {
@@ -25,11 +25,12 @@ const rowButtonMenu = (info, menu) => {
25
25
  } = item;
26
26
  const {
27
27
  disabled,
28
- onClick
28
+ onClick,
29
+ getLabel
29
30
  } = rowHandler(item);
30
31
  return /*#__PURE__*/React.createElement(TooltipText, {
31
32
  key: id,
32
- tooltip: label,
33
+ tooltip: getLabel(label),
33
34
  asChild: true
34
35
  }, /*#__PURE__*/React.createElement(Button, {
35
36
  disabled: disabled || loading,
@@ -33,7 +33,8 @@ const rowPopoverMenu = (info, menu) => {
33
33
  } = item;
34
34
  const {
35
35
  disabled,
36
- onClick
36
+ onClick,
37
+ getLabel
37
38
  } = rowMenu(item);
38
39
  return /*#__PURE__*/React.createElement(DropdownMenuItem, {
39
40
  key: id,
@@ -42,7 +43,7 @@ const rowPopoverMenu = (info, menu) => {
42
43
  onSelect: onClick
43
44
  }, icon != null && /*#__PURE__*/React.createElement(SvgThemeIcon, {
44
45
  icon: icon
45
- }), label);
46
+ }), getLabel(label));
46
47
  }))));
47
48
  };
48
49
  export { rowPopoverMenu };
package/use-row-menu.d.ts CHANGED
@@ -2,6 +2,7 @@ import type { CellContext } from "@tanstack/react-table";
2
2
  import type { RowMenuOption } from "./types";
3
3
  declare const useRowMenu: <TData>(info: CellContext<TData, unknown>) => (item: Pick<RowMenuOption<TData>, "onClick" | "trigger" | "confirmation" | "disabledKey" | "triggerKey">) => {
4
4
  disabled: boolean;
5
+ getLabel(label: string): string;
5
6
  onClick(): void;
6
7
  };
7
8
  export { useRowMenu };
package/use-row-menu.js CHANGED
@@ -43,6 +43,9 @@ const useRowMenu = info => {
43
43
  }
44
44
  return {
45
45
  disabled,
46
+ getLabel(label) {
47
+ return label.includes("{{") ? app.replace(label, data) : label;
48
+ },
46
49
  onClick() {
47
50
  if (confirmation) {
48
51
  const message = app.replace(confirmation, data);