@dakataa/crud-react 1.0.10 → 2.1.0

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.
Files changed (109) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/README.md +482 -169
  3. package/dist/Crud.d.ts +15 -0
  4. package/dist/component/BaseButtonContent.d.ts +10 -0
  5. package/dist/component/Button.d.ts +9 -0
  6. package/dist/component/Dropdown.d.ts +17 -0
  7. package/dist/component/Empty.d.ts +5 -0
  8. package/dist/component/Link.d.ts +6 -0
  9. package/dist/component/LottieAnimation.d.ts +8 -0
  10. package/dist/component/Modal.d.ts +22 -0
  11. package/dist/component/Money.d.ts +7 -0
  12. package/dist/component/Preloader.d.ts +20 -0
  13. package/dist/component/Translation.d.ts +14 -0
  14. package/dist/component/crud/ActionLink.d.ts +10 -0
  15. package/dist/component/crud/CrudLoader.d.ts +29 -0
  16. package/dist/component/crud/DynamicView.d.ts +19 -0
  17. package/dist/component/crud/FiltersView.d.ts +7 -0
  18. package/dist/component/crud/GridView.d.ts +27 -0
  19. package/dist/component/crud/IsListItemActionGranted.d.ts +10 -0
  20. package/dist/component/crud/ItemAction.d.ts +9 -0
  21. package/dist/component/crud/ItemActions.d.ts +8 -0
  22. package/dist/component/crud/ItemLabel.d.ts +7 -0
  23. package/dist/component/crud/ItemValue.d.ts +7 -0
  24. package/dist/component/crud/List.d.ts +19 -0
  25. package/dist/component/crud/ListItem.d.ts +5 -0
  26. package/dist/component/crud/ListView.d.ts +8 -0
  27. package/dist/component/crud/Modify.d.ts +9 -0
  28. package/dist/component/crud/Navigation.d.ts +19 -0
  29. package/dist/component/crud/Paginator.d.ts +3 -0
  30. package/dist/component/crud/ViewLoader.d.ts +15 -0
  31. package/dist/component/crud/batch/BatchActionSelector.d.ts +3 -0
  32. package/dist/component/crud/batch/BatchActionsContext.d.ts +17 -0
  33. package/dist/component/crud/batch/BatchItemSelector.d.ts +5 -0
  34. package/dist/component/crud/form/Form.d.ts +31 -0
  35. package/dist/component/crud/form/FormError.d.ts +6 -0
  36. package/dist/component/crud/form/FormField.d.ts +11 -0
  37. package/dist/component/crud/form/FormGroup.d.ts +76 -0
  38. package/dist/component/crud/form/FormGroupViewLoader.d.ts +2 -0
  39. package/dist/component/crud/form/FormLabel.d.ts +4 -0
  40. package/dist/component/crud/form/FormRequestError.d.ts +14 -0
  41. package/dist/component/crud/form/FormRest.d.ts +2 -0
  42. package/dist/component/crud/form/FormRestError.d.ts +4 -0
  43. package/dist/component/error/ErrorBoundary.d.ts +13 -0
  44. package/dist/component/error/Exception.d.ts +9 -0
  45. package/dist/component/error/HttpException.d.ts +16 -0
  46. package/dist/component/form/Choice.d.ts +24 -0
  47. package/dist/component/form/Collection.d.ts +27 -0
  48. package/dist/component/form/Form.d.ts +62 -0
  49. package/dist/component/form/FormAlert.d.ts +3 -0
  50. package/dist/component/form/FormFieldError.d.ts +6 -0
  51. package/dist/component/form/FormGroup.d.ts +8 -0
  52. package/dist/component/form/FormHelp.d.ts +5 -0
  53. package/dist/component/form/FormLabel.d.ts +7 -0
  54. package/dist/component/form/FormSetting.d.ts +11 -0
  55. package/dist/component/form/FormStore.d.ts +93 -0
  56. package/dist/component/form/Input.d.ts +13 -0
  57. package/dist/component/form/Textarea.d.ts +15 -0
  58. package/dist/component/form/constraint/Contraint.d.ts +6 -0
  59. package/dist/component/form/constraint/NotBlank.d.ts +11 -0
  60. package/dist/component/form/formChoices.d.ts +8 -0
  61. package/dist/component/form/formSession.d.ts +3 -0
  62. package/dist/component/form/formView.d.ts +35 -0
  63. package/dist/component/router/Route.d.ts +12 -0
  64. package/dist/component/templating/Template.d.ts +17 -0
  65. package/dist/component/templating/TemplateBlock.d.ts +8 -0
  66. package/dist/component/templating/TemplateExtend.d.ts +9 -0
  67. package/dist/component/templating/TemplateParentBlock.d.ts +5 -0
  68. package/dist/context/ActionContext.d.ts +46 -0
  69. package/dist/context/AlertContext.d.ts +52 -0
  70. package/dist/context/ConfigContext.d.ts +34 -0
  71. package/dist/context/CrudProvider.d.ts +7 -0
  72. package/dist/context/GetData.d.ts +43 -0
  73. package/dist/context/ListContext.d.ts +69 -0
  74. package/dist/context/ListItemContext.d.ts +8 -0
  75. package/dist/context/LoaderContext.d.ts +5 -0
  76. package/dist/context/ModalContext.d.ts +18 -0
  77. package/dist/context/ModalScopeContext.d.ts +5 -0
  78. package/dist/context/NamespaceContext.d.ts +5 -0
  79. package/dist/crud-react.css +2 -1
  80. package/dist/crud-react.js +4004 -2956
  81. package/dist/denied-Cg2igDWh.js +688 -0
  82. package/dist/helper/ObjectUtils.d.ts +3 -0
  83. package/dist/helper/PathUtils.d.ts +12 -0
  84. package/dist/helper/StringUtils.d.ts +3 -0
  85. package/dist/info-Dfyx45FU.js +626 -0
  86. package/dist/layout/default/Base.d.ts +5 -0
  87. package/dist/layout/default/Error.d.ts +11 -0
  88. package/dist/layout/default/Main.d.ts +5 -0
  89. package/dist/main.d.ts +92 -79
  90. package/dist/setupTests.d.ts +0 -0
  91. package/dist/success-B5xn1-UX.js +559 -0
  92. package/dist/type/ActionRequestType.d.ts +17 -0
  93. package/dist/type/ActionType.d.ts +15 -0
  94. package/dist/type/ColumnType.d.ts +24 -0
  95. package/dist/type/ExceptionType.d.ts +6 -0
  96. package/dist/type/FormType.d.ts +6 -0
  97. package/dist/type/FormViewType.d.ts +96 -0
  98. package/dist/type/ListMetaType.d.ts +8 -0
  99. package/dist/type/ListType.d.ts +32 -0
  100. package/dist/type/ModifyType.d.ts +15 -0
  101. package/dist/type/RedirectType.d.ts +7 -0
  102. package/dist/type/RouteType.d.ts +7 -0
  103. package/dist/type/ViewType.d.ts +17 -0
  104. package/dist/warning-BaaC-X6i.js +630 -0
  105. package/package.json +86 -81
  106. package/dist/denied-CgoMpaA7.js +0 -27
  107. package/dist/info-D-NzIEYs.js +0 -144
  108. package/dist/success-Bu_BJcf1.js +0 -27
  109. package/dist/warning-B1nr7TsB.js +0 -27
