udp-react-enterprise-component-library 25.18.1-beta.56 → 25.18.1-beta.58

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.
@@ -3,6 +3,7 @@ import { t as Form$1 } from "./Form-DbOA5j38.js";
3
3
  import { t as Field$1 } from "./Field-Cda5rJe2.js";
4
4
  import { t as arrayMutators } from "./form-Dj1zVw6K.js";
5
5
  import { t as FluentButton } from "./FluentButton-BexKrnAp.js";
6
+ import { t as ConfigService } from "./configService-C4uoG3wj.js";
6
7
  import { t as useUser } from "./useUser-wpHGo6jU.js";
7
8
  import { t as apiMutate } from "./useAxiosMutate-DeqKSi5z.js";
8
9
  import { V as UdpTransactionActionEnums, a as EMPTY_GUID } from "./unitySystemEnums-CZDCsD5t.js";
@@ -27,7 +28,7 @@ import { FieldArray } from "react-final-form-arrays";
27
28
 
28
29
  //#region src/udp/pages/UdpTransactionTypesPage/forms/UdpTransactionTypeForm.jsx
29
30
  const UdpTransactionTypeForm = (props, ref) => {
30
- const { onSubmit, initialData, domainNameOptions, onSelectDomainName, domainFieldOptions } = props;
31
+ const { onSubmit, initialData, disableSubTypeFields, domainNameOptions, onSelectDomainName, domainFieldOptions } = props;
31
32
  const handleSubmitRef = useRef();
32
33
  const { t } = useTranslation();
33
34
  useImperativeHandle(ref, () => ({ submit: () => {
@@ -91,7 +92,8 @@ const UdpTransactionTypeForm = (props, ref) => {
91
92
  initialValue: initialData?.domainFieldType,
92
93
  options: domainFieldOptions || [],
93
94
  getOptionLabelFunction: (option) => option,
94
- additionalOnChangeAction: handleDomainFieldTypeChange
95
+ additionalOnChangeAction: handleDomainFieldTypeChange,
96
+ disabled: disableSubTypeFields
95
97
  }), hasDomainFieldType && /* @__PURE__ */ React.createElement(Field$1, {
96
98
  component: FluentTextField,
97
99
  label: t("Sub-Type Value"),
@@ -101,7 +103,8 @@ const UdpTransactionTypeForm = (props, ref) => {
101
103
  variant: "outlined",
102
104
  margin: "normal",
103
105
  size: "small",
104
- initialValue: initialData?.domainFieldValue || ""
106
+ initialValue: initialData?.domainFieldValue || "",
107
+ disabled: disableSubTypeFields
105
108
  }), /* @__PURE__ */ React.createElement(Field$1, {
106
109
  component: AmbientAutoComplete,
107
110
  label: "Grid Columns",
@@ -169,6 +172,7 @@ const UdpTransactionTypeSidesheet = (props) => {
169
172
  const isEditing = !!initialTransactionType;
170
173
  const formRef = useRef();
171
174
  const { t } = useTranslation();
175
+ const [transactions, setTransactions] = useState(null);
172
176
  const catalogObjectNames = useMemo(() => {
173
177
  const catalogObjectList = catalogObjects?.ctlg?.catalogObjectList;
174
178
  if (!catalogObjectList) return [];
@@ -182,6 +186,46 @@ const UdpTransactionTypeSidesheet = (props) => {
182
186
  handleSideSheet(isOpen);
183
187
  setSelectedDomainName(domainName);
184
188
  }, [handleSideSheet, setSelectedDomainName]);
189
+ if (!isSideSheetOpen && transactions) setTransactions(null);
190
+ const shouldDisableSubTypes = useMemo(() => {
191
+ if (!transactions || transactions.length === 0 || !initialTransactionType) return false;
192
+ const targetValue = initialTransactionType.domainFieldValue;
193
+ if (targetValue === void 0 || targetValue === null) return false;
194
+ return transactions.some((t$1) => {
195
+ return t$1.entityBusinessObject?.[initialTransactionType.domainFieldType] === targetValue;
196
+ });
197
+ }, [transactions, initialTransactionType]);
198
+ useEffect(() => {
199
+ let isMounted = true;
200
+ const fetchTransactions = async () => {
201
+ if (isEditing && isSideSheetOpen && initialTransactionType?.transactionTypeId) try {
202
+ const response = await apiMutate(ConfigService.productV1ApiUrl, "UdpTransaction/search", { method: "post" }, { data: {
203
+ filterElements: [{
204
+ searchField: "transactionTypeId",
205
+ searchOperator: "=",
206
+ searchValue: initialTransactionType.transactionTypeId
207
+ }, {
208
+ searchField: "isDeleted",
209
+ searchOperator: "=",
210
+ searchValue: 0
211
+ }],
212
+ getAll: true
213
+ } });
214
+ if (isMounted && response?.data?.pageList) setTransactions(response.data.pageList);
215
+ } catch (error) {
216
+ console.error("Failed to check transaction existence", error);
217
+ if (isMounted) setTransactions([]);
218
+ }
219
+ };
220
+ fetchTransactions();
221
+ return () => {
222
+ isMounted = false;
223
+ };
224
+ }, [
225
+ initialTransactionType,
226
+ isEditing,
227
+ isSideSheetOpen
228
+ ]);
185
229
  return /* @__PURE__ */ React.createElement(SideSheet, {
186
230
  open: isSideSheetOpen,
187
231
  width: 500,
@@ -191,10 +235,11 @@ const UdpTransactionTypeSidesheet = (props) => {
191
235
  onSubmit: () => {
192
236
  formRef?.current?.submit();
193
237
  }
194
- }, /* @__PURE__ */ React.createElement(UdpTransactionTypeForm_default, {
238
+ }, isEditing && !transactions ? /* @__PURE__ */ React.createElement(LinearProgress$1, null) : /* @__PURE__ */ React.createElement(UdpTransactionTypeForm_default, {
195
239
  ref: formRef,
196
240
  onSubmit: onSubmitForm,
197
241
  initialData: initialTransactionType,
242
+ disableSubTypeFields: shouldDisableSubTypes,
198
243
  domainNameOptions: catalogObjectNames,
199
244
  onSelectDomainName: setSelectedDomainName,
200
245
  domainFieldOptions: catalogObjectProperties
@@ -3567,4 +3612,4 @@ var UdpTransactionTypesPage_exports = /* @__PURE__ */ __export({ default: () =>
3567
3612
 
3568
3613
  //#endregion
3569
3614
  export { UdpTransactionTypesPage_default as n, UdpTransactionTypesPage_exports as t };
3570
- //# sourceMappingURL=UdpTransactionTypesPage-C-TdPgtF.js.map
3615
+ //# sourceMappingURL=UdpTransactionTypesPage-MdoNtG3E.js.map