webcito/jquery-bs-calendar 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

webcito/jquery-bs-calendar

Composer 安装命令:

composer require webcito/jquery-bs-calendar

包简介

description

README 文档

README

promo image

The event calendar was created with JQuery and Boostrap 5. It does not need any additional CSS file.
The calendar can be included in all Boostrap elements (.card, .navbar, .offcanvas, .dropdowns, ...).

options

prop type default description
locale string 'en' Sets the language of days and months
url null|string| function null When a function is implemented, an array of event objects is expected. A string represents the path to the server. If the value remains at zero, no appointments will be loaded.
queryParams function see example below Additional parameters can be sent to the server here. From and To are always sent.
width string '310px' Sets the width of the container. All subelements are calculated from the width of the container.
icons object see example below Here you can change the icon classes. Bootstrap icons are set as default.
showTodayHeader boolean true Show or hide the header of the calendar, which contains information about today.
eventListContainer null|string null If a selector is specified here, the appointment list will be transferred to this selector.
classes object see example below Here you can set your own CSS classes for the elements in the calendar to stylishly adapt your container to your page. The calendar is built with a table and can therefore easily inherit the themes from Bootstrap.
event object see example below The object event expects 2 properties. Firstly the function formatted(event){} which expects a string as return and secondly the event handler list as object[]
popoverConfig object|null see example below The popover configuration can be set here, more at https://getbootstrap.com/docs/5.3/components/popovers/#options. If the value is null, no popover will be initialized.
formatPopoverContent function see example below The content of the popover can be formatted here. The condition for this is that the showPopover attribute is set to true.
formatNoEvent function see example below The display when there are no appointments on the selected date.

full options example

const options = {
    "locale": "de",
    "url": null,
    "width": "310px",
    "icons": {
        "prev": 'bi bi-chevron-left',
        "next": 'bi bi-chevron-right'
    },
    "showTodayHeader": true,
    "eventListContainer": null,
    "classes": {
        "table": 'table table-sm table-borderless',
        "tableHeaderCell": 'text-muted fw-lighter',
        "tableHeaderCellActive": 'text-warning fw-bold',
        "tableData": {
            "all": 'rounded-circle w-100 h-100 border',
            "today": 'text-bg-primary',
            "hover": 'shadow',
            "active": 'border-secondary',
            "inMonth": 'fw-bold',
            "notInMonth": 'text-muted fw-small',
            "eventCounter": 'start-50 bottom-0 translate-middle-x text-bg-danger rounded-pill'
        }
    },
    "event": {
        formatter(event) {
            return drawEvent(event);
        },
        events: { // a list of events for each event
            "click .edit-button"(e, event, $element) { // example 1
                e.preventDefault();
                console.log('event', event, 'clicked on', $element.get(0));
            },
            "change .some-select"(e, event, $element) { // example 2
                e.preventDefault();
                console.log('event', event, 'select object', $element.get(0));
            },
        }
    },
    "popoverConfig": {
        animation: false,
        html: true,
        delay: 400,
        placement: 'top',
        trigger: 'hover'
    },
    "formatPopoverContent"(events) {
        return '';
    },
    "formatNoEvent"(date) {
        return "No appointments on this day";
    },
    "queryParams"(params) {
        params.userId = 1;
        return params;
    }
}

the event object

The event object must have a start and an end attribute

{
  "id": 1,
  "title": "first date",
  "description": null,
  "start": "2022-10-30 10:00:00",
  "end": "2022-10-30 12:30:00",
  "link": "",
  "whatever": "you want..."
}

set defaults

This function can be used to define default values, such as the language before initialization.

// set single property
$.bsCalendar.setDefault(prop, value);
// or multiple properties
$.bsCalendar.setDefaults({
    prop: value,
    prop2: value2
});

methods

$('#calendar').bsCalendar(method, param);
methodName Params Description
refresh - Reloads the dates
updateOptions (object) {new:options} Updates the options of the calendar
setDate (string) '2024-12-24' Switches the calendar to the month given in the date.

events

$('#calendar')
    .on('eventName', function (e, ...params) {
    });
eventName params Description
init - Fires when the calendar is fully initialized
change-day date, events Fires when a date was clicked manually
events-loaded events Fires when the data has been loaded from the server
show-event-list events Fires before building the appointment list
shown-event-list events Fires when the appointment list has been created and displayed
click-current-month - Fires when the button for the current month is pressed
click-prev-month - Fires when the button for the previous month is pressed
click-next-month - Fires when the button for the next month has been pressed
change-month - Fires when the month is changed
$('#calendar')
    .on('init', function (e) {
    })
    .on('change-day', function (e, date, events) {
    })
    .on('events-loaded', function (e, events) {
    })
    .on('show-event-list', function (e, events) {
    })
    .on('shown-event-list', function (e, events) {
    })
    .on('click-current-month', function (e) {
    })
    .on('click-prev-month', function (e) {
    })
    .on('click-next-month', function (e) {
    })
    .on('change-month', function (e) {
    })

Satisfied customers of the plugin

Schulz von Thun Institut
für Kommunikation
Perspekto Coaching GmbH
Institut für berufliche Entwicklung
Uniquo Coaching
webcito UG

webcito/jquery-bs-calendar 适用场景与选型建议

webcito/jquery-bs-calendar 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 232 次下载、GitHub Stars 达 14, 最近一次更新时间为 2023 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 webcito/jquery-bs-calendar 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 webcito/jquery-bs-calendar 我们能提供哪些服务?
定制开发 / 二次开发

基于 webcito/jquery-bs-calendar 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 232
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 14
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2023-01-11