plugins: config.type=date_time
Massimo Melina committed
Mar 18, 2025 at 20:14 UTC
fb22819434094c4f9c5406408c4ea50b39454fc2
2 files changed
+6
-1
admin/src/InstalledPlugins.ts
+4
@@ -20,6 +20,7 @@ import FileField from './FileField'
20
import { PLUGIN_ERRORS } from './PluginsPage'
21
import { Btn, Flex, hTooltip, IconBtn, iconTooltip, usePauseButton } from './mui'
22
import VfsPathField from './VfsPathField'
23
+import { DateTimeField } from './DateTimeField'
24
25
// updates=true will show the "check updates" version of the page
26
export default function InstalledPlugins({ updates }: { updates?: true }) {
@@ -254,6 +255,8 @@ function makeFields(config: any, values: any) {
255
catch {}
256
rest.helperText &&= md(rest.helperText, { html: false })
257
const comp = (type2comp as any)[type] as Field<any> | undefined
258
+ if (values === false && type === 'date_time')
259
+ rest.$type = 'dateTime'
260
if (comp === ArrayField) {
261
const {fields} = rest
262
rest.valuesForAdd = newObj(callable(fields, false), x => x.defaultValue)
@@ -278,6 +281,7 @@ const type2comp = {
281
username: UsernameField,
282
color: ColorField,
283
showHtml: ({ html }: any) => h(Html, {}, String(html)),
284
+ date_time: DateTimeField,
285
}
286
287
export async function startPlugin(id: string) {
dev-plugins.md
+2
-1
@@ -162,7 +162,7 @@ used must be strictly JSON (thus, no single quotes, only double quotes for strin
162
### FieldDescriptor
163
164
A FieldDescriptor is an object and can be empty. Currently, these optional properties are supported:
165
-- `type: 'string' | 'number' | 'boolean' | 'select' | 'multiselect' | 'real_path' | 'vfs_path' | 'array' | 'username' | 'color'` . Default is `string`.
165
+- `type: 'string' | 'number' | 'boolean' | 'select' | 'multiselect' | 'real_path' | 'vfs_path' | 'array' | 'username' | 'color' | 'date_time'` . Default is `string`.
166
- `label: string` what name to display next to the field. Default is based on `key`.
167
- `defaultValue: any` value to be used when nothing is set. Default is undefined.
168
- `helperText: string` extra text printed next to the field.
@@ -204,6 +204,7 @@ Based on `type`, other properties are supported:
204
- `groups: undefined | boolean` true if you want only groups, false if you want only users. Default is undefined.
205
- `multiple: boolean` if you set this to true, the field will allow the selection of multiple accounts,
206
and the resulting value will be array of strings, instead of a string. Default is false.
207
+- `date_time`
208
- `showHtml`
209
- `html: string` HTML code to display.
210