Skip to content

Commit

Permalink
[update] events info updated
Browse files Browse the repository at this point in the history
  • Loading branch information
tbshag2 committed Aug 30, 2024
1 parent 60ce632 commit f7109d7
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 104 deletions.
78 changes: 38 additions & 40 deletions docs/api/config/booking-filtershape.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,68 +15,66 @@ description: You can learn about the filterShape config in the documentation of
~~~jsx {}
filterShape:{
text?: boolean | [{
id:string,
suggest?:string,
id: string,
label?: string,
suggest?: boolean,
}],
date?: boolean,
time?: boolean | {
time?: boolean | [{
from: number | string,
to: number | string,
label: string,
};
label?: string,
}],
autoApply?: boolean
};
~~~

### Parameters

- `text` - (optional) TBD
- `id` - (required)
- `suggest` - (required) TBD
- `date` - (optional) shows/hides the date field
- `time` - (optional) shows/hides the time field. If set to **true**, it takes an array of objects with time options for a slot. For each object you can specify the following parameters:
- `from` - (optional) a start time
- `to` - (optional) an end time
- `label` - (optional) a time period label. If the `time` parameters are not set, the default values are applied:
~~~jsx {}
[
{ from: 8, to: 12, label: "Morning" },
{ from: 12, to: 17, label: "Afternoon" },
{ from: 17, to: 20, label: "Evening" },
]
~~~

