@infuro/cms-core 1.0.23 → 1.0.24

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.
package/dist/admin.d.cts CHANGED
@@ -32,24 +32,39 @@ interface CustomNavSection {
32
32
  title: string;
33
33
  items: CustomNavItem[];
34
34
  }
35
+ /** Single option for CRUD list filters and for `CustomCrudColumn.type === 'select'` form fields. */
36
+ interface CrudFilterSelectOption {
37
+ value: string;
38
+ label: string;
39
+ }
35
40
  interface CustomCrudColumn {
36
41
  field: string;
37
42
  displayName: string;
38
43
  type?: string;
44
+ /** Placeholder for plain text/number inputs in the CRUD modal form. */
45
+ placeholder?: string;
46
+ /**
47
+ * For `type: 'select'`: fixed choices in Add/Edit (e.g. job application status).
48
+ * Example: `{ field: 'status', displayName: 'Status', type: 'select', options: [{ value: 'new', label: 'New' }, ...] }`
49
+ */
50
+ options?: CrudFilterSelectOption[];
51
+ /** Initial value when creating a row (works with `select` and plain fields). */
52
+ defaultValue?: string | number | boolean;
39
53
  /** When set, form renders an async searchable relation dropdown instead of a plain input. */
40
54
  relationApi?: string;
41
55
  /** Field on the relation entity to show in the list (default: 'name'). */
42
56
  relationLabelField?: string;
43
57
  /** Field on the relation entity to use as value (default: 'id'). */
44
58
  relationValueField?: string;
45
- }
46
- /** Single filter: select (status, method, inventory) or dateRange or text (paymentRef, orderNumber). */
47
- interface CrudFilterSelectOption {
48
- value: string;
49
- label: string;
59
+ /** Override query param for auto-generated list filters (default: `field`). */
60
+ filterParam?: string;
61
+ /** Override filter control label (default: `displayName`). */
62
+ filterLabel?: string;
63
+ /** When `false`, this column is not used for auto-generated list filters. */
64
+ listFilter?: boolean;
50
65
  }
51
66
  interface CrudFilter {
52
- /** Query param name (e.g. status, dateFrom, paymentRef). */
67
+ /** Query param name (e.g. status, dateFrom, paymentRef). List filter: select, dateRange, or text. */
53
68
  param: string;
54
69
  label: string;
55
70
  type: 'select' | 'dateRange' | 'text';
@@ -111,8 +126,13 @@ type CrudFilterItem = {
111
126
  label: string;
112
127
  type: 'select' | 'dateRange' | 'text';
113
128
  options?: CrudFilterOption[];
129
+ /** When set, merge runtime options from relation list fetch (id → label). */
130
+ relationApi?: string;
131
+ relationLabelField?: string;
132
+ relationValueField?: string;
114
133
  };
115
- declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, extraListParams, manageUserGroups, }: {
134
+
135
+ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, filterColumns, extraListParams, manageUserGroups, }: {
116
136
  title: string;
117
137
  apiEndpoint: string;
118
138
  columns: any[];
@@ -121,6 +141,8 @@ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, custom
121
141
  defaultSortField?: string;
122
142
  defaultSortOrder?: 'asc' | 'desc';
123
143
  filters?: CrudFilterItem[];
144
+ /** Full column config for deriving list filters (`select`, `boolean`, `relationApi`). List `columns` may omit hidden fields. */
145
+ filterColumns?: any[];
124
146
  extraListParams?: Record<string, string>;
125
147
  /** When true, show group (role) selector for each user; requires GET /api/admin/roles. */
126
148
  manageUserGroups?: boolean;
package/dist/admin.d.ts CHANGED
@@ -32,24 +32,39 @@ interface CustomNavSection {
32
32
  title: string;
33
33
  items: CustomNavItem[];
34
34
  }
35
+ /** Single option for CRUD list filters and for `CustomCrudColumn.type === 'select'` form fields. */
36
+ interface CrudFilterSelectOption {
37
+ value: string;
38
+ label: string;
39
+ }
35
40
  interface CustomCrudColumn {
36
41
  field: string;
37
42
  displayName: string;
38
43
  type?: string;
44
+ /** Placeholder for plain text/number inputs in the CRUD modal form. */
45
+ placeholder?: string;
46
+ /**
47
+ * For `type: 'select'`: fixed choices in Add/Edit (e.g. job application status).
48
+ * Example: `{ field: 'status', displayName: 'Status', type: 'select', options: [{ value: 'new', label: 'New' }, ...] }`
49
+ */
50
+ options?: CrudFilterSelectOption[];
51
+ /** Initial value when creating a row (works with `select` and plain fields). */
52
+ defaultValue?: string | number | boolean;
39
53
  /** When set, form renders an async searchable relation dropdown instead of a plain input. */
40
54
  relationApi?: string;
41
55
  /** Field on the relation entity to show in the list (default: 'name'). */
42
56
  relationLabelField?: string;
43
57
  /** Field on the relation entity to use as value (default: 'id'). */
44
58
  relationValueField?: string;
45
- }
46
- /** Single filter: select (status, method, inventory) or dateRange or text (paymentRef, orderNumber). */
47
- interface CrudFilterSelectOption {
48
- value: string;
49
- label: string;
59
+ /** Override query param for auto-generated list filters (default: `field`). */
60
+ filterParam?: string;
61
+ /** Override filter control label (default: `displayName`). */
62
+ filterLabel?: string;
63
+ /** When `false`, this column is not used for auto-generated list filters. */
64
+ listFilter?: boolean;
50
65
  }
51
66
  interface CrudFilter {
52
- /** Query param name (e.g. status, dateFrom, paymentRef). */
67
+ /** Query param name (e.g. status, dateFrom, paymentRef). List filter: select, dateRange, or text. */
53
68
  param: string;
54
69
  label: string;
55
70
  type: 'select' | 'dateRange' | 'text';
@@ -111,8 +126,13 @@ type CrudFilterItem = {
111
126
  label: string;
112
127
  type: 'select' | 'dateRange' | 'text';
113
128
  options?: CrudFilterOption[];
129
+ /** When set, merge runtime options from relation list fetch (id → label). */
130
+ relationApi?: string;
131
+ relationLabelField?: string;
132
+ relationValueField?: string;
114
133
  };
115
- declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, extraListParams, manageUserGroups, }: {
134
+
135
+ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, filterColumns, extraListParams, manageUserGroups, }: {
116
136
  title: string;
117
137
  apiEndpoint: string;
118
138
  columns: any[];
@@ -121,6 +141,8 @@ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, custom
121
141
  defaultSortField?: string;
122
142
  defaultSortOrder?: 'asc' | 'desc';
123
143
  filters?: CrudFilterItem[];
144
+ /** Full column config for deriving list filters (`select`, `boolean`, `relationApi`). List `columns` may omit hidden fields. */
145
+ filterColumns?: any[];
124
146
  extraListParams?: Record<string, string>;
125
147
  /** When true, show group (role) selector for each user; requires GET /api/admin/roles. */
126
148
  manageUserGroups?: boolean;