@lvce-editor/problems-view 1.6.0 → 1.8.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.
@@ -1050,14 +1050,19 @@ const create = (id, uri, x, y, width, height, args, parentUid) => {
1050
1050
  set(id, state, state);
1051
1051
  };
1052
1052
 
1053
+ const isEqual$1 = (oldState, newState) => {
1054
+ return newState.inputSource === User || oldState.filterValue === newState.filterValue;
1055
+ };
1056
+
1053
1057
  const isEqual = (oldState, newState) => {
1054
- return oldState.problems === newState.problems;
1058
+ return oldState.problems === newState.problems && oldState.filterValue === newState.filterValue;
1055
1059
  };
1056
1060
 
1057
1061
  const RenderItems = 1;
1062
+ const RenderFilterValue = 2;
1058
1063
 
1059
- const modules = [isEqual];
1060
- const numbers = [RenderItems];
1064
+ const modules = [isEqual, isEqual$1];
1065
+ const numbers = [RenderItems, RenderFilterValue];
1061
1066
 
1062
1067
  const diff = (oldState, newState) => {
1063
1068
  const diffResult = [];
@@ -1310,6 +1315,14 @@ const handleContextMenu = async (state, eventX, eventY) => {
1310
1315
  return state;
1311
1316
  };
1312
1317
 
1318
+ const handleFilterInput = (state, value, inputSource = Script) => {
1319
+ return {
1320
+ ...state,
1321
+ filterValue: value,
1322
+ inputSource
1323
+ };
1324
+ };
1325
+
1313
1326
  const handleIconThemeChange = state => {
1314
1327
  return {
1315
1328
  ...state,
@@ -1445,12 +1458,18 @@ const loadContent = async (state, savedState) => {
1445
1458
  };
1446
1459
  };
1447
1460
 
1461
+ const Filter$2 = 'filter';
1462
+
1463
+ const renderFilterValue = (oldState, newState) => {
1464
+ return ['Viewlet.setValueByName', Filter$2, newState.filterValue];
1465
+ };
1466
+
1448
1467
  const Button = 1;
1449
1468
  const ProblemsFilter = 4;
1450
1469
 
1451
1470
  const Chevron = 'Chevron';
1452
1471
  const FileIcon = 'FileIcon';
1453
- const Filter$2 = 'Filter';
1472
+ const Filter$1 = 'Filter';
1454
1473
  const FilterBadge = 'FilterBadge';
1455
1474
  const Highlight = 'Highlight';
1456
1475
  const IconButton = 'IconButton';
@@ -1520,8 +1539,6 @@ const getInputBoxVirtualDom = (name, onInput, placeholder) => {
1520
1539
  };
1521
1540
  };
1522
1541
 
1523
- const Filter$1 = 'filter';
1524
-
1525
1542
  const CollapseAll = 'CollapseAll';
1526
1543
  const Filter = 'Filter';
1527
1544
  const ListFlat = 'ListFlat';
@@ -1549,9 +1566,9 @@ const getBadgeDom = badgeText => {
1549
1566
  const getProblemsFilterVirtualDom = action => {
1550
1567
  return [{
1551
1568
  type: VirtualDomElements.Div,
1552
- className: Filter$2,
1569
+ className: Filter$1,
1553
1570
  childCount: getChildCount(action.badgeText)
1554
- }, getInputBoxVirtualDom(Filter$1, action.command, action.placeholder || ''), ...getBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
1571
+ }, getInputBoxVirtualDom(Filter$2, action.command, action.placeholder || ''), ...getBadgeDom(action.badgeText), ...getActionButtonVirtualDom({
1555
1572
  id: 'more filters',
1556
1573
  // TODO use i18n string
1557
1574
  icon: Filter,
@@ -1966,6 +1983,8 @@ const getRenderer = diffType => {
1966
1983
  switch (diffType) {
1967
1984
  case RenderItems:
1968
1985
  return renderItems;
1986
+ case RenderFilterValue:
1987
+ return renderFilterValue;
1969
1988
  default:
1970
1989
  throw new Error('unknown renderer');
1971
1990
  }
@@ -2011,9 +2030,19 @@ const getActionsVirtualDom = actions => {
2011
2030
  };
2012
2031
 
2013
2032
  const getActions = state => {
2014
- const visibleCount = getVisibleProblems(state.problems, state.collapsedUris, state.focusedIndex, state.filterValue).length;
2015
- const problemsCount = state.problems.length;
2016
- const isSmall = state.width <= state.smallWidthBreakPoint;
2033
+ const {
2034
+ problems,
2035
+ width,
2036
+ collapsedUris,
2037
+ focusedIndex,
2038
+ smallWidthBreakPoint,
2039
+ filterValue,
2040
+ inputSource,
2041
+ viewMode
2042
+ } = state;
2043
+ const visibleCount = getVisibleProblems(problems, collapsedUris, focusedIndex, filterValue).length;
2044
+ const problemsCount = problems.length;
2045
+ const isSmall = width <= smallWidthBreakPoint;
2017
2046
  const actions = [];
2018
2047
  if (!isSmall) {
2019
2048
  actions.push({
@@ -2022,10 +2051,10 @@ const getActions = state => {
2022
2051
  command: HandleFilterInput,
2023
2052
  badgeText: visibleCount === problemsCount ? '' : showingOf(visibleCount, problemsCount),
2024
2053
  placeholder: filter(),
2025
- value: state.inputSource === Script ? state.filterValue : ''
2054
+ value: inputSource === Script ? filterValue : ''
2026
2055
  });
2027
2056
  }
2028
- if (state.viewMode === Table) {
2057
+ if (viewMode === Table) {
2029
2058
  actions.push({
2030
2059
  type: Button,
2031
2060
  id: viewAsList$1(),
@@ -2067,10 +2096,14 @@ const renderEventListeners = () => {
2067
2096
  preventDefault: true
2068
2097
  }, {
2069
2098
  name: HandleFilterInput,
2070
- params: ['handleFilterInput', 'event.target.value']
2099
+ // @ts-ignore
2100
+ params: ['handleFilterInput', 'event.target.value', User]
2071
2101
  }, {
2072
2102
  name: HandleClearFilterClick,
2073
2103
  params: ['clearFilter']
2104
+ }, {
2105
+ name: HandlePointerDown,
2106
+ params: ['handleClickAt', 'event.clientX', 'event.clientY']
2074
2107
  }];
2075
2108
  };
2076
2109
 
@@ -2110,26 +2143,27 @@ const viewAsTable = state => {
2110
2143
 
2111
2144
  const commandMap = {
2112
2145
  'Problems.copyMessage': copyMessage,
2113
- 'Problems.renderEventListeners': renderEventListeners,
2114
2146
  'Problems.create': create,
2115
2147
  'Problems.diff2': diff2,
2116
2148
  'Problems.focusIndex': focusIndex,
2149
+ 'Problems.getCommandIds': getCommandIds,
2117
2150
  'Problems.getKeyBindings': getKeyBindings,
2118
2151
  'Problems.handleArrowLeft': wrapCommand(handleArrowLeft),
2119
2152
  'Problems.handleArrowRight': wrapCommand(handleArrowRight),
2153
+ 'Problems.handleClickAt': wrapCommand(handleClickAt),
2154
+ 'Problems.handleContextMenu': handleContextMenu,
2155
+ 'Problems.handleFilterInput': wrapCommand(handleFilterInput),
2156
+ 'Problems.handleIconThemeChange': handleIconThemeChange,
2120
2157
  'Problems.initialize': initialize,
2121
2158
  'Problems.loadContent': wrapCommand(loadContent),
2122
2159
  'Problems.render2': render2,
2123
2160
  'Problems.renderActions': renderActions,
2161
+ 'Problems.renderEventListeners': renderEventListeners,
2124
2162
  'Problems.resize': resize,
2125
2163
  'Problems.saveState': saveState,
2126
2164
  'Problems.terminate': terminate,
2127
- 'Problems.handleIconThemeChange': handleIconThemeChange,
2128
- 'Problems.handleContextMenu': handleContextMenu,
2129
- 'Problems.viewAsTable': viewAsTable,
2130
2165
  'Problems.viewAsList': viewAsList,
2131
- 'Problems.handleClickAt': wrapCommand(handleClickAt),
2132
- 'Problems.getCommandIds': getCommandIds
2166
+ 'Problems.viewAsTable': viewAsTable
2133
2167
  };
2134
2168
 
2135
2169
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/problems-view",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "Problems View Worker",
5
5
  "repository": {
6
6
  "type": "git",