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

openui5-flatpickr

v0.0.1

Published

An openui5 custom control to use flatpickr (https://github.com/chmln/flatpickr)

Downloads

3

Readme

openui5-flatpickr

openui5-flatpickr is a SAPUI5 Custom Control that wraps flatpickr Date Picker

flatpickr example with time support

Demo

You can checkout a demo with different configurations here: https://stermi.github.io/openui5-flatpickr/test/demo/

Usage

Configure manifest.json

Add the library to sap.ui5 dependencies list and configure the resourceRoots to point where you uploaded the custom library.

"sap.ui5": {
    ...
	"dependencies": {
		"minUI5Version": "1.30.0",
		"libs": {
    		...
			"it.designfuture.flatpickr": {}
		}
	},
	"resourceRoots": {
		"it.designfuture.flatpickr": "./thirdparty/it/designfuture/flatpickr/"
	}
}

Add the custom control inside an XML View

First of all add the namespace

xmlns:df="it.designfuture.flatpickr"

And than you can simply add it a simple Input (FlatDatePicker extends InputBase)

<df:FlatDatePicker 
  class="sapUiMediumMargin"
  clickOpens="false"
  dateFormat="d/m/Y"
/>

Parameters

| Name | Type | Default| Description | :---- | :------------------- | :---- | :--------- | | altFormat | string | "F j, Y" | Exactly the same as date format, but for the altInput field | altInput | boolean | false | Show the user a readable date (as per altFormat), but return something totally different to the server | altInputClass | string | "" | This class will be added to the input element created by the altInput option. Note that altInput already inherits classes from the original input | allowInput | boolean | false | Allows the user to enter a date directly input the input field. By default, direct entry is disabled | clickOpens | boolean | false | Whether clicking on the input should open the picker. You could disable this if you wish to open the calendar manually with.open() | dateFormat | string | "Y-m-d" | A string of characters which are used to define how the date will be displayed in the input box. The supported characters are defined in the table below. | dateValue | object | null | Set the initial selected date. Same as preloading a date string into an input's value attribute, but can also handle a Date object | hourValue | int | 12 | Initial value of the hour element | minuteValue | int | 0 | Initial value of the minute element | disabledDates | object[] | [] | Arrays of dates object to be disabled | disableMobile | boolean | false | Set disableMobile to true to always use the non-native picker. By default, Flatpickr utilizes native datetime widgets unless certain options (e.g. disable) are used | enabledDates | object[] | [] | Arrays of dates object to be enabled | enableTime | boolean | false | Enables time picker | enableSeconds | boolean | false | Enables seconds in the time picker | hourIncrement | int | 1 | Adjusts the step for the hour input (incl. scrolling) | inline | boolean | false | Displays the calendar inline | maxDate | object | null | The maximum date that a user can pick to (inclusive). | minDate | object | null | The minimum date that a user can start picking from (inclusive) | minuteIncrement | int | 5 | Adjusts the step for the minute input (incl. scrolling) | mode | string | "single" | "single", "multiple", or "range" | noCalendar | boolean | false | Hides the day selection in calendar. Use it along with enableTime to create a time picker | shorthandCurrentMonth | boolean | false | Show the month using the shorthand version (ie, Sep instead of September) | static | boolean | false | Position the calendar inside the wrapper and next to the input element. (Leave false unless you know what you're doing.) | time_24hr | boolean | false | Displays time picker in 24 hour mode without AM/PM selection when enabled | weekNumbers | boolean | false | Enables display of week numbers in calendar

Events

| Name | Description | :---- | :------------------- | | onChange | onChange gets triggered when the user selects a date, or changes the time on a selected date | onOpen | onOpen gets triggered when the calendar is opened | onClose | onClose gets triggered when the calendar is closed | onMonthChange | onMonthChange gets triggered when the month is changed, either by the user or programmatically | onYearChange | onYearChange gets triggered when the year is changed, either by the user or programmatically | onReady | onReady gets triggered once the calendar is in a ready state | onValueUpdate | onValueUpdate gets triggered when the input value is updated with a new date string | onDayCreate | Take full control of every date cell with the onDayCreate() hook

Methods

| Name | Description | :---- | :------------------- | | clearDatePicker | Resets the selected dates (if any) and clears the input | openDatePicker | Shows/opens the calendar | closeDatePicker | Closes the calendar | destroyDatePicker | Destroys the Flatpickr instance, cleans up - removes event listeners, restores inputs, etc | formatDate | Return a formatted date | jumpToDate | Sets the calendar view to the year and month ofdate, which can be a date string, a Date, or nothing. If date is undefined, the view is set to the latest selected date, the minDate, or today’s date | parseDate | Parses a date string or a timestamp, and returns a Date | redrawDatePicker | Redraws the calendar. Shouldn’t be necessary in most cases | setDate | Sets the current selected date(s) todate, which can be a date string, a Date, or an Array of the Dates. Optionally, pass true as the second argument to force any onChange events to fire | toggleDatePicker | Shows/opens the calendar if its closed, hides/closes it otherwise | getSelectedDates | Return an array with selected dates

Build

If you would like to extend and customize the controllr, you can easily do that but re-building the code with just a simple Grunt command:

npm install
grunt build

You just need to take note of two things:

  1. compatVersion: you should type here your project SAPUI5 version. Old projects (1.28.x) will generate a library-preload.json, new version will instead create a library-prelaod.js
  2. openui5_theme: add addictional files for each theme you are supporting in your application

Credits

Emanuele Ricci

License

This project is licensed under the Apache 2.0 License - see the LICENSE.md file for details