ikoncomponents 1.2.1 → 1.2.2
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/dist/ikoncomponents/activity-sheet/index.d.ts +11 -0
- package/dist/ikoncomponents/activity-sheet/index.js +23 -0
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.d.ts +5 -0
- package/dist/ikoncomponents/big-calendar/big-calender-event/index.js +16 -0
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.d.ts +2 -0
- package/dist/ikoncomponents/big-calendar/big-calender-toolbar/index.js +39 -0
- package/dist/ikoncomponents/big-calendar/index.d.ts +4 -0
- package/dist/ikoncomponents/big-calendar/index.js +35 -0
- package/dist/ikoncomponents/big-calendar/type.d.ts +31 -0
- package/dist/ikoncomponents/big-calendar/type.js +1 -0
- package/dist/ikoncomponents/form-fields/combobox-input-value/index.js +1 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newCropper.d.ts +15 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newCropper.js +85 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.d.ts +7 -0
- package/dist/ikoncomponents/image-cropper-upload/components/newImageUploadForm.js +145 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.d.ts +6 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form/index.js +92 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.d.ts +6 -0
- package/dist/ikoncomponents/image-cropper-upload/cropper-form-with-modal/index.js +14 -0
- package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.d.ts +14 -0
- package/dist/ikoncomponents/image-cropper-upload/image-cropper/index.js +87 -0
- package/dist/ikoncomponents/image-cropper-upload/index.d.ts +27 -0
- package/dist/ikoncomponents/image-cropper-upload/index.js +49 -0
- package/dist/ikoncomponents/image-cropper-upload/utils/index.d.ts +16 -0
- package/dist/ikoncomponents/image-cropper-upload/utils/index.js +73 -0
- package/dist/ikoncomponents/main-layout/main-sidebar.d.ts +5 -9
- package/dist/ikoncomponents/main-layout/main-sidebar.js +2 -2
- package/dist/ikoncomponents/resource-spreadsheet/index.d.ts +21 -21
- package/dist/ikoncomponents/resource-spreadsheet/index.js +36 -36
- package/dist/index.d.ts +14 -0
- package/dist/index.js +8 -0
- package/dist/styles.css +95 -0
- package/dist/utils/actions/account/index.d.ts +5 -0
- package/dist/utils/actions/account/index.js +28 -0
- package/dist/utils/actions/account/type.d.ts +4 -0
- package/dist/utils/actions/account/type.js +1 -0
- package/dist/utils/actions/auth/index.d.ts +7 -0
- package/dist/utils/actions/auth/index.js +58 -0
- package/dist/utils/actions/common/utils.d.ts +5 -0
- package/dist/utils/actions/common/utils.js +25 -0
- package/dist/utils/actions/software/index.d.ts +11 -0
- package/dist/utils/actions/software/index.js +75 -0
- package/dist/utils/api/accountService/index.d.ts +23 -0
- package/dist/utils/api/accountService/index.js +64 -0
- package/dist/utils/api/accountService/type.d.ts +4 -0
- package/dist/utils/api/accountService/type.js +1 -0
- package/dist/utils/api/file-upload/index.d.ts +5 -0
- package/dist/utils/api/file-upload/index.js +80 -0
- package/dist/utils/api/file-upload/type.d.ts +6 -0
- package/dist/utils/api/file-upload/type.js +1 -0
- package/dist/utils/api/ikonBaseApi.d.ts +12 -0
- package/dist/utils/api/ikonBaseApi.js +104 -0
- package/dist/utils/api/loginService/index.d.ts +12 -0
- package/dist/utils/api/loginService/index.js +72 -0
- package/dist/utils/api/loginService/type.d.ts +31 -0
- package/dist/utils/api/loginService/type.js +1 -0
- package/dist/utils/api/softwareService/index.d.ts +64 -0
- package/dist/utils/api/softwareService/index.js +212 -0
- package/dist/utils/api/softwareService/type.d.ts +54 -0
- package/dist/utils/api/softwareService/type.js +1 -0
- package/package.json +6 -2
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo, useEffect, useRef } from "react";
|
|
3
|
+
import Cropper from "react-cropper";
|
|
4
|
+
import "cropperjs/dist/cropper.css";
|
|
5
|
+
const ImageCropperComponent = ({ src, onCroppedImage, aspectRatio, rotationAngle, zoomLevel, moveDirection }) => {
|
|
6
|
+
const cropperRef = useRef(null);
|
|
7
|
+
function onCrop(event) {
|
|
8
|
+
var _a;
|
|
9
|
+
const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
|
|
10
|
+
if (cropper) {
|
|
11
|
+
//cropper.setDragMode('move');
|
|
12
|
+
const croppedCanvas = cropper.getCroppedCanvas();
|
|
13
|
+
const croppedImageUrl = croppedCanvas.toDataURL("image/webp"); // Data URL for preview
|
|
14
|
+
onCroppedImage(croppedImageUrl);
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
console.log("Cropper instance is not available.");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
;
|
|
21
|
+
useEffect(() => {
|
|
22
|
+
var _a;
|
|
23
|
+
// Rotate the image whenever the rotation angle changes
|
|
24
|
+
const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
|
|
25
|
+
if (cropper) {
|
|
26
|
+
cropper.rotate(rotationAngle); // Apply the rotation to the image
|
|
27
|
+
}
|
|
28
|
+
}, [rotationAngle]); // Effect will run whenever rotationAngle changes
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
var _a;
|
|
31
|
+
// Zoom the image whenever the zoom level changes
|
|
32
|
+
const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
|
|
33
|
+
if (cropper) {
|
|
34
|
+
const cropBoxData = cropper.getCropBoxData();
|
|
35
|
+
if (cropBoxData.width) {
|
|
36
|
+
console.log('Inside cropper scale');
|
|
37
|
+
cropper.scale(zoomLevel); // Apply the zoom level
|
|
38
|
+
}
|
|
39
|
+
// Apply zoom directly without using getZoom method
|
|
40
|
+
}
|
|
41
|
+
}, [zoomLevel]); // Effect will run whenever zoomLevel changes
|
|
42
|
+
// Move the image based on the moveDirection prop
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
var _a;
|
|
45
|
+
const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
|
|
46
|
+
if (cropper) {
|
|
47
|
+
// Make sure moveDirection is available before calling move
|
|
48
|
+
const cropBoxData = cropper.getCropBoxData();
|
|
49
|
+
if (cropBoxData.width) {
|
|
50
|
+
const { x, y } = moveDirection;
|
|
51
|
+
if (typeof x === "number" && typeof y === "number") {
|
|
52
|
+
cropper.move(x, y); // Move the image
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}, [moveDirection]); // This effect runs whenever moveDirection changes
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
var _a;
|
|
59
|
+
const cropper = (_a = cropperRef.current) === null || _a === void 0 ? void 0 : _a.cropper;
|
|
60
|
+
if (cropper) {
|
|
61
|
+
cropper.setAspectRatio(aspectRatio); // Dynamically set the aspect ratio
|
|
62
|
+
if (aspectRatio === 1) {
|
|
63
|
+
// Get the displayed (canvas) dimensions of the image
|
|
64
|
+
const canvasData = cropper.getCanvasData();
|
|
65
|
+
const canvasWidth = canvasData.width; // Displayed width of the image
|
|
66
|
+
const canvasHeight = canvasData.height; // Displayed height of the image
|
|
67
|
+
const canvasLeft = canvasData.left; // Left offset of the image within the container
|
|
68
|
+
const canvasTop = canvasData.top; // Top offset of the image within the container
|
|
69
|
+
// Define the desired crop box dimensions
|
|
70
|
+
const cropBoxWidth = 200; // Desired crop box width
|
|
71
|
+
const cropBoxHeight = 100; // Desired crop box height
|
|
72
|
+
// Calculate the center position for the crop box
|
|
73
|
+
const left = canvasLeft + (canvasWidth - cropBoxWidth) / 2;
|
|
74
|
+
const top = canvasTop + (canvasHeight - cropBoxHeight) / 2;
|
|
75
|
+
// Set the crop box data
|
|
76
|
+
cropper.setCropBoxData({
|
|
77
|
+
left: left,
|
|
78
|
+
top: top,
|
|
79
|
+
width: cropBoxWidth,
|
|
80
|
+
height: cropBoxHeight,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, [aspectRatio]); // Trigger this effect whenever aspectRatio changes
|
|
85
|
+
return (_jsx(Cropper, { src: src, style: { height: "100%", width: "100%", objectFit: "contain" }, guides: true, crop: onCrop, ref: cropperRef, dragMode: 'move', movable: true, zoomable: true, scalable: true, cropBoxMovable: true, cropBoxResizable: false }));
|
|
86
|
+
};
|
|
87
|
+
export const ImageCropper = memo(ImageCropperComponent);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { CropperUploadImagesInfoProps } from './utils';
|
|
3
|
+
export interface ImageCropperContextProps {
|
|
4
|
+
originalImage: OriginalImageProps;
|
|
5
|
+
setOriginalImage: (originalImage: OriginalImageProps) => void;
|
|
6
|
+
aspectRatioWiseImages: AspectRatioWiseImagesProps;
|
|
7
|
+
setAspectRatioWiseImages: (aspectRatioWiseImages: AspectRatioWiseImagesProps) => void;
|
|
8
|
+
}
|
|
9
|
+
export interface AspectRatioWiseImagesProps {
|
|
10
|
+
landscape: string | null;
|
|
11
|
+
potrait: string | null;
|
|
12
|
+
icon: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface OriginalImageProps {
|
|
15
|
+
image: string | File | null;
|
|
16
|
+
name?: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ImageCropperProps {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
uploadedImages: CropperUploadImagesInfoProps | null;
|
|
22
|
+
onCropperChange: (originalImage: OriginalImageProps, aspectRatioWiseImages: AspectRatioWiseImagesProps) => void;
|
|
23
|
+
modalOpen?: boolean;
|
|
24
|
+
onModalOpenChange?: (open: boolean) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function ImageCropperProvider({ children, uploadedImages, onCropperChange, modalOpen, onModalOpenChange }: ImageCropperProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const useImageCropper: () => ImageCropperContextProps;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useEffect, useState } from 'react';
|
|
4
|
+
import { CropperFormWithModal } from './cropper-form-with-modal';
|
|
5
|
+
import { uploadedImagesToCropperImgObj } from './utils';
|
|
6
|
+
const ImageCropperContext = createContext(undefined);
|
|
7
|
+
export function ImageCropperProvider({ children, uploadedImages, onCropperChange, modalOpen, onModalOpenChange }) {
|
|
8
|
+
const [aspectRatioWiseImages, setAspectRatioWiseImages] = useState({
|
|
9
|
+
landscape: null,
|
|
10
|
+
potrait: null,
|
|
11
|
+
icon: null
|
|
12
|
+
});
|
|
13
|
+
const [originalImage, setOriginalImage] = useState({
|
|
14
|
+
image: null,
|
|
15
|
+
name: "",
|
|
16
|
+
description: "",
|
|
17
|
+
});
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
async function updateCropperImages() {
|
|
20
|
+
if (!uploadedImages)
|
|
21
|
+
return; // Prevent unnecessary processing
|
|
22
|
+
try {
|
|
23
|
+
const res = await uploadedImagesToCropperImgObj(uploadedImages);
|
|
24
|
+
if (res) {
|
|
25
|
+
// Check if state is different before updating
|
|
26
|
+
setOriginalImage((prev) => JSON.stringify(prev) === JSON.stringify(res.originalImage) ? prev : res.originalImage);
|
|
27
|
+
setAspectRatioWiseImages((prev) => JSON.stringify(prev) === JSON.stringify(res.aspectRatioWiseImages) ? prev : res.aspectRatioWiseImages);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
console.error("Error processing uploaded images:", error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
updateCropperImages();
|
|
35
|
+
}, [uploadedImages]); // Runs only when `uploadedImages` changes
|
|
36
|
+
return (_jsxs(ImageCropperContext.Provider, { value: {
|
|
37
|
+
originalImage,
|
|
38
|
+
setOriginalImage,
|
|
39
|
+
aspectRatioWiseImages,
|
|
40
|
+
setAspectRatioWiseImages
|
|
41
|
+
}, children: [children, modalOpen && onModalOpenChange && _jsx(CropperFormWithModal, { open: modalOpen, onOpenChange: onModalOpenChange, onCropperChange: onCropperChange })] }));
|
|
42
|
+
}
|
|
43
|
+
export const useImageCropper = () => {
|
|
44
|
+
const context = useContext(ImageCropperContext);
|
|
45
|
+
if (!context) {
|
|
46
|
+
throw new Error("useImageCropper must be used within a ImageCropperProvider");
|
|
47
|
+
}
|
|
48
|
+
return context;
|
|
49
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AspectRatioWiseImagesProps, OriginalImageProps } from "..";
|
|
2
|
+
import { FileinfoProps } from "../../../utils/api/file-upload/type";
|
|
3
|
+
export interface CropperUploadImagesInfoProps {
|
|
4
|
+
originalImageInfo?: FileinfoProps | null;
|
|
5
|
+
imageName?: string;
|
|
6
|
+
imageDescription?: string;
|
|
7
|
+
landscapeImageInfo?: FileinfoProps | null;
|
|
8
|
+
portaitImageInfo?: FileinfoProps | null;
|
|
9
|
+
iconImageInfo?: FileinfoProps | null;
|
|
10
|
+
}
|
|
11
|
+
export interface UploadedImagesToCropperImgObjProps {
|
|
12
|
+
originalImage: OriginalImageProps;
|
|
13
|
+
aspectRatioWiseImages: AspectRatioWiseImagesProps;
|
|
14
|
+
}
|
|
15
|
+
export declare function imageCropperFilesUpload(originalImage: OriginalImageProps, aspectRatioWiseImages?: AspectRatioWiseImagesProps, resourceId?: string): Promise<CropperUploadImagesInfoProps | null>;
|
|
16
|
+
export declare function uploadedImagesToCropperImgObj(uploadedImages: CropperUploadImagesInfoProps | null): Promise<UploadedImagesToCropperImgObjProps | null>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { base64FileUpload, singleFileUpload, } from "../../../utils/api/file-upload";
|
|
2
|
+
import { getResourceUrl } from "../../../utils/actions/common/utils";
|
|
3
|
+
export async function imageCropperFilesUpload(originalImage, aspectRatioWiseImages, resourceId) {
|
|
4
|
+
if (!originalImage.image) {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const originalImageInfo = await singleFileUpload(originalImage.image, resourceId);
|
|
8
|
+
const cropperUploadImagesInfo = {
|
|
9
|
+
originalImageInfo: originalImageInfo,
|
|
10
|
+
imageName: originalImage.name,
|
|
11
|
+
imageDescription: originalImage.description,
|
|
12
|
+
landscapeImageInfo: null,
|
|
13
|
+
portaitImageInfo: null,
|
|
14
|
+
iconImageInfo: null,
|
|
15
|
+
};
|
|
16
|
+
if (aspectRatioWiseImages) {
|
|
17
|
+
if (aspectRatioWiseImages.landscape) {
|
|
18
|
+
try {
|
|
19
|
+
cropperUploadImagesInfo["landscapeImageInfo"] = await base64FileUpload(aspectRatioWiseImages.landscape, originalImage.name + "_L.webp", "image/webp");
|
|
20
|
+
}
|
|
21
|
+
catch (error) {
|
|
22
|
+
console.error(error);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (aspectRatioWiseImages.potrait) {
|
|
26
|
+
try {
|
|
27
|
+
cropperUploadImagesInfo["portaitImageInfo"] = await base64FileUpload(aspectRatioWiseImages.potrait, originalImage.name + "_P.webp", "image/webp");
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
console.error(error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (aspectRatioWiseImages.icon) {
|
|
34
|
+
try {
|
|
35
|
+
cropperUploadImagesInfo["iconImageInfo"] = await base64FileUpload(aspectRatioWiseImages.icon, originalImage.name + "_I.webp", "image/webp");
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(error);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return cropperUploadImagesInfo;
|
|
43
|
+
}
|
|
44
|
+
export async function uploadedImagesToCropperImgObj(uploadedImages) {
|
|
45
|
+
if (!uploadedImages) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const originalImageUrl = uploadedImages.originalImageInfo
|
|
49
|
+
? await getResourceUrl(uploadedImages.originalImageInfo)
|
|
50
|
+
: null;
|
|
51
|
+
const landscapeImageUrl = uploadedImages.landscapeImageInfo
|
|
52
|
+
? await getResourceUrl(uploadedImages.landscapeImageInfo)
|
|
53
|
+
: null;
|
|
54
|
+
const portaitImageUrl = uploadedImages.portaitImageInfo
|
|
55
|
+
? await getResourceUrl(uploadedImages.portaitImageInfo)
|
|
56
|
+
: null;
|
|
57
|
+
const iconImageUrl = uploadedImages.iconImageInfo
|
|
58
|
+
? await getResourceUrl(uploadedImages.iconImageInfo)
|
|
59
|
+
: null;
|
|
60
|
+
const obj = {
|
|
61
|
+
originalImage: {
|
|
62
|
+
image: originalImageUrl,
|
|
63
|
+
name: uploadedImages.imageName,
|
|
64
|
+
description: uploadedImages.imageDescription,
|
|
65
|
+
},
|
|
66
|
+
aspectRatioWiseImages: {
|
|
67
|
+
landscape: landscapeImageUrl,
|
|
68
|
+
potrait: portaitImageUrl,
|
|
69
|
+
icon: iconImageUrl,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
return obj;
|
|
73
|
+
}
|
|
@@ -12,15 +12,11 @@ export interface Account {
|
|
|
12
12
|
export interface Software {
|
|
13
13
|
softwareId: string;
|
|
14
14
|
softwareName: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
expiresOn: string | null;
|
|
21
|
-
active: boolean;
|
|
22
|
-
requestStatus: string | null;
|
|
23
|
-
softwareVisibility: 'PUBLIC' | 'PRIVATE' | 'RESTRICTED';
|
|
15
|
+
url: string;
|
|
16
|
+
icon: string;
|
|
17
|
+
visible: boolean;
|
|
18
|
+
defaultSoftware: boolean;
|
|
19
|
+
order: number;
|
|
24
20
|
}
|
|
25
21
|
export declare const MainSidebar: ({ baseUrl }: {
|
|
26
22
|
baseUrl: string;
|
|
@@ -48,7 +48,7 @@ export const MainSidebar = ({ baseUrl }) => {
|
|
|
48
48
|
const fetchSubscribedSoftwares = async () => {
|
|
49
49
|
try {
|
|
50
50
|
const accessToken = await getValidAccessToken();
|
|
51
|
-
const response = await axios.get(`${baseUrl}/platform/software
|
|
51
|
+
const response = await axios.get(`${baseUrl}/platform/software/accessible/user`, {
|
|
52
52
|
headers: {
|
|
53
53
|
Authorization: `Bearer ${accessToken}`,
|
|
54
54
|
},
|
|
@@ -66,7 +66,7 @@ export const MainSidebar = ({ baseUrl }) => {
|
|
|
66
66
|
setSelectedAccount(account);
|
|
67
67
|
}, children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "h-6 w-6 rounded bg-primary/10 flex items-center justify-center", children: _jsx("span", { className: "text-xs font-medium text-primary", children: getInitials(account.accountName) }) }), _jsx("span", { className: "text-sm", children: account.accountName })] }), (selectedAccount === null || selectedAccount === void 0 ? void 0 : selectedAccount.accountId) === account.accountId && (_jsx(Check, { className: "h-4 w-4 text-primary" }))] }, account.accountId)))] })] }), _jsx("nav", { className: "flex flex-col gap-2", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-5 w-5', children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: "/", children: [_jsx(Home, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Home" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Home" })] }, "home") }), _jsx("nav", { className: "flex flex-col gap-2 flex-1", children: softwares.map((software) => {
|
|
68
68
|
const Icon = FolderCode;
|
|
69
|
-
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-5 w-5', children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href:
|
|
69
|
+
return (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-5 w-5', children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: software.url, children: [_jsx(Icon, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: software.softwareName })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: software.softwareName })] }, software.softwareName));
|
|
70
70
|
}) }), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-5 w-5', children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: "/last-visited", children: [_jsx(Clock, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Last Visited" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Last Visited" })] }, "last-visited"), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-5 w-5', children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: "/favourites", children: [_jsx(Heart, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Favourites" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Favourites" })] }, "favourites"), _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, className: 'h-5 w-5', children: _jsx(Button, { variant: "ghost", className: "h-10 w-10", asChild: true, children: _jsxs(Link, { href: "/settings", children: [_jsx(Settings, { className: "h-5 w-5" }), _jsx("span", { className: "sr-only", children: "Settings" })] }) }) }), _jsx(TooltipContent, { side: "right", sideOffset: 5, children: "Settings" })] }, "settings"), _jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "icon", className: "h-10 w-10 rounded-full", children: _jsxs(Avatar, { className: "h-8 w-8", children: [_jsx(AvatarImage, { src: user.avatar, alt: user.name }), _jsx(AvatarFallback, { className: "text-sm font-semibold", children: user.name.split(' ').map(n => n[0]).join('') })] }) }) }), _jsxs(DropdownMenuContent, { className: "w-55 p-0", side: 'right', sideOffset: 8, children: [_jsxs("div", { className: "flex items-start gap-3 p-4 bg-card", children: [_jsxs(Avatar, { className: "h-10 w-10 mt-1", children: [_jsx(AvatarImage, { src: user.avatar, alt: user.name }), _jsx(AvatarFallback, { className: "", children: user.name.split(' ').map(n => n[0]).join('') })] }), _jsxs("div", { className: "flex flex-col gap-0.5 flex-1 min-w-0", children: [_jsx("p", { className: "text-sm font-bold text-foreground blue-dark:text-muted-foreground truncate", children: user.name }), _jsx("p", { className: "text-xs text-muted-foreground truncate", children: user.email }), _jsx("p", { className: "text-sm text-muted-foreground font-semibold", children: user.role })] })] }), _jsx(DropdownMenuSeparator, { className: "my-0" }), _jsxs(DropdownMenuItem, { onClick: async () => {
|
|
71
71
|
await clearAllCookieSession();
|
|
72
72
|
redirect("/login.html");
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
interface ResourceTableProps {
|
|
3
|
-
resourceDataWithAllocation: any[];
|
|
4
|
-
userMaps: UserMaps;
|
|
5
|
-
monthsRange: string[];
|
|
6
|
-
}
|
|
7
|
-
interface UserMaps {
|
|
8
|
-
userDetailsMap: {
|
|
9
|
-
[key: string]: {
|
|
10
|
-
name: string;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
rolesMap: {
|
|
14
|
-
[key: string]: {
|
|
15
|
-
roleId: string;
|
|
16
|
-
roleName: string;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
export declare const ResourceTable: React.FC<ResourceTableProps>;
|
|
21
|
-
export {};
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
interface ResourceTableProps {
|
|
3
|
+
resourceDataWithAllocation: any[];
|
|
4
|
+
userMaps: UserMaps;
|
|
5
|
+
monthsRange: string[];
|
|
6
|
+
}
|
|
7
|
+
interface UserMaps {
|
|
8
|
+
userDetailsMap: {
|
|
9
|
+
[key: string]: {
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
rolesMap: {
|
|
14
|
+
[key: string]: {
|
|
15
|
+
roleId: string;
|
|
16
|
+
roleName: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export declare const ResourceTable: React.FC<ResourceTableProps>;
|
|
21
|
+
export {};
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Card, CardContent } from "../../shadcn/card";
|
|
3
|
-
import { Input } from "../../shadcn/input";
|
|
4
|
-
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../shadcn/select";
|
|
5
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../shadcn/table";
|
|
6
|
-
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
7
|
-
import * as React from "react";
|
|
8
|
-
import { useFormContext } from "react-hook-form";
|
|
9
|
-
const groupResourcesByTask = (resources) => {
|
|
10
|
-
const groupedMap = resources.reduce((acc, resource) => {
|
|
11
|
-
const taskId = resource.taskId;
|
|
12
|
-
if (!acc.has(taskId)) {
|
|
13
|
-
acc.set(taskId, {
|
|
14
|
-
taskId,
|
|
15
|
-
taskName: resource.taskName,
|
|
16
|
-
resources: []
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
acc.get(taskId).resources.push(resource);
|
|
20
|
-
return acc;
|
|
21
|
-
}, new Map());
|
|
22
|
-
return Array.from(groupedMap.values());
|
|
23
|
-
};
|
|
24
|
-
export const ResourceTable = ({ resourceDataWithAllocation, userMaps, monthsRange }) => {
|
|
25
|
-
const { setValue } = useFormContext();
|
|
26
|
-
const [expandedTasks, setExpandedTasks] = React.useState(new Set());
|
|
27
|
-
const groupedResources = groupResourcesByTask(resourceDataWithAllocation);
|
|
28
|
-
const toggleTask = (taskId) => {
|
|
29
|
-
setExpandedTasks((prev) => {
|
|
30
|
-
const newSet = new Set(prev);
|
|
31
|
-
newSet.has(taskId) ? newSet.delete(taskId) : newSet.add(taskId);
|
|
32
|
-
return newSet;
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
return (_jsx(Card, { className: "p-0 bg-background", children: _jsx(CardContent, { className: "p-0", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "w-[300px] py-5", children: "Task Name" }), _jsx(TableHead, { className: "w-[200px] py-5", children: "Employee Name" }), _jsx(TableHead, { className: "w-[200px] py-5", children: "Role" }), monthsRange.map((month) => (_jsx(TableHead, { className: "w-[100px] py-5", children: month.replace("_", " ") }, month)))] }) }), _jsx(TableBody, { children: groupedResources.map((group) => (_jsxs(React.Fragment, { children: [_jsx(TableRow, { className: "cursor-pointer hover:bg-accent", onClick: () => toggleTask(group.taskId), children: _jsx(TableCell, { colSpan: 3 + monthsRange.length, children: _jsxs("div", { className: "flex items-center gap-2", children: [expandedTasks.has(group.taskId) ? _jsx(ChevronDown, { className: "h-4 w-4 text-primary" }) : _jsx(ChevronRight, { className: "h-4 w-4 text-primary" }), _jsx("span", { className: "font-medium", children: group.taskName })] }) }) }), expandedTasks.has(group.taskId) && group.resources.map((resource) => (_jsxs(TableRow, { className: "hover:bg-muted/30", children: [_jsx(TableCell, { className: "pl-8", children: _jsx(Input, { value: resource.taskName, disabled: true, className: "w-full bg-transparent border-0 px-0 disabled:opacity-100" }) }), _jsx(TableCell, { children: _jsxs(Select, { defaultValue: resource.resourceId, children: [_jsx(SelectTrigger, { className: "w-full bg-secondary dark:bg-secondary", children: _jsx(SelectValue, { placeholder: "Select employee" }) }), _jsx(SelectContent, { children: Object.entries(userMaps.userDetailsMap).map(([id, user]) => (_jsx(SelectItem, { value: id, children: user.name }, id))) })] }) }), _jsx(TableCell, { children: _jsxs(Select, { defaultValue: resource.gradeId.toString(), children: [_jsx(SelectTrigger, { className: "w-full bg-secondary dark:bg-secondary", children: _jsx(SelectValue, { placeholder: "Select role" }) }), _jsx(SelectContent, { children: Object.entries(userMaps.rolesMap).map(([id, role]) => (_jsx(SelectItem, { value: id, children: role.roleName }, id))) })] }) }), monthsRange.map((month) => (_jsx(TableCell, { children: _jsx(Input, { type: "number", min: "0", max: "1", step: "0.01", defaultValue: resource.allocation[month] || 0, className: "w-20" }) }, month)))] }, `${resource.taskId}-${resource.resourceId}`)))] }, group.taskId))) })] }) }) }));
|
|
36
|
-
};
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card, CardContent } from "../../shadcn/card";
|
|
3
|
+
import { Input } from "../../shadcn/input";
|
|
4
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../shadcn/select";
|
|
5
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "../../shadcn/table";
|
|
6
|
+
import { ChevronDown, ChevronRight } from "lucide-react";
|
|
7
|
+
import * as React from "react";
|
|
8
|
+
import { useFormContext } from "react-hook-form";
|
|
9
|
+
const groupResourcesByTask = (resources) => {
|
|
10
|
+
const groupedMap = resources.reduce((acc, resource) => {
|
|
11
|
+
const taskId = resource.taskId;
|
|
12
|
+
if (!acc.has(taskId)) {
|
|
13
|
+
acc.set(taskId, {
|
|
14
|
+
taskId,
|
|
15
|
+
taskName: resource.taskName,
|
|
16
|
+
resources: []
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
acc.get(taskId).resources.push(resource);
|
|
20
|
+
return acc;
|
|
21
|
+
}, new Map());
|
|
22
|
+
return Array.from(groupedMap.values());
|
|
23
|
+
};
|
|
24
|
+
export const ResourceTable = ({ resourceDataWithAllocation, userMaps, monthsRange }) => {
|
|
25
|
+
const { setValue } = useFormContext();
|
|
26
|
+
const [expandedTasks, setExpandedTasks] = React.useState(new Set());
|
|
27
|
+
const groupedResources = groupResourcesByTask(resourceDataWithAllocation);
|
|
28
|
+
const toggleTask = (taskId) => {
|
|
29
|
+
setExpandedTasks((prev) => {
|
|
30
|
+
const newSet = new Set(prev);
|
|
31
|
+
newSet.has(taskId) ? newSet.delete(taskId) : newSet.add(taskId);
|
|
32
|
+
return newSet;
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
return (_jsx(Card, { className: "p-0 bg-background", children: _jsx(CardContent, { className: "p-0", children: _jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { className: "w-[300px] py-5", children: "Task Name" }), _jsx(TableHead, { className: "w-[200px] py-5", children: "Employee Name" }), _jsx(TableHead, { className: "w-[200px] py-5", children: "Role" }), monthsRange.map((month) => (_jsx(TableHead, { className: "w-[100px] py-5", children: month.replace("_", " ") }, month)))] }) }), _jsx(TableBody, { children: groupedResources.map((group) => (_jsxs(React.Fragment, { children: [_jsx(TableRow, { className: "cursor-pointer hover:bg-accent", onClick: () => toggleTask(group.taskId), children: _jsx(TableCell, { colSpan: 3 + monthsRange.length, children: _jsxs("div", { className: "flex items-center gap-2", children: [expandedTasks.has(group.taskId) ? _jsx(ChevronDown, { className: "h-4 w-4 text-primary" }) : _jsx(ChevronRight, { className: "h-4 w-4 text-primary" }), _jsx("span", { className: "font-medium", children: group.taskName })] }) }) }), expandedTasks.has(group.taskId) && group.resources.map((resource) => (_jsxs(TableRow, { className: "hover:bg-muted/30", children: [_jsx(TableCell, { className: "pl-8", children: _jsx(Input, { value: resource.taskName, disabled: true, className: "w-full bg-transparent border-0 px-0 disabled:opacity-100" }) }), _jsx(TableCell, { children: _jsxs(Select, { defaultValue: resource.resourceId, children: [_jsx(SelectTrigger, { className: "w-full bg-secondary dark:bg-secondary", children: _jsx(SelectValue, { placeholder: "Select employee" }) }), _jsx(SelectContent, { children: Object.entries(userMaps.userDetailsMap).map(([id, user]) => (_jsx(SelectItem, { value: id, children: user.name }, id))) })] }) }), _jsx(TableCell, { children: _jsxs(Select, { defaultValue: resource.gradeId.toString(), children: [_jsx(SelectTrigger, { className: "w-full bg-secondary dark:bg-secondary", children: _jsx(SelectValue, { placeholder: "Select role" }) }), _jsx(SelectContent, { children: Object.entries(userMaps.rolesMap).map(([id, role]) => (_jsx(SelectItem, { value: id, children: role.roleName }, id))) })] }) }), monthsRange.map((month) => (_jsx(TableCell, { children: _jsx(Input, { type: "number", min: "0", max: "1", step: "0.01", defaultValue: resource.allocation[month] || 0, className: "w-20" }) }, month)))] }, `${resource.taskId}-${resource.resourceId}`)))] }, group.taskId))) })] }) }) }));
|
|
36
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,8 @@ export { FrameworkItemDropdown } from "./ikoncomponents/twolevel-dropdown";
|
|
|
80
80
|
export type { FrameworkEntry, TreeNode, ParentEntry, ProcessedFrameworkData } from "./ikoncomponents/twolevel-dropdown";
|
|
81
81
|
export { Widgets } from "./ikoncomponents/widgets";
|
|
82
82
|
export type { WidgetProps, WidgetsFunctionProps } from "./ikoncomponents/widgets/type";
|
|
83
|
+
export { BigCalendar } from "./ikoncomponents/big-calendar";
|
|
84
|
+
export type { BigCalendarProps, ExtraParamsEvent, BigCalendarEventProps, BigCalenderToolbarProps } from "./ikoncomponents/big-calendar/type";
|
|
83
85
|
export { BreadcrumbProvider, useBreadcrumb } from "./ikoncomponents/app-breadcrumb/BreadcrumbProvider";
|
|
84
86
|
export type { BreadcrumbItemProps } from "./ikoncomponents/app-breadcrumb/BreadcrumbProvider";
|
|
85
87
|
export { AppBreadcrumb, RenderAppBreadcrumb } from "./ikoncomponents/app-breadcrumb";
|
|
@@ -107,6 +109,18 @@ export type { SidebarNavSubItem, SidebarNavItem, SidebarNavContextType } from ".
|
|
|
107
109
|
export { SidebarNavProvider, useSidebarNav } from "./ikoncomponents/main-layout/SidebarNavContext";
|
|
108
110
|
export { MainLayout } from "./ikoncomponents/main-layout";
|
|
109
111
|
export { ProviderWrapper } from "./ikoncomponents/provider-wrapper";
|
|
112
|
+
export { ActivitySheet } from "./ikoncomponents/activity-sheet";
|
|
113
|
+
export type { ActivityLogProps } from "./ikoncomponents/activity-sheet";
|
|
114
|
+
export { ImageCropperProvider, useImageCropper } from "./ikoncomponents/image-cropper-upload";
|
|
115
|
+
export type { ImageCropperProps, OriginalImageProps, AspectRatioWiseImagesProps, ImageCropperContextProps } from "./ikoncomponents/image-cropper-upload";
|
|
116
|
+
export { ImageCropper } from "./ikoncomponents/image-cropper-upload/image-cropper";
|
|
117
|
+
export type { CropperImgProps } from "./ikoncomponents/image-cropper-upload/image-cropper";
|
|
118
|
+
export { CropperFormWithModal } from "./ikoncomponents/image-cropper-upload/cropper-form-with-modal";
|
|
119
|
+
export { CropperForm } from "./ikoncomponents/image-cropper-upload/cropper-form";
|
|
120
|
+
export { NewCropperImg } from "./ikoncomponents/image-cropper-upload/components/newCropper";
|
|
121
|
+
export type { CropperImgProps as NewCropperImgProps } from "./ikoncomponents/image-cropper-upload/components/newCropper";
|
|
122
|
+
export { NewImageForm } from "./ikoncomponents/image-cropper-upload/components/newImageUploadForm";
|
|
123
|
+
export type { ImageFormProps } from "./ikoncomponents/image-cropper-upload/components/newImageUploadForm";
|
|
110
124
|
export { ThemeProvider } from "./utils/theme-provider";
|
|
111
125
|
export { RadiusProvider, useRadius } from "./utils/border-radius-provider";
|
|
112
126
|
export { FontProvider, useFont } from "./utils/font-provider";
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,7 @@ export { TitleProgress } from "./ikoncomponents/title-progress";
|
|
|
72
72
|
export { TooltipComponent } from "./ikoncomponents/tooltip";
|
|
73
73
|
export { FrameworkItemDropdown } from "./ikoncomponents/twolevel-dropdown";
|
|
74
74
|
export { Widgets } from "./ikoncomponents/widgets";
|
|
75
|
+
export { BigCalendar } from "./ikoncomponents/big-calendar";
|
|
75
76
|
export { BreadcrumbProvider, useBreadcrumb } from "./ikoncomponents/app-breadcrumb/BreadcrumbProvider";
|
|
76
77
|
export { AppBreadcrumb, RenderAppBreadcrumb } from "./ikoncomponents/app-breadcrumb";
|
|
77
78
|
export { FormComboboxInput } from "./ikoncomponents/form-fields/combobox-input";
|
|
@@ -94,6 +95,13 @@ export { NavMain } from "./ikoncomponents/main-layout/nav-main";
|
|
|
94
95
|
export { SidebarNavProvider, useSidebarNav } from "./ikoncomponents/main-layout/SidebarNavContext";
|
|
95
96
|
export { MainLayout } from "./ikoncomponents/main-layout";
|
|
96
97
|
export { ProviderWrapper } from "./ikoncomponents/provider-wrapper";
|
|
98
|
+
export { ActivitySheet } from "./ikoncomponents/activity-sheet";
|
|
99
|
+
export { ImageCropperProvider, useImageCropper } from "./ikoncomponents/image-cropper-upload";
|
|
100
|
+
export { ImageCropper } from "./ikoncomponents/image-cropper-upload/image-cropper";
|
|
101
|
+
export { CropperFormWithModal } from "./ikoncomponents/image-cropper-upload/cropper-form-with-modal";
|
|
102
|
+
export { CropperForm } from "./ikoncomponents/image-cropper-upload/cropper-form";
|
|
103
|
+
export { NewCropperImg } from "./ikoncomponents/image-cropper-upload/components/newCropper";
|
|
104
|
+
export { NewImageForm } from "./ikoncomponents/image-cropper-upload/components/newImageUploadForm";
|
|
97
105
|
export { ThemeProvider } from "./utils/theme-provider";
|
|
98
106
|
export { RadiusProvider, useRadius } from "./utils/border-radius-provider";
|
|
99
107
|
export { FontProvider, useFont } from "./utils/font-provider";
|