@addev-be/ui 0.19.4 → 0.20.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@addev-be/ui",
3
- "version": "0.19.4",
3
+ "version": "0.20.0",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "watch": "tsc -b --watch",
@@ -20,7 +20,7 @@
20
20
  "update-version": "../../node/update-version.mjs"
21
21
  },
22
22
  "devDependencies": {
23
- "@addev-be/framework-utils": "^0.19.4",
23
+ "@addev-be/framework-utils": "^0.20.0",
24
24
  "@types/lodash": "^4",
25
25
  "@types/react": "^18.3.3",
26
26
  "@types/react-dom": "^18.3.0",
@@ -12,6 +12,8 @@ const NumberEditableCellInner = <R,>(
12
12
  {
13
13
  decimals = 0,
14
14
  currency,
15
+ prefix: prefixFromProps,
16
+ suffix: suffixFromProps,
15
17
  row,
16
18
  value,
17
19
  onChange,
@@ -19,16 +21,21 @@ const NumberEditableCellInner = <R,>(
19
21
  }: DataGridEditableCellProps<R, number> & {
20
22
  decimals?: number;
21
23
  currency?: string | ((row: R) => string);
24
+ prefix?: string;
25
+ suffix?: string;
22
26
  },
23
27
  ref: ForwardedRef<HTMLElement>
24
28
  ) => {
25
29
  const currencyName =
26
30
  typeof currency === 'function' ? currency(row) : currency;
27
31
 
28
- const [prefix, suffix] = currencyName
32
+ const [prefixFromCurrency, suffixFromCurrency] = currencyName
29
33
  ? getCurrencySymbol(currencyName)
30
34
  : [undefined, undefined];
31
35
 
36
+ const prefix = prefixFromProps || prefixFromCurrency;
37
+ const suffix = suffixFromProps || suffixFromCurrency;
38
+
32
39
  const onBlur = useCallback(() => {
33
40
  onClose(true);
34
41
  }, [onClose]);
@@ -78,6 +78,8 @@ export type DataGridNumberColumn<R> = EditableDataGridColumn<R, number> & {
78
78
  type: 'number';
79
79
  decimals?: number;
80
80
  currency?: string | ((row: R) => string);
81
+ prefix?: string;
82
+ suffix?: string;
81
83
  };
82
84
 
83
85
  export type DataGridDateColumn<R> = EditableDataGridColumn<R, string> & {
@@ -1,3 +1,4 @@
1
+ /* eslint-disable react/display-name */
1
2
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
3
 
3
4
  import { Ref, forwardRef, useContext } from 'react';
@@ -206,6 +207,8 @@ export const sqlNumberColumn = <R extends Record<string, any>>(
206
207
  ref={ref}
207
208
  decimals={column.decimals}
208
209
  currency={column.currency}
210
+ prefix={column.prefix}
211
+ suffix={column.suffix}
209
212
  {...props}
210
213
  />
211
214
  )),