@lvce-editor/text-search-view 1.12.2 → 1.13.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.
@@ -6791,9 +6791,11 @@ const getActionButtonVirtualDom = action => {
6791
6791
  label
6792
6792
  } = action;
6793
6793
  const className = getClassName(enabled);
6794
+ const disabled = !enabled;
6794
6795
  return [{
6795
6796
  childCount: 1,
6796
6797
  className,
6798
+ disabled,
6797
6799
  name: id,
6798
6800
  title: label,
6799
6801
  type: Button$2
@@ -6827,20 +6829,23 @@ const Refresh = 'Refresh';
6827
6829
 
6828
6830
  const getActions = state => {
6829
6831
  const {
6832
+ items,
6830
6833
  replacement,
6831
6834
  value
6832
6835
  } = state;
6833
- const bothEmpty = value === '' && replacement === '';
6836
+ const hasSearchPattern = value !== '';
6837
+ const hasSearchResults = items.length > 0;
6838
+ const canClear = hasSearchResults || hasSearchPattern || replacement !== '';
6834
6839
  return [{
6835
6840
  command: 'refresh',
6836
- enabled: true,
6841
+ enabled: hasSearchPattern,
6837
6842
  icon: Refresh,
6838
6843
  id: Refresh$1,
6839
6844
  label: refresh$1(),
6840
6845
  type: Button
6841
6846
  }, {
6842
6847
  command: 'clearSearchResults',
6843
- enabled: !bothEmpty,
6848
+ enabled: canClear,
6844
6849
  icon: ClearAll,
6845
6850
  id: ClearAll$1,
6846
6851
  label: clearSearchResults(),
@@ -6854,14 +6859,14 @@ const getActions = state => {
6854
6859
  type: Button
6855
6860
  }, {
6856
6861
  command: '',
6857
- enabled: true,
6862
+ enabled: hasSearchResults,
6858
6863
  icon: ListFlat,
6859
6864
  id: ViewAsTree,
6860
6865
  label: viewAsTree$1(),
6861
6866
  type: Button
6862
6867
  }, {
6863
6868
  command: '',
6864
- enabled: true,
6869
+ enabled: hasSearchResults,
6865
6870
  icon: CollapseAll,
6866
6871
  id: CollapseAll$1,
6867
6872
  label: collapseAll(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/text-search-view",
3
- "version": "1.12.2",
3
+ "version": "1.13.0",
4
4
  "description": "Text Search View",
5
5
  "keywords": [
6
6
  "text-search"