@galadrim/galadmin 0.1.205 → 0.1.207

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.
@@ -107,16 +107,7 @@ export default ({ column, onChange, initialData }) => {
107
107
  initialData={initialData}
108
108
  />
109
109
  );
110
- } else if (dataType === "datetime") {
111
- return (
112
- <DatetimeInput
113
- column={column}
114
- onChange={onChange}
115
- initialData={initialData}
116
- withTime={true}
117
- />
118
- );
119
- } else if (dataType === "datetimeUTC") {
110
+ } else if (dataType === "datetime" || dataType === "datetimeUTC") {
120
111
  return (
121
112
  <DatetimeInput
122
113
  column={column}
@@ -8,6 +8,7 @@ export default ({ column, onChange, initialData, withTime }) => {
8
8
  const datepickerEl = window.$(datepicker.current).datepicker({
9
9
  language: "fr",
10
10
  autoClose: true,
11
+ view: column?.datepickerView || "days",
11
12
  onSelect: (_, date) => {
12
13
  if (column.dataType === "datetimeUTC") {
13
14
  onChange({ [column.name]: date.toISOString() });
package/src/index.ts CHANGED
@@ -84,7 +84,8 @@ export default (config: Config): any => {
84
84
  res.send({ success: true })
85
85
  } else if (config.authRoles) {
86
86
  for (const authRole of config.authRoles) {
87
- const { rows } = await db.query("SELECT * FROM ?? WHERE ?? = ?", [authRole.table, authRole.usernameField, req.body.username]);
87
+ const filters = authRole.filters ? `AND ${authRole.filters}` : ""
88
+ const { rows } = await db.query(`SELECT * FROM ?? WHERE ?? = ? ${filters}`, [authRole.table, authRole.usernameField, req.body.username]);
88
89
  let user;
89
90
  for (const row of rows) {
90
91
  if (await passwordMatch(req.body.password, row[authRole.passwordField])) {
@@ -54,16 +54,19 @@ export type AddressColumn = {
54
54
  export type DateColumn = {
55
55
  dataType: "date";
56
56
  name: string;
57
+ datepickerView?: "days" | "months" | "years";
57
58
  };
58
59
 
59
60
  export type DatetimeColumn = {
60
61
  dataType: "datetime";
61
62
  name: string;
63
+ datepickerView?: "days" | "months" | "years";
62
64
  };
63
65
 
64
66
  export type DateTimeUTCColumn = {
65
67
  dataType: "datetimeUTC";
66
68
  name: string;
69
+ datepickerView?: "days" | "months" | "years";
67
70
  };
68
71
 
69
72
  export type ForeignSelectColumn = {
@@ -180,7 +183,7 @@ export type CustomAction = {
180
183
  successMessage?: string;
181
184
  isBulkAction?: boolean;
182
185
  /**
183
- * A callback that will be called after the action finishes successfully
186
+ * A callback that will be called after the action finishes successfully
184
187
  * If set, the default success action will be ignored
185
188
  * @param record The record the action was called on
186
189
  * @param response The response from the action
@@ -403,6 +406,7 @@ export type AuthRole = {
403
406
  usernameField: string;
404
407
  passwordField: string;
405
408
  idField: string;
409
+ filters?: string;
406
410
  };
407
411
 
408
412
  export type Config = {