mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
additional macros
This commit is contained in:
parent
952bdc4baa
commit
9876a76836
@ -12,7 +12,7 @@
|
||||
</script>
|
||||
|
||||
{#if arg.type == 'text'}
|
||||
<FormTextField label={arg.label} {name} />
|
||||
<FormTextField label={arg.label} {name} defaultValue={arg.default} />
|
||||
{:else if arg.type == 'checkbox'}
|
||||
<FormCheckboxField label={arg.label} {name} defaultValue={arg.default} />
|
||||
{:else if arg.type == 'select'}
|
||||
|
@ -3,8 +3,13 @@
|
||||
import TextField from './TextField.svelte';
|
||||
|
||||
export let name;
|
||||
export let defaultValue;
|
||||
|
||||
const { values, setFieldValue } = getFormContext();
|
||||
</script>
|
||||
|
||||
<TextField {...$$restProps} value={$values[name]} on:input={e => setFieldValue(name, e.target['value'])} />
|
||||
<TextField
|
||||
{...$$restProps}
|
||||
value={$values[name] ?? defaultValue}
|
||||
on:input={e => setFieldValue(name, e.target['value'])}
|
||||
/>
|
||||
|
@ -58,6 +58,58 @@ return value ? value.toString().replace(new RegExp(rtext, rflags), args.replace
|
||||
],
|
||||
code: `return modules.lodash[args.type](value)`,
|
||||
},
|
||||
{
|
||||
title: 'Pad left',
|
||||
name: 'padLeft',
|
||||
group: 'Text',
|
||||
args: [
|
||||
{
|
||||
type: 'text',
|
||||
label: 'Character',
|
||||
name: 'character',
|
||||
default: '0',
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
label: 'Length',
|
||||
name: 'length',
|
||||
default: '3',
|
||||
},
|
||||
],
|
||||
description: 'Returns string of a specified length in which the beginning of the current string is padded with spaces or other character',
|
||||
type: 'transformValue',
|
||||
code: `return modules.lodash.padStart(value, +args.length, args.character)`,
|
||||
},
|
||||
{
|
||||
title: 'Pad right',
|
||||
name: 'padRight',
|
||||
group: 'Text',
|
||||
args: [
|
||||
{
|
||||
type: 'text',
|
||||
label: 'Character',
|
||||
name: 'character',
|
||||
default: '0',
|
||||
},
|
||||
{
|
||||
type: 'text',
|
||||
label: 'Length',
|
||||
name: 'length',
|
||||
default: '3',
|
||||
},
|
||||
],
|
||||
description: 'Returns string of a specified length in which the end of the current string is padded with spaces or other character',
|
||||
type: 'transformValue',
|
||||
code: `return modules.lodash.padEnd(value, +args.length, args.character)`,
|
||||
},
|
||||
{
|
||||
title: 'Trim',
|
||||
name: 'trim',
|
||||
group: 'Text',
|
||||
description: 'Removes leading and trailing whitespace ',
|
||||
type: 'transformValue',
|
||||
code: `return modules.lodash.trim(value)`,
|
||||
},
|
||||
{
|
||||
title: 'Row index',
|
||||
name: 'rowIndex',
|
||||
|
Loading…
Reference in New Issue
Block a user