@galadrim/galadmin 0.1.140 → 0.1.142
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/api.js +5 -1
- package/dist/api.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +10 -8
- package/package.json +1 -1
- package/src/api.ts +5 -1
- package/src/types/config.ts +263 -253
package/dist/types/config.d.ts
CHANGED
|
@@ -63,6 +63,7 @@ export type ForeignSelectColumn = {
|
|
|
63
63
|
selectExpression?: string;
|
|
64
64
|
join?: string;
|
|
65
65
|
filters?: Filter[];
|
|
66
|
+
filtersFromUser?: (userId: number) => string;
|
|
66
67
|
orderBy?: string;
|
|
67
68
|
optional?: boolean;
|
|
68
69
|
formatForeignValue?: (record: any) => string;
|
|
@@ -77,6 +78,7 @@ export type ForeignDatalistColumn = {
|
|
|
77
78
|
selectExpression?: string;
|
|
78
79
|
join?: string;
|
|
79
80
|
filters?: Filter[];
|
|
81
|
+
filtersFromUser?: (userId: number) => string;
|
|
80
82
|
orderBy?: string;
|
|
81
83
|
optional?: boolean;
|
|
82
84
|
formatForeignValue?: (record: any) => string;
|
|
@@ -86,12 +88,12 @@ export type TextareaColumn = {
|
|
|
86
88
|
name: string;
|
|
87
89
|
};
|
|
88
90
|
export type RichTextColumn = {
|
|
89
|
-
dataType:
|
|
91
|
+
dataType: 'richText';
|
|
90
92
|
htmlField: string;
|
|
91
93
|
contentField?: string;
|
|
92
94
|
};
|
|
93
95
|
export type BetterRichTextColumn = {
|
|
94
|
-
dataType:
|
|
96
|
+
dataType: 'betterRichText';
|
|
95
97
|
htmlField: string;
|
|
96
98
|
fileUploadProperties?: FileUploadProperties;
|
|
97
99
|
};
|
|
@@ -207,7 +209,7 @@ export type CreateConfig = {
|
|
|
207
209
|
redirectToCreatedItems?: boolean;
|
|
208
210
|
};
|
|
209
211
|
export type TablePanel = {
|
|
210
|
-
type:
|
|
212
|
+
type: 'table';
|
|
211
213
|
query: string;
|
|
212
214
|
formattedQuery?: string;
|
|
213
215
|
canDownload?: boolean;
|
|
@@ -216,7 +218,7 @@ export type TablePanel = {
|
|
|
216
218
|
canCreate?: boolean;
|
|
217
219
|
canImport?: boolean;
|
|
218
220
|
importFileTypes?: string[];
|
|
219
|
-
parseImportFile?: (file: FormDataFile, id?:
|
|
221
|
+
parseImportFile?: (file: FormDataFile, id?: any) => Promise<any[]>;
|
|
220
222
|
createConfig?: CreateConfig;
|
|
221
223
|
tableName?: string;
|
|
222
224
|
primaryId?: string;
|
|
@@ -237,14 +239,14 @@ export type TablePanel = {
|
|
|
237
239
|
}) => void;
|
|
238
240
|
};
|
|
239
241
|
export type MapPanel = {
|
|
240
|
-
type:
|
|
242
|
+
type: 'map';
|
|
241
243
|
query: string;
|
|
242
244
|
latitudeField: string;
|
|
243
245
|
longitudeField: string;
|
|
244
246
|
zoom?: number;
|
|
245
247
|
};
|
|
246
248
|
export type GalleryPanel = {
|
|
247
|
-
type:
|
|
249
|
+
type: 'gallery';
|
|
248
250
|
query: string;
|
|
249
251
|
canDelete?: boolean;
|
|
250
252
|
canCreate?: boolean;
|
|
@@ -260,13 +262,13 @@ export type GalleryPanel = {
|
|
|
260
262
|
data: any;
|
|
261
263
|
}) => void;
|
|
262
264
|
deleteCallback?: string;
|
|
263
|
-
deleteCallbackFunction?: ({ id, deletedRecord }: {
|
|
265
|
+
deleteCallbackFunction?: ({ id, deletedRecord, }: {
|
|
264
266
|
id: number;
|
|
265
267
|
deletedRecord?: any;
|
|
266
268
|
}) => void;
|
|
267
269
|
};
|
|
268
270
|
export type ChatPanel = {
|
|
269
|
-
type:
|
|
271
|
+
type: 'chat';
|
|
270
272
|
getMessagesQuery: string;
|
|
271
273
|
postMessageUrl: string;
|
|
272
274
|
messageField: string;
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -176,7 +176,11 @@ export default (db, config, user) => {
|
|
|
176
176
|
const { rows: records, error } = await getRecords({
|
|
177
177
|
table: column.table,
|
|
178
178
|
page: 1,
|
|
179
|
-
filters: sqlAnd([
|
|
179
|
+
filters: sqlAnd([
|
|
180
|
+
column.filters,
|
|
181
|
+
req.body.query ? `${column.searchableName} LIKE '${column.wholeSearch ? '%' : ''}${req.body.query}%'` : null,
|
|
182
|
+
column.filtersFromUser ? column.filtersFromUser(user.userId) : null
|
|
183
|
+
]),
|
|
180
184
|
join: column.join,
|
|
181
185
|
selectExpression: column.selectExpression,
|
|
182
186
|
orderBy: column.orderBy,
|