mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-07 01:39:07 +00:00
add draggable
This commit is contained in:
32
types/zui/draggable.d.ts
vendored
Normal file
32
types/zui/draggable.d.ts
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
|
||||
interface Postion {
|
||||
left: number;
|
||||
top: number;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
interface DraggableEvent {
|
||||
event?: object;
|
||||
element?: object;
|
||||
pos?: Postion;
|
||||
offset?: object;
|
||||
smallOffset?: object;
|
||||
startOffset?: object;
|
||||
|
||||
}
|
||||
interface DraggableOption {
|
||||
container?: string,
|
||||
move?: boolean;
|
||||
selector?: string,
|
||||
handle?: string,
|
||||
mouseButton?: string,
|
||||
stopPropagation?: boolean,
|
||||
before?(e?: DraggableEvent): boolean;
|
||||
drag?(e: DraggableEvent): void;
|
||||
finish?(e: DraggableEvent): void
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
draggable(command: string): JQuery;
|
||||
draggable(option: DraggableOption): JQuery;
|
||||
}
|
||||
2
types/zui/index.d.ts
vendored
2
types/zui/index.d.ts
vendored
@@ -13,7 +13,7 @@
|
||||
|
||||
///<reference path="modal.trigger.d.ts" />
|
||||
///<reference path="color.d.ts" />
|
||||
|
||||
///<reference path="draggable.d.ts" />
|
||||
/*~ If this module is a UMD module that exposes a global variable 'myLib' when
|
||||
*~ loaded outside a module loader environment, declare that global here.
|
||||
*~ Otherwise, delete this declaration.
|
||||
|
||||
@@ -83,7 +83,7 @@ $('#myPopover').popover('show');
|
||||
* collapse
|
||||
*/
|
||||
$('#myCollapseContent').collapse({
|
||||
toggle: false
|
||||
toggle: false
|
||||
});
|
||||
$().collapse('show')
|
||||
|
||||
@@ -101,22 +101,22 @@ $('.carousel').carousel()
|
||||
*/
|
||||
// 仅选择日期
|
||||
$(".form-date").datetimepicker(
|
||||
{
|
||||
language: "zh-CN",
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
minView: 2,
|
||||
forceParse: 0,
|
||||
format: "yyyy-mm-dd"
|
||||
});
|
||||
{
|
||||
language: "zh-CN",
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
minView: 2,
|
||||
forceParse: 0,
|
||||
format: "yyyy-mm-dd"
|
||||
});
|
||||
// 选择时间
|
||||
$(".form-time").datetimepicker({
|
||||
language: "zh-CN",
|
||||
language: "zh-CN",
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 1,
|
||||
@@ -127,35 +127,35 @@ $(".form-time").datetimepicker({
|
||||
});
|
||||
// 选择时间和日期
|
||||
$(".form-datetime").datetimepicker(
|
||||
{
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
forceParse: 0,
|
||||
showMeridian: 1,
|
||||
format: "yyyy-mm-dd hh:ii"
|
||||
});
|
||||
{
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
forceParse: 0,
|
||||
showMeridian: 1,
|
||||
format: "yyyy-mm-dd hh:ii"
|
||||
});
|
||||
|
||||
// 仅选择日期
|
||||
$(".form-date").datetimepicker(
|
||||
{
|
||||
language: "zh-CN",
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
minView: 2,
|
||||
forceParse: 0,
|
||||
format: "yyyy-mm-dd"
|
||||
});
|
||||
{
|
||||
language: "zh-CN",
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 2,
|
||||
minView: 2,
|
||||
forceParse: 0,
|
||||
format: "yyyy-mm-dd"
|
||||
});
|
||||
// 选择时间
|
||||
$(".form-time").datetimepicker({
|
||||
language: "zh-CN",
|
||||
language: "zh-CN",
|
||||
weekStart: 1,
|
||||
todayBtn: 1,
|
||||
todayBtn: 1,
|
||||
autoclose: 1,
|
||||
todayHighlight: 1,
|
||||
startView: 1,
|
||||
@@ -185,4 +185,23 @@ var myColor = new $.zui.Color('#095823');
|
||||
var myHsl = myColor.toHsl();
|
||||
|
||||
var zuiPrimaryColor = $.zui.colorset.get('primary');
|
||||
console.log('ZUI primary color is', zuiPrimaryColor.toCssStr());
|
||||
console.log('ZUI primary color is', zuiPrimaryColor.toCssStr());
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
let count = 0;
|
||||
$('#draggableBtn').draggable({
|
||||
container: '#draggableBox',
|
||||
before: function () {
|
||||
console.log(count++ + ': ' + '[开始] 拖动...\n');
|
||||
return true;
|
||||
},
|
||||
drag: function (e: DraggableEvent) {
|
||||
console.log(count++ + ': ' + '拖动: pos = ' + JSON.stringify(e.pos) + ', offset = ' + JSON.stringify(e.offset) + '\n');
|
||||
// console.log('(' + e.pos.left + ', ' + e.pos.top + ')');
|
||||
},
|
||||
finish: function (e: DraggableEvent) {
|
||||
console.log(count++ + ': ' + '[完毕]:pos = ' + JSON.stringify(e.pos) + ', offset = ' + JSON.stringify(e.offset) + '\n');
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user