fox-block-builder
Version:
Maintainable code for loop slack-block-kit-like modal builder
360 lines • 18 kB
JavaScript
"use strict";
/* eslint-disable max-len */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Elements = void 0;
exports.Button = Button;
exports.ChannelMultiSelect = ChannelMultiSelect;
exports.ChannelSelect = ChannelSelect;
exports.Checkboxes = Checkboxes;
exports.ConversationMultiSelect = ConversationMultiSelect;
exports.ConversationSelect = ConversationSelect;
exports.DatePicker = DatePicker;
exports.DateTimePicker = DateTimePicker;
exports.EmailInput = EmailInput;
exports.ExternalMultiSelect = ExternalMultiSelect;
exports.ExternalSelect = ExternalSelect;
exports.Img = Img;
exports.FileInput = FileInput;
exports.NumberInput = NumberInput;
exports.OverflowMenu = OverflowMenu;
exports.RadioButtons = RadioButtons;
exports.StaticMultiSelect = StaticMultiSelect;
exports.StaticSelect = StaticSelect;
exports.TextInput = TextInput;
exports.TimePicker = TimePicker;
exports.URLInput = URLInput;
exports.UserMultiSelect = UserMultiSelect;
exports.UserSelect = UserSelect;
exports.DirectorySelect = DirectorySelect;
exports.OneSSelect = OneSSelect;
exports.ImageSelect = ImageSelect;
exports.DateRangePicker = DateRangePicker;
exports.AddableInput = AddableInput;
const button_1 = require("./button");
const channel_multi_select_1 = require("./channel-multi-select");
const channel_select_1 = require("./channel-select");
const checkboxes_1 = require("./checkboxes");
const conversation_multi_select_1 = require("./conversation-multi-select");
const conversation_select_1 = require("./conversation-select");
const date_picker_1 = require("./date-picker");
const date_time_picker_1 = require("./date-time-picker");
const email_input_1 = require("./email-input");
const external_multi_select_1 = require("./external-multi-select");
const external_select_1 = require("./external-select");
const file_input_1 = require("./file-input");
const img_1 = require("./img");
const number_input_1 = require("./number-input");
const overflow_menu_1 = require("./overflow-menu");
const radio_buttons_1 = require("./radio-buttons");
const static_multi_select_1 = require("./static-multi-select");
const static_select_1 = require("./static-select");
const text_input_1 = require("./text-input");
const timepicker_1 = require("./timepicker");
const url_input_1 = require("./url-input");
const user_multi_select_1 = require("./user-multi-select");
const user_select_1 = require("./user-select");
const directory_select_1 = require("./directory-select");
const one_s_select_1 = require("./one-s-select");
const image_select_1 = require("./image-select");
const date_range_picker_1 = require("./date-range-picker");
const addable_input_1 = require("./addable-input");
/**
* Functions here do not use arrow functions stored in variables for IDE color compatibility.
*/
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.accessibilityLabel] Sets a longer descriptive text that will be read out by screen readers instead of the button text object.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.text] Sets the display text for the button.
* @param {string} [config.url] Sets the URL to redirect the user to when this button is clicked.
* @param {string} [config.value] Sets the value to be passed to your app when this button is clicked.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#button|View in Slack API Documentation}
*/
function Button(params) {
return new button_1.ButtonBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [config.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#channel_multi_select|View in Slack API Documentation}
*/
function ChannelMultiSelect(params) {
return new channel_multi_select_1.ChannelMultiSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialChannel] Sets the default selected item in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#channel_select|View in Slack API Documentation}
*/
function ChannelSelect(params) {
return new channel_select_1.ChannelSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#checkboxes|View in Slack API Documentation}
*/
function Checkboxes(params) {
return new checkboxes_1.CheckboxesBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [config.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation}
*/
function ConversationMultiSelect(params) {
return new conversation_multi_select_1.ConversationMultiSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialConversation] Sets the default selected item in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#conversation_multi_select|View in Slack API Documentation}
*/
function ConversationSelect(params) {
return new conversation_select_1.ConversationSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialDate] Sets the default selected date in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#datepicker|View in Slack API Documentation}
*/
function DatePicker(params) {
return new date_picker_1.DatePickerBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.initialDateTime] Sets the default selected date and time for the date time picker.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#datetimepicker|View in Slack API Documentation}
*/
function DateTimePicker(params) {
return new date_time_picker_1.DateTimePickerBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialValue] Sets the default email entered into the Email input at modal render.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#email|View in Slack API Documentation}
*/
function EmailInput(params) {
return new email_input_1.EmailInputBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [config.maxSelectedItems] Sets a limit to how many items the user can select.
* @param {int} [config.minQueryLength] Sets a minimum number of characters types before querying your options URL.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#external_multi_select|View in Slack API Documentation}
*/
function ExternalMultiSelect(params) {
return new external_multi_select_1.ExternalMultiSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [config.minQueryLength] Sets a minimum number of characters types before querying your options URL.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#external_select|View in Slack API Documentation}
*/
function ExternalSelect(params) {
return new external_select_1.ExternalSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.imageUrl] Sets the source URL from which the image will be loaded.
* @param {string} [config.altText] Sets the textual summary of the image.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#image|View in Slack API Documentation}
*/
function Img(params) {
return new img_1.ImgBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.filetypes] Sets the accepted filetypes.
* @param {string} [config.maxFiles] Sets the maximum number of files to upload.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#file_input|View in Slack API Documentation}
*/
function FileInput(params) {
return new file_input_1.FileInputBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {boolean} [config.isDecimalAllowed] Dicates whether a decimal is allowed for the value entered into the number input.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialValue] Sets the default text entered into the text input at modal render.
* @param {int} [config.minValue] Sets a minimum value for the number input.
* @param {int} [config.maxValue] Sets a maximum value for the number input.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#number|View in Slack API Documentation}
*/
function NumberInput(params) {
return new number_input_1.NumberInputBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#overflow|View in Slack API Documentation}
*/
function OverflowMenu(params) {
return new overflow_menu_1.OverflowMenuBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#radio|View in Slack API Documentation}
*/
function RadioButtons(params) {
return new radio_buttons_1.RadioButtonsBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [config.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#static_multi_select|View in Slack API Documentation}
*/
function StaticMultiSelect(params) {
return new static_multi_select_1.StaticMultiSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#static_select|View in Slack API Documentation}
*/
function StaticSelect(params) {
return new static_select_1.StaticSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialValue] Sets the default text entered into the text input at modal render.
* @param {boolean} [config.multiline] Sets whether the input will be a single line or a larger text area.
* @param {int} [config.minLength] Sets a minimum character count in order for the user to submit the form.
* @param {int} [config.maxLength] Sets a maximum character count allowed to send the form.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#input|View in Slack API Documentation}
*/
function TextInput(params) {
return new text_input_1.TextInputBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialTime] Sets the default selected time in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#timepicker|View in Slack API Documentation}
*/
function TimePicker(params) {
return new timepicker_1.TimePickerBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialValue] Sets the default URL entered into the URL input at modal render.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#url|View in Slack API Documentation}
*/
function URLInput(params) {
return new url_input_1.URLInputBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {int} [config.maxSelectedItems] Sets a limit to how many items the user can select.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#users_multi_select|View in Slack API Documentation}
*/
function UserMultiSelect(params) {
return new user_multi_select_1.UserMultiSelectBuilder(params);
}
/**
* @param {Object} [config] Parameters passed to the constructor.
* @param {string} [config.actionId] Sets a string to be an identifier for the source of an action in interaction payloads.
* @param {string} [config.placeholder] Adds the text in place of the input before selected or interacted with.
* @param {string} [config.initialUser] Setts the default selected user in the menu.
*
* {@link https://api.slack.com/reference/block-kit/block-elements#users_select|View in Slack API Documentation}
*/
function UserSelect(params) {
return new user_select_1.UserSelectBuilder(params);
}
/** Расширенные элементы нашего форка */
/** Выбор параметров из хендбуков ПФ */
function DirectorySelect(params) {
return new directory_select_1.DirectorySelectBuilder(params);
}
/** Выбор параметров из хендбуков ПФ */
function OneSSelect(params) {
return new one_s_select_1.OneSSelectBuilder(params);
}
/** Выбор изображений. Формат опций - {url: {ссылка}, text: {alt}} */
function ImageSelect(variant = 'select', params) {
return new image_select_1.ImageSelectBuilder({ ...params, variant });
}
function DateRangePicker(params) {
return new date_range_picker_1.DateRangePickerBuilder(params);
}
function AddableInput(params) {
return new addable_input_1.AddableInputBuilder(params);
}
const elements = {
Button,
ChannelMultiSelect,
ChannelSelect,
Checkboxes,
DatePicker,
DateTimePicker,
EmailInput,
NumberInput,
RadioButtons,
StaticMultiSelect,
StaticSelect,
TextInput,
TimePicker,
URLInput,
UserMultiSelect,
UserSelect,
FileInput,
DirectorySelect,
OneSSelect,
ImageSelect,
DateRangePicker,
AddableInput,
};
exports.Elements = elements;
//# sourceMappingURL=index.js.map