fastman2 3.0.0-alpha.1 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,181 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["fastman"] = factory();
8
- else
9
- root["fastman"] = factory();
10
- })(this, function() {
11
- return webpackJsonpfastman([24],{
12
-
13
- /***/ 219:
14
- /***/ (function(module, exports, __webpack_require__) {
15
-
16
- module.exports = __webpack_require__(87);
17
-
18
-
19
- /***/ }),
20
-
21
- /***/ 87:
22
- /***/ (function(module, exports, __webpack_require__) {
23
-
24
- "use strict";
25
-
26
-
27
- Object.defineProperty(exports, "__esModule", {
28
- value: true
29
- });
30
-
31
- var _picker = __webpack_require__(30);
32
-
33
- var _picker2 = _interopRequireDefault(_picker);
34
-
35
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
-
37
- var today = new Date(); /**
38
- * Created by linyiqing on 2017/6/26.
39
- */
40
-
41
-
42
- var getDays = function getDays(max) {
43
- var days = [];
44
- for (var i = 1; i <= (max || 31); i++) {
45
- days.push(i < 10 ? "0" + i : i);
46
- }
47
- return days;
48
- };
49
-
50
- var getDaysByMonthAndYear = function getDaysByMonthAndYear(month, year) {
51
- var int_d = new Date(year, parseInt(month) + 1 - 1, 1);
52
- var d = new Date(int_d - 1);
53
- return getDays(d.getDate());
54
- };
55
-
56
- var formatNumber = function formatNumber(n) {
57
- return n < 10 ? "0" + n : n;
58
- };
59
-
60
- var initMonthes = '01 02 03 04 05 06 07 08 09 10 11 12'.split(' ');
61
-
62
- var initYears = function () {
63
- var arr = [];
64
- for (var i = 1950; i <= 2090; i++) {
65
- arr.push(i);
66
- }
67
- return arr;
68
- }();
69
-
70
- var defaults = {
71
-
72
- rotateEffect: false, //为了性能
73
-
74
- value: [today.getFullYear(), formatNumber(today.getMonth() + 1), formatNumber(today.getDate()), today.getHours(), formatNumber(today.getMinutes())],
75
-
76
- onChange: function onChange(picker, values, displayValues) {
77
- var days = getDaysByMonthAndYear(picker.cols[1].value, picker.cols[0].value);
78
- var currentValue = picker.cols[2].value;
79
- if (currentValue > days.length) currentValue = days.length;
80
- picker.cols[2].setValue(currentValue);
81
- },
82
-
83
- formatValue: function formatValue(p, values, displayValues) {
84
- return displayValues[0] + '-' + values[1] + '-' + values[2] + ' ' + values[3] + ':' + values[4];
85
- },
86
-
87
- cols: [
88
- // Years
89
- {
90
- values: initYears
91
- },
92
- // Months
93
- {
94
- values: initMonthes
95
- },
96
- // Days
97
- {
98
- values: getDays()
99
- },
100
-
101
- // Space divider
102
- {
103
- divider: true,
104
- content: ' '
105
- },
106
- // Hours
107
- {
108
- values: function () {
109
- var arr = [];
110
- for (var i = 0; i <= 23; i++) {
111
- arr.push(i);
112
- }
113
- return arr;
114
- }()
115
- },
116
- // Divider
117
- {
118
- divider: true,
119
- content: ':'
120
- },
121
- // Minutes
122
- {
123
- values: function () {
124
- var arr = [];
125
- for (var i = 0; i <= 59; i++) {
126
- arr.push(i < 10 ? '0' + i : i);
127
- }
128
- return arr;
129
- }()
130
- }]
131
- };
132
-
133
- var defaults_notime = {
134
-
135
- rotateEffect: false, //为了性能
136
-
137
- value: [today.getFullYear(), formatNumber(today.getMonth() + 1), formatNumber(today.getDate())],
138
-
139
- onChange: function onChange(picker, values, displayValues) {
140
- var days = getDaysByMonthAndYear(picker.cols[1].value, picker.cols[0].value);
141
- var currentValue = picker.cols[2].value;
142
- if (currentValue > days.length) currentValue = days.length;
143
- picker.cols[2].setValue(currentValue);
144
- },
145
-
146
- formatValue: function formatValue(p, values, displayValues) {
147
- return displayValues[0] + '-' + values[1] + '-' + values[2];
148
- },
149
-
150
- cols: [
151
- // Years
152
- {
153
- values: initYears
154
- },
155
- // Months
156
- {
157
- values: initMonthes
158
- },
159
- // Days
160
- {
161
- values: getDays()
162
- }]
163
- };
164
-
165
- //needTime是否需要时间(不定义默认带时间)
166
-
167
- exports.default = function (id, params, needTime) {
168
- return $(id).each(function () {
169
- console.log($(this));
170
- if ($(this).length == 0) return;
171
- var p = $.extend(needTime === false ? defaults_notime : defaults, params);
172
- p.callback && p.callback(p);
173
- (0, _picker2.default)(id, p);
174
- if (params.value) $(this).val(p.formatValue(p, p.value, p.value));
175
- });
176
- };
177
-
178
- /***/ })
179
-
180
- },[219]);
181
- });
1
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.fastman=t():e.fastman=t()}(this,function(){return webpackJsonpfastman([24],{219:function(e,t,n){e.exports=n(87)},87:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var u=n(30),a=function(e){return e&&e.__esModule?e:{default:e}}(u),o=new Date,l=function(e){for(var t=[],n=1;n<=(e||31);n++)t.push(n<10?"0"+n:n);return t},r=function(e,t){var n=new Date(t,parseInt(e)+1-1,1),u=new Date(n-1);return l(u.getDate())},f=function(e){return e<10?"0"+e:e},s="01 02 03 04 05 06 07 08 09 10 11 12".split(" "),c=function(){for(var e=[],t=1950;t<=2090;t++)e.push(t);return e}(),i={rotateEffect:!1,value:[o.getFullYear(),f(o.getMonth()+1),f(o.getDate()),o.getHours(),f(o.getMinutes())],onChange:function(e,t,n){var u=r(e.cols[1].value,e.cols[0].value),a=e.cols[2].value;a>u.length&&(a=u.length),e.cols[2].setValue(a)},formatValue:function(e,t,n){return n[0]+"-"+t[1]+"-"+t[2]+" "+t[3]+":"+t[4]},cols:[{values:c},{values:s},{values:l()},{divider:!0,content:" "},{values:function(){for(var e=[],t=0;t<=23;t++)e.push(t);return e}()},{divider:!0,content:":"},{values:function(){for(var e=[],t=0;t<=59;t++)e.push(t<10?"0"+t:t);return e}()}]},v={rotateEffect:!1,value:[o.getFullYear(),f(o.getMonth()+1),f(o.getDate())],onChange:function(e,t,n){var u=r(e.cols[1].value,e.cols[0].value),a=e.cols[2].value;a>u.length&&(a=u.length),e.cols[2].setValue(a)},formatValue:function(e,t,n){return n[0]+"-"+t[1]+"-"+t[2]},cols:[{values:c},{values:s},{values:l()}]};t.default=function(e,t,n){return $(e).each(function(){if(0!=$(this).length){var u=$.extend(!1===n?v:i,t);u.callback&&u.callback(u),(0,a.default)(e,u),t.value&&$(this).val(u.formatValue(u,u.value,u.value))}})}}},[219])});