index.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. import { VxeUI } from '@vxe-ui/core';
  2. import { getFuncText } from './src/utils';
  3. export const version = "3.19.1";
  4. VxeUI.version = version;
  5. VxeUI.tableVersion = version;
  6. VxeUI.setConfig({
  7. emptyCell: ' ',
  8. table: {
  9. fit: true,
  10. showHeader: true,
  11. animat: true,
  12. delayHover: 250,
  13. autoResize: true,
  14. padding: true,
  15. minHeight: 144,
  16. // keepSource: false,
  17. // showOverflow: null,
  18. // showHeaderOverflow: null,
  19. // showFooterOverflow: null,
  20. // resizeInterval: 500,
  21. // size: null,
  22. // zIndex: null,
  23. // stripe: false,
  24. // border: false,
  25. // round: false,
  26. // emptyText: '暂无数据',
  27. // emptyRender: {
  28. // name: ''
  29. // },
  30. // rowConfig: {
  31. // keyField: '_X_ROW_KEY' // 行数据的唯一主键字段名
  32. // },
  33. resizeConfig: {
  34. // refreshDelay: 20
  35. },
  36. resizableConfig: {
  37. dragMode: 'auto',
  38. showDragTip: true,
  39. isSyncAutoHeight: true,
  40. isSyncAutoWidth: true,
  41. minHeight: 18
  42. },
  43. radioConfig: {
  44. // trigger: 'default'
  45. strict: true
  46. },
  47. rowDragConfig: {
  48. showIcon: true,
  49. animation: true,
  50. showGuidesStatus: true,
  51. showDragTip: true
  52. },
  53. columnDragConfig: {
  54. showIcon: true,
  55. animation: true,
  56. showGuidesStatus: true,
  57. showDragTip: true
  58. },
  59. checkboxConfig: {
  60. // trigger: 'default',
  61. strict: true
  62. },
  63. tooltipConfig: {
  64. enterable: true
  65. },
  66. headerTooltipConfig: {
  67. enterable: true
  68. },
  69. footerTooltipConfig: {
  70. enterable: true
  71. },
  72. validConfig: {
  73. showMessage: true,
  74. autoClear: true,
  75. autoPos: true,
  76. message: 'inline',
  77. msgMode: 'single',
  78. theme: 'beautify'
  79. },
  80. columnConfig: {
  81. autoOptions: {
  82. isCalcHeader: true,
  83. isCalcBody: true,
  84. isCalcFooter: true
  85. },
  86. maxFixedSize: 4
  87. },
  88. cellConfig: {
  89. padding: true
  90. },
  91. headerCellConfig: {
  92. height: 'unset'
  93. },
  94. footerCellConfig: {
  95. height: 'unset'
  96. },
  97. menuConfig: {
  98. // visibleMethod () {},
  99. // transfer: false,
  100. destroyOnClose: true
  101. },
  102. customConfig: {
  103. // enabled: false,
  104. allowVisible: true,
  105. allowResizable: true,
  106. allowFixed: true,
  107. allowSort: true,
  108. showFooter: true,
  109. placement: 'top-right',
  110. // storage: false,
  111. storeOptions: {
  112. visible: true,
  113. resizable: true,
  114. sort: true,
  115. fixed: true
  116. // rowGroup: false,
  117. // aggFunc: false
  118. },
  119. // autoAggGroupValues: false,
  120. // checkMethod () {},
  121. modalOptions: {
  122. showMaximize: true,
  123. mask: true,
  124. lockView: true,
  125. resize: true,
  126. escClosable: true
  127. },
  128. drawerOptions: {
  129. mask: true,
  130. lockView: true,
  131. escClosable: true,
  132. resize: true
  133. }
  134. },
  135. sortConfig: {
  136. // remote: false,
  137. // trigger: 'default',
  138. // orders: ['asc', 'desc', null],
  139. // sortMethod: null,
  140. showIcon: true,
  141. allowClear: true,
  142. allowBtn: true,
  143. iconLayout: 'vertical'
  144. },
  145. filterConfig: {
  146. // remote: false,
  147. // filterMethod: null,
  148. // isEvery: false,
  149. // transfer: false,
  150. destroyOnClose: true,
  151. multiple: true,
  152. showIcon: true
  153. },
  154. floatingFilterConfig: {
  155. // enabled: false
  156. },
  157. aggregateConfig: {
  158. padding: true,
  159. rowField: 'id',
  160. parentField: '_X_ROW_PARENT_KEY',
  161. childrenField: '_X_ROW_CHILDREN',
  162. mapChildrenField: '_X_ROW_CHILD_LIST',
  163. indent: 20,
  164. showIcon: true,
  165. maxGroupSize: 4,
  166. showAggFuncTitle: true
  167. },
  168. treeConfig: {
  169. padding: true,
  170. rowField: 'id',
  171. parentField: 'parentId',
  172. childrenField: 'children',
  173. hasChildField: 'hasChild',
  174. mapChildrenField: '_X_ROW_CHILD',
  175. indent: 20,
  176. showIcon: true
  177. },
  178. expandConfig: {
  179. // trigger: 'default',
  180. showIcon: true,
  181. mode: 'fixed'
  182. },
  183. editConfig: {
  184. // mode: 'cell',
  185. showIcon: true,
  186. showAsterisk: true,
  187. autoFocus: true
  188. },
  189. importConfig: {
  190. _typeMaps: {
  191. csv: 1,
  192. html: 1,
  193. xml: 1,
  194. txt: 1
  195. }
  196. },
  197. exportConfig: {
  198. _typeMaps: {
  199. csv: 1,
  200. html: 1,
  201. xml: 1,
  202. txt: 1
  203. }
  204. },
  205. printConfig: {},
  206. mouseConfig: {
  207. extension: true
  208. },
  209. keyboardConfig: {
  210. isAll: true,
  211. isEsc: true
  212. },
  213. areaConfig: {
  214. autoClear: true,
  215. selectCellByHeader: true,
  216. selectCellByBody: true,
  217. extendDirection: {
  218. top: true,
  219. left: true,
  220. bottom: true,
  221. right: true
  222. }
  223. },
  224. clipConfig: {
  225. isCopy: true,
  226. isCut: true,
  227. isPaste: true
  228. },
  229. fnrConfig: {
  230. isFind: true,
  231. isReplace: true
  232. },
  233. virtualXConfig: {
  234. // enabled: false,
  235. gt: 24,
  236. preSize: 0,
  237. oSize: 0
  238. },
  239. virtualYConfig: {
  240. // enabled: false,
  241. // mode: 'wheel',
  242. gt: 100,
  243. preSize: 1,
  244. oSize: 0
  245. },
  246. scrollbarConfig: {
  247. // width: 14,
  248. // height: 14,
  249. x: {
  250. // position: 'bottom',
  251. visible: true
  252. },
  253. y: {
  254. // position: 'right',
  255. visible: true
  256. }
  257. }
  258. },
  259. grid: {
  260. // size: null,
  261. // zoomConfig: {
  262. // escRestore: true
  263. // },
  264. formConfig: {
  265. enabled: true
  266. },
  267. pagerConfig: {
  268. enabled: true
  269. // perfect: false
  270. },
  271. toolbarConfig: {
  272. enabled: true
  273. // perfect: false
  274. },
  275. proxyConfig: {
  276. enabled: true,
  277. autoLoad: true,
  278. showLoading: true,
  279. showResponseMsg: true,
  280. showActionMsg: true,
  281. response: {
  282. list: null,
  283. result: 'result',
  284. total: 'page.total',
  285. message: 'message'
  286. }
  287. // beforeItem: null,
  288. // beforeColumn: null,
  289. // beforeQuery: null,
  290. // afterQuery: null,
  291. // beforeDelete: null,
  292. // afterDelete: null,
  293. // beforeSave: null,
  294. // afterSave: null
  295. }
  296. },
  297. toolbar: {
  298. // size: null,
  299. // import: {
  300. // mode: 'covering'
  301. // },
  302. // export: {
  303. // types: ['csv', 'html', 'xml', 'txt']
  304. // },
  305. // buttons: []
  306. },
  307. gantt: {}
  308. });
  309. const iconPrefix = 'vxe-table-icon-';
  310. VxeUI.setIcon({
  311. // table
  312. TABLE_SORT_ASC: iconPrefix + 'caret-up',
  313. TABLE_SORT_DESC: iconPrefix + 'caret-down',
  314. TABLE_FILTER_NONE: iconPrefix + 'funnel',
  315. TABLE_FILTER_MATCH: iconPrefix + 'funnel',
  316. TABLE_EDIT: iconPrefix + 'edit',
  317. TABLE_TITLE_PREFIX: iconPrefix + 'question-circle-fill',
  318. TABLE_TITLE_SUFFIX: iconPrefix + 'question-circle-fill',
  319. TABLE_TREE_LOADED: iconPrefix + 'spinner roll',
  320. TABLE_TREE_OPEN: iconPrefix + 'caret-right rotate90',
  321. TABLE_TREE_CLOSE: iconPrefix + 'caret-right',
  322. TABLE_EXPAND_LOADED: iconPrefix + 'spinner roll',
  323. TABLE_EXPAND_OPEN: iconPrefix + 'arrow-right rotate90',
  324. TABLE_EXPAND_CLOSE: iconPrefix + 'arrow-right',
  325. TABLE_CHECKBOX_CHECKED: iconPrefix + 'checkbox-checked-fill',
  326. TABLE_CHECKBOX_UNCHECKED: iconPrefix + 'checkbox-unchecked',
  327. TABLE_CHECKBOX_INDETERMINATE: iconPrefix + 'checkbox-indeterminate-fill',
  328. TABLE_CHECKBOX_DISABLED_UNCHECKED: iconPrefix + 'checkbox-unchecked-fill',
  329. TABLE_RADIO_CHECKED: iconPrefix + 'radio-checked-fill',
  330. TABLE_RADIO_UNCHECKED: iconPrefix + 'radio-unchecked',
  331. TABLE_RADIO_DISABLED_UNCHECKED: iconPrefix + 'radio-unchecked-fill',
  332. TABLE_CUSTOM_SORT: iconPrefix + 'drag-handle',
  333. TABLE_MENU_OPTIONS: iconPrefix + 'arrow-right',
  334. TABLE_DRAG_ROW: iconPrefix + 'drag-handle',
  335. TABLE_DRAG_COLUMN: iconPrefix + 'drag-handle',
  336. TABLE_DRAG_STATUS_ROW: iconPrefix + 'sort',
  337. TABLE_DRAG_STATUS_SUB_ROW: iconPrefix + 'add-sub',
  338. TABLE_DRAG_STATUS_AGG_GROUP: iconPrefix + 'grouping',
  339. TABLE_DRAG_STATUS_AGG_VALUES: iconPrefix + 'values',
  340. TABLE_DRAG_STATUS_COLUMN: iconPrefix + 'swap',
  341. TABLE_DRAG_DISABLED: iconPrefix + 'no-drop',
  342. TABLE_ROW_GROUP_OPEN: iconPrefix + 'arrow-right rotate90',
  343. TABLE_ROW_GROUP_CLOSE: iconPrefix + 'arrow-right',
  344. TABLE_AGGREGATE_GROUPING: iconPrefix + 'grouping',
  345. TABLE_AGGREGATE_VALUES: iconPrefix + 'values',
  346. TABLE_AGGREGATE_SORT: iconPrefix + 'drag-handle',
  347. TABLE_AGGREGATE_DELETE: iconPrefix + 'close',
  348. // toolbar
  349. TOOLBAR_TOOLS_REFRESH: iconPrefix + 'repeat',
  350. TOOLBAR_TOOLS_REFRESH_LOADING: iconPrefix + 'repeat roll',
  351. TOOLBAR_TOOLS_IMPORT: iconPrefix + 'upload',
  352. TOOLBAR_TOOLS_EXPORT: iconPrefix + 'download',
  353. TOOLBAR_TOOLS_PRINT: iconPrefix + 'print',
  354. TOOLBAR_TOOLS_FULLSCREEN: iconPrefix + 'fullscreen',
  355. TOOLBAR_TOOLS_MINIMIZE: iconPrefix + 'minimize',
  356. TOOLBAR_TOOLS_CUSTOM: iconPrefix + 'custom-column',
  357. TOOLBAR_TOOLS_FIXED_LEFT: iconPrefix + 'fixed-left',
  358. TOOLBAR_TOOLS_FIXED_LEFT_ACTIVE: iconPrefix + 'fixed-left-fill',
  359. TOOLBAR_TOOLS_FIXED_RIGHT: iconPrefix + 'fixed-right',
  360. TOOLBAR_TOOLS_FIXED_RIGHT_ACTIVE: iconPrefix + 'fixed-right-fill'
  361. });
  362. export const setTheme = VxeUI.setTheme;
  363. export const getTheme = VxeUI.getTheme;
  364. export const setConfig = VxeUI.setConfig;
  365. export const getConfig = VxeUI.getConfig;
  366. export const setIcon = VxeUI.setIcon;
  367. export const getIcon = VxeUI.getIcon;
  368. export const setLanguage = VxeUI.setLanguage;
  369. export const setI18n = VxeUI.setI18n;
  370. export const getI18n = VxeUI.getI18n;
  371. export const globalEvents = VxeUI.globalEvents;
  372. export const globalResize = VxeUI.globalResize;
  373. export const renderer = VxeUI.renderer;
  374. export const validators = VxeUI.validators;
  375. export const menus = VxeUI.menus;
  376. export const formats = VxeUI.formats;
  377. export const commands = VxeUI.commands;
  378. export const interceptor = VxeUI.interceptor;
  379. export const clipboard = VxeUI.clipboard;
  380. export const log = VxeUI.log;
  381. export const use = VxeUI.use;
  382. /**
  383. * 已废弃
  384. * @deprecated
  385. */
  386. export const setup = (options) => {
  387. return VxeUI.setConfig(options);
  388. };
  389. VxeUI.setup = setup;
  390. /**
  391. * 已废弃
  392. * @deprecated
  393. */
  394. export const config = (options) => {
  395. return VxeUI.setConfig(options);
  396. };
  397. VxeUI.config = config;
  398. /**
  399. * 已废弃
  400. * @deprecated
  401. */
  402. export const t = (key, args) => {
  403. return VxeUI.getI18n(key, args);
  404. };
  405. VxeUI.t = t;
  406. /**
  407. * 已废弃
  408. * @deprecated
  409. */
  410. export const _t = (content, args) => {
  411. return getFuncText(content, args);
  412. };
  413. VxeUI._t = _t;
  414. /**
  415. * 已废弃,兼容老版本
  416. * @deprecated
  417. */
  418. export const VXETable = VxeUI;
  419. /**
  420. * 已废弃,兼容老版本
  421. * @deprecated
  422. */
  423. export const saveFile = (options) => {
  424. return VxeUI.saveFile(options);
  425. };
  426. /**
  427. * 已废弃,兼容老版本
  428. * @deprecated
  429. */
  430. export const readFile = (options) => {
  431. return VxeUI.readFile(options);
  432. };
  433. /**
  434. * 已废弃,兼容老版本
  435. * @deprecated
  436. */
  437. export const print = (options) => {
  438. return VxeUI.print(options);
  439. };
  440. /**
  441. * 已废弃,兼容老版本
  442. * @deprecated
  443. */
  444. export const modal = {
  445. /**
  446. * 已废弃,兼容老版本
  447. * @deprecated
  448. */
  449. get(id) {
  450. return VxeUI.modal.get(id);
  451. },
  452. /**
  453. * 已废弃,兼容老版本
  454. * @deprecated
  455. */
  456. close(id) {
  457. return VxeUI.modal.close(id);
  458. },
  459. /**
  460. * 已废弃,兼容老版本
  461. * @deprecated
  462. */
  463. open(options) {
  464. return VxeUI.modal.open(options);
  465. },
  466. /**
  467. * 已废弃,兼容老版本
  468. * @deprecated
  469. */
  470. alert(content, title, options) {
  471. return VxeUI.modal.alert(content, title, options);
  472. },
  473. /**
  474. * 已废弃,兼容老版本
  475. * @deprecated
  476. */
  477. confirm(content, title, options) {
  478. return VxeUI.modal.confirm(content, title, options);
  479. },
  480. /**
  481. * 已废弃,兼容老版本
  482. * @deprecated
  483. */
  484. message(content, options) {
  485. return VxeUI.modal.message(content, options);
  486. },
  487. /**
  488. * 已废弃,兼容老版本
  489. * @deprecated
  490. */
  491. notification(content, title, options) {
  492. return VxeUI.modal.notification(content, title, options);
  493. }
  494. };
  495. export { VxeUI };
  496. export default VxeUI;