fh-pydantic-form 0.3.2__tar.gz → 0.3.3__tar.gz
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.
Potentially problematic release.
This version of fh-pydantic-form might be problematic. Click here for more details.
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/PKG-INFO +1 -1
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/RELEASE_NOTES.md +3 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/pyproject.toml +1 -1
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/comparison_form.py +8 -71
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/.github/workflows/build.yaml +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/.github/workflows/publish.yaml +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/.gitignore +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/.pre-commit-config.yaml +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/LICENSE +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/README.md +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/__init__.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/color_utils.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/constants.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/defaults.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/field_renderers.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/form_parser.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/form_renderer.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/list_path.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/py.typed +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/registry.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/type_helpers.py +0 -0
- {fh_pydantic_form-0.3.2 → fh_pydantic_form-0.3.3}/src/fh_pydantic_form/ui_style.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fh-pydantic-form
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: a library to turn any pydantic BaseModel object into a fasthtml/monsterui input form
|
|
5
5
|
Project-URL: Homepage, https://github.com/Marcura/fh-pydantic-form
|
|
6
6
|
Project-URL: Repository, https://github.com/Marcura/fh-pydantic-form
|
|
@@ -347,6 +347,13 @@ class ComparisonForm(Generic[ModelType]):
|
|
|
347
347
|
# Determine comparison-specific refresh endpoint
|
|
348
348
|
comparison_refresh = f"/compare/{self.name}/{'left' if form is self.left_form else 'right'}/refresh"
|
|
349
349
|
|
|
350
|
+
# Get label color for this field if specified
|
|
351
|
+
label_color = (
|
|
352
|
+
form.label_colors.get(field_name)
|
|
353
|
+
if hasattr(form, "label_colors")
|
|
354
|
+
else None
|
|
355
|
+
)
|
|
356
|
+
|
|
350
357
|
# Create renderer
|
|
351
358
|
renderer = renderer_cls(
|
|
352
359
|
field_name=field_name,
|
|
@@ -357,6 +364,7 @@ class ComparisonForm(Generic[ModelType]):
|
|
|
357
364
|
spacing=form.spacing,
|
|
358
365
|
field_path=[field_name],
|
|
359
366
|
form_name=form.name,
|
|
367
|
+
label_color=label_color, # Pass the label color if specified
|
|
360
368
|
metrics_dict=form.metrics_dict, # Use form's own metrics
|
|
361
369
|
refresh_endpoint_override=comparison_refresh, # Pass comparison-specific refresh endpoint
|
|
362
370
|
)
|
|
@@ -375,77 +383,6 @@ class ComparisonForm(Generic[ModelType]):
|
|
|
375
383
|
# Return wrapper with display: contents
|
|
376
384
|
return fh.Div(*cells, id=wrapper_id, cls="contents")
|
|
377
385
|
|
|
378
|
-
# def _create_field_pairs(
|
|
379
|
-
# self,
|
|
380
|
-
# ) -> List[Tuple[str, BaseFieldRenderer, BaseFieldRenderer]]:
|
|
381
|
-
# """
|
|
382
|
-
# Create pairs of renderers (left, right) for each field path
|
|
383
|
-
|
|
384
|
-
# Returns:
|
|
385
|
-
# List of (path_string, left_renderer, right_renderer) tuples
|
|
386
|
-
# """
|
|
387
|
-
# pairs = []
|
|
388
|
-
# registry = FieldRendererRegistry()
|
|
389
|
-
|
|
390
|
-
# # Walk through model fields to create renderer pairs
|
|
391
|
-
# for field_name, field_info in self.model_class.model_fields.items():
|
|
392
|
-
# # Skip fields that are excluded in either form
|
|
393
|
-
# if field_name in (self.left_form.exclude_fields or []) or field_name in (
|
|
394
|
-
# self.right_form.exclude_fields or []
|
|
395
|
-
# ):
|
|
396
|
-
# logger.debug(
|
|
397
|
-
# f"Skipping field '{field_name}' - excluded in one or both forms"
|
|
398
|
-
# )
|
|
399
|
-
# continue
|
|
400
|
-
|
|
401
|
-
# # Get values from each form
|
|
402
|
-
# left_value = self.left_form.values_dict.get(field_name)
|
|
403
|
-
# right_value = self.right_form.values_dict.get(field_name)
|
|
404
|
-
|
|
405
|
-
# # Get the path string for comparison lookup
|
|
406
|
-
# path_str = field_name
|
|
407
|
-
# left_comparison_metric = self.left_metrics.get(path_str)
|
|
408
|
-
# right_comparison_metric = self.right_metrics.get(path_str)
|
|
409
|
-
|
|
410
|
-
# # Get renderer class
|
|
411
|
-
# renderer_cls = registry.get_renderer(field_name, field_info)
|
|
412
|
-
# if not renderer_cls:
|
|
413
|
-
# from fh_pydantic_form.field_renderers import StringFieldRenderer
|
|
414
|
-
|
|
415
|
-
# renderer_cls = StringFieldRenderer
|
|
416
|
-
|
|
417
|
-
# # Create left renderer
|
|
418
|
-
# left_renderer = renderer_cls(
|
|
419
|
-
# field_name=field_name,
|
|
420
|
-
# field_info=field_info,
|
|
421
|
-
# value=left_value,
|
|
422
|
-
# prefix=self.left_form.base_prefix,
|
|
423
|
-
# disabled=self.left_form.disabled,
|
|
424
|
-
# spacing=self.left_form.spacing,
|
|
425
|
-
# field_path=[field_name],
|
|
426
|
-
# form_name=self.left_form.name,
|
|
427
|
-
# comparison=left_comparison_metric,
|
|
428
|
-
# comparison_map=self.left_metrics, # Pass the full comparison map
|
|
429
|
-
# )
|
|
430
|
-
|
|
431
|
-
# # Create right renderer
|
|
432
|
-
# right_renderer = renderer_cls(
|
|
433
|
-
# field_name=field_name,
|
|
434
|
-
# field_info=field_info,
|
|
435
|
-
# value=right_value,
|
|
436
|
-
# prefix=self.right_form.base_prefix,
|
|
437
|
-
# disabled=self.right_form.disabled,
|
|
438
|
-
# spacing=self.right_form.spacing,
|
|
439
|
-
# field_path=[field_name],
|
|
440
|
-
# form_name=self.right_form.name,
|
|
441
|
-
# comparison=right_comparison_metric,
|
|
442
|
-
# comparison_map=self.right_metrics, # Pass the full comparison map
|
|
443
|
-
# )
|
|
444
|
-
|
|
445
|
-
# pairs.append((path_str, left_renderer, right_renderer))
|
|
446
|
-
|
|
447
|
-
# return pairs
|
|
448
|
-
|
|
449
386
|
def render_inputs(self) -> FT:
|
|
450
387
|
"""
|
|
451
388
|
Render the comparison form with side-by-side layout
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|