django-unfold 0.28.0__py3-none-any.whl → 0.29.0__py3-none-any.whl

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.
@@ -4,29 +4,55 @@
4
4
  {% if not line.has_visible_field %} hidden{% endif %}
5
5
  {% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
6
6
  {% for field in line %}
7
- <div class="flex group {% if not line.fields|length == 1 and not adminform.model_admin.compressed_fields %} lg:max-w-xs flex-grow{% endif %}{% if field.errors %} errors {% endif %}{% if not forloop.parentloop.last %} {% if adminform.model_admin.compressed_fields %}mb-3{% else %}mb-6{% endif %}{% else %} pb-3{% endif %} {% if adminform.model_admin.compressed_fields %}flex-col lg:flex-row lg:gap-2 {% else %}flex-col{% endif %}">
7
+ <div class="flex group {% if adminform.model_admin.compressed_fields %} field-row{% endif %}{% if not line.fields|length == 1 and not adminform.model_admin.compressed_fields %} lg:max-w-xs flex-grow{% endif %}{% if field.errors %} errors {% endif %}{% if not forloop.parentloop.last %} {% if adminform.model_admin.compressed_fields %}mb-3{% else %}mb-6{% endif %}{% else %} pb-3{% endif %} {% if adminform.model_admin.compressed_fields %}flex-col lg:flex-row lg:gap-2 {% else %}flex-col{% endif %}">
8
8
  {% if field.is_checkbox %}
9
- <div class="flex flex-row">
10
- {{ field.field }}
11
-
12
- <div class="flex flex-col">
13
- {{ field.label_tag }}
14
-
15
- {% if field.field.help_text %}
16
- <div class="ml-2 -mt-1">
17
- {% include "unfold/helpers/help_text.html" with help_text=field.field.help_text %}
18
- </div>
19
- {% endif %}
20
-
21
- {% if field.errors %}
22
- <span class="mt-1 text-red-600 text-sm dark:text-red-500">
23
- {{ field.errors }}
24
- </span>
25
- {% endif %}
9
+ {% if adminform.model_admin.compressed_fields %}
10
+ <div class="flex flex-row gap-4">
11
+ <div class="font-medium h-5 flex items-start -ml-2 min-w-32 w-32 lg:min-w-48 lg:w-48">
12
+ {{ field.label_tag }}
13
+ </div>
14
+
15
+ <div class="flex-grow">
16
+ <div class="flex flex-col lg:flex-row">
17
+ {{ field.field }}
18
+
19
+ {% if field.field.help_text %}
20
+ <div class="lg:-mt-2 lg:ml-2">
21
+ {% include "unfold/helpers/help_text.html" with help_text=field.field.help_text %}
22
+ </div>
23
+ {% endif %}
24
+ </div>
25
+
26
+ {% if field.errors %}
27
+ <span class="mt-1 text-red-600 text-sm dark:text-red-500">
28
+ {{ field.errors }}
29
+ </span>
30
+ {% endif %}
31
+ </div>
26
32
  </div>
27
- </div>
33
+ {% else %}
34
+ <div class="flex flex-row">
35
+ {{ field.field }}
36
+
37
+ <div class="flex flex-col">
38
+ {{ field.label_tag }}
39
+
40
+ {% if field.field.help_text %}
41
+ <div class="ml-2 -mt-1">
42
+ {% include "unfold/helpers/help_text.html" with help_text=field.field.help_text %}
43
+ </div>
44
+ {% endif %}
45
+
46
+ {% if field.errors %}
47
+ <span class="mt-1 text-red-600 text-sm dark:text-red-500">
48
+ {{ field.errors }}
49
+ </span>
50
+ {% endif %}
51
+ </div>
52
+ </div>
53
+ {% endif %}
28
54
  {% else %}
29
- <div class="{% if adminform.model_admin.compressed_fields %} min-w-48 mt-2 w-48{% endif %}">
55
+ <div class="{% if adminform.model_admin.compressed_fields %} min-w-48 lg:mt-2 w-48{% endif %}">
30
56
  {{ field.label_tag }}
31
57
  </div>
32
58
 
@@ -1,7 +1,7 @@
1
1
  {% load i18n %}
2
2
 
3
3
  <div class="relative min-w-sidebar transition-width w-sidebar z-30">
4
- <nav id="nav-sidebar" class="bg-gray-50 border-r border-gray-200 flex flex-col fixed max-h-screen min-h-screen min-w-sidebar transition-width w-sidebar dark:bg-gray-900 dark:border-gray-800">
4
+ <nav id="nav-sidebar" class="bg-gray-50 border-r border-gray-200 flex flex-col fixed max-h-screen min-h-screen min-w-sidebar transition-width w-sidebar dark:bg-gray-950 dark:border-gray-800">
5
5
  <div class="border-b border-gray-200 mb-5 py-3 dark:border-gray-800">
6
6
  <div class="flex font-medium h-10 items-center px-6 text-gray-700 dark:text-gray-200">
7
7
  {% if site_logo %}
@@ -1,5 +1,5 @@
1
1
  <li class="border-b flex-grow text-center md:border-b-0 md:border-r last:border-0 dark:border-gray-800">
2
- <a href="{{ link }}" class="block px-4 py-2 text-gray-500 text-left whitespace-nowrap hover:text-gray-700 dark:text-gray-400 hover:dark:text-gray-200"{% if blank %} target="_blank"{% endif %}>
2
+ <a href="{{ link }}" class="block px-4 py-2 text-gray-500 text-left whitespace-nowrap hover:text-gray-700 dark:text-gray-400 hover:dark:text-gray-200"{% if blank %} target="_blank"{% endif %} {% include "unfold/helpers/attrs.html" with attrs=action.attrs %}>
3
3
  {{ title }}
4
4
  </a>
5
5
  </li>
@@ -1,5 +1,5 @@
1
1
  {% if not is_popup %}
2
- {% if tab_list or actions_list or actions_items or nav_global %}
2
+ {% if tab_list or actions_list or actions_detail or actions_items or nav_global %}
3
3
  <div class="flex items-start flex-col mb-4 text-gray-500 text-sm w-full md:border-b dark:md:border-gray-800 md:border-l-0 md:flex-row md:items-center md:justify-end dark:text-gray-400">
4
4
  {% if tab_list %}
5
5
  <ul class="border rounded-md flex flex-col w-full md:flex-row md:border-b-0 md:border-t-0 md:border-l-0 md:border-r-0 dark:border-gray-800">
@@ -15,12 +15,16 @@
15
15
  </ul>
16
16
  {% endif %}
17
17
 
18
- {% if actions_list or actions_items or nav_global %}
18
+ {% if actions_list or actions_detail or actions_items or nav_global %}
19
19
  <ul class="border flex flex-col mb-4 mt-2 rounded-md shadow-sm md:flex-row md:mb-2 md:mt-0 dark:border-gray-800 max-md:w-full">
20
20
  {% for action in actions_list %}
21
21
  {% include "unfold/helpers/tab_action.html" with title=action.title link=action.path %}
22
22
  {% endfor %}
23
23
 
24
+ {% for action in actions_detail %}
25
+ {% include "unfold/helpers/tab_action.html" with title=action.title link=action.path %}
26
+ {% endfor %}
27
+
24
28
  {% if actions_items %}
25
29
  {{ actions_items }}
26
30
  {% endif %}
@@ -7,7 +7,7 @@
7
7
  </span>
8
8
  </a>
9
9
 
10
- <nav class="absolute bg-white border flex flex-col leading-none overflow-hidden py-1 -right-2 rounded shadow-lg text-sm text-gray-500 top-7 w-40 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400" x-cloak x-show="openTheme" @click.outside="openTheme = false">
10
+ <nav class="absolute bg-white border flex flex-col leading-none overflow-hidden py-1 -right-2 rounded shadow-lg text-sm text-gray-500 top-7 w-40 z-50 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400" x-cloak x-show="openTheme" @click.outside="openTheme = false">
11
11
  <a class="cursor-pointer flex flex-row leading-none mx-1 px-3 py-1.5 rounded hover:bg-gray-100 hover:text-gray-700 dark:hover:bg-gray-700 dark:hover:text-gray-200"
12
12
  x-on:click="adminTheme = 'dark'"
13
13
  x-bind:class="adminTheme == 'dark' && 'text-primary-600 dark:text-primary-500 dark:hover:!text-primary-500 hover:!text-primary-600'">
@@ -1,4 +1,4 @@
1
- <div class="flex flex-row">
1
+ <div class="flex flex-row flex-grow">
2
2
  {% include 'django/forms/widgets/input.html' %}
3
3
 
4
4
  {% if related_url %}
@@ -1,23 +1,23 @@
1
- <div class="datetime flex flex-col max-w-2xl lg:flex-row">
2
- <div class="basis-1/2 flex flex-col flex-wrap mb-4 lg:mb-0 lg:mr-2">
3
- <div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400">
1
+ <div class="datetime flex flex-col gap-2 max-w-2xl lg:flex-row lg:group-[.field-row]:flex-row lg:group-[.field-row]:items-center lg:group-[.field-tabular]:flex-row lg:group-[.field-tabular]:items-center">
2
+ <div class="basis-1/2 flex flex-col lg:group-[.field-row]:flex-row group-[.field-row]:gap-2 lg:group-[.field-tabular]:flex-row group-[.field-tabular]:gap-2">
3
+ <div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
4
4
  {{ date_label }}
5
5
  </div>
6
6
 
7
7
  {% with widget=widget.subwidgets.0 %}
8
- <div class="flex flex-col relative">
8
+ <div class="flex flex-col min-w-52 relative group-[.field-row]:flex-grow group-[.field-tabular]:flex-grow">
9
9
  {% include widget.template_name %}
10
10
  </div>
11
11
  {% endwith %}
12
12
  </div>
13
13
 
14
- <div class="basis-1/2 flex flex-col flex-wrap lg:ml-auto mt-3 md:mt-0">
15
- <div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400">
14
+ <div class="basis-1/2 flex flex-col lg:ml-auto md:mt-0 lg:group-[.field-row]:flex-row group-[.field-row]:gap-2 lg:group-[.field-tabular]:flex-row group-[.field-tabular]:gap-2">
15
+ <div class="font-medium mb-2 text-gray-500 text-sm dark:text-gray-400 group-[.field-row]:mb-0 group-[.field-row]:flex group-[.field-row]:items-center group-[.field-tabular]:mb-0 group-[.field-tabular]:flex group-[.field-tabular]:items-center">
16
16
  {{ time_label }}
17
17
  </div>
18
18
 
19
19
  {% with widget=widget.subwidgets.1 %}
20
- <div class="flex flex-col relative">
20
+ <div class="flex flex-col min-w-52 relative group-[.field-row]:flex-grow group-[.field-tabular]:flex-grow">
21
21
  {% include widget.template_name %}
22
22
  </div>
23
23
  {% endwith %}
@@ -26,6 +26,7 @@ def tab_list(context, opts) -> str:
26
26
  context={
27
27
  "tab_list": tabs,
28
28
  "nav_global": context.get("nav_global"),
29
+ "actions_detail": context.get("actions_detail"),
29
30
  "actions_list": context.get("actions_list"),
30
31
  "actions_items": context.get("actions_items"),
31
32
  "is_popup": context.get("is_popup"),
unfold/widgets.py CHANGED
@@ -49,6 +49,7 @@ BASE_CLASSES = [
49
49
  "border",
50
50
  "bg-white",
51
51
  "font-medium",
52
+ "min-w-20",
52
53
  "rounded-md",
53
54
  "shadow-sm",
54
55
  "text-gray-500",
@@ -78,6 +79,8 @@ BASE_INPUT_CLASSES = [
78
79
 
79
80
  INPUT_CLASSES = [*BASE_INPUT_CLASSES, "max-w-2xl"]
80
81
 
82
+ DATETIME_CLASSES = [*BASE_INPUT_CLASSES, "min-w-52"]
83
+
81
84
  COLOR_CLASSES = [*BASE_CLASSES, "h-9.5", "px-2", "py-2", "w-32"]
82
85
 
83
86
  INPUT_CLASSES_READONLY = [*BASE_INPUT_CLASSES, "bg-gray-50"]
@@ -227,6 +230,7 @@ SWITCH_CLASSES = [
227
230
  "rounded-full",
228
231
  "transition-all",
229
232
  "w-8",
233
+ "min-w-8",
230
234
  "after:absolute",
231
235
  "after:bg-white",
232
236
  "after:content-['']",
@@ -321,7 +325,7 @@ class UnfoldAdminDateWidget(AdminDateWidget):
321
325
  self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
322
326
  ) -> None:
323
327
  attrs = {
324
- "class": "vDateField " + " ".join(INPUT_CLASSES),
328
+ "class": "vDateField " + " ".join(DATETIME_CLASSES),
325
329
  "size": "10",
326
330
  **(attrs or {}),
327
331
  }
@@ -335,7 +339,7 @@ class UnfoldAdminSingleDateWidget(AdminDateWidget):
335
339
  self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
336
340
  ) -> None:
337
341
  attrs = {
338
- "class": "vDateField " + " ".join(INPUT_CLASSES),
342
+ "class": "vDateField " + " ".join(DATETIME_CLASSES),
339
343
  "size": "10",
340
344
  **(attrs or {}),
341
345
  }
@@ -347,7 +351,7 @@ class UnfoldAdminTimeWidget(AdminTimeWidget):
347
351
  self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
348
352
  ) -> None:
349
353
  attrs = {
350
- "class": "vTimeField " + " ".join(INPUT_CLASSES),
354
+ "class": "vTimeField " + " ".join(DATETIME_CLASSES),
351
355
  "size": "8",
352
356
  **(attrs or {}),
353
357
  }
@@ -361,7 +365,7 @@ class UnfoldAdminSingleTimeWidget(AdminTimeWidget):
361
365
  self, attrs: Optional[Dict[str, Any]] = None, format: Optional[str] = None
362
366
  ) -> None:
363
367
  attrs = {
364
- "class": "vTimeField " + " ".join(INPUT_CLASSES),
368
+ "class": "vTimeField " + " ".join(DATETIME_CLASSES),
365
369
  "size": "8",
366
370
  **(attrs or {}),
367
371
  }