@pega/lists-core 9.0.0-build.3.2 → 9.0.0-build.3.4
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/lib/index.d.ts +2 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -2
- package/lib/index.js.map +1 -1
- package/lib/src/core/constants.d.ts +11 -101
- package/lib/src/core/constants.d.ts.map +1 -1
- package/lib/src/core/constants.js +6 -6
- package/lib/src/core/constants.js.map +1 -1
- package/lib/src/core/features/featureFactory.d.ts.map +1 -1
- package/lib/src/core/features/featureFactory.js +0 -1
- package/lib/src/core/features/featureFactory.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js +12 -5
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/autoSize.js.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js +13 -1
- package/lib/src/core/features/uIFeatures/afterRender/columnSizing/index.js.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.js +4 -0
- package/lib/src/core/features/uIFeatures/beforeRender/rowHeight.js.map +1 -1
- package/lib/src/core/features/uIFeatures/index.d.ts +0 -2
- package/lib/src/core/features/uIFeatures/index.d.ts.map +1 -1
- package/lib/src/core/features/uIFeatures/index.js +0 -2
- package/lib/src/core/features/uIFeatures/index.js.map +1 -1
- package/lib/src/core/generators/ViewGenerator.d.ts.map +1 -1
- package/lib/src/core/generators/ViewGenerator.js +7 -2
- package/lib/src/core/generators/ViewGenerator.js.map +1 -1
- package/lib/src/core/utils/util.d.ts +1 -0
- package/lib/src/core/utils/util.d.ts.map +1 -1
- package/lib/src/core/utils/util.js +7 -1
- package/lib/src/core/utils/util.js.map +1 -1
- package/lib/types/Meta.types.d.ts +25 -0
- package/lib/types/Meta.types.d.ts.map +1 -1
- package/lib/types/Meta.types.js +3 -0
- package/lib/types/Meta.types.js.map +1 -1
- package/package.json +4 -4
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.d.ts +0 -7
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.d.ts.map +0 -1
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.js +0 -24
- package/lib/src/core/features/uIFeatures/beforeRender/resizeGroupedDragDropColumn.js.map +0 -1
package/lib/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { getMockColumn } from './src/core/test/junitMocks';
|
|
|
8
8
|
export { getGroupKey, getGroupFromKey } from './src/core/utils/util';
|
|
9
9
|
export { default as BaseA11y } from './src/core/a11y/BaseA11y';
|
|
10
10
|
export type { RsCoreTypes } from './types';
|
|
11
|
-
export { ROW_DENSITY } from './types/Meta.types';
|
|
12
|
-
export { REPEATING_STRUCTURE_TEMPLATES } from './types/Meta.types';
|
|
11
|
+
export { ROW_DENSITY, FieldType } from './types/Meta.types';
|
|
12
|
+
export { REPEATING_STRUCTURE_TEMPLATES, cellUpdateTrigger } from './types/Meta.types';
|
|
13
13
|
export { sanitizeConditionalStyleFormats } from './src/core/features/uIFeatures/beforeRender/stateSanitization';
|
|
14
14
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAG/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AAElG,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEtF,OAAO,EACL,iBAAiB,EACj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BAAsB,CAAC;AAC9B,eAAO,MACL,iBAAiB,qBACjB,wBAAwB,4BACxB,eAAe,oBACf,mBAAmB,uBACnB,wBAAwB,4BACxB,qBAAqB,wBACrB,oBAAoB,sBACP,CAAC;AAEhB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAE/D,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+DAA+D,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@ export const { UPDATE_DEBUG_INFO, TOGGLE_DISABLE_SELECTION, TOGGLE_REQUIRED, NOT
|
|
|
9
9
|
export { getMockColumn } from './src/core/test/junitMocks';
|
|
10
10
|
export { getGroupKey, getGroupFromKey } from './src/core/utils/util';
|
|
11
11
|
export { default as BaseA11y } from './src/core/a11y/BaseA11y';
|
|
12
|
-
export { ROW_DENSITY } from './types/Meta.types';
|
|
13
|
-
export { REPEATING_STRUCTURE_TEMPLATES } from './types/Meta.types';
|
|
12
|
+
export { ROW_DENSITY, FieldType } from './types/Meta.types';
|
|
13
|
+
export { REPEATING_STRUCTURE_TEMPLATES, cellUpdateTrigger } from './types/Meta.types';
|
|
14
14
|
export { sanitizeConditionalStyleFormats } from './src/core/features/uIFeatures/beforeRender/stateSanitization';
|
|
15
15
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OA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C;AAEtF,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,OAAO,EACP,aAAa,EACd,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,MAAM,CAAC,MAAM,EACX,iBAAiB,EACjB,wBAAwB,EACxB,eAAe,EACf,mBAAmB,EACnB,wBAAwB,EACxB,qBAAqB,EACrB,oBAAoB,EACrB,GAAG,WAAW,CAAC;AAEhB,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAErE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAI/D,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,EAAE,6BAA6B,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEtF,OAAO,EAAE,+BAA+B,EAAE,MAAM,+DAA+D,CAAC","sourcesContent":["import ActionTypes from './src/core/actions/actionConstants';\n\nexport { default as initializeRsCore } from './src/core/index';\n\n// FIXME: revisit below exports\nexport { convertMetaIntoState } from './src/core/features/uIFeatures/beforeRender/stateHydration';\n\nexport { filterParams, typeMap, comparatorMap } from './src/core/config/filterConfig';\n\nexport {\n getVisibileFields,\n dateFunctionLabels,\n getScrollbarWidth,\n getScrollerElem,\n getRowContextData,\n getFilterInitializers,\n getFilterConditions,\n isFilterApplied,\n addFilter,\n getFilters,\n removeEmptyValues,\n isEmpty,\n normalizeMeta\n} from './src/core/utils/util';\n\nexport {\n ACTION_FIELD_TYPE,\n expandCollapseAllMeta,\n rowErrorColumnMeta,\n rowDragDropColumnMeta\n} from './src/core/constants';\nexport const {\n UPDATE_DEBUG_INFO,\n TOGGLE_DISABLE_SELECTION,\n TOGGLE_REQUIRED,\n NOTIFY_DATA_REFRESH,\n USER_CONFIRMATION_ACTION,\n SET_IN_EXTERNAL_STATE,\n UPDATE_SELECTED_ROWS\n} = ActionTypes;\n\nexport { getMockColumn } from './src/core/test/junitMocks';\nexport { getGroupKey, getGroupFromKey } from './src/core/utils/util';\n\nexport { default as BaseA11y } from './src/core/a11y/BaseA11y';\n\nexport type { RsCoreTypes } from './types';\n\nexport { ROW_DENSITY, FieldType } from './types/Meta.types';\n\nexport { REPEATING_STRUCTURE_TEMPLATES, cellUpdateTrigger } from './types/Meta.types';\n\nexport { sanitizeConditionalStyleFormats } from './src/core/features/uIFeatures/beforeRender/stateSanitization';\n"]}
|
|
@@ -1,115 +1,24 @@
|
|
|
1
|
+
import type { OmitStrict } from '@pega/cosmos-react-core';
|
|
2
|
+
import type { ColumnConfig } from './generators/ColumnGenerator.types';
|
|
1
3
|
export declare const nonPersonalizationViewKey = "nonPersonalizationViewKey";
|
|
2
4
|
export declare const defaultPresetIdIndex = 0;
|
|
3
5
|
export declare const EXTERNAL_FILTERS = "externalFilters";
|
|
4
6
|
export declare const ACTION_FIELD_TYPE = "action";
|
|
5
7
|
export declare const rowActionColumnMeta: {
|
|
6
|
-
field:
|
|
7
|
-
|
|
8
|
-
filter: boolean;
|
|
9
|
-
sort: boolean;
|
|
10
|
-
autosize: boolean;
|
|
11
|
-
freeze: boolean;
|
|
12
|
-
aggregation: boolean;
|
|
13
|
-
toggle: boolean;
|
|
14
|
-
grouping: boolean;
|
|
15
|
-
customizeColumn: boolean;
|
|
16
|
-
combineColumn: boolean;
|
|
17
|
-
showMenu: boolean;
|
|
18
|
-
noContextMenu: boolean;
|
|
19
|
-
showTooltip: boolean;
|
|
20
|
-
reorderFields: boolean;
|
|
21
|
-
type: "action";
|
|
22
|
-
name: string;
|
|
23
|
-
label: string;
|
|
24
|
-
cellRenderer: string;
|
|
25
|
-
id: string;
|
|
26
|
-
width: number;
|
|
27
|
-
};
|
|
28
|
-
options: {
|
|
29
|
-
classList: string[];
|
|
30
|
-
};
|
|
8
|
+
field: ColumnConfig['field'];
|
|
9
|
+
options: OmitStrict<ColumnConfig, 'field'>;
|
|
31
10
|
};
|
|
32
11
|
export declare const rowSelectColumnMeta: {
|
|
33
|
-
field:
|
|
34
|
-
|
|
35
|
-
filter: boolean;
|
|
36
|
-
sort: boolean;
|
|
37
|
-
autosize: boolean;
|
|
38
|
-
freeze: boolean;
|
|
39
|
-
aggregation: boolean;
|
|
40
|
-
toggle: boolean;
|
|
41
|
-
grouping: boolean;
|
|
42
|
-
customizeColumn: boolean;
|
|
43
|
-
combineColumn: boolean;
|
|
44
|
-
showMenu: boolean;
|
|
45
|
-
noContextMenu: boolean;
|
|
46
|
-
showTooltip: boolean;
|
|
47
|
-
reorderFields: boolean;
|
|
48
|
-
type: "action";
|
|
49
|
-
name: string;
|
|
50
|
-
label: string;
|
|
51
|
-
cellRenderer: string;
|
|
52
|
-
id: string;
|
|
53
|
-
headerCellRenderer: string;
|
|
54
|
-
};
|
|
55
|
-
options: {
|
|
56
|
-
classList: string[];
|
|
57
|
-
label: string;
|
|
58
|
-
};
|
|
12
|
+
field: ColumnConfig['field'];
|
|
13
|
+
options: OmitStrict<ColumnConfig, 'field'>;
|
|
59
14
|
};
|
|
60
15
|
export declare const rowDragDropColumnMeta: {
|
|
61
|
-
field:
|
|
62
|
-
|
|
63
|
-
filter: boolean;
|
|
64
|
-
sort: boolean;
|
|
65
|
-
autosize: boolean;
|
|
66
|
-
freeze: boolean;
|
|
67
|
-
aggregation: boolean;
|
|
68
|
-
toggle: boolean;
|
|
69
|
-
grouping: boolean;
|
|
70
|
-
customizeColumn: boolean;
|
|
71
|
-
combineColumn: boolean;
|
|
72
|
-
showMenu: boolean;
|
|
73
|
-
noContextMenu: boolean;
|
|
74
|
-
showTooltip: boolean;
|
|
75
|
-
reorderFields: boolean;
|
|
76
|
-
type: "action";
|
|
77
|
-
name: string;
|
|
78
|
-
label: string;
|
|
79
|
-
cellRenderer: string;
|
|
80
|
-
id: string;
|
|
81
|
-
width: number;
|
|
82
|
-
};
|
|
83
|
-
options: {
|
|
84
|
-
classList: string[];
|
|
85
|
-
};
|
|
16
|
+
field: ColumnConfig['field'];
|
|
17
|
+
options: OmitStrict<ColumnConfig, 'field'>;
|
|
86
18
|
};
|
|
87
19
|
export declare const rowErrorColumnMeta: {
|
|
88
|
-
field:
|
|
89
|
-
|
|
90
|
-
filter: boolean;
|
|
91
|
-
sort: boolean;
|
|
92
|
-
autosize: boolean;
|
|
93
|
-
freeze: boolean;
|
|
94
|
-
aggregation: boolean;
|
|
95
|
-
toggle: boolean;
|
|
96
|
-
grouping: boolean;
|
|
97
|
-
customizeColumn: boolean;
|
|
98
|
-
combineColumn: boolean;
|
|
99
|
-
showMenu: boolean;
|
|
100
|
-
noContextMenu: boolean;
|
|
101
|
-
showTooltip: boolean;
|
|
102
|
-
reorderFields: boolean;
|
|
103
|
-
type: "action";
|
|
104
|
-
name: string;
|
|
105
|
-
label: string;
|
|
106
|
-
cellRenderer: string;
|
|
107
|
-
id: string;
|
|
108
|
-
width: number;
|
|
109
|
-
};
|
|
110
|
-
options: {
|
|
111
|
-
classList: string[];
|
|
112
|
-
};
|
|
20
|
+
field: ColumnConfig['field'];
|
|
21
|
+
options: OmitStrict<ColumnConfig, 'field'>;
|
|
113
22
|
};
|
|
114
23
|
export declare const UNSUPPORTED_HEADER_ICON_FIELD_TYPES: string[];
|
|
115
24
|
export declare const RICH_TEXT = "RichText";
|
|
@@ -141,6 +50,7 @@ export declare const TEMPLATES: {
|
|
|
141
50
|
export declare const DEFAULT_FORMAT = "Default";
|
|
142
51
|
export declare const expandCollapseAllMeta: {
|
|
143
52
|
width: number;
|
|
53
|
+
selector: string;
|
|
144
54
|
};
|
|
145
55
|
export declare const NON_DRAGGABLE_COLUMNS: string[];
|
|
146
56
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAEvE,eAAO,MAAM,yBAAyB,8BAA8B,CAAC;AACrE,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,gBAAgB,oBAAoB,CAAC;AAClD,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAoB1C,eAAO,MAAM,mBAAmB,EAAE;IAChC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CAa5C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE;IAChC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CAe5C,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE;IAClC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CAa5C,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE;IAC/B,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC;IAC7B,OAAO,EAAE,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;CAa5C,CAAC;AAEF,eAAO,MAAM,mCAAmC,UAAsB,CAAC;AAEvE,eAAO,MAAM,SAAS,aAAa,CAAC;AAEpC,eAAO,MAAM,KAAK;;;;CAIjB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AACF,eAAO,MAAM,6BAA6B,UAGzC,CAAC;AAEF,eAAO,MAAM,oBAAoB,UAMhC,CAAC;AACF,eAAO,MAAM,4BAA4B,UAAsC,CAAC;AAGhF,eAAO,MAAM,iBAAiB,EAAE;IAC9B,CAAC,GAAG,EAAE,MAAM,GAAG;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAMtE,CAAC;AAEF,eAAO,MAAM,SAAS;;;;CAIrB,CAAC;AAEF,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,qBAAqB;;;CAIjC,CAAC;AACF,eAAO,MAAM,qBAAqB,UAIjC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldType } from '../../types/Meta.types';
|
|
1
|
+
import { cellUpdateTrigger, FieldType } from '../../types/Meta.types';
|
|
2
2
|
export const nonPersonalizationViewKey = 'nonPersonalizationViewKey';
|
|
3
3
|
export const defaultPresetIdIndex = 0;
|
|
4
4
|
export const EXTERNAL_FILTERS = 'externalFilters';
|
|
@@ -17,7 +17,8 @@ const ootbFieldMeta = {
|
|
|
17
17
|
showMenu: false,
|
|
18
18
|
noContextMenu: true,
|
|
19
19
|
showTooltip: false,
|
|
20
|
-
reorderFields: false
|
|
20
|
+
reorderFields: false,
|
|
21
|
+
cellUpdateTriggers: [cellUpdateTrigger.ROW_DENSITY_CHANGE]
|
|
21
22
|
};
|
|
22
23
|
export const rowActionColumnMeta = {
|
|
23
24
|
field: {
|
|
@@ -26,7 +27,6 @@ export const rowActionColumnMeta = {
|
|
|
26
27
|
label: 'Actions',
|
|
27
28
|
cellRenderer: 'RowActionMenu',
|
|
28
29
|
id: 'RowActionMenu',
|
|
29
|
-
width: 32,
|
|
30
30
|
...ootbFieldMeta
|
|
31
31
|
},
|
|
32
32
|
options: {
|
|
@@ -55,7 +55,6 @@ export const rowDragDropColumnMeta = {
|
|
|
55
55
|
label: '',
|
|
56
56
|
cellRenderer: 'RowDragDropHandle',
|
|
57
57
|
id: 'RowDragDrop',
|
|
58
|
-
width: 34,
|
|
59
58
|
...ootbFieldMeta
|
|
60
59
|
},
|
|
61
60
|
options: {
|
|
@@ -69,7 +68,6 @@ export const rowErrorColumnMeta = {
|
|
|
69
68
|
label: '',
|
|
70
69
|
cellRenderer: 'RowError',
|
|
71
70
|
id: 'RowError',
|
|
72
|
-
width: 34,
|
|
73
71
|
...ootbFieldMeta
|
|
74
72
|
},
|
|
75
73
|
options: {
|
|
@@ -114,7 +112,9 @@ export const TEMPLATES = {
|
|
|
114
112
|
};
|
|
115
113
|
export const DEFAULT_FORMAT = 'Default';
|
|
116
114
|
export const expandCollapseAllMeta = {
|
|
117
|
-
width: 32
|
|
115
|
+
width: 32,
|
|
116
|
+
// TODO: RsCore should take this as part of contract. It wil be fixed, after setting up css classes contract OR go with some other approach if accepting CSS classes is not an option.
|
|
117
|
+
selector: '.expand-collapse-all'
|
|
118
118
|
};
|
|
119
119
|
export const NON_DRAGGABLE_COLUMNS = [
|
|
120
120
|
rowSelectColumnMeta.field.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/core/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAiB,MAAM,wBAAwB,CAAC;AAIrF,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AACrE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,iBAAiB,CAAC;AAClD,MAAM,CAAC,MAAM,iBAAiB,GAAG,QAAQ,CAAC;AAE1C,MAAM,aAAa,GAAsB;IACvC,M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AAS,EAAE,EAAE,EAAE;IACzD,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE;IAC1D,CAAC,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,qBAAqB,EAAE;CACjD,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,EAAE;IACT,sLAAsL;IACtL,QAAQ,EAAE,sBAAsB;CACjC,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,mBAAmB,CAAC,KAAK,CAAC,EAAE;IAC5B,qBAAqB,CAAC,KAAK,CAAC,EAAE;IAC9B,mBAAmB,CAAC,KAAK,CAAC,EAAE;CAC7B,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport { cellUpdateTrigger, FieldType, type FieldDef } from '../../types/Meta.types';\n\nimport type { ColumnConfig } from './generators/ColumnGenerator.types';\n\nexport const nonPersonalizationViewKey = 'nonPersonalizationViewKey';\nexport const defaultPresetIdIndex = 0;\nexport const EXTERNAL_FILTERS = 'externalFilters';\nexport const ACTION_FIELD_TYPE = 'action';\n\nconst ootbFieldMeta: Partial<FieldDef> = {\n resize: false,\n filter: false,\n sort: false,\n autosize: false,\n freeze: false,\n aggregation: false,\n toggle: false,\n grouping: false,\n customizeColumn: false,\n combineColumn: false,\n showMenu: false,\n noContextMenu: true,\n showTooltip: false,\n reorderFields: false,\n cellUpdateTriggers: [cellUpdateTrigger.ROW_DENSITY_CHANGE]\n};\n\nexport const rowActionColumnMeta: {\n field: ColumnConfig['field'];\n options: OmitStrict<ColumnConfig, 'field'>;\n} = {\n field: {\n type: FieldType.ACTION_FIELD_TYPE,\n name: 'RowActionMenu',\n label: 'Actions',\n cellRenderer: 'RowActionMenu',\n id: 'RowActionMenu',\n ...ootbFieldMeta\n },\n options: {\n classList: ['cell-action']\n }\n};\n\nexport const rowSelectColumnMeta: {\n field: ColumnConfig['field'];\n options: OmitStrict<ColumnConfig, 'field'>;\n} = {\n field: {\n type: FieldType.ACTION_FIELD_TYPE,\n name: 'RowSelect',\n label: 'Select',\n cellRenderer: 'RowSelectHandle',\n id: 'RowSelect',\n headerCellRenderer: 'selectAllCheckboxRenderer',\n ...ootbFieldMeta\n },\n options: {\n classList: ['row-select-handle'],\n label: 'Select'\n }\n};\n\nexport const rowDragDropColumnMeta: {\n field: ColumnConfig['field'];\n options: OmitStrict<ColumnConfig, 'field'>;\n} = {\n field: {\n type: FieldType.ACTION_FIELD_TYPE,\n name: 'RowDragDrop',\n label: '',\n cellRenderer: 'RowDragDropHandle',\n id: 'RowDragDrop',\n ...ootbFieldMeta\n },\n options: {\n classList: ['row-reorder-handle']\n }\n};\n\nexport const rowErrorColumnMeta: {\n field: ColumnConfig['field'];\n options: OmitStrict<ColumnConfig, 'field'>;\n} = {\n field: {\n type: FieldType.ACTION_FIELD_TYPE,\n name: 'RowError',\n label: '',\n cellRenderer: 'RowError',\n id: 'RowError',\n ...ootbFieldMeta\n },\n options: {\n classList: ['row-error-column']\n }\n};\n\nexport const UNSUPPORTED_HEADER_ICON_FIELD_TYPES = [ACTION_FIELD_TYPE];\n\nexport const RICH_TEXT = 'RichText';\n\nexport const STATE = {\n NOT_STARTED: 'NOT_STARTED',\n IN_PROGRESS: 'IN_PROGRESS',\n FAILED: 'FAILED'\n};\n\nexport const SELECTION_MODES = {\n single: 'single',\n multi: 'multi',\n multi_on_hover: 'multi_on_hover'\n};\nexport const SUPPORTED_MODES_FOR_SELECTALL = [\n SELECTION_MODES.multi_on_hover,\n SELECTION_MODES.multi\n];\n\nexport const SUPPORTED_FLUSH_KEYS = [\n 'filterExpression',\n 'search',\n 'selectedRows',\n 'sourceID',\n 'destinationID'\n];\nexport const SUPPORTED_AVOIDABLE_FEATURES = ['rowAnimation', 'columnAnimation'];\n\n// FIXME: this should be injectable in core\nexport const rowDensityClasses: {\n [key: number]: { id: string; className: string; rowHeight?: number };\n} = {\n 1: { id: '1', className: 'short-height', rowHeight: 25 },\n 2: { id: '2', className: 'medium-height', rowHeight: 35 },\n 3: { id: '3', className: 'tall-height', rowHeight: 45.04 },\n 4: { id: '4', className: 'wrap-content-height' }\n};\n\nexport const TEMPLATES = {\n GALLERY: 'Gallery',\n TABLE: 'Table',\n TIMELINE: 'Timeline'\n};\n\nexport const DEFAULT_FORMAT = 'Default';\nexport const expandCollapseAllMeta = {\n width: 32,\n // TODO: RsCore should take this as part of contract. It wil be fixed, after setting up css classes contract OR go with some other approach if accepting CSS classes is not an option.\n selector: '.expand-collapse-all'\n};\nexport const NON_DRAGGABLE_COLUMNS = [\n rowSelectColumnMeta.field.id,\n rowDragDropColumnMeta.field.id,\n rowActionColumnMeta.field.id\n];\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureFactory.d.ts","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,KAAK,IAAI,MAAM,6BAA6B,CAAC;AAKpD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,aAAa,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIvD,MAAM,MAAM,YAAY,CAAC,iBAAiB,SAAS,OAAO,GAAG,KAAK,IAAI;IACpE,gDAAgD;IAChD,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,2CAA2C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E,CAAC;CACzB,CAAC;AAEF,qOAAqO;AACrO,MAAM,MAAM,OAAO,CAAC,iBAAiB,SAAS,OAAO,GAAG,KAAK,IAAI,CAC/D,UAAU,EAAE,UAAU,KACnB,CAAC,CAAC,YAAY,EAAE,YAAY,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;AAC1D,iBAAS,aAAa;kBAEJ,OAAO,CAAC,IAAI,CAAC,EAAE;iBAChB,OAAO,EAAE;EA2DzB;AAuDD;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAU,EAAE,UAAU,GACrB,CAAC,CAAC,YAAY,EAAE,sBAAsB,KAAK,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,MAAM,IAAI,CAAC,CAE9E"}
|
|
@@ -39,7 +39,6 @@ function getUIFeatures() {
|
|
|
39
39
|
// We have to inject this feature always as we are generating instance
|
|
40
40
|
// level data with same to avoid condition block in UI.
|
|
41
41
|
features.beforeRender.push(uiFeatures.beforeRender.grouping);
|
|
42
|
-
features.beforeRender.push(uiFeatures.beforeRender.resizeGroupedDragDropColumn);
|
|
43
42
|
features.beforeRender.push(uiFeatures.beforeRender.filter);
|
|
44
43
|
features.beforeRender.push(uiFeatures.beforeRender.columnSort);
|
|
45
44
|
features.beforeRender.push(uiFeatures.beforeRender.columnResize);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featureFactory.js","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAaA,OAAO,UAAU,MAAM,cAAc,CAAC;AA6CtC,SAAS,aAAa;IACpB,MAAM,QAAQ,GAGV;QACF,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,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AO,CAAC,CAAC;IAE3F,OAAO,GAAG,EAAE;QACT,qBAAkE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACpF,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC;oBACN,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;oBACnD,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,gBAAgB;oBACnE,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;iBACpD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAsB;IAEtB,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'packages/lists-rs-core/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.resizeGroupedDragDropColumn);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.edit);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n * @returns\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n * @returns\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver()!.getState,\n getOriginalState: rsInternal.getRsStateResolver()!.getOriginalState,\n dispatch: rsInternal.getRsStateResolver()!.dispatch\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n * @returns\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"featureFactory.js","sourceRoot":"","sources":["../../../../src/core/features/featureFactory.ts"],"names":[],"mappings":"AAaA,OAAO,UAAU,MAAM,cAAc,CAAC;AA6CtC,SAAS,aAAa;IACpB,MAAM,QAAQ,GAGV;QACF,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,EAAE;KAChB,CAAC;IACF,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;IAChE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IAClE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACpE,iGAAiG;IACjG,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAC/D,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,qBAAqB,CAAC,CAAC;IAC1E,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,cAAc,CAAC,CAAC;IACnE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC;IACpE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;IACtE,kIAAkI;IAClI,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CA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AgB;oBAC/C,QAAQ,EAAE,YAAY,CAAC,QAAQ;oBAC/B,aAAa,EAAE,YAAY,CAAC,aAAa;iBAC1C,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,6BAA6B,CAAC,UAAsB;IAC3D,MAAM,QAAQ,GAAG,aAAa,EAAE,CAAC;IACjC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE3F,OAAO,GAAG,EAAE;QACT,qBAAkE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YACpF,IAAI,UAAU,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,CAAC;gBACtC,OAAO,CAAC;oBACN,OAAO,EAAE,UAAU,CAAC,OAAO;oBAC3B,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,UAAU,EAAE,UAAU,CAAC,UAAU;oBACjC,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;oBACnD,gBAAgB,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,gBAAgB;oBACnE,QAAQ,EAAE,UAAU,CAAC,kBAAkB,EAAG,CAAC,QAAQ;iBACpD,CAAC,CAAC;YACL,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,UAAsB;IAEtB,OAAO,CAAC,8BAA8B,CAAC,UAAU,CAAC,EAAE,6BAA6B,CAAC,UAAU,CAAC,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { State } from 'packages/lists-rs-core/types/State.types';\n\nimport type View from '../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Column from '../generators/ColumnGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type Row from '../generators/RowGenerator';\nimport type RsInternal from '../RsInternal';\nimport type RsProps from '../RsProps';\nimport type StateResolver from '../StateResolver';\nimport type RsStore from '../RsStore';\nimport type { Action } from '../actions/actions.types';\n\nimport uiFeatures from './uIFeatures';\n\nexport type FeatureProps<WithQueuedActions extends boolean = false> = {\n /** Returns reference to current {@link View} */\n getView: () => View;\n /** Returns reference to {@link RsStore} */\n getRsStore: () => RsStore;\n /** Returns reference to {@link RsProps} */\n getRsProps: () => RsProps;\n /** Returns reference to latest/current {@link State} */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n} & (WithQueuedActions extends true\n ? {\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n }\n : // For better readability keeping {} rather than Record<string, never>.\n // eslint-disable-next-line @typescript-eslint/ban-types\n {});\n\nexport type BeforeRenderFeatureProps = FeatureProps<true>;\n\nexport type MiddleWareFeatureProps = {\n /** Reference to RsInternal object. */\n rsInternal: RsInternal;\n /** Returns reference to latest/current {@link State}. */\n getState: () => State;\n /** Returns the stable {@link State} before the actions in the queue started executing. */\n getOriginalState: StateResolver['getOriginalState'];\n /** A dispatcher to dispatch RS actions. */\n dispatch: StateResolver['dispatch'];\n /** A queue of current actions that are dispatched. */\n queuedActions: Action[];\n};\n\n/** A feature is a function that runs based on a particular state slice change and produces immutable generator({@link View}, {@link Row}, {@link Column}) objects. It may also {@link StateResolver.dispatch dispatch} an action. */\nexport type Feature<WithQueuedActions extends boolean = false> = (\n rsInternal: RsInternal\n) => ((featureProps: FeatureProps<WithQueuedActions>) => void) | void;\n\nexport type UIFeatures = ReturnType<typeof getUIFeatures>;\nfunction getUIFeatures() {\n const features: {\n beforeRender: Feature<true>[];\n afterRender: Feature[];\n } = {\n beforeRender: [],\n afterRender: []\n };\n features.beforeRender.push(uiFeatures.beforeRender.scrollToTop);\n features.beforeRender.push(uiFeatures.beforeRender.busyIndicator);\n features.beforeRender.push(uiFeatures.beforeRender.personalization);\n // Reset dataApi context so that new count and data could be fetched on change of personalization\n features.beforeRender.push(uiFeatures.beforeRender.resetFetch);\n features.beforeRender.push(uiFeatures.beforeRender.changePersonalisation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareColumns);\n features.beforeRender.push(uiFeatures.beforeRender.columnFormatter);\n features.beforeRender.push(uiFeatures.beforeRender.ColumnDisplayMode);\n /* customColumn feature injects field definitions for custom fields, so stateSanitization feature should run after customColumn */\n features.beforeRender.push(uiFeatures.beforeRender.customColumn);\n features.beforeRender.push(uiFeatures.beforeRender.columnAlias);\n features.beforeRender.push(uiFeatures.beforeRender.stateSanitization);\n features.beforeRender.push(uiFeatures.beforeRender.stateHydration);\n features.beforeRender.push(uiFeatures.beforeRender.conditionalStyleFormat);\n features.beforeRender.push(uiFeatures.beforeRender.columnToggle);\n // ORDER: if any feature is going to generate some markup, then it should come before columnSizing feature\n // If reordering or moving records is enabled then rowDragDrop handler size has to be calculated and picked by column sizing\n features.beforeRender.push(uiFeatures.beforeRender.errorColumn);\n features.beforeRender.push(uiFeatures.beforeRender.rowDragDrop);\n features.beforeRender.push(uiFeatures.beforeRender.columnSizing);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeight);\n features.beforeRender.push(uiFeatures.beforeRender.freeze);\n // columnOrder is required for both columnVisualOrder and columnReorder feature\n features.beforeRender.push(uiFeatures.beforeRender.columnOrder);\n features.beforeRender.push(uiFeatures.beforeRender.columnVisualOrder);\n // Columns header should be rendered as soon as it is available. Features making calculation on columns should be before this.\n features.beforeRender.push(uiFeatures.beforeRender.renderHeader);\n features.beforeRender.push(uiFeatures.beforeRender.refresh);\n features.beforeRender.push(uiFeatures.beforeRender.rowHeight);\n features.beforeRender.push(uiFeatures.beforeRender.animation);\n features.beforeRender.push(uiFeatures.beforeRender.prepareRows);\n // We have to inject this feature always as we are generating instance\n // level data with same to avoid condition block in UI.\n\n features.beforeRender.push(uiFeatures.beforeRender.grouping);\n features.beforeRender.push(uiFeatures.beforeRender.filter);\n features.beforeRender.push(uiFeatures.beforeRender.columnSort);\n features.beforeRender.push(uiFeatures.beforeRender.columnResize);\n features.beforeRender.push(uiFeatures.beforeRender.adjustHeightToFitRecords);\n\n features.beforeRender.push(uiFeatures.beforeRender.columnReOrder);\n features.beforeRender.push(uiFeatures.beforeRender.rowSelect);\n features.beforeRender.push(uiFeatures.beforeRender.toggleSelectAllCheckbox);\n features.beforeRender.push(uiFeatures.beforeRender.aggregation);\n features.beforeRender.push(uiFeatures.beforeRender.edit);\n features.beforeRender.push(uiFeatures.beforeRender.moveRecords);\n features.beforeRender.push(uiFeatures.beforeRender.toggleHeaderIcons);\n\n features.afterRender.push(uiFeatures.afterRender.animation);\n features.afterRender.push(uiFeatures.afterRender.columnAutoSizing);\n features.afterRender.push(uiFeatures.afterRender.customizeParentContainer);\n\n return features;\n}\n\n/**\n * Initializes and returns before render features which run when any action is dispatched in the queue.\n * @param rsInternal - RsInternal reference.\n * @returns\n */\nfunction initializeBeforeRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const beforeRenderUIFeatures = features.beforeRender.map(t => t(rsInternal)).filter(Boolean);\n return (featureProps: MiddleWareFeatureProps) => {\n return (beforeRenderUIFeatures as ((featureProps: BeforeRenderFeatureProps) => void)[]).reduce<\n Promise<void | null>\n >(async (p, feature) => {\n return p.then(() => {\n if (!featureProps.rsInternal.getRsStore().isMounted) return null;\n return feature({\n getView: featureProps.rsInternal.getView,\n getRsStore: featureProps.rsInternal.getRsStore,\n getRsProps: featureProps.rsInternal.getRsProps,\n getState: featureProps.getState,\n getOriginalState: featureProps.getOriginalState,\n dispatch: featureProps.dispatch,\n queuedActions: featureProps.queuedActions\n });\n });\n }, Promise.resolve());\n };\n}\n\n/**\n * Initializes and returns after render features which run after the render is completed.\n * @param rsInternal RsInternal reference.\n * @returns\n */\nfunction initializeAfterRenderFeatures(rsInternal: RsInternal) {\n const features = getUIFeatures();\n const afterRenderUIFeatures = features.afterRender.map(t => t(rsInternal)).filter(Boolean);\n\n return () => {\n (afterRenderUIFeatures as ((featureProps: FeatureProps) => void)[]).forEach(feature => {\n if (rsInternal.getRsStore().isMounted) {\n feature({\n getView: rsInternal.getView,\n getRsStore: rsInternal.getRsStore,\n getRsProps: rsInternal.getRsProps,\n getState: rsInternal.getRsStateResolver()!.getState,\n getOriginalState: rsInternal.getRsStateResolver()!.getOriginalState,\n dispatch: rsInternal.getRsStateResolver()!.dispatch\n });\n }\n });\n };\n}\n\n/**\n * Initializes and return before and after render features.\n * @param rsInternal\n * @returns\n */\nexport default function initializeFeatures(\n rsInternal: RsInternal\n): [(featureProps: MiddleWareFeatureProps) => Promise<void | null>, () => void] {\n return [initializeBeforeRenderFeatures(rsInternal), initializeAfterRenderFeatures(rsInternal)];\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoSize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"autoSize.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,wCAAwC,CAAC;AACjE,OAAO,KAAK,IAAI,MAAM,sCAAsC,CAAC;AAK7D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,aAAa,UAAQ,UA0DtB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,UAmBnF;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EAAE,EACjB,YAAY,EAAE,WAAW,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,EAC/C,KAAK,CAAC,EAAE,OAAO;;EA8BhB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { rowSelectColumnMeta } from '../../../../constants';
|
|
1
|
+
import { expandCollapseAllMeta, rowSelectColumnMeta } from '../../../../constants';
|
|
2
2
|
import { getScrollbarWidth } from '../../../../utils/util';
|
|
3
|
-
const GROUP_ICON_WIDTH = 24;
|
|
4
3
|
/**
|
|
5
4
|
* Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.
|
|
6
5
|
*
|
|
@@ -18,6 +17,8 @@ export function autoSizeOfColumn(column, domContainer, forceAutoSize = false) {
|
|
|
18
17
|
if (column.field.width)
|
|
19
18
|
return column.field.width;
|
|
20
19
|
}
|
|
20
|
+
const view = column.parent;
|
|
21
|
+
const { showGroupingExpandCollapseAll, state: { showSelectAllCheckbox } } = view;
|
|
21
22
|
// Condition for double click event triggered to autosize the column
|
|
22
23
|
/* Autosize calculations begin */
|
|
23
24
|
const cells = domContainer.querySelectorAll(`[data-col-id="${column.field.id}"]`);
|
|
@@ -34,12 +35,18 @@ export function autoSizeOfColumn(column, domContainer, forceAutoSize = false) {
|
|
|
34
35
|
});
|
|
35
36
|
let autoSize = Math.ceil(span.getBoundingClientRect().width);
|
|
36
37
|
const iconsPlaceholder = domContainer.querySelector(`.header .cell[data-col-id="${column.field.id}"] .icons-ph`);
|
|
37
|
-
|
|
38
|
+
// If grouping and select all functionality are enabled and selection is the first column, reserve extra space in Row select header column to accommodate expand all button.
|
|
39
|
+
const reserveSpaceForGroupToggleButton = showGroupingExpandCollapseAll &&
|
|
40
|
+
showSelectAllCheckbox &&
|
|
41
|
+
column.field.id === rowSelectColumnMeta.field.id &&
|
|
42
|
+
// TODO: Selectors should not be hardcoded in rsCore OR it should come via proper contract.
|
|
43
|
+
domContainer.querySelector(`.row .cell[data-col-id="${rowSelectColumnMeta.field.id}"]:first-child`);
|
|
38
44
|
if (iconsPlaceholder) {
|
|
39
45
|
autoSize += iconsPlaceholder.offsetWidth;
|
|
40
46
|
}
|
|
41
|
-
if (
|
|
42
|
-
|
|
47
|
+
if (reserveSpaceForGroupToggleButton) {
|
|
48
|
+
const expandCollapseAllElement = domContainer.querySelector(expandCollapseAllMeta.selector);
|
|
49
|
+
autoSize += expandCollapseAllElement ? expandCollapseAllElement.offsetWidth : 0;
|
|
43
50
|
}
|
|
44
51
|
domContainer.removeChild(holder);
|
|
45
52
|
// Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"autoSize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,YAA+C,EAC/C,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,+CAA+C;QAC/C,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACxD,IAAI,iBAAiB;YAAE,OAAO,iBAAiB,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK;YAAE,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC;IACpD,CAAC;IACD,oEAAoE;IACpE,iCAAiC;IACjC,MA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MAAM,EAAE,CAAC;QACrE,eAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,CAAC,eAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnD,0BAA0B,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;IAC5D,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColumnResizePayload } from '../../../../actions/actions.types';\nimport { rowSelectColumnMeta } from '../../../../constants';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\nimport { getScrollbarWidth } from '../../../../utils/util';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef } from '../../../../../../types/Meta.types';\n\nconst GROUP_ICON_WIDTH = 24;\n\n/**\n * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.\n *\n * @param column - A column object representing column in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns column width in pixels.\n */\nexport function autoSizeOfColumn(\n column: Column,\n domContainer: NonNullable<View['domContainer']>,\n forceAutoSize = false\n) {\n if (!forceAutoSize) {\n // This will be executed in case of reset width\n const personalizedWidth = column.getPersonalizedWidth();\n if (personalizedWidth) return personalizedWidth;\n if (column.field.width) return column.field.width;\n }\n // Condition for double click event triggered to autosize the column\n /* Autosize calculations begin */\n const cells = domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`);\n const holder = document.createElement('div');\n holder.style.width = '100000px'; // some very high number\n const span = document.createElement('span');\n holder.appendChild(span);\n domContainer.appendChild(holder);\n cells.forEach(cell => {\n const row = document.createElement('div');\n row.style.display = 'table-row';\n cell.childNodes.forEach(child => row.appendChild(child.cloneNode(true)));\n span.appendChild(row);\n });\n let autoSize = Math.ceil(span.getBoundingClientRect().width);\n const iconsPlaceholder = domContainer.querySelector<HTMLElement>(\n `.header .cell[data-col-id=\"${column.field.id}\"] .icons-ph`\n );\n const groupIconPlaceholder = domContainer.querySelector<HTMLElement>(\n `.show-expand-collapse-all .row .cell[data-col-id=\"${column.field.id}\"]`\n );\n if (iconsPlaceholder) {\n autoSize += iconsPlaceholder.offsetWidth;\n }\n if (groupIconPlaceholder) {\n autoSize += GROUP_ICON_WIDTH;\n }\n domContainer.removeChild(holder);\n // Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.\n autoSize += 17; // 17px for Spacing styles applied (Fetching applied styles is costly, so keeping some visible space)\n // Allow columns to autosize till a restricted max width\n return column.field.maxWidth && autoSize > column.field.maxWidth\n ? column.field.maxWidth\n : autoSize;\n}\n\n/**\n * Calculates the maximum width available in the dom container\n * @param domContainer The HTML element that acts as the container for RS.\n * @returns Maximum available width.\n */\nexport function getMaxAvailableWidth(domContainer: NonNullable<View['domContainer']>) {\n let width = domContainer.clientWidth - getScrollbarWidth();\n const firstCell = domContainer.querySelector('.cell');\n if (!firstCell) {\n return width;\n }\n let element = firstCell.parentElement!;\n let style = null;\n let margin = 0;\n let padding = 0;\n while (element !== domContainer.parentElement) {\n // @ts-expect-error Property 'currentStyle' does not exist on type 'HTMLElement' This was used for IE browser initially. Check if it can be removed.\n style = element.currentStyle || window.getComputedStyle(element);\n margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);\n padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n width -= padding + margin + element.offsetWidth - element.clientWidth;\n element = element.parentElement!;\n }\n return width;\n}\n\n/**\n * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..\n *\n * @param columns - An array of `Column` objects representing the columns in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param reset - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns An object containing width for each column.\n */\nexport function autoSizeOfColumns(\n columns: Column[],\n domContainer: NonNullable<View['domContainer']>,\n reset?: boolean\n) {\n let totalCalculatedWidth = 0;\n const columnAutoSizes: ColumnResizePayload['data'] = {};\n\n const remainingAvailableWidth = getMaxAvailableWidth(domContainer);\n\n columns.forEach(column => {\n if (!column.hidden) {\n if (!(column.currentWidth && reset === undefined)) {\n // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.\n const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;\n const autoSize = autoSizeOfColumn(column, domContainer, forceAutosize);\n columnAutoSizes[column.field.id] = autoSize;\n totalCalculatedWidth += autoSize;\n } else {\n totalCalculatedWidth += column.currentWidth;\n }\n }\n });\n const extraSpace = remainingAvailableWidth - totalCalculatedWidth;\n if (extraSpace <= 0 || Number.isNaN(extraSpace)) return columnAutoSizes;\n const columnToFillRemainingSpace = columns.find(c => c.field.fillAvailableSpace);\n\n if (columnToFillRemainingSpace && !columnToFillRemainingSpace.hidden) {\n columnAutoSizes[columnToFillRemainingSpace.field.id] =\n (columnAutoSizes[columnToFillRemainingSpace.field.id] ??\n columnToFillRemainingSpace.currentWidth) + extraSpace;\n }\n return columnAutoSizes;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"autoSize.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/autoSize.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAC9B,MAAc,EACd,YAA+C,EAC/C,aAAa,GAAG,KAAK;IAErB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,+CAA+C;QAC/C,MAAM,iBAAiB,GAAG,MAAM,CAAC,oBAAoB,EAAE,CAAC;QACxD,IAAI,iBAAiB;YAAE,OAAO,iBAAiB,CAAC;QAChD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK;Y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AAM,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC;gBAC5C,oBAAoB,IAAI,QAAQ,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,oBAAoB,IAAI,MAAM,CAAC,YAAY,CAAC;YAC9C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,uBAAuB,GAAG,oBAAoB,CAAC;IAClE,IAAI,UAAU,IAAI,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;QAAE,OAAO,eAAe,CAAC;IACxE,MAAM,0BAA0B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAC;IAEjF,IAAI,0BAA0B,IAAI,CAAC,0BAA0B,CAAC,MAAM,EAAE,CAAC;QACrE,eAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;YAClD,CAAC,eAAe,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,CAAC;gBACnD,0BAA0B,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;IAC5D,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC","sourcesContent":["import type { ColumnResizePayload } from '../../../../actions/actions.types';\nimport { expandCollapseAllMeta, rowSelectColumnMeta } from '../../../../constants';\nimport type Column from '../../../../generators/ColumnGenerator';\nimport type View from '../../../../generators/ViewGenerator';\nimport { getScrollbarWidth } from '../../../../utils/util';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { FieldDef } from '../../../../../../types/Meta.types';\n\n/**\n * Calculates the width of column based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width.\n *\n * @param column - A column object representing column in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param forceAutoSize - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns column width in pixels.\n */\nexport function autoSizeOfColumn(\n column: Column,\n domContainer: NonNullable<View['domContainer']>,\n forceAutoSize = false\n) {\n if (!forceAutoSize) {\n // This will be executed in case of reset width\n const personalizedWidth = column.getPersonalizedWidth();\n if (personalizedWidth) return personalizedWidth;\n if (column.field.width) return column.field.width;\n }\n\n const view = column.parent;\n const {\n showGroupingExpandCollapseAll,\n state: { showSelectAllCheckbox }\n } = view;\n // Condition for double click event triggered to autosize the column\n /* Autosize calculations begin */\n const cells = domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`);\n const holder = document.createElement('div');\n holder.style.width = '100000px'; // some very high number\n const span = document.createElement('span');\n holder.appendChild(span);\n domContainer.appendChild(holder);\n cells.forEach(cell => {\n const row = document.createElement('div');\n row.style.display = 'table-row';\n cell.childNodes.forEach(child => row.appendChild(child.cloneNode(true)));\n span.appendChild(row);\n });\n let autoSize = Math.ceil(span.getBoundingClientRect().width);\n const iconsPlaceholder = domContainer.querySelector<HTMLElement>(\n `.header .cell[data-col-id=\"${column.field.id}\"] .icons-ph`\n );\n // If grouping and select all functionality are enabled and selection is the first column, reserve extra space in Row select header column to accommodate expand all button.\n const reserveSpaceForGroupToggleButton =\n showGroupingExpandCollapseAll &&\n showSelectAllCheckbox &&\n column.field.id === rowSelectColumnMeta.field.id &&\n // TODO: Selectors should not be hardcoded in rsCore OR it should come via proper contract.\n domContainer.querySelector<HTMLElement>(\n `.row .cell[data-col-id=\"${rowSelectColumnMeta.field.id}\"]:first-child`\n );\n\n if (iconsPlaceholder) {\n autoSize += iconsPlaceholder.offsetWidth;\n }\n if (reserveSpaceForGroupToggleButton) {\n const expandCollapseAllElement = domContainer.querySelector<HTMLElement>(\n expandCollapseAllMeta.selector\n );\n autoSize += expandCollapseAllElement ? expandCollapseAllElement.offsetWidth : 0;\n }\n domContainer.removeChild(holder);\n // Increased spacing style width by 1px to account for offsetWidth rounding off, this was causing truncation.\n autoSize += 17; // 17px for Spacing styles applied (Fetching applied styles is costly, so keeping some visible space)\n // Allow columns to autosize till a restricted max width\n return column.field.maxWidth && autoSize > column.field.maxWidth\n ? column.field.maxWidth\n : autoSize;\n}\n\n/**\n * Calculates the maximum width available in the dom container\n * @param domContainer The HTML element that acts as the container for RS.\n * @returns Maximum available width.\n */\nexport function getMaxAvailableWidth(domContainer: NonNullable<View['domContainer']>) {\n let width = domContainer.clientWidth - getScrollbarWidth();\n const firstCell = domContainer.querySelector('.cell');\n if (!firstCell) {\n return width;\n }\n let element = firstCell.parentElement!;\n let style = null;\n let margin = 0;\n let padding = 0;\n while (element !== domContainer.parentElement) {\n // @ts-expect-error Property 'currentStyle' does not exist on type 'HTMLElement' This was used for IE browser initially. Check if it can be removed.\n style = element.currentStyle || window.getComputedStyle(element);\n margin = parseFloat(style.marginLeft) + parseFloat(style.marginRight);\n padding = parseFloat(style.paddingLeft) + parseFloat(style.paddingRight);\n width -= padding + margin + element.offsetWidth - element.clientWidth;\n element = element.parentElement!;\n }\n return width;\n}\n\n/**\n * Calculates the width of columns based on their content size. If a column already has a width specified in {@link FieldDef.width} or through {@link column.getPersonalizedWidth personalization}, then that width will be honored over content size width..\n *\n * @param columns - An array of `Column` objects representing the columns in the view.\n * @param domContainer - The HTML element that acts as the container for RS.\n * @param reset - A boolean flag that indicates whether to force a recalculation of column widths.\n * @returns An object containing width for each column.\n */\nexport function autoSizeOfColumns(\n columns: Column[],\n domContainer: NonNullable<View['domContainer']>,\n reset?: boolean\n) {\n let totalCalculatedWidth = 0;\n const columnAutoSizes: ColumnResizePayload['data'] = {};\n\n const remainingAvailableWidth = getMaxAvailableWidth(domContainer);\n\n columns.forEach(column => {\n if (!column.hidden) {\n if (!(column.currentWidth && reset === undefined)) {\n // always calculate the content based width for row selection column because it's width will change depending on if grouping is applied or not.\n const forceAutosize = column.field.id === rowSelectColumnMeta.field.id || !reset;\n const autoSize = autoSizeOfColumn(column, domContainer, forceAutosize);\n columnAutoSizes[column.field.id] = autoSize;\n totalCalculatedWidth += autoSize;\n } else {\n totalCalculatedWidth += column.currentWidth;\n }\n }\n });\n const extraSpace = remainingAvailableWidth - totalCalculatedWidth;\n if (extraSpace <= 0 || Number.isNaN(extraSpace)) return columnAutoSizes;\n const columnToFillRemainingSpace = columns.find(c => c.field.fillAvailableSpace);\n\n if (columnToFillRemainingSpace && !columnToFillRemainingSpace.hidden) {\n columnAutoSizes[columnToFillRemainingSpace.field.id] =\n (columnAutoSizes[columnToFillRemainingSpace.field.id] ??\n columnToFillRemainingSpace.currentWidth) + extraSpace;\n }\n return columnAutoSizes;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAU1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAU1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAmE5D;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE;IAC7E,YAAY,EAAE,UAAU,CAAC,YAAY,EAAE,kBAAkB,GAAG,YAAY,CAAC;CAC1E,QA2DA;AAWD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;+BAMuB,cAAc,YAAY;AALpD,wBA0BE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { actionColumnResize, actionColumnsAutoSize, actionColumnAutoSize, actionForceUpdate } from '../../../../actions/actions';
|
|
2
2
|
import { TEMPLATES, SELECTION_MODES, rowSelectColumnMeta } from '../../../../constants';
|
|
3
|
-
import { withMemoization } from '../../../../utils/util';
|
|
3
|
+
import { OOTB_COLUMNS, withMemoization } from '../../../../utils/util';
|
|
4
4
|
import { autoSizeOfColumns } from './autoSize';
|
|
5
5
|
/*
|
|
6
6
|
* If columnWidths are undefined, there is no active personalization invloved in the current view
|
|
@@ -44,6 +44,16 @@ function autosizeRowSelectionColumn([{ getView, dispatch }]) {
|
|
|
44
44
|
dispatch(actionColumnAutoSize(col, getDomContainer(), true));
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Runs autosizing on out-of-the-box (OOTB) action columns in the view.
|
|
49
|
+
*/
|
|
50
|
+
const autosizeOotbActionColumns = ([{ getView, dispatch }]) => {
|
|
51
|
+
const { columns = [] } = getView();
|
|
52
|
+
const ootbColumns = columns?.filter(col => OOTB_COLUMNS.includes(col.field.id));
|
|
53
|
+
if (ootbColumns.length) {
|
|
54
|
+
dispatch(actionColumnsAutoSize(ootbColumns, getView().getDomContainer(), true));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
47
57
|
/**
|
|
48
58
|
* Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.
|
|
49
59
|
* @param param featureProps
|
|
@@ -139,6 +149,7 @@ export default () => {
|
|
|
139
149
|
const memoizedRunColumnSizing = withMemoization(runColumnSizing);
|
|
140
150
|
const memoizedResetAutosizeStatus = withMemoization(resetAutosizeStatus);
|
|
141
151
|
const memoizedAutosizeRowSelectionColumn = withMemoization(autosizeRowSelectionColumn);
|
|
152
|
+
const memoizedAutosizeOotbActionColumns = withMemoization(autosizeOotbActionColumns);
|
|
142
153
|
return function execute(featureProps) {
|
|
143
154
|
const state = featureProps.getState();
|
|
144
155
|
// AutoSize by default
|
|
@@ -152,6 +163,7 @@ export default () => {
|
|
|
152
163
|
state.forceUpdateFeatures?.forceCalculateAutoWidth
|
|
153
164
|
]);
|
|
154
165
|
memoizedAutosizeRowSelectionColumn([featureProps], [state.groups, state.responsive?.sm]);
|
|
166
|
+
memoizedAutosizeOotbActionColumns([featureProps], [state.selectedHeightOption]);
|
|
155
167
|
};
|
|
156
168
|
};
|
|
157
169
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;GAIG;AACH;;;;;GAKG;AACH,MAAM,2BAA2B,GAAG,CAClC,OAAqC,EACrC,YAAkC,EAClC,EAAE;IACF,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,KAAK,GAAG,YAAY;gBACxB,CAAC,CAAC,YAAY,CAAC,gBAAgB,CAAC,iBAAiB,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC;gBACrE,CAAC,CAAC,EAAE,CAAC;YACP,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,OAAO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,4BAA4B,GAAG,CAAC,YAAkC,EAAE,EAAE;IAC1E,OAAO,CAAC,CAAC,CAAC,YAAY,IAAI,YAAY,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AACzF,CAAC,CAAC;AA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;AACzC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,uBAAuB,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;IACjE,MAAM,2BAA2B,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC;IACzE,MAAM,kCAAkC,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC;IACvF,OAAO,SAAS,OAAO,CAAC,YAA0B;QAChD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,sBAAsB;QACtB,2BAA2B,CACzB,CAAC,YAAY,CAAC,EACd,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CACxF,CAAC;QACF,uBAAuB,CACrB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,eAAe,EAAE,MAAM;YAC7B,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI;YAC3B,YAAY,CAAC,UAAU,EAAE,CAAC,iBAAiB;YAC3C,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,mBAAmB,EAAE,uBAAuB;SACnD,CACF,CAAC;QACF,kCAAkC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3F,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n actionColumnResize,\n actionColumnsAutoSize,\n actionColumnAutoSize,\n actionForceUpdate\n} from '../../../../actions/actions';\nimport { TEMPLATES, SELECTION_MODES, rowSelectColumnMeta } from '../../../../constants';\nimport { withMemoization } from '../../../../utils/util';\nimport type { FeatureProps } from '../../../featureFactory';\nimport type View from '../../../../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { State } from '../../../../../../types/State.types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../../RsStore';\n\nimport { autoSizeOfColumns } from './autoSize';\n\n/*\n * If columnWidths are undefined, there is no active personalization invloved in the current view\n * So triggering auto column sizing, which depends on column content.\n * in case of nested groupings, skipping group headers from being counted as a row\n */\n/**\n * Checks if {@link View.domContainer dom container} has any rows with visible cells.\n * @param columns\n * @param domContainer\n * @returns true if dom container has any rows available, otherwise false.\n */\nconst checkDomContainerHasAnyRows = (\n columns: NonNullable<View['columns']>,\n domContainer: View['domContainer']\n) => {\n for (const column of columns) {\n if (!column.hidden) {\n const cells = domContainer\n ? domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`)\n : [];\n if (cells.length > 1) {\n return true;\n }\n }\n }\n return false;\n};\n\n/**\n * Checks if any data rows are available in dom container. It does not includes grouped rows.\n * @returns true if data rows are available, otherwise false.\n */\nconst checkDomContainerHasDataRows = (domContainer: View['domContainer']) => {\n return !!(domContainer && domContainer.querySelectorAll('.row[aria-rowindex]').length);\n};\n\n/**\n * Executes the autosizing feature on row selection column.\n */\nfunction autosizeRowSelectionColumn([{ getView, dispatch }]: [featureProps: FeatureProps]) {\n const { columns = [], getDomContainer, meta } = getView();\n if (meta.selectionMode && Object.values(SELECTION_MODES).includes(meta.selectionMode)) {\n const col = columns.find(c => c.field.id === rowSelectColumnMeta.field.id);\n if (col) dispatch(actionColumnAutoSize(col, getDomContainer()!, true));\n }\n}\n\n/**\n * Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.\n * @param param featureProps\n * @returns\n */\nexport function runColumnSizing([{ getState, getView, getRsStore, dispatch }]: [\n featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps'>\n]) {\n const { columns = [], getDomContainer, meta } = getView();\n\n if (meta.template !== TEMPLATES.TABLE) return;\n\n const rsStore = getRsStore();\n const domContainer = getDomContainer();\n const runColumnSizingOnRowsAvailable =\n !rsStore.columnSizingTriggerdOnRowsAvailable && checkDomContainerHasDataRows(domContainer);\n\n // if there is no group/data row to size in DOM, don't run column sizing\n if (\n !checkDomContainerHasAnyRows(columns, domContainer) ||\n (rsStore.autosizeTriggered && !runColumnSizingOnRowsAvailable)\n ) {\n // if in current render cycle the rows were not painted, check for autosizing in next cycle\n if (!rsStore.autosizeTriggered) {\n dispatch(actionForceUpdate(false, { forceCalculateAutoWidth: true }));\n }\n return;\n }\n\n /**\n * If one of the table's ancestors is in a hidden state, the autosize calculations will not function correctly\n * since the domContainer's offsetWidth will be 0. To address this scenario, a resize observer is attached for this use case.\n * It triggers autosize whenever the offsetWidth of the domContainer increases from 0 once the ancestors are\n * made visible. */\n if (domContainer?.offsetWidth === 0) {\n const observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.contentRect.width > 0) {\n runColumnSizing([\n {\n getState,\n getView,\n getRsStore,\n dispatch\n }\n ]);\n observer.unobserve(entry.target);\n }\n }\n });\n observer.observe(domContainer);\n return;\n }\n\n rsStore.autosizeTriggered = true;\n // skipping column animation on next run if column size changed after personalization change or delete\n rsStore.skipColumnAnimationOnNextRun = true;\n\n if (runColumnSizingOnRowsAvailable) {\n // Fresh column sizing will run only once for a view when the rows are loaded for the first time in DOM\n rsStore.columnSizingTriggerdOnRowsAvailable = true;\n dispatch(actionColumnsAutoSize(columns, domContainer!, true));\n } else {\n // Incremental column sizing on show/hide of columns or table refresh or on view change with grouping applied\n dispatch(actionColumnResize(autoSizeOfColumns(columns, domContainer!)));\n }\n}\n\n/**\n * It resets the {@link RsStore.autosizeTriggered autosize status} on RsStore.\n * @param param featureProps\n */\nfunction resetAutosizeStatus([{ getRsStore }]: [featureProps: FeatureProps]) {\n // This parent flag checks if any type of sizing is triggered on the table including table header/groups/rows.\n getRsStore().autosizeTriggered = false;\n}\n\n/**\n * Manages the autosizing feature of columns in the view. This includes the following actions:\n * 1. **Executing Autosize for All Columns**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link View.rows}\n * - {@link RsStore.autosizeTriggered}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.forceUpdateFeatures.forceCalculateAutoWidth}\n * 2. **Resetting Autosize Status**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.customFields}\n *\n * 3. **Executing Autosize on Row Selection Column**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.groups}\n * - {@link State.responsive.sm}\n */\nexport default () => {\n const memoizedRunColumnSizing = withMemoization(runColumnSizing);\n const memoizedResetAutosizeStatus = withMemoization(resetAutosizeStatus);\n const memoizedAutosizeRowSelectionColumn = withMemoization(autosizeRowSelectionColumn);\n return function execute(featureProps: FeatureProps) {\n const state = featureProps.getState();\n // AutoSize by default\n memoizedResetAutosizeStatus(\n [featureProps],\n [state.personalization?.active, state.refresh, state.hiddenColumns, state.customFields]\n );\n memoizedRunColumnSizing(\n [featureProps],\n [\n state.personalization?.active,\n featureProps.getView().rows,\n featureProps.getRsStore().autosizeTriggered,\n state.refresh,\n state.hiddenColumns,\n state.forceUpdateFeatures?.forceCalculateAutoWidth\n ]\n );\n memoizedAutosizeRowSelectionColumn([featureProps], [state.groups, state.responsive?.sm]);\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/features/uIFeatures/afterRender/columnSizing/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAQvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,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;;;;;;;;;GAwBG;AACH,eAAe,GAAG,EAAE;IAClB,MAAM,uBAAuB,GAAG,eAAe,CAAC,eAAe,CAAC,CAAC;IACjE,MAAM,2BAA2B,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAC;IACzE,MAAM,kCAAkC,GAAG,eAAe,CAAC,0BAA0B,CAAC,CAAC;IACvF,MAAM,iCAAiC,GAAG,eAAe,CAAC,yBAAyB,CAAC,CAAC;IACrF,OAAO,SAAS,OAAO,CAAC,YAA0B;QAChD,MAAM,KAAK,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACtC,sBAAsB;QACtB,2BAA2B,CACzB,CAAC,YAAY,CAAC,EACd,CAAC,KAAK,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,YAAY,CAAC,CACxF,CAAC;QACF,uBAAuB,CACrB,CAAC,YAAY,CAAC,EACd;YACE,KAAK,CAAC,eAAe,EAAE,MAAM;YAC7B,YAAY,CAAC,OAAO,EAAE,CAAC,IAAI;YAC3B,YAAY,CAAC,UAAU,EAAE,CAAC,iBAAiB;YAC3C,KAAK,CAAC,OAAO;YACb,KAAK,CAAC,aAAa;YACnB,KAAK,CAAC,mBAAmB,EAAE,uBAAuB;SACnD,CACF,CAAC;QACF,kCAAkC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;QACzF,iCAAiC,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAClF,CAAC,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { OmitStrict } from '@pega/cosmos-react-core';\n\nimport {\n actionColumnResize,\n actionColumnsAutoSize,\n actionColumnAutoSize,\n actionForceUpdate\n} from '../../../../actions/actions';\nimport { TEMPLATES, SELECTION_MODES, rowSelectColumnMeta } from '../../../../constants';\nimport { OOTB_COLUMNS, withMemoization } from '../../../../utils/util';\nimport type { FeatureProps } from '../../../featureFactory';\nimport type View from '../../../../generators/ViewGenerator';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type { State } from '../../../../../../types/State.types';\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport type RsStore from '../../../../RsStore';\n\nimport { autoSizeOfColumns } from './autoSize';\n\n/*\n * If columnWidths are undefined, there is no active personalization invloved in the current view\n * So triggering auto column sizing, which depends on column content.\n * in case of nested groupings, skipping group headers from being counted as a row\n */\n/**\n * Checks if {@link View.domContainer dom container} has any rows with visible cells.\n * @param columns\n * @param domContainer\n * @returns true if dom container has any rows available, otherwise false.\n */\nconst checkDomContainerHasAnyRows = (\n columns: NonNullable<View['columns']>,\n domContainer: View['domContainer']\n) => {\n for (const column of columns) {\n if (!column.hidden) {\n const cells = domContainer\n ? domContainer.querySelectorAll(`[data-col-id=\"${column.field.id}\"]`)\n : [];\n if (cells.length > 1) {\n return true;\n }\n }\n }\n return false;\n};\n\n/**\n * Checks if any data rows are available in dom container. It does not includes grouped rows.\n * @returns true if data rows are available, otherwise false.\n */\nconst checkDomContainerHasDataRows = (domContainer: View['domContainer']) => {\n return !!(domContainer && domContainer.querySelectorAll('.row[aria-rowindex]').length);\n};\n\n/**\n * Executes the autosizing feature on row selection column.\n */\nfunction autosizeRowSelectionColumn([{ getView, dispatch }]: [featureProps: FeatureProps]) {\n const { columns = [], getDomContainer, meta } = getView();\n if (meta.selectionMode && Object.values(SELECTION_MODES).includes(meta.selectionMode)) {\n const col = columns.find(c => c.field.id === rowSelectColumnMeta.field.id);\n if (col) dispatch(actionColumnAutoSize(col, getDomContainer()!, true));\n }\n}\n\n/**\n * Runs autosizing on out-of-the-box (OOTB) action columns in the view.\n */\nconst autosizeOotbActionColumns = ([{ getView, dispatch }]: [featureProps: FeatureProps]) => {\n const { columns = [] } = getView();\n const ootbColumns = columns?.filter(col => OOTB_COLUMNS.includes(col.field.id));\n if (ootbColumns.length) {\n dispatch(actionColumnsAutoSize(ootbColumns, getView().getDomContainer()!, true));\n }\n};\n\n/**\n * Executes the autosizing feature on all the columns. It dispatches an action that updates {@link State.columnWidths} slice with the calculated widths for all the columns.\n * @param param featureProps\n * @returns\n */\nexport function runColumnSizing([{ getState, getView, getRsStore, dispatch }]: [\n featureProps: OmitStrict<FeatureProps, 'getOriginalState' | 'getRsProps'>\n]) {\n const { columns = [], getDomContainer, meta } = getView();\n\n if (meta.template !== TEMPLATES.TABLE) return;\n\n const rsStore = getRsStore();\n const domContainer = getDomContainer();\n const runColumnSizingOnRowsAvailable =\n !rsStore.columnSizingTriggerdOnRowsAvailable && checkDomContainerHasDataRows(domContainer);\n\n // if there is no group/data row to size in DOM, don't run column sizing\n if (\n !checkDomContainerHasAnyRows(columns, domContainer) ||\n (rsStore.autosizeTriggered && !runColumnSizingOnRowsAvailable)\n ) {\n // if in current render cycle the rows were not painted, check for autosizing in next cycle\n if (!rsStore.autosizeTriggered) {\n dispatch(actionForceUpdate(false, { forceCalculateAutoWidth: true }));\n }\n return;\n }\n\n /**\n * If one of the table's ancestors is in a hidden state, the autosize calculations will not function correctly\n * since the domContainer's offsetWidth will be 0. To address this scenario, a resize observer is attached for this use case.\n * It triggers autosize whenever the offsetWidth of the domContainer increases from 0 once the ancestors are\n * made visible. */\n if (domContainer?.offsetWidth === 0) {\n const observer = new ResizeObserver(entries => {\n for (const entry of entries) {\n if (entry.contentRect.width > 0) {\n runColumnSizing([\n {\n getState,\n getView,\n getRsStore,\n dispatch\n }\n ]);\n observer.unobserve(entry.target);\n }\n }\n });\n observer.observe(domContainer);\n return;\n }\n\n rsStore.autosizeTriggered = true;\n // skipping column animation on next run if column size changed after personalization change or delete\n rsStore.skipColumnAnimationOnNextRun = true;\n\n if (runColumnSizingOnRowsAvailable) {\n // Fresh column sizing will run only once for a view when the rows are loaded for the first time in DOM\n rsStore.columnSizingTriggerdOnRowsAvailable = true;\n dispatch(actionColumnsAutoSize(columns, domContainer!, true));\n } else {\n // Incremental column sizing on show/hide of columns or table refresh or on view change with grouping applied\n dispatch(actionColumnResize(autoSizeOfColumns(columns, domContainer!)));\n }\n}\n\n/**\n * It resets the {@link RsStore.autosizeTriggered autosize status} on RsStore.\n * @param param featureProps\n */\nfunction resetAutosizeStatus([{ getRsStore }]: [featureProps: FeatureProps]) {\n // This parent flag checks if any type of sizing is triggered on the table including table header/groups/rows.\n getRsStore().autosizeTriggered = false;\n}\n\n/**\n * Manages the autosizing feature of columns in the view. This includes the following actions:\n * 1. **Executing Autosize for All Columns**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link View.rows}\n * - {@link RsStore.autosizeTriggered}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.forceUpdateFeatures.forceCalculateAutoWidth}\n * 2. **Resetting Autosize Status**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.personalization.active}\n * - {@link State.refresh}\n * - {@link State.hiddenColumns}\n * - {@link State.customFields}\n *\n * 3. **Executing Autosize on Row Selection Column**:\n *\n * This action is triggered when any of the following properties change:\n * - {@link State.groups}\n * - {@link State.responsive.sm}\n */\nexport default () => {\n const memoizedRunColumnSizing = withMemoization(runColumnSizing);\n const memoizedResetAutosizeStatus = withMemoization(resetAutosizeStatus);\n const memoizedAutosizeRowSelectionColumn = withMemoization(autosizeRowSelectionColumn);\n const memoizedAutosizeOotbActionColumns = withMemoization(autosizeOotbActionColumns);\n return function execute(featureProps: FeatureProps) {\n const state = featureProps.getState();\n // AutoSize by default\n memoizedResetAutosizeStatus(\n [featureProps],\n [state.personalization?.active, state.refresh, state.hiddenColumns, state.customFields]\n );\n memoizedRunColumnSizing(\n [featureProps],\n [\n state.personalization?.active,\n featureProps.getView().rows,\n featureProps.getRsStore().autosizeTriggered,\n state.refresh,\n state.hiddenColumns,\n state.forceUpdateFeatures?.forceCalculateAutoWidth\n ]\n );\n memoizedAutosizeRowSelectionColumn([featureProps], [state.groups, state.responsive?.sm]);\n memoizedAutosizeOotbActionColumns([featureProps], [state.selectedHeightOption]);\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rowHeight.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/rowHeight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"rowHeight.d.ts","sourceRoot":"","sources":["../../../../../../src/core/features/uIFeatures/beforeRender/rowHeight.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAsBrE;;GAEG;+BAIuB,cAAc,wBAAwB;AAHhE,wBAME"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { rowDensityClasses } from '../../../constants';
|
|
2
2
|
import { withMemoization } from '../../../utils/util';
|
|
3
|
+
import { cellUpdateTrigger } from '../../../../../types/Meta.types';
|
|
3
4
|
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
4
5
|
const setRowHeightClass = ([{ getView, getState }]) => {
|
|
5
6
|
const { selectedHeightOption } = getState();
|
|
6
7
|
const value = rowDensityClasses[selectedHeightOption]?.className ?? rowDensityClasses['1']?.className;
|
|
7
8
|
getView().setProp('rowHeightClass', value);
|
|
9
|
+
// Refresh the columns that are dependent on row density change.
|
|
10
|
+
getView().columns?.forEach(column => column.field.cellUpdateTriggers?.includes(cellUpdateTrigger.ROW_DENSITY_CHANGE) &&
|
|
11
|
+
column.setProp('refresh', Math.random()));
|
|
8
12
|
};
|
|
9
13
|
/**
|
|
10
14
|
* Sets the {@link View.rowHeightClass rowHeightClass} property in the view when {@link State.selectedHeightOption selectedHeightOption} is changed in the `State`.
|