@open-tender/utils 0.1.12 → 0.1.14
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.
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Address, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { Address, FormFieldType, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export declare const useAddressForm: (address: Address, loading: RequestStatus, error: any, update: (addressId: number, updatedData: Address, callback: () => void) => void, callback: () => void) => {
|
|
4
|
-
fields:
|
|
5
|
-
label: string;
|
|
6
|
-
name: string;
|
|
7
|
-
type: string;
|
|
8
|
-
}[];
|
|
4
|
+
fields: FormFieldType[];
|
|
9
5
|
data: Address;
|
|
10
6
|
errors: any;
|
|
11
7
|
submitting: boolean;
|
|
@@ -3,12 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useAddressForm = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const utils_1 = require("../utils");
|
|
6
|
-
// interface AddressFormField {
|
|
7
|
-
// label: string
|
|
8
|
-
// name: string
|
|
9
|
-
// type: string
|
|
10
|
-
// required?: boolean
|
|
11
|
-
// }
|
|
12
6
|
const useAddressForm = (address, loading, error, update, callback) => {
|
|
13
7
|
const submitRef = (0, react_1.useRef)(null);
|
|
14
8
|
const inputRef = (0, react_1.useRef)(null);
|
|
@@ -16,12 +10,32 @@ const useAddressForm = (address, loading, error, update, callback) => {
|
|
|
16
10
|
const [errors, setErrors] = (0, react_1.useState)({});
|
|
17
11
|
const [submitting, setSubmitting] = (0, react_1.useState)(false);
|
|
18
12
|
const fields = [
|
|
19
|
-
{ label: 'Company', name: 'company', type: '
|
|
20
|
-
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
{ label: 'Company', name: 'company', type: 'text', fieldType: 'Input' },
|
|
14
|
+
{
|
|
15
|
+
label: 'Contact Person',
|
|
16
|
+
name: 'contact',
|
|
17
|
+
type: 'text',
|
|
18
|
+
fieldType: 'Input'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
label: 'Contact Phone',
|
|
22
|
+
name: 'phone',
|
|
23
|
+
type: 'tel',
|
|
24
|
+
fieldType: 'Input'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
label: 'Description',
|
|
28
|
+
name: 'description',
|
|
29
|
+
type: 'text',
|
|
30
|
+
fieldType: 'Input'
|
|
31
|
+
},
|
|
32
|
+
{ label: 'Notes', name: 'notes', type: 'text', fieldType: 'Input' },
|
|
33
|
+
{
|
|
34
|
+
label: 'Is Default',
|
|
35
|
+
name: 'is_default',
|
|
36
|
+
type: 'checkbox',
|
|
37
|
+
fieldType: 'Checkbox'
|
|
38
|
+
}
|
|
25
39
|
];
|
|
26
40
|
(0, react_1.useEffect)(() => {
|
|
27
41
|
var _a, _b;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Address, RequestStatus } from '@open-tender/types';
|
|
2
|
+
import { Address, FormFieldType, RequestStatus } from '@open-tender/types';
|
|
3
3
|
export declare const useAddressForm: (address: Address, loading: RequestStatus, error: any, update: (addressId: number, updatedData: Address, callback: () => void) => void, callback: () => void) => {
|
|
4
|
-
fields:
|
|
5
|
-
label: string;
|
|
6
|
-
name: string;
|
|
7
|
-
type: string;
|
|
8
|
-
}[];
|
|
4
|
+
fields: FormFieldType[];
|
|
9
5
|
data: Address;
|
|
10
6
|
errors: any;
|
|
11
7
|
submitting: boolean;
|
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
|
2
2
|
import { makePhone } from '../utils';
|
|
3
|
-
// interface AddressFormField {
|
|
4
|
-
// label: string
|
|
5
|
-
// name: string
|
|
6
|
-
// type: string
|
|
7
|
-
// required?: boolean
|
|
8
|
-
// }
|
|
9
3
|
export const useAddressForm = (address, loading, error, update, callback) => {
|
|
10
4
|
const submitRef = useRef(null);
|
|
11
5
|
const inputRef = useRef(null);
|
|
@@ -13,12 +7,32 @@ export const useAddressForm = (address, loading, error, update, callback) => {
|
|
|
13
7
|
const [errors, setErrors] = useState({});
|
|
14
8
|
const [submitting, setSubmitting] = useState(false);
|
|
15
9
|
const fields = [
|
|
16
|
-
{ label: 'Company', name: 'company', type: '
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
10
|
+
{ label: 'Company', name: 'company', type: 'text', fieldType: 'Input' },
|
|
11
|
+
{
|
|
12
|
+
label: 'Contact Person',
|
|
13
|
+
name: 'contact',
|
|
14
|
+
type: 'text',
|
|
15
|
+
fieldType: 'Input'
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
label: 'Contact Phone',
|
|
19
|
+
name: 'phone',
|
|
20
|
+
type: 'tel',
|
|
21
|
+
fieldType: 'Input'
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
label: 'Description',
|
|
25
|
+
name: 'description',
|
|
26
|
+
type: 'text',
|
|
27
|
+
fieldType: 'Input'
|
|
28
|
+
},
|
|
29
|
+
{ label: 'Notes', name: 'notes', type: 'text', fieldType: 'Input' },
|
|
30
|
+
{
|
|
31
|
+
label: 'Is Default',
|
|
32
|
+
name: 'is_default',
|
|
33
|
+
type: 'checkbox',
|
|
34
|
+
fieldType: 'Checkbox'
|
|
35
|
+
}
|
|
22
36
|
];
|
|
23
37
|
useEffect(() => {
|
|
24
38
|
var _a, _b;
|
package/package.json
CHANGED