ForgeComponente
ro

Componente

j-DatePicker

jComponent 20 · jcomponent@20 component Exemplu încărcat cu jComponent 20
  • Este clonul îmbunătățit al j-Calendar
  • Modul întunecat - Dark Mode
  • susține gesturile touch (swipe) și dimensiunea completă fixă pe mobil

Configurarea:

  • firstday {Number} în prima zi a săptămânii (default: DEF.firstdayofweek)
  • today {String} este o etichetă pentru butonul Set today
  • clear {String} este o etichetă pentru butonul Clear
  • days {String} zilele, de exemplu SU,MO,TU,WE,TH,FR,SA (default)
  • months {String} luni, de exemplu January,February,... (default)

Componentul trebuie numit manual sau funcționează automat cu componenta j-Input.

  • important adăugați componenta calendarului sub elementul <body>

Utilizare

var opt = {};
opt.element = YOUR_ELEMENT;
opt.value = new Date();
// or opt.value = 'path.to.date'; --> then "opt.callback" is disabled
// opt.align {String}      : align "left" (default), "center" or "right"
// opt.position {String}   : position "top" (default) or "bottom"
// NEW: opt.clock {Boolean} : enables time (default: false)
// NEW: opt.ampm {Boolean} : enables AM/PM (default: false)

opt.clear = false; // Removes "clear" button from datepicker. If this property is not specified as "false" - "clear" button will be shown

opt.callback = function(newdate) {
	console.log('date has been changed');
};
// IMPORTANT - opt.callback() can receive "null" value as a parameter, so this check should be taken into consideration when callback function is being created.

// opt.offsetX {Number} "x" offset
// opt.offsetY {Number} "y" offset
// opt.close {Function} optional, this function can determine closing of DatePicker

// NEW and OPTIONAL
// It's callend when the DatePicker changes year/month
opt.badges = function(date, append) {
	// Appends small and red badges to the current view/month
	append([date1, date2, date3]);
};

SETTER('datepicker/show', opt);

Utilizați-l cu <ui-component name="datepicker">Când componenta nu este încă încărcată, jComponent Descărcați-l la prima utilizare de la adresa DEF.fallback (în cazul Componentator Autor: Peter Širka. sursă: Componentator Componente de stocare, MIT licență.

example.html
<a href="#datepicker">SHOW DATEPICKER: <b><ui-bind path="form.date" config="html:value?value.format('dd.MM.yyyy'):DEF.empty"></ui-bind></b></a>
<ui-component name="datepicker" config="today:Set today;firstday:0"></ui-component>

<script>
	var form = {};
	form.date = new Date();

	$('a[href="#datepicker"]').on('click', function(e) {
		var opt = {};
		opt.value = 'form.date';
		opt.element = this;

		// Append badges
		opt.badges = function(date, append) {
			setTimeout(function() {
				append([date.add('-5 days'), date.add('-2 days'), date.add('3 days'), date.add('8 days')])
			}, 1000);
		};

		SETTER('datepicker/show', opt);
	});
</script>