@vitrosoftware/common-ui-ts 1.1.202 → 1.1.204

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.
package/dist/index.js CHANGED
@@ -21340,6 +21340,7 @@ var EVENT$1;
21340
21340
  EVENT["ON_GET_TYPE"] = "OnGetType";
21341
21341
  EVENT["ON_BUTTON_CLICK"] = "OnButtonClick";
21342
21342
  EVENT["ON_AFTER_COL_RESIZE"] = "OnAfterColResize";
21343
+ EVENT["ON_EXPORT"] = "OnExport";
21343
21344
  })(EVENT$1 || (EVENT$1 = {}));
21344
21345
  var CFG_ATTRIBUTE;
21345
21346
  (function (CFG_ATTRIBUTE) {
@@ -21363,7 +21364,9 @@ var URL;
21363
21364
  URL["LAYOUT"] = "Layout";
21364
21365
  URL["DATA"] = "Data";
21365
21366
  URL["PAGE"] = "Page";
21367
+ URL["EXPORT"] = "Export";
21366
21368
  URL["TREEGRID_TEXT"] = "treegrid/Text_ru-RU.xml";
21369
+ URL["API"] = "/api";
21367
21370
  })(URL || (URL = {}));
21368
21371
  var CONTROLLER;
21369
21372
  (function (CONTROLLER) {
@@ -21580,6 +21583,11 @@ var GANTT_MENU_ACTION;
21580
21583
  GANTT_MENU_ACTION["DELETE_ALL_DEPENDENCIES"] = "DelAllGanttDep";
21581
21584
  GANTT_MENU_ACTION["CORRECT_RELATED_DEPENDENCIES"] = "CorrectRelatedDependencies";
21582
21585
  })(GANTT_MENU_ACTION || (GANTT_MENU_ACTION = {}));
21586
+ var GANTT_COLUMN_LIST = ['GanttStart', 'GanttEnd', 'GanttDescendants', 'GanttAncestors', 'GanttMinStart', 'GanttMaxEnd'];
21587
+ var XML_TAG;
21588
+ (function (XML_TAG) {
21589
+ XML_TAG["PAGE_SETTINGS"] = "B";
21590
+ })(XML_TAG || (XML_TAG = {}));
21583
21591
 
