@homefile/components-v2 2.24.4 → 2.24.6
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/components/forms/dynamicForm/fields/GridField.js +1 -1
- package/dist/components/receipts/receipt/ReceiptItems.js +1 -1
- package/dist/hooks/forms/useDynamicForm.js +1 -0
- package/dist/mocks/forms/dynamicForm.mock.js +23 -2
- package/package.json +1 -1
- package/src/components/forms/dynamicForm/fields/GridField.tsx +1 -1
- package/src/components/receipts/receipt/ReceiptItems.tsx +1 -1
- package/src/hooks/forms/useDynamicForm.ts +1 -0
- package/src/mocks/forms/dynamicForm.mock.ts +23 -2
|
@@ -4,7 +4,7 @@ import { Flex } from '@chakra-ui/react';
|
|
|
4
4
|
import { DateField, NumberField, TextField, SelectField, CurrencyField, SingleImage, } from '../../..';
|
|
5
5
|
import { fieldIcons } from '../../../../helpers';
|
|
6
6
|
export const GridField = ({ children, onRemove, onUpload, showIcon, }) => {
|
|
7
|
-
return (_jsx(Flex, { align: "stretch", gap: "base", children: children === null || children === void 0 ? void 0 : children.map(({ id, description, label, name, value, type, options = [], icon }) => {
|
|
7
|
+
return (_jsx(Flex, { align: "stretch", gap: "base", flex: "1", children: children === null || children === void 0 ? void 0 : children.map(({ id, description, label, name, value, type, options = [], icon }) => {
|
|
8
8
|
const baseProps = {
|
|
9
9
|
id,
|
|
10
10
|
value,
|
|
@@ -10,6 +10,6 @@ export const ReceiptItems = ({ isSelectDisabled = true, leftOptions = [], onItem
|
|
|
10
10
|
});
|
|
11
11
|
return (_jsxs(Box, { mb: "10rem", children: [_jsxs(Stack, { bg: "lightBlue.2", px: "4", pb: "base", pt: "2", children: [_jsx(Text, { textTransform: "uppercase", variant: "home", children: title }), _jsxs(Flex, { gap: "base", align: "center", children: [_jsx(Checkbox, { onChange: handleSelectAll }), _jsx(DoubleSelects, { isSelectDisabled: isSelectDisabled, leftOptions: leftOptions, rightOptions: rightOptions, onLeftSelectChange: onLeftSelectChange, onRightSelectChange: onRightSelectChange })] })] }), receipts.map((receipt) => {
|
|
12
12
|
const hasRoomType = !!(receipt === null || receipt === void 0 ? void 0 : receipt.roomType);
|
|
13
|
-
return (_jsxs(Box, { children: [!hasRoomType && (_jsx(ReceiptItem, Object.assign({ onChange: () => handleItemSelect(receipt._id), isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, onEditClick: () => onEditReceipt === null || onEditReceipt === void 0 ? void 0 : onEditReceipt(receipt.
|
|
13
|
+
return (_jsxs(Box, { children: [!hasRoomType && (_jsx(ReceiptItem, Object.assign({ onChange: () => handleItemSelect(receipt._id), isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, onEditClick: () => onEditReceipt === null || onEditReceipt === void 0 ? void 0 : onEditReceipt(receipt.sku), selectItems: receiptOptions, variant: variant }, receipt))), hasRoomType && (_jsx(ReceiptItemAssigned, Object.assign({ onChange: () => handleItemSelect(receipt._id), onRoomClick: onRoomClick, isChecked: isItemSelected(receipt._id), onSelectedChange: onReceiptSelectedChange, initialSelectValue: receiptOptions === null || receiptOptions === void 0 ? void 0 : receiptOptions[1], selectItems: receiptOptions, variant: variant }, receipt)))] }, receipt._id));
|
|
14
14
|
})] }));
|
|
15
15
|
};
|
|
@@ -48,9 +48,30 @@ export const formFieldsMock = [
|
|
|
48
48
|
description: faker.lorem.sentence(),
|
|
49
49
|
comments: faker.lorem.sentence(),
|
|
50
50
|
value: '',
|
|
51
|
-
type: '
|
|
51
|
+
type: 'grid',
|
|
52
52
|
visible: true,
|
|
53
|
-
|
|
53
|
+
children: [
|
|
54
|
+
{
|
|
55
|
+
id: faker.database.mongodbObjectId(),
|
|
56
|
+
name: '',
|
|
57
|
+
label: 'Phone',
|
|
58
|
+
description: faker.lorem.sentence(),
|
|
59
|
+
comments: faker.lorem.sentence(),
|
|
60
|
+
value: '',
|
|
61
|
+
type: 'telephone',
|
|
62
|
+
visible: true,
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
id: faker.database.mongodbObjectId(),
|
|
66
|
+
name: '',
|
|
67
|
+
label: 'Email',
|
|
68
|
+
description: faker.lorem.sentence(),
|
|
69
|
+
comments: faker.lorem.sentence(),
|
|
70
|
+
value: '',
|
|
71
|
+
type: 'email',
|
|
72
|
+
visible: true,
|
|
73
|
+
},
|
|
74
|
+
],
|
|
54
75
|
},
|
|
55
76
|
{
|
|
56
77
|
id: faker.database.mongodbObjectId(),
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@ export const GridField = ({
|
|
|
17
17
|
showIcon,
|
|
18
18
|
}: GridFieldI) => {
|
|
19
19
|
return (
|
|
20
|
-
<Flex align="stretch" gap="base">
|
|
20
|
+
<Flex align="stretch" gap="base" flex="1">
|
|
21
21
|
{children?.map(
|
|
22
22
|
({ id, description, label, name, value, type, options = [], icon }) => {
|
|
23
23
|
const baseProps = {
|
|
@@ -51,7 +51,7 @@ export const ReceiptItems = ({
|
|
|
51
51
|
onChange={() => handleItemSelect(receipt._id)}
|
|
52
52
|
isChecked={isItemSelected(receipt._id)}
|
|
53
53
|
onSelectedChange={onReceiptSelectedChange}
|
|
54
|
-
onEditClick={() => onEditReceipt?.(receipt.
|
|
54
|
+
onEditClick={() => onEditReceipt?.(receipt.sku)}
|
|
55
55
|
selectItems={receiptOptions}
|
|
56
56
|
variant={variant}
|
|
57
57
|
{...receipt}
|
|
@@ -51,9 +51,30 @@ export const formFieldsMock: ReportI[] = [
|
|
|
51
51
|
description: faker.lorem.sentence(),
|
|
52
52
|
comments: faker.lorem.sentence(),
|
|
53
53
|
value: '',
|
|
54
|
-
type: '
|
|
54
|
+
type: 'grid',
|
|
55
55
|
visible: true,
|
|
56
|
-
|
|
56
|
+
children: [
|
|
57
|
+
{
|
|
58
|
+
id: faker.database.mongodbObjectId(),
|
|
59
|
+
name: '',
|
|
60
|
+
label: 'Phone',
|
|
61
|
+
description: faker.lorem.sentence(),
|
|
62
|
+
comments: faker.lorem.sentence(),
|
|
63
|
+
value: '',
|
|
64
|
+
type: 'telephone',
|
|
65
|
+
visible: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: faker.database.mongodbObjectId(),
|
|
69
|
+
name: '',
|
|
70
|
+
label: 'Email',
|
|
71
|
+
description: faker.lorem.sentence(),
|
|
72
|
+
comments: faker.lorem.sentence(),
|
|
73
|
+
value: '',
|
|
74
|
+
type: 'email',
|
|
75
|
+
visible: true,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
57
78
|
},
|
|
58
79
|
{
|
|
59
80
|
id: faker.database.mongodbObjectId(),
|