form-payload 1.0.3 → 1.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "form-payload",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "Gets form-payload via form.elements",
5
5
  "keywords": [
6
6
  "form",
@@ -17,6 +17,10 @@
17
17
  "type": "git",
18
18
  "url": "git+https://github.com/what1s1ove/form-payload.git"
19
19
  },
20
+ "bugs": {
21
+ "url": "https://github.com/what1s1ove/form-payload/issues",
22
+ "email": "hello@whatislove.dev"
23
+ },
20
24
  "license": "MIT",
21
25
  "type": "module",
22
26
  "main": "./src/index.js",
package/readme.md CHANGED
@@ -72,7 +72,6 @@ PS. _The library works perfectly with any framework. Just use a valid [HTMLFormE
72
72
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="url"` | ✅ | `string` |
73
73
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="tel"` | ✅ | `string` |
74
74
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="color"` | ✅ | `string` |
75
- | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="datetime-local"` | ✅ | `string` |
76
75
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="radio"` | ✅ | `string` |
77
76
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="hidden"` | ✅ | `string` |
78
77
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="number"` | ✅ | `number` |
@@ -82,6 +81,7 @@ PS. _The library works perfectly with any framework. Just use a valid [HTMLFormE
82
81
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="time"` | ✅ | [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) |
83
82
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="month"` | ✅ | [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) |
84
83
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="week"` | ✅ | [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) |
84
+ | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="datetime-local"` | ✅ | [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) |
85
85
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="file"` | ✅ | [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) or `null` |
86
86
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="file"` and `multiple` | ✅ | <code>Array<[File](https://developer.mozilla.org/en-US/docs/Web/API/File)></code> |
87
87
  | [HTMLInputElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement) | `type="button"` | ❌ | – |
@@ -6,7 +6,6 @@ export namespace ControlType {
6
6
  let URL: "url";
7
7
  let TEL: "tel";
8
8
  let COLOR: "color";
9
- let DATETIME_LOCAL: "datetime-local";
10
9
  let RADIO: "radio";
11
10
  let HIDDEN: "hidden";
12
11
  let NUMBER: "number";
@@ -16,6 +15,7 @@ export namespace ControlType {
16
15
  let TIME: "time";
17
16
  let MONTH: "month";
18
17
  let WEEK: "week";
18
+ let DATETIME_LOCAL: "datetime-local";
19
19
  let FILE: "file";
20
20
  let BUTTON: "button";
21
21
  let SUBMIT: "submit";
@@ -6,7 +6,6 @@ const ControlType = /** @type {const} */ ({
6
6
  URL: 'url',
7
7
  TEL: 'tel',
8
8
  COLOR: 'color',
9
- DATETIME_LOCAL: 'datetime-local',
10
9
  RADIO: 'radio',
11
10
  HIDDEN: 'hidden',
12
11
 
@@ -19,6 +18,7 @@ const ControlType = /** @type {const} */ ({
19
18
  TIME: 'time',
20
19
  MONTH: 'month',
21
20
  WEEK: 'week',
21
+ DATETIME_LOCAL: 'datetime-local',
22
22
 
23
23
  FILE: 'file',
24
24
 
@@ -1 +1 @@
1
- {"version":3,"file":"get-form-control-payload.d.ts","sourceRoot":"","sources":["../../../../src/packages/get-form-control-payload/get-form-control-payload.js"],"names":[],"mappings":"qCAac,OAAO,2BAA2B,EAAE,sBAAsB;gDAC1D,OAAO,2BAA2B,EAAE,iCAAiC;AA+BnF;;;;GAIG;AACH,mDAJW,iCAAiC,GAC/B,OAAO,CAsEnB;AAxGD,mGAAmG;AACnG,yHAAyH;AAEzH;;;;GAIG;AACH,8FAHc,sBAAsB,OAyBnC"}
1
+ {"version":3,"file":"get-form-control-payload.d.ts","sourceRoot":"","sources":["../../../../src/packages/get-form-control-payload/get-form-control-payload.js"],"names":[],"mappings":"qCAcc,OAAO,2BAA2B,EAAE,sBAAsB;gDAC1D,OAAO,2BAA2B,EAAE,iCAAiC;AA+BnF;;;;GAIG;AACH,mDAJW,iCAAiC,GAC/B,OAAO,CA0EnB;AA5GD,mGAAmG;AACnG,yHAAyH;AAEzH;;;;GAIG;AACH,8FAHc,sBAAsB,OAyBnC"}
@@ -4,6 +4,7 @@ import {
4
4
  checkIsReferToAnotherNode,
5
5
  getAllowedElements,
6
6
  getCheckboxValue,
7
+ getDatetimeLocalValue,
7
8
  getFormControlValue,
8
9
  getInputDateValue,
9
10
  getInputFileValue,
@@ -57,7 +58,6 @@ const getFormControlPayload = (controlNode) => {
57
58
  case ControlType.URL:
58
59
  case ControlType.TEL:
59
60
  case ControlType.COLOR:
60
- case ControlType.DATETIME_LOCAL:
61
61
  case ControlType.RADIO:
62
62
  case ControlType.HIDDEN:
63
63
  case ControlType.TEXTAREA:
@@ -91,6 +91,11 @@ const getFormControlPayload = (controlNode) => {
91
91
  /** @type {HTMLInputElement} */ (controlNode),
92
92
  );
93
93
  }
94
+ case ControlType.DATETIME_LOCAL: {
95
+ return getDatetimeLocalValue(
96
+ /** @type {HTMLInputElement} */ (controlNode),
97
+ );
98
+ }
94
99
  case ControlType.FILE: {
95
100
  return getInputFileValue(
96
101
  /** @type {HTMLInputElement} */ (controlNode),
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @param {HTMLInputElement} element
3
+ * @returns {Date}
4
+ */
5
+ export function getDatetimeLocalValue(element: HTMLInputElement): Date;
6
+ //# sourceMappingURL=get-datatime-local-value.helper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-datatime-local-value.helper.d.ts","sourceRoot":"","sources":["../../../../../../src/packages/get-form-control-payload/helpers/get-datatime-local-value/get-datatime-local-value.helper.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH,+CAHW,gBAAgB,GACd,IAAI,CAIhB"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @param {HTMLInputElement} element
3
+ * @returns {Date}
4
+ */
5
+ const getDatetimeLocalValue = (element) => {
6
+ return new Date(element.value);
7
+ };
8
+
9
+ export { getDatetimeLocalValue };
@@ -2,6 +2,7 @@ export { checkIsReferToAnotherNode } from "./check-is-refer-to-another-node/chec
2
2
  export { getAllowedElements } from "./get-allowed-elements/get-allowed-elements.helper.js";
3
3
  export { getCheckboxValue } from "./get-checkbox-value/get-checkbox-value.helper.js";
4
4
  export { getFormControlValue } from "./get-control-value/get-control-value.helper.js";
5
+ export { getDatetimeLocalValue } from "./get-datatime-local-value/get-datatime-local-value.helper.js";
5
6
  export { getInputDateValue } from "./get-input-date-value/get-input-date-value.helper.js";
6
7
  export { getInputFileValue } from "./get-input-file-value/get-input-file-value.helper.js";
7
8
  export { getInputNumericValue } from "./get-input-numeric-value/get-input-numeric-value.helper.js";
@@ -2,6 +2,7 @@ export { checkIsReferToAnotherNode } from './check-is-refer-to-another-node/chec
2
2
  export { getAllowedElements } from './get-allowed-elements/get-allowed-elements.helper.js';
3
3
  export { getCheckboxValue } from './get-checkbox-value/get-checkbox-value.helper.js';
4
4
  export { getFormControlValue } from './get-control-value/get-control-value.helper.js';
5
+ export { getDatetimeLocalValue } from './get-datatime-local-value/get-datatime-local-value.helper.js';
5
6
  export { getInputDateValue } from './get-input-date-value/get-input-date-value.helper.js';
6
7
  export { getInputFileValue } from './get-input-file-value/get-input-file-value.helper.js';
7
8
  export { getInputNumericValue } from './get-input-numeric-value/get-input-numeric-value.helper.js';