21584
21592
  var TableViewConstants = {
21585
21593
  __proto__: null,
@@ -21615,7 +21623,9 @@ var TableViewConstants = {
21615
21623
  get DEPENDENCY_TYPE () { return DEPENDENCY_TYPE; },
21616
21624
  get GANTT_OBJECT_NAME () { return GANTT_OBJECT_NAME; },
21617
21625
  get GANTT_UNITS () { return GANTT_UNITS; },
21618
- get GANTT_MENU_ACTION () { return GANTT_MENU_ACTION; }
21626
+ get GANTT_MENU_ACTION () { return GANTT_MENU_ACTION; },
21627
+ GANTT_COLUMN_LIST: GANTT_COLUMN_LIST,
21628
+ get XML_TAG () { return XML_TAG; }
21619
21629
  };
21620
21630
 
21621
21631
  var w$1 = window;
@@ -21857,6 +21867,9 @@ var TableViewServiceImpl = /*#__PURE__*/function () {
21857
21867
  _proto["export"] = function _export() {
21858
21868
  this.grid.ActionExport();
21859
21869
  };
21870
+ _proto.getExportUrl = function getExportUrl() {
21871
+ return this.grid.Data.Export.Url;
21872
+ };
21860
21873
  _proto.print = function print() {
21861
21874
  this.grid.ActionPrint();
21862
21875
  };
@@ -22017,6 +22030,65 @@ var TableViewServiceImpl = /*#__PURE__*/function () {
22017
22030
  _proto.expand = function expand(row) {
22018
22031
  this.grid.Expand(row);
22019
22032
  };
22033
+ _proto.getRequestDataXml = function getRequestDataXml(data) {
22034
+ var newData = data;
22035
+ if (this.isFilterOneLevel) {
22036
+ newData = this.setXmlPart(newData, 'FilterOneLevel="1"', XML_TAG.PAGE_SETTINGS);
22037
+ }
22038
+ if (this.filterContentTypeList) {
22039
+ var filterContentTypeListJson = JSON.stringify(this.filterContentTypeList);
22040
+ newData = this.setXmlPart(newData, "FilterContentTypeList='" + filterContentTypeListJson + "'", XML_TAG.PAGE_SETTINGS);
22041
+ }
22042
+ newData = this.setSearchCriterionLisXml(newData);
22043
+ newData = this.setVisibleColumnListXml(newData);
22044
+ return newData;
22045
+ };
22046
+ _proto.setXmlPart = function setXmlPart(xmlString, value, tag) {
22047
+ var startTag = "<" + tag + " ";
22048
+ if (xmlString.indexOf(startTag) === -1) {
22049
+ var configStartTag = '</Grid>';
22050
+ var insertIndex = xmlString.indexOf(configStartTag);
22051
+ var insertString = "<" + tag + " " + value + " />";
22052
+ if (xmlString.indexOf('<Body>') === -1) {
22053
+ insertString = "<Body>" + insertString + "</Body>";
22054
+ }
22055
+ xmlString = xmlString.slice(0, insertIndex) + insertString + xmlString.slice(insertIndex);
22056
+ } else {
22057
+ var _configStartTag = startTag;
22058
+ var _insertIndex = xmlString.indexOf(_configStartTag) + _configStartTag.length;
22059
+ xmlString = xmlString.slice(0, _insertIndex) + value + CTRL.SPACE + xmlString.slice(_insertIndex);
22060
+ }
22061
+ return xmlString;
22062
+ };
22063
+ _proto.setSearchCriterionLisXml = function setSearchCriterionLisXml(data) {
22064
+ var searchCriterionList = this.getSearchCriterionList();
22065
+ if (searchCriterionList && searchCriterionList.length) {
22066
+ var searchCriterionListJson = JSON.stringify(searchCriterionList);
22067
+ var value = "SearchCriterionList='" + searchCriterionListJson + "'";
22068
+ data = this.setXmlPart(data, value, XML_TAG.PAGE_SETTINGS);
22069
+ }
22070
+ return data;
22071
+ };
22072
+ _proto.setVisibleColumnListXml = function setVisibleColumnListXml(data) {
22073
+ var visibleColumnNameList = this.getCols(ATTRIBUTE.VISIBLE);
22074
+ if (visibleColumnNameList && visibleColumnNameList.length) {
22075
+ this.addGanttVisibleColumnList(visibleColumnNameList);
22076
+ var visibleColumnNameListJson = JSON.stringify(visibleColumnNameList);
22077
+ var value = "VisibleColumnList='" + visibleColumnNameListJson + "'";
22078
+ data = this.setXmlPart(data, value, XML_TAG.PAGE_SETTINGS);
22079
+ }
22080
+ return data;
22081
+ };
22082
+ _proto.addGanttVisibleColumnList = function addGanttVisibleColumnList(visibleColumnNameList) {
22083
+ if (this.ganttCol) {
22084
+ for (var _iterator = _createForOfIteratorHelperLoose(GANTT_COLUMN_LIST), _step; !(_step = _iterator()).done;) {
22085
+ var col = _step.value;
22086
+ if (this.ganttCol[col]) {
22087
+ visibleColumnNameList.push(this.ganttCol[col]);
22088
+ }
22089
+ }
22090
+ }
22091
+ };
22020
22092
  _createClass(TableViewServiceImpl, [{
22021
22093
  key: "columnList",
22022
22094
  get: function get() {
@@ -22160,60 +22232,8 @@ var TreeGrid = function TreeGrid(props) {
22160
22232
  }
22161
22233
  }
22162
22234
  };
22163
- var initData = function initData(data, value, tag) {
22164
- if (data.indexOf("<" + tag) === -1) {
22165
- var configStartTag = '</Grid>';
22166
- var insertIndex = data.indexOf(configStartTag);
22167
- data = data.slice(0, insertIndex) + ("<" + tag + ">" + value + "</" + tag + ">") + data.slice(insertIndex);
22168
- } else {
22169
- var _configStartTag = "<" + tag + " ";
22170
- var _insertIndex = data.indexOf(_configStartTag) + _configStartTag.length;
22171
- data = data.slice(0, _insertIndex) + value + CTRL.SPACE + data.slice(_insertIndex);
22172
- }
22173
- return data;
22174
- };
22175
22235
  var onDataSendHandler = function onDataSendHandler(tableView, source, data) {
22176
- var newData = data;
22177
- if (tableView.isFilterOneLevel) {
22178
- newData = initData(newData, 'FilterOneLevel="1"', 'B');
22179
- }
22180
- if (tableView.filterContentTypeList) {
22181
- var filterContentTypeListJson = JSON.stringify(tableView.filterContentTypeList);
22182
- newData = initData(newData, "FilterContentTypeList='" + filterContentTypeListJson + "'", 'B');
22183
- }
22184
- var searchCriterionList = tableView.getSearchCriterionList();
22185
- if (searchCriterionList && searchCriterionList.length) {
22186
- var searchCriterionListJson = JSON.stringify(searchCriterionList);
22187
- var value = "SearchCriterionList='" + searchCriterionListJson + "'";
22188
- newData = initData(newData, value, 'B');
22189
- }
22190
- var visibleColumnNameList = [];
22191
- var columnList = tableView.columnList;
22192
- for (var column in columnList) {
22193
- if (columnList.hasOwnProperty(column)) {
22194
- if (columnList[column] && columnList[column].Visible) {
22195
- visibleColumnNameList.push(column);
22196
- }
22197
- }
22198
- }
22199
- if (visibleColumnNameList && visibleColumnNameList.length) {
22200
- initGanttVisibleColumnList(tableView, visibleColumnNameList);
22201
- var visibleColumnNameListJson = JSON.stringify(visibleColumnNameList);
22202
- var _value = "VisibleColumnList='" + visibleColumnNameListJson + "'";
22203
- newData = initData(newData, _value, 'B');
22204
- }
22205
- return newData;
22206
- };
22207
- var initGanttVisibleColumnList = function initGanttVisibleColumnList(tableView, visibleColumnNameList) {
22208
- if (tableView.ganttCol) {
22209
- var ganttColumnList = ["GanttStart", "GanttEnd", "GanttDescendants", "GanttAncestors", "GanttMinStart", "GanttMaxEnd"];
22210
- for (var _i = 0, _ganttColumnList = ganttColumnList; _i < _ganttColumnList.length; _i++) {
22211
- var col = _ganttColumnList[_i];
22212
- if (tableView.ganttCol[col]) {
22213
- visibleColumnNameList.push(tableView.ganttCol[col]);
22214
- }
22215
- }
22216
- }
22236
+ return tableView.getRequestDataXml(data);
22217
22237
  };
22218
22238
  var onGridLoaded = function onGridLoaded(g, next) {
22219
22239
  g.IsReadOnly = props.isReadOnly;
@@ -22259,7 +22279,7 @@ var TreeGrid = function TreeGrid(props) {
22259
22279
  return props.createGridUrl(dataKey);
22260
22280
  } else {
22261
22281
  var controller = props.controller || CONTROLLER.REQUEST;
22262
- return '/api/' + controller + '/' + dataKey + '/' + props.listCode;
22282
+ return [URL.API, controller, dataKey, props.listCode].join(CTRL.SLASH);
22263
22283
  }
22264
22284
  };
22265
22285
  React.useEffect(function () {
@@ -22297,7 +22317,7 @@ var TreeGrid = function TreeGrid(props) {
22297
22317
  Debug: props.debug || CTRL.EMPTY,
22298
22318
  Cache: props.cache || CACHE.DEFAULT,
22299
22319
  CacheVersion: props.cacheVersion
22300
- }, "vitro-table-view" + props.id);
22320
+ }, 'vitro-table-view' + props.id);
22301
22321
  } else {
22302
22322
  w$2.TreeGrid({
22303
22323
  id: props.id,
@@ -22313,10 +22333,14 @@ var TreeGrid = function TreeGrid(props) {
22313
22333
  Text: {
22314
22334
  Url: props.textUrl || URL.TREEGRID_TEXT
22315
22335
  },
22336
+ Export: {
22337
+ Url: createGridUrl(URL.EXPORT),
22338
+ Type: 'Settings'
22339
+ },
22316
22340
  Debug: props.debug || CTRL.EMPTY,
22317
22341
  Cache: props.cache || CACHE.DEFAULT,
22318
22342
  CacheVersion: props.cacheVersion
22319
- }, "vitro-table-view" + props.id);
22343
+ }, 'vitro-table-view' + props.id);
22320
22344
  }
22321
22345
  }
22322
22346
  }, [props.id]);
