Skip to content
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

Version 9 #48

Merged
merged 212 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
212 commits
Select commit Hold shift + click to select a range
d5cff2e
Add `wire:key` to `@foreach` loops
aerni Oct 25, 2023
d84b11a
Use coherent naming for keys and ids
aerni Oct 25, 2023
a478ab0
Livewire automatically calls `preventDefault()`
aerni Oct 25, 2023
a31303d
Autocomplete option `on` doesn’t exists
aerni Oct 30, 2023
d281a97
Add configurable textarea rows
aerni Oct 30, 2023
554c19b
Fix indentation
aerni Nov 3, 2023
54d8447
Lots of field and template optimizations
aerni Nov 8, 2023
17f282b
Use shorthand syntax
aerni Nov 8, 2023
861ac28
Rename Form to DynamicForm
aerni Nov 8, 2023
6db79de
Simplify component by using Facade directly
aerni Nov 8, 2023
fde78e0
No need for the wrapping div
aerni Nov 8, 2023
c367c40
Move honeypot view into fields directory
aerni Nov 8, 2023
128fb9f
Revert "No need for the wrapping div"
aerni Nov 8, 2023
75d9cd7
Move views to vendor folder
aerni Nov 9, 2023
f304b35
Use dot syntax for loading views
aerni Nov 9, 2023
4dd8081
Rename default view
aerni Nov 9, 2023
78c95a7
Autoload view by form handle
aerni Nov 9, 2023
cbcd261
Autoload theme by form handle
aerni Nov 9, 2023
388975e
Rename form components
aerni Nov 9, 2023
012b708
Fix wrong default value
aerni Nov 9, 2023
ec9e3fb
Allow falling back to vendor provided theme
aerni Nov 9, 2023
330ed06
Move theme out of themes folder
aerni Nov 10, 2023
044e5a0
Fix make:view command
aerni Nov 10, 2023
72cab27
Don’t publish views as we’ve got make:theme`
aerni Nov 10, 2023
d81f2a4
Better organization of views with subfolders
aerni Nov 10, 2023
c80abd3
Abstract view include behind `@formView` directive
aerni Nov 10, 2023
489bbc7
Remove blade directives that solely render a view
aerni Nov 10, 2023
8598899
Update comments
aerni Nov 10, 2023
b51d282
Fix loading of field views
aerni Nov 10, 2023
fd388f5
Fix loading of default-form
aerni Nov 11, 2023
94a5d9d
Update form stub
aerni Nov 11, 2023
04fb573
Use Alpine for field conditions
aerni Nov 15, 2023
bbdaf3e
Extend Honeypot from Field
aerni Nov 22, 2023
de54136
Use new `@assets` directive
aerni Nov 22, 2023
c56b7d1
Simplify models implementation
aerni Nov 22, 2023
931277e
Use Livewire’s Computed Attribute
aerni Nov 22, 2023
52b2697
Better comments
aerni Nov 23, 2023
bf31be3
Clean up DynamicForm by using traits
aerni Nov 23, 2023
6849ce5
Refactor theme view evaluation
aerni Nov 23, 2023
05c5432
Simplify code by getting rid of Component class
aerni Nov 23, 2023
9698270
Use existing handle, view, and theme traits
aerni Nov 23, 2023
6d20928
Move form data to trait
aerni Nov 23, 2023
a3e3142
Move models to trait
aerni Nov 23, 2023
7afd36f
Refactor Form class into traits
aerni Nov 23, 2023
4a61f77
Make it possible to add to `$data` on mount
aerni Nov 23, 2023
a7d8f6e
Move submit method
aerni Nov 24, 2023
0d69c3b
Make it easy to set and get data
aerni Nov 24, 2023
12a77d2
Simplify file upload method
aerni Nov 24, 2023
163dc84
Fix styling
aerni Nov 24, 2023
f0cceff
Ensure success flash doesn’t disappear immediately
aerni Nov 25, 2023
6c32bc1
Integer fieldtype should always use a number input
aerni Nov 25, 2023
8547a79
Move value process into field models
aerni Nov 25, 2023
7d68abd
The event should be scoped to the component
aerni Nov 25, 2023
7c184cd
Use preferred syntax
aerni Nov 25, 2023
ea8a846
Automatically set handle based on component name
aerni Nov 26, 2023
8154c13
Deprecate the static properties
aerni Nov 26, 2023
f15c108
Move fieldsToSubmit to more fitting trait
aerni Nov 26, 2023
1bfcd25
Move submit method to more appropriate place
aerni Nov 26, 2023
ff53c8c
Move trait imports into proper order
aerni Nov 26, 2023
4dc6351
Throw exception if field model binding is missing
aerni Nov 26, 2023
c6a56c7
Preserve trait order
aerni Nov 26, 2023
ec47b17
Fix styling
aerni Nov 26, 2023
aef3077
Remove captcha code complexity
aerni Nov 28, 2023
e42394e
Add method to get the data as collection
aerni Nov 28, 2023
d706d8c
Make `fieldsToSubmit` a regular array
aerni Nov 28, 2023
7902460
Use a computed property for the component
aerni Nov 28, 2023
af5b169
Increase security by locking public properties
aerni Nov 28, 2023
6bd871b
Use Laravel Prompts for commands
aerni Nov 28, 2023
d594898
Fix styling
aerni Nov 28, 2023
16b716f
Rename `file` field view to `assets`
aerni Nov 30, 2023
bc30e86
Rename `checkbox` field to `checkboxes`
aerni Nov 30, 2023
21a7529
Rename `input` field to `default`
aerni Nov 30, 2023
7fe1000
Remove unused classes
aerni Nov 30, 2023
ef3d6c9
Consolidate component code into master trait
aerni Dec 9, 2023
5c64ab5
Fix styling
aerni Dec 9, 2023
65a913f
No need to use alias
aerni Dec 9, 2023
46ad00f
No need to use static property for view
aerni Dec 9, 2023
5cc3509
Move exceptions into their own classes
aerni Dec 9, 2023
85a9ffb
Update dummy component
aerni Dec 9, 2023
edb720e
Import models trait in related trait
aerni Dec 10, 2023
45f0d16
Ensure we are scoping models to each form
aerni Dec 10, 2023
27e99ff
Fix styling
aerni Dec 10, 2023
7d3bcd1
wip
aerni Dec 11, 2023
3c30114
wip
aerni Dec 11, 2023
8c1e381
Fix styling
aerni Dec 11, 2023
d9bc860
wip
aerni Dec 12, 2023
dc7bbd4
Inline the section fields
aerni Dec 13, 2023
6dc1f24
Make coherent with Livewire hooks
aerni Dec 13, 2023
28ad123
Implement properties cache
aerni Dec 15, 2023
4a57b1a
Fix field value reset
aerni Dec 15, 2023
2088a1d
Use named arguments
aerni Dec 15, 2023
227c961
Make the sections a computed field
aerni Dec 15, 2023
77514b9
Cleanup
aerni Dec 15, 2023
b214d6b
Make method protected
aerni Dec 15, 2023
f4d672b
Fix styling
aerni Dec 15, 2023
bace829
Remove comments
aerni Dec 15, 2023
23b9844
Move section text translation into Livewire
aerni Dec 15, 2023
0314462
Rename trait
aerni Dec 15, 2023
64fe9e9
Make code simpler
aerni Dec 15, 2023
0c68ddb
Refactor Alpine integration
aerni Dec 15, 2023
4922fd2
Inline the captcha code
aerni Dec 15, 2023
095a147
Make it look nicer
aerni Dec 15, 2023
23b04bb
Move Alpine code into bundle
aerni Dec 16, 2023
0f03978
Add line break
aerni Dec 16, 2023
5a42a71
Fix hidden field not being hidden
aerni Dec 16, 2023
a6f48f3
Submit values of hidden fields
aerni Dec 16, 2023
9dc9d03
Better key names
aerni Dec 16, 2023
36435d9
Better naming
aerni Dec 16, 2023
4d1e8fa
Reorder methods
aerni Dec 16, 2023
6cdc018
Refactor submission handling
aerni Dec 16, 2023
600b1e8
Closer align events to Statamic form events
aerni Dec 16, 2023
c07d603
Make code more concise
aerni Dec 16, 2023
57f6cf7
Better event order
aerni Dec 16, 2023
0637ff2
Add submission to events
aerni Dec 16, 2023
f61e325
Sluggify event names
aerni Dec 16, 2023
9ab5c68
Greatly simplify events
aerni Dec 16, 2023
1759f6e
No need to pass submittable anymore
aerni Dec 16, 2023
0e8b107
Update dummy component
aerni Dec 16, 2023
87d7652
Refactor submittable fields
aerni Dec 17, 2023
ec3a1b3
Move all properties into constructor
aerni Dec 18, 2023
8b1cc7e
Reorganize form component and remove wrapper trait
aerni Dec 23, 2023
37a6ac2
Fix typo
aerni Dec 23, 2023
154a790
Ensure we always process unprocessed properties
aerni Dec 25, 2023
d01d92d
Make it possible to unset a processed property
aerni Dec 25, 2023
2435d0f
Cache property when accessed
aerni Dec 25, 2023
6143261
Better honeypot handling
aerni Dec 25, 2023
b319013
Cleanup class with property wrapper trait
aerni Dec 25, 2023
2eb9ef1
Use processed properties
aerni Dec 25, 2023
54eec19
Statamic already takes care of boolean casting
aerni Dec 25, 2023
223dd4c
No need to use parent process method
aerni Dec 25, 2023
a8a3661
Cleanup
aerni Dec 25, 2023
9b93461
No need to return anything here
aerni Dec 25, 2023
34a3043
Let each field’s fieldtype process its value
aerni Dec 25, 2023
63649c0
Statamic always saves checkboxes as array
aerni Dec 26, 2023
eb4b793
Ensure all possible option types work
aerni Dec 26, 2023
c28e0fb
Fix styling
aerni Dec 26, 2023
be2956d
Inline the variables
aerni Dec 26, 2023
7db26d3
Use cached property
aerni Dec 26, 2023
ea88068
Merge branch 'fields-synth' of github.com:aerni/statamic-livewire-for…
aerni Dec 26, 2023
a693f13
Fix autoloading of custom form component
aerni Dec 29, 2023
67ffbc9
Make views directory configurable
aerni Jan 19, 2024
d2b908c
Introduce better way to manage views in one place
aerni Jan 21, 2024
68fdc8f
Fix styling
aerni Jan 21, 2024
70f70d5
Pass component to field class
aerni Jan 22, 2024
d423d95
Update README.md
aerni Jan 22, 2024
7c082cc
Fix issue with nested arrays
aerni Jan 22, 2024
c1d13a7
Update README.md
aerni Jan 22, 2024
9aa0dea
Update README.md
aerni Jan 22, 2024
e332cf3
Update README.md
aerni Jan 23, 2024
ea4bdd8
Use methods to process value when setting property
aerni Jan 5, 2024
450e21a
Make it possible to opt-out of processing
aerni Jan 5, 2024
c0ce15b
Don’t allow changing some important properties
aerni Jan 5, 2024
9f60b70
Fix field view loading
aerni Jan 23, 2024
2abfc23
Rework property handling
aerni Jan 23, 2024
b2c4958
Setup test suite
aerni Jan 24, 2024
69fa694
Add more tests
aerni Jan 25, 2024
c1b1bac
Fix styling
aerni Jan 25, 2024
1e4bc58
Add test workflow
aerni Jan 25, 2024
6b41fe1
Merge branch 'tests' of github.com:aerni/statamic-livewire-forms into…
aerni Jan 25, 2024
1245dd8
Add more tests
aerni Jan 25, 2024
975eaa2
Fix styling
aerni Jan 25, 2024
95f998a
Update README.md
aerni Jan 25, 2024
dd21816
Add more tests
aerni Jan 26, 2024
09f7b37
Deprecate showLabel property
aerni Jan 27, 2024
281301e
Ensure we can pass nested arrays
aerni Feb 7, 2024
1e13d0e
Add `max_items` validation rule to select field
aerni Feb 8, 2024
002cd46
Remove validation rules that would break the field
aerni Feb 8, 2024
97812a6
Update styling of views and some new features
aerni Feb 8, 2024
5207239
Fix styling
aerni Feb 8, 2024
5cfd850
Delete file after test
aerni Mar 4, 2024
7b8eefa
Statamic already boots the addon translations
aerni Mar 4, 2024
6cb5838
Rename methods
aerni Mar 4, 2024
ce0eac2
Refactor so that we can get section by handle
aerni Mar 5, 2024
e3ef712
Fix styling
aerni Mar 5, 2024
d413d7b
Fix test
aerni Mar 5, 2024
6735947
Fix styling
aerni Mar 5, 2024
0d080f8
Add new line
aerni Apr 2, 2024
e32386a
Update README.md
aerni Apr 2, 2024
d47d4cc
Update README.md
aerni Apr 2, 2024
b37e020
Merge branch 'major-refactor' of github.com:aerni/statamic-livewire-f…
aerni Apr 2, 2024
4614792
Update README.md
aerni Apr 2, 2024
428eafe
Only run validation when `$fields` is updated
aerni Apr 12, 2024
a9fd22b
Fix validation when field is updated
aerni Apr 12, 2024
43a9466
Allow using the `sometimes` rule
aerni Apr 15, 2024
0514c90
Simplify Field by not passing component through
aerni Apr 15, 2024
c4241ba
Add form selection to component create command
aerni Apr 15, 2024
537be91
Fix styling
aerni Apr 15, 2024
2c84a9f
Fix tests
aerni Apr 15, 2024
d57674c
Fix styling
aerni Apr 15, 2024
15da855
Extract field model creation into its own method
aerni Apr 15, 2024
642ff8b
Add exceptions to blade directives
aerni Apr 15, 2024
a5246a8
Better section handle and id
aerni Apr 15, 2024
d6526e2
Filter empty sections early for correct `$order
aerni Apr 15, 2024
9cd2c3e
Extract section into its own class
aerni Apr 15, 2024
4215214
Fix styling
aerni Apr 15, 2024
d55c555
Add FilePond integration (#49)
aerni Apr 19, 2024
db1da9e
We can directly set the value
aerni Apr 25, 2024
56b523c
Rename section order to number
aerni May 1, 2024
0c23e35
Add Wizard (#50)
aerni May 8, 2024
25490b7
Move classes down
aerni May 8, 2024
d0f9732
Add support for Statamic 5 (#51)
aerni May 9, 2024
f7829f4
Improve accessibility
aerni May 9, 2024
2c5b16a
Renamed label to display
aerni May 9, 2024
812d396
Just pass the field keys instead of actual fields
aerni May 9, 2024
51101c7
Fix styling
aerni May 9, 2024
ca4fd82
Update README.md
aerni May 9, 2024
f4b39e4
Use config value as default
aerni May 9, 2024
26a0c2b
Show error if no forms can be found
aerni May 11, 2024
e7f00d4
Fix styling
aerni May 11, 2024
5f5399f
ID needs to be unique
aerni May 13, 2024
884b4d6
Betterify Alpine implementation
aerni May 13, 2024
cd62dfd
Throw exception if form has no fields
aerni May 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: run-tests

on: ['push', 'pull_request']

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2, 8.3]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Setup problem matchers
run: |
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/pest
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.DS_Store
composer.lock
vendor
node_modules
333 changes: 152 additions & 181 deletions README.md

Large diffs are not rendered by default.

29 changes: 24 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,45 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"jonassiewertsen/statamic-livewire": "^3.0",
"laravel/framework": "^10.0",
"livewire/livewire": "^3.0",
"statamic/cms": "^4.9"
"laravel/framework": "^10.0 || ^11.0",
"laravel/prompts": "^0.1.13",
"livewire/livewire": "^3.2",
"spatie/invade": "^2.0",
"statamic/cms": "^5.0"
},
"require-dev": {
"orchestra/testbench": "^8.19",
"pestphp/pest": "^2.32",
"pestphp/pest-plugin-laravel": "^2.2",
"pestphp/pest-plugin-livewire": "^2.1"
},
"autoload": {
"psr-4": {
"Aerni\\LivewireForms\\": "src"
}
},
"autoload-dev" : {
"psr-4" : {
"Aerni\\LivewireForms\\Tests\\" : "tests"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"pixelfear/composer-dist-plugin": true
"pixelfear/composer-dist-plugin": true,
"pestphp/pest-plugin": true
}
},
"scripts": {
"test": [
"./vendor/bin/pest"
]
},
"extra": {
"statamic": {
"name": "Livewire Forms",
Expand Down
53 changes: 32 additions & 21 deletions config/livewire-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,59 @@

/*
|--------------------------------------------------------------------------
| Default View
| Field Models
|--------------------------------------------------------------------------
|
| This view will be used if you don't specify one on the component.
| You may change the model of each fieldtype with your own implementation.
|
*/

'view' => 'default',
'models' => [
Aerni\LivewireForms\Fieldtypes\Captcha::class => Aerni\LivewireForms\Fields\Captcha::class,
Statamic\Fieldtypes\Assets\Assets::class => Aerni\LivewireForms\Fields\Assets::class,
Statamic\Fieldtypes\Checkboxes::class => Aerni\LivewireForms\Fields\Checkboxes::class,
Statamic\Fieldtypes\Hidden::class => Aerni\LivewireForms\Fields\Hidden::class,
Statamic\Fieldtypes\Integer::class => Aerni\LivewireForms\Fields\Integer::class,
Statamic\Fieldtypes\Radio::class => Aerni\LivewireForms\Fields\Radio::class,
Statamic\Fieldtypes\Select::class => Aerni\LivewireForms\Fields\Select::class,
Statamic\Fieldtypes\Spacer::class => Aerni\LivewireForms\Fields\Spacer::class,
Statamic\Fieldtypes\Text::class => Aerni\LivewireForms\Fields\Text::class,
Statamic\Fieldtypes\Textarea::class => Aerni\LivewireForms\Fields\Textarea::class,
Statamic\Fieldtypes\Toggle::class => Aerni\LivewireForms\Fields\Toggle::class,
],

/*
|--------------------------------------------------------------------------
| Default Theme
| View Path
|--------------------------------------------------------------------------
|
| This theme will be used if you don't specify one on the component.
| The path under resources/views where the form views are published and loaded from.
|
*/

'theme' => 'default',
'view_path' => 'livewire/forms',

/*
|--------------------------------------------------------------------------
| Field Models
| Default View
|--------------------------------------------------------------------------
|
| You may change the model of each fieldtype with your own implementation.
| The default view that is used if you don't specify one on the component.
|
*/

'models' => [
\Aerni\LivewireForms\Fieldtypes\Captcha::class => \Aerni\LivewireForms\Fields\Captcha::class,
\Statamic\Fieldtypes\Assets\Assets::class => \Aerni\LivewireForms\Fields\Assets::class,
\Statamic\Fieldtypes\Checkboxes::class => \Aerni\LivewireForms\Fields\Checkbox::class,
\Statamic\Fieldtypes\Hidden::class => \Aerni\LivewireForms\Fields\Hidden::class,
\Statamic\Fieldtypes\Integer::class => \Aerni\LivewireForms\Fields\Integer::class,
\Statamic\Fieldtypes\Radio::class => \Aerni\LivewireForms\Fields\Radio::class,
\Statamic\Fieldtypes\Select::class => \Aerni\LivewireForms\Fields\Select::class,
\Statamic\Fieldtypes\Spacer::class => \Aerni\LivewireForms\Fields\Spacer::class,
\Statamic\Fieldtypes\Text::class => \Aerni\LivewireForms\Fields\Text::class,
\Statamic\Fieldtypes\Textarea::class => \Aerni\LivewireForms\Fields\Textarea::class,
\Statamic\Fieldtypes\Toggle::class => \Aerni\LivewireForms\Fields\Toggle::class,
],
'view' => 'default',

/*
|--------------------------------------------------------------------------
| Default Theme
|--------------------------------------------------------------------------
|
| The default theme that is used if you don't specify one on the component.
|
*/

'theme' => 'default',

/*
|--------------------------------------------------------------------------
Expand Down
Loading
Loading