adminforth 1.3.47 → 1.3.49-next.0

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.
@@ -112,7 +112,10 @@ export default class ConfigValidator {
112
112
  errors.push(...this.checkCustomFileExists(this.config.customization.favicon));
113
113
  }
114
114
  if (!this.config.customization.datesFormat) {
115
- this.config.customization.datesFormat = 'MMM D, YYYY HH:mm:ss';
115
+ this.config.customization.datesFormat = 'MMM D, YYYY';
116
+ }
117
+ if (!this.config.customization.timeFormat) {
118
+ this.config.customization.timeFormat = 'HH:mm:ss';
116
119
  }
117
120
  if (this.config.resources) {
118
121
  this.config.resources.forEach((res) => {
@@ -220,6 +220,7 @@ export default class AdminForthRestAPI {
220
220
  showBrandNameInSidebar: this.adminforth.config.customization.showBrandNameInSidebar,
221
221
  brandLogo: this.adminforth.config.customization.brandLogo,
222
222
  datesFormat: this.adminforth.config.customization.datesFormat,
223
+ timeFormat: this.adminforth.config.customization.timeFormat,
223
224
  deleteConfirmation: this.adminforth.config.deleteConfirmation,
224
225
  auth: this.adminforth.config.auth,
225
226
  usernameField: this.adminforth.config.auth.usernameField,
@@ -127,7 +127,11 @@ export default class ConfigValidator implements IConfigValidator {
127
127
  }
128
128
 
129
129
  if (!this.config.customization.datesFormat) {
130
- this.config.customization.datesFormat = 'MMM D, YYYY HH:mm:ss';
130
+ this.config.customization.datesFormat = 'MMM D, YYYY';
131
+ }
132
+
133
+ if (!this.config.customization.timeFormat) {
134
+ this.config.customization.timeFormat = 'HH:mm:ss';
131
135
  }
132
136
 
133
137
  if (this.config.resources) {
@@ -258,6 +258,7 @@ export default class AdminForthRestAPI {
258
258
  showBrandNameInSidebar: this.adminforth.config.customization.showBrandNameInSidebar,
259
259
  brandLogo: this.adminforth.config.customization.brandLogo,
260
260
  datesFormat: this.adminforth.config.customization.datesFormat,
261
+ timeFormat: this.adminforth.config.customization.timeFormat,
261
262
  deleteConfirmation: this.adminforth.config.deleteConfirmation,
262
263
  auth: this.adminforth.config.auth,
263
264
  usernameField: this.adminforth.config.auth.usernameField,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adminforth",
3
- "version": "1.3.47",
3
+ "version": "1.3.49-next.0",
4
4
  "description": "OpenSource Vue3 powered forth-generation admin panel",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -9,6 +9,7 @@
9
9
  "build": "tsc",
10
10
  "---prepareDist": "cp -rL spa dist/",
11
11
  "rollout": "tsc && npm version patch && npm publish && npm run rollout-doc",
12
+ "rollout-next": "tsc && npm publish --tag next",
12
13
  "rollout-doc": "cd documentation && npm run build && npm run deploy",
13
14
  "docs": "typedoc",
14
15
  "postinstall": "cd ./spa/src/ && test ! -d ./types && ln -sf ../../types ./types || echo 'types linked'"
@@ -217,7 +217,7 @@
217
217
  1
218
218
  </button>
219
219
  <input type="text"
220
- class="w-10 py-1.5 px-3 text-sm text-center text-gray-700 border border-gray-300 dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800 z-10"
220
+ class="w-12 min-w-10 py-1.5 px-3 text-sm text-center text-gray-700 border border-gray-300 dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800 z-10"
221
221
  v-model="page"/>
222
222
 
223
223
  <button
@@ -18,8 +18,14 @@
18
18
  {{ checkEmptyValues(column.enum.find(e => e.value === record[column.name])?.label || record[column.name], route.meta.type) }}
19
19
  </span>
20
20
  <span v-else-if="column.type === 'datetime'" class="whitespace-nowrap">
21
+ {{ checkEmptyValues(formatDateTime(record[column.name]),route.meta.type) }}
22
+ </span>
23
+ <span v-else-if="column.type === 'date'" class="whitespace-nowrap">
21
24
  {{ checkEmptyValues(formatDate(record[column.name]),route.meta.type) }}
22
25
  </span>
26
+ <span v-else-if="column.type === 'time'" class="whitespace-nowrap">
27
+ {{ checkEmptyValues(formatTime(record[column.name]),route.meta.type) }}
28
+ </span>
23
29
  <span v-else-if="column.type === 'richtext'">
24
30
  <div v-html="protectAgainstXSS(record[column.name])" class="allow-lists"></div>
25
31
  </span>
@@ -73,9 +79,19 @@ function protectAgainstXSS(value) {
73
79
  }
74
80
 
75
81
 
82
+ function formatDateTime(date) {
83
+ if (!date) return '';
84
+ return dayjs.utc(date).local().format(`${coreStore.config?.datesFormat} ${coreStore.config?.timeFormat}` || 'YYYY-MM-DD HH:mm:ss');
85
+ }
86
+
76
87
  function formatDate(date) {
77
88
  if (!date) return '';
78
- return dayjs.utc(date).local().format(coreStore.config?.datesFormat || 'YYYY-MM-DD HH:mm:ss');
89
+ return dayjs.utc(date).local().format(coreStore.config?.datesFormat || 'YYYY-MM-DD');
90
+ }
91
+
92
+ function formatTime(date) {
93
+ if (!date) return '';
94
+ return dayjs.utc(date).local().format(coreStore.config?.timeFormat || 'HH:mm:ss');
79
95
  }
80
96
  </script>
81
97
 
@@ -24,6 +24,7 @@ export type CoreConfig = {
24
24
  brandLogo: string,
25
25
  title: string,
26
26
  datesFormat: string,
27
+ timeFormat: string,
27
28
  usernameField: string,
28
29
  usernameFieldName?: string,
29
30
  deleteConfirmation?: boolean,
@@ -1303,10 +1303,17 @@ export type AdminForthConfig = {
1303
1303
  favicon?: string,
1304
1304
 
1305
1305
  /**
1306
- * DayJS format string for all dates in the app
1306
+ * DayJS format string for all dates in the app.
1307
+ * Defaulted to 'MMM D, YYYY'
1307
1308
  */
1308
1309
  datesFormat?: string,
1309
1310
 
1311
+ /**
1312
+ * DayJS format string for all datetimes in the app.
1313
+ * Defaulted to 'HH:mm:ss'
1314
+ */
1315
+ timeFormat?: string,
1316
+
1310
1317
  /**
1311
1318
  * HTML title tag value, defaults to brandName
1312
1319
  */