UNPKG

@microsoft/teams.cards

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta

121 lines (118 loc) 2.78 kB
'use strict'; var base = require('./base'); class ChoiceSetInput extends base.InputElement { type; /** * Choice options. */ choices; /** * Allows dynamic fetching of choices from the bot to be displayed as suggestions in the dropdown when the user types in the input field. */ "choices.data"; /** * Allow multiple choices to be selected. */ isMultiSelect; /** * the style of the choice input */ style; /** * The initial choice (or set of choices) that should be selected. For multi-select, specify a comma-separated string of values. */ value; /** * Description of the input desired. Only visible when no selection has been made, the `style` is `compact` and `isMultiSelect` is `false` */ placeholder; /** * If `true`, allow text to wrap. Otherwise, text is clipped. */ wrap; constructor(...choices) { super(); this.type = "Input.ChoiceSet"; this.choices = choices; } withOptions(value) { Object.assign(this, value); return this; } withData(value) { this["choices.data"] = value; return this; } withMultiSelect(value = true) { this.isMultiSelect = value; return this; } withStyle(value) { this.style = value; return this; } withValue(value) { this.value = value; return this; } withPlaceholder(value) { this.placeholder = value; return this; } withWrap(value = true) { this.wrap = value; return this; } addChoices(...value) { this.choices.push(...value); return this; } } class Choice { /** * Text to display. */ title; /** * The raw value for the choice. NOTE: do not use a `,` in the value, since a `ChoiceSet` with `isMultiSelect` set to `true` returns a comma-delimited string of choice values. */ value; constructor(title, value) { this.title = title; this.value = value; } } class ChoiceDataQuery { /** * The dataset to be queried to get the choices. */ dataset; /** * The maximum number of choices that should be returned by the query. It can be ignored if the card-author wants to send a different number. */ count; /** * The number of choices to be skipped in the list of choices returned by the query. It can be ignored if the card-author does not want pagination. */ skip; constructor(dataset) { this.dataset = dataset; } withOptions(value) { Object.assign(this, value); return this; } withCount(value) { this.count = value; return this; } withSkip(value) { this.skip = value; return this; } } exports.Choice = Choice; exports.ChoiceDataQuery = ChoiceDataQuery; exports.ChoiceSetInput = ChoiceSetInput; //# sourceMappingURL=choice-set.js.map //# sourceMappingURL=choice-set.js.map