package/CHANGELOG.md ADDED
@@ -0,0 +1,108 @@
1
+ # Changelog
2
+
3
+ ## 2.1.0 — 2026-11-27
4
+
5
+ ### What's new
6
+
7
+ - **Detect modal context.** The new `useIsModal()` hook tells a component whether
8
+ it belongs to a modal. It works in loaded CRUD views, directly rendered modals
9
+ and nested modals, including portal content. The page behind an open modal
10
+ still receives `false`.
11
+ - **Automatic modal layout.** `Modify` now detects modal context when its `modal`
12
+ prop is omitted, choosing the modal layout and embedded-form behavior automatically.
13
+ Explicit `modal={true}` and `modal={false}` still take priority.
14
+ - **Object actions in CRUD views.** `ViewType.action` lists the actions the backend
15
+ authorizes for the displayed object. An empty array means no actions are available.
16
+
17
+ ### Fixes
18
+
19
+ - `Button` with `autoDisableOnInvalid` checks form validity without firing `invalid`
20
+ events during the check. Native validation on submission remains unchanged.
21
+
22
+ ### Compatibility
23
+
24
+ - `dakataa/crud` v2.1.0 adds the `action` array to standard view responses.
25
+ Earlier versions omit it. If you construct a `ViewType` yourself, for example
26
+ in a custom response or a test fixture, include `action: []` when no actions are available.
27
+
28
+ ## 2.0.0 — 2026-11-04
29
+
30
+ Forms now keep unsaved edits when fields are hidden and shown again, and better
31
+ handle validation and server responses. This release also improves translations,
32
+ lists and error handling. Custom integrations need the API updates below.
33
+
34
+ Changes since `1.0.10`.
35
+
36
+ ### What's new
37
+
38
+ - **Forms remember edits.** Field values and added or removed collection rows survive
39
+ unmounting. Server responses preserve newer edits made while saving.
40
+ - **React to individual field changes.** Use `useFormField` for custom controls,
41
+ `useFormValue` / `useFormValues` to watch values, and `useFormErrors` for errors.
42
+ `useFormState` watches form status; `onStateChange` exposes it to parent components.
43
+ - **More control over saving and errors.** `Form.onSubmit(data, submission, runtime)`
44
+ provides a snapshot of submitted values and access to the form API. Handle failures
45
+ with `GetData.onError`, `GetData.throwOnError` or `CrudForm.onError`.
46
+ Redirects wait for asynchronous `CrudForm.onSuccess` handlers.
47
+ - **Easier form customization.** `FormGroup` and `FormField` accept `optional` for
48
+ fields that may be absent. Error components accept HTML and accessibility attributes.
49
+ Schema attributes such as `class`, `for` and `readonly` are converted to React names.
50
+ - **Shared helpers and translations.** Export `choiceToken`, `choiceList`,
51
+ `selectionTokens` and `resolveAttribute`. `config.translate` handles form labels,
52
+ help text, placeholders, accessible labels and choice group labels.
53
+ - **More display options.** Add configurable timezone, customizable pagination and
54
+ list/action helpers for embedded views.
55
+
56
+ ### Fixes
57
+
58
+ - Validation responses preserve edited values and update untouched fields with new
59
+ backend defaults. Programmatic changes are available immediately to submission
60
+ and `getFormData()`.
61
+ - Compound filters and choice groups keyed by identifiers work correctly.
62
+ - Sorting stays consistent across Activity tab changes, without duplicate handlers.
63
+ - List item actions work when no permission is declared.
64
+ - Canceled requests no longer cause unhandled request-abort errors.
65
+ - Modals share animations and play them in reverse when closing.
66
+
67
+ ### Breaking changes
68
+
69
+ - **Dependencies:** `@dakataa/requester` now requires **^3.0.0** instead of **^2.0.3**.
70
+ React and React DOM remain at **^19.2.3**.
71
+ - **Form context:** `UseForm()` returns `{ store, apiRef, elementRef }` instead of
72
+ `[[state, dispatch], formRef, elementRef]`. Read status with `useFormState()` and
73
+ change values through `apiRef.current`. `FormRef` remains supported.
74
+ - **Field values:** `FormViewType` and `options.data` / `value` / `checked` describe
75
+ initial values. Use setters for later updates; changing `view.data` has no effect.
76
+ Bind custom validation with `useFormField(view, constraints)` and `field.change()`.
77
+ - **Removed APIs:** `FormAction`, `dispatch`, `FormState.response`,
78
+ `UseFormView().setRendered`, `UseFormView().setErrorRendered` and `Choice.prototype`.
79
+ Keep response data in application state. Collection prototypes still use
80
+ `FormViewType.prototype`.
81
+ - **Translations:** replace translation templates with `config.translate`.
82
+ Custom templates can call `UseTranslate()`.
83
+ - **Action and list contexts:** use `actionRequest` / `setActionRequest` instead of
84
+ `action` / `setAction`. Pass `actionRequest` to `CurrentActionRequestProvider` and
85
+ `GetDataByAction`. `ListProvider` now reads data from the data context, not a `data` prop.
86
+
87
+ Renamed public exports:
88
+
89
+ | Before | Now |
90
+ | -------------------------- | --------------------------------- |
91
+ | `Action` | `ActionLink` |
92
+ | `OnClickAction` | `ActionRequestType` |
93
+ | `CurrentActionProvider` | `CurrentActionRequestProvider` |
94
+ | `CurrentActionProviderRef` | `CurrentActionRequestProviderRef` |
95
+ | `UseCurrentAction` | `UseCurrentActionRequest` |
96
+ | `GetDataByActionProps` | `GetDataByActionRequestProps` |
97
+ | `ListContextType` | `ListContextPropsType` |
98
+
99
+ ### Upgrading from v1
100
+
101
+ 1. Update `@dakataa/crud-react` to `^2.0.0` and `@dakataa/requester` to `^3.0.0`.
102
+ 2. Apply the API changes above. For custom forms, follow the
103
+ [Form API migration guide](https://github.com/dakataa/crud-react/blob/2.0.0/src/component/form/README.md#migration-from-v1).
104
+ 3. Check saving, validation, conditional fields, collections, translations, filters,
105
+ sorting and modal navigation in your application.
106
+
107
+ Native controls still submit normally. Use `useFormField` to preserve custom control
108
+ values across unmounts. Unmounted and disabled controls are excluded from `FormData`.