@vitrosoftware/common-ui-ts 1.1.53 → 1.1.55

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.
@@ -12,6 +12,7 @@ export interface TableViewProps {
12
12
  controller?: string | undefined;
13
13
  listCode?: string | undefined;
14
14
  eventHandlerList?: TableViewEventHandler[];
15
+ onCustomAjax?: (grid: any, source: any, data: string, func: (code: any, result: any) => any) => any;
15
16
  onInit?: ((grid: TableViewContext, next?: () => any) => any) | undefined;
16
17
  onSelect?: ((grid: TableViewContext, row: TableViewRow, deselect: boolean, columnList: string[], test: boolean) => any) | undefined;
17
18
  layout?: any;
@@ -21,6 +22,5 @@ export interface TableViewProps {
21
22
  cacheVersion?: number | string;
22
23
  scope?: string;
23
24
  searchCriterionList?: SearchCriterion[];
24
- searchParentId?: string;
25
25
  readOnly?: boolean;
26
26
  }
@@ -34,7 +34,9 @@ export declare enum EVENT {
34
34
  ON_SUGGEST = "OnSuggest",
35
35
  ON_VALUE_CHANGED = "OnValueChanged",
36
36
  ON_DRAG_OVER = "OnDragOver",
37
- ON_DROP = "OnDrop"
37
+ ON_DROP = "OnDrop",
38
+ ON_INIT = "OnInit",
39
+ ON_CUSTOM_AJAX = "OnCustomAjax"
38
40
  }
39
41
  export declare enum URL {
40
42
  LAYOUT = "Layout",
@@ -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;
package/dist/index.js CHANGED
@@ -20503,12 +20503,45 @@ var TreeGridTableViewContextImpl = /*#__PURE__*/function () {
20503
20503
  this.suggestValue = '';
20504
20504
  this.filterOneLevel = false;
20505
20505
  this.gridChangesFormat = 'JSON';
20506
+ this.searchCriterionMap = new Map();
20506
20507
  this.grid = grid;
20507
20508
  this.id = grid.id;
20508
20509
  this.grid.Source.Upload.Format = this.gridChangesFormat;
20509
20510
  tableViewList.set(this.id, this);
20510
20511
  }
20511
20512
  var _proto = TreeGridTableViewContextImpl.prototype;
20513
+ _proto.setSearchCriterionList = function setSearchCriterionList(searchCriterionList, searchId) {
20514
+ if (searchCriterionList && searchCriterionList.length) {
20515
+ this.searchCriterionMap.set(searchId, [].concat(searchCriterionList));
20516
+ } else {
20517
+ this.clearSearchCriterionList(searchId);
20518
+ }
20519
+ };
20520
+ _proto.clearSearchCriterionList = function clearSearchCriterionList(searchId) {
20521
+ if (this.searchCriterionMap.has(searchId)) {
20522
+ this.searchCriterionMap["delete"](searchId);
20523
+ }
20524
+ };
20525
+ _proto.getSearchCriterionList = function getSearchCriterionList(searchId) {
20526
+ var result = [];
20527
+ if (searchId) {
20528
+ if (this.searchCriterionMap.has(searchId)) {
20529
+ var searchCriterionList = this.searchCriterionMap.get(searchId);
20530
+ if (searchCriterionList) {
20531
+ searchCriterionList.forEach(function (searchCriterion) {
20532
+ return result.push(searchCriterion);
20533
+ });
20534
+ }
20535
+ }
20536
+ } else {
20537
+ this.searchCriterionMap.forEach(function (searchCriterionList) {
20538
+ return searchCriterionList.forEach(function (searchCriterion) {
20539
+ return result.push(searchCriterion);
20540
+ });
20541
+ });
20542
+ }
20543
+ return result;
20544
+ };
20512
20545
  _proto.acceptChanges = function acceptChanges(row) {
20513
20546
  this.grid.AcceptChanges(row);
20514
20547
  };
@@ -20790,6 +20823,8 @@ var EVENT$1;
20790
20823
  EVENT["ON_VALUE_CHANGED"] = "OnValueChanged";
20791
20824
  EVENT["ON_DRAG_OVER"] = "OnDragOver";
20792
20825
  EVENT["ON_DROP"] = "OnDrop";
20826
+ EVENT["ON_INIT"] = "OnInit";
20827
+ EVENT["ON_CUSTOM_AJAX"] = "OnCustomAjax";
20793
20828
  })(EVENT$1 || (EVENT$1 = {}));
20794
20829
  var URL;
20795
20830
  (function (URL) {
@@ -20977,10 +21012,10 @@ var TreeGrid = function TreeGrid(props) {
20977
21012
  if (tableView.filterOneLevel) {
20978
21013
  newData = initData(newData, 'FilterOneLevel="1"');
20979
21014
  }
20980
- if (tableView.searchCriterionList && tableView.searchCriterionList.length && tableView.parentId) {
20981
- var searchCriterionList = JSON.stringify(tableView.searchCriterionList);
20982
- var parentId = tableView.parentId;
20983
- var value = "SearchCriterionList='" + searchCriterionList + "' ParentId=\"" + parentId + "\"";
21015
+ var searchCriterionList = tableView.getSearchCriterionList();
21016
+ if (searchCriterionList && searchCriterionList.length) {
21017
+ var searchCriterionListJson = JSON.stringify(searchCriterionList);
21018
+ var value = "SearchCriterionList='" + searchCriterionListJson + "'";
20984
21019
  newData = initData(data, value);
20985
21020
  }
20986
21021
  return newData;
@@ -20991,10 +21026,6 @@ var TreeGrid = function TreeGrid(props) {
20991
21026
  if (props.filterOneLevel) {
20992
21027
  grid.filterOneLevel = props.filterOneLevel;
20993
21028
  }
20994
- if (props.searchCriterionList && props.searchParentId) {
20995
- grid.searchCriterionList = props.searchCriterionList;
20996
- grid.parentId = props.searchParentId;
20997
- }
20998
21029
  if (props.eventHandlerList) {
20999
21030
  props.eventHandlerList.forEach(function (eventHandler) {
21000
21031
  grid.setEventHandler(eventHandler);
@@ -21016,6 +21047,9 @@ var TreeGrid = function TreeGrid(props) {
21016
21047
  };
21017
21048
  grid.setEventHandler(onDateSendEventHandler);
21018
21049
  };
21050
+ var onGridInit = function onGridInit(g, reload) {
21051
+ g.scope = props.scope;
21052
+ };
21019
21053
  var createGridUrl = function createGridUrl(dataKey) {
21020
21054
  if (props.layout || props.data) {
21021
21055
  return null;
@@ -21032,6 +21066,15 @@ var TreeGrid = function TreeGrid(props) {
21032
21066
  w$2.TGSetEvent(EVENT$1.ON_LOADED, props.id, function (grid, next) {
21033
21067
  return onGridLoaded(grid, next);
21034
21068
  });
21069
+ w$2.TGSetEvent(EVENT$1.ON_INIT, props.id, function (grid, reload) {
21070
+ return onGridInit(grid);
21071
+ });
21072
+ if (props.onCustomAjax) {
21073
+ var onCustomAjax = props.onCustomAjax;
21074
+ w$2.TGSetEvent(EVENT$1.ON_CUSTOM_AJAX, props.id, function (grid, source, data, func) {
21075
+ return onCustomAjax(grid, source, data, func);
21076
+ });
21077
+ }
21035
21078
  if (props.layout || props.data) {
21036
21079
  w$2.TreeGrid({
21037
21080
  id: props.id,
@@ -21046,8 +21089,7 @@ var TreeGrid = function TreeGrid(props) {
21046
21089
  },
21047
21090
  Debug: props.debug || '',
21048
21091
  Cache: props.cache || CACHE.DEFAULT,
21049
- CacheVersion: props.cacheVersion,
21050
- scope: props.scope
21092
+ CacheVersion: props.cacheVersion
21051
21093
  }, "vitro-table-view" + props.id);
21052
21094
  } else {
21053
21095
  w$2.TreeGrid({
@@ -21066,8 +21108,7 @@ var TreeGrid = function TreeGrid(props) {
21066
21108
  },
21067
21109
  Debug: props.debug || '',
21068
21110
  Cache: props.cache || CACHE.DEFAULT,
21069
- CacheVersion: props.cacheVersion,
21070
- scope: props.scope
21111
+ CacheVersion: props.cacheVersion
21071
21112
  }, "vitro-table-view" + props.id);
21072
21113
  }
21073
21114
  return function () {