@vitrosoftware/common-ui-ts 1.1.203 → 1.1.205

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;
@@ -21818,7 +21828,7 @@ var TableViewServiceImpl = /*#__PURE__*/function () {
21818
21828
  return eventHandler.process.apply(eventHandler, params);
21819
21829
  }, eventHandler.id);
21820
21830
  };
21821
- _proto.addEventHandler = function addEventHandler(eventHandler) {
21831
+ _proto.addEventHandler = function addEventHandler(eventHandler, ident) {
21822
21832
  var grid = this;
21823
21833
  w$1.TGAddEvent(eventHandler.id, this.id, function () {
21824
21834
  for (var _len2 = arguments.length, params = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
@@ -21828,7 +21838,7 @@ var TableViewServiceImpl = /*#__PURE__*/function () {
21828
21838
  params[0] = grid;
21829
21839
  }
21830
21840
  return eventHandler.process.apply(eventHandler, params);
21831
- }, eventHandler.id);
21841
+ }, ident);
21832
21842
  };
21833
21843
  _proto.endEdit = function endEdit(success) {
21834
21844
  return this.grid.EndEdit(success ? 1 : 0);
@@ -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;
@@ -22242,11 +22262,11 @@ var TreeGrid = function TreeGrid(props) {
22242
22262
  if (props.onInit) {
22243
22263
  props.onInit(grid, next);
22244
22264
  }
22245
- var onDateSendEventHandler = {
22265
+ var onDataSendEventHandler = {
22246
22266
  id: EVENT$1.ON_DATA_SEND,
22247
22267
  process: onDataSendHandler
22248
22268
  };
22249
- grid.setEventHandler(onDateSendEventHandler);
22269
+ grid.addEventHandler(onDataSendEventHandler);
22250
22270
  };
22251
22271
  var onGridInit = function onGridInit(g) {
22252
22272
  g.scope = props.scope;
@@ -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
 
@@ -63140,7 +63164,7 @@ var Viewer = function Viewer(props) {
63140
63164
  };
63141
63165
 
63142
63166
  var name = "@vitrosoftware/common-ui-ts";
63143
- var version$1 = "1.1.203";
63167
+ var version$1 = "1.1.205";
63144
63168
  var description = "vitro software common ui ts";
63145
63169
  var author = "";
63146
63170
  var license = "MIT";
@@ -65131,6 +65155,23 @@ var DatePicker = React.forwardRef(function (props, ref) {
65131
65155
  props.onChange(value, props.name);
65132
65156
  }
65133
65157
  };
65158
+ var onPaste = function onPaste(e) {
65159
+ if (!props.isReadOnly && !props.isDisabled) {
65160
+ var text = e.clipboardData.getData('text');
65161
+ var prevValue = $$4(inputRef.current).data(componentName).value();
65162
+ if (text) {
65163
+ $$4(inputRef.current).data(componentName).value(text);
65164
+ var parsedValue = $$4(inputRef.current).data(componentName).value();
65165
+ if (parsedValue) {
65166
+ if (props.onChange) {
65167
+ props.onChange(parsedValue, props.name);
65168
+ }
65169
+ } else {
65170
+ $$4(inputRef.current).data(componentName).value(prevValue);
65171
+ }
65172
+ }
65173
+ }
65174
+ };
65134
65175
  var getClassName = function getClassName() {
65135
65176
  var classList = [styles$W['vitro-control'], props.className];
65136
65177
  if (props.isDisabled || props.isReadOnly) {
@@ -65154,7 +65195,8 @@ var DatePicker = React.forwardRef(function (props, ref) {
65154
65195
  ref: inputRef,
65155
65196
  placeholder: props.placeholder,
65156
65197
  onFocus: onFocus,
65157
- onBlur: onBlur
65198
+ onBlur: onBlur,
65199
+ onPaste: onPaste
65158
65200
  }), props.isReadOnly ? React__default.createElement(CopyButton, {
65159
65201
  className: styles$W['vitro-copy-button'],
65160
65202
  value: ((_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.toString()) || CTRL.EMPTY