- `text` - (optional) if **true**, the text input field is displayed (default); if **false**, the text field is hidden
- `id` - (required) the id of a card
- `suggest` - (required) if **true**, the values (from the [`data`](/api/config/booking-data) object) that match the user's input text will be displayed
- `label` - (optional) the label for the property from the `data` object. See [Default config](#default-config) below.
- `date` - (optional) shows/hides the date field; **true** is set by default (the field is shown)
- `time` - (optional) shows/hides the time field. If set to **true**, it takes an array of objects with default time options for a slot. For each object you can specify the following parameters:
- `from` - (required) the start time for a slot; it can be a number from 0 to 24 that specifies the time in hours (e.g., 9 means 9:00, 8.5 means 8:30) or a string in the format "h:m" (for example, "8:30")
- `to` - (required) the end time for a slot; it can be a number from 0 to 24 that specifies the time in hours (e.g., 9 means 9:00, 8.5 means 8:30) or a string in the format "h:m" (for example, "8:30")
- `label` - (optional) placeholder for the time field
If the `time` parameters are not set, the default values are applied: see [Default config](#default-config) below.
- `autoApply` - (optional) tif **true**, the search criteria will be automatically applied (no need to initiate the search by clicking the button); **false** is set by default

### Default config

~~~jsx {}
const defaultFilterShape = {
text: true,
date: true,
time: defaultTimeRanges,
autoApply: false,
text: [
{ id: "category", label: "speciality", suggest: true },
{ id: "title", label: "specialist", suggest: true },
{ id: "details", label: "location" },
],
date: true,
time: defaultTimeRanges,
autoApply: false,
};

const defaultTimeRanges = {
{from: 8, to: 12, label: "Morning" },
{ from: 12, to: 17, label: "Afternoon" },
{ from: 17, to: 20, label: "Evening" },
};
const defaultTimeRanges = [
{ from: 8, to: 12, label: "Morning" },
{ from: 12, to: 17, label: "Afternoon" },
{ from: 17, to: 20, label: "Evening" },
];
~~~

### Example

~~~jsx {1-12,15}
const filterShape = {
global: true,
date: false,
time: [
{ from: 8, to: 11, label: "Morning" },
{ from: 12, to: 16, label: "Afternoon" },
{ from: 17, to: 20, label: "Evening" },
],
config: {
debounce: 100,
}
date: false,
autoApply: true,
time: [
{ from: 8, to: 11, label: "Morning" },
{ from: 12, to: 16, label: "Afternoon" },
{ from: 17, to: 20, label: "Evening" },
],
};

new booking.Booking("#root", {
Expand Down
8 changes: 4 additions & 4 deletions docs/api/events/booking-confirmslot-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ description: You can learn about the confirm-slot event in the documentation of
~~~jsx {}
"confirm-slot": ({
slot:{
id:string|number, //item id
time: [ number, number ], //timestamp, length in minutes
id:string|number,
time: [ number, number ],
};
data:{
[key]: any, //fields described in formShape
[key]: any,
};
confirm:{
promise:Promise,
Expand All @@ -35,7 +35,7 @@ The callback of the **confirm-slot** event can take an object with the following

- `slot` - (required) an object with the next slot parameters:
- `id` - (required) the ID of a card for which the booking of a slot is confirmed
- `time` - (required)
- `time` - (required) an array with the slot start time in milliseconds and the slot duration in minutes
- `data` - (required) an abject with the booking screen form fields with the following parameters for each field:
- `key` - (required) the form field ID. By default, three fields are added: *name*, *email*, *description*
- `startTime` - (required) the start time of a slot in milliseconds
Expand Down
4 changes: 2 additions & 2 deletions docs/api/events/booking-filterdata-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ The callback of the **filter-data** event can take an object with the following
- `start` - the slot start date
- `end` - the slot end date
- `time` - (required) an array of objects containing time options for a slot. For each object, you can specify the following parameters:
- `from` - (required) the start time
- `to` - (required) the end time
- `from` - (required) the start time (available formats: "h:m", ?)
- `to` - (required) the end time (available formats: "h:m", ?)

### Example

Expand Down
2 changes: 1 addition & 1 deletion docs/api/events/booking-selectitemdate-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const booking = new booking.Booking("#root", {
// initial configuration parameters
});

//output the date
// output the date
booking.api.on("select-item-date", (ev) => {
console.log(ev.date);
});
Expand Down
2 changes: 1 addition & 1 deletion docs/api/events/booking-selectslot-event.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ description: You can learn about the select-slot event in the documentation of t

The callback of the **select-slot** event can take an object with the following parameters:

- `id` - (required) the ID of a card a selected slot belongs to
- `id` - (required) the ID of a card the selected slot belongs to
- `time` - (required) an array with the slot start time in milliseconds and the slot duration in minutes

### Example
Expand Down
59 changes: 3 additions & 56 deletions docs/api/overview/booking-internal-eventbus-overview.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,10 @@
---
sidebar_label: API overview
title: API Overview
sidebar_label: Event Bus methods overview
title: Event Bus methods overview
description: You can have an API overview of JavaScript Booking in the documentation of the DHTMLX JavaScript Booking library. Browse developer guides and API reference, try out code examples and live demos, and download a free 30-day evaluation version of DHTMLX Booking.
---

# API overview

## Booking constructor

~~~jsx {}
new booking.Booking("#root", {
// initial configuration parameters
});
~~~

**Parameters**:

- an HTML container (the ID of the HTML container)
- an object of the configuration parameters ([check here](#booking-properties))

## Booking methods

| Name | Description |
| -------------------------------------------------- | --------------------------------------------------------- |
| [](api/methods/booking_methodname_method.md) | @getshort(api/methods/booking_methodname_method.md) |

## Booking internal API

### Event Bus methods
# Event Bus methods

| Name | Description |
| ---------------------------------------- | ----------------------------------------------- |
Expand All @@ -36,34 +13,4 @@ new booking.Booking("#root", {
| [](api/internal/js_booking_on.md) | @getshort(api/internal/js_booking_on.md) |
| [](api/internal/js_booking_setnext.md) | @getshort(api/internal/js_booking_setnext.md) |

### State methods

| Name | Description |
| ----------------------------------------------- | ------------------------------------------------------ |
| [](api/internal/js_booking_getreactivestate.md) | @getshort(api/internal/js_booking_getreactivestate.md) |
| [](api/internal/js_booking_getstate.md) | @getshort(api/internal/js_booking_getstate.md) |

### RestDataProvider methods

| Name | Description |
| -------------------------------------------------------- | ------------------------------------------------------------- |
| [](api/internal/booking_innermethodname_method.md) | @getshort(api/internal/booking_innermethodname_method.md) |

## Booking events

| Name | Description |
| ----------------------------------------- | ------------------------------------------------ |
| [](api/events/js_booking_confirmslot_event.md) | @getshort(api/events/js_booking_confirmslot_event.md) |
| [](api/events/js_booking_selectslot_event.md) | @getshort(api/events/js_booking_selectslot_event.md) |
| [](api/events/js_booking_setfilter_event.md) | @getshort(api/events/js_booking_setfilter_event.md) |

## Booking properties

| Name | Description |
| ----------------------------------------- | ------------------------------------------------ |
| [](api/config/js_booking_data.md) | @getshort(api/config/js_booking_data.md) |
| [](api/config/js_booking_cardshape.md) | @getshort(api/config/js_booking_cardshape.md) |
| [](api/config/js_booking_filteredcards.md)| @getshort(api/config/js_booking_filteredcards.md)|
| [](api/config/js_booking_filtershape.md) | @getshort(api/config/js_booking_filtershape.md) |
| [](api/config/js_booking_formshape.md) | @getshort(api/config/js_booking_formshape.md) |
| [](api/config/js_booking_infoshape.md) | @getshort(api/config/js_booking_infoshape.md) |

0 comments on commit f7109d7

Please sign in to comment.