@vitrosoftware/common-ui-ts 1.1.54 → 1.1.56

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.
@@ -22,6 +22,5 @@ export interface TableViewProps {
22
22
  cacheVersion?: number | string;
23
23
  scope?: string;
24
24
  searchCriterionList?: SearchCriterion[];
25
- searchParentId?: string;
26
25
  readOnly?: boolean;
27
26
  }
@@ -16,8 +16,9 @@ export interface TableViewContext {
16
16
  dragging: boolean;
17
17
  filterOneLevel: boolean;
18
18
  scope: string;
19
- searchCriterionList: SearchCriterion[];
20
- parentId: string;
19
+ setSearchCriterionList(searchCriterionList: SearchCriterion[], searchId: string): void;
20
+ clearSearchCriterionList(searchId: string): void;
21
+ getSearchCriterionList(searchId?: string): SearchCriterion[];
21
22
  acceptChanges(row?: TableViewRow): void;
22
23
  hasGantt(): boolean;
23
24
  getRowById(id: string, attr?: string, nofixed?: boolean): TableViewRow;
@@ -11,8 +11,7 @@ export declare class TreeGridTableViewContextImpl implements TableViewContext {
11
11
  suggestValue: string;
12
12
  filterOneLevel: boolean;
13
13
  private readonly gridChangesFormat;
14
- searchCriterionList: SearchCriterion[];
15
- parentId: string;
14
+ private readonly searchCriterionMap;
16
15
  constructor(grid: any);
17
16
  get columnList(): any;
18
17
  get columnNameList(): any;
@@ -27,6 +26,9 @@ export declare class TreeGridTableViewContextImpl implements TableViewContext {
27
26
  set scope(value: string);
28
27
  get pageLength(): any;
29
28
  get header(): TableViewRow;
29
+ setSearchCriterionList(searchCriterionList: SearchCriterion[], searchId: string): void;
30
+ clearSearchCriterionList(searchId: string): void;
31
+ getSearchCriterionList(searchId?: string): SearchCriterion[];
30
32
  acceptChanges(row?: TableViewRow): void;
31
33
  addRow(parent: TableViewRow | null, next?: TableViewRow | null, show?: number, id?: string, def?: string): TableViewRow;
32
34
  addPage(name: string, xml: string | null, count: number): TableViewRow;
@@ -1,12 +1,13 @@
1
1
  /// <reference types="react" />
2
2
  import 'jstree';
3
3
  import { TreeViewContext } from './TreeViewContext';
4
- interface TreeViewProps {
4
+ export interface TreeViewProps {
5
5
  id: string;
6
6
  getData: (obj: any, cb: any) => any;
7
7
  onInit: (jsTreeView: TreeViewContext) => any;
8
8
  isCheckboxSelect?: boolean;
9
9
  isSaveCheckboxState?: boolean;
10
+ expandNodeIdList?: string[];
11
+ selectNodeId?: string;
10
12
  }
11
13
  export declare const TreeView: (props: TreeViewProps) => JSX.Element;
12
- export {};
@@ -1,6 +1,6 @@
1
1
  import { PLUGIN, CASCADE, NODE_TYPE } from './TreeViewConstants';
2
2
  export declare class TreeViewConfig {
3
- static getConfig(id: string, checkboxSelect?: boolean, saveChecked?: boolean): {
3
+ static getConfig(id: string, checkboxSelect?: boolean, saveChecked?: boolean, expandNodeIdList?: string[], selectNodeId?: string): {
4
4
  core: {
5
5
  check_callback: boolean;
6
6
  themes: {
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ import commonRu from './locale/common-ru.json';
4
4
  export { commonRu, commonEn };
5
5
  import { Breadcrumbs } from './controls/Breadcrumbs/Breadcrumbs';
6
6
  import { TopLevelMenu } from './controls/TopLevelMenu/TopLevelMenu';
7
- import { TreeView } from './controls/TreeView/TreeView';
7
+ import { TreeView, TreeViewProps } from './controls/TreeView/TreeView';
8
8
  import { TreeViewContext } from './controls/TreeView/TreeViewContext';
9
9
  import * as TREE_VIEW from './controls/TreeView/TreeViewConstants';
10
10
  import { TableView } from './controls/TableView/TableView';
@@ -73,7 +73,7 @@ import { Tooltip } from './controls/Tooltip/Tooltip';
73
73
  import * as TOOLTIP from './controls/Tooltip/TooltipConstants';
74
74
  export { Breadcrumbs };
75
75
  export { TopLevelMenu };
76
- export { TreeView, TreeViewContext, TREE_VIEW };
76
+ export { TreeView, TreeViewContext, TREE_VIEW, TreeViewProps };
77
77
  export { TableView, TableViewContext, TableViewRow, TableViewCol, TABLE_VIEW };
78
78
  export { MicroFrontend };
79
79
  export { TelerikUploader, TelerikUploaderContext, TelerikUploaderContextImpl, TelerikUploaderSettings };
package/dist/index.js CHANGED
@@ -20189,7 +20189,7 @@ var TreeViewConstants = {
20189
20189
 
20190
20190
  var TreeViewConfig = /*#__PURE__*/function () {
20191
20191
  function TreeViewConfig() {}
20192
- TreeViewConfig.getConfig = function getConfig(id, checkboxSelect, saveChecked) {
20192
+ TreeViewConfig.getConfig = function getConfig(id, checkboxSelect, saveChecked, expandNodeIdList, selectNodeId) {
20193
20193
  return {
20194
20194
  core: {
20195
20195
  check_callback: true,
@@ -20221,6 +20221,18 @@ var TreeViewConfig = /*#__PURE__*/function () {
20221
20221
  if (!saveChecked) {
20222
20222
  delete state.checkbox;
20223
20223
  }
20224
+ if (expandNodeIdList) {
20225
+ if (!state.core) {
20226
+ state.core = {};
20227
+ }
20228
+ state.core.open = expandNodeIdList;
20229
+ }
20230
+ if (selectNodeId) {
20231
+ if (!state.core) {
20232
+ state.core = {};
20233
+ }
20234
+ state.core.selected = [selectNodeId];
20235
+ }
20224
20236
  return state;
20225
20237
  }
20226
20238
  },
@@ -20355,7 +20367,7 @@ var TreeView = function TreeView(props) {
20355
20367
  jsTreeTreeView = _useState[0],
20356
20368
  setJsTreeTreeView = _useState[1];
20357
20369
  var jsTreeRef = React.useRef(null);
20358
- var config = TreeViewConfig.getConfig(props.id, props.isCheckboxSelect, props.isSaveCheckboxState);
20370
+ var config = TreeViewConfig.getConfig(props.id, props.isCheckboxSelect, props.isSaveCheckboxState, props.expandNodeIdList, props.selectNodeId);
20359
20371
  var jsTreeView;
20360
20372
  React.useEffect(function () {
20361
20373
  config.core.data = props.getData;
@@ -20503,12 +20515,45 @@ var TreeGridTableViewContextImpl = /*#__PURE__*/function () {
20503
20515
  this.suggestValue = '';
20504
20516
  this.filterOneLevel = false;
20505
20517
  this.gridChangesFormat = 'JSON';
20518
+ this.searchCriterionMap = new Map();
20506
20519
  this.grid = grid;
20507
20520
  this.id = grid.id;
20508
20521
  this.grid.Source.Upload.Format = this.gridChangesFormat;
20509
20522
  tableViewList.set(this.id, this);
20510
20523
  }
20511
20524
  var _proto = TreeGridTableViewContextImpl.prototype;
20525
+ _proto.setSearchCriterionList = function setSearchCriterionList(searchCriterionList, searchId) {
20526
+ if (searchCriterionList && searchCriterionList.length) {
20527
+ this.searchCriterionMap.set(searchId, [].concat(searchCriterionList));
20528
+ } else {
20529
+ this.clearSearchCriterionList(searchId);
20530
+ }
20531
+ };
20532
+ _proto.clearSearchCriterionList = function clearSearchCriterionList(searchId) {
20533
+ if (this.searchCriterionMap.has(searchId)) {
20534
+ this.searchCriterionMap["delete"](searchId);
20535
+ }
20536
+ };
20537
+ _proto.getSearchCriterionList = function getSearchCriterionList(searchId) {
20538
+ var result = [];
20539
+ if (searchId) {
20540
+ if (this.searchCriterionMap.has(searchId)) {
20541
+ var searchCriterionList = this.searchCriterionMap.get(searchId);
20542
+ if (searchCriterionList) {
20543
+ searchCriterionList.forEach(function (searchCriterion) {
20544
+ return result.push(searchCriterion);
20545
+ });
20546
+ }
20547
+ }
20548
+ } else {
20549
+ this.searchCriterionMap.forEach(function (searchCriterionList) {
20550
+ return searchCriterionList.forEach(function (searchCriterion) {
20551
+ return result.push(searchCriterion);
20552
+ });
20553
+ });
20554
+ }
20555
+ return result;
20556
+ };
20512
20557
  _proto.acceptChanges = function acceptChanges(row) {
20513
20558
  this.grid.AcceptChanges(row);
20514
20559
  };
@@ -20979,10 +21024,10 @@ var TreeGrid = function TreeGrid(props) {
20979
21024
  if (tableView.filterOneLevel) {
20980
21025
  newData = initData(newData, 'FilterOneLevel="1"');
20981
21026
  }
20982
- if (tableView.searchCriterionList && tableView.searchCriterionList.length && tableView.parentId) {
20983
- var searchCriterionList = JSON.stringify(tableView.searchCriterionList);
20984
- var parentId = tableView.parentId;
20985
- var value = "SearchCriterionList='" + searchCriterionList + "' ParentId=\"" + parentId + "\"";
21027
+ var searchCriterionList = tableView.getSearchCriterionList();
21028
+ if (searchCriterionList && searchCriterionList.length) {
21029
+ var searchCriterionListJson = JSON.stringify(searchCriterionList);
21030
+ var value = "SearchCriterionList='" + searchCriterionListJson + "'";
20986
21031
  newData = initData(data, value);
20987
21032
  }
20988
21033
  return newData;
@@ -20993,10 +21038,6 @@ var TreeGrid = function TreeGrid(props) {
20993
21038
  if (props.filterOneLevel) {
20994
21039
  grid.filterOneLevel = props.filterOneLevel;
20995
21040
  }
20996
- if (props.searchCriterionList && props.searchParentId) {
20997
- grid.searchCriterionList = props.searchCriterionList;
20998
- grid.parentId = props.searchParentId;
20999
- }
21000
21041
  if (props.eventHandlerList) {
21001
21042
  props.eventHandlerList.forEach(function (eventHandler) {
21002
21043
  grid.setEventHandler(eventHandler);