npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

cap-jalali-calendar-nuxt3

v0.0.19

Published

تقویم شمسی و جلالی برای استفاده در Nuxt 3

Downloads

1,085

Readme

Cap-Jalali-Calendar

Cap Jalali Calendar is a Jalali Calendar component library for Nuxt 3 FrameWork.

About

The Cap Jalali Calendar is an open-source library developed and maintained by CAP Company. It is developed using Nuxt 3 framework and tailwindcss.

Showcase

Quick Setup

  1. Add Cap-Jalali-Calendar dependency to your project .

Using yarn :

yarn add Cap-Jalali-Calendar

Using npm :

npm install Cap-Jalali-Calendar

Using pnpm :

pnpm install Cap-Jalali-Calendar
  1. Add cap-jalali-calendar-nuxt3 to the modules of nuxt.config.ts
export default defineNuxtConfig({
  modules: ['cap-jalali-calendar-nuxt3']
});

That's it! You can now use library in your Nuxt app ✨

How to Use

Using the calendar is easy, you just need to import the library and use it as follows.

<JalaliCalendar />

Props

| Key | Type | Default | Description | sample | |-----------------------------------------|-----------|-------------|--------------------------------------------------------------------|--------------------------| | cellClass | string | empty | you can add custom class for calendar days | bg-rose-400 p-5 | | cellTodayClass | string | empty | you can change class of today calendar cell | bg-purple-500 text-white | | showMonthSelector | boolean | false | if set TRUE , can access change month button on header of calendar | | | events | array | null | list of calendar events based on template | |

How To Using Classes

Using the calendar is easy, you just need to import the library and use it as follows.

<JalaliCalendar 
  cellClass="!text-white !bg-purple-500"
  cellTodayClass="!text-slate-500 !bg-gray-100" />

Event Model

First of all, you need to add the interface and enum related to the events format.

interface DayEvent {
  id: number,
  title: string,
  color: string,
  time: string,
  date: string,
  extra?:any,
  action: EventActions,
}

enum EventActions {
  NONE= 0,
  GOTO_URL= 1,
  ALERT= 2
}

Then it is recommended to create a list to store the events, in the example below we have also filled this list with 2 items.

const _events = ref<DayEvent[]>([
  {
    id: 1,
    title: 'رویداد اول',
    color: 'red',
    time: '12:45',
    date: '1403/07/23',
    action: EventActions.NONE,
  },
  {
    id: 2,
    title: 'رویداد دوم',
    color: 'blue',
    time: '17:23',
    date: '1403/07/23',
    action: EventActions.NONE,
  }
])

In the next step, we used a computed method to optimize and manage events

const events = computed<DayEvent[]>(() =>{
  return _events.value;
})

Finally, we connected the prepared list to the calendar as follows. Also, after connecting the list of events to the calendar, you can still add to that list of events and view them in the calendar at the same time without needing to make any changes.

    <JalaliCalendar :events="events" />

Templates

You can customize the calendar using templates. It is now possible to customize to change events and add button(s) to the top bar of the calendar.

| Key | Description | |-----------------------------------------|--------------------------------------------------------------------| | customButton | It is used to add a button to the top bar of the calendar | | event | Use this template to personalize events |

How To Using Template : customButton

<!--#region Use Template : Custom Button On Header -->
<JalaliCalendar :events="events">
    <template #customButton> 
        <button type="button"> مشاهده بیشتر </button>
    </template>
</JalaliCalendar>
<!--#endregion-->

How To Using Template : customButton

<!--#region Use Template : Custom Event -->
    <JalaliCalendar :events="events">
      <template #event="{ event }">
         <a href="javascript:" class="flex rounded-lg p-2 bg-rose-400 text-white">
           <p class="custom-title">{{ event.name }} (سفارشی شده)</p>
         </a>
    </template>
  </JalaliCalendar>
<!--#endregion-->

Events

You can customize the calendar using templates. It is now possible to customize to change events and add button(s) to the top bar of the calendar.

| Key | Description | |-----------------------------------------|--------------------------------------------------------------------| | onChangeMonth | This event occurs when the time period of the calendar display changes, use this event to receive the start and end time period of the calendar. | | onEvent | This event will be called when an event is clicked on the calendar days. |

Full Sample Code

    <JalaliCalendar
  :events="events"
  cellClass=""
  cellTodayClass=""
  :showMonthSelector="true"
  @onChangeMonth="onChangeMonthListener"
  @onEvent="eventClickListener">
  <!--#region Use Template : Custom Button On Header -->
  <template #customButton>
    <button type="button"> کلیک کنید </button>
  </template>
  <!--#endregion-->
  <!--#region Use Template : Custom Event -->
  <template #event="{ event }">
    <a href="javascript:" class="flex rounded-lg p-2 bg-rose-400 text-white">
      <p class="custom-title">{{ event.title }} (سفارشی شده)</p>
    </a>
  </template>
  <!--#endregion-->
</JalaliCalendar>

Thank You

Thanks to all colleagues of CAP Company

Author : Ahmad Ghanavati

Thank you Learning Site Source :

https://canopas.com/how-to-create-and-publish-nuxt-component-library-2f9e60278407