@94ai/nf-double-year 9.0.0 → 10.0.0

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.
@@ -1280,13 +1280,9 @@ const RANGE_PARSER = function(array, format, separator) {
1280
1280
  const TYPE_VALUE_RESOLVER_MAP = {
1281
1281
  default: {
1282
1282
  formatter(value) {
1283
- if (!value)
1284
- return "";
1285
1283
  return "" + value;
1286
1284
  },
1287
1285
  parser(text) {
1288
- if (text === void 0 || text === "")
1289
- return null;
1290
1286
  return text;
1291
1287
  }
1292
1288
  },
@@ -1349,8 +1345,6 @@ const TYPE_VALUE_RESOLVER_MAP = {
1349
1345
  },
1350
1346
  number: {
1351
1347
  formatter(value) {
1352
- if (!value)
1353
- return "";
1354
1348
  return "" + value;
1355
1349
  },
1356
1350
  parser(text) {
@@ -1555,10 +1549,7 @@ const _sfc_main$3 = {
1555
1549
  return reference.$el || reference;
1556
1550
  },
1557
1551
  refInput() {
1558
- if (this.reference) {
1559
- return [].slice.call(this.reference.querySelectorAll("input"));
1560
- }
1561
- return [];
1552
+ return [].slice.call(this.reference.querySelectorAll("input"));
1562
1553
  },
1563
1554
  valueIsEmpty() {
1564
1555
  const val = this.value;
@@ -1591,9 +1582,6 @@ const _sfc_main$3 = {
1591
1582
  return "day";
1592
1583
  },
1593
1584
  haveTrigger() {
1594
- if (typeof this.showTrigger !== "undefined") {
1595
- return this.showTrigger;
1596
- }
1597
1585
  return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
1598
1586
  },
1599
1587
  displayValue() {
@@ -1833,9 +1821,6 @@ const _sfc_main$3 = {
1833
1821
  event.stopPropagation();
1834
1822
  return;
1835
1823
  }
1836
- if (this.picker && this.picker.handleKeydown) {
1837
- this.picker.handleKeydown(event);
1838
- }
1839
1824
  },
1840
1825
  handleRangeClick() {
1841
1826
  const type = this.type;
@@ -1846,7 +1831,6 @@ const _sfc_main$3 = {
1846
1831
  },
1847
1832
  hidePicker() {
1848
1833
  if (this.picker) {
1849
- this.picker.resetView && this.picker.resetView();
1850
1834
  this.pickerVisible = this.picker.visible = false;
1851
1835
  this.destroyPopper();
1852
1836
  }
@@ -1860,10 +1844,6 @@ const _sfc_main$3 = {
1860
1844
  this.pickerVisible = this.picker.visible = true;
1861
1845
  this.updatePopper();
1862
1846
  this.picker.value = this.parsedValue;
1863
- this.picker.resetView && this.picker.resetView();
1864
- this.$nextTick(() => {
1865
- this.picker.adjustSpinners && this.picker.adjustSpinners();
1866
- });
1867
1847
  },
1868
1848
  mountPicker() {
1869
1849
  this.picker = new Vue(this.panel).$mount();
@@ -1903,13 +1883,11 @@ const _sfc_main$3 = {
1903
1883
  deep: true
1904
1884
  });
1905
1885
  this.$el.appendChild(this.picker.$el);
1906
- this.picker.resetView && this.picker.resetView();
1907
1886
  this.picker.$on("dodestroy", this.doDestroy);
1908
1887
  this.picker.$on("pick", (date = "", visible = false) => {
1909
1888
  this.userInput = null;
1910
1889
  this.pickerVisible = this.picker.visible = visible;
1911
1890
  this.emitInput(date);
1912
- this.picker.resetView && this.picker.resetView();
1913
1891
  });
1914
1892
  this.picker.$on("select-range", (start, end, pos) => {
1915
1893
  if (this.refInput.length === 0)
@@ -1954,11 +1932,7 @@ const _sfc_main$3 = {
1954
1932
  if (!this.picker) {
1955
1933
  this.mountPicker();
1956
1934
  }
1957
- if (this.picker.isValidValue) {
1958
- return value && this.picker.isValidValue(value);
1959
- } else {
1960
- return true;
1961
- }
1935
+ return this.picker.isValidValue(value);
1962
1936
  }
1963
1937
  }
1964
1938
  };
@@ -2140,6 +2114,12 @@ const _sfc_main$2 = {
2140
2114
  return Math.floor(this.date.getFullYear() / 12) * 12;
2141
2115
  }
2142
2116
  },
2117
+ data() {
2118
+ return {
2119
+ lastRow: null,
2120
+ lastColumn: null
2121
+ };
2122
+ },
2143
2123
  methods: {
2144
2124
  getCellStyle(year) {
2145
2125
  const style = {};
@@ -2180,6 +2160,8 @@ const _sfc_main$2 = {
2180
2160
  const year = Number(target.textContent || target.innerText);
2181
2161
  if (this.selectionMode === "range") {
2182
2162
  if (!this.rangeState.selecting) {
2163
+ this.lastRow = null;
2164
+ this.lastColumn = null;
2183
2165
  this.$emit("pick", {
2184
2166
  minDate: year,
2185
2167
  maxDate: null
@@ -2203,7 +2185,6 @@ const _sfc_main$2 = {
2203
2185
  } else {
2204
2186
  this.$emit("pick", year);
2205
2187
  }
2206
- this.handleMouseMove(event);
2207
2188
  },
2208
2189
  handleMouseMove(event) {
2209
2190
  let target = event.target;
@@ -2219,9 +2200,11 @@ const _sfc_main$2 = {
2219
2200
  return;
2220
2201
  const row = target.parentNode.rowIndex;
2221
2202
  const column = target.cellIndex;
2222
- if (hasClass(target.parentNode, "disabled"))
2203
+ if (hasClass(target, "disabled"))
2223
2204
  return;
2224
2205
  if (row !== this.lastRow || column !== this.lastColumn) {
2206
+ this.lastRow = row;
2207
+ this.lastColumn = column;
2225
2208
  this.$emit("changerange", {
2226
2209
  minDate: this.minDate,
2227
2210
  maxDate: this.maxDate,
@@ -2397,6 +2380,13 @@ const _sfc_main$1 = {
2397
2380
  }
2398
2381
  },
2399
2382
  methods: {
2383
+ isValidValue(value) {
2384
+ const validDate = (date) => date instanceof Date && !isNaN(date.getTime());
2385
+ if (!Array.isArray(value)) {
2386
+ return validDate(value) && (!this.disabledDate || !this.disabledDate(value));
2387
+ }
2388
+ return value.length === 2 && value.every(validDate) && value[0].getTime() <= value[1].getTime() && (!this.disabledDate || value.every((date) => !this.disabledDate(date)));
2389
+ },
2400
2390
  handleClear() {
2401
2391
  this.minDate = null;
2402
2392
  this.maxDate = null;
@@ -1278,13 +1278,9 @@ const RANGE_PARSER = function(array, format, separator) {
1278
1278
  const TYPE_VALUE_RESOLVER_MAP = {
1279
1279
  default: {
1280
1280
  formatter(value) {
1281
- if (!value)
1282
- return "";
1283
1281
  return "" + value;
1284
1282
  },
1285
1283
  parser(text) {
1286
- if (text === void 0 || text === "")
1287
- return null;
1288
1284
  return text;
1289
1285
  }
1290
1286
  },
@@ -1347,8 +1343,6 @@ const TYPE_VALUE_RESOLVER_MAP = {
1347
1343
  },
1348
1344
  number: {
1349
1345
  formatter(value) {
1350
- if (!value)
1351
- return "";
1352
1346
  return "" + value;
1353
1347
  },
1354
1348
  parser(text) {
@@ -1553,10 +1547,7 @@ const _sfc_main$3 = {
1553
1547
  return reference.$el || reference;
1554
1548
  },
1555
1549
  refInput() {
1556
- if (this.reference) {
1557
- return [].slice.call(this.reference.querySelectorAll("input"));
1558
- }
1559
- return [];
1550
+ return [].slice.call(this.reference.querySelectorAll("input"));
1560
1551
  },
1561
1552
  valueIsEmpty() {
1562
1553
  const val = this.value;
@@ -1589,9 +1580,6 @@ const _sfc_main$3 = {
1589
1580
  return "day";
1590
1581
  },
1591
1582
  haveTrigger() {
1592
- if (typeof this.showTrigger !== "undefined") {
1593
- return this.showTrigger;
1594
- }
1595
1583
  return HAVE_TRIGGER_TYPES.indexOf(this.type) !== -1;
1596
1584
  },
1597
1585
  displayValue() {
@@ -1831,9 +1819,6 @@ const _sfc_main$3 = {
1831
1819
  event.stopPropagation();
1832
1820
  return;
1833
1821
  }
1834
- if (this.picker && this.picker.handleKeydown) {
1835
- this.picker.handleKeydown(event);
1836
- }
1837
1822
  },
1838
1823
  handleRangeClick() {
1839
1824
  const type = this.type;
@@ -1844,7 +1829,6 @@ const _sfc_main$3 = {
1844
1829
  },
1845
1830
  hidePicker() {
1846
1831
  if (this.picker) {
1847
- this.picker.resetView && this.picker.resetView();
1848
1832
  this.pickerVisible = this.picker.visible = false;
1849
1833
  this.destroyPopper();
1850
1834
  }
@@ -1858,10 +1842,6 @@ const _sfc_main$3 = {
1858
1842
  this.pickerVisible = this.picker.visible = true;
1859
1843
  this.updatePopper();
1860
1844
  this.picker.value = this.parsedValue;
1861
- this.picker.resetView && this.picker.resetView();
1862
- this.$nextTick(() => {
1863
- this.picker.adjustSpinners && this.picker.adjustSpinners();
1864
- });
1865
1845
  },
1866
1846
  mountPicker() {
1867
1847
  this.picker = new Vue(this.panel).$mount();
@@ -1901,13 +1881,11 @@ const _sfc_main$3 = {
1901
1881
  deep: true
1902
1882
  });
1903
1883
  this.$el.appendChild(this.picker.$el);
1904
- this.picker.resetView && this.picker.resetView();
1905
1884
  this.picker.$on("dodestroy", this.doDestroy);
1906
1885
  this.picker.$on("pick", (date = "", visible = false) => {
1907
1886
  this.userInput = null;
1908
1887
  this.pickerVisible = this.picker.visible = visible;
1909
1888
  this.emitInput(date);
1910
- this.picker.resetView && this.picker.resetView();
1911
1889
  });
1912
1890
  this.picker.$on("select-range", (start, end, pos) => {
1913
1891
  if (this.refInput.length === 0)
@@ -1952,11 +1930,7 @@ const _sfc_main$3 = {
1952
1930
  if (!this.picker) {
1953
1931
  this.mountPicker();
1954
1932
  }
1955
- if (this.picker.isValidValue) {
1956
- return value && this.picker.isValidValue(value);
1957
- } else {
1958
- return true;
1959
- }
1933
+ return this.picker.isValidValue(value);
1960
1934
  }
1961
1935
  }
1962
1936
  };
@@ -2138,6 +2112,12 @@ const _sfc_main$2 = {
2138
2112
  return Math.floor(this.date.getFullYear() / 12) * 12;
2139
2113
  }
2140
2114
  },
2115
+ data() {
2116
+ return {
2117
+ lastRow: null,
2118
+ lastColumn: null
2119
+ };
2120
+ },
2141
2121
  methods: {
2142
2122
  getCellStyle(year) {
2143
2123
  const style = {};
@@ -2178,6 +2158,8 @@ const _sfc_main$2 = {
2178
2158
  const year = Number(target.textContent || target.innerText);
2179
2159
  if (this.selectionMode === "range") {
2180
2160
  if (!this.rangeState.selecting) {
2161
+ this.lastRow = null;
2162
+ this.lastColumn = null;
2181
2163
  this.$emit("pick", {
2182
2164
  minDate: year,
2183
2165
  maxDate: null
@@ -2201,7 +2183,6 @@ const _sfc_main$2 = {
2201
2183
  } else {
2202
2184
  this.$emit("pick", year);
2203
2185
  }
2204
- this.handleMouseMove(event);
2205
2186
  },
2206
2187
  handleMouseMove(event) {
2207
2188
  let target = event.target;
@@ -2217,9 +2198,11 @@ const _sfc_main$2 = {
2217
2198
  return;
2218
2199
  const row = target.parentNode.rowIndex;
2219
2200
  const column = target.cellIndex;
2220
- if (hasClass(target.parentNode, "disabled"))
2201
+ if (hasClass(target, "disabled"))
2221
2202
  return;
2222
2203
  if (row !== this.lastRow || column !== this.lastColumn) {
2204
+ this.lastRow = row;
2205
+ this.lastColumn = column;
2223
2206
  this.$emit("changerange", {
2224
2207
  minDate: this.minDate,
2225
2208
  maxDate: this.maxDate,
@@ -2395,6 +2378,13 @@ const _sfc_main$1 = {
2395
2378
  }
2396
2379
  },
2397
2380
  methods: {
2381
+ isValidValue(value) {
2382
+ const validDate = (date) => date instanceof Date && !isNaN(date.getTime());
2383
+ if (!Array.isArray(value)) {
2384
+ return validDate(value) && (!this.disabledDate || !this.disabledDate(value));
2385
+ }
2386
+ return value.length === 2 && value.every(validDate) && value[0].getTime() <= value[1].getTime() && (!this.disabledDate || value.every((date) => !this.disabledDate(date)));
2387
+ },
2398
2388
  handleClear() {
2399
2389
  this.minDate = null;
2400
2390
  this.maxDate = null;
@@ -1,175 +1,175 @@
1
- declare var _default: import("vue").DefineComponent<{
2
- type: {
3
- type: StringConstructor;
4
- default: string;
5
- };
6
- timeArrowControl: BooleanConstructor;
7
- }, {}, {}, {}, {}, import("vue").DefineComponent<{
8
- size: {
9
- type: StringConstructor;
10
- default: undefined;
11
- };
12
- format: StringConstructor;
13
- valueFormat: StringConstructor;
14
- readonly: BooleanConstructor;
15
- placeholder: StringConstructor;
16
- startPlaceholder: {
17
- type: StringConstructor;
18
- default: undefined;
19
- };
20
- endPlaceholder: {
21
- type: StringConstructor;
22
- default: undefined;
23
- };
24
- prefixIcon: StringConstructor;
25
- clearIcon: {
26
- type: StringConstructor;
27
- default: string;
28
- };
29
- name: {
30
- default: string;
31
- validator: (val: any) => boolean;
32
- };
33
- disabled: BooleanConstructor;
34
- clearable: {
35
- type: BooleanConstructor;
36
- default: boolean;
37
- };
38
- id: {
39
- default: string;
40
- validator: (val: any) => boolean;
41
- };
42
- popperClass: StringConstructor;
43
- editable: {
44
- type: BooleanConstructor;
45
- default: boolean;
46
- };
47
- align: {
48
- type: StringConstructor;
49
- default: string;
50
- };
51
- value: {};
52
- defaultValue: {};
53
- defaultTime: {};
54
- rangeSeparator: {
55
- type: StringConstructor;
56
- default: string;
57
- };
58
- pickerOptions: {};
59
- unlinkPanels: BooleanConstructor;
60
- validateEvent: {
61
- type: BooleanConstructor;
62
- default: boolean;
63
- };
64
- }, {}, {
65
- pickerVisible: boolean;
66
- showClose: boolean;
67
- userInput: null;
68
- valueOnOpen: null;
69
- unwatchPickerOptions: null;
70
- }, {
71
- localeText(): {
72
- startPlaceholder: any;
73
- endPlaceholder: any;
74
- };
75
- ranged(): boolean;
76
- reference(): any;
77
- refInput(): never[];
78
- valueIsEmpty(): boolean;
79
- triggerClass(): any;
80
- selectionMode(): "year" | "month" | "week" | "dates" | "day";
81
- haveTrigger(): any;
82
- displayValue(): any;
83
- parsedValue(): any;
84
- _elFormItemSize(): any;
85
- pickerSize(): any;
86
- pickerDisabled(): any;
87
- firstInputId(): {
88
- id: any;
89
- };
90
- secondInputId(): {
91
- id: any;
92
- };
93
- }, {}, any, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
94
- size: {
95
- type: StringConstructor;
96
- default: undefined;
97
- };
98
- format: StringConstructor;
99
- valueFormat: StringConstructor;
100
- readonly: BooleanConstructor;
101
- placeholder: StringConstructor;
102
- startPlaceholder: {
103
- type: StringConstructor;
104
- default: undefined;
105
- };
106
- endPlaceholder: {
107
- type: StringConstructor;
108
- default: undefined;
109
- };
110
- prefixIcon: StringConstructor;
111
- clearIcon: {
112
- type: StringConstructor;
113
- default: string;
114
- };
115
- name: {
116
- default: string;
117
- validator: (val: any) => boolean;
118
- };
119
- disabled: BooleanConstructor;
120
- clearable: {
121
- type: BooleanConstructor;
122
- default: boolean;
123
- };
124
- id: {
125
- default: string;
126
- validator: (val: any) => boolean;
127
- };
128
- popperClass: StringConstructor;
129
- editable: {
130
- type: BooleanConstructor;
131
- default: boolean;
132
- };
133
- align: {
134
- type: StringConstructor;
135
- default: string;
136
- };
137
- value: {};
138
- defaultValue: {};
139
- defaultTime: {};
140
- rangeSeparator: {
141
- type: StringConstructor;
142
- default: string;
143
- };
144
- pickerOptions: {};
145
- unlinkPanels: BooleanConstructor;
146
- validateEvent: {
147
- type: BooleanConstructor;
148
- default: boolean;
149
- };
150
- }>>, {
151
- name: string;
152
- readonly: boolean;
153
- disabled: boolean;
154
- unlinkPanels: boolean;
155
- size: string;
156
- startPlaceholder: string;
157
- endPlaceholder: string;
158
- clearIcon: string;
159
- clearable: boolean;
160
- id: string;
161
- editable: boolean;
162
- align: string;
163
- rangeSeparator: string;
164
- validateEvent: boolean;
165
- }>, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
166
- type: {
167
- type: StringConstructor;
168
- default: string;
169
- };
170
- timeArrowControl: BooleanConstructor;
171
- }>>, {
172
- type: string;
173
- timeArrowControl: boolean;
174
- }>;
175
- export default _default;
1
+ declare var _default: import("vue").DefineComponent<{
2
+ type: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ timeArrowControl: BooleanConstructor;
7
+ }, {}, {}, {}, {}, import("vue").DefineComponent<{
8
+ size: {
9
+ type: StringConstructor;
10
+ default: undefined;
11
+ };
12
+ format: StringConstructor;
13
+ valueFormat: StringConstructor;
14
+ readonly: BooleanConstructor;
15
+ placeholder: StringConstructor;
16
+ startPlaceholder: {
17
+ type: StringConstructor;
18
+ default: undefined;
19
+ };
20
+ endPlaceholder: {
21
+ type: StringConstructor;
22
+ default: undefined;
23
+ };
24
+ prefixIcon: StringConstructor;
25
+ clearIcon: {
26
+ type: StringConstructor;
27
+ default: string;
28
+ };
29
+ name: {
30
+ default: string;
31
+ validator: (val: any) => boolean;
32
+ };
33
+ disabled: BooleanConstructor;
34
+ clearable: {
35
+ type: BooleanConstructor;
36
+ default: boolean;
37
+ };
38
+ id: {
39
+ default: string;
40
+ validator: (val: any) => boolean;
41
+ };
42
+ popperClass: StringConstructor;
43
+ editable: {
44
+ type: BooleanConstructor;
45
+ default: boolean;
46
+ };
47
+ align: {
48
+ type: StringConstructor;
49
+ default: string;
50
+ };
51
+ value: {};
52
+ defaultValue: {};
53
+ defaultTime: {};
54
+ rangeSeparator: {
55
+ type: StringConstructor;
56
+ default: string;
57
+ };
58
+ pickerOptions: {};
59
+ unlinkPanels: BooleanConstructor;
60
+ validateEvent: {
61
+ type: BooleanConstructor;
62
+ default: boolean;
63
+ };
64
+ }, {}, {
65
+ pickerVisible: boolean;
66
+ showClose: boolean;
67
+ userInput: null;
68
+ valueOnOpen: null;
69
+ unwatchPickerOptions: null;
70
+ }, {
71
+ localeText(): {
72
+ startPlaceholder: any;
73
+ endPlaceholder: any;
74
+ };
75
+ ranged(): boolean;
76
+ reference(): any;
77
+ refInput(): never[];
78
+ valueIsEmpty(): boolean;
79
+ triggerClass(): any;
80
+ selectionMode(): "week" | "month" | "year" | "dates" | "day";
81
+ haveTrigger(): boolean;
82
+ displayValue(): any;
83
+ parsedValue(): any;
84
+ _elFormItemSize(): any;
85
+ pickerSize(): any;
86
+ pickerDisabled(): any;
87
+ firstInputId(): {
88
+ id: any;
89
+ };
90
+ secondInputId(): {
91
+ id: any;
92
+ };
93
+ }, {}, any, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
94
+ size: {
95
+ type: StringConstructor;
96
+ default: undefined;
97
+ };
98
+ format: StringConstructor;
99
+ valueFormat: StringConstructor;
100
+ readonly: BooleanConstructor;
101
+ placeholder: StringConstructor;
102
+ startPlaceholder: {
103
+ type: StringConstructor;
104
+ default: undefined;
105
+ };
106
+ endPlaceholder: {
107
+ type: StringConstructor;
108
+ default: undefined;
109
+ };
110
+ prefixIcon: StringConstructor;
111
+ clearIcon: {
112
+ type: StringConstructor;
113
+ default: string;
114
+ };
115
+ name: {
116
+ default: string;
117
+ validator: (val: any) => boolean;
118
+ };
119
+ disabled: BooleanConstructor;
120
+ clearable: {
121
+ type: BooleanConstructor;
122
+ default: boolean;
123
+ };
124
+ id: {
125
+ default: string;
126
+ validator: (val: any) => boolean;
127
+ };
128
+ popperClass: StringConstructor;
129
+ editable: {
130
+ type: BooleanConstructor;
131
+ default: boolean;
132
+ };
133
+ align: {
134
+ type: StringConstructor;
135
+ default: string;
136
+ };
137
+ value: {};
138
+ defaultValue: {};
139
+ defaultTime: {};
140
+ rangeSeparator: {
141
+ type: StringConstructor;
142
+ default: string;
143
+ };
144
+ pickerOptions: {};
145
+ unlinkPanels: BooleanConstructor;
146
+ validateEvent: {
147
+ type: BooleanConstructor;
148
+ default: boolean;
149
+ };
150
+ }>>, {
151
+ name: string;
152
+ readonly: boolean;
153
+ disabled: boolean;
154
+ unlinkPanels: boolean;
155
+ size: string;
156
+ startPlaceholder: string;
157
+ endPlaceholder: string;
158
+ clearIcon: string;
159
+ clearable: boolean;
160
+ id: string;
161
+ editable: boolean;
162
+ align: string;
163
+ rangeSeparator: string;
164
+ validateEvent: boolean;
165
+ }>, import("vue/types/v3-component-options").ComponentOptionsMixin, {}, string, Readonly<import("vue").ExtractPropTypes<{
166
+ type: {
167
+ type: StringConstructor;
168
+ default: string;
169
+ };
170
+ timeArrowControl: BooleanConstructor;
171
+ }>>, {
172
+ type: string;
173
+ timeArrowControl: boolean;
174
+ }>;
175
+ export default _default;