diff --git a/en.e1f05150.html b/en.e1f05150.html new file mode 100644 index 0000000..7a30e84 --- /dev/null +++ b/en.e1f05150.html @@ -0,0 +1,59 @@ + + +

Basic

+

You can select or input a date, month, year, time or datetime

+ + +

ValueType

+

You can set the type of the v-model value by valueType.

+ + + +

Range

+

Support to select a date range.

+ + +

DisabledDate & DisabledTime

+

Disabled part of dates and time by disabledDate and disabledTime respectively.

+

You should let the defaultValue not be disabled, when you use disabledDate or disabledTime.

+ + +

Disabled & editable

+ + + +

Shortcut

+

You can set shortcuts to improve user experience.

+

Use the header slot or the footer slot to render extra element in panel for customized requirements.

+ + +

Control TimePanel visible(datetime mode)

+

The display or hiding of the time panel can be controlled by showTimePanel.

+

The time panel is displayed after the date is selected by default.

+ + +

Control Open

+

You can use the prop open to control the visible of popup.

+

This example shows how to close the popup when the seconds is selected.

+ + +

Hide seconds selection & display AMPM selection

+

The columns of the time Picker is displayed according to the value of format(HH:mm:ss) by default.

+

You can also set showHour showMinute showSecond to override the default value

+ + +

Interval and custom time options

+

Set stepped time options by hourStep minuteStep secondStep

+

Set custom time options by hourOptions minuteOptions secondOptions.

+ + +

Select fixed time list

+

You can provide a list of fixed time for users to choose by timePickerOptions

