@94ai/nf-timezone-picker 6.1.11 → 6.1.12

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,101 +1,101 @@
1
- <template>
2
- <table class="el-year-table" @click="handleYearTableClick">
3
- <tbody>
4
- <tr>
5
- <td class="available" :class="getCellStyle(startYear + 0)">
6
- <a class="cell">{{ startYear }}</a>
7
- </td>
8
- <td class="available" :class="getCellStyle(startYear + 1)">
9
- <a class="cell">{{ startYear + 1 }}</a>
10
- </td>
11
- <td class="available" :class="getCellStyle(startYear + 2)">
12
- <a class="cell">{{ startYear + 2 }}</a>
13
- </td>
14
- <td class="available" :class="getCellStyle(startYear + 3)">
15
- <a class="cell">{{ startYear + 3 }}</a>
16
- </td>
17
- </tr>
18
- <tr>
19
- <td class="available" :class="getCellStyle(startYear + 4)">
20
- <a class="cell">{{ startYear + 4 }}</a>
21
- </td>
22
- <td class="available" :class="getCellStyle(startYear + 5)">
23
- <a class="cell">{{ startYear + 5 }}</a>
24
- </td>
25
- <td class="available" :class="getCellStyle(startYear + 6)">
26
- <a class="cell">{{ startYear + 6 }}</a>
27
- </td>
28
- <td class="available" :class="getCellStyle(startYear + 7)">
29
- <a class="cell">{{ startYear + 7 }}</a>
30
- </td>
31
- </tr>
32
- <tr>
33
- <td class="available" :class="getCellStyle(startYear + 8)">
34
- <a class="cell">{{ startYear + 8 }}</a>
35
- </td>
36
- <td class="available" :class="getCellStyle(startYear + 9)">
37
- <a class="cell">{{ startYear + 9 }}</a>
38
- </td>
39
- <td />
40
- <td />
41
- </tr>
42
- </tbody>
43
- </table>
44
- </template>
45
-
46
- <script type="text/babel">
47
- import { hasClass } from 'element-ui/src/utils/dom'
48
- import { isDate, range, nextDate, getDayCountOfYear } from 'element-ui/src/utils/date-util'
49
- import { arrayFindIndex, coerceTruthyValueToArray } from 'element-ui/src/utils/util'
50
-
51
- const datesInYear = year => {
52
- const numOfDays = getDayCountOfYear(year)
53
- const firstDay = new Date(year, 0, 1)
54
- return range(numOfDays).map(n => nextDate(firstDay, n))
55
- }
56
-
57
- export default {
58
- props: {
59
- disabledDate: {},
60
- value: {},
61
- defaultValue: {
62
- validator(val) {
63
- // null or valid Date Object
64
- return val === null || (val instanceof Date && isDate(val))
65
- }
66
- },
67
- date: {}
68
- },
69
-
70
- computed: {
71
- startYear() {
72
- return Math.floor(this.date.getFullYear() / 10) * 10
73
- }
74
- },
75
-
76
- methods: {
77
- getCellStyle(year) {
78
- const style = {}
79
- const today = new Date()
80
-
81
- style.disabled = typeof this.disabledDate === 'function'
82
- ? datesInYear(year).every(this.disabledDate)
83
- : false
84
- style.current = arrayFindIndex(coerceTruthyValueToArray(this.value), date => date.getFullYear() === year) >= 0
85
- style.today = today.getFullYear() === year
86
- style.default = this.defaultValue && this.defaultValue.getFullYear() === year
87
-
88
- return style
89
- },
90
-
91
- handleYearTableClick(event) {
92
- const target = event.target
93
- if (target.tagName === 'A') {
94
- if (hasClass(target.parentNode, 'disabled')) return
95
- const year = target.textContent || target.innerText
96
- this.$emit('pick', Number(year))
97
- }
98
- }
99
- }
100
- }
101
- </script>
1
+ <template>
2
+ <table class="el-year-table" @click="handleYearTableClick">
3
+ <tbody>
4
+ <tr>
5
+ <td class="available" :class="getCellStyle(startYear + 0)">
6
+ <a class="cell">{{ startYear }}</a>
7
+ </td>
8
+ <td class="available" :class="getCellStyle(startYear + 1)">
9
+ <a class="cell">{{ startYear + 1 }}</a>
10
+ </td>
11
+ <td class="available" :class="getCellStyle(startYear + 2)">
12
+ <a class="cell">{{ startYear + 2 }}</a>
13
+ </td>
14
+ <td class="available" :class="getCellStyle(startYear + 3)">
15
+ <a class="cell">{{ startYear + 3 }}</a>
16
+ </td>
17
+ </tr>
18
+ <tr>
19
+ <td class="available" :class="getCellStyle(startYear + 4)">
20
+ <a class="cell">{{ startYear + 4 }}</a>
21
+ </td>
22
+ <td class="available" :class="getCellStyle(startYear + 5)">
23
+ <a class="cell">{{ startYear + 5 }}</a>
24
+ </td>
25
+ <td class="available" :class="getCellStyle(startYear + 6)">
26
+ <a class="cell">{{ startYear + 6 }}</a>
27
+ </td>
28
+ <td class="available" :class="getCellStyle(startYear + 7)">
29
+ <a class="cell">{{ startYear + 7 }}</a>
30
+ </td>
31
+ </tr>
32
+ <tr>
33
+ <td class="available" :class="getCellStyle(startYear + 8)">
34
+ <a class="cell">{{ startYear + 8 }}</a>
35
+ </td>
36
+ <td class="available" :class="getCellStyle(startYear + 9)">
37
+ <a class="cell">{{ startYear + 9 }}</a>
38
+ </td>
39
+ <td />
40
+ <td />
41
+ </tr>
42
+ </tbody>
43
+ </table>
44
+ </template>
45
+
46
+ <script type="text/babel">
47
+ import { hasClass } from 'element-ui/src/utils/dom'
48
+ import { isDate, range, nextDate, getDayCountOfYear } from 'element-ui/src/utils/date-util'
49
+ import { arrayFindIndex, coerceTruthyValueToArray } from 'element-ui/src/utils/util'
50
+
51
+ const datesInYear = year => {
52
+ const numOfDays = getDayCountOfYear(year)
53
+ const firstDay = new Date(year, 0, 1)
54
+ return range(numOfDays).map(n => nextDate(firstDay, n))
55
+ }
56
+
57
+ export default {
58
+ props: {
59
+ disabledDate: {},
60
+ value: {},
61
+ defaultValue: {
62
+ validator(val) {
63
+ // null or valid Date Object
64
+ return val === null || (val instanceof Date && isDate(val))
65
+ }
66
+ },
67
+ date: {}
68
+ },
69
+
70
+ computed: {
71
+ startYear() {
72
+ return Math.floor(this.date.getFullYear() / 10) * 10
73
+ }
74
+ },
75
+
76
+ methods: {
77
+ getCellStyle(year) {
78
+ const style = {}
79
+ const today = new Date()
80
+
81
+ style.disabled = typeof this.disabledDate === 'function'
82
+ ? datesInYear(year).every(this.disabledDate)
83
+ : false
84
+ style.current = arrayFindIndex(coerceTruthyValueToArray(this.value), date => date.getFullYear() === year) >= 0
85
+ style.today = today.getFullYear() === year
86
+ style.default = this.defaultValue && this.defaultValue.getFullYear() === year
87
+
88
+ return style
89
+ },
90
+
91
+ handleYearTableClick(event) {
92
+ const target = event.target
93
+ if (target.tagName === 'A') {
94
+ if (hasClass(target.parentNode, 'disabled')) return
95
+ const year = target.textContent || target.innerText
96
+ this.$emit('pick', Number(year))
97
+ }
98
+ }
99
+ }
100
+ }
101
+ </script>
@@ -1,39 +1,39 @@
1
- import Picker from '../picker'
2
- import TimePanel from '../panel/time'
3
- import TimeRangePanel from '../panel/time-range'
4
-
5
- export default {
6
- mixins: [Picker],
7
-
8
- name: 'ElTimePicker',
9
-
10
- props: {
11
- isRange: Boolean,
12
- arrowControl: Boolean
13
- },
14
-
15
- data() {
16
- return {
17
- type: ''
18
- }
19
- },
20
-
21
- watch: {
22
- isRange(isRange) {
23
- if (this.picker) {
24
- this.unmountPicker()
25
- this.type = isRange ? 'timerange' : 'time'
26
- this.panel = isRange ? TimeRangePanel : TimePanel
27
- this.mountPicker()
28
- } else {
29
- this.type = isRange ? 'timerange' : 'time'
30
- this.panel = isRange ? TimeRangePanel : TimePanel
31
- }
32
- }
33
- },
34
-
35
- created() {
36
- this.type = this.isRange ? 'timerange' : 'time'
37
- this.panel = this.isRange ? TimeRangePanel : TimePanel
38
- }
39
- }
1
+ import Picker from '../picker'
2
+ import TimePanel from '../panel/time'
3
+ import TimeRangePanel from '../panel/time-range'
4
+
5
+ export default {
6
+ mixins: [Picker],
7
+
8
+ name: 'ElTimePicker',
9
+
10
+ props: {
11
+ isRange: Boolean,
12
+ arrowControl: Boolean
13
+ },
14
+
15
+ data() {
16
+ return {
17
+ type: ''
18
+ }
19
+ },
20
+
21
+ watch: {
22
+ isRange(isRange) {
23
+ if (this.picker) {
24
+ this.unmountPicker()
25
+ this.type = isRange ? 'timerange' : 'time'
26
+ this.panel = isRange ? TimeRangePanel : TimePanel
27
+ this.mountPicker()
28
+ } else {
29
+ this.type = isRange ? 'timerange' : 'time'
30
+ this.panel = isRange ? TimeRangePanel : TimePanel
31
+ }
32
+ }
33
+ },
34
+
35
+ created() {
36
+ this.type = this.isRange ? 'timerange' : 'time'
37
+ this.panel = this.isRange ? TimeRangePanel : TimePanel
38
+ }
39
+ }
@@ -1,21 +1,21 @@
1
- import Picker from '../picker'
2
- import Panel from '../panel/time-select'
3
-
4
- export default {
5
- mixins: [Picker],
6
-
7
- name: 'ElTimeSelect',
8
-
9
- componentName: 'ElTimeSelect',
10
-
11
- props: {
12
- type: {
13
- type: String,
14
- default: 'time-select'
15
- }
16
- },
17
-
18
- beforeCreate() {
19
- this.panel = Panel
20
- }
21
- }
1
+ import Picker from '../picker'
2
+ import Panel from '../panel/time-select'
3
+
4
+ export default {
5
+ mixins: [Picker],
6
+
7
+ name: 'ElTimeSelect',
8
+
9
+ componentName: 'ElTimeSelect',
10
+
11
+ props: {
12
+ type: {
13
+ type: String,
14
+ default: 'time-select'
15
+ }
16
+ },
17
+
18
+ beforeCreate() {
19
+ this.panel = Panel
20
+ }
21
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-timezone-picker",
3
- "version": "6.1.11",
3
+ "version": "6.1.12",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,7 +14,7 @@
14
14
  "url": "http://94ai.gitlab.com/ui/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/nf-theme-chalk": "^6.1.11",
17
+ "@94ai/nf-theme-chalk": "^6.1.12",
18
18
  "vue-demi": "^0.14.5"
19
19
  },
20
20
  "peerDependenciesMeta": {
@@ -30,5 +30,5 @@
30
30
  "types": "lib/index.d.ts",
31
31
  "main": "lib/nf-timezone-picker.cjs.js",
32
32
  "module": "lib/nf-timezone-picker.esm-bundler.js",
33
- "gitHead": "b323e0bc9c0c83ee7729ce6fc8e1611143f73e09"
33
+ "gitHead": "c170847f6493387bf69985e7661c5d44e0a1decd"
34
34
  }
package/components.d.ts DELETED
@@ -1,8 +0,0 @@
1
- export {}
2
-
3
- declare module 'vue' {
4
- export interface GlobalComponents {
5
- NfTimezonePicker: typeof import('@94ai/nf-timezone-picker/lib/nf-timezone-picker.vue')['default']
6
-
7
- }
8
- }