mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-29 05:16:00 +00:00
additional macros
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if arg.type == 'text'}
|
{#if arg.type == 'text'}
|
||||||
<FormTextField label={arg.label} {name} />
|
<FormTextField label={arg.label} {name} defaultValue={arg.default} />
|
||||||
{:else if arg.type == 'checkbox'}
|
{:else if arg.type == 'checkbox'}
|
||||||
<FormCheckboxField label={arg.label} {name} defaultValue={arg.default} />
|
<FormCheckboxField label={arg.label} {name} defaultValue={arg.default} />
|
||||||
{:else if arg.type == 'select'}
|
{:else if arg.type == 'select'}
|
||||||
|
|||||||
@@ -3,8 +3,13 @@
|
|||||||
import TextField from './TextField.svelte';
|
import TextField from './TextField.svelte';
|
||||||
|
|
||||||
export let name;
|
export let name;
|
||||||
|
export let defaultValue;
|
||||||
|
|
||||||
const { values, setFieldValue } = getFormContext();
|
const { values, setFieldValue } = getFormContext();
|
||||||
</script>
|
</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)`,
|
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',
|
title: 'Row index',
|
||||||
name: 'rowIndex',
|
name: 'rowIndex',
|
||||||
|
|||||||
Reference in New Issue
Block a user