ui.diagram.items.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /**
  2. * DevExtreme (ui/diagram/ui.diagram.items.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. function _typeof(obj) {
  11. "@babel/helpers - typeof";
  12. return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) {
  13. return typeof obj
  14. } : function(obj) {
  15. return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj
  16. }, _typeof(obj)
  17. }
  18. var _component = require("../../core/component");
  19. var _component2 = _interopRequireDefault(_component);
  20. var _data_helper = require("../../data_helper");
  21. var _data_helper2 = _interopRequireDefault(_data_helper);
  22. function _interopRequireDefault(obj) {
  23. return obj && obj.__esModule ? obj : {
  24. "default": obj
  25. }
  26. }
  27. function _classCallCheck(instance, Constructor) {
  28. if (!(instance instanceof Constructor)) {
  29. throw new TypeError("Cannot call a class as a function")
  30. }
  31. }
  32. function _defineProperties(target, props) {
  33. for (var i = 0; i < props.length; i++) {
  34. var descriptor = props[i];
  35. descriptor.enumerable = descriptor.enumerable || false;
  36. descriptor.configurable = true;
  37. if ("value" in descriptor) {
  38. descriptor.writable = true
  39. }
  40. Object.defineProperty(target, descriptor.key, descriptor)
  41. }
  42. }
  43. function _createClass(Constructor, protoProps, staticProps) {
  44. if (protoProps) {
  45. _defineProperties(Constructor.prototype, protoProps)
  46. }
  47. if (staticProps) {
  48. _defineProperties(Constructor, staticProps)
  49. }
  50. Object.defineProperty(Constructor, "prototype", {
  51. writable: false
  52. });
  53. return Constructor
  54. }
  55. function _inherits(subClass, superClass) {
  56. if ("function" !== typeof superClass && null !== superClass) {
  57. throw new TypeError("Super expression must either be null or a function")
  58. }
  59. subClass.prototype = Object.create(superClass && superClass.prototype, {
  60. constructor: {
  61. value: subClass,
  62. writable: true,
  63. configurable: true
  64. }
  65. });
  66. Object.defineProperty(subClass, "prototype", {
  67. writable: false
  68. });
  69. if (superClass) {
  70. _setPrototypeOf(subClass, superClass)
  71. }
  72. }
  73. function _setPrototypeOf(o, p) {
  74. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(o, p) {
  75. o.__proto__ = p;
  76. return o
  77. };
  78. return _setPrototypeOf(o, p)
  79. }
  80. function _createSuper(Derived) {
  81. var hasNativeReflectConstruct = _isNativeReflectConstruct();
  82. return function() {
  83. var result, Super = _getPrototypeOf(Derived);
  84. if (hasNativeReflectConstruct) {
  85. var NewTarget = _getPrototypeOf(this).constructor;
  86. result = Reflect.construct(Super, arguments, NewTarget)
  87. } else {
  88. result = Super.apply(this, arguments)
  89. }
  90. return _possibleConstructorReturn(this, result)
  91. }
  92. }
  93. function _possibleConstructorReturn(self, call) {
  94. if (call && ("object" === _typeof(call) || "function" === typeof call)) {
  95. return call
  96. } else {
  97. if (void 0 !== call) {
  98. throw new TypeError("Derived constructors may only return object or undefined")
  99. }
  100. }
  101. return _assertThisInitialized(self)
  102. }
  103. function _assertThisInitialized(self) {
  104. if (void 0 === self) {
  105. throw new ReferenceError("this hasn't been initialised - super() hasn't been called")
  106. }
  107. return self
  108. }
  109. function _isNativeReflectConstruct() {
  110. if ("undefined" === typeof Reflect || !Reflect.construct) {
  111. return false
  112. }
  113. if (Reflect.construct.sham) {
  114. return false
  115. }
  116. if ("function" === typeof Proxy) {
  117. return true
  118. }
  119. try {
  120. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
  121. return true
  122. } catch (e) {
  123. return false
  124. }
  125. }
  126. function _getPrototypeOf(o) {
  127. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(o) {
  128. return o.__proto__ || Object.getPrototypeOf(o)
  129. };
  130. return _getPrototypeOf(o)
  131. }
  132. var ItemsOption = function(_Component) {
  133. _inherits(ItemsOption, _Component);
  134. var _super = _createSuper(ItemsOption);
  135. function ItemsOption(diagramWidget) {
  136. var _this;
  137. _classCallCheck(this, ItemsOption);
  138. _this = _super.call(this);
  139. _this._diagramWidget = diagramWidget;
  140. return _this
  141. }
  142. _createClass(ItemsOption, [{
  143. key: "insert",
  144. value: function(data, callback) {
  145. this._dataSource.store().insert(data).done(function(data) {
  146. if (callback) {
  147. callback(data)
  148. }
  149. })
  150. }
  151. }, {
  152. key: "update",
  153. value: function(key, data, callback) {
  154. this._dataSource.store().update(key, data).done(function(data, key) {
  155. if (callback) {
  156. callback(key, data)
  157. }
  158. })
  159. }
  160. }, {
  161. key: "remove",
  162. value: function(key, callback) {
  163. this._dataSource.store().remove(key).done(function(key) {
  164. if (callback) {
  165. callback(key)
  166. }
  167. })
  168. }
  169. }]);
  170. return ItemsOption
  171. }(_component2.default);
  172. ItemsOption.include(_data_helper2.default);
  173. module.exports = ItemsOption;