adminforth 2.4.0-next.33 → 2.4.0-next.331

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 (177) hide show
  1. package/commands/callTsProxy.js +14 -4
  2. package/commands/createApp/templates/api.ts.hbs +10 -0
  3. package/commands/createApp/templates/custom/tsconfig.json.hbs +2 -3
  4. package/commands/createApp/templates/index.ts.hbs +12 -1
  5. package/commands/createApp/templates/package.json.hbs +1 -1
  6. package/commands/createApp/templates/prisma.config.ts.hbs +8 -0
  7. package/commands/createApp/templates/schema.prisma.hbs +0 -1
  8. package/commands/createApp/utils.js +10 -0
  9. package/commands/createCustomComponent/configLoader.js +17 -4
  10. package/commands/createCustomComponent/main.js +13 -7
  11. package/commands/createCustomComponent/templates/customCrud/beforeActionButtons.vue.hbs +38 -0
  12. package/commands/createCustomComponent/templates/customCrud/saveButton.vue.hbs +28 -0
  13. package/commands/createPlugin/templates/custom/tsconfig.json.hbs +2 -5
  14. package/commands/createPlugin/templates/package.json.hbs +1 -1
  15. package/commands/generateModels.js +30 -22
  16. package/dist/auth.d.ts +9 -1
  17. package/dist/auth.d.ts.map +1 -1
  18. package/dist/auth.js +21 -2
  19. package/dist/auth.js.map +1 -1
  20. package/dist/dataConnectors/baseConnector.d.ts +1 -1
  21. package/dist/dataConnectors/baseConnector.d.ts.map +1 -1
  22. package/dist/dataConnectors/baseConnector.js +70 -18
  23. package/dist/dataConnectors/baseConnector.js.map +1 -1
  24. package/dist/dataConnectors/clickhouse.d.ts.map +1 -1
  25. package/dist/dataConnectors/clickhouse.js +15 -0
  26. package/dist/dataConnectors/clickhouse.js.map +1 -1
  27. package/dist/dataConnectors/mongo.d.ts.map +1 -1
  28. package/dist/dataConnectors/mongo.js +50 -15
  29. package/dist/dataConnectors/mongo.js.map +1 -1
  30. package/dist/dataConnectors/mysql.d.ts.map +1 -1
  31. package/dist/dataConnectors/mysql.js +11 -0
  32. package/dist/dataConnectors/mysql.js.map +1 -1
  33. package/dist/dataConnectors/postgres.d.ts.map +1 -1
  34. package/dist/dataConnectors/postgres.js +43 -14
  35. package/dist/dataConnectors/postgres.js.map +1 -1
  36. package/dist/dataConnectors/sqlite.d.ts.map +1 -1
  37. package/dist/dataConnectors/sqlite.js +11 -0
  38. package/dist/dataConnectors/sqlite.js.map +1 -1
  39. package/dist/index.d.ts +11 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +44 -21
  42. package/dist/index.js.map +1 -1
  43. package/dist/modules/codeInjector.d.ts +2 -0
  44. package/dist/modules/codeInjector.d.ts.map +1 -1
  45. package/dist/modules/codeInjector.js +62 -6
  46. package/dist/modules/codeInjector.js.map +1 -1
  47. package/dist/modules/configValidator.d.ts +6 -0
  48. package/dist/modules/configValidator.d.ts.map +1 -1
  49. package/dist/modules/configValidator.js +209 -25
  50. package/dist/modules/configValidator.js.map +1 -1
  51. package/dist/modules/restApi.d.ts +1 -1
  52. package/dist/modules/restApi.d.ts.map +1 -1
  53. package/dist/modules/restApi.js +199 -31
  54. package/dist/modules/restApi.js.map +1 -1
  55. package/dist/modules/styles.d.ts +499 -13
  56. package/dist/modules/styles.d.ts.map +1 -1
  57. package/dist/modules/styles.js +555 -31
  58. package/dist/modules/styles.js.map +1 -1
  59. package/dist/modules/utils.d.ts +7 -15
  60. package/dist/modules/utils.d.ts.map +1 -1
  61. package/dist/modules/utils.js +45 -68
  62. package/dist/modules/utils.js.map +1 -1
  63. package/dist/servers/express.d.ts +5 -0
  64. package/dist/servers/express.d.ts.map +1 -1
  65. package/dist/servers/express.js +40 -1
  66. package/dist/servers/express.js.map +1 -1
  67. package/dist/spa/index.html +1 -1
  68. package/dist/spa/package-lock.json +1208 -708
  69. package/dist/spa/package.json +34 -34
  70. package/dist/spa/src/App.vue +132 -174
  71. package/dist/spa/src/adminforth.ts +41 -17
  72. package/dist/spa/src/afcl/AreaChart.vue +0 -1
  73. package/dist/spa/src/afcl/BarChart.vue +2 -2
  74. package/dist/spa/src/afcl/Button.vue +3 -3
  75. package/dist/spa/src/afcl/ButtonGroup.vue +91 -0
  76. package/dist/spa/src/afcl/Card.vue +25 -0
  77. package/dist/spa/src/afcl/Checkbox.vue +21 -13
  78. package/dist/spa/src/afcl/CountryFlag.vue +4 -1
  79. package/dist/spa/src/{components/CustomDatePicker.vue → afcl/DatePicker.vue} +95 -9
  80. package/dist/spa/src/afcl/Dialog.vue +47 -27
  81. package/dist/spa/src/afcl/Dropzone.vue +145 -48
  82. package/dist/spa/src/afcl/Input.vue +14 -6
  83. package/dist/spa/src/afcl/JsonViewer.vue +25 -0
  84. package/dist/spa/src/afcl/LinkButton.vue +3 -3
  85. package/dist/spa/src/afcl/PieChart.vue +5 -5
  86. package/dist/spa/src/afcl/ProgressBar.vue +7 -7
  87. package/dist/spa/src/afcl/Select.vue +82 -34
  88. package/dist/spa/src/afcl/Skeleton.vue +6 -6
  89. package/dist/spa/src/afcl/Table.vue +313 -75
  90. package/dist/spa/src/afcl/Textarea.vue +31 -0
  91. package/dist/spa/src/afcl/Toggle.vue +32 -0
  92. package/dist/spa/src/afcl/Tooltip.vue +28 -18
  93. package/dist/spa/src/afcl/VerticalTabs.vue +21 -7
  94. package/dist/spa/src/afcl/index.ts +6 -3
  95. package/dist/spa/src/components/AcceptModal.vue +48 -14
  96. package/dist/spa/src/components/Breadcrumbs.vue +5 -5
  97. package/dist/spa/src/components/CallActionWrapper.vue +15 -0
  98. package/dist/spa/src/components/ColumnValueInput.vue +38 -18
  99. package/dist/spa/src/components/ColumnValueInputWrapper.vue +4 -3
  100. package/dist/spa/src/components/CustomDateRangePicker.vue +9 -8
  101. package/dist/spa/src/components/CustomRangePicker.vue +37 -21
  102. package/dist/spa/src/components/ErrorMessage.vue +21 -0
  103. package/dist/spa/src/components/Filters.vue +195 -132
  104. package/dist/spa/src/components/GroupsTable.vue +9 -8
  105. package/dist/spa/src/components/MenuLink.vue +95 -23
  106. package/dist/spa/src/components/ResourceForm.vue +99 -51
  107. package/dist/spa/src/components/ResourceListTable.vue +121 -95
  108. package/dist/spa/src/components/ResourceListTableVirtual.vue +119 -88
  109. package/dist/spa/src/components/ShowTable.vue +21 -15
  110. package/dist/spa/src/components/Sidebar.vue +472 -0
  111. package/dist/spa/src/components/SingleSkeletLoader.vue +6 -6
  112. package/dist/spa/src/components/SkeleteLoader.vue +3 -3
  113. package/dist/spa/src/components/ThreeDotsMenu.vue +84 -15
  114. package/dist/spa/src/components/Toast.vue +40 -29
  115. package/dist/spa/src/components/UserMenuSettingsButton.vue +69 -0
  116. package/dist/spa/src/components/ValueRenderer.vue +44 -17
  117. package/dist/spa/src/controls/BoolToggle.vue +34 -0
  118. package/dist/spa/src/i18n.ts +5 -3
  119. package/dist/spa/src/main.ts +1 -1
  120. package/dist/spa/src/renderers/CompactField.vue +1 -1
  121. package/dist/spa/src/renderers/CompactUUID.vue +1 -1
  122. package/dist/spa/src/router/index.ts +8 -0
  123. package/dist/spa/src/shims-vue.d.ts +5 -0
  124. package/dist/spa/src/spa_types/core.ts +13 -1
  125. package/dist/spa/src/stores/core.ts +15 -1
  126. package/dist/spa/src/stores/filters.ts +33 -2
  127. package/dist/spa/src/stores/modal.ts +6 -1
  128. package/dist/spa/src/stores/toast.ts +22 -3
  129. package/dist/spa/src/types/Back.ts +168 -23
  130. package/dist/spa/src/types/Common.ts +109 -32
  131. package/dist/spa/src/types/FrontendAPI.ts +32 -23
  132. package/dist/spa/src/types/adapters/CaptchaAdapter.ts +34 -0
  133. package/dist/spa/src/types/adapters/EmailAdapter.ts +2 -4
  134. package/dist/spa/src/types/adapters/ImageVisionAdapter.ts +30 -0
  135. package/dist/spa/src/types/adapters/KeyValueAdapter.ts +16 -0
  136. package/dist/spa/src/types/adapters/StorageAdapter.ts +4 -2
  137. package/dist/spa/src/types/adapters/index.ts +3 -0
  138. package/dist/spa/src/utils.ts +291 -11
  139. package/dist/spa/src/views/CreateView.vue +88 -22
  140. package/dist/spa/src/views/EditView.vue +55 -22
  141. package/dist/spa/src/views/ListView.vue +144 -87
  142. package/dist/spa/src/views/LoginView.vue +26 -35
  143. package/dist/spa/src/views/ResourceParent.vue +2 -2
  144. package/dist/spa/src/views/SettingsView.vue +121 -0
  145. package/dist/spa/src/views/ShowView.vue +83 -53
  146. package/dist/spa/src/websocket.ts +6 -1
  147. package/dist/spa/tsconfig.app.json +1 -1
  148. package/dist/spa/vite.config.ts +45 -2
  149. package/dist/types/Back.d.ts +151 -14
  150. package/dist/types/Back.d.ts.map +1 -1
  151. package/dist/types/Back.js +15 -0
  152. package/dist/types/Back.js.map +1 -1
  153. package/dist/types/Common.d.ts +123 -29
  154. package/dist/types/Common.d.ts.map +1 -1
  155. package/dist/types/Common.js.map +1 -1
  156. package/dist/types/FrontendAPI.d.ts +32 -18
  157. package/dist/types/FrontendAPI.d.ts.map +1 -1
  158. package/dist/types/FrontendAPI.js.map +1 -1
  159. package/dist/types/adapters/CaptchaAdapter.d.ts +30 -0
  160. package/dist/types/adapters/CaptchaAdapter.d.ts.map +1 -0
  161. package/dist/types/adapters/CaptchaAdapter.js +5 -0
  162. package/dist/types/adapters/CaptchaAdapter.js.map +1 -0
  163. package/dist/types/adapters/EmailAdapter.d.ts +2 -3
  164. package/dist/types/adapters/EmailAdapter.d.ts.map +1 -1
  165. package/dist/types/adapters/ImageVisionAdapter.d.ts +25 -0
  166. package/dist/types/adapters/ImageVisionAdapter.d.ts.map +1 -0
  167. package/dist/types/adapters/ImageVisionAdapter.js +2 -0
  168. package/dist/types/adapters/ImageVisionAdapter.js.map +1 -0
  169. package/dist/types/adapters/KeyValueAdapter.d.ts +10 -0
  170. package/dist/types/adapters/KeyValueAdapter.d.ts.map +1 -0
  171. package/dist/types/adapters/KeyValueAdapter.js +2 -0
  172. package/dist/types/adapters/KeyValueAdapter.js.map +1 -0
  173. package/dist/types/adapters/StorageAdapter.d.ts +2 -0
  174. package/dist/types/adapters/StorageAdapter.d.ts.map +1 -1
  175. package/dist/types/adapters/index.d.ts +3 -0
  176. package/dist/types/adapters/index.d.ts.map +1 -1
  177. package/package.json +4 -2
