udp-react-enterprise-component-library 25.18.4-beta.71 → 25.18.4-beta.73

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.
@@ -122,55 +122,53 @@ const useStyles$3 = makeStyles((theme) => ({
122
122
  "&:hover": { color: theme.palette.error.main }
123
123
  }
124
124
  }));
125
- const UdpTransactionTypeForm = (props, ref) => {
126
- const { onSubmit, initialData, disableSubTypeFields, domainNameOptions, onSelectDomainName, domainFieldOptions, selectedDomainName, isPageConfigOpen, setIsPageConfigOpen } = props;
127
- const handleSubmitRef = useRef();
128
- const { t } = useTranslation();
129
- const classes = useStyles$3();
130
- const requiredColumnDefFields = REQUIRED_COLUMN_DEF_FIELDS.map((key) => [key, {
125
+ const buildRequiredColumnDefFields = () => REQUIRED_COLUMN_DEF_FIELDS.map((key) => [key, {
126
+ displayName: REQUIRED_COLUMN_DEF_MAPPING[key]?.displayName || key,
127
+ order: 0,
128
+ hide: false
129
+ }]);
130
+ /**
131
+ * Checks for the UDP prefix, strips it if present, and returns the result.
132
+ * @param {string} value - The string to process.
133
+ * @returns {string} The shortened string or the original if no prefix found.
134
+ */
135
+ const stripUdpPrefix = (value) => {
136
+ if (typeof value !== "string") return value;
137
+ if (value.startsWith(UdpSearchEnums.UdpBusinessDomainPrefix)) return value.slice(UdpSearchEnums.UdpBusinessDomainPrefix.length + 1);
138
+ return value;
139
+ };
140
+ const computeInitialValues = (initialData, domainNameOptions, domainFieldOptions, selectedDomainName) => {
141
+ let formattedData;
142
+ const requiredFields = buildRequiredColumnDefFields();
143
+ if (!initialData) return { domainFields: requiredFields };
144
+ let domainFieldsDatasource = initialData?.pageConfiguration?.columnDefProperties ? initialData?.pageConfiguration?.columnDefProperties : initialData?.domainFields;
145
+ const existingDomainFields = selectedDomainName === initialData?.domainName && domainFieldsDatasource ? Object.entries(domainFieldsDatasource).map(([fieldKey, fieldConfig]) => {
146
+ return [stripUdpPrefix(fieldKey), { ...fieldConfig && typeof fieldConfig === "object" ? fieldConfig : { value: fieldConfig } }];
147
+ }) : [[]];
148
+ const existingKeys = existingDomainFields.map((field) => field[0]);
149
+ const missingTransactionFields = REQUIRED_COLUMN_DEF_FIELDS.filter((key) => !existingKeys.includes(key)).map((key) => [key, {
131
150
  displayName: REQUIRED_COLUMN_DEF_MAPPING[key]?.displayName || key,
132
151
  order: 0,
133
152
  hide: false
134
153
  }]);
135
- /**
136
- * Checks for the UDP prefix, strips it if present, and returns the result.
137
- * @param {string} value - The string to process.
138
- * @returns {string} The shortened string or the original if no prefix found.
139
- */
140
- const stripUdpPrefix = (value) => {
141
- if (typeof value !== "string") return value;
142
- if (value.startsWith(UdpSearchEnums.UdpBusinessDomainPrefix)) return value.slice(UdpSearchEnums.UdpBusinessDomainPrefix.length + 1);
143
- return value;
154
+ formattedData = {
155
+ ...initialData,
156
+ domainName: domainNameOptions?.find((domainName) => domainName === selectedDomainName || ""),
157
+ domainFieldType: domainFieldOptions?.find((domainField) => domainField === initialData?.domainFieldType),
158
+ domainFieldLabel: domainFieldOptions?.find((domainField) => domainField === initialData?.domainFieldLabel) || initialData?.domainFieldLabel,
159
+ revisionField: domainFieldOptions?.find((domainField) => domainField === initialData?.revisionField),
160
+ domainFields: [...missingTransactionFields, ...existingDomainFields]
144
161
  };
145
- const formInitialValues = useMemo(() => {
146
- let formattedData;
147
- if (!initialData) return { domainFields: requiredColumnDefFields };
148
- let domainFieldsDatasource = initialData?.pageConfiguration?.columnDefProperties ? initialData?.pageConfiguration?.columnDefProperties : initialData?.domainFields;
149
- const existingDomainFields = selectedDomainName === initialData?.domainName && domainFieldsDatasource ? Object.entries(domainFieldsDatasource).map(([fieldKey, fieldConfig]) => {
150
- return [stripUdpPrefix(fieldKey), { ...fieldConfig && typeof fieldConfig === "object" ? fieldConfig : { value: fieldConfig } }];
151
- }) : [[]];
152
- const existingKeys = existingDomainFields.map((field) => field[0]);
153
- const missingTransactionFields = REQUIRED_COLUMN_DEF_FIELDS.filter((key) => !existingKeys.includes(key)).map((key) => [key, {
154
- displayName: REQUIRED_COLUMN_DEF_MAPPING[key]?.displayName || key,
155
- order: 0,
156
- hide: false
157
- }]);
158
- formattedData = {
159
- ...initialData,
160
- domainName: domainNameOptions?.find((domainName) => domainName === selectedDomainName || ""),
161
- domainFieldType: domainFieldOptions?.find((domainField) => domainField === initialData?.domainFieldType),
162
- domainFieldLabel: domainFieldOptions?.find((domainField) => domainField === initialData?.domainFieldLabel) || initialData?.domainFieldLabel,
163
- revisionField: domainFieldOptions?.find((domainField) => domainField === initialData?.revisionField),
164
- domainFields: [...missingTransactionFields, ...existingDomainFields]
165
- };
166
- return formattedData;
167
- }, [
168
- initialData,
169
- selectedDomainName,
170
- domainNameOptions,
171
- domainFieldOptions,
172
- requiredColumnDefFields
173
- ]);
162
+ return formattedData;
163
+ };
164
+ const UdpTransactionTypeForm = (props, ref) => {
165
+ const { onSubmit, initialData, disableSubTypeFields, domainNameOptions, onSelectDomainName, domainFieldOptions, selectedDomainName, isPageConfigOpen, setIsPageConfigOpen } = props;
166
+ const handleSubmitRef = useRef();
167
+ const { t } = useTranslation();
168
+ const classes = useStyles$3();
169
+ const [formInitialValues] = useState(() => {
170
+ return computeInitialValues(initialData, domainNameOptions, domainFieldOptions, selectedDomainName);
171
+ });
174
172
  useImperativeHandle(ref, () => ({ submit: () => {
175
173
  handleSubmitRef?.current();
176
174
  } }));
@@ -188,7 +186,7 @@ const UdpTransactionTypeForm = (props, ref) => {
188
186
  const nextDomainName = value || "";
189
187
  if ((form.getState().values?.domainName || "") !== nextDomainName) {
190
188
  onSelectDomainName?.(nextDomainName);
191
- form.change("domainFields", [...requiredColumnDefFields]);
189
+ form.change("domainFields", [...buildRequiredColumnDefFields()]);
192
190
  }
193
191
  };
194
192
  const handleDomainFieldTypeChange = (value) => {
@@ -3611,7 +3609,7 @@ const UdpTransactionTypesPage = () => {
3611
3609
  {
3612
3610
  id: 3,
3613
3611
  title: t("Manage Actions"),
3614
- iconName: "workorder",
3612
+ iconName: "text-grammar-settings",
3615
3613
  handleOnClick: (e, transactionType) => {
3616
3614
  handleTransactionTypeTransactionActionSidesheet(true, transactionType?.data);
3617
3615
  }
@@ -3619,7 +3617,7 @@ const UdpTransactionTypesPage = () => {
3619
3617
  {
3620
3618
  id: 4,
3621
3619
  title: t("Manage Forms/Pages"),
3622
- iconName: "send",
3620
+ iconName: "form-new",
3623
3621
  handleOnClick: (e, transactionType) => {
3624
3622
  handleTransactionUiActionSidesheet(true, transactionType?.data);
3625
3623
  }
@@ -3627,7 +3625,7 @@ const UdpTransactionTypesPage = () => {
3627
3625
  {
3628
3626
  id: 5,
3629
3627
  title: t("Manage Rules"),
3630
- iconName: "wizard",
3628
+ iconName: "apps-list",
3631
3629
  handleOnClick: (e, transactionType) => {
3632
3630
  handleTransactionTypeConfigurationSidesheet(true, transactionType?.data);
3633
3631
  }
@@ -3864,4 +3862,4 @@ var UdpTransactionTypesPage_exports = /* @__PURE__ */ __exportAll({
3864
3862
  //#endregion
3865
3863
  export { UdpTransactionTypesPage as a, REQUIRED_COLUMN_DEF_MAPPING as i, DISABLE_ORDERING_FOR_FIELDS as n, REQUIRED_COLUMN_DEF_FIELDS as r, UdpTransactionTypesPage_exports as t };
3866
3864
 
3867
- //# sourceMappingURL=UdpTransactionTypesPage-DVM7nJhy.js.map
3865
+ //# sourceMappingURL=UdpTransactionTypesPage-C_BN1GFo.js.map