diff --git a/example.9bb69ced.js b/example.9bb69ced.js new file mode 100644 index 0000000..07e07db --- /dev/null +++ b/example.9bb69ced.js @@ -0,0 +1,2805 @@ +// modules are defined as an array +// [ module function, map of requires ] +// +// map of requires is short require name -> numeric require +// +// anything defined in a previous bundle is accessed via the +// orig method which is the require for previous bundles +parcelRequire = (function (modules, cache, entry, globalName) { + // Save the require from previous bundle to this closure if any + var previousRequire = typeof parcelRequire === 'function' && parcelRequire; + var nodeRequire = typeof require === 'function' && require; + + function newRequire(name, jumped) { + if (!cache[name]) { + if (!modules[name]) { + // if we cannot find the module within our internal map or + // cache jump to the current global require ie. the last bundle + // that was added to the page. + var currentRequire = typeof parcelRequire === 'function' && parcelRequire; + if (!jumped && currentRequire) { + return currentRequire(name, true); + } + + // If there are other bundles on this page the require from the + // previous one is saved to 'previousRequire'. Repeat this as + // many times as there are bundles until the module is found or + // we exhaust the require chain. + if (previousRequire) { + return previousRequire(name, true); + } + + // Try the node require function if it exists. + if (nodeRequire && typeof name === 'string') { + return nodeRequire(name); + } + + var err = new Error('Cannot find module \'' + name + '\''); + err.code = 'MODULE_NOT_FOUND'; + throw err; + } + + localRequire.resolve = resolve; + localRequire.cache = {}; + + var module = cache[name] = new newRequire.Module(name); + + modules[name][0].call(module.exports, localRequire, module, module.exports, this); + } + + return cache[name].exports; + + function localRequire(x){ + return newRequire(localRequire.resolve(x)); + } + + function resolve(x){ + return modules[name][1][x] || x; + } + } + + function Module(moduleName) { + this.id = moduleName; + this.bundle = newRequire; + this.exports = {}; + } + + newRequire.isParcelRequire = true; + newRequire.Module = Module; + newRequire.modules = modules; + newRequire.cache = cache; + newRequire.parent = previousRequire; + newRequire.register = function (id, exports) { + modules[id] = [function (require, module) { + module.exports = exports; + }, {}]; + }; + + var error; + for (var i = 0; i < entry.length; i++) { + try { + newRequire(entry[i]); + } catch (e) { + // Save first error but execute all entries + if (!error) { + error = e; + } + } + } + + if (entry.length) { + // Expose entry point to Node, AMD or browser globals + // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js + var mainExports = newRequire(entry[entry.length - 1]); + + // CommonJS + if (typeof exports === "object" && typeof module !== "undefined") { + module.exports = mainExports; + + // RequireJS + } else if (typeof define === "function" && define.amd) { + define(function () { + return mainExports; + }); + + // \n" +}, { + id: 'ValueType', + component: _ValueType.default, + code: "\n\n\n" +}, { + id: 'Range', + component: _Range.default, + code: "\n\n\n" +}, { + id: 'HideSeconds', + component: _HideSeconds.default, + code: "\n\n\n" +}, { + id: 'MinuteStep', + component: _MinuteStep.default, + code: "\n\n\n" +}, { + id: 'FixedTimeList', + component: _FixedTimeList.default, + code: "\n\n\n" +}, { + id: 'DisabledDateTime', + component: _DisabledDateTime.default, + code: "\n\n\n" +}, { + id: 'Disabled', + component: _Disabled.default, + code: "\n\n\n" +}, { + id: 'Shortcut', + component: _Shortcut.default, + code: "\n\n\n" +}, { + id: 'ControlTimePanel', + component: _ControlTimePanel.default, + code: "\n\n\n" +}, { + id: 'ControlOpen', + component: _ControlOpen.default, + code: "\n\n\n" +}]; + +function transformMd(text) { + var array = text.split(/\n(?=/); + return result && result[1].trim(); + }; + + var getTitleAndDescription = function getTitleAndDescription(s) { + var result = s.match(/(.*?)<\/h\d>/); + if (!result) return null; + var title = result[1]; + var description = s.slice(result[0].length + result.index); + return { + title: title.trim().replace(/&/g, '&'), + description: description.trim() + }; + }; + + var result = {}; + array.forEach(function (str) { + var id = getId(str); + + if (id) { + result[id] = getTitleAndDescription(str); + } + }); + return result; +} + +var docMap = { + en: transformMd(_en.default), + 'zh-cn': transformMd(_zhCn.default) +}; +var App = { + name: 'App', + props: { + changeLocale: { + type: Function, + default: function _default() { + return ''; + } + } + }, + data: function data() { + return { + lang: 'en', + currentId: this.getCurrentId() + }; + }, + mounted: function mounted() { + var _this = this; + + window.onhashchange = function () { + _this.currentId = _this.getCurrentId(); + }; + + if (this.currentId) { + document.getElementById(this.currentId).scrollIntoView(); + } + }, + methods: { + getCurrentId: function getCurrentId() { + return location.hash.slice(1); + }, + handleChangeLocale: function handleChangeLocale() { + var lang = this.lang === 'en' ? 'zh-cn' : 'en'; + this.lang = lang; + this.changeLocale(lang); + } + }, + render: function render(h) { + var _this2 = this; + + var doc = docMap[this.lang] || docMap.en; + var menus = components.map(function (item) { + return _objectSpread({ + id: item.id + }, doc[item.id]); + }); + return h(_container.default, { + "attrs": { + "menus": menus + } + }, [h("div", { + "style": { + textAlign: 'right' + } + }, [h("a", { + "style": "margin-right: 10px", + "class": "mx-btn-text mx-btn", + "attrs": { + "href": "https://github.com/mengxiong10/vue2-datepicker", + "target": "_blank" + } + }, ["GitHub"]), h("button", { + "on": { + "click": this.handleChangeLocale + }, + "class": "mx-btn" + }, [this.lang === 'en' ? '中文' : 'English'])]), h("div", { + "key": this.lang + }, [components.map(function (item) { + var component = item.component, + id = item.id, + code = item.code; + + var props = _objectSpread({ + id: id, + code: code, + active: id === _this2.currentId + }, doc[id]); + + return h(_card.default, { + "props": _objectSpread({}, props) + }, [h(component)]); + })])]); + } +}; +var _default = App; +exports.default = _default; +},{"fs":"rDCW","./helper/container.vue":"exOZ","./helper/card.vue":"K2WH","./demo/Basic.vue":"F4k5","./demo/ValueType.vue":"MAVg","./demo/Range.vue":"vssy","./demo/DisabledDateTime.vue":"tBXd","./demo/Shortcut.vue":"U8rn","./demo/ControlTimePanel.vue":"jkBQ","./demo/ControlOpen.vue":"hLWH","./demo/HideSeconds.vue":"P315","./demo/MinuteStep.vue":"WCZR","./demo/FixedTimeList.vue":"hxWp","./demo/Disabled.vue":"TYGO","./en.md":"yxg7","./zh-cn.md":"u7Vb"}],"Focm":[function(require,module,exports) { +"use strict"; + +var _app = _interopRequireDefault(require("./app")); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +window.DatePicker.locale('en'); +new window.Vue({ + render: function render(h) { + return h(_app.default, { + props: { + changeLocale: window.DatePicker.locale + } + }); + } +}).$mount('#app'); +},{"./app":"A2T1"}],"FheM":[function(require,module,exports) { +var bundleURL = null; + +function getBundleURLCached() { + if (!bundleURL) { + bundleURL = getBundleURL(); + } + + return bundleURL; +} + +function getBundleURL() { + // Attempt to find the URL of the current script and use that as the base URL + try { + throw new Error(); + } catch (err) { + var matches = ('' + err.stack).match(/(https?|file|ftp|chrome-extension|moz-extension):\/\/[^)\n]+/g); + + if (matches) { + return getBaseURL(matches[0]); + } + } + + return '/'; +} + +function getBaseURL(url) { + return ('' + url).replace(/^((?:https?|file|ftp|chrome-extension|moz-extension):\/\/.+)\/[^/]+$/, '$1') + '/'; +} + +exports.getBundleURL = getBundleURLCached; +exports.getBaseURL = getBaseURL; +},{}],"TUK3":[function(require,module,exports) { +var getBundleURL = require('./bundle-url').getBundleURL; + +function loadBundlesLazy(bundles) { + if (!Array.isArray(bundles)) { + bundles = [bundles]; + } + + var id = bundles[bundles.length - 1]; + + try { + return Promise.resolve(require(id)); + } catch (err) { + if (err.code === 'MODULE_NOT_FOUND') { + return new LazyPromise(function (resolve, reject) { + loadBundles(bundles.slice(0, -1)).then(function () { + return require(id); + }).then(resolve, reject); + }); + } + + throw err; + } +} + +function loadBundles(bundles) { + return Promise.all(bundles.map(loadBundle)); +} + +var bundleLoaders = {}; + +function registerBundleLoader(type, loader) { + bundleLoaders[type] = loader; +} + +module.exports = exports = loadBundlesLazy; +exports.load = loadBundles; +exports.register = registerBundleLoader; +var bundles = {}; + +function loadBundle(bundle) { + var id; + + if (Array.isArray(bundle)) { + id = bundle[1]; + bundle = bundle[0]; + } + + if (bundles[bundle]) { + return bundles[bundle]; + } + + var type = (bundle.substring(bundle.lastIndexOf('.') + 1, bundle.length) || bundle).toLowerCase(); + var bundleLoader = bundleLoaders[type]; + + if (bundleLoader) { + return bundles[bundle] = bundleLoader(getBundleURL() + bundle).then(function (resolved) { + if (resolved) { + module.bundle.register(id, resolved); + } + + return resolved; + }).catch(function (e) { + delete bundles[bundle]; + throw e; + }); + } +} + +function LazyPromise(executor) { + this.executor = executor; + this.promise = null; +} + +LazyPromise.prototype.then = function (onSuccess, onError) { + if (this.promise === null) this.promise = new Promise(this.executor); + return this.promise.then(onSuccess, onError); +}; + +LazyPromise.prototype.catch = function (onError) { + if (this.promise === null) this.promise = new Promise(this.executor); + return this.promise.catch(onError); +}; +},{"./bundle-url":"FheM"}],"A3BY":[function(require,module,exports) { +module.exports = function loadHTMLBundle(bundle) { + return fetch(bundle).then(function (res) { + return res.text(); + }); +}; +},{}],0:[function(require,module,exports) { +var b=require("TUK3");b.register("html",require("A3BY"));b.load([["en.e1f05150.html","yxg7"],["zh-cn.d0e04549.html","u7Vb"]]).then(function(){require("Focm");}); +},{}]},{},[0], null) \ No newline at end of file diff --git a/index.html b/index.html index 3cf71f7..12939c2 100644 --- a/index.html +++ b/index.html @@ -7,13 +7,13 @@ Document - +
- + diff --git a/zh-cn.d0e04549.html b/zh-cn.d0e04549.html new file mode 100644 index 0000000..b77bb17 --- /dev/null +++ b/zh-cn.d0e04549.html @@ -0,0 +1,59 @@ + + +

基本

+

可以选择或手动输入一个日期, 月, 年, 时间或者日期加时间

+ + +

绑定值的类型

+

通过valueType去设置v-model绑定的值的类型

+ + + +

日期范围

+

支持选择一个日期范围

+ + +

不可选择的日期和时间

+

可用 disabledDatedisabledTime 分别禁止选择部分日期和时间.

+

当你使用disabledDatedisabledTime的时候, 应该设置defaultValue的值是不被禁止选择的.

+ + +

禁用和可编辑

+ + + +

快捷选项

+

可以通过设置 shortcuts 提升用户体验.

+

也可以使用 slot header 或者 footer 去设置额外的元素.

+ + +

控制时间选择的显示和隐藏(日期时间模式)

+

时间选择的显示可以通过 showTimePanel 控制.

+

默认情况下选择一个日期后时间面板就自动显示.

+ + +

控制弹窗打开

+

可以通过 open 去控制弹窗的显示

+

下面的例子说明怎么关闭弹窗当选择秒的时候

+ + +

隐藏秒和显示 am/pm

+

时间选择的列是自动显示通过 format的设置.

+

你可以通过 showHour showMinute showSecond 覆盖默认值

+ + +

间隔的时间和自定义时间选择

+

设置间隔的时间通过hourStep minuteStep secondStep.

+

设置自定义的选择通过hourOptions minuteOptions secondOptions.

+ + +

固定的时间列表

+

可以通过 timePickerOptions 提供一个固定的时间列表选择