mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 03:07:19 +00:00
feat: add "simple", "prepend", and "append" render types (#1156)
* feat: add "simple", "prepend", and "append" render types * refactor: explicitly set strategy for "document" in tests
This commit is contained in:
parent
e74e1241ac
commit
bf7a204e92
16 changed files with 1210 additions and 408 deletions
|
@ -25,6 +25,7 @@ class Calendar(Component):
|
|||
kwargs={
|
||||
"date": request.GET.get("date", ""),
|
||||
},
|
||||
deps_strategy="append",
|
||||
)
|
||||
|
||||
|
||||
|
@ -52,4 +53,5 @@ class CalendarRelative(Component):
|
|||
kwargs={
|
||||
"date": request.GET.get("date", ""),
|
||||
},
|
||||
deps_strategy="append",
|
||||
)
|
||||
|
|
|
@ -107,7 +107,7 @@ class FragmentBaseHtmx(Component):
|
|||
class FragJs(Component):
|
||||
class View:
|
||||
def get(self, request):
|
||||
return FragJs.render_to_response(request=request, type="fragment")
|
||||
return FragJs.render_to_response(request=request, deps_strategy="fragment")
|
||||
|
||||
template: types.django_html = """
|
||||
<div class="frag">
|
||||
|
@ -131,7 +131,7 @@ class FragJs(Component):
|
|||
class FragAlpine(Component):
|
||||
class View:
|
||||
def get(self, request):
|
||||
return FragAlpine.render_to_response(request=request, type="fragment")
|
||||
return FragAlpine.render_to_response(request=request, deps_strategy="fragment")
|
||||
|
||||
# NOTE: We wrap the actual fragment in a template tag with x-if="false" to prevent it
|
||||
# from being rendered until we have registered the component with AlpineJS.
|
||||
|
|
|
@ -25,4 +25,5 @@ class CalendarNested(Component):
|
|||
kwargs={
|
||||
"date": request.GET.get("date", ""),
|
||||
},
|
||||
deps_strategy="append",
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue