@lobehub/ui 1.168.3 → 1.168.4

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.
@@ -9,6 +9,7 @@ export interface HotkeyInputProps {
9
9
  onChange?: (value: string) => void;
10
10
  onConflict?: (conflictKey: string) => void;
11
11
  placeholder?: string;
12
+ resetValue?: string;
12
13
  style?: CSSProperties;
13
14
  texts?: {
14
15
  conflicts?: string;
@@ -32,6 +32,7 @@ var HotkeyInput = /*#__PURE__*/memo(function (_ref) {
32
32
  value = _ref$value === void 0 ? '' : _ref$value,
33
33
  _ref$defaultValue = _ref.defaultValue,
34
34
  defaultValue = _ref$defaultValue === void 0 ? '' : _ref$defaultValue,
35
+ resetValue = _ref.resetValue,
35
36
  onChange = _ref.onChange,
36
37
  onConflict = _ref.onConflict,
37
38
  _ref$placeholder = _ref.placeholder,
@@ -79,6 +80,7 @@ var HotkeyInput = /*#__PURE__*/memo(function (_ref) {
79
80
  stop = _useRecordHotkeys2$.stop,
80
81
  isRecording = _useRecordHotkeys2$.isRecording,
81
82
  resetKeys = _useRecordHotkeys2$.resetKeys;
83
+ var oldValue = resetValue || defaultValue;
82
84
  useHotkeys('*', function () {
83
85
  var _inputRef$current;
84
86
  (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 || _inputRef$current.blur();
@@ -145,7 +147,9 @@ var HotkeyInput = /*#__PURE__*/memo(function (_ref) {
145
147
 
146
148
  // 检查快捷键冲突
147
149
  var checkHotkeyConflict = useCallback(function (newHotkey) {
148
- return hotkeyConflicts.some(function (conflictKey) {
150
+ return hotkeyConflicts.filter(function (conflictKey) {
151
+ return conflictKey !== oldValue;
152
+ }).some(function (conflictKey) {
149
153
  var newKeys = splitKeysByPlus(newHotkey);
150
154
  var conflictKeys = splitKeysByPlus(conflictKey);
151
155
  return isEqual(newKeys.sort(), conflictKeys.sort());
@@ -193,7 +197,7 @@ var HotkeyInput = /*#__PURE__*/memo(function (_ref) {
193
197
  var handleReset = function handleReset(e) {
194
198
  e.preventDefault();
195
199
  e.stopPropagation();
196
- onChange === null || onChange === void 0 || onChange(defaultValue);
200
+ onChange === null || onChange === void 0 || onChange(oldValue);
197
201
  resetKeys();
198
202
  setHasConflict(false);
199
203
  setHasInvalidCombination(false);
@@ -239,7 +243,7 @@ var HotkeyInput = /*#__PURE__*/memo(function (_ref) {
239
243
  style: {
240
244
  pointerEvents: 'none'
241
245
  }
242
- }), allowReset && value && value !== defaultValue && !disabled && /*#__PURE__*/_jsx(ActionIcon, {
246
+ }), allowReset && value && value !== oldValue && !disabled && /*#__PURE__*/_jsx(ActionIcon, {
243
247
  active: true,
244
248
  icon: Undo2Icon,
245
249
  onClick: handleReset,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.168.3",
3
+ "version": "1.168.4",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",