hi-tm 0.0.1
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/README.md +0 -0
- package/dist/components/AutoComplete/AutoComplete.d.ts +4 -0
- package/dist/components/AutoComplete/AutoComplete.js +132 -0
- package/dist/components/AutoComplete/AutoCompleteMultiSelect.d.ts +4 -0
- package/dist/components/AutoComplete/AutoCompleteMultiSelect.js +155 -0
- package/dist/components/AutoComplete/TreeAutoComplete.d.ts +65 -0
- package/dist/components/AutoComplete/TreeAutoComplete.js +150 -0
- package/dist/components/Cards/AutoComplete&DropDown/CourierCard.d.ts +4 -0
- package/dist/components/Cards/AutoComplete&DropDown/CourierCard.js +13 -0
- package/dist/components/Cards/AutoComplete&DropDown/GeographyCard.d.ts +4 -0
- package/dist/components/Cards/AutoComplete&DropDown/GeographyCard.js +11 -0
- package/dist/components/Cards/AutoComplete&DropDown/ItemCard.d.ts +4 -0
- package/dist/components/Cards/AutoComplete&DropDown/ItemCard.js +12 -0
- package/dist/components/Cards/AutoComplete&DropDown/PersonCard.d.ts +4 -0
- package/dist/components/Cards/AutoComplete&DropDown/PersonCard.js +12 -0
- package/dist/components/Cards/AutoComplete&DropDown/SimpleCard.d.ts +4 -0
- package/dist/components/Cards/AutoComplete&DropDown/SimpleCard.js +11 -0
- package/dist/components/DropDowns/DropDown.d.ts +4 -0
- package/dist/components/DropDowns/DropDown.js +170 -0
- package/dist/components/DropDowns/DropDownItemsPerPage.d.ts +8 -0
- package/dist/components/DropDowns/DropDownItemsPerPage.js +44 -0
- package/dist/components/DropDowns/DropDownMultiSelect.d.ts +4 -0
- package/dist/components/DropDowns/DropDownMultiSelect.js +154 -0
- package/dist/components/Inputs/Buttons/Button.d.ts +14 -0
- package/dist/components/Inputs/Buttons/Button.js +39 -0
- package/dist/components/Inputs/DaysCheckBox.d.ts +4 -0
- package/dist/components/Inputs/DaysCheckBox.js +27 -0
- package/dist/components/Inputs/InputBarcode.d.ts +4 -0
- package/dist/components/Inputs/InputBarcode.js +148 -0
- package/dist/components/Inputs/InputCurrency.d.ts +25 -0
- package/dist/components/Inputs/InputCurrency.js +105 -0
- package/dist/components/Inputs/InputMultiselect.d.ts +20 -0
- package/dist/components/Inputs/InputMultiselect.js +106 -0
- package/dist/components/Inputs/InputPercent.d.ts +40 -0
- package/dist/components/Inputs/InputPercent.js +100 -0
- package/dist/components/Inputs/InputSearch.d.ts +4 -0
- package/dist/components/Inputs/InputSearch.js +35 -0
- package/dist/components/Inputs/RangePicker.d.ts +18 -0
- package/dist/components/Inputs/RangePicker.js +132 -0
- package/dist/components/Inputs/TextArea.d.ts +4 -0
- package/dist/components/Inputs/TextArea.js +61 -0
- package/dist/components/Inputs/TextInput.d.ts +4 -0
- package/dist/components/Inputs/TextInput.js +74 -0
- package/dist/components/Inputs/Toggle.d.ts +20 -0
- package/dist/components/Inputs/Toggle.js +83 -0
- package/dist/components/Layout/Footers/FooterLayout.d.ts +5 -0
- package/dist/components/Layout/Footers/FooterLayout.js +80 -0
- package/dist/components/Layout/Headers/HeaderLayout.d.ts +85 -0
- package/dist/components/Layout/Headers/HeaderLayout.js +333 -0
- package/dist/components/Layout/Headers/HeaderSelectBranch.d.ts +38 -0
- package/dist/components/Layout/Headers/HeaderSelectBranch.js +153 -0
- package/dist/components/Layout/Sidebar.d.ts +4 -0
- package/dist/components/Layout/Sidebar.js +304 -0
- package/dist/components/Pagination/PaginationPrimary.d.ts +8 -0
- package/dist/components/Pagination/PaginationPrimary.js +40 -0
- package/dist/components/Table/TableHeader.d.ts +17 -0
- package/dist/components/Table/TableHeader.js +73 -0
- package/dist/components/Table/TableHeaderDiv.d.ts +33 -0
- package/dist/components/Table/TableHeaderDiv.js +121 -0
- package/dist/components/Table/TableRow.d.ts +4 -0
- package/dist/components/Table/TableRow.js +156 -0
- package/dist/components/Table/TableRowCards/TableRowCardChildren.d.ts +11 -0
- package/dist/components/Table/TableRowCards/TableRowCardChildren.js +68 -0
- package/dist/components/Table/TableRowCards/TableRowCardSimple.d.ts +12 -0
- package/dist/components/Table/TableRowCards/TableRowCardSimple.js +66 -0
- package/dist/components/Table/TableRowDiv.d.ts +59 -0
- package/dist/components/Table/TableRowDiv.js +329 -0
- package/dist/components/Tabs/Tabs.d.ts +15 -0
- package/dist/components/Tabs/Tabs.js +45 -0
- package/dist/components/Wrapper/Bounded.d.ts +30 -0
- package/dist/components/Wrapper/Bounded.js +17 -0
- package/dist/components/Wrapper/GlobalWrapper.d.ts +6 -0
- package/dist/components/Wrapper/GlobalWrapper.js +12 -0
- package/dist/components/Wrapper/Modals/Modal.d.ts +9 -0
- package/dist/components/Wrapper/Modals/Modal.js +77 -0
- package/dist/components/Wrapper/TableBodyBounded.d.ts +5 -0
- package/dist/components/Wrapper/TableBodyBounded.js +50 -0
- package/dist/components/Wrapper/TableBodyBoundedDiv.d.ts +6 -0
- package/dist/components/Wrapper/TableBodyBoundedDiv.js +11 -0
- package/dist/components/Wrapper/TableBounded.d.ts +18 -0
- package/dist/components/Wrapper/TableBounded.js +22 -0
- package/dist/components/Wrapper/TableBoundedDiv.d.ts +6 -0
- package/dist/components/Wrapper/TableBoundedDiv.js +11 -0
- package/dist/components/sections/components/Inputs/Toggle.d.ts +6 -0
- package/dist/components/sections/components/Inputs/Toggle.js +19 -0
- package/dist/components/sections/components/Loader/BtnLoader.d.ts +3 -0
- package/dist/components/sections/components/Loader/BtnLoader.js +15 -0
- package/dist/components/sections/components/Modals/ModalProvider.d.ts +4 -0
- package/dist/components/sections/components/Modals/ModalProvider.js +10 -0
- package/dist/components/sections/components/Modals/ModalSearchContentInHeader.d.ts +4 -0
- package/dist/components/sections/components/Modals/ModalSearchContentInHeader.js +104 -0
- package/dist/components/sections/components/Tabs/BreadCrumbs.d.ts +4 -0
- package/dist/components/sections/components/Tabs/BreadCrumbs.js +23 -0
- package/dist/components/sections/components/Tabs/TabsComponent.d.ts +4 -0
- package/dist/components/sections/components/Tabs/TabsComponent.js +109 -0
- package/dist/helper/formatNumberWithCommas.d.ts +1 -0
- package/dist/helper/formatNumberWithCommas.js +32 -0
- package/dist/helper/getValueByTypeInList.d.ts +2 -0
- package/dist/helper/getValueByTypeInList.js +7 -0
- package/dist/helper/modalStyleOperationHandler.d.ts +3 -0
- package/dist/helper/modalStyleOperationHandler.js +12 -0
- package/dist/helper/truncateText.d.ts +2 -0
- package/dist/helper/truncateText.js +19 -0
- package/dist/helper/useBackAndEscModal.d.ts +24 -0
- package/dist/helper/useBackAndEscModal.js +26 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +85 -0
- package/dist/styles/globals.css +176 -0
- package/dist/tailwind-preset.d.ts +42 -0
- package/dist/tailwind-preset.js +43 -0
- package/dist/tailwind-preset.ts +41 -0
- package/dist/types/AutoComplete/AutoComplete.d.ts +22 -0
- package/dist/types/AutoComplete/AutoComplete.js +2 -0
- package/dist/types/AutoComplete/AutoCompleteMultiSelect.d.ts +27 -0
- package/dist/types/AutoComplete/AutoCompleteMultiSelect.js +2 -0
- package/dist/types/BreakCrumbTypes.d.ts +12 -0
- package/dist/types/BreakCrumbTypes.js +2 -0
- package/dist/types/Buttons/PrimaryButton.d.ts +14 -0
- package/dist/types/Buttons/PrimaryButton.js +2 -0
- package/dist/types/Cards/AutoComplete&DropDown/CardsType.d.ts +30 -0
- package/dist/types/Cards/AutoComplete&DropDown/CardsType.js +2 -0
- package/dist/types/DropDown/DropDownMultiSelectType.d.ts +31 -0
- package/dist/types/DropDown/DropDownMultiSelectType.js +2 -0
- package/dist/types/DropDown/DropDownType.d.ts +30 -0
- package/dist/types/DropDown/DropDownType.js +2 -0
- package/dist/types/Inputs/AutoCompleteType.d.ts +37 -0
- package/dist/types/Inputs/AutoCompleteType.js +2 -0
- package/dist/types/Inputs/DaysCheckBoxType.d.ts +13 -0
- package/dist/types/Inputs/DaysCheckBoxType.js +2 -0
- package/dist/types/Inputs/DropDownType.d.ts +24 -0
- package/dist/types/Inputs/DropDownType.js +2 -0
- package/dist/types/Inputs/InputBarcodeType.d.ts +17 -0
- package/dist/types/Inputs/InputBarcodeType.js +2 -0
- package/dist/types/Inputs/InputCurrencyType.d.ts +17 -0
- package/dist/types/Inputs/InputCurrencyType.js +2 -0
- package/dist/types/Inputs/InputMultiselectType.d.ts +19 -0
- package/dist/types/Inputs/InputMultiselectType.js +2 -0
- package/dist/types/Inputs/InputSearchType.d.ts +19 -0
- package/dist/types/Inputs/InputSearchType.js +2 -0
- package/dist/types/Inputs/RangePickerType.d.ts +14 -0
- package/dist/types/Inputs/RangePickerType.js +2 -0
- package/dist/types/Inputs/TextAreaType.d.ts +12 -0
- package/dist/types/Inputs/TextAreaType.js +2 -0
- package/dist/types/Inputs/TextInputType.d.ts +20 -0
- package/dist/types/Inputs/TextInputType.js +2 -0
- package/dist/types/Inputs/ToggleType.d.ts +11 -0
- package/dist/types/Inputs/ToggleType.js +2 -0
- package/dist/types/Layout/Headers/HeaderLayout.d.ts +75 -0
- package/dist/types/Layout/Headers/HeaderLayout.js +2 -0
- package/dist/types/Layout/Sidebar.d.ts +21 -0
- package/dist/types/Layout/Sidebar.js +2 -0
- package/dist/types/Layout/SidebarType.d.ts +42 -0
- package/dist/types/Layout/SidebarType.js +2 -0
- package/dist/types/Modals/ModalProviderType.d.ts +4 -0
- package/dist/types/Modals/ModalProviderType.js +2 -0
- package/dist/types/Modals/ModalSearchContentInHeaderPropsType.d.ts +10 -0
- package/dist/types/Modals/ModalSearchContentInHeaderPropsType.js +2 -0
- package/dist/types/Table/TableRowType.d.ts +41 -0
- package/dist/types/Table/TableRowType.js +2 -0
- package/dist/types/TabsType.d.ts +24 -0
- package/dist/types/TabsType.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +17 -0
- package/package.json +44 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
const image_1 = __importDefault(require("next/image"));
|
|
41
|
+
const react_1 = __importStar(require("react"));
|
|
42
|
+
const getValueByTypeInList_1 = require("../../helper/getValueByTypeInList");
|
|
43
|
+
const Toggle_1 = __importDefault(require("../sections/components/Inputs/Toggle"));
|
|
44
|
+
const TableRowCardSimple_1 = __importDefault(require("./TableRowCards/TableRowCardSimple"));
|
|
45
|
+
const modalStyleOperationHandler_1 = require("../../helper/modalStyleOperationHandler");
|
|
46
|
+
const TableRow = ({ itemId, data, modalPosition, modalData, modalClickHandler, editClickHandler, iconsSRC, changeStatusToggleHandler, modalOpenHandler, isShowToggle, type, lastTrHeight, hasEdit = true, isShowModalProps = true, operation = true, trOnClickHandler, isShowCheckbox = false, selectHandle, }) => {
|
|
47
|
+
const [isShowModal, setIsShowModal] = (0, react_1.useState)(false);
|
|
48
|
+
const [isMobileCard, setIsMobileCard] = (0, react_1.useState)(false);
|
|
49
|
+
const [activeItemId, setActiveItemId] = (0, react_1.useState)(null);
|
|
50
|
+
const modalRef = (0, react_1.useRef)(null);
|
|
51
|
+
(0, react_1.useEffect)(() => {
|
|
52
|
+
if (modalOpenHandler !== undefined) {
|
|
53
|
+
modalOpenHandler(isShowModal);
|
|
54
|
+
}
|
|
55
|
+
}, [isShowModal]);
|
|
56
|
+
// Handle clicking outside the modal
|
|
57
|
+
(0, react_1.useEffect)(() => {
|
|
58
|
+
const handleClickOutside = (event) => {
|
|
59
|
+
if (modalRef.current && !modalRef.current.contains(event.target)) {
|
|
60
|
+
setIsShowModal(false);
|
|
61
|
+
setActiveItemId(null);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
if (isShowModal) {
|
|
65
|
+
window.addEventListener('click', handleClickOutside);
|
|
66
|
+
}
|
|
67
|
+
return () => {
|
|
68
|
+
window.removeEventListener('click', handleClickOutside);
|
|
69
|
+
};
|
|
70
|
+
}, [isShowModal]);
|
|
71
|
+
// Detect mobile view
|
|
72
|
+
(0, react_1.useEffect)(() => {
|
|
73
|
+
const handleResize = () => {
|
|
74
|
+
setIsMobileCard(window.innerWidth < 1280);
|
|
75
|
+
};
|
|
76
|
+
handleResize();
|
|
77
|
+
window.addEventListener('resize', handleResize);
|
|
78
|
+
return () => {
|
|
79
|
+
window.removeEventListener('resize', handleResize);
|
|
80
|
+
};
|
|
81
|
+
}, []);
|
|
82
|
+
const handleModalToggle = (itemId) => {
|
|
83
|
+
if (activeItemId === itemId) {
|
|
84
|
+
setIsShowModal(false);
|
|
85
|
+
setActiveItemId(null);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setIsShowModal(true);
|
|
89
|
+
setActiveItemId(itemId);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, !isMobileCard ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
93
|
+
react_1.default.createElement("tr", { className: "w-full h-1 " }),
|
|
94
|
+
react_1.default.createElement("tr", { style: { borderRadius: '12px' }, onClick: () => trOnClickHandler && itemId !== undefined && trOnClickHandler(itemId), className: `group trShadow ${trOnClickHandler && itemId ? 'cursor-pointer' : 'cursor-default'}` },
|
|
95
|
+
data &&
|
|
96
|
+
data.length > 0 &&
|
|
97
|
+
data.map((item, index) => {
|
|
98
|
+
if (type === 'simple') {
|
|
99
|
+
return (react_1.default.createElement(react_1.default.Fragment, { key: index },
|
|
100
|
+
react_1.default.createElement(TableRowCardSimple_1.default, { data: item, index: index, operation: operation, length: data.length, isShowCheckbox: isShowCheckbox, itemId: itemId, selectHandle: selectHandle })));
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
operation && (react_1.default.createElement("td", { className: "px-4 py-3 relative rounded-l-tiny" },
|
|
107
|
+
react_1.default.createElement("div", { className: "flex items-center justify-end gap-2" },
|
|
108
|
+
react_1.default.createElement("button", { onClick: () => editClickHandler(data[0].itemId), className: `p-1 ${hasEdit ? 'flex' : 'hidden'}` },
|
|
109
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.editIcon, alt: "\u0648\u06CC\u0631\u0627\u06CC\u0634", width: 20, height: 20 })),
|
|
110
|
+
react_1.default.createElement("button", { onClick: (e) => {
|
|
111
|
+
e.stopPropagation();
|
|
112
|
+
if (isShowModalProps) {
|
|
113
|
+
handleModalToggle(data[0].itemId);
|
|
114
|
+
}
|
|
115
|
+
}, className: `p-1 ${isShowModalProps ? 'opacity-100' : 'opacity-50'}` },
|
|
116
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.menuIcon, alt: "\u0645\u0646\u0648", width: 20, height: 20 }))),
|
|
117
|
+
isShowModal && isShowModalProps && activeItemId === data[0].itemId && (react_1.default.createElement("div", { ref: modalRef, className: `modal-content absolute ${modalPosition ? 'top-10' : 'bottom-10'} left-7 w-40 bg-white-color customShadowBox rounded-md px-tiny py-2 z-10` },
|
|
118
|
+
react_1.default.createElement("ul", { className: "flex flex-col gap-1 items-start justify-center" }, modalData.map((item) => (react_1.default.createElement("li", { onClick: () => modalClickHandler({
|
|
119
|
+
modalItemId: item.id,
|
|
120
|
+
modalText: item.text,
|
|
121
|
+
itemId: data[0].itemId,
|
|
122
|
+
}), key: item.id, className: `text-sm text-opacity-70 font-normal p-1 rounded-md ${(0, modalStyleOperationHandler_1.modalStyleOperationHandler)(item.class)} customTransition cursor-pointer w-full` }, item.text))))))))),
|
|
123
|
+
react_1.default.createElement("tr", { style: { height: lastTrHeight || '4px' }, className: "w-full" }))) : (
|
|
124
|
+
// Mobile View
|
|
125
|
+
react_1.default.createElement("tr", { className: "w-auto h-auto flex flex-row items-center justify-center" },
|
|
126
|
+
react_1.default.createElement("td", { className: "w-full" },
|
|
127
|
+
react_1.default.createElement("div", { className: "bg-white-color border border-solid border-gray-secondary rounded-tiny w-full h-36 relative px-2 py-0.5 flex flex-col justify-between" },
|
|
128
|
+
react_1.default.createElement("div", { className: "flex items-center justify-end gap-2 p-2" },
|
|
129
|
+
react_1.default.createElement("button", { onClick: () => editClickHandler(data[0].itemId), className: `p-1 ${hasEdit ? 'flex' : 'hidden'}` },
|
|
130
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.editIcon, alt: "\u0648\u06CC\u0631\u0627\u06CC\u0634", width: 20, height: 20 })),
|
|
131
|
+
react_1.default.createElement("button", { onClick: (e) => {
|
|
132
|
+
e.stopPropagation();
|
|
133
|
+
if (isShowModalProps) {
|
|
134
|
+
handleModalToggle(data[0].itemId);
|
|
135
|
+
}
|
|
136
|
+
}, className: `p-1 ${isShowModalProps ? 'opacity-100' : 'opacity-50'}` },
|
|
137
|
+
react_1.default.createElement(image_1.default, { src: iconsSRC.menuIcon, alt: "\u0645\u0646\u0648", width: 20, height: 20 }))),
|
|
138
|
+
isShowModal && isShowModalProps && activeItemId === data[0].itemId && (react_1.default.createElement("div", { ref: modalRef, className: `modal-content absolute ${modalPosition ? 'top-10' : 'bottom-10'} left-7 w-40 bg-white-color customShadowBox rounded-md py-3 px-4 z-10` },
|
|
139
|
+
react_1.default.createElement("ul", { className: "flex flex-col gap-4 items-start justify-center" }, modalData.map((item, index) => (react_1.default.createElement("li", { onClick: () => modalClickHandler({
|
|
140
|
+
modalItemId: item.id,
|
|
141
|
+
modalText: item.text,
|
|
142
|
+
itemId: data[0].itemId,
|
|
143
|
+
}), key: item.id, className: `text-sm ${index === modalData.length - 1
|
|
144
|
+
? 'text-red-primary'
|
|
145
|
+
: 'text-text-color-primary'} text-opacity-70 font-normal cursor-pointer w-full` }, item.text)))))),
|
|
146
|
+
react_1.default.createElement("div", { className: "w-full h-full" },
|
|
147
|
+
react_1.default.createElement("div", { className: "text-sm text-text-color-primary flex flex-col gap-1 mt-[6px]" },
|
|
148
|
+
react_1.default.createElement("h2", null, (0, getValueByTypeInList_1.getValueByType)(data, 'name')),
|
|
149
|
+
react_1.default.createElement("h3", { className: "opacity-50" }, (0, getValueByTypeInList_1.getValueByType)(data, 'date')))),
|
|
150
|
+
(0, getValueByTypeInList_1.getValueByType)(data, 'status') && (0, getValueByTypeInList_1.getValueByType)(data, 'status') !== false && (react_1.default.createElement("div", { className: `flex flex-row items-center ${isShowToggle ? 'justify-between' : 'justify-end'} w-full` },
|
|
151
|
+
react_1.default.createElement("h2", { className: `w-16 h-9 flex flex-row items-center justify-center text-xs font-normal text-opacity-80 rounded-tiny ${(0, getValueByTypeInList_1.getValueByType)(data, 'status') === 'فعال'
|
|
152
|
+
? 'text-green-600 bg-green-600 bg-opacity-30'
|
|
153
|
+
: 'text-red-primary bg-red-primary bg-opacity-30'}` }, (0, getValueByTypeInList_1.getValueByType)(data, 'status')),
|
|
154
|
+
isShowToggle && (react_1.default.createElement(Toggle_1.default, { isChecked: (0, getValueByTypeInList_1.getValueByType)(data, 'status') === 'فعال', changeStatusToggleHandler: changeStatusToggleHandler }))))))))));
|
|
155
|
+
};
|
|
156
|
+
exports.default = TableRow;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataTRType } from '../../../types/Table/TableRowType';
|
|
3
|
+
declare const TableRowHasChildren: ({ data, index, isShowCheckbox, length, selectHandle, itemId, }: {
|
|
4
|
+
data: DataTRType;
|
|
5
|
+
index: number;
|
|
6
|
+
length: number;
|
|
7
|
+
isShowCheckbox: boolean;
|
|
8
|
+
selectHandle?: (itemId: number) => void;
|
|
9
|
+
itemId?: number;
|
|
10
|
+
}) => React.JSX.Element;
|
|
11
|
+
export default TableRowHasChildren;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const formatNumberWithCommas_1 = require("../../../helper/formatNumberWithCommas");
|
|
8
|
+
const TableRowHasChildren = ({ data, index, isShowCheckbox, length, selectHandle, itemId, }) => {
|
|
9
|
+
const [isChecked, setIsChecked] = react_1.default.useState(false);
|
|
10
|
+
const isStatus = data.type === 'status';
|
|
11
|
+
const isPrice = data.type === 'price';
|
|
12
|
+
const hasChildren = data.children ? true : false;
|
|
13
|
+
const renderContent = () => {
|
|
14
|
+
if (isStatus) {
|
|
15
|
+
return (react_1.default.createElement("div", { style: {
|
|
16
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
17
|
+
...data.inlineCSS,
|
|
18
|
+
} },
|
|
19
|
+
react_1.default.createElement("span", { className: `
|
|
20
|
+
px-0 py-3 w-full rounded-full truncate
|
|
21
|
+
${data.statusClass === 'danger' ? 'danger' : ''}
|
|
22
|
+
${data.statusClass === 'info' ? 'info' : ''}
|
|
23
|
+
${data.statusClass === 'primary' ? 'primary' : ''}
|
|
24
|
+
${data.statusClass === 'secondary' ? 'secondary' : ''}
|
|
25
|
+
${data.statusClass === 'success' ? 'success' : ''}
|
|
26
|
+
${data.statusClass === 'warning' ? 'warning' : ''}
|
|
27
|
+
font-semibold whitespace-nowrap min-w-[74px]
|
|
28
|
+
` }, data.value)));
|
|
29
|
+
}
|
|
30
|
+
else if (isPrice) {
|
|
31
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
32
|
+
react_1.default.createElement("div", { style: {
|
|
33
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
34
|
+
...data.inlineCSS,
|
|
35
|
+
} },
|
|
36
|
+
react_1.default.createElement("span", { className: `text-gray-900 w-full block ${data.statusClass === 'danger' ? 'dangerPrice' : ''}
|
|
37
|
+
${data.statusClass === 'info' ? 'infoPrice' : ''}
|
|
38
|
+
${data.statusClass === 'primary' ? 'primaryPrice' : ''}
|
|
39
|
+
${data.statusClass === 'secondary' ? 'secondaryPrice' : ''}
|
|
40
|
+
${data.statusClass === 'success' ? 'successPrice' : ''}
|
|
41
|
+
${data.statusClass === 'warning' ? 'warningPrice' : ''}` }, data.value ? (0, formatNumberWithCommas_1.formatNumberWithCommas)(data.value, 3) : ''))));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return (react_1.default.createElement("div", { style: {
|
|
45
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
46
|
+
...data.inlineCSS,
|
|
47
|
+
} },
|
|
48
|
+
react_1.default.createElement("span", { className: 'text-gray-900 w-full block' }, data.value)));
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
return (react_1.default.createElement("td", { style: {
|
|
52
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
53
|
+
marginRight: '50px',
|
|
54
|
+
}, id: data?.itemId?.toString(), className: `
|
|
55
|
+
py-3 px-0 text-sm
|
|
56
|
+
${index === 0 ? 'rounded-r-xl' : ''}
|
|
57
|
+
min-w-[120px]
|
|
58
|
+
${index === 0 || index === length - 1 ? 'px-4' : 'px-0'}
|
|
59
|
+
` }, isShowCheckbox ? (react_1.default.createElement("div", { className: 'flex items-center flex-row gap-2' },
|
|
60
|
+
isShowCheckbox && index === 0 && (react_1.default.createElement("div", { onClick: () => {
|
|
61
|
+
setIsChecked(!isChecked);
|
|
62
|
+
if (selectHandle && itemId) {
|
|
63
|
+
selectHandle(itemId);
|
|
64
|
+
}
|
|
65
|
+
}, className: ` ${isChecked ? 'bg-gray-primary' : 'bg-inherit'} cursor-pointer rounded-[6px] border-solid border-[0.5px] w-4 h-4` })),
|
|
66
|
+
renderContent())) : (renderContent())));
|
|
67
|
+
};
|
|
68
|
+
exports.default = TableRowHasChildren;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DataTRType } from '../../../types/Table/TableRowType';
|
|
3
|
+
declare const TableRowCardSimple: ({ data, index, operation, isShowCheckbox, length, selectHandle, itemId, }: {
|
|
4
|
+
data: DataTRType;
|
|
5
|
+
index: number;
|
|
6
|
+
operation: boolean;
|
|
7
|
+
length: number;
|
|
8
|
+
isShowCheckbox: boolean;
|
|
9
|
+
selectHandle?: (itemId: number) => void;
|
|
10
|
+
itemId?: number;
|
|
11
|
+
}) => React.JSX.Element;
|
|
12
|
+
export default TableRowCardSimple;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const formatNumberWithCommas_1 = require("../../../helper/formatNumberWithCommas");
|
|
8
|
+
const TableRowCardSimple = ({ data, index, operation, isShowCheckbox, length, selectHandle, itemId, }) => {
|
|
9
|
+
const [isChecked, setIsChecked] = react_1.default.useState(false);
|
|
10
|
+
const isStatus = data.type === 'status';
|
|
11
|
+
const isPrice = data.type === 'price';
|
|
12
|
+
const renderContent = () => {
|
|
13
|
+
if (isStatus) {
|
|
14
|
+
return (react_1.default.createElement("div", { style: {
|
|
15
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
16
|
+
...data.inlineCSS,
|
|
17
|
+
} },
|
|
18
|
+
react_1.default.createElement("span", { className: `
|
|
19
|
+
px-0 py-3 w-full rounded-full truncate
|
|
20
|
+
${data.statusClass === 'danger' ? 'danger' : ''}
|
|
21
|
+
${data.statusClass === 'info' ? 'info' : ''}
|
|
22
|
+
${data.statusClass === 'primary' ? 'primary' : ''}
|
|
23
|
+
${data.statusClass === 'secondary' ? 'secondary' : ''}
|
|
24
|
+
${data.statusClass === 'success' ? 'success' : ''}
|
|
25
|
+
${data.statusClass === 'warning' ? 'warning' : ''}
|
|
26
|
+
font-semibold whitespace-nowrap min-w-[74px]
|
|
27
|
+
` }, data.value)));
|
|
28
|
+
}
|
|
29
|
+
else if (isPrice) {
|
|
30
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
31
|
+
react_1.default.createElement("div", { style: {
|
|
32
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
33
|
+
...data.inlineCSS,
|
|
34
|
+
} },
|
|
35
|
+
react_1.default.createElement("span", { className: `text-gray-900 w-full block ${data.statusClass === 'danger' ? 'dangerPrice' : ''}
|
|
36
|
+
${data.statusClass === 'info' ? 'infoPrice' : ''}
|
|
37
|
+
${data.statusClass === 'primary' ? 'primaryPrice' : ''}
|
|
38
|
+
${data.statusClass === 'secondary' ? 'secondaryPrice' : ''}
|
|
39
|
+
${data.statusClass === 'success' ? 'successPrice' : ''}
|
|
40
|
+
${data.statusClass === 'warning' ? 'warningPrice' : ''}` }, data.value ? (0, formatNumberWithCommas_1.formatNumberWithCommas)(data.value, 3) : ''))));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return (react_1.default.createElement("div", { style: {
|
|
44
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
45
|
+
...data.inlineCSS,
|
|
46
|
+
} },
|
|
47
|
+
react_1.default.createElement("span", { className: 'text-gray-900 w-full block' }, data.value)));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
return (react_1.default.createElement("td", { style: {
|
|
51
|
+
textAlign: data?.textAlign ? data.textAlign : 'right',
|
|
52
|
+
}, id: data?.itemId?.toString(), className: `
|
|
53
|
+
py-3 px-0 text-sm
|
|
54
|
+
${index === 0 ? 'rounded-r-xl' : ''}
|
|
55
|
+
min-w-[120px]
|
|
56
|
+
${index === 0 || index === length - 1 ? 'px-4' : 'px-0'}
|
|
57
|
+
` }, isShowCheckbox ? (react_1.default.createElement("div", { className: 'flex items-center flex-row gap-2' },
|
|
58
|
+
isShowCheckbox && index === 0 && (react_1.default.createElement("div", { onClick: () => {
|
|
59
|
+
setIsChecked(!isChecked);
|
|
60
|
+
if (selectHandle && itemId) {
|
|
61
|
+
selectHandle(itemId);
|
|
62
|
+
}
|
|
63
|
+
}, className: ` ${isChecked ? 'bg-gray-primary' : 'bg-inherit'} cursor-pointer rounded-[6px] border-solid border-[0.5px] w-4 h-4` })),
|
|
64
|
+
renderContent())) : (renderContent())));
|
|
65
|
+
};
|
|
66
|
+
exports.default = TableRowCardSimple;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare enum ModalAction {
|
|
3
|
+
Edit = 1,
|
|
4
|
+
ToggleStatus = 2,
|
|
5
|
+
Delete = 3,
|
|
6
|
+
ChangeRoute = 4
|
|
7
|
+
}
|
|
8
|
+
export interface modalTRData {
|
|
9
|
+
text: string;
|
|
10
|
+
id: number;
|
|
11
|
+
class?: 'delete';
|
|
12
|
+
}
|
|
13
|
+
interface TableRowDivProps {
|
|
14
|
+
data: {
|
|
15
|
+
id: number;
|
|
16
|
+
content: string;
|
|
17
|
+
type: 'text' | 'date' | 'status' | 'price' | 'image' | 'operation';
|
|
18
|
+
statusClass?: 'danger' | 'success' | 'warning' | 'info' | 'primary' | 'secondary';
|
|
19
|
+
inlineCss?: {
|
|
20
|
+
width?: string | number;
|
|
21
|
+
[key: string]: any;
|
|
22
|
+
};
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
}[];
|
|
25
|
+
index: number;
|
|
26
|
+
isLastIndex: boolean;
|
|
27
|
+
hasChildren: boolean;
|
|
28
|
+
childrenData?: {
|
|
29
|
+
id: number;
|
|
30
|
+
content: string;
|
|
31
|
+
status: string | number;
|
|
32
|
+
statusDescription: string;
|
|
33
|
+
date: string;
|
|
34
|
+
onStatusChange?: (childId: number, newStatus: number) => void;
|
|
35
|
+
onChangeRoute?: (childId: number) => void;
|
|
36
|
+
onDelete?: (childId: number) => void;
|
|
37
|
+
}[];
|
|
38
|
+
itemId: number;
|
|
39
|
+
itemClickHandler?: (id: number) => void;
|
|
40
|
+
iconsSRC?: {
|
|
41
|
+
editIcon?: string;
|
|
42
|
+
menuIcon?: string;
|
|
43
|
+
};
|
|
44
|
+
editClickHandler?: (id: number | null) => void;
|
|
45
|
+
modalPosition?: boolean;
|
|
46
|
+
modalData?: modalTRData[];
|
|
47
|
+
modalClickHandler?: (params: {
|
|
48
|
+
modalItemId: number;
|
|
49
|
+
modalText: string;
|
|
50
|
+
}) => void;
|
|
51
|
+
hasModal?: boolean;
|
|
52
|
+
hasSelect?: boolean;
|
|
53
|
+
selectHandler?: (id: number | null) => void;
|
|
54
|
+
isChild?: boolean;
|
|
55
|
+
isShowToggle?: boolean;
|
|
56
|
+
onStatusChange?: (childId: number, newStatus: number) => void;
|
|
57
|
+
}
|
|
58
|
+
declare const TableRowDiv: ({ index, data, isLastIndex, itemId, itemClickHandler, iconsSRC, editClickHandler, modalPosition, modalData, modalClickHandler, hasChildren, childrenData, hasSelect, hasModal, selectHandler, isChild, isShowToggle, }: TableRowDivProps) => React.JSX.Element;
|
|
59
|
+
export default TableRowDiv;
|