@infuro/cms-core 1.0.23 → 1.0.25

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';
@@ -106,13 +121,31 @@ type CrudFilterOption = {
106
121
  value: string;
107
122
  label: string;
108
123
  };
124
+ type CrudFilterFieldType = "select" | "dateRange" | "text" | "number" | "multiSelect";
109
125
  type CrudFilterItem = {
110
126
  param: string;
111
127
  label: string;
112
- type: 'select' | 'dateRange' | 'text';
128
+ type: CrudFilterFieldType;
113
129
  options?: CrudFilterOption[];
130
+ /** When set, merge runtime options from relation list fetch (id → label). */
131
+ relationApi?: string;
132
+ relationLabelField?: string;
133
+ relationValueField?: string;
134
+ /**
135
+ * For `dateRange`: URL query keys (default `${param}From` / `${param}To`, e.g. `createdAtFrom`).
136
+ * Use explicit `dateFrom` / `dateTo` when `param` is `date` (legacy lists).
137
+ */
138
+ fromParam?: string;
139
+ toParam?: string;
140
+ /**
141
+ * For `number` filters: query keys for range (defaults `${param}Min`, `${param}Max`).
142
+ * List handlers must read these keys if server-side filtering is required.
143
+ */
144
+ minParam?: string;
145
+ maxParam?: string;
114
146
  };
115
- declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, extraListParams, manageUserGroups, }: {
147
+
148
+ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, filterColumns, extraListParams, manageUserGroups, }: {
116
149
  title: string;
117
150
  apiEndpoint: string;
118
151
  columns: any[];
@@ -121,6 +154,8 @@ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, custom
121
154
  defaultSortField?: string;
122
155
  defaultSortOrder?: 'asc' | 'desc';
123
156
  filters?: CrudFilterItem[];
157
+ /** Full column config for deriving list filters (`select`, `boolean`, `relationApi`). List `columns` may omit hidden fields. */
158
+ filterColumns?: any[];
124
159
  extraListParams?: Record<string, string>;
125
160
  /** When true, show group (role) selector for each user; requires GET /api/admin/roles. */
126
161
  manageUserGroups?: boolean;
@@ -134,15 +169,21 @@ type CreateEditFormProps = {
134
169
  apiEndpoint: string;
135
170
  columns: any[];
136
171
  existingData?: Record<string, unknown> | null;
172
+ /** When creating: pre-fill the modal from this row (POST only; omit `id` in payload). */
173
+ duplicateSeed?: Record<string, unknown> | null;
137
174
  };
138
- declare function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns, existingData, }: CreateEditFormProps): react_jsx_runtime.JSX.Element | null;
175
+ declare function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns, existingData, duplicateSeed, }: CreateEditFormProps): react_jsx_runtime.JSX.Element | null;
139
176
 
140
- declare function FormBuilder({ formId }: {
177
+ declare function FormBuilder({ formId, duplicateFromId, }: {
141
178
  formId?: string;
179
+ /** When creating (`!formId`), load this id and clone into a new form. */
180
+ duplicateFromId?: string;
142
181
  }): react_jsx_runtime.JSX.Element;
143
182
 
144
- declare function BlogEditor({ existingBlog }: {
183
+ declare function BlogEditor({ existingBlog, duplicateSource, }: {
145
184
  existingBlog?: any;
185
+ /** Loaded row to copy into a new post (save always POSTs). */
186
+ duplicateSource?: any;
146
187
  }): react_jsx_runtime.JSX.Element;
147
188
 
148
189
  interface AnalyticsChartProps {
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';
@@ -106,13 +121,31 @@ type CrudFilterOption = {
106
121
  value: string;
107
122
  label: string;
108
123
  };
124
+ type CrudFilterFieldType = "select" | "dateRange" | "text" | "number" | "multiSelect";
109
125
  type CrudFilterItem = {
110
126
  param: string;
111
127
  label: string;
112
- type: 'select' | 'dateRange' | 'text';
128
+ type: CrudFilterFieldType;
113
129
  options?: CrudFilterOption[];
130
+ /** When set, merge runtime options from relation list fetch (id → label). */
131
+ relationApi?: string;
132
+ relationLabelField?: string;
133
+ relationValueField?: string;
134
+ /**
135
+ * For `dateRange`: URL query keys (default `${param}From` / `${param}To`, e.g. `createdAtFrom`).
136
+ * Use explicit `dateFrom` / `dateTo` when `param` is `date` (legacy lists).
137
+ */
138
+ fromParam?: string;
139
+ toParam?: string;
140
+ /**
141
+ * For `number` filters: query keys for range (defaults `${param}Min`, `${param}Max`).
142
+ * List handlers must read these keys if server-side filtering is required.
143
+ */
144
+ minParam?: string;
145
+ maxParam?: string;
114
146
  };
115
- declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, extraListParams, manageUserGroups, }: {
147
+
148
+ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, customViewPageUrl, defaultSortField, defaultSortOrder, filters, filterColumns, extraListParams, manageUserGroups, }: {
116
149
  title: string;
117
150
  apiEndpoint: string;
118
151
  columns: any[];
@@ -121,6 +154,8 @@ declare function AdminCRUD({ title, apiEndpoint, columns, addEditPageUrl, custom
121
154
  defaultSortField?: string;
122
155
  defaultSortOrder?: 'asc' | 'desc';
123
156
  filters?: CrudFilterItem[];
157
+ /** Full column config for deriving list filters (`select`, `boolean`, `relationApi`). List `columns` may omit hidden fields. */
158
+ filterColumns?: any[];
124
159
  extraListParams?: Record<string, string>;
125
160
  /** When true, show group (role) selector for each user; requires GET /api/admin/roles. */
126
161
  manageUserGroups?: boolean;
@@ -134,15 +169,21 @@ type CreateEditFormProps = {
134
169
  apiEndpoint: string;
135
170
  columns: any[];
136
171
  existingData?: Record<string, unknown> | null;
172
+ /** When creating: pre-fill the modal from this row (POST only; omit `id` in payload). */
173
+ duplicateSeed?: Record<string, unknown> | null;
137
174
  };
138
- declare function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns, existingData, }: CreateEditFormProps): react_jsx_runtime.JSX.Element | null;
175
+ declare function CreateEditForm({ isOpen, onClose, onSaveSuccess, apiEndpoint, columns, existingData, duplicateSeed, }: CreateEditFormProps): react_jsx_runtime.JSX.Element | null;
139
176
 
140
- declare function FormBuilder({ formId }: {
177
+ declare function FormBuilder({ formId, duplicateFromId, }: {
141
178
  formId?: string;
179
+ /** When creating (`!formId`), load this id and clone into a new form. */
180
+ duplicateFromId?: string;
142
181
  }): react_jsx_runtime.JSX.Element;
143
182
 
144
- declare function BlogEditor({ existingBlog }: {
183
+ declare function BlogEditor({ existingBlog, duplicateSource, }: {
145
184
  existingBlog?: any;
185
+ /** Loaded row to copy into a new post (save always POSTs). */
186
+ duplicateSource?: any;
146
187
  }): react_jsx_runtime.JSX.Element;
147
188
 
148
189
  interface AnalyticsChartProps {