Files
metabuilder/packages/admin_dialog/scripts/functions.json

122 lines
3.7 KiB
JSON

{
"$schema": "https://metabuilder.dev/schemas/json-script.schema.json",
"schemaVersion": "2.0.0",
"package": "admin_dialog",
"functions": [
{
"id": "handleConfirm",
"namespace": "dialog",
"name": "handleConfirm",
"description": "Handle confirm button click in admin dialog",
"parameters": [
{
"name": "event",
"type": "object",
"required": true,
"description": "Click event object"
}
],
"returns": {
"type": "void"
},
"implementation": "function(event) { this.setState({ open: false }); if (this.props.onConfirm) { this.props.onConfirm(event); } }"
},
{
"id": "handleCancel",
"namespace": "dialog",
"name": "handleCancel",
"description": "Handle cancel button click in admin dialog",
"parameters": [
{
"name": "event",
"type": "object",
"required": true,
"description": "Click event object"
}
],
"returns": {
"type": "void"
},
"implementation": "function(event) { this.setState({ open: false }); if (this.props.onCancel) { this.props.onCancel(event); } }"
},
{
"id": "handleClose",
"namespace": "dialog",
"name": "handleClose",
"description": "Handle dialog close event",
"parameters": [
{
"name": "event",
"type": "object",
"required": true,
"description": "Close event object"
},
{
"name": "reason",
"type": "string",
"required": false,
"description": "Close reason"
}
],
"returns": {
"type": "void"
},
"implementation": "function(event, reason) { if (reason !== 'backdropClick') { this.setState({ open: false }); if (this.props.onClose) { this.props.onClose(event, reason); } } }"
},
{
"id": "handleDelete",
"namespace": "dialog",
"name": "handleDelete",
"description": "Handle delete button click after confirmation",
"parameters": [
{
"name": "event",
"type": "object",
"required": true,
"description": "Click event object"
}
],
"returns": {
"type": "Promise<void>"
},
"implementation": "async function(event) { if (this.state.confirmInput !== this.props.confirmationText) { return; } this.setState({ open: false, confirmInput: '' }); if (this.props.onDelete) { await this.props.onDelete({ itemId: this.props.itemId, itemType: this.props.itemType, itemName: this.props.itemName }); } }"
},
{
"id": "handleConfirmInputChange",
"namespace": "dialog",
"name": "handleConfirmInputChange",
"description": "Handle confirmation text input change",
"parameters": [
{
"name": "event",
"type": "object",
"required": true,
"description": "Input change event"
}
],
"returns": {
"type": "void"
},
"implementation": "function(event) { this.setState({ confirmInput: event.target.value }); }"
},
{
"id": "handleAction",
"namespace": "dialog",
"name": "handleAction",
"description": "Handle custom action button click",
"parameters": [
{
"name": "actionDef",
"type": "object",
"required": true,
"description": "Action definition object"
}
],
"returns": {
"type": "Promise<void>"
},
"implementation": "async function(actionDef) { this.setState({ open: false }); if (this.props.onAction) { await this.props.onAction(actionDef); } }"
}
]
}