@@ -22326,9 +22350,9 @@ var TreeGrid = function TreeGrid(props) {
22326
22350
  };
22327
22351
  }, []);
22328
22352
  return React__default.createElement("div", {
22329
- className: styles$5["vitro-table-view"] + (props.className ? CTRL.SPACE + props.className : CTRL.EMPTY)
22353
+ className: styles$5['vitro-table-view'] + (props.className ? CTRL.SPACE + props.className : CTRL.EMPTY)
22330
22354
  }, React__default.createElement("div", {
22331
- id: "vitro-table-view" + props.id
22355
+ id: 'vitro-table-view' + props.id
22332
22356
  }));
22333
22357
  };
22334
22358
 
@@ -61066,9 +61090,14 @@ var Button$2 = React.forwardRef(function (props, ref) {
61066
61090
  var _useState2 = React.useState(false),
61067
61091
  isHover = _useState2[0],
61068
61092
  setIsHover = _useState2[1];
61093
+ var innerRef = React.useRef(null);
61094
+ React.useImperativeHandle(ref, function () {
61095
+ return innerRef.current;
61096
+ });
61069
61097
  var createRipple = function createRipple(e) {
61098
+ var _innerRef$current;
61070
61099
  var button = e.currentTarget.firstElementChild;
61071
- if (button && !props.isDisabled) {
61100
+ if (button && !(innerRef !== null && innerRef !== void 0 && (_innerRef$current = innerRef.current) !== null && _innerRef$current !== void 0 && _innerRef$current.disabled)) {
61072
61101
  var circle = window.document.createElement(HTML_ELEMENT_SPAN);
61073
61102
  var diameter = Math.max(button.clientWidth, button.clientHeight);
61074
61103
  var radius = diameter / 2;
@@ -61084,8 +61113,8 @@ var Button$2 = React.forwardRef(function (props, ref) {
61084
61113
  }
61085
61114
  };
61086
61115
  var onClick = function onClick(e) {
61087
- var _ref$current;
61088
- if (!props.isDisabled && !(ref !== null && ref !== void 0 && (_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.disabled)) {
61116
+ var _innerRef$current2;
61117
+ if (!(innerRef !== null && innerRef !== void 0 && (_innerRef$current2 = innerRef.current) !== null && _innerRef$current2 !== void 0 && _innerRef$current2.disabled)) {
61089
61118
  if (props.onClick) {
61090
61119
  setPending(true);
61091
61120
  var promise = props.onClick(e);
@@ -61106,15 +61135,19 @@ var Button$2 = React.forwardRef(function (props, ref) {
61106
61135
  }
61107
61136
  }
61108
61137
  };
61138
+ React.useEffect(function () {
61139
+ if (innerRef.current) {
61140
+ innerRef.current.disabled = pending || (props.isDisabled ? true : false);
61141
+ }
61142
+ }, [pending, props.isDisabled]);
61109
61143
  return React__default.createElement("button", {
61110
- ref: ref,
61144
+ ref: innerRef,
61111
61145
  onMouseEnter: function onMouseEnter() {
61112
61146
  return setIsHover(true);
61113
61147
  },
61114
61148
  onMouseLeave: function onMouseLeave() {
61115
61149
  return setIsHover(false);
61116
61150
  },
61117
- disabled: pending || props.isDisabled,
61118
61151
  type: TYPE_BUTTON,
61119
61152
  className: styles$h['vitro-button'] + (props.className ? CTRL.SPACE + props.className : CTRL.EMPTY),
61120
61153
  title: CTRL.EMPTY,
@@ -63131,7 +63164,7 @@ var Viewer = function Viewer(props) {
63131
63164
  };
63132
63165
 
63133
63166
  var name = "@vitrosoftware/common-ui-ts";
63134
- var version$1 = "1.1.202";
63167
+ var version$1 = "1.1.204";
63135
63168
  var description = "vitro software common ui ts";
63136
63169
  var author = "";
63137
63170
  var license = "MIT";