@pega/react-sdk-components 0.23.17 → 0.23.18
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/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.d.ts.map +1 -1
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js +20 -3
- package/lib/components/designSystemExtension/CaseSummaryFields/CaseSummaryFields.js.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js +1 -2
- package/lib/components/designSystemExtension/FieldGroup/FieldGroup.js.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.d.ts.map +1 -1
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js +23 -40
- package/lib/components/designSystemExtension/FieldValueList/FieldValueList.js.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.d.ts.map +1 -1
- package/lib/components/field/AutoComplete/AutoComplete.js +5 -5
- package/lib/components/field/AutoComplete/AutoComplete.js.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/field/Checkbox/Checkbox.js +5 -5
- package/lib/components/field/Checkbox/Checkbox.js.map +1 -1
- package/lib/components/field/Currency/Currency.d.ts.map +1 -1
- package/lib/components/field/Currency/Currency.js +21 -6
- package/lib/components/field/Currency/Currency.js.map +1 -1
- package/lib/components/field/Currency/currency-utils.d.ts +11 -0
- package/lib/components/field/Currency/currency-utils.d.ts.map +1 -0
- package/lib/components/field/Currency/currency-utils.js +60 -0
- package/lib/components/field/Currency/currency-utils.js.map +1 -0
- package/lib/components/field/Date/Date.d.ts.map +1 -1
- package/lib/components/field/Date/Date.js +17 -6
- package/lib/components/field/Date/Date.js.map +1 -1
- package/lib/components/field/DateTime/DateTime.d.ts.map +1 -1
- package/lib/components/field/DateTime/DateTime.js +16 -7
- package/lib/components/field/DateTime/DateTime.js.map +1 -1
- package/lib/components/field/Decimal/Decimal.d.ts.map +1 -1
- package/lib/components/field/Decimal/Decimal.js +5 -5
- package/lib/components/field/Decimal/Decimal.js.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.d.ts.map +1 -1
- package/lib/components/field/Dropdown/Dropdown.js +5 -5
- package/lib/components/field/Dropdown/Dropdown.js.map +1 -1
- package/lib/components/field/Email/Email.js +5 -5
- package/lib/components/field/Email/Email.js.map +1 -1
- package/lib/components/field/Integer/Integer.d.ts.map +1 -1
- package/lib/components/field/Integer/Integer.js +5 -5
- package/lib/components/field/Integer/Integer.js.map +1 -1
- package/lib/components/field/Percentage/Percentage.d.ts.map +1 -1
- package/lib/components/field/Percentage/Percentage.js +5 -5
- package/lib/components/field/Percentage/Percentage.js.map +1 -1
- package/lib/components/field/Phone/Phone.d.ts.map +1 -1
- package/lib/components/field/Phone/Phone.js +5 -5
- package/lib/components/field/Phone/Phone.js.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.d.ts.map +1 -1
- package/lib/components/field/RadioButtons/RadioButtons.js +5 -5
- package/lib/components/field/RadioButtons/RadioButtons.js.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.d.ts.map +1 -1
- package/lib/components/field/SemanticLink/SemanticLink.js +5 -1
- package/lib/components/field/SemanticLink/SemanticLink.js.map +1 -1
- package/lib/components/field/TextArea/TextArea.d.ts.map +1 -1
- package/lib/components/field/TextArea/TextArea.js +5 -5
- package/lib/components/field/TextArea/TextArea.js.map +1 -1
- package/lib/components/field/TextInput/TextInput.d.ts.map +1 -1
- package/lib/components/field/TextInput/TextInput.js +5 -5
- package/lib/components/field/TextInput/TextInput.js.map +1 -1
- package/lib/components/field/Time/Time.d.ts.map +1 -1
- package/lib/components/field/Time/Time.js +5 -5
- package/lib/components/field/Time/Time.js.map +1 -1
- package/lib/components/field/URL/URL.d.ts.map +1 -1
- package/lib/components/field/URL/URL.js +5 -5
- package/lib/components/field/URL/URL.js.map +1 -1
- package/lib/components/helpers/date-format-utils.d.ts +13 -0
- package/lib/components/helpers/date-format-utils.d.ts.map +1 -0
- package/lib/components/helpers/date-format-utils.js +59 -0
- package/lib/components/helpers/date-format-utils.js.map +1 -0
- package/lib/components/helpers/formatters/Currency.js +11 -5
- package/lib/components/helpers/formatters/Currency.js.map +1 -1
- package/lib/components/helpers/formatters/common.d.ts.map +1 -1
- package/lib/components/helpers/formatters/common.js +6 -1
- package/lib/components/helpers/formatters/common.js.map +1 -1
- package/lib/components/helpers/formatters/index.d.ts.map +1 -1
- package/lib/components/helpers/formatters/index.js +4 -0
- package/lib/components/helpers/formatters/index.js.map +1 -1
- package/lib/components/helpers/template-utils.d.ts +14 -0
- package/lib/components/helpers/template-utils.d.ts.map +1 -0
- package/lib/components/helpers/template-utils.js +65 -0
- package/lib/components/helpers/template-utils.js.map +1 -0
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.d.ts.map +1 -1
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js +52 -53
- package/lib/components/infra/Containers/FlowContainer/FlowContainer.js.map +1 -1
- package/lib/components/infra/MultiStep/MultiStep.css +4 -18
- package/lib/components/infra/NavBar/NavBar.d.ts +1 -1
- package/lib/components/infra/NavBar/NavBar.d.ts.map +1 -1
- package/lib/components/infra/NavBar/NavBar.js +57 -121
- package/lib/components/infra/NavBar/NavBar.js.map +1 -1
- package/lib/components/infra/View/View.d.ts.map +1 -1
- package/lib/components/infra/View/View.js +12 -3
- package/lib/components/infra/View/View.js.map +1 -1
- package/lib/components/template/CaseView/CaseView.d.ts.map +1 -1
- package/lib/components/template/CaseView/CaseView.js +2 -3
- package/lib/components/template/CaseView/CaseView.js.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.d.ts.map +1 -1
- package/lib/components/template/DefaultForm/DefaultForm.js +6 -1
- package/lib/components/template/DefaultForm/DefaultForm.js.map +1 -1
- package/lib/components/template/Details/Details/Details.d.ts +2 -0
- package/lib/components/template/Details/Details/Details.d.ts.map +1 -1
- package/lib/components/template/Details/Details/Details.js +35 -18
- package/lib/components/template/Details/Details/Details.js.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts +12 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js +43 -27
- package/lib/components/template/Details/DetailsThreeColumn/DetailsThreeColumn.js.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts +12 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.d.ts.map +1 -1
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js +43 -25
- package/lib/components/template/Details/DetailsTwoColumn/DetailsTwoColumn.js.map +1 -1
- package/lib/components/template/ListView/DefaultViewMeta.d.ts +91 -0
- package/lib/components/template/ListView/DefaultViewMeta.d.ts.map +1 -0
- package/lib/components/template/ListView/DefaultViewMeta.js +208 -0
- package/lib/components/template/ListView/DefaultViewMeta.js.map +1 -0
- package/lib/components/template/ListView/ListView.d.ts.map +1 -1
- package/lib/components/template/ListView/ListView.js +143 -45
- package/lib/components/template/ListView/ListView.js.map +1 -1
- package/lib/components/template/ListView/hooks.d.ts +2 -0
- package/lib/components/template/ListView/hooks.d.ts.map +1 -0
- package/lib/components/template/ListView/hooks.js +73 -0
- package/lib/components/template/ListView/hooks.js.map +1 -0
- package/lib/components/template/ListView/utils.d.ts +63 -0
- package/lib/components/template/ListView/utils.d.ts.map +1 -0
- package/lib/components/template/ListView/utils.js +537 -0
- package/lib/components/template/ListView/utils.js.map +1 -0
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts +12 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.d.ts.map +1 -1
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js +45 -29
- package/lib/components/template/NarrowWide/NarrowWideDetails/NarrowWideDetails.js.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts +12 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.d.ts.map +1 -1
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js +45 -29
- package/lib/components/template/WideNarrow/WideNarrowDetails/WideNarrowDetails.js.map +1 -1
- package/lib/components/widget/Attachment/Attachment.css +7 -0
- package/lib/components/widget/Attachment/Attachment.d.ts.map +1 -1
- package/lib/components/widget/Attachment/Attachment.js +25 -2
- package/lib/components/widget/Attachment/Attachment.js.map +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js +1 -1
- package/lib/components/widget/SummaryItem/SummaryItem.js.map +1 -1
- package/package.json +1 -1
- package/lib/components/template/utils.d.ts +0 -3
- package/lib/components/template/utils.d.ts.map +0 -1
- package/lib/components/template/utils.js +0 -22
- package/lib/components/template/utils.js.map +0 -1
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
const LOCALIZATON_ANNOTATION = '@L ';
|
|
2
|
+
const PROPERTY_ANNOTATION = '@P .';
|
|
3
|
+
const USER_ANNOTATION = '@USER .';
|
|
4
|
+
const ASSOCIATED_ANNOTATION = '@ASSOCIATED .';
|
|
5
|
+
const ASSOCIATION_ANNOTATION = '@CA ';
|
|
6
|
+
const getDefaultConfig = (fieldMeta, classID, show) => {
|
|
7
|
+
const { name, label, fieldID, fieldType, dataType, type, classID: fieldMetaClassID, displayAs, displayAsLink, category, associationClassID, associationID } = fieldMeta;
|
|
8
|
+
return {
|
|
9
|
+
value: (associationClassID ? ASSOCIATION_ANNOTATION : PROPERTY_ANNOTATION).concat(fieldID),
|
|
10
|
+
label: LOCALIZATON_ANNOTATION.concat(name || label),
|
|
11
|
+
fieldType,
|
|
12
|
+
propertyType: dataType || type,
|
|
13
|
+
classID: classID || fieldMetaClassID,
|
|
14
|
+
displayAs,
|
|
15
|
+
displayAsLink,
|
|
16
|
+
category,
|
|
17
|
+
show,
|
|
18
|
+
...(associationClassID ? { associationLabel: LOCALIZATON_ANNOTATION.concat(category) } : {}),
|
|
19
|
+
associationID
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export default function getDefaultViewMeta(fieldMeta, classID, showField) {
|
|
23
|
+
const { type, name, displayAs, fieldID, isUserReference, associationID, datasource, label, fieldType } = fieldMeta;
|
|
24
|
+
const mapperKey = type && displayAs ? type.concat(':').concat(displayAs) : type;
|
|
25
|
+
const defaultConfig = getDefaultConfig(fieldMeta, classID, showField);
|
|
26
|
+
let viewMeta;
|
|
27
|
+
switch (mapperKey) {
|
|
28
|
+
case 'True-False:pxCheckbox':
|
|
29
|
+
viewMeta = {
|
|
30
|
+
type: 'Checkbox',
|
|
31
|
+
config: {
|
|
32
|
+
...defaultConfig,
|
|
33
|
+
trueLabel: '@L Yes',
|
|
34
|
+
falseLabel: '@L No',
|
|
35
|
+
caption: LOCALIZATON_ANNOTATION.concat(name || label),
|
|
36
|
+
label: undefined
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
break;
|
|
40
|
+
case 'Decimal:pxCurrency':
|
|
41
|
+
viewMeta = {
|
|
42
|
+
type: 'Currency',
|
|
43
|
+
config: defaultConfig
|
|
44
|
+
};
|
|
45
|
+
break;
|
|
46
|
+
case 'Date Time:pxDateTime':
|
|
47
|
+
case 'Date & time:pxDateTime':
|
|
48
|
+
viewMeta = {
|
|
49
|
+
type: 'DateTime',
|
|
50
|
+
config: defaultConfig
|
|
51
|
+
};
|
|
52
|
+
break;
|
|
53
|
+
case 'Date:pxDateTime':
|
|
54
|
+
case 'Date only:pxDateTime':
|
|
55
|
+
viewMeta = {
|
|
56
|
+
type: 'Date',
|
|
57
|
+
config: defaultConfig
|
|
58
|
+
};
|
|
59
|
+
break;
|
|
60
|
+
case 'Decimal:pxNumber':
|
|
61
|
+
viewMeta = {
|
|
62
|
+
type: 'Decimal',
|
|
63
|
+
config: defaultConfig
|
|
64
|
+
};
|
|
65
|
+
break;
|
|
66
|
+
case 'Text:pxEmail':
|
|
67
|
+
viewMeta = {
|
|
68
|
+
type: 'Email',
|
|
69
|
+
config: defaultConfig
|
|
70
|
+
};
|
|
71
|
+
break;
|
|
72
|
+
case 'Integer:pxInteger':
|
|
73
|
+
viewMeta = {
|
|
74
|
+
type: 'Integer',
|
|
75
|
+
config: defaultConfig
|
|
76
|
+
};
|
|
77
|
+
break;
|
|
78
|
+
case 'Decimal:pxPercentage':
|
|
79
|
+
viewMeta = {
|
|
80
|
+
type: 'Percentage',
|
|
81
|
+
config: defaultConfig
|
|
82
|
+
};
|
|
83
|
+
break;
|
|
84
|
+
case 'Text:pxPhone':
|
|
85
|
+
viewMeta = {
|
|
86
|
+
type: 'Phone',
|
|
87
|
+
config: {
|
|
88
|
+
...defaultConfig,
|
|
89
|
+
datasource: {
|
|
90
|
+
source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults',
|
|
91
|
+
fields: {
|
|
92
|
+
value: '@P .pyCallingCode'
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
break;
|
|
98
|
+
case 'TimeOfDay:pxDateTime':
|
|
99
|
+
viewMeta = {
|
|
100
|
+
type: 'Time',
|
|
101
|
+
config: defaultConfig
|
|
102
|
+
};
|
|
103
|
+
break;
|
|
104
|
+
case 'Text:pxURL':
|
|
105
|
+
case 'Text:pxUrl':
|
|
106
|
+
viewMeta = {
|
|
107
|
+
type: 'URL',
|
|
108
|
+
config: defaultConfig
|
|
109
|
+
};
|
|
110
|
+
break;
|
|
111
|
+
case 'Text:pxTextArea':
|
|
112
|
+
viewMeta = {
|
|
113
|
+
type: 'TextArea',
|
|
114
|
+
config: defaultConfig
|
|
115
|
+
};
|
|
116
|
+
break;
|
|
117
|
+
case 'Text:pxRichTextEditor':
|
|
118
|
+
viewMeta = {
|
|
119
|
+
type: 'RichText',
|
|
120
|
+
config: defaultConfig
|
|
121
|
+
};
|
|
122
|
+
break;
|
|
123
|
+
case 'Text:pxAutoComplete':
|
|
124
|
+
if (isUserReference || fieldType === 'User reference') {
|
|
125
|
+
viewMeta = {
|
|
126
|
+
type: 'UserReference',
|
|
127
|
+
config: {
|
|
128
|
+
...defaultConfig,
|
|
129
|
+
value: USER_ANNOTATION.concat(fieldID),
|
|
130
|
+
placeholder: 'Select...',
|
|
131
|
+
displayAs: 'Search box',
|
|
132
|
+
associationID,
|
|
133
|
+
associationLabel: undefined
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
const { tableType = '' } = datasource || {};
|
|
139
|
+
viewMeta = {
|
|
140
|
+
type: 'AutoComplete',
|
|
141
|
+
config: {
|
|
142
|
+
...defaultConfig,
|
|
143
|
+
placeholder: 'Select...',
|
|
144
|
+
listType: 'associated',
|
|
145
|
+
datasource: ASSOCIATED_ANNOTATION.concat(fieldID),
|
|
146
|
+
deferDatasource: tableType === 'DataPage'
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
break;
|
|
151
|
+
case 'Text:pxDropdown':
|
|
152
|
+
if (isUserReference || fieldType === 'User reference') {
|
|
153
|
+
viewMeta = {
|
|
154
|
+
type: 'UserReference',
|
|
155
|
+
config: {
|
|
156
|
+
...defaultConfig,
|
|
157
|
+
value: USER_ANNOTATION.concat(fieldID),
|
|
158
|
+
placeholder: 'Select...',
|
|
159
|
+
displayAs: 'Drop-down list',
|
|
160
|
+
associationID,
|
|
161
|
+
associationLabel: undefined
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
const { tableType = '' } = datasource || {};
|
|
167
|
+
viewMeta = {
|
|
168
|
+
type: 'Dropdown',
|
|
169
|
+
config: {
|
|
170
|
+
...defaultConfig,
|
|
171
|
+
placeholder: 'Select...',
|
|
172
|
+
listType: 'associated',
|
|
173
|
+
datasource: ASSOCIATED_ANNOTATION.concat(fieldID),
|
|
174
|
+
deferDatasource: tableType === 'DataPage'
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case 'Text:pxRadioButtons':
|
|
180
|
+
{
|
|
181
|
+
const { tableType = '' } = datasource || {};
|
|
182
|
+
viewMeta = {
|
|
183
|
+
type: 'RadioButtons',
|
|
184
|
+
config: {
|
|
185
|
+
...defaultConfig,
|
|
186
|
+
placeholder: 'Select...',
|
|
187
|
+
listType: 'associated',
|
|
188
|
+
datasource: ASSOCIATED_ANNOTATION.concat(fieldID),
|
|
189
|
+
deferDatasource: tableType === 'DataPage'
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
break;
|
|
194
|
+
case 'Text:pxTextInput':
|
|
195
|
+
viewMeta = {
|
|
196
|
+
type: 'TextInput',
|
|
197
|
+
config: defaultConfig
|
|
198
|
+
};
|
|
199
|
+
break;
|
|
200
|
+
default:
|
|
201
|
+
viewMeta = {
|
|
202
|
+
type,
|
|
203
|
+
config: defaultConfig
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
return viewMeta;
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=DefaultViewMeta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultViewMeta.js","sourceRoot":"","sources":["../../../../src/components/template/ListView/DefaultViewMeta.js"],"names":[],"mappings":"AAAA,MAAM,sBAAsB,GAAG,KAAK,CAAC;AACrC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,eAAe,GAAG,SAAS,CAAC;AAClC,MAAM,qBAAqB,GAAG,eAAe,CAAC;AAC9C,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAEtC,MAAM,gBAAgB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;IACpD,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,QAAQ,EACR,IAAI,EACJ,OAAO,EAAE,gBAAgB,EACzB,SAAS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OTATION = '@ASSOCIATED .';\nconst ASSOCIATION_ANNOTATION = '@CA ';\n\nconst getDefaultConfig = (fieldMeta, classID, show) => {\n const {\n name,\n label,\n fieldID,\n fieldType,\n dataType,\n type,\n classID: fieldMetaClassID,\n displayAs,\n displayAsLink,\n category,\n associationClassID,\n associationID\n } = fieldMeta;\n return {\n value: (associationClassID ? ASSOCIATION_ANNOTATION : PROPERTY_ANNOTATION).concat(fieldID),\n label: LOCALIZATON_ANNOTATION.concat(name || label),\n fieldType,\n propertyType: dataType || type,\n classID: classID || fieldMetaClassID,\n displayAs,\n displayAsLink,\n category,\n show,\n ...(associationClassID ? { associationLabel: LOCALIZATON_ANNOTATION.concat(category) } : {}),\n associationID\n };\n};\n\n\nexport default function getDefaultViewMeta(fieldMeta, classID, showField) {\n const { type, name, displayAs, fieldID, isUserReference, associationID, datasource, label, fieldType } =\n fieldMeta;\n const mapperKey = type && displayAs ? type.concat(':').concat(displayAs) : type;\n const defaultConfig = getDefaultConfig(fieldMeta, classID, showField);\n let viewMeta;\n switch (mapperKey) {\n case 'True-False:pxCheckbox':\n viewMeta = {\n type: 'Checkbox',\n config: {\n ...defaultConfig,\n trueLabel: '@L Yes',\n falseLabel: '@L No',\n caption: LOCALIZATON_ANNOTATION.concat(name || label),\n label: undefined\n }\n };\n break;\n case 'Decimal:pxCurrency':\n viewMeta = {\n type: 'Currency',\n config: defaultConfig\n };\n break;\n case 'Date Time:pxDateTime':\n case 'Date & time:pxDateTime':\n viewMeta = {\n type: 'DateTime',\n config: defaultConfig\n };\n break;\n case 'Date:pxDateTime':\n case 'Date only:pxDateTime':\n viewMeta = {\n type: 'Date',\n config: defaultConfig\n };\n break;\n case 'Decimal:pxNumber':\n viewMeta = {\n type: 'Decimal',\n config: defaultConfig\n };\n break;\n case 'Text:pxEmail':\n viewMeta = {\n type: 'Email',\n config: defaultConfig\n };\n break;\n case 'Integer:pxInteger':\n viewMeta = {\n type: 'Integer',\n config: defaultConfig\n };\n break;\n case 'Decimal:pxPercentage':\n viewMeta = {\n type: 'Percentage',\n config: defaultConfig\n };\n break;\n case 'Text:pxPhone':\n viewMeta = {\n type: 'Phone',\n config: {\n ...defaultConfig,\n datasource: {\n source: '@DATASOURCE D_pyCountryCallingCodeList.pxResults',\n fields: {\n value: '@P .pyCallingCode'\n }\n }\n }\n };\n break;\n case 'TimeOfDay:pxDateTime':\n viewMeta = {\n type: 'Time',\n config: defaultConfig\n };\n break;\n case 'Text:pxURL':\n case 'Text:pxUrl':\n viewMeta = {\n type: 'URL',\n config: defaultConfig\n };\n break;\n case 'Text:pxTextArea':\n viewMeta = {\n type: 'TextArea',\n config: defaultConfig\n };\n break;\n case 'Text:pxRichTextEditor':\n viewMeta = {\n type: 'RichText',\n config: defaultConfig\n };\n break;\n case 'Text:pxAutoComplete':\n if (isUserReference || fieldType === 'User reference') {\n viewMeta = {\n type: 'UserReference',\n config: {\n ...defaultConfig,\n value: USER_ANNOTATION.concat(fieldID),\n placeholder: 'Select...',\n displayAs: 'Search box',\n associationID,\n associationLabel: undefined\n }\n };\n } else {\n const { tableType = '' } = datasource || {};\n viewMeta = {\n type: 'AutoComplete',\n config: {\n ...defaultConfig,\n placeholder: 'Select...',\n listType: 'associated',\n datasource: ASSOCIATED_ANNOTATION.concat(fieldID),\n deferDatasource: tableType === 'DataPage'\n }\n };\n }\n break;\n case 'Text:pxDropdown':\n if (isUserReference || fieldType === 'User reference') {\n viewMeta = {\n type: 'UserReference',\n config: {\n ...defaultConfig,\n value: USER_ANNOTATION.concat(fieldID),\n placeholder: 'Select...',\n displayAs: 'Drop-down list',\n associationID,\n associationLabel: undefined\n }\n };\n } else {\n const { tableType = '' } = datasource || {};\n viewMeta = {\n type: 'Dropdown',\n config: {\n ...defaultConfig,\n placeholder: 'Select...',\n listType: 'associated',\n datasource: ASSOCIATED_ANNOTATION.concat(fieldID),\n deferDatasource: tableType === 'DataPage'\n }\n };\n }\n break;\n case 'Text:pxRadioButtons':\n {\n const { tableType = '' } = datasource || {};\n viewMeta = {\n type: 'RadioButtons',\n config: {\n ...defaultConfig,\n placeholder: 'Select...',\n listType: 'associated',\n datasource: ASSOCIATED_ANNOTATION.concat(fieldID),\n deferDatasource: tableType === 'DataPage'\n }\n };\n }\n break;\n case 'Text:pxTextInput':\n viewMeta = {\n type: 'TextInput',\n config: defaultConfig\n };\n break;\n default:\n viewMeta = {\n type,\n config: defaultConfig\n };\n }\n return viewMeta;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../../src/components/template/ListView/ListView.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../../../src/components/template/ListView/ListView.tsx"],"names":[],"mappings":";AAMA,OAAO,SAAS,MAAM,YAAY,CAAC;AAkCnC,OAAO,gBAAgB,CAAC;AAsBxB,iBAAwB,QAAQ,CAAC,KAAK,KAAA,eAswCrC;kBAtwCuB,QAAQ;;;;;;eAAR,QAAQ"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-plusplus */
|
|
2
2
|
/* eslint-disable guard-for-in */
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
4
|
+
/* eslint-disable @typescript-eslint/no-shadow */
|
|
5
|
+
/* eslint-disable no-shadow */
|
|
4
6
|
import React, { useState, useEffect, useRef } from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { createStyles, makeStyles } from '@material-ui/core/styles';
|
|
@@ -37,6 +39,7 @@ import { Radio } from '@material-ui/core';
|
|
|
37
39
|
import Checkbox from '@material-ui/core/Checkbox';
|
|
38
40
|
import { filterData } from '../../helpers/simpleTableHelpers';
|
|
39
41
|
import './ListView.css';
|
|
42
|
+
import useInit from './hooks';
|
|
40
43
|
const SELECTION_MODE = { SINGLE: 'single', MULTI: 'multi' };
|
|
41
44
|
let myRows;
|
|
42
45
|
let myDisplayColumnList;
|
|
@@ -51,7 +54,15 @@ let sortColumnId;
|
|
|
51
54
|
const filterByColumns = [];
|
|
52
55
|
export default function ListView(props) {
|
|
53
56
|
const { getPConnect, bInForm } = props;
|
|
54
|
-
const { globalSearch,
|
|
57
|
+
const { globalSearch, referenceList, rowClickAction, selectionMode, referenceType, payload, parameters, compositeKeys, showDynamicFields, presets } = props;
|
|
58
|
+
const ref = useRef({}).current;
|
|
59
|
+
const cosmosTableRef = useRef();
|
|
60
|
+
// List component context
|
|
61
|
+
const [listContext, setListContext] = useState({});
|
|
62
|
+
const { meta } = listContext;
|
|
63
|
+
const xRayApis = PCore.getDebugger().getXRayRuntime();
|
|
64
|
+
const xRayUid = xRayApis.startXRay();
|
|
65
|
+
useInit({ ...props, setListContext, ref, showDynamicFields, xRayUid, cosmosTableRef });
|
|
55
66
|
const thePConn = getPConnect();
|
|
56
67
|
const componentConfig = thePConn.getComponentConfig();
|
|
57
68
|
const resolvedConfigProps = thePConn.getConfigProps();
|
|
@@ -154,7 +165,6 @@ export default function ListView(props) {
|
|
|
154
165
|
function stableSort(array, comparator) {
|
|
155
166
|
const stabilizedThis = array.map((el, index) => [el, index]);
|
|
156
167
|
stabilizedThis.sort((a, b) => {
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/no-shadow, no-shadow
|
|
158
168
|
const order = comparator(a[0], b[0]);
|
|
159
169
|
if (order !== 0)
|
|
160
170
|
return order;
|
|
@@ -181,15 +191,19 @@ export default function ListView(props) {
|
|
|
181
191
|
// });
|
|
182
192
|
// return arReturn;
|
|
183
193
|
// }
|
|
184
|
-
|
|
185
|
-
|
|
194
|
+
const AssignDashObjects = ['Assign-Worklist', 'Assign-WorkBasket'];
|
|
195
|
+
function getHeaderCells(colFields, fields, presetFields) {
|
|
196
|
+
const arReturn = colFields.map((field, index) => {
|
|
186
197
|
let theField = field.config.value.substring(field.config.value.indexOf(' ') + 1);
|
|
187
198
|
if (theField.indexOf('.') === 0) {
|
|
188
199
|
theField = theField.substring(1);
|
|
189
200
|
}
|
|
201
|
+
const colIndex = fields.findIndex(ele => ele.name === theField);
|
|
202
|
+
const displayAsLink = field.config.displayAsLink;
|
|
190
203
|
const headerRow = {};
|
|
191
204
|
headerRow.id = theField;
|
|
192
205
|
headerRow.type = field.type;
|
|
206
|
+
headerRow.displayAsLink = displayAsLink;
|
|
193
207
|
headerRow.numeric =
|
|
194
208
|
field.type === 'Decimal' ||
|
|
195
209
|
field.type === 'Integer' ||
|
|
@@ -197,19 +211,28 @@ export default function ListView(props) {
|
|
|
197
211
|
field.type === 'Currency' ||
|
|
198
212
|
false;
|
|
199
213
|
headerRow.disablePadding = false;
|
|
200
|
-
headerRow.label =
|
|
214
|
+
headerRow.label = presetFields[index].config.label;
|
|
215
|
+
if (colIndex > -1) {
|
|
216
|
+
headerRow.classID = fields[colIndex].classID;
|
|
217
|
+
}
|
|
218
|
+
if (displayAsLink) {
|
|
219
|
+
headerRow.isAssignmentLink = AssignDashObjects.includes(headerRow.classID);
|
|
220
|
+
if (field.config.value?.startsWith('@CA')) {
|
|
221
|
+
headerRow.isAssociation = true;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
201
224
|
return headerRow;
|
|
202
225
|
});
|
|
203
226
|
return arReturn;
|
|
204
227
|
}
|
|
205
228
|
function updateFields(arFields, theColumns) {
|
|
206
|
-
const arReturn = arFields;
|
|
207
|
-
|
|
229
|
+
const arReturn = arFields.filter(ele => ele.type !== 'reference');
|
|
230
|
+
arReturn.forEach((field, index) => {
|
|
208
231
|
arReturn[index].config.name = theColumns[index].id;
|
|
209
232
|
});
|
|
210
233
|
return arReturn;
|
|
211
234
|
}
|
|
212
|
-
function getUsingData(arTableData
|
|
235
|
+
function getUsingData(arTableData) {
|
|
213
236
|
if (selectionMode === SELECTION_MODE.SINGLE || selectionMode === SELECTION_MODE.MULTI) {
|
|
214
237
|
const record = arTableData?.length > 0 ? arTableData[0] : '';
|
|
215
238
|
if (typeof record === 'object' && !('pyGUID' in record) && !('pyID' in record)) {
|
|
@@ -218,21 +241,7 @@ export default function ListView(props) {
|
|
|
218
241
|
}
|
|
219
242
|
}
|
|
220
243
|
const arReturn = arTableData?.map((data) => {
|
|
221
|
-
const row =
|
|
222
|
-
theColumns.forEach(col => {
|
|
223
|
-
row[col.id] = data[col.id];
|
|
224
|
-
});
|
|
225
|
-
row[rowID] = data[rowID];
|
|
226
|
-
// for (const field of theColumns) {
|
|
227
|
-
// row[field.id] = data[field.id];
|
|
228
|
-
// }
|
|
229
|
-
// add in pxRefObjectClass and pzInsKey
|
|
230
|
-
if (data['pxRefObjectClass']) {
|
|
231
|
-
row['pxRefObjectClass'] = data['pxRefObjectClass'];
|
|
232
|
-
}
|
|
233
|
-
if (data['pzInsKey']) {
|
|
234
|
-
row['pzInsKey'] = data['pzInsKey'];
|
|
235
|
-
}
|
|
244
|
+
const row = data;
|
|
236
245
|
return row;
|
|
237
246
|
});
|
|
238
247
|
return arReturn;
|
|
@@ -396,19 +405,86 @@ export default function ListView(props) {
|
|
|
396
405
|
}, `dashboard-component-${'id'}`, false, getPConnect().getContextName());
|
|
397
406
|
}, 0);
|
|
398
407
|
}, []);
|
|
399
|
-
function fetchAllData() {
|
|
408
|
+
function fetchAllData(fields) {
|
|
409
|
+
let query = null;
|
|
410
|
+
if (payload) {
|
|
411
|
+
query = payload.query;
|
|
412
|
+
}
|
|
413
|
+
else if (fields?.length && meta.isQueryable) {
|
|
414
|
+
query = { select: fields };
|
|
415
|
+
}
|
|
416
|
+
else if (dashboardFilterPayload) {
|
|
417
|
+
query = dashboardFilterPayload.query;
|
|
418
|
+
}
|
|
400
419
|
const context = getPConnect().getContextName();
|
|
401
|
-
return PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null,
|
|
402
|
-
}
|
|
420
|
+
return PCore.getDataPageUtils().getDataAsync(referenceList, context, payload ? payload.dataViewParameters : dataViewParameters, null, query);
|
|
421
|
+
}
|
|
422
|
+
const buildSelect = (fieldDefs, colId, patchQueryFields = [], compositeKeys = []) => {
|
|
423
|
+
const listFields = [];
|
|
424
|
+
if (colId) {
|
|
425
|
+
const field = getField(fieldDefs, colId);
|
|
426
|
+
listFields.push({
|
|
427
|
+
field: field.name
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
else {
|
|
431
|
+
// NOTE: If we ever decide to not set up all the `fieldDefs` on select, ensure that the fields corresponding to `state.groups` are set up. Needed in Client-mode grouping/pagination.
|
|
432
|
+
fieldDefs.forEach(field => {
|
|
433
|
+
if (!listFields.find(f => f.field === field.name)) {
|
|
434
|
+
listFields.push({
|
|
435
|
+
field: field.name
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
patchQueryFields.forEach(k => {
|
|
440
|
+
if (!listFields.find(f => f.field === k)) {
|
|
441
|
+
listFields.push({
|
|
442
|
+
field: k
|
|
443
|
+
});
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
compositeKeys.forEach(k => {
|
|
448
|
+
if (!listFields.find(f => f.field === k)) {
|
|
449
|
+
listFields.push({
|
|
450
|
+
field: k
|
|
451
|
+
});
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
return listFields;
|
|
455
|
+
};
|
|
456
|
+
const addItemKeyInSelect = (fieldDefs, itemKey, select, compositeKeys) => {
|
|
457
|
+
const elementFound = getField(fieldDefs, itemKey);
|
|
458
|
+
if (itemKey && !elementFound && Array.isArray(select) && !(compositeKeys !== null && compositeKeys?.length) && !select.find(sel => sel.field === itemKey)) {
|
|
459
|
+
return [...select, {
|
|
460
|
+
field: itemKey
|
|
461
|
+
}];
|
|
462
|
+
}
|
|
463
|
+
return select;
|
|
464
|
+
};
|
|
465
|
+
const getField = (fieldDefs, columnId) => {
|
|
466
|
+
const fieldsMap = getFieldsMap(fieldDefs);
|
|
467
|
+
return fieldsMap.get(columnId);
|
|
468
|
+
};
|
|
469
|
+
const getFieldsMap = fieldDefs => {
|
|
470
|
+
const fieldsMap = new Map();
|
|
471
|
+
fieldDefs.forEach(element => {
|
|
472
|
+
fieldsMap.set(element.id, element);
|
|
473
|
+
});
|
|
474
|
+
return fieldsMap;
|
|
475
|
+
};
|
|
403
476
|
async function fetchDataFromServer() {
|
|
404
477
|
let bCallSetRowsColumns = true;
|
|
405
|
-
const
|
|
478
|
+
const { fieldDefs, itemKey, patchQueryFields } = meta;
|
|
479
|
+
let listFields = fieldDefs ? buildSelect(fieldDefs, undefined, patchQueryFields, compositeKeys) : [];
|
|
480
|
+
listFields = addItemKeyInSelect(fieldDefs, itemKey, listFields, compositeKeys);
|
|
481
|
+
const workListJSON = await fetchAllData(listFields);
|
|
406
482
|
// don't update these fields until we return from promise
|
|
407
483
|
let fields = presets[0].children[0].children;
|
|
408
484
|
// this is an unresovled version of this.fields$, need unresolved, so can get the property reference
|
|
409
485
|
const columnFields = componentConfig.presets[0].children[0].children;
|
|
410
486
|
const tableDataResults = workListJSON['data'];
|
|
411
|
-
const myColumns = getHeaderCells(columnFields, fields);
|
|
487
|
+
const myColumns = getHeaderCells(columnFields, fieldDefs, fields);
|
|
412
488
|
const selectParams = [];
|
|
413
489
|
myColumns.forEach(column => {
|
|
414
490
|
selectParams.push({
|
|
@@ -422,7 +498,7 @@ export default function ListView(props) {
|
|
|
422
498
|
columnList = colList;
|
|
423
499
|
fields = updateFields(fields, myColumns);
|
|
424
500
|
setResponse(tableDataResults);
|
|
425
|
-
const usingDataResults = getUsingData(tableDataResults
|
|
501
|
+
const usingDataResults = getUsingData(tableDataResults);
|
|
426
502
|
// store globally, so can be searched, filtered, etc.
|
|
427
503
|
myRows = updateData(usingDataResults, fields);
|
|
428
504
|
myDisplayColumnList = getMyColumnList(myColumns);
|
|
@@ -443,8 +519,10 @@ export default function ListView(props) {
|
|
|
443
519
|
};
|
|
444
520
|
}
|
|
445
521
|
useEffect(() => {
|
|
446
|
-
|
|
447
|
-
|
|
522
|
+
if (listContext.meta) {
|
|
523
|
+
fetchDataFromServer();
|
|
524
|
+
}
|
|
525
|
+
}, [listContext]);
|
|
448
526
|
function searchFilter(value, rows) {
|
|
449
527
|
function filterArray(el) {
|
|
450
528
|
const bReturn = false;
|
|
@@ -504,7 +582,8 @@ export default function ListView(props) {
|
|
|
504
582
|
}
|
|
505
583
|
}
|
|
506
584
|
function openWork(row) {
|
|
507
|
-
const {
|
|
585
|
+
const { pxRefObjectKey } = row;
|
|
586
|
+
const pxRefObjectClass = row.pxRefObjectClass || row.pxObjClass;
|
|
508
587
|
if (pxRefObjectClass !== '' && pxRefObjectKey !== '') {
|
|
509
588
|
thePConn.getActionsApi().openWorkByHandle(pxRefObjectKey, pxRefObjectClass);
|
|
510
589
|
}
|
|
@@ -691,16 +770,35 @@ export default function ListView(props) {
|
|
|
691
770
|
}
|
|
692
771
|
return bReturn;
|
|
693
772
|
}
|
|
694
|
-
function _listViewClick(
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
773
|
+
function _listViewClick(row, column) {
|
|
774
|
+
const name = column.id;
|
|
775
|
+
if (column.displayAsLink) {
|
|
776
|
+
const { pxObjClass } = row;
|
|
777
|
+
let { pzInsKey } = row;
|
|
778
|
+
if (column.isAssociation) {
|
|
779
|
+
const associationCategory = name.split(':')[0];
|
|
780
|
+
pzInsKey = row[`${associationCategory}:pzInsKey`];
|
|
781
|
+
}
|
|
782
|
+
if (column.isAssignmentLink) {
|
|
783
|
+
thePConn.getActionsApi().openAssignment(pzInsKey, pxObjClass, {
|
|
784
|
+
containerName: 'primary'
|
|
785
|
+
});
|
|
786
|
+
}
|
|
787
|
+
else {
|
|
788
|
+
thePConn.getActionsApi().openWorkByHandle(pzInsKey, pxObjClass);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
switch (name) {
|
|
793
|
+
case 'pxTaskLabel':
|
|
794
|
+
openAssignment(row);
|
|
795
|
+
break;
|
|
796
|
+
case 'pxRefObjectInsName':
|
|
797
|
+
openWork(row);
|
|
798
|
+
break;
|
|
799
|
+
default:
|
|
800
|
+
break;
|
|
801
|
+
}
|
|
704
802
|
}
|
|
705
803
|
}
|
|
706
804
|
function _listTitle() {
|
|
@@ -764,7 +862,7 @@ export default function ListView(props) {
|
|
|
764
862
|
React.createElement(Grid, { item: true },
|
|
765
863
|
React.createElement(SearchIcon, null)),
|
|
766
864
|
React.createElement(Grid, { item: true },
|
|
767
|
-
React.createElement(TextField, { label: 'Search', fullWidth: true, variant: 'outlined', placeholder: '', size: 'small', onChange: _onSearch })))),
|
|
865
|
+
React.createElement(TextField, { label: 'Search', fullWidth: true, variant: 'outlined', placeholder: '', size: 'small', id: "search", onChange: _onSearch })))),
|
|
768
866
|
React.createElement(React.Fragment, null, bInForm ? (React.createElement(TableContainer, { className: classes.tableInForm },
|
|
769
867
|
React.createElement(Table, { stickyHeader: true, "aria-label": 'sticky table' },
|
|
770
868
|
React.createElement(TableHead, null,
|
|
@@ -785,8 +883,8 @@ export default function ListView(props) {
|
|
|
785
883
|
_rowClick(row);
|
|
786
884
|
} }, arColumns.map(column => {
|
|
787
885
|
const value = row[column.id];
|
|
788
|
-
return (React.createElement(TableCell, { key: column.id, align: column.align, className: classes.cell }, _showButton(column.id, row) ? (React.createElement(Link, { component: 'button', onClick: () => {
|
|
789
|
-
_listViewClick(
|
|
886
|
+
return (React.createElement(TableCell, { key: column.id, align: column.align, className: classes.cell }, _showButton(column.id, row) || column.displayAsLink ? (React.createElement(Link, { component: 'button', onClick: () => {
|
|
887
|
+
_listViewClick(row, column);
|
|
790
888
|
} }, column.format && typeof value === 'number'
|
|
791
889
|
? column.format(value)
|
|
792
890
|
: value)) : (React.createElement(React.Fragment, null, column.format && typeof value === 'number'
|