@anji-dashing/dam-solution-v2 5.8.173

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.
Files changed (259) hide show
  1. package/README.md +53 -0
  2. package/build/AssetType/AddFieldProperties.d.ts +10 -0
  3. package/build/AssetType/AddFieldProperties.js +359 -0
  4. package/build/AssetType/AssetTemplatesTable.d.ts +10 -0
  5. package/build/AssetType/AssetTemplatesTable.js +172 -0
  6. package/build/AssetType/CreateAssetTemplate.d.ts +3 -0
  7. package/build/AssetType/CreateAssetTemplate.js +70 -0
  8. package/build/AssetType/CreateOrEditAssetTemplate.d.ts +1 -0
  9. package/build/AssetType/CreateOrEditAssetTemplate.js +100 -0
  10. package/build/AssetType/DraggedField.d.ts +14 -0
  11. package/build/AssetType/DraggedField.js +58 -0
  12. package/build/AssetType/EditAssetTemplate.d.ts +5 -0
  13. package/build/AssetType/EditAssetTemplate.js +257 -0
  14. package/build/AssetType/FieldsSection.d.ts +14 -0
  15. package/build/AssetType/FieldsSection.js +268 -0
  16. package/build/AssetType/assetTemplatesContainer.d.ts +2 -0
  17. package/build/AssetType/assetTemplatesContainer.js +71 -0
  18. package/build/AssetType/fieldProperties/DateField.d.ts +5 -0
  19. package/build/AssetType/fieldProperties/DateField.js +23 -0
  20. package/build/AssetType/fieldProperties/NumberField.d.ts +5 -0
  21. package/build/AssetType/fieldProperties/NumberField.js +91 -0
  22. package/build/AssetType/fieldProperties/OptionsField.d.ts +6 -0
  23. package/build/AssetType/fieldProperties/OptionsField.js +55 -0
  24. package/build/AssetType/fieldProperties/TextField.d.ts +5 -0
  25. package/build/AssetType/fieldProperties/TextField.js +92 -0
  26. package/build/AssetType/index.d.ts +11 -0
  27. package/build/AssetType/index.js +25 -0
  28. package/build/AssetType/routes.d.ts +3 -0
  29. package/build/AssetType/routes.js +17 -0
  30. package/build/BookView/ProductDescription.d.ts +4 -0
  31. package/build/BookView/ProductDescription.js +20 -0
  32. package/build/BookView/bookDetail.d.ts +4 -0
  33. package/build/BookView/bookDetail.js +106 -0
  34. package/build/BookView/bookInfo.d.ts +4 -0
  35. package/build/BookView/bookInfo.js +17 -0
  36. package/build/BookView/description.d.ts +4 -0
  37. package/build/BookView/description.js +5 -0
  38. package/build/BookView/index.d.ts +10 -0
  39. package/build/BookView/index.js +23 -0
  40. package/build/CreateClient/CreateClientBtn.d.ts +14 -0
  41. package/build/CreateClient/CreateClientBtn.js +54 -0
  42. package/build/CreateClient/CreateClientForm.d.ts +15 -0
  43. package/build/CreateClient/CreateClientForm.js +347 -0
  44. package/build/CreateClient/index.d.ts +20 -0
  45. package/build/CreateClient/index.js +18 -0
  46. package/build/ImagePicker/MetaFieldOptions.d.ts +14 -0
  47. package/build/ImagePicker/MetaFieldOptions.js +75 -0
  48. package/build/ImagePicker/TestImagePickerModal.d.ts +8 -0
  49. package/build/ImagePicker/TestImagePickerModal.js +72 -0
  50. package/build/ImagePicker/TestImgFromMetaData.d.ts +7 -0
  51. package/build/ImagePicker/TestImgFromMetaData.js +82 -0
  52. package/build/ImagePicker/imagePickerComponent.d.ts +6 -0
  53. package/build/ImagePicker/imagePickerComponent.js +63 -0
  54. package/build/ImagePicker/index.d.ts +13 -0
  55. package/build/ImagePicker/index.js +24 -0
  56. package/build/ImagePicker/routes.d.ts +6 -0
  57. package/build/ImagePicker/routes.js +17 -0
  58. package/build/ImagePickerFilters/ImagePickerFiltersComponent.d.ts +8 -0
  59. package/build/ImagePickerFilters/ImagePickerFiltersComponent.js +223 -0
  60. package/build/ImagePickerFilters/index.d.ts +12 -0
  61. package/build/ImagePickerFilters/index.js +19 -0
  62. package/build/MyDrive/ActionBar.d.ts +8 -0
  63. package/build/MyDrive/ActionBar.js +190 -0
  64. package/build/MyDrive/AddDrive.d.ts +5 -0
  65. package/build/MyDrive/AddDrive.js +189 -0
  66. package/build/MyDrive/AddFolder.d.ts +11 -0
  67. package/build/MyDrive/AddFolder.js +165 -0
  68. package/build/MyDrive/BreadCrumbList.d.ts +10 -0
  69. package/build/MyDrive/BreadCrumbList.js +81 -0
  70. package/build/MyDrive/BulkUploadModal.d.ts +2 -0
  71. package/build/MyDrive/BulkUploadModal.js +324 -0
  72. package/build/MyDrive/DriveContainer.d.ts +14 -0
  73. package/build/MyDrive/DriveContainer.js +343 -0
  74. package/build/MyDrive/FileDownloadHistory.d.ts +7 -0
  75. package/build/MyDrive/FileDownloadHistory.js +107 -0
  76. package/build/MyDrive/FileMenuOptions.d.ts +11 -0
  77. package/build/MyDrive/FileMenuOptions.js +450 -0
  78. package/build/MyDrive/FilesGridView.d.ts +9 -0
  79. package/build/MyDrive/FilesGridView.js +25 -0
  80. package/build/MyDrive/FolderGridView.d.ts +20 -0
  81. package/build/MyDrive/FolderGridView.js +95 -0
  82. package/build/MyDrive/FolderListView.d.ts +26 -0
  83. package/build/MyDrive/FolderListView.js +226 -0
  84. package/build/MyDrive/FolderMenuOptions.d.ts +5 -0
  85. package/build/MyDrive/FolderMenuOptions.js +350 -0
  86. package/build/MyDrive/FolderTree.d.ts +8 -0
  87. package/build/MyDrive/FolderTree.js +479 -0
  88. package/build/MyDrive/ImageEditor/EditImage.d.ts +6 -0
  89. package/build/MyDrive/ImageEditor/EditImage.js +97 -0
  90. package/build/MyDrive/ImageEditor/EditImageModal.d.ts +8 -0
  91. package/build/MyDrive/ImageEditor/EditImageModal.js +30 -0
  92. package/build/MyDrive/ImageEditor/TuiImageEditor.d.ts +10 -0
  93. package/build/MyDrive/ImageEditor/TuiImageEditor.js +99 -0
  94. package/build/MyDrive/ImagePickerBreadCrumbList.d.ts +8 -0
  95. package/build/MyDrive/ImagePickerBreadCrumbList.js +35 -0
  96. package/build/MyDrive/ImagePickerDrive.d.ts +1 -0
  97. package/build/MyDrive/ImagePickerDrive.js +41 -0
  98. package/build/MyDrive/MyDriveMainContainer.d.ts +6 -0
  99. package/build/MyDrive/MyDriveMainContainer.js +63 -0
  100. package/build/MyDrive/SearchFilter.d.ts +8 -0
  101. package/build/MyDrive/SearchFilter.js +73 -0
  102. package/build/MyDrive/ShareBtn.d.ts +5 -0
  103. package/build/MyDrive/ShareBtn.js +19 -0
  104. package/build/MyDrive/ToggleView.d.ts +4 -0
  105. package/build/MyDrive/ToggleView.js +12 -0
  106. package/build/MyDrive/UploadStatusModal.d.ts +12 -0
  107. package/build/MyDrive/UploadStatusModal.js +52 -0
  108. package/build/MyDrive/fileDetails/CommentEntity.d.ts +8 -0
  109. package/build/MyDrive/fileDetails/CommentEntity.js +102 -0
  110. package/build/MyDrive/fileDetails/Comments.d.ts +6 -0
  111. package/build/MyDrive/fileDetails/Comments.js +65 -0
  112. package/build/MyDrive/fileDetails/Compliance.d.ts +2 -0
  113. package/build/MyDrive/fileDetails/Compliance.js +18 -0
  114. package/build/MyDrive/fileDetails/CreateComment.d.ts +7 -0
  115. package/build/MyDrive/fileDetails/CreateComment.js +48 -0
  116. package/build/MyDrive/fileDetails/Editor.d.ts +6 -0
  117. package/build/MyDrive/fileDetails/Editor.js +55 -0
  118. package/build/MyDrive/fileDetails/EmojiPicker.d.ts +5 -0
  119. package/build/MyDrive/fileDetails/EmojiPicker.js +6 -0
  120. package/build/MyDrive/fileDetails/FileDetails.d.ts +11 -0
  121. package/build/MyDrive/fileDetails/FileDetails.js +125 -0
  122. package/build/MyDrive/fileDetails/FileHeader.d.ts +7 -0
  123. package/build/MyDrive/fileDetails/FileHeader.js +27 -0
  124. package/build/MyDrive/fileDetails/FileViewer.d.ts +10 -0
  125. package/build/MyDrive/fileDetails/FileViewer.js +17 -0
  126. package/build/MyDrive/fileDetails/ImageOptions.d.ts +2 -0
  127. package/build/MyDrive/fileDetails/ImageOptions.js +44 -0
  128. package/build/MyDrive/fileDetails/ImageViewer.d.ts +6 -0
  129. package/build/MyDrive/fileDetails/ImageViewer.js +16 -0
  130. package/build/MyDrive/fileDetails/ManageFile.d.ts +7 -0
  131. package/build/MyDrive/fileDetails/ManageFile.js +34 -0
  132. package/build/MyDrive/fileDetails/MetaForm.d.ts +15 -0
  133. package/build/MyDrive/fileDetails/MetaForm.js +199 -0
  134. package/build/MyDrive/fileDetails/Metadata.d.ts +8 -0
  135. package/build/MyDrive/fileDetails/Metadata.js +52 -0
  136. package/build/MyDrive/fileDetails/PdfOptions.d.ts +9 -0
  137. package/build/MyDrive/fileDetails/PdfOptions.js +35 -0
  138. package/build/MyDrive/fileDetails/PdfViewer.d.ts +8 -0
  139. package/build/MyDrive/fileDetails/PdfViewer.js +18 -0
  140. package/build/MyDrive/fileDetails/Previewdetails.d.ts +10 -0
  141. package/build/MyDrive/fileDetails/Previewdetails.js +53 -0
  142. package/build/MyDrive/fileDetails/VideoPlayer.d.ts +4 -0
  143. package/build/MyDrive/fileDetails/VideoPlayer.js +21 -0
  144. package/build/MyDrive/files/AssetSelectionFormItem.d.ts +7 -0
  145. package/build/MyDrive/files/AssetSelectionFormItem.js +14 -0
  146. package/build/MyDrive/files/FolderTabs.d.ts +6 -0
  147. package/build/MyDrive/files/FolderTabs.js +90 -0
  148. package/build/MyDrive/files/MapFile.d.ts +9 -0
  149. package/build/MyDrive/files/MapFile.js +239 -0
  150. package/build/MyDrive/files/MoveToAnotherFolder.d.ts +9 -0
  151. package/build/MyDrive/files/MoveToAnotherFolder.js +67 -0
  152. package/build/MyDrive/filesListView.d.ts +2 -0
  153. package/build/MyDrive/filesListView.js +57 -0
  154. package/build/MyDrive/index.d.ts +16 -0
  155. package/build/MyDrive/index.js +50 -0
  156. package/build/MyDrive/routes.d.ts +10 -0
  157. package/build/MyDrive/routes.js +12 -0
  158. package/build/PenView/PenDetails.d.ts +4 -0
  159. package/build/PenView/PenDetails.js +114 -0
  160. package/build/PenView/ProductDescription.d.ts +5 -0
  161. package/build/PenView/ProductDescription.js +51 -0
  162. package/build/PenView/index.d.ts +10 -0
  163. package/build/PenView/index.js +23 -0
  164. package/build/RefreshKey/RefreshKeyBtn.d.ts +1 -0
  165. package/build/RefreshKey/RefreshKeyBtn.js +42 -0
  166. package/build/RefreshKey/index.d.ts +9 -0
  167. package/build/RefreshKey/index.js +23 -0
  168. package/build/ShoesView/ProductDescription.d.ts +4 -0
  169. package/build/ShoesView/ProductDescription.js +25 -0
  170. package/build/ShoesView/ShoeDetails.d.ts +4 -0
  171. package/build/ShoesView/ShoeDetails.js +96 -0
  172. package/build/ShoesView/index.d.ts +10 -0
  173. package/build/ShoesView/index.js +23 -0
  174. package/build/common/Button.d.ts +2 -0
  175. package/build/common/Button.js +18 -0
  176. package/build/common/CustomElements.d.ts +98 -0
  177. package/build/common/CustomElements.js +77 -0
  178. package/build/common/LoadMoreItems.d.ts +7 -0
  179. package/build/common/LoadMoreItems.js +33 -0
  180. package/build/common/RenderFormItem.d.ts +42 -0
  181. package/build/common/RenderFormItem.js +98 -0
  182. package/build/common/RenderThumnail.d.ts +7 -0
  183. package/build/common/RenderThumnail.js +6 -0
  184. package/build/common/deleteModal.d.ts +1 -0
  185. package/build/common/deleteModal.js +12 -0
  186. package/build/common/folders/TypeAndDateFilters.d.ts +13 -0
  187. package/build/common/folders/TypeAndDateFilters.js +66 -0
  188. package/build/common/folders/getFolderOrFileIcon.d.ts +2 -0
  189. package/build/common/folders/getFolderOrFileIcon.js +41 -0
  190. package/build/common/loader/CustomLoader.d.ts +7 -0
  191. package/build/common/loader/CustomLoader.js +8 -0
  192. package/build/common/loader/loader.d.ts +1 -0
  193. package/build/common/loader/loader.js +6 -0
  194. package/build/common/notifications.d.ts +2 -0
  195. package/build/common/notifications.js +30 -0
  196. package/build/common/steps.d.ts +4 -0
  197. package/build/common/steps.js +7 -0
  198. package/build/hocs/AppProvider.d.ts +3 -0
  199. package/build/hocs/AppProvider.js +11 -0
  200. package/build/hocs/DamConfigContext.d.ts +2 -0
  201. package/build/hocs/DamConfigContext.js +153 -0
  202. package/build/hocs/ThemeContext.d.ts +15 -0
  203. package/build/hocs/ThemeContext.js +131 -0
  204. package/build/hocs/ToastProvider.d.ts +2 -0
  205. package/build/hocs/ToastProvider.js +6 -0
  206. package/build/hocs/appConstants.d.ts +124 -0
  207. package/build/hocs/appConstants.js +211 -0
  208. package/build/hocs/configureAxios.d.ts +2 -0
  209. package/build/hocs/configureAxios.js +65 -0
  210. package/build/hocs/helpers.d.ts +17 -0
  211. package/build/hocs/helpers.js +201 -0
  212. package/build/index.d.ts +12 -0
  213. package/build/index.js +12 -0
  214. package/build/react-query/hooks/brand-hooks.d.ts +3 -0
  215. package/build/react-query/hooks/brand-hooks.js +10 -0
  216. package/build/react-query/hooks/folder-hooks.d.ts +7 -0
  217. package/build/react-query/hooks/folder-hooks.js +119 -0
  218. package/build/react-query/services/brand-services.d.ts +4 -0
  219. package/build/react-query/services/brand-services.js +41 -0
  220. package/build/react-query/services/file-services.d.ts +43 -0
  221. package/build/react-query/services/file-services.js +69 -0
  222. package/build/react-query/services/folder-services.d.ts +46 -0
  223. package/build/react-query/services/folder-services.js +87 -0
  224. package/build/react-query/services/image-picker-services.d.ts +5 -0
  225. package/build/react-query/services/image-picker-services.js +47 -0
  226. package/build/settings/InviteTeamModal.d.ts +12 -0
  227. package/build/settings/InviteTeamModal.js +174 -0
  228. package/build/settings/UpdateInvitationAccessType.d.ts +9 -0
  229. package/build/settings/UpdateInvitationAccessType.js +96 -0
  230. package/build/settings/getUserAvatar.d.ts +7 -0
  231. package/build/settings/getUserAvatar.js +11 -0
  232. package/build/style.css +1 -0
  233. package/build/types/assetType.d.ts +8 -0
  234. package/build/types/assetType.js +1 -0
  235. package/build/ui/pageTitle.d.ts +3 -0
  236. package/build/ui/pageTitle.js +4 -0
  237. package/build/utilities/FoldersContext.d.ts +16 -0
  238. package/build/utilities/FoldersContext.js +15 -0
  239. package/build/utilities/NavigatorProvider.d.ts +2 -0
  240. package/build/utilities/NavigatorProvider.js +10 -0
  241. package/build/utilities/constants/apiUrls.d.ts +97 -0
  242. package/build/utilities/constants/apiUrls.js +117 -0
  243. package/build/utilities/constants/imageUrls.d.ts +6 -0
  244. package/build/utilities/constants/imageUrls.js +6 -0
  245. package/build/utilities/constants/interface.d.ts +371 -0
  246. package/build/utilities/constants/interface.js +142 -0
  247. package/build/utilities/constants/messages.d.ts +55 -0
  248. package/build/utilities/constants/messages.js +55 -0
  249. package/build/utilities/constants/queryKeys.d.ts +16 -0
  250. package/build/utilities/constants/queryKeys.js +33 -0
  251. package/build/utilities/constants/routes.d.ts +22 -0
  252. package/build/utilities/constants/routes.js +22 -0
  253. package/build/utilities/helpers/validators.d.ts +12 -0
  254. package/build/utilities/helpers/validators.js +89 -0
  255. package/build/utilities/useAppNavigate.d.ts +2 -0
  256. package/build/utilities/useAppNavigate.js +35 -0
  257. package/build/utilities/useAppParams.d.ts +8 -0
  258. package/build/utilities/useAppParams.js +72 -0
  259. package/package.json +93 -0
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # @bindu-dashing/dam-solution-v2
2
+
3
+ ---
4
+
5
+ ## Installation
6
+
7
+ To install the library in your project:
8
+
9
+ ```bash
10
+ npm install @bindu-dashing/dam-solution-v2
11
+ # or
12
+ yarn add @bindu-dashing/dam-solution-v2
13
+
14
+ ```
15
+
16
+ ## Local Testing
17
+
18
+ To test the library in local before publishing it to npm:
19
+
20
+ In Library
21
+
22
+ ```bash
23
+ npm run build
24
+ npm link
25
+ ```
26
+
27
+ In test project:
28
+
29
+ ```bash
30
+ npm link @bindu-dashing/dam-solution-v2
31
+ ```
32
+
33
+ ## Publishing
34
+
35
+ To publish the library to npm:
36
+
37
+ 1. Update the version in package.json
38
+ 2. Next Steps
39
+
40
+ ```bash
41
+ npm run build
42
+ npm publish --access public
43
+
44
+ ```
45
+
46
+ ## Login
47
+
48
+ To login to npm account:
49
+ Before publishing, login to npm account if not already loggedin
50
+
51
+ ```bash
52
+ npm login
53
+ ```
@@ -0,0 +1,10 @@
1
+ import { InputTypeEntity } from "../utilities/constants/interface";
2
+ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpdateField, currentInputType, index, allFields, onCancel, }: {
3
+ field: InputTypeEntity | undefined;
4
+ setCurrentFieldIndex: (value: number | null) => void;
5
+ onUpdateField: (updatedValues: any, field: InputTypeEntity, index: number | null) => void;
6
+ currentInputType: InputTypeEntity | undefined;
7
+ index: number | null;
8
+ allFields: InputTypeEntity[];
9
+ onCancel?: (index: number | null) => void;
10
+ }): JSX.Element;
@@ -0,0 +1,359 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { Button, Checkbox, Form, Input } from "antd";
12
+ import TextField from "./fieldProperties/TextField";
13
+ import NumberField from "./fieldProperties/NumberField";
14
+ import { useEffect, useState } from "react";
15
+ import DateField from "./fieldProperties/DateField";
16
+ import OptionsField from "./fieldProperties/OptionsField";
17
+ import { InputSupportedTypes, InputTypes, NotificationStatus, } from "../utilities/constants/interface";
18
+ import { first, get, includes, isArray, nth } from "lodash";
19
+ import { useDamConfig } from "../hocs/DamConfigContext";
20
+ import useAppNavigate from "../utilities/useAppNavigate";
21
+ import { getFormItem } from "../MyDrive/fileDetails/MetaForm";
22
+ import dayjs from "dayjs";
23
+ import { DATE_FORMAT, DATE_WITH_TIME_FORMAT } from "../hocs/appConstants";
24
+ import { showNotification } from "../common/notifications";
25
+ import { UPDATE_SUCCESS } from "../utilities/constants/messages";
26
+ export default function AddFieldProperties({ field, setCurrentFieldIndex, onUpdateField, currentInputType, index, allFields, onCancel, }) {
27
+ const { styles } = useDamConfig();
28
+ const navigate = useAppNavigate();
29
+ const [defaultValueInput, setDefaultValueInput] = useState("");
30
+ const [loading, setLoading] = useState(false);
31
+ const [form] = Form.useForm();
32
+ const formValues = Form.useWatch([], form);
33
+ const [isFormValid, setIsFormValid] = useState(false);
34
+ const [disabledReason, setDisabledReason] = useState(null);
35
+ useEffect(() => {
36
+ const checkFormValidity = () => __awaiter(this, void 0, void 0, function* () {
37
+ var _a;
38
+ try {
39
+ // Only check errors for main fields (name, placeholder, defaultValue)
40
+ const mainFieldNames = ["name", "placeholder", "defaultValue"];
41
+ const errors = form.getFieldsError(mainFieldNames);
42
+ const hasMainFieldErrors = errors.some((error) => { var _a; return ((_a = error.errors) === null || _a === void 0 ? void 0 : _a.length) > 0; });
43
+ // Get current form values
44
+ const values = form.getFieldsValue();
45
+ const nameFilled = !!(values.name && typeof values.name === 'string' && values.name.trim() !== '');
46
+ const placeholderFilled = !!(values.placeholder && typeof values.placeholder === 'string' && values.placeholder.trim() !== '');
47
+ const valid = nameFilled && placeholderFilled && !hasMainFieldErrors;
48
+ setIsFormValid(valid);
49
+ // Set reason for disabled state so user knows why
50
+ if (!valid) {
51
+ if (!nameFilled) {
52
+ setDisabledReason("Name is required");
53
+ }
54
+ else if (!placeholderFilled) {
55
+ setDisabledReason("Placeholder is required");
56
+ }
57
+ else if (hasMainFieldErrors) {
58
+ const firstError = errors.find((e) => { var _a; return ((_a = e.errors) === null || _a === void 0 ? void 0 : _a.length) > 0; });
59
+ const errorMsg = (_a = firstError === null || firstError === void 0 ? void 0 : firstError.errors) === null || _a === void 0 ? void 0 : _a[0];
60
+ setDisabledReason(errorMsg ? `Fix error: ${errorMsg}` : "Please fix the form errors above");
61
+ }
62
+ else {
63
+ setDisabledReason(null);
64
+ }
65
+ }
66
+ else {
67
+ setDisabledReason(null);
68
+ }
69
+ }
70
+ catch (error) {
71
+ setIsFormValid(false);
72
+ setDisabledReason("Unable to validate form");
73
+ }
74
+ });
75
+ checkFormValidity();
76
+ }, [formValues, form]);
77
+ const onUpdate = (values) => __awaiter(this, void 0, void 0, function* () {
78
+ try {
79
+ setLoading(true);
80
+ const allValues = Object.assign({}, values);
81
+ // Format defaultValue if it exists (including empty string/null/undefined)
82
+ if (allValues.hasOwnProperty("defaultValue")) {
83
+ const formattedValue = getFormattedDefaultValue(allValues);
84
+ // Set to undefined if empty/null, otherwise use formatted value
85
+ allValues["defaultValue"] = formattedValue === null || formattedValue === "" ? undefined : formattedValue;
86
+ }
87
+ if (get(field, "_id", null)) {
88
+ allValues["_id"] = get(field, "_id");
89
+ }
90
+ // Small delay to show loading state
91
+ yield new Promise((resolve) => setTimeout(resolve, 300));
92
+ onUpdateField(allValues, currentInputType, index);
93
+ setCurrentFieldIndex(null);
94
+ showNotification(UPDATE_SUCCESS, NotificationStatus.SUCCESS);
95
+ }
96
+ catch (error) {
97
+ // Handle error if needed
98
+ }
99
+ finally {
100
+ setLoading(false);
101
+ }
102
+ });
103
+ const getFormattedDefaultValue = (values) => {
104
+ const defaultName = get(field, "defaultName");
105
+ const defaultValue = get(values, "defaultValue");
106
+ // console.log("default", defaultValue);
107
+ const allowTime = get(values, `inputTypeSettings.${InputSupportedTypes.ALLOW_TIME}.allow`, false);
108
+ const allowMultiple = get(values, `inputTypeSettings.${InputSupportedTypes.ALLOW_MULTIPLE}`, false);
109
+ switch (defaultName) {
110
+ case InputTypes.DATE_RANGE:
111
+ case InputTypes.DATE:
112
+ const format = allowTime ? DATE_WITH_TIME_FORMAT : DATE_FORMAT;
113
+ if (isArray(defaultValue) && get(defaultValue, "length") === 2) {
114
+ return [
115
+ first(defaultValue)
116
+ ? dayjs(first(defaultValue)).format(format)
117
+ : null,
118
+ nth(defaultValue, 1)
119
+ ? dayjs(nth(defaultValue, 1)).format(format)
120
+ : null,
121
+ ];
122
+ }
123
+ return defaultValue ? dayjs(defaultValue).format(format) : null;
124
+ case InputTypes.CHECKBOX:
125
+ return defaultValue || [];
126
+ case InputTypes.SELECT:
127
+ return allowMultiple ? defaultValue || [] : defaultValue || undefined;
128
+ case InputTypes.NUMBERS:
129
+ // Ensure defaultValue is a valid number, convert string to number if needed
130
+ if (defaultValue === null || defaultValue === undefined || defaultValue === "") {
131
+ return undefined;
132
+ }
133
+ if (typeof defaultValue === "number" && !isNaN(defaultValue) && isFinite(defaultValue)) {
134
+ return defaultValue;
135
+ }
136
+ if (typeof defaultValue === "string") {
137
+ const parsed = Number(defaultValue);
138
+ const trimmedValue = defaultValue.trim();
139
+ if (!isNaN(parsed) && isFinite(parsed) && trimmedValue !== "") {
140
+ return parsed;
141
+ }
142
+ }
143
+ // If value is not a valid number, return undefined
144
+ return undefined;
145
+ default:
146
+ return defaultValue;
147
+ }
148
+ };
149
+ const getInitialDefaultValue = (inputTypeSettings) => {
150
+ const defaultName = currentInputType === null || currentInputType === void 0 ? void 0 : currentInputType.defaultName;
151
+ const allowMultiple = get(inputTypeSettings, `${InputSupportedTypes.ALLOW_MULTIPLE}`, false);
152
+ const value = get(field, "defaultValue", "");
153
+ switch (defaultName) {
154
+ case InputTypes.DATE:
155
+ return value ? dayjs(value) : undefined;
156
+ case InputTypes.DATE_RANGE:
157
+ return isArray(value) && get(value, "length") === 2
158
+ ? [dayjs(first(value)), dayjs(nth(value, 1))]
159
+ : undefined;
160
+ case InputTypes.SELECT:
161
+ return allowMultiple ? value || [] : value !== null && value !== void 0 ? value : undefined;
162
+ case InputTypes.CHECKBOX:
163
+ return value || [];
164
+ case InputTypes.NUMBERS:
165
+ // Convert string to number if valid, otherwise return undefined
166
+ if (value === null || value === undefined || value === "") {
167
+ return undefined;
168
+ }
169
+ const valueType = typeof value;
170
+ if (valueType === "number" && !isNaN(value) && isFinite(value)) {
171
+ return value;
172
+ }
173
+ if (valueType === "string") {
174
+ const stringVal = value;
175
+ const parsed = Number(stringVal);
176
+ const trimmedValue = stringVal.trim();
177
+ if (!isNaN(parsed) && isFinite(parsed) && trimmedValue !== "") {
178
+ return parsed;
179
+ }
180
+ }
181
+ // If value is not a valid number, return undefined
182
+ return undefined;
183
+ default:
184
+ return value;
185
+ }
186
+ };
187
+ useEffect(() => {
188
+ form.setFieldsValue(Object.assign(Object.assign({}, field), { defaultValue: getInitialDefaultValue(get(field, "inputTypeSettings", {})) }));
189
+ handleFormValuesChange();
190
+ // Check initial form validity after setting field values
191
+ setTimeout(() => {
192
+ var _a;
193
+ const mainFieldNames = ["name", "placeholder", "defaultValue"];
194
+ const errors = form.getFieldsError(mainFieldNames);
195
+ const hasMainFieldErrors = errors.some((error) => error.errors && error.errors.length > 0);
196
+ const values = form.getFieldsValue();
197
+ const nameFilled = !!(values.name && typeof values.name === 'string' && values.name.trim() !== '');
198
+ const placeholderFilled = !!(values.placeholder && typeof values.placeholder === 'string' && values.placeholder.trim() !== '');
199
+ const valid = nameFilled && placeholderFilled && !hasMainFieldErrors;
200
+ setIsFormValid(valid);
201
+ if (!valid) {
202
+ if (!nameFilled)
203
+ setDisabledReason("Name is required");
204
+ else if (!placeholderFilled)
205
+ setDisabledReason("Placeholder is required");
206
+ else if (hasMainFieldErrors) {
207
+ const firstError = errors.find((e) => { var _a; return ((_a = e.errors) === null || _a === void 0 ? void 0 : _a.length) > 0; });
208
+ setDisabledReason(((_a = firstError === null || firstError === void 0 ? void 0 : firstError.errors) === null || _a === void 0 ? void 0 : _a[0]) ? `Fix error: ${firstError.errors[0]}` : "Please fix the form errors above");
209
+ }
210
+ else
211
+ setDisabledReason(null);
212
+ }
213
+ else
214
+ setDisabledReason(null);
215
+ }, 100);
216
+ }, [field, form]);
217
+ // Update defaultValueInput whenever form values change
218
+ const handleFormValuesChange = () => {
219
+ var _a;
220
+ const formValues = form.getFieldsValue(true);
221
+ const defaultName = currentInputType === null || currentInputType === void 0 ? void 0 : currentInputType.defaultName;
222
+ const options = ((_a = formValues.options) === null || _a === void 0 ? void 0 : _a.filter((opt) => (opt === null || opt === void 0 ? void 0 : opt.label) && (opt === null || opt === void 0 ? void 0 : opt.value))) || [];
223
+ const settings = formValues.inputTypeSettings || {};
224
+ const isOptionsBasedField = includes([InputTypes.SELECT, InputTypes.CHECKBOX, InputTypes.RADIO], defaultName);
225
+ if (isOptionsBasedField && options.length === 0) {
226
+ // Don't show Default Value field if no options exist
227
+ setDefaultValueInput(null);
228
+ return;
229
+ }
230
+ // Use a specific placeholder for default value input, or fallback to field placeholder
231
+ const defaultValuePlaceholder = "Enter default value";
232
+ const item = {
233
+ _id: "defaultValue",
234
+ name: "Default Value",
235
+ defaultName,
236
+ options,
237
+ inputTypeSettings: settings,
238
+ placeholder: defaultValuePlaceholder,
239
+ };
240
+ // Add rule: defaultValue must be one of the options when defaultName is SELECT
241
+ let rules = [];
242
+ if ((defaultName === InputTypes.SELECT ||
243
+ defaultName === InputTypes.CHECKBOX ||
244
+ defaultName === InputTypes.RADIO) &&
245
+ options.length > 0) {
246
+ rules.push({
247
+ validator: (_, value) => {
248
+ const allowedValues = options
249
+ .filter((opt) => opt)
250
+ .map((opt) => opt.value);
251
+ if (value === undefined ||
252
+ (Array.isArray(value)
253
+ ? value.every((v) => allowedValues.includes(v))
254
+ : allowedValues.includes(value))) {
255
+ return Promise.resolve();
256
+ }
257
+ return Promise.reject("Default value must be one of the options");
258
+ },
259
+ });
260
+ }
261
+ // Rule for NUMBERS: reject strings - only accept number type
262
+ if (defaultName === InputTypes.NUMBERS) {
263
+ rules.push({
264
+ validator: (_, value) => {
265
+ if (value === undefined || value === null || value === "") {
266
+ return Promise.resolve();
267
+ }
268
+ // Only accept actual number type - reject all strings
269
+ if (typeof value !== "number") {
270
+ return Promise.reject("Default value must be a number, not text");
271
+ }
272
+ if (isNaN(value) || !isFinite(value)) {
273
+ return Promise.reject("Default value must be a valid number");
274
+ }
275
+ return Promise.resolve();
276
+ },
277
+ });
278
+ }
279
+ // Rule for DATE and DATE_RANGE: check time part if allow time is selected
280
+ if ((defaultName === InputTypes.DATE ||
281
+ defaultName === InputTypes.DATE_RANGE) &&
282
+ settings[InputSupportedTypes.ALLOW_TIME] !== undefined) {
283
+ rules.push({
284
+ validator: (_, value) => {
285
+ const allowTime = !!get(settings, `${InputSupportedTypes.ALLOW_TIME}.allow`);
286
+ if (!value)
287
+ return Promise.resolve();
288
+ // For DATE
289
+ if (defaultName === InputTypes.DATE) {
290
+ const hasTimeMethods = value &&
291
+ typeof value.hour === "function" &&
292
+ typeof value.minute === "function" &&
293
+ typeof value.second === "function";
294
+ if (allowTime && !hasTimeMethods) {
295
+ return Promise.reject("Please select a date with time (hour/minute/second).");
296
+ }
297
+ if (!allowTime && hasTimeMethods) {
298
+ return Promise.reject("Time is not allowed. Please select only a date.");
299
+ }
300
+ }
301
+ // For DATE_RANGE
302
+ if (defaultName === InputTypes.DATE_RANGE && Array.isArray(value)) {
303
+ const [start, end] = value;
304
+ const startHasTimeMethods = start &&
305
+ typeof start.hour === "function" &&
306
+ typeof start.minute === "function" &&
307
+ typeof start.second === "function";
308
+ const endHasTimeMethods = end &&
309
+ typeof end.hour === "function" &&
310
+ typeof end.minute === "function" &&
311
+ typeof end.second === "function";
312
+ if (allowTime && (!startHasTimeMethods || !endHasTimeMethods)) {
313
+ return Promise.reject("Please select both start and end dates with time.");
314
+ }
315
+ if (!allowTime && (startHasTimeMethods || endHasTimeMethods)) {
316
+ return Promise.reject("Time is not allowed. Please select only dates.");
317
+ }
318
+ }
319
+ return Promise.resolve();
320
+ },
321
+ });
322
+ }
323
+ // Pass rules to getFormItem
324
+ const defaultValueItem = getFormItem(Object.assign(Object.assign({}, item), { additionalRules: rules }), true);
325
+ setDefaultValueInput(defaultValueItem);
326
+ };
327
+ return (_jsxs("div", { className: "md-lib-p-4", children: [_jsxs("div", { className: "md-lib-flex md-lib-items-center md-lib-gap-2", children: [_jsx("h2", { className: "md-lib-text-xl md-lib-font-semibold", children: "Properties" }), _jsxs("p", { className: "md-lib-ml-auto md-lib-text-sm md-lib-truncate", style: { color: styles === null || styles === void 0 ? void 0 : styles.secondaryTextColor }, children: ["Type: ", get(field, "name", "N/A")] })] }), _jsx("div", { className: "md-lib-mt-4 md-lib-relative", children: _jsxs(Form, { layout: "vertical", form: form, requiredMark: true, scrollToFirstError: true, onFinish: onUpdate, initialValues: field, onValuesChange: handleFormValuesChange, className: "md-lib-pb-20", children: [_jsx(Form.Item, { name: "isMandatory", valuePropName: "checked", children: _jsx(Checkbox, { children: "Marks as mandatory field" }) }), _jsx(Form.Item, { name: "name", label: "Name", rules: [
328
+ { required: true, message: "Name is required" },
329
+ {
330
+ validator: (_, value) => {
331
+ if (!value ||
332
+ !allFields.some((f, i) => f.name === value && i !== index)) {
333
+ return Promise.resolve();
334
+ }
335
+ return Promise.reject("Name must be unique");
336
+ },
337
+ },
338
+ ], children: _jsx(Input, { placeholder: "Enter name", className: "md-lib-h-12", maxLength: 255, showCount: true }) }), _jsx(Form.Item, { label: "Placeholder", name: "placeholder", rules: [
339
+ {
340
+ required: true,
341
+ message: "Placeholder is required",
342
+ },
343
+ ], children: _jsx(Input, { placeholder: "Enter Field Placeholder", className: "md-lib-h-12", maxLength: 255, showCount: true }) }), defaultValueInput && defaultValueInput, _jsxs("div", { children: [!!get(currentInputType, "supportedTypes.length") && (_jsx("h3", { className: "md-lib-text-md md-lib-font-semibold md-lib-mb-2", children: "Field Validations" })), _jsxs(Form.Item, { name: "field_validations", children: [includes([InputTypes.PARAGRAPH, InputTypes.TEXT, InputTypes.LINK], get(currentInputType, "defaultName")) && (_jsx(TextField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), get(currentInputType, "defaultName") == InputTypes.NUMBERS && (_jsx(NumberField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), (get(currentInputType, "defaultName") == InputTypes.DATE ||
344
+ get(currentInputType, "defaultName") ==
345
+ InputTypes.DATE_RANGE) && (_jsx(DateField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []) })), includes([
346
+ InputTypes.SELECT,
347
+ InputTypes.PERSON,
348
+ InputTypes.TEAM,
349
+ InputTypes.CHECKBOX,
350
+ InputTypes.RADIO,
351
+ ], get(currentInputType, "defaultName")) && (_jsx(OptionsField, { field: field, supportedTypes: get(currentInputType, "supportedTypes", []), currentInputType: currentInputType }))] })] }), _jsxs(Form.Item, { className: "md-lib-flex md-lib-flex-col md-lib-items-end md-lib-absolute md-lib-bottom-0 md-lib-right-0 md-lib-pr-4 md-lib-pb-4", children: [disabledReason && (_jsxs("p", { className: "md-lib-text-sm md-lib-mb-2 md-lib-mr-2", style: { color: styles === null || styles === void 0 ? void 0 : styles.secondaryTextColor }, children: ["Update disabled: ", disabledReason] })), _jsxs("div", { className: "md-lib-flex md-lib-items-center", children: [_jsx(Button, { color: "primary", variant: "text", onClick: () => {
352
+ if (onCancel && index !== null) {
353
+ onCancel(index);
354
+ }
355
+ else {
356
+ setCurrentFieldIndex(null);
357
+ }
358
+ }, size: "large", children: "Cancel" }), _jsx(Button, { color: "primary", htmlType: "submit", className: "md-lib-ml-2 md-lib-border-primaryColor md-lib-text-primaryColor", size: "large", loading: loading, disabled: !isFormValid || loading, title: disabledReason || undefined, children: "Update" })] })] })] }) })] }));
359
+ }
@@ -0,0 +1,10 @@
1
+ import { AssetTemplateEntity } from "../utilities/constants/interface";
2
+ declare function AssetTemplatesTable({ assetTemplates, totalPages, totalCount, filters, onFetchAssetTemplates, loading, }: {
3
+ assetTemplates: AssetTemplateEntity[];
4
+ totalPages: number;
5
+ totalCount: number;
6
+ filters: any;
7
+ onFetchAssetTemplates: (params: any) => void;
8
+ loading: boolean;
9
+ }): JSX.Element;
10
+ export default AssetTemplatesTable;
@@ -0,0 +1,172 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ import { Space, Table, Tooltip, Switch } from "antd";
12
+ import { useMemo, useState } from "react";
13
+ import { get } from "lodash";
14
+ import { APP_DATE_TIME_FORMAT, DEFAULT_PAGE, LOCAL_TIMEZONE, } from "../hocs/appConstants";
15
+ import { NotificationStatus, SortOrders, } from "../utilities/constants/interface";
16
+ import CustomLoader from "../common/loader/CustomLoader";
17
+ import { EditOutlined, DeleteOutlined } from "@ant-design/icons";
18
+ import CustomButton from "../common/Button";
19
+ import { ASSET_TEMPLATE_SCREEN } from "../utilities/constants/routes";
20
+ import moment from "moment-timezone";
21
+ import { DeleteConfirmationModal, RenderTableSearchFilters, RenderTableSelectFilters, } from "../common/CustomElements";
22
+ import { DEACTIVATE_OK_TEXT, DELETE_CONFIRMATION_MESSAGE, DELETE_OK_TEXT, DELETE_SUCCESS, SOMETHING_WENT_WRONG, UPDATE_SUCCESS, } from "../utilities/constants/messages";
23
+ import { showNotification } from "../common/notifications";
24
+ import { FETCH_ASSET_URL } from "../utilities/constants/apiUrls";
25
+ import { useDamConfig } from "../hocs/DamConfigContext";
26
+ import { createApiClient } from "../hocs/configureAxios";
27
+ import useAppNavigate from "../utilities/useAppNavigate";
28
+ function AssetTemplatesTable({ assetTemplates, totalPages, totalCount, filters = {}, onFetchAssetTemplates, loading, }) {
29
+ const [state, setState] = useState({
30
+ showConfirmPopup: false,
31
+ selectedAsset: {},
32
+ actionLoading: false,
33
+ updateAssetId: "",
34
+ });
35
+ const navigate = useAppNavigate();
36
+ const damConfig = useDamConfig();
37
+ const api = useMemo(() => createApiClient(damConfig), [damConfig]);
38
+ const { showConfirmPopup, selectedAsset, actionLoading, updateAssetId } = state;
39
+ const toggleDeletConfirm = (asset = {}, updateAssetId = "") => {
40
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { selectedAsset: asset, showConfirmPopup: !prevState.showConfirmPopup, actionLoading: false, updateAssetId: updateAssetId })));
41
+ };
42
+ const onDeleteTemplate = () => __awaiter(this, void 0, void 0, function* () {
43
+ const assetId = get(selectedAsset, "_id");
44
+ if (!assetId) {
45
+ showNotification("Unable to delete: Asset ID is missing", NotificationStatus.ERROR);
46
+ toggleDeletConfirm();
47
+ return;
48
+ }
49
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { actionLoading: true })));
50
+ try {
51
+ const response = yield api.delete(FETCH_ASSET_URL.replace(":assetId", assetId));
52
+ onFetchAssetTemplates(Object.assign(Object.assign({}, filters), { page: DEFAULT_PAGE }));
53
+ toggleDeletConfirm();
54
+ showNotification(get(response, "data.message", DELETE_SUCCESS), NotificationStatus.SUCCESS);
55
+ }
56
+ catch (error) {
57
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { actionLoading: false })));
58
+ const errorMessage = get(error, "response.data.message") ||
59
+ get(error, "message") ||
60
+ SOMETHING_WENT_WRONG;
61
+ showNotification(errorMessage, NotificationStatus.ERROR);
62
+ }
63
+ });
64
+ const onUpdateTemplate = (values, assetId) => __awaiter(this, void 0, void 0, function* () {
65
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { actionLoading: true })));
66
+ try {
67
+ const response = yield api.put(FETCH_ASSET_URL.replace(":assetId", assetId), values);
68
+ onFetchAssetTemplates(filters);
69
+ toggleDeletConfirm();
70
+ showNotification(get(response, "data.message", UPDATE_SUCCESS), NotificationStatus.SUCCESS);
71
+ }
72
+ catch (error) {
73
+ setState((prevState) => (Object.assign(Object.assign({}, prevState), { actionLoading: false })));
74
+ showNotification(get(error, "message", SOMETHING_WENT_WRONG), NotificationStatus.ERROR);
75
+ }
76
+ });
77
+ const getSortOrder = (order) => {
78
+ if (order === SortOrders.ASCEND) {
79
+ return "ascend";
80
+ }
81
+ else if (order === SortOrders.DESCEND) {
82
+ return "descend";
83
+ }
84
+ };
85
+ const columns = [
86
+ {
87
+ title: "Template Name",
88
+ dataIndex: "name",
89
+ key: "templateName",
90
+ sortOrder: filters.sortBy == "name" ? getSortOrder(filters.sortOrder) : undefined,
91
+ filteredValue: filters.name ? [filters.name] : [],
92
+ filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, }) => {
93
+ return (_jsx(RenderTableSearchFilters, { value: selectedKeys[0] || "", onChange: (e) => setSelectedKeys(e.target.value ? [e.target.value] : []), placeholder: "Search name", onPressEnter: confirm, onClick: confirm, onClear: () => {
94
+ clearFilters();
95
+ setSelectedKeys([]);
96
+ confirm();
97
+ } }));
98
+ },
99
+ sorter: true,
100
+ render: (text) => (_jsx("span", { className: "md-lib-text-textColor dark:md-lib-text-darkTextColor md-lib-max-w-[200px] md-lib-truncate md-lib-inline-block md-lib-cursor-default", title: text, children: text })),
101
+ },
102
+ {
103
+ title: "Created at",
104
+ dataIndex: "createdAt",
105
+ key: "createdAt",
106
+ sorter: true,
107
+ sortOrder: filters.sortBy == "createdAt"
108
+ ? getSortOrder(filters.sortOrder)
109
+ : undefined,
110
+ width: 200,
111
+ render: (date) => (_jsx("span", { className: "md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor md-lib-text-sm md-lib-cursor-default", children: moment.utc(date).tz(LOCAL_TIMEZONE).format(APP_DATE_TIME_FORMAT) })),
112
+ },
113
+ {
114
+ title: "Description",
115
+ dataIndex: "description",
116
+ key: "description",
117
+ render: (text) => (_jsx("span", { className: "md-lib-text-secondaryTextColor dark:md-lib-text-darkSecondaryTextColor md-lib-max-w-[240px] md-lib-truncate md-lib-inline-block md-lib-text-sm md-lib-cursor-default", title: text, children: text })),
118
+ },
119
+ {
120
+ title: "Active",
121
+ dataIndex: "isActive",
122
+ key: "isActive",
123
+ align: "center",
124
+ filteredValue: filters.isActive ? filters.isActive : null,
125
+ render: (isActive, record) => (_jsx(Switch, { loading: updateAssetId === get(record, "_id") && actionLoading, checked: isActive, onChange: (checked) => {
126
+ if (isActive) {
127
+ toggleDeletConfirm(record, get(record, "_id"));
128
+ }
129
+ else {
130
+ onUpdateTemplate({ isActive: !isActive }, get(record, "_id"));
131
+ }
132
+ } })),
133
+ filterDropdown: ({ setSelectedKeys, selectedKeys, confirm, clearFilters, }) => (_jsx(RenderTableSelectFilters, { selectedKeys: selectedKeys, onChange: (value) => setSelectedKeys(value), placeholder: "Is active?", onClear: () => {
134
+ clearFilters();
135
+ setSelectedKeys([]);
136
+ confirm();
137
+ }, onClick: confirm })),
138
+ },
139
+ {
140
+ title: "Actions",
141
+ dataIndex: "",
142
+ key: "actions",
143
+ render: (record) => (_jsxs(Space, { children: [_jsx(Tooltip, { title: "Edit Asset template", className: "md-lib-hidden md:md-lib-block", children: _jsx(CustomButton, { icon: _jsx(EditOutlined, { size: 24, className: "md-lib-text-primaryColor" }), size: "large", label: "", className: "md-lib-border-none", onClick: () => {
144
+ if (navigate) {
145
+ navigate(ASSET_TEMPLATE_SCREEN.replace(":id", get(record, "_id")));
146
+ }
147
+ } }) }), _jsx(Tooltip, { title: "Delete Asset template", placement: "topLeft", children: _jsx(CustomButton, { icon: _jsx(DeleteOutlined, { className: "md-lib-text-dangerColor", size: 24 }), label: "", type: "default", onClick: () => toggleDeletConfirm(record), className: "md-lib-border-none", size: "large" }) })] })),
148
+ },
149
+ ];
150
+ const handleTableChange = (pagination, tableFilters, sorter) => {
151
+ const order = sorter.order === "ascend" ? SortOrders.ASCEND : SortOrders.DESCEND;
152
+ const sortBy = sorter.field;
153
+ const updatedFilters = Object.assign(Object.assign({}, filters), { page: get(pagination, "current"), name: get(tableFilters, "templateName")
154
+ ? get(tableFilters, "templateName[0]")
155
+ : "", isActive: get(tableFilters, "isActive")
156
+ ? get(tableFilters, "isActive")
157
+ : undefined, sortBy: sortBy, sortOrder: order });
158
+ onFetchAssetTemplates(updatedFilters);
159
+ };
160
+ return (_jsxs("div", { className: "md-lib-mt-4", children: [_jsx(Table, { columns: columns, dataSource: assetTemplates, loading: { spinning: loading, indicator: _jsx(CustomLoader, {}) }, className: "assetType-table", pagination: totalPages > 1
161
+ ? {
162
+ showSizeChanger: false,
163
+ total: totalCount,
164
+ current: filters.page || DEFAULT_PAGE,
165
+ }
166
+ : false, onChange: handleTableChange, scroll: { x: "100%" } }), _jsx(DeleteConfirmationModal, { showDeleteModal: showConfirmPopup, toggleDeleteModal: toggleDeletConfirm, okText: updateAssetId ? DEACTIVATE_OK_TEXT : DELETE_OK_TEXT, onOk: updateAssetId
167
+ ? () => onUpdateTemplate({ isActive: false }, get(selectedAsset, "_id"))
168
+ : onDeleteTemplate, loading: actionLoading, description: DELETE_CONFIRMATION_MESSAGE.replace(":action", updateAssetId ? "deactivate" : "delete").replace(":entity", `${get(selectedAsset, "name", "this asset template")}`), subHeading: updateAssetId
169
+ ? ""
170
+ : "Deleting this template might result in loosing all the meta data associated with this asset type. This change is irreversible." })] }));
171
+ }
172
+ export default AssetTemplatesTable;
@@ -0,0 +1,3 @@
1
+ export default function CreateAssetTemplate({ label }: {
2
+ label: string;
3
+ }): JSX.Element;