@@ -1,4 +1,3 @@
1
-
2
1
  /**
3
2
  * Types that are common for both frontend side (SPA) and backend side (server).
4
3
  */
@@ -31,6 +30,21 @@ export enum AdminForthFilterOperators {
31
30
  OR = 'or',
32
31
  };
33
32
 
33
+ export type FilterParams = {
34
+ /**
35
+ * Field of resource to filter
36
+ */
37
+ field: string;
38
+ /**
39
+ * Operator of filter
40
+ */
41
+ operator: AdminForthFilterOperators;
42
+ /**
43
+ * Value of filter
44
+ */
45
+ value: string | number | boolean ;
46
+ }
47
+
34
48
  export enum AdminForthSortDirections {
35
49
  asc = 'asc',
36
50
  desc = 'desc',
@@ -68,6 +82,11 @@ export type AllowedActionsResolved = {
68
82
  [key in AllowedActionsEnum]: boolean
69
83
  }
70
84
 
85
+ // conditional operators for predicates
86
+ type Value = any;
87
+ type Operators = { $eq: Value } | { $not: Value } | { $gt: Value } | { $gte: Value } | { $lt: Value } | { $lte: Value } | { $in: Value[] } | { $nin: Value[] } | { $includes: Value } | { $nincludes: Value };
88
+ export type Predicate = { $and: Predicate[] } | { $or: Predicate[] } | { [key: string]: Operators | Value };
89
+
71
90
  export interface AdminUser {
72
91
  /**
73
92
  * primaryKey field value of user in table which is defined by {@link AdminForthConfig.auth.usersResourceId}
@@ -95,12 +114,9 @@ export interface AdminForthBulkActionCommon {
95
114
  label: string,
96
115
 
97
116
  /**
98
- * Bulk Action button state 'danger'|success|'active',
99
- * * 'danger' - red button
100
- * * 'success' - green button
101
- * * 'active' - blue button
117
+ * Add custom class
102
118
  **/
103
- state?: 'danger' | 'success' | 'active';
119
+ buttonCustomCssClass?: string;
104
120
 
105
121
  /**
106
122
  * Optional small badge for button which will be displayed in the list view
@@ -122,6 +138,10 @@ export interface AdminForthBulkActionCommon {
122
138
  */
123
139
  successMessage?: string,
124
140
 
141
+ /**
142
+ * Show in three dots dropdown menu in list view.
143
+ */
144
+ showInThreeDotsDropdown?: boolean,
125
145
  }
126
146
 
127
147
  export interface AdminForthFieldComponents {
@@ -261,11 +281,30 @@ export interface AdminForthComponentDeclarationFull {
261
281
  * </script>
262
282
  *
263
283
  */
264
- meta?: any,
284
+ meta?: {
285
+ /**
286
+ * Controls sidebar and header visibility for custom pages
287
+ * - 'default': Show both sidebar and header (default behavior)
288
+ * - 'none': Hide both sidebar and header (full custom layout)
289
+ * - 'preferIconOnly': Show header but prefer icon-only sidebar
290
+ * - 'headerOnly': Show only header (full custom layout)
291
+ */
292
+ sidebarAndHeader?: 'default' | 'none' | 'preferIconOnly' | 'headerOnly',
293
+
294
+ [key: string]: any,
295
+ }
265
296
  }
297
+ import { type AdminForthActionInput } from './Back.js'
298
+ export { type AdminForthActionInput } from './Back.js'
266
299
 
267
300
  export type AdminForthComponentDeclaration = AdminForthComponentDeclarationFull | string;
268
301
 
302
+ export type FieldGroup = {
303
+ groupName: string;
304
+ columns: string[];
305
+ noTitle?: boolean;
306
+ };
307
+
269
308
  /**
270
309
  * Resource describes one table or collection in database.
271
310
  * AdminForth generates set of pages for 'list', 'show', 'edit', 'create', 'filter' operations for each resource.
@@ -347,6 +386,11 @@ export interface AdminForthResourceInputCommon {
347
386
  direction: AdminForthSortDirections | string,
348
387
  }
349
388
 
389
+ /*
390
+ * Custom actions list. Actions available in show, edit and create views.
391
+ */
392
+ actions?: AdminForthActionInput[],
393
+
350
394
  /**
351
395
  * Custom bulk actions list. Bulk actions available in list view when user selects multiple records by
352
396
  * using checkboxes.
@@ -374,26 +418,10 @@ export interface AdminForthResourceInputCommon {
374
418
  /**
375
419
  * Allows to make groups of columns in show, create and edit resource pages.
376
420
  */
377
- fieldGroups?: {
378
- groupName: string;
379
- columns: string[];
380
- noTitle?: boolean;
381
- }[];
382
- createFieldGroups?: {
383
- groupName: string;
384
- columns: string[];
385
- noTitle?: boolean;
386
- }[];
387
- editFieldGroups?: {
388
- groupName: string;
389
- columns: string[];
390
- noTitle?: boolean;
391
- }[];
392
- showFieldGroups?: {
393
- groupName: string;
394
- columns: string[];
395
- noTitle?: boolean;
396
- }[];
421
+ fieldGroups?: FieldGroup[];
422
+ createFieldGroups?: FieldGroup[];
423
+ editFieldGroups?: FieldGroup[];
424
+ showFieldGroups?: FieldGroup[];
397
425
 
398
426
  /**
399
427
  * Page size for list view
@@ -471,6 +499,7 @@ export interface AdminForthResourceInputCommon {
471
499
  list?: {
472
500
  beforeBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
473
501
  afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
502
+ beforeActionButtons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
474
503
  bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
475
504
  threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
476
505
  customActionIcons?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
@@ -499,6 +528,11 @@ export interface AdminForthResourceInputCommon {
499
528
  afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
500
529
  bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
501
530
  threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
531
+ /**
532
+ * Custom Save button component for Edit page.
533
+ * Accepts props: [record, resource, adminUser, meta, saving, validating, isValid, disabled, saveRecord]
534
+ */
535
+ saveButton?: AdminForthComponentDeclaration,
502
536
  },
503
537
 
504
538
  /**
@@ -511,6 +545,11 @@ export interface AdminForthResourceInputCommon {
511
545
  afterBreadcrumbs?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
512
546
  bottom?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
513
547
  threeDotsDropdownItems?: AdminForthComponentDeclaration | Array<AdminForthComponentDeclaration>,
548
+ /**
549
+ * Custom Save button component for Create page.
550
+ * Accepts props: [record, resource, adminUser, meta, saving, validating, isValid, disabled, saveRecord]
551
+ */
552
+ saveButton?: AdminForthComponentDeclaration,
514
553
  },
515
554
  }
516
555
  },
@@ -584,6 +623,8 @@ export interface AdminForthForeignResourceCommon {
584
623
  polymorphicResources?: Array<AdminForthPolymorphicForeignResource>,
585
624
  polymorphicOn?: string,
586
625
  unsetLabel?: string,
626
+ searchableFields?: string | string[],
627
+ searchIsCaseSensitive?: boolean,
587
628
  }
588
629
 
589
630
  export type FillOnCreateFunction = (params: {
@@ -810,9 +851,6 @@ export interface AdminForthResourceColumnInputCommon {
810
851
  */
811
852
  minLength?: number,
812
853
 
813
- min?: number,
814
- max?: number,
815
-
816
854
  /**
817
855
  * Minimum value that can be entered in this field.
818
856
  */
@@ -865,6 +903,15 @@ export interface AdminForthResourceColumnInputCommon {
865
903
  */
866
904
  masked?: boolean,
867
905
 
906
+ /**
907
+ * Sticky position for column
908
+ */
909
+ listSticky?: boolean;
910
+
911
+ /**
912
+ * Show field only if certain conditions are met.
913
+ */
914
+ showIf?: Predicate;
868
915
  }
869
916
 
870
917
  export interface AdminForthResourceColumnCommon extends AdminForthResourceColumnInputCommon {
@@ -878,6 +925,15 @@ export interface AdminForthResourceColumnCommon extends AdminForthResourceColumn
878
925
 
879
926
  editingNote?: { create?: string, edit?: string },
880
927
 
928
+ /**
929
+ * Minimal value stored in this field.
930
+ */
931
+ min?: number,
932
+
933
+ /**
934
+ * Maximum value stored in this field.
935
+ */
936
+ max?: number,
881
937
  }
882
938
 
883
939
  export enum AdminForthMenuTypes {
@@ -1055,16 +1111,24 @@ export interface AdminForthConfigForFrontend {
1055
1111
  usernameFieldName: string,
1056
1112
  loginBackgroundImage: string,
1057
1113
  loginBackgroundPosition: string,
1114
+ removeBackgroundBlendMode: boolean,
1058
1115
  title?: string,
1059
1116
  demoCredentials?: string,
1060
- loginPromptHTML?: string,
1117
+ loginPromptHTML?: string | (() => string | Promise<string> | void | Promise<void> | Promise<undefined>) | undefined
1061
1118
  loginPageInjections: {
1062
1119
  underInputs: Array<AdminForthComponentDeclaration>,
1063
1120
  panelHeader: Array<AdminForthComponentDeclaration>,
1064
1121
  },
1065
1122
  rememberMeDays: number,
1066
1123
  showBrandNameInSidebar: boolean,
1124
+ showBrandLogoInSidebar: boolean,
1067
1125
  brandLogo?: string,
1126
+ iconOnlySidebar?: {
1127
+ logo?: string,
1128
+ enabled?: boolean,
1129
+ expandedSidebarWidth?: string,
1130
+ },
1131
+ singleTheme?: 'light' | 'dark',
1068
1132
  datesFormat: string,
1069
1133
  timeFormat: string,
1070
1134
  auth: any,
@@ -1079,8 +1143,21 @@ export interface AdminForthConfigForFrontend {
1079
1143
  userMenu: Array<AdminForthComponentDeclarationFull>,
1080
1144
  header: Array<AdminForthComponentDeclarationFull>,
1081
1145
  sidebar: Array<AdminForthComponentDeclarationFull>,
1146
+ sidebarTop: Array<AdminForthComponentDeclarationFull>,
1082
1147
  everyPageBottom: Array<AdminForthComponentDeclarationFull>,
1083
- }
1148
+ },
1149
+ customHeadItems?: {
1150
+ tagName: string;
1151
+ attributes: Record<string, string | boolean>;
1152
+ innerCode?: string;
1153
+ }[],
1154
+ settingPages?:{
1155
+ icon?: string,
1156
+ pageLabel: string,
1157
+ slug?: string,
1158
+ component: string,
1159
+ isVisible?: boolean
1160
+ }[],
1084
1161
  }
1085
1162
 
1086
1163
  export interface GetBaseConfigResponse {
@@ -1,21 +1,4 @@
1
- import type { AdminForthFilterOperators } from "./Common.js";
2
-
3
-
4
-
5
- export type FilterParams = {
6
- /**
7
- * Field of resource to filter
8
- */
9
- field: string;
10
- /**
11
- * Operator of filter
12
- */
13
- operator: AdminForthFilterOperators;
14
- /**
15
- * Value of filter
16
- */
17
- value: string | number | boolean ;
18
- }
1
+ import type { AdminForthFilterOperators, FilterParams } from "./Common.js";
19
2
 
20
3
  export interface FrontendAPIInterface {
21
4
 
@@ -55,7 +38,7 @@ export interface FrontendAPIInterface {
55
38
  *
56
39
  * @param params - The parameters of the alert
57
40
  */
58
- alert(params:AlertParams): void;
41
+ alert(params:AlertParams): void | Promise<string> | string;
59
42
 
60
43
 
61
44
  list: {
@@ -82,27 +65,40 @@ export interface FrontendAPIInterface {
82
65
  */
83
66
  closeThreeDotsDropdown(): void;
84
67
 
85
-
86
68
  /**
87
- * Set a filter in the list
88
- * Works only when user located on the list page.
69
+ * Set a filter in the list.
70
+ * Works only when user located on the list page. If filter already exists, it will be replaced with the new one.
89
71
  * Can be used to set filter from charts or other components in pageInjections.
90
72
  *
73
+ * Filters are automatically marked as hidden (won't count in badge) if:
74
+ * - Column has showIn.filter: false
75
+ *
91
76
  * Example:
92
77
  *
93
78
  * ```ts
94
79
  * import adminforth from '@/adminforth'
95
80
  *
81
+ * // Regular filter (will show in badge if column.showIn.filter !== false)
96
82
  * adminforth.list.setFilter({field: 'name', operator: 'ilike', value: 'john'})
83
+ *
84
+ * // Hidden filter (won't show in badge if column.showIn.filter === false)
85
+ * adminforth.list.setFilter({field: 'internal_status', operator: 'eq', value: 'active'})
97
86
  * ```
98
87
  *
88
+ * Please note that you can set/update filter even for fields which have showIn.filter=false in resource configuration.
89
+ * Also you can set filter for virtual columns. For example Universal search plugin calls updateFilter for virtual column which has showIn.filter=false (because we dont want to show this column in filter dropdown, plugin renders its own filter UI)
90
+ *
99
91
  * @param filter - The filter to set
100
92
  */
101
93
  setFilter(filter: FilterParams): void;
102
94
 
103
95
  /**
96
+ * DEPRECATED: does the same as setFilter, kept for backward compatibility
104
97
  * Update a filter in the list
105
98
  *
99
+ * Filters visibility in badge is automatically determined by column configuration:
100
+ * - Hidden if column has showIn.filter: false
101
+ *
106
102
  * Example:
107
103
  *
108
104
  * ```ts
@@ -121,6 +117,14 @@ export interface FrontendAPIInterface {
121
117
  clearFilters(): void;
122
118
  }
123
119
 
120
+ show: {
121
+ /**
122
+ * Full refresh the current record on the show page. Loader may be shown during fetching.
123
+ * Fire-and-forget; you don't need to await it.
124
+ */
125
+ refresh(): void;
126
+ }
127
+
124
128
  menu: {
125
129
  /**
126
130
  * Refreshes the badges in the menu, by recalling the badge function for each menu item
@@ -171,7 +175,12 @@ export type AlertParams = {
171
175
  * Default is 10 seconds;
172
176
  */
173
177
  timeout?: number | 'unlimited';
174
-
178
+
179
+ /**
180
+ * Optional buttons to display in the alert
181
+ */
182
+ buttons?: {value: any, label: string}[];
183
+
175
184
  }
176
185
 
177
186
 
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Interface for Captcha adapters.
3
+ */
4
+
5
+ export interface CaptchaAdapter {
6
+ /**
7
+ * Returns the script source URL for the captcha widget.
8
+ */
9
+ getScriptSrc(): string;
10
+
11
+ /**
12
+ * Returns the site key for the captcha.
13
+ */
14
+ getSiteKey(): string;
15
+
16
+ /**
17
+ * Returns the widget ID for the captcha.
18
+ */
19
+ getWidgetId(): string;
20
+
21
+ /**
22
+ * Returns the script HTML for the captcha widget.
23
+ */
24
+ getRenderWidgetCode(): string;
25
+
26
+ /**
27
+ * Returns the function name to render the captcha widget.
28
+ */
29
+ getRenderWidgetFunctionName(): string;
30
+ /**
31
+ * Validates the captcha token.
32
+ */
33
+ validate(token: string, ip: string): Promise<Record<string, any>>;
34
+ }
@@ -1,8 +1,8 @@
1
- interface EmailAdapter {
1
+ export interface EmailAdapter {
2
2
 
3
3
  /**
4
4
  * This method is called to validate the configuration of the adapter
5
- * and should throw a clear user-readbale error if the configuration is invalid.
5
+ * and should throw a clear user-readable error if the configuration is invalid.
6
6
  */
7
7
  validate(): Promise<void>;
8
8
 
@@ -25,5 +25,3 @@ interface EmailAdapter {
25
25
  ok?: boolean;
26
26
  }>;
27
27
  }
28
-
29
- export { EmailAdapter };
@@ -0,0 +1,30 @@
1
+ export interface ImageVisionAdapter {
2
+
3
+ /**
4
+ * This method is called to validate the configuration of the adapter
5
+ * and should throw a clear user-readable error if the configuration is invalid.
6
+ */
7
+ validate(): void;
8
+
9
+ /**
10
+ * Input file extension supported
11
+ */
12
+ inputFileExtensionSupported(): string[];
13
+
14
+ /**
15
+ * This method should generate an image based on the provided prompt and input files.
16
+ * @param prompt - The prompt to generate the image
17
+ * @param inputFileUrls - An array of input file paths (optional)
18
+ * @returns A promise that resolves to an object containing the generated image and any error message
19
+ */
20
+ generate({
21
+ prompt,
22
+ inputFileUrls,
23
+ }: {
24
+ prompt: string,
25
+ inputFileUrls: string[],
26
+ }): Promise<{
27
+ response: string;
28
+ error?: string;
29
+ }>;
30
+ }
@@ -0,0 +1,16 @@
1
+
2
+ /**
3
+ * Might have implementations like RAM, Redis, Memcached,
4
+ *
5
+ */
6
+ export interface KeyValueAdapter {
7
+
8
+ get(key: string): Promise<string | null>;
9
+
10
+ set(key: string, value: string, expiresInSeconds?: number): Promise<void>;
11
+
12
+ delete(key: string): Promise<void>;
13
+
14
+ }
15
+
16
+
@@ -39,7 +39,8 @@ export interface StorageAdapter {
39
39
  * This method should work even if the file does not exist yet (e.g. only presigned URL was generated).
40
40
  * @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
41
41
  */
42
- markKeyForDeletation(key: string): Promise<void>;
42
+ markKeyForDeletation(key: string): Promise<void>; //TODO delete after one year
43
+ markKeyForDeletion(key: string): Promise<void>;
43
44
 
44
45
 
45
46
  /**
@@ -47,7 +48,8 @@ export interface StorageAdapter {
47
48
  * This method should be used to cancel the deletion of the file if it was marked for deletion.
48
49
  * @param key - The key of the file to be uploaded e.g. "uploads/file.txt"
49
50
  */
50
- markKeyForNotDeletation(key: string): Promise<void>;
51
+ markKeyForNotDeletation(key: string): Promise<void>; //TODO delete after one year
52
+ markKeyForNotDeletion(key: string): Promise<void>;
51
53
 
52
54
 
53
55
  /**
@@ -1,5 +1,8 @@
1
1
  export type { EmailAdapter } from './EmailAdapter.js';
2
2
  export type { CompletionAdapter } from './CompletionAdapter.js';
3
3
  export type { ImageGenerationAdapter } from './ImageGenerationAdapter.js';
4
+ export type { KeyValueAdapter } from './KeyValueAdapter.js';
5
+ export type { ImageVisionAdapter } from './ImageVisionAdapter.js';
4
6
  export type { OAuth2Adapter } from './OAuth2Adapter.js';
5
7
  export type { StorageAdapter } from './StorageAdapter.js';
8
+ export type { CaptchaAdapter } from './CaptchaAdapter.js';