@etsoo/react 1.6.54 → 1.6.55

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.
@@ -1,3 +1,4 @@
1
+ import { EntityStatus } from '@etsoo/appscript';
1
2
  import { DataTypes } from '@etsoo/shared';
2
3
  import React from 'react';
3
4
  import { GridLoaderStates } from './GridLoader';
@@ -16,6 +17,16 @@ export type GridAlign = 'center' | 'inherit' | 'justify' | 'left' | 'right';
16
17
  * @param type Data type
17
18
  */
18
19
  export declare const GridAlignGet: (align?: GridAlign, type?: GridDataType) => GridAlign | undefined;
20
+ /**
21
+ * Grid deleted cell box style
22
+ * @param data Data
23
+ * @returns Result
24
+ */
25
+ export declare const GridDeletedCellBoxStyle: (data: undefined | {
26
+ status: EntityStatus;
27
+ } | {
28
+ entityStatus: EntityStatus;
29
+ }) => React.CSSProperties;
19
30
  /**
20
31
  * Grid cell value type
21
32
  */
@@ -164,7 +175,7 @@ export type GridColumn<T> = {
164
175
  /**
165
176
  * Cell box style
166
177
  */
167
- cellBoxStyle?: ((data: T) => React.CSSProperties) | React.CSSProperties;
178
+ cellBoxStyle?: ((data: T | undefined) => React.CSSProperties) | React.CSSProperties;
168
179
  /**
169
180
  * Render props
170
181
  */
@@ -1,3 +1,4 @@
1
+ import { EntityStatus } from '@etsoo/appscript';
1
2
  import { DataTypes } from '@etsoo/shared';
2
3
  /**
3
4
  * Grid data type
@@ -21,3 +22,20 @@ export const GridAlignGet = (align, type) => {
21
22
  }
22
23
  return align;
23
24
  };
25
+ /**
26
+ * Grid deleted cell box style
27
+ * @param data Data
28
+ * @returns Result
29
+ */
30
+ export const GridDeletedCellBoxStyle = (data) => {
31
+ if (data == null)
32
+ return {};
33
+ const status = 'status' in data
34
+ ? data.status
35
+ : 'entityStatus' in data
36
+ ? data.entityStatus
37
+ : EntityStatus.Normal;
38
+ if (status >= EntityStatus.Inactivated)
39
+ return { textDecoration: 'line-through', color: 'red' };
40
+ return {};
41
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/react",
3
- "version": "1.6.54",
3
+ "version": "1.6.55",
4
4
  "description": "TypeScript ReactJs UI Independent Framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -1,3 +1,4 @@
1
+ import { EntityStatus } from '@etsoo/appscript';
1
2
  import { DataTypes } from '@etsoo/shared';
2
3
  import React from 'react';
3
4
  import { GridLoaderStates } from './GridLoader';
@@ -32,6 +33,29 @@ export const GridAlignGet = (align?: GridAlign, type?: GridDataType) => {
32
33
  return align;
33
34
  };
34
35
 
36
+ /**
37
+ * Grid deleted cell box style
38
+ * @param data Data
39
+ * @returns Result
40
+ */
41
+ export const GridDeletedCellBoxStyle = (
42
+ data: undefined | { status: EntityStatus } | { entityStatus: EntityStatus }
43
+ ): React.CSSProperties => {
44
+ if (data == null) return {};
45
+
46
+ const status =
47
+ 'status' in data
48
+ ? data.status
49
+ : 'entityStatus' in data
50
+ ? data.entityStatus
51
+ : EntityStatus.Normal;
52
+
53
+ if (status >= EntityStatus.Inactivated)
54
+ return { textDecoration: 'line-through', color: 'red' };
55
+
56
+ return {};
57
+ };
58
+
35
59
  /**
36
60
  * Grid cell value type
37
61
  */
@@ -210,7 +234,9 @@ export type GridColumn<T> = {
210
234
  /**
211
235
  * Cell box style
212
236
  */
213
- cellBoxStyle?: ((data: T) => React.CSSProperties) | React.CSSProperties;
237
+ cellBoxStyle?:
238
+ | ((data: T | undefined) => React.CSSProperties)
239
+ | React.CSSProperties;
214
240
 
215
241
  /**
216
242
  * Render props