index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _exportNames = {
  6. use: true,
  7. config: true,
  8. t: true,
  9. _t: true,
  10. v: true,
  11. VXETable: true
  12. };
  13. exports.use = use;
  14. exports.t = t;
  15. exports._t = _t;
  16. exports.default = exports.VXETable = exports.v = exports.config = void 0;
  17. var _xeUtils = _interopRequireDefault(require("xe-utils"));
  18. var _conf = _interopRequireDefault(require("../v-x-e-table/src/conf"));
  19. var _interceptor = require("./src/interceptor");
  20. Object.keys(_interceptor).forEach(function (key) {
  21. if (key === "default" || key === "__esModule") return;
  22. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  23. if (key in exports && exports[key] === _interceptor[key]) return;
  24. Object.defineProperty(exports, key, {
  25. enumerable: true,
  26. get: function get() {
  27. return _interceptor[key];
  28. }
  29. });
  30. });
  31. var _renderer = require("./src/renderer");
  32. Object.keys(_renderer).forEach(function (key) {
  33. if (key === "default" || key === "__esModule") return;
  34. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  35. if (key in exports && exports[key] === _renderer[key]) return;
  36. Object.defineProperty(exports, key, {
  37. enumerable: true,
  38. get: function get() {
  39. return _renderer[key];
  40. }
  41. });
  42. });
  43. var _commands = require("./src/commands");
  44. Object.keys(_commands).forEach(function (key) {
  45. if (key === "default" || key === "__esModule") return;
  46. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  47. if (key in exports && exports[key] === _commands[key]) return;
  48. Object.defineProperty(exports, key, {
  49. enumerable: true,
  50. get: function get() {
  51. return _commands[key];
  52. }
  53. });
  54. });
  55. var _menus = require("./src/menus");
  56. Object.keys(_menus).forEach(function (key) {
  57. if (key === "default" || key === "__esModule") return;
  58. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  59. if (key in exports && exports[key] === _menus[key]) return;
  60. Object.defineProperty(exports, key, {
  61. enumerable: true,
  62. get: function get() {
  63. return _menus[key];
  64. }
  65. });
  66. });
  67. var _formats = require("./src/formats");
  68. Object.keys(_formats).forEach(function (key) {
  69. if (key === "default" || key === "__esModule") return;
  70. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  71. if (key in exports && exports[key] === _formats[key]) return;
  72. Object.defineProperty(exports, key, {
  73. enumerable: true,
  74. get: function get() {
  75. return _formats[key];
  76. }
  77. });
  78. });
  79. var _setup = require("./src/setup");
  80. Object.keys(_setup).forEach(function (key) {
  81. if (key === "default" || key === "__esModule") return;
  82. if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
  83. if (key in exports && exports[key] === _setup[key]) return;
  84. Object.defineProperty(exports, key, {
  85. enumerable: true,
  86. get: function get() {
  87. return _setup[key];
  88. }
  89. });
  90. });
  91. var _tools = require("../tools");
  92. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  93. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  94. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  95. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  96. var installedPlugins = [];
  97. function use(Plugin, options) {
  98. /* eslint-disable @typescript-eslint/no-use-before-define */
  99. if (Plugin && Plugin.install) {
  100. if (installedPlugins.indexOf(Plugin) === -1) {
  101. Plugin.install(VXETable, options);
  102. installedPlugins.push(Plugin);
  103. }
  104. }
  105. return VXETable;
  106. }
  107. /**
  108. * 检测模块的安装顺序是否正确
  109. */
  110. function reg(key) {
  111. /* eslint-disable @typescript-eslint/no-use-before-define */
  112. // 检测安装顺序是否正确
  113. if (process.env.NODE_ENV === 'development') {
  114. if (VXETable.Table) {
  115. _tools.UtilTools.error('vxe.error.useErr', [key]);
  116. }
  117. }
  118. VXETable["_".concat(key)] = 1;
  119. }
  120. function getExportOrImpotType(types, flag) {
  121. var rest = [];
  122. _xeUtils.default.objectEach(types, function (val, type) {
  123. if (val === 0 || val === flag) {
  124. rest.push(type);
  125. }
  126. });
  127. return rest;
  128. }
  129. var VXETableConfig = /*#__PURE__*/function () {
  130. function VXETableConfig() {
  131. _classCallCheck(this, VXETableConfig);
  132. }
  133. _createClass(VXETableConfig, [{
  134. key: "zIndex",
  135. get:
  136. /**
  137. * 获取当前的 zIndex
  138. */
  139. function get() {
  140. return _tools.UtilTools.getLastZIndex();
  141. }
  142. /**
  143. * 获取下一个 zIndex
  144. */
  145. }, {
  146. key: "nextZIndex",
  147. get: function get() {
  148. return _tools.UtilTools.nextZIndex();
  149. }
  150. /**
  151. * 获取所有导出类型
  152. */
  153. }, {
  154. key: "exportTypes",
  155. get: function get() {
  156. return getExportOrImpotType(_conf.default.export.types, 1);
  157. }
  158. /**
  159. * 获取所有导入类型
  160. */
  161. }, {
  162. key: "importTypes",
  163. get: function get() {
  164. return getExportOrImpotType(_conf.default.export.types, 2);
  165. }
  166. }]);
  167. return VXETableConfig;
  168. }();
  169. var config = new VXETableConfig();
  170. exports.config = config;
  171. function t(key, args) {
  172. return _conf.default.i18n(key, args);
  173. }
  174. function _t(key, args) {
  175. return key ? _xeUtils.default.toValueString(_conf.default.translate ? _conf.default.translate(key, args) : key) : '';
  176. }
  177. var v = 'v3';
  178. exports.v = v;
  179. var VXETable = {
  180. v: v,
  181. reg: reg,
  182. use: use,
  183. setup: _setup.setup,
  184. interceptor: _interceptor.interceptor,
  185. renderer: _renderer.renderer,
  186. commands: _commands.commands,
  187. formats: _formats.formats,
  188. menus: _menus.menus,
  189. config: config,
  190. t: t,
  191. _t: _t
  192. };
  193. exports.VXETable = VXETable;
  194. var _default = VXETable;
  195. exports.default = _default;