@douyinfe/semi-foundation 2.9.0 → 2.9.1

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.
@@ -115,6 +115,7 @@
115
115
  }
116
116
  .semi-select-open:hover, .semi-select-focus:hover {
117
117
  background-color: var(--semi-color-fill-0);
118
+ border: 1px solid var(--semi-color-focus-border);
118
119
  }
119
120
  .semi-select-warning {
120
121
  background-color: var(--semi-color-warning-light-default);
@@ -54,9 +54,10 @@ $multiple: #{$module}-multiple;
54
54
 
55
55
  &:hover {
56
56
  background-color: $color-select-bg-default;
57
+ border: $border-thickness-control-focus solid $color-select_default-border-focus;
57
58
  }
58
59
  }
59
-
60
+
60
61
  &-warning {
61
62
  background-color: $color-select_warning-bg-default;
62
63
  border-color: $color-select_warning-border-default;
@@ -126,6 +126,10 @@ class TimePickerFoundation extends _foundation.default {
126
126
  parsedValues.push(this.isValidTimeZone() ? (0, _dateFnsExtra.utcToZonedTime)(pv, timeZone) : pv);
127
127
  }
128
128
  });
129
+ const isAM = [true, false];
130
+ (0, _map.default)(parsedValues).call(parsedValues, (item, idx) => {
131
+ isAM[idx] = (0, _dateFns.getHours)(item) < 12;
132
+ });
129
133
 
130
134
  if (parsedValues.length === value.length) {
131
135
  value = parsedValues;
@@ -144,6 +148,7 @@ class TimePickerFoundation extends _foundation.default {
144
148
  }
145
149
 
146
150
  this.setState({
151
+ isAM,
147
152
  value,
148
153
  inputValue,
149
154
  invalid
@@ -181,6 +186,12 @@ class TimePickerFoundation extends _foundation.default {
181
186
  isAM[index] = panelIsAM;
182
187
  const inputValue = this.formatValue(value);
183
188
 
189
+ if (this.getState('isAM')[index] !== result.isAM) {
190
+ this.setState({
191
+ isAM
192
+ });
193
+ }
194
+
184
195
  if (!this._isControlledComponent('value')) {
185
196
  const invalid = this.validateDates(value);
186
197
  this.setState({
@@ -88,4 +88,4 @@ $module-icon: #{$module}-icon-arrow;
88
88
  }
89
89
 
90
90
  @import './arrow.scss';
91
- @import './rtl.scss';
91
+ @import './rtl.scss';
@@ -115,6 +115,7 @@
115
115
  }
116
116
  .semi-select-open:hover, .semi-select-focus:hover {
117
117
  background-color: var(--semi-color-fill-0);
118
+ border: 1px solid var(--semi-color-focus-border);
118
119
  }
119
120
  .semi-select-warning {
120
121
  background-color: var(--semi-color-warning-light-default);
@@ -54,9 +54,10 @@ $multiple: #{$module}-multiple;
54
54
 
55
55
  &:hover {
56
56
  background-color: $color-select-bg-default;
57
+ border: $border-thickness-control-focus solid $color-select_default-border-focus;
57
58
  }
58
59
  }
59
-
60
+
60
61
  &-warning {
61
62
  background-color: $color-select_warning-bg-default;
62
63
  border-color: $color-select_warning-border-default;
@@ -10,7 +10,7 @@ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
10
10
  import { strings } from './constants';
11
11
  import BaseFoundation from '../base/foundation';
12
12
  import { formatToString, parseToDate, hourIsDisabled, minuteIsDisabled, secondIsDisabled, transformToArray, isTimeFormatLike } from './utils';
13
- import { isValid, format } from 'date-fns';
13
+ import { isValid, format, getHours } from 'date-fns';
14
14
  import { utcToZonedTime, zonedTimeToUtc } from '../utils/date-fns-extra';
15
15
  import isNullOrUndefined from '../utils/isNullOrUndefined'; // TODO: split, timePicker different components cannot share a foundation
16
16
 
@@ -102,6 +102,12 @@ class TimePickerFoundation extends BaseFoundation {
102
102
  }
103
103
  });
104
104
 
105
+ const isAM = [true, false];
106
+
107
+ _mapInstanceProperty(parsedValues).call(parsedValues, (item, idx) => {
108
+ isAM[idx] = getHours(item) < 12;
109
+ });
110
+
105
111
  if (parsedValues.length === value.length) {
106
112
  value = parsedValues;
107
113
  } else {
@@ -119,6 +125,7 @@ class TimePickerFoundation extends BaseFoundation {
119
125
  }
120
126
 
121
127
  this.setState({
128
+ isAM,
122
129
  value,
123
130
  inputValue,
124
131
  invalid
@@ -156,6 +163,12 @@ class TimePickerFoundation extends BaseFoundation {
156
163
  isAM[index] = panelIsAM;
157
164
  const inputValue = this.formatValue(value);
158
165
 
166
+ if (this.getState('isAM')[index] !== result.isAM) {
167
+ this.setState({
168
+ isAM
169
+ });
170
+ }
171
+
159
172
  if (!this._isControlledComponent('value')) {
160
173
  const invalid = this.validateDates(value);
161
174
  this.setState({
@@ -88,4 +88,4 @@ $module-icon: #{$module}-icon-arrow;
88
88
  }
89
89
 
90
90
  @import './arrow.scss';
91
- @import './rtl.scss';
91
+ @import './rtl.scss';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@douyinfe/semi-foundation",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "build:lib": "node ./scripts/compileLib.js",
@@ -8,7 +8,7 @@
8
8
  },
9
9
  "dependencies": {
10
10
  "@babel/runtime-corejs3": "^7.15.4",
11
- "@douyinfe/semi-animation": "2.9.0",
11
+ "@douyinfe/semi-animation": "2.9.1",
12
12
  "async-validator": "^3.5.0",
13
13
  "classnames": "^2.2.6",
14
14
  "date-fns": "^2.9.0",
@@ -24,7 +24,7 @@
24
24
  "*.scss",
25
25
  "*.css"
26
26
  ],
27
- "gitHead": "22b74e58077b068daa6b35bc8b32f47a064734a3",
27
+ "gitHead": "9593ab23b59b5a18305627ac402cfd4527072f9c",
28
28
  "devDependencies": {
29
29
  "@babel/plugin-proposal-decorators": "^7.15.8",
30
30
  "@babel/plugin-transform-runtime": "^7.15.8",
@@ -54,9 +54,10 @@ $multiple: #{$module}-multiple;
54
54
 
55
55
  &:hover {
56
56
  background-color: $color-select-bg-default;
57
+ border: $border-thickness-control-focus solid $color-select_default-border-focus;
57
58
  }
58
59
  }
59
-
60
+
60
61
  &-warning {
61
62
  background-color: $color-select_warning-bg-default;
62
63
  border-color: $color-select_warning-border-default;
@@ -11,7 +11,7 @@ import {
11
11
  isTimeFormatLike
12
12
  } from './utils';
13
13
  import { split } from 'lodash';
14
- import { isValid, format } from 'date-fns';
14
+ import { isValid, format, getHours } from 'date-fns';
15
15
  import { utcToZonedTime, zonedTimeToUtc } from '../utils/date-fns-extra';
16
16
  import isNullOrUndefined from '../utils/isNullOrUndefined';
17
17
 
@@ -125,6 +125,11 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
125
125
  }
126
126
  });
127
127
 
128
+ const isAM = [true, false];
129
+ parsedValues.map((item, idx)=>{
130
+ isAM[idx]= getHours(item) < 12;
131
+ });
132
+
128
133
  if (parsedValues.length === value.length) {
129
134
  value = parsedValues;
130
135
  } else {
@@ -142,6 +147,7 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
142
147
  }
143
148
 
144
149
  this.setState({
150
+ isAM,
145
151
  value,
146
152
  inputValue,
147
153
  invalid,
@@ -176,6 +182,9 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
176
182
  isAM[index] = panelIsAM;
177
183
  const inputValue = this.formatValue(value);
178
184
 
185
+ if (this.getState('isAM')[index] !== result.isAM){
186
+ this.setState({ isAM } as any);
187
+ }
179
188
  if (!this._isControlledComponent('value')) {
180
189
  const invalid = this.validateDates(value);
181
190
  this.setState({
@@ -307,7 +316,7 @@ class TimePickerFoundation<P = Record<string, any>, S = Record<string, any>> ext
307
316
 
308
317
  validateStr(inputValue = '') {
309
318
  const dates = this.parseInput(inputValue);
310
-
319
+
311
320
  return this.validateDates(dates);
312
321
  }
313
322
 
@@ -88,4 +88,4 @@ $module-icon: #{$module}-icon-arrow;
88
88
  }
89
89
 
90
90
  @import './arrow.scss';
91
- @import './rtl.scss';
91
+ @import './rtl.scss';