-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: get checkboxes with same value as array fp-96 (#117)
- Loading branch information
1 parent
64dd17a
commit 397680a
Showing
15 changed files
with
217 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export { BANNED_CONTROL_TYPES } from './banned-control-types.constant.js'; | ||
export { VALUE_AS_ARRAY_CUSTOM_CONTROL_TYPES } from './value-as-array-custom-control-types.constant.js'; | ||
export { VALUE_AS_ARRAY_IDENTIFIER } from './value-as-array-identifier.constant.js'; |
5 changes: 5 additions & 0 deletions
5
src/libs/constants/value-as-array-custom-control-types.constant.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ControlType } from '../enums/enums.js'; | ||
|
||
const VALUE_AS_ARRAY_CUSTOM_CONTROL_TYPES = [ControlType.CHECKBOX]; | ||
|
||
export { VALUE_AS_ARRAY_CUSTOM_CONTROL_TYPES }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const VALUE_AS_ARRAY_IDENTIFIER = '[]'; | ||
|
||
export { VALUE_AS_ARRAY_IDENTIFIER }; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export { bannedElementNameToElementInstance } from './element-name-to-element-instance.map.js'; | ||
export { bannedElementNameToElementInstance } from './banned-element-name-to-element-instance.map.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...-form-control-payload/helpers/check-has-value-as-array/check-has-value-as-array.helper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { | ||
VALUE_AS_ARRAY_CUSTOM_CONTROL_TYPES, | ||
VALUE_AS_ARRAY_IDENTIFIER, | ||
} from '../../../../libs/constants/constants.js'; | ||
|
||
/** @typedef {import('../../../../libs/types/types.js').HTMLFormOperationalControlElement} HTMLFormOperationalControlElement */ | ||
|
||
/** | ||
* @param {HTMLFormOperationalControlElement} element | ||
* @returns {boolean} | ||
*/ | ||
const checkHasValueAsArray = (element) => { | ||
return ( | ||
element.name.endsWith(VALUE_AS_ARRAY_IDENTIFIER) && | ||
/** @type {readonly string[]} */ ( | ||
VALUE_AS_ARRAY_CUSTOM_CONTROL_TYPES | ||
).includes(element.type) | ||
); | ||
}; | ||
|
||
export { checkHasValueAsArray }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 9 additions & 1 deletion
10
...packages/get-form-control-payload/helpers/get-checkbox-value/get-checkbox-value.helper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...get-cleaned-value-as-array-control-name/get-cleaned-value-as-array-control-name.helper.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { VALUE_AS_ARRAY_IDENTIFIER } from '../../../../libs/constants/constants.js'; | ||
|
||
/** @typedef {import('../../../../libs/types/types.js').HTMLFormOperationalControlElement} HTMLFormOperationalControlElement */ | ||
|
||
/** | ||
* @param {HTMLFormOperationalControlElement} element | ||
* @returns {string} | ||
*/ | ||
const getCleanedValueAsArrayControlName = (element) => { | ||
return element.name.replace(VALUE_AS_ARRAY_IDENTIFIER, ''); | ||
}; | ||
|
||
export { getCleanedValueAsArrayControlName }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters