-
Notifications
You must be signed in to change notification settings - Fork 344
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dc3e4 new matrix field #484
Merged
Merged
Changes from 25 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
a4ac0d1
fix password reset bug
madassdev 9345436
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev c4e069f
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev ad07808
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev ce99260
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 840e9c1
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev d443551
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 267e631
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 34ff509
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 8697ede
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 9bf816c
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev bdc64bc
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 4a5b72c
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 49a8a04
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev 7079bd4
Merge branch 'main' of https://github.com/JhumanJ/OpnForm
madassdev a9c5371
wip: matrix input
madassdev d633500
wip: matrix input
madassdev 88c3a67
wip: matrix input
madassdev 0c37a89
Fixed matric input component logic
JhumanJ a853c82
matrix input cleanup
madassdev a307379
fix lint errors
madassdev 4e87cf8
Merge branch 'dc3e4-new-matrix-field' of https://github.com/JhumanJ/O…
madassdev ca723b6
table border and radius
madassdev 046038b
cleanup, linting
madassdev 82fe4b0
Merge remote-tracking branch 'origin/main' into dc3e4-new-matrix-field
madassdev a1dbd4a
fix component methos
madassdev c1cfcac
wip matrix input
madassdev c7f7e5d
matrix condition for contains and not contain
madassdev e19c461
patch matrix input condition logic
madassdev 54b7a7b
linting
madassdev 104eabe
refactor and cleanup
madassdev 4d4b747
fix syntax error
madassdev 1b6ec44
Merge remote-tracking branch 'origin/main' into dc3e4-new-matrix-field
madassdev 88ec9a3
Merge branch 'main' into dc3e4-new-matrix-field
JhumanJ 8afbdb1
Polished the matrix input
JhumanJ 24ac419
Fix linting
JhumanJ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace App\Rules; | ||
|
||
use Closure; | ||
use Illuminate\Contracts\Validation\ValidationRule; | ||
|
||
class MatrixValidationRule implements ValidationRule | ||
{ | ||
/** | ||
* Run the validation rule. | ||
* | ||
* @param \Closure(string): \Illuminate\Translation\PotentiallyTranslatedString $fail | ||
*/ | ||
public function validate(string $attribute, mixed $value, Closure $fail): void | ||
{ | ||
if (!is_array($value)) { | ||
$fail('The Matrix field must be an array.'); | ||
return; | ||
} | ||
$nullValues = array_filter($value, function ($val) { | ||
return $val === null; | ||
}); | ||
if (sizeof($nullValues)) { | ||
$fail('The Matrix field is required.'); | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<template> | ||
<input-wrapper v-bind="inputWrapperProps"> | ||
<template #label> | ||
<slot name="label"/> | ||
</template> | ||
<div class='border' :class="[ | ||
theme.default.borderRadius, | ||
{ | ||
'!ring-red-500 !ring-2 !border-transparent': hasError, | ||
'!cursor-not-allowed !bg-gray-200': disabled, | ||
}, | ||
]"> | ||
<table | ||
class="w-full table-fixed overflow-hidden border border-collapse border-transparent" | ||
:class="[ | ||
theme.default.borderRadius]" | ||
> | ||
<thead class=""> | ||
<tr class="bg-gray-200/60"> | ||
<th @click="test" class="border border-gray-300"> | ||
|
||
</th> | ||
<td v-for="column in columns" :key="column" class="border border-gray-300"> | ||
<div class="p-2 w-full flex items-center justify-center capitalize text-sm truncate"> | ||
{{ column }} | ||
</div> | ||
</td> | ||
</tr> | ||
</thead> | ||
|
||
<tbody> | ||
<tr v-for="row, rowIndex in rows" :key="rowIndex" class=""> | ||
<td class="border border-gray-300"> | ||
<div class="w-full flex-grow p-2 text-sm truncate"> | ||
{{ row }} | ||
</div> | ||
</td> | ||
<td v-for="column in columns" :key="row + column" class="border border-gray-300"> | ||
<div | ||
class="w-full flex items-center justify-center hover:bg-gray-200/40" | ||
v-if="compVal" | ||
role="radio" | ||
:aria-checked="compVal[row] === column" | ||
:class="[ | ||
theme.FlatSelectInput.spacing.vertical, | ||
theme.FlatSelectInput.fontSize, | ||
theme.FlatSelectInput.option, | ||
]" | ||
@click="onSelect(row, column)" | ||
> | ||
<Icon | ||
v-if="compVal[row] === column" | ||
:key="row+column" | ||
name="material-symbols:radio-button-checked-outline" | ||
class="text-inherit" | ||
:color="color" | ||
:class="[theme.FlatSelectInput.icon]" | ||
/> | ||
<Icon | ||
v-else | ||
:key="row+column" | ||
name="material-symbols:radio-button-unchecked" | ||
:class="[theme.FlatSelectInput.icon,theme.FlatSelectInput.unselectedIcon]" | ||
/> | ||
</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<template #help> | ||
<slot name="help"/> | ||
</template> | ||
<template #error> | ||
<slot name="error"/> | ||
</template> | ||
</input-wrapper> | ||
</template> | ||
<script> | ||
import {inputProps, useFormInput} from "./useFormInput.js" | ||
import InputWrapper from "./components/InputWrapper.vue" | ||
|
||
export default { | ||
name: "MatrixInput", | ||
components: {InputWrapper}, | ||
|
||
props: { | ||
...inputProps, | ||
rows: {type: Array, required: true}, | ||
columns: {type: Array, required: true}, | ||
}, | ||
data() { | ||
return { | ||
} | ||
}, | ||
setup(props, context) { | ||
return { | ||
...useFormInput(props, context), | ||
} | ||
}, | ||
computed: {}, | ||
methods: { | ||
onSelect(row, column) { | ||
if (this.compVal[row] === column) { | ||
this.compVal[row] = null | ||
} else { | ||
this.compVal[row] = column | ||
} | ||
}, | ||
}, | ||
beforeMount() { | ||
if (!this.compVal || typeof this.compVal !== 'object') { | ||
this.compVal = {} | ||
} | ||
}, | ||
} | ||
</script> |
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,42 @@ | ||
<template> | ||
<div | ||
role="radio" | ||
:aria-checked="selected" | ||
:class="[ | ||
theme.FlatSelectInput.spacing.vertical, | ||
theme.FlatSelectInput.fontSize, | ||
theme.FlatSelectInput.option, | ||
]" | ||
@click="onSelect" | ||
> | ||
<Icon | ||
v-if="selected" | ||
name="material-symbols:radio-button-checked-outline" | ||
class="text-inherit" | ||
:color="color" | ||
:class="[theme.FlatSelectInput.icon]" | ||
/> | ||
<Icon | ||
v-else | ||
name="material-symbols:radio-button-unchecked" | ||
:class="[theme.FlatSelectInput.icon,theme.FlatSelectInput.unselectedIcon]" | ||
/> | ||
</div> | ||
</template> | ||
<script> | ||
export default { | ||
emits: ['toggle-select'], | ||
props: { | ||
theme: { type: Object }, | ||
color: {type: String, default: "#3B82F6"}, | ||
selected: { type: Boolean, default: false } | ||
}, | ||
methods: { | ||
onSelect(){ | ||
this.$emit("toggle-select") | ||
} | ||
} | ||
|
||
} | ||
|
||
</script> |
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate matrix data type.
Ensure that the matrix data is always an array before passing it to
getMatrixString
.