📄 db.js
字号:
if ("z.value" == nm) { var meta = zkau.getMeta(cmp); if (meta) meta.setDate(zk.parseDate(val, "yyyy/MM/dd")); } zkau.setAttr(cmp, nm, val); return true;};zkCal.onyearofs = function (evt, ofs) { var meta = zkau.getMeta($uuid(Event.element(evt))); if (meta) meta._onyearofs(ofs);};zkCal.onmonofs = function (evt, ofs) { var meta = zkau.getMeta($uuid(Event.element(evt))); if (meta) meta._onmonofs(ofs);};zkCal.onmonclk = function (evt) { var el = Event.element(evt); var meta = zkau.getMeta($uuid(el)); if (meta) meta._onmonclk(el);};zkCal.ondayclk = function (evt) { var el = Event.element(evt); if ($tag(el) == "A") el = el.parentNode; var meta = zkau.getMeta($uuid(el)); if (meta) meta._ondayclk(el);};zkCal.onup = function (evt) { var meta = zkau.getMeta($uuid(Event.element(evt))); if (meta && meta._changed) meta.onchange(); //delay onchange here to avoid too many reqs return true;};zkCal.onkey = function (evt) { if (!evt.altKey && evt.keyCode >= 37 && evt.keyCode <= 40) { var meta = zkau.getMeta($uuid(Event.element(evt))); if (meta) { ofs = evt.keyCode == 37 ? -1: evt.keyCode == 39 ? 1: evt.keyCode == 38 ? -7: 7; meta.shift(ofs); zk.focusDown(meta.element); meta._changed = true; } Event.stop(evt); return false; } return true;};zkCal.onblur = function (evt) { //onup is not called if onblur happens first var meta = zkau.getMeta($uuid(Event.element(evt))); if (meta && meta._changed) meta.onchange();};zkCal.onover = function (evt) { Event.element(evt).style.textDecoration = "underline";};zkCal.onout = function (evt) { Event.element(evt).style.textDecoration = "";};//Datebox//zkDtbox = {};zkDtbox.init = function (cmp) { zkDtbox.onVisi = zkWgt.fixDropBtn; //widget.js is ready now zkDtbox.onHide = zkTxbox.onHide; //widget.js is ready now var inp = $real(cmp); zkTxbox.init(inp); zk.listen(inp, zk.ie ? "keydown": "keypress", zkDtbox.onkey); //IE: use keydown. otherwise, it causes the window to scroll var btn = $e(cmp.id + "!btn"); if (btn) { zk.listen(btn, "click", function () {if (!inp.disabled && !zk.dragging) zkDtbox.onbutton(cmp);}); zkWgt.fixDropBtn(cmp); }};zkDtbox.validate = function (cmp) { var inp = $e(cmp.id+"!real"); if (inp.value) { var fmt = getZKAttr(cmp, "fmt"); var d = zk.parseDate(inp.value, fmt, getZKAttr(cmp, "lenient") == "false"); if (!d) return msgzul.DATE_REQUIRED+fmt; inp.value = zk.formatDate(d, fmt); //meta might not be ready } return null;};/** Handles setAttr. */zkDtbox.setAttr = function (cmp, nm, val) { if ("z.fmt" == nm) { zkau.setAttr(cmp, nm, val); var inp = $real(cmp); if (inp) { var d = zk.parseDate(inp.value, val); if (d) inp.value = zk.formatDate(d, val); } return true; } else if ("style" == nm) { var inp = $real(cmp); if (inp) zkau.setAttr(inp, nm, zk.getTextStyle(val, true, true)); } else if ("style.width" == nm) { var inp = $real(cmp); if (inp) { inp.style.width = val; return true; } } else if ("style.height" == nm) { var inp = $real(cmp); if (inp) { inp.style.height = val; return true; } } else if ("z.sel" == nm ) { return zkTxbox.setAttr(cmp, nm, val); } else if ("z.btnVisi" == nm) { var btn = $e(cmp.id + "!btn"); if (btn) btn.style.display = val == "true" ? "": "none"; return true; } zkau.setAttr(cmp, nm, val); return true;};zkDtbox.rmAttr = function (cmp, nm) { if ("style" == nm) { var inp = $real(cmp); if (inp) zkau.rmAttr(inp, nm); } else if ("style.width" == nm) { var inp = $real(cmp); if (inp) inp.style.width = ""; } else if ("style.height" == nm) { var inp = $real(cmp); if (inp) inp.style.height = ""; } zkau.rmAttr(cmp, nm); return true;};zkDtbox.onkey = function (evt) { var inp = Event.element(evt); if (!inp) return true; var uuid = $uuid(inp.id); var pp = $e(uuid + "!pp"); if (!pp) return true; var opened = $visible(pp); if (evt.keyCode == 9) { //TAB; IE: close now to show covered SELECT if (opened) zkDtbox.close(pp); return true; //don't eat } if (evt.keyCode == 38 || evt.keyCode == 40) {//UP/DN if (evt.altKey) { if (evt.keyCode == 38) { //UP if (opened) zkDtbox.close(pp); } else { if (!opened) zkDtbox.open(pp); } //FF: if we eat UP/DN, Alt+UP degenerate to Alt (select menubar) if (zk.ie) { Event.stop(evt); return false; } return true; } if (!opened) { zkDtbox.open(pp); Event.stop(evt); return false; } } if (opened) { var meta = zkau.getMeta(uuid); if (meta) { //Request 1551019: better responsive if (evt.keyCode == 13) { //ENTER meta.onchange(); return true; } var ofs = evt.keyCode == 37 ? -1: evt.keyCode == 39 ? 1: evt.keyCode == 38 ? -7: evt.keyCode == 40 ? 7: 0; if (ofs) { meta.shift(ofs); inp.value = meta.getDateString(); zk.asyncSelect(inp.id); Event.stop(evt); return false; } } } return true;};/* Whn the button is clicked on button. */zkDtbox.onbutton = function (cmp) { var pp = $e(cmp.id + "!pp"); if (pp) { if (!$visible(pp)) zkDtbox.open(pp); else zkDtbox.close(pp, true); }};zkDtbox.open = function (pp) { pp = $e(pp); zkau.closeFloats(pp); //including popups zkau._dtbox.setFloatId(pp.id); var uuid = $uuid(pp.id); var cb = $e(uuid); if (!cb) return; var meta = zkau.getMeta(cb); if (meta) meta.init(); else zkau.setMeta(cb, new zk.Cal(cb, pp)); pp.style.width = pp.style.height = "auto"; pp.style.position = "absolute"; //just in case pp.style.overflow = "auto"; //just in case pp.style.display = "block"; pp.style.zIndex = "88000"; //No special child, so no need to: zk.onVisiAt(pp); //FF: Bug 1486840 //IE: Bug 1766244 (after specifying position:relative to grid/tree/listbox) zk.setVParent(pp); //fix size if (pp.offsetHeight > 200) { pp.style.height = "200px"; pp.style.width = "auto"; //recalc } else if (pp.offsetHeight < 10) { pp.style.height = "10px"; //minimal } if (pp.offsetWidth < cb.offsetWidth) { pp.style.width = cb.offsetWidth + "px"; } else { var wd = zk.innerWidth() - 20; if (wd < cb.offsetWidth) wd = cb.offsetWidth; if (pp.offsetWidth > wd) pp.style.width = wd; } zk.position(pp, cb, "after-start"); setTimeout("zkDtbox._repos('"+uuid+"')", 3); //IE issue: we have to re-position again because some dimensions //might not be correct here};/** Re-position the popup. */zkDtbox._repos = function (uuid) { var cb = $e(uuid); if (!cb) return; var pp = $e(uuid + "!pp"); var inpId = cb.id + "!real"; var inp = $e(inpId); zk.position(pp, cb, "after-start"); zkau.hideCovered(); zk.asyncFocus(inpId);};zkDtbox.close = function (pp, focus) { var uuid = $uuid(pp.id); pp.style.display = "none"; zk.unsetVParent(pp); pp = $e(pp); zkau._dtbox.setFloatId(null); //No special child, so no need to: zk.onHideAt(pp); zkau.hideCovered(); if (focus) zk.asyncFocus(uuid + "!real");};zk.FloatDatebox = Class.create();Object.extend(Object.extend(zk.FloatDatebox.prototype, zk.Float.prototype), { _close: function (el) { zkDtbox.close(el); }});if (!zkau._dtbox) zkau.floats.push(zkau._dtbox = new zk.FloatDatebox()); //hook to zkau.js
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -