d2coreui 21.0.33 → 23.0.0

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.
Files changed (295) hide show
  1. package/components/clipboard/clipboardUtils.d.ts +4 -3
  2. package/components/clipboard/clipboardUtils.js +47 -22
  3. package/components/clipboard/clipboardUtils.js.map +1 -1
  4. package/components/codemirror/SyntaxHighlighter.d.ts +21 -21
  5. package/components/codemirror/SyntaxHighlighter.js +45 -44
  6. package/components/codemirror/SyntaxHighlighter.js.map +1 -1
  7. package/components/collapse/expandable.d.ts +13 -12
  8. package/components/collapse/expandable.js +20 -20
  9. package/components/collapse/expandable.js.map +1 -1
  10. package/components/color/colorPicker.d.ts +20 -20
  11. package/components/color/colorPicker.js +53 -53
  12. package/components/color/colorPicker.js.map +1 -1
  13. package/components/color/colorSwatch.d.ts +13 -12
  14. package/components/color/colorSwatch.js +62 -62
  15. package/components/color/colorSwatch.js.map +1 -1
  16. package/components/color/colorUtils.d.ts +7 -7
  17. package/components/color/colorUtils.js +43 -43
  18. package/components/color/colorUtils.js.map +1 -1
  19. package/components/date/dateRangeInput.d.ts +66 -64
  20. package/components/date/dateRangeInput.js +292 -297
  21. package/components/date/dateRangeInput.js.map +1 -1
  22. package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -26
  23. package/components/date/dateRangeInputAdvancedPanel.js +130 -115
  24. package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
  25. package/components/date/dateRangeInputConfirm.d.ts +31 -29
  26. package/components/date/dateRangeInputConfirm.js +132 -121
  27. package/components/date/dateRangeInputConfirm.js.map +1 -1
  28. package/components/date/dateTimeInput.d.ts +72 -69
  29. package/components/date/dateTimeInput.js +440 -412
  30. package/components/date/dateTimeInput.js.map +1 -1
  31. package/components/date/durationInput.d.ts +59 -56
  32. package/components/date/durationInput.js +269 -280
  33. package/components/date/durationInput.js.map +1 -1
  34. package/components/form/NiceFormItem.d.ts +14 -14
  35. package/components/form/NiceFormItem.js +28 -31
  36. package/components/form/NiceFormItem.js.map +1 -1
  37. package/components/grid/cell/beanAccessor.d.ts +9 -0
  38. package/components/grid/cell/beanAccessor.js +13 -0
  39. package/components/grid/cell/beanAccessor.js.map +1 -0
  40. package/components/grid/cell/cellEditorUtils.d.ts +4 -4
  41. package/components/grid/cell/cellEditorUtils.js +8 -8
  42. package/components/grid/cell/customEnumCellEditor.d.ts +4 -26
  43. package/components/grid/cell/customEnumCellEditor.js +82 -91
  44. package/components/grid/cell/customEnumCellEditor.js.map +1 -1
  45. package/components/grid/cell/dataGridCellEditorComponent.d.ts +14 -0
  46. package/components/grid/cell/dataGridCellEditorComponent.js +49 -0
  47. package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -0
  48. package/components/grid/cell/dateCellEditor.d.ts +4 -25
  49. package/components/grid/cell/dateCellEditor.js +53 -72
  50. package/components/grid/cell/dateCellEditor.js.map +1 -1
  51. package/components/grid/cell/durationCellEditor.d.ts +4 -24
  52. package/components/grid/cell/durationCellEditor.js +74 -97
  53. package/components/grid/cell/durationCellEditor.js.map +1 -1
  54. package/components/grid/cell/hexaOctetStringCellEditor.d.ts +4 -24
  55. package/components/grid/cell/hexaOctetStringCellEditor.js +70 -94
  56. package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
  57. package/components/grid/cell/hexaValueCellEditor.d.ts +4 -24
  58. package/components/grid/cell/hexaValueCellEditor.js +65 -89
  59. package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
  60. package/components/grid/cell/numberCellEditor.d.ts +4 -27
  61. package/components/grid/cell/numberCellEditor.js +73 -95
  62. package/components/grid/cell/numberCellEditor.js.map +1 -1
  63. package/components/grid/cell/rangeSelector.d.ts +78 -78
  64. package/components/grid/cell/rangeSelector.js +526 -518
  65. package/components/grid/cell/rangeSelector.js.map +1 -1
  66. package/components/grid/cell/simpleStatusTextCellEditor.d.ts +4 -32
  67. package/components/grid/cell/simpleStatusTextCellEditor.js +106 -116
  68. package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
  69. package/components/grid/cell/statusTextCellEditor.d.ts +4 -32
  70. package/components/grid/cell/statusTextCellEditor.js +136 -159
  71. package/components/grid/cell/statusTextCellEditor.js.map +1 -1
  72. package/components/grid/cell/tableDefaultRowStyleRules.d.ts +20 -20
  73. package/components/grid/cell/tableDefaultRowStyleRules.js +29 -18
  74. package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
  75. package/components/grid/cell/textCellEditor.d.ts +4 -21
  76. package/components/grid/cell/textCellEditor.js +63 -85
  77. package/components/grid/cell/textCellEditor.js.map +1 -1
  78. package/components/grid/cell/withAgGridHooks.d.ts +3 -0
  79. package/components/grid/cell/withAgGridHooks.js +15 -0
  80. package/components/grid/cell/withAgGridHooks.js.map +1 -0
  81. package/components/grid/columnUtils.d.ts +5 -5
  82. package/components/grid/columnUtils.js +26 -26
  83. package/components/grid/columnUtils.js.map +1 -1
  84. package/components/grid/config/columnTransfer.d.ts +21 -22
  85. package/components/grid/config/columnTransfer.js +205 -201
  86. package/components/grid/config/columnTransfer.js.map +1 -1
  87. package/components/grid/config/dataGridEditor.d.ts +41 -41
  88. package/components/grid/config/dataGridEditor.js +181 -160
  89. package/components/grid/config/dataGridEditor.js.map +1 -1
  90. package/components/grid/config/rowHeightCalculator.d.ts +8 -0
  91. package/components/grid/config/rowHeightCalculator.js +20 -0
  92. package/components/grid/config/rowHeightCalculator.js.map +1 -0
  93. package/components/grid/config/rowStylePicker.d.ts +27 -25
  94. package/components/grid/config/rowStylePicker.js +127 -109
  95. package/components/grid/config/rowStylePicker.js.map +1 -1
  96. package/components/grid/dataGrid.d.ts +218 -206
  97. package/components/grid/dataGrid.js +1629 -1538
  98. package/components/grid/dataGrid.js.map +1 -1
  99. package/components/grid/detail/detailHeaderPanel.d.ts +13 -13
  100. package/components/grid/detail/detailHeaderPanel.js +25 -25
  101. package/components/grid/detail/detailHeaderPanel.js.map +1 -1
  102. package/components/grid/export/contextMenu.d.ts +18 -24
  103. package/components/grid/export/contextMenu.js +116 -113
  104. package/components/grid/export/contextMenu.js.map +1 -1
  105. package/components/grid/export/progressPopup.d.ts +29 -29
  106. package/components/grid/export/progressPopup.js +93 -93
  107. package/components/grid/export/progressPopup.js.map +1 -1
  108. package/components/grid/export/worker/clipboardExport.d.ts +1 -1
  109. package/components/grid/export/worker/clipboardExport.js +8 -8
  110. package/components/grid/export/worker/csvExport.d.ts +1 -1
  111. package/components/grid/export/worker/csvExport.js +8 -8
  112. package/components/grid/export/worker/pdfExport.d.ts +1 -1
  113. package/components/grid/export/worker/pdfExport.js +81 -81
  114. package/components/grid/export/worker/pdfExport.js.map +1 -1
  115. package/components/grid/export/worker/txtExport.d.ts +1 -1
  116. package/components/grid/export/worker/txtExport.js +19 -19
  117. package/components/grid/extendedDataGrid.d.ts +140 -140
  118. package/components/grid/extendedDataGrid.js +704 -695
  119. package/components/grid/extendedDataGrid.js.map +1 -1
  120. package/components/grid/filter/customColumnFilter.d.ts +5 -21
  121. package/components/grid/filter/customColumnFilter.js +11 -82
  122. package/components/grid/filter/customColumnFilter.js.map +1 -1
  123. package/components/grid/filter/dataGridColumnFilter.d.ts +17 -0
  124. package/components/grid/filter/dataGridColumnFilter.js +49 -0
  125. package/components/grid/filter/dataGridColumnFilter.js.map +1 -0
  126. package/components/grid/filter/dateColumnFilter.d.ts +7 -11
  127. package/components/grid/filter/dateColumnFilter.js +22 -56
  128. package/components/grid/filter/dateColumnFilter.js.map +1 -1
  129. package/components/grid/filter/textColumnFilter.d.ts +8 -20
  130. package/components/grid/filter/textColumnFilter.js +24 -76
  131. package/components/grid/filter/textColumnFilter.js.map +1 -1
  132. package/components/grid/filter/wildcardQuickFilterEngine.d.ts +7 -0
  133. package/components/grid/filter/wildcardQuickFilterEngine.js +48 -0
  134. package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -0
  135. package/components/grid/header/simpleHeader.d.ts +17 -16
  136. package/components/grid/header/simpleHeader.js +230 -186
  137. package/components/grid/header/simpleHeader.js.map +1 -1
  138. package/components/grid/panel/dataGridPagination.d.ts +16 -16
  139. package/components/grid/panel/dataGridPagination.js +58 -58
  140. package/components/grid/panel/dataGridPagination.js.map +1 -1
  141. package/components/grid/panel/loadingOverlay.d.ts +6 -6
  142. package/components/grid/panel/loadingOverlay.js +10 -10
  143. package/components/grid/panel/loadingOverlay.js.map +1 -1
  144. package/components/grid/panel/noRecordsOverlay.d.ts +6 -6
  145. package/components/grid/panel/noRecordsOverlay.js +10 -10
  146. package/components/grid/panel/noRecordsOverlay.js.map +1 -1
  147. package/components/grid/panel/tablePagination.d.ts +10 -10
  148. package/components/grid/panel/tablePagination.js +45 -45
  149. package/components/grid/panel/tablePagination.js.map +1 -1
  150. package/components/icons/dropdownArrow.d.ts +8 -0
  151. package/components/icons/dropdownArrow.js +59 -0
  152. package/components/icons/dropdownArrow.js.map +1 -0
  153. package/components/icons/undoIcon.d.ts +8 -8
  154. package/components/icons/undoIcon.js +6 -6
  155. package/components/input/autoCompleteInput.d.ts +35 -35
  156. package/components/input/autoCompleteInput.js +122 -121
  157. package/components/input/autoCompleteInput.js.map +1 -1
  158. package/components/input/draftUtils.d.ts +4 -4
  159. package/components/input/draftUtils.js +48 -48
  160. package/components/input/draftUtils.js.map +1 -1
  161. package/components/input/draftail.d.ts +1 -1
  162. package/components/input/draftail.js +1 -1
  163. package/components/input/hexaFormattedInput.d.ts +16 -16
  164. package/components/input/hexaFormattedInput.js +54 -54
  165. package/components/input/hexaFormattedInput.js.map +1 -1
  166. package/components/input/mask/helpers.d.ts +28 -28
  167. package/components/input/mask/helpers.js +112 -112
  168. package/components/input/mask/helpers.js.map +1 -1
  169. package/components/input/mask/inputMaskCore.d.ts +46 -46
  170. package/components/input/mask/inputMaskCore.js +278 -278
  171. package/components/input/mask/inputMaskCore.js.map +1 -1
  172. package/components/input/mask/pattern.d.ts +20 -20
  173. package/components/input/mask/pattern.js +78 -78
  174. package/components/input/mask/pattern.js.map +1 -1
  175. package/components/input/maskedInput.d.ts +373 -351
  176. package/components/input/maskedInput.js +224 -224
  177. package/components/input/maskedInput.js.map +1 -1
  178. package/components/input/passwordInput.d.ts +9 -9
  179. package/components/input/passwordInput.js +55 -55
  180. package/components/input/passwordInput.js.map +1 -1
  181. package/components/input/simpleAutoComplete.d.ts +12 -12
  182. package/components/input/simpleAutoComplete.js +41 -43
  183. package/components/input/simpleAutoComplete.js.map +1 -1
  184. package/components/input/textarea/extractSpansOfClasses.d.ts +15 -15
  185. package/components/input/textarea/extractSpansOfClasses.js +96 -96
  186. package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
  187. package/components/input/textarea/getRanges.d.ts +1 -1
  188. package/components/input/textarea/getRanges.js +73 -73
  189. package/components/input/textarea/getRanges.js.map +1 -1
  190. package/components/input/textarea/getType.d.ts +1 -1
  191. package/components/input/textarea/getType.js +26 -26
  192. package/components/input/textarea/getType.js.map +1 -1
  193. package/components/input/textarea/highlighedContents.d.ts +6 -6
  194. package/components/input/textarea/highlighedContents.js +10 -10
  195. package/components/input/textarea/mentionsWithHighlighting.d.ts +27 -27
  196. package/components/input/textarea/mentionsWithHighlighting.js +60 -60
  197. package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
  198. package/components/keyboard/keyboardUtils.d.ts +5 -5
  199. package/components/keyboard/keyboardUtils.js +32 -32
  200. package/components/modal/draggableModalProvider.d.ts +4 -4
  201. package/components/modal/draggableModalProvider.js +21 -21
  202. package/components/modal/draggableModalProvider.js.map +1 -1
  203. package/components/modal/impl/clamp.d.ts +1 -1
  204. package/components/modal/impl/clamp.js +1 -1
  205. package/components/modal/impl/clamp.js.map +1 -1
  206. package/components/modal/impl/draggableModal.d.ts +12 -12
  207. package/components/modal/impl/draggableModal.js +17 -17
  208. package/components/modal/impl/draggableModal.js.map +1 -1
  209. package/components/modal/impl/draggableModalContext.d.ts +9 -9
  210. package/components/modal/impl/draggableModalContext.js +2 -2
  211. package/components/modal/impl/draggableModalContext.js.map +1 -1
  212. package/components/modal/impl/draggableModalInner.d.ts +15 -13
  213. package/components/modal/impl/draggableModalInner.js +57 -55
  214. package/components/modal/impl/draggableModalInner.js.map +1 -1
  215. package/components/modal/impl/draggableModalReducer.d.ts +66 -62
  216. package/components/modal/impl/draggableModalReducer.js +77 -78
  217. package/components/modal/impl/draggableModalReducer.js.map +1 -1
  218. package/components/modal/impl/getWindowSize.d.ts +4 -4
  219. package/components/modal/impl/getWindowSize.js +4 -4
  220. package/components/modal/impl/getWindowSize.js.map +1 -1
  221. package/components/modal/impl/index.d.ts +3 -3
  222. package/components/modal/impl/index.js +3 -3
  223. package/components/modal/impl/index.js.map +1 -1
  224. package/components/modal/impl/resizeHandle.d.ts +3 -3
  225. package/components/modal/impl/resizeHandle.js +4 -4
  226. package/components/modal/impl/resizeHandle.js.map +1 -1
  227. package/components/modal/impl/useDrag.d.ts +5 -5
  228. package/components/modal/impl/useDrag.js +42 -42
  229. package/components/modal/impl/useDrag.js.map +1 -1
  230. package/components/modal/impl/usePrevious.d.ts +1 -1
  231. package/components/modal/impl/usePrevious.js +8 -8
  232. package/components/modal/impl/usePrevious.js.map +1 -1
  233. package/components/modal/impl/useResize.d.ts +7 -7
  234. package/components/modal/impl/useResize.js +46 -46
  235. package/components/modal/impl/useResize.js.map +1 -1
  236. package/components/modal/modalDialog.d.ts +49 -49
  237. package/components/modal/modalDialog.js +152 -152
  238. package/components/modal/modalDialog.js.map +1 -1
  239. package/components/picker/enumValuePicker.d.ts +16 -16
  240. package/components/picker/enumValuePicker.js +34 -34
  241. package/components/picker/enumValuePicker.js.map +1 -1
  242. package/components/platformSpecific.d.ts +10 -10
  243. package/components/platformSpecific.js +27 -27
  244. package/components/scrollTo/onlyText.d.ts +4 -4
  245. package/components/scrollTo/onlyText.js +30 -30
  246. package/components/scrollTo/onlyText.js.map +1 -1
  247. package/components/scrollTo/scrollTo.d.ts +41 -39
  248. package/components/scrollTo/scrollTo.js +264 -264
  249. package/components/scrollTo/scrollTo.js.map +1 -1
  250. package/components/style/withCss.d.ts +9 -0
  251. package/components/style/withCss.js +6 -0
  252. package/components/style/withCss.js.map +1 -0
  253. package/components/style/withInputNumberCss.d.ts +6 -0
  254. package/components/style/withInputNumberCss.js +13 -0
  255. package/components/style/withInputNumberCss.js.map +1 -0
  256. package/components/table/dragSortingTable.d.ts +13 -14
  257. package/components/table/dragSortingTable.js +96 -82
  258. package/components/table/dragSortingTable.js.map +1 -1
  259. package/components/text/impl/innerSize.d.ts +2 -2
  260. package/components/text/impl/innerSize.js +12 -12
  261. package/components/text/impl/series.d.ts +1 -1
  262. package/components/text/impl/series.js +28 -28
  263. package/components/text/impl/shallowEqual.d.ts +1 -1
  264. package/components/text/impl/shallowEqual.js +18 -18
  265. package/components/text/impl/shallowEqual.js.map +1 -1
  266. package/components/text/impl/uniqueId.d.ts +1 -1
  267. package/components/text/impl/uniqueId.js +4 -4
  268. package/components/text/impl/whilst.d.ts +1 -1
  269. package/components/text/impl/whilst.js +19 -19
  270. package/components/text/impl/whilst.js.map +1 -1
  271. package/components/text/textFit.d.ts +38 -38
  272. package/components/text/textFit.js +165 -168
  273. package/components/text/textFit.js.map +1 -1
  274. package/i18n/components.cs.json +101 -100
  275. package/i18n/components.sk.json +101 -100
  276. package/i18n/components.uk.json +101 -100
  277. package/i18n/componentsLocaleHolder.d.ts +3 -3
  278. package/i18n/componentsLocaleHolder.js +28 -28
  279. package/i18n/componentsLocaleHolder.js.map +1 -1
  280. package/package.json +71 -70
  281. package/style/index.less +274 -298
  282. package/style/modal/DraggableModal.css +43 -40
  283. package/style/modal/ResizeHandle.css +27 -19
  284. package/tsconfig.build.json +24 -24
  285. package/tsconfig.json +11 -11
  286. package/components/grid/cell/wildcardQuickFilter.d.ts +0 -11
  287. package/components/grid/cell/wildcardQuickFilter.js +0 -61
  288. package/components/grid/cell/wildcardQuickFilter.js.map +0 -1
  289. package/components/table/dataTable.d.ts +0 -17
  290. package/components/table/dataTable.js +0 -79
  291. package/components/table/dataTable.js.map +0 -1
  292. package/style/antd/antd-tree-showline.css +0 -25
  293. package/style/antd/full-height-tabs.scss +0 -63
  294. package/style/draftail/draftail-editor.css +0 -179
  295. package/style/table/dragSortingTable.css +0 -7
@@ -1,94 +1,94 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React from "react";
13
- import { LoadingOutlined } from "@ant-design/icons";
14
- import { notification, Progress } from "antd";
15
- import i18n from "d2core/i18n/i18n";
16
- export class ProgressBar extends React.Component {
17
- constructor(props) {
18
- super(props);
19
- this.state = {
20
- percent: 0,
21
- };
22
- }
23
- componentDidMount() {
24
- if (this.props.registerUpdateHandler) {
25
- this.props.registerUpdateHandler(this.makeProgress.bind(this));
26
- }
27
- }
28
- componentWillUnmount() {
29
- if (this.props.registerUpdateHandler) {
30
- this.props.registerUpdateHandler(null);
31
- }
32
- }
33
- makeProgress(percent) {
34
- this.setState({ percent: percent });
35
- }
36
- render() {
37
- const _a = this.props, { registerUpdateHandler } = _a, rest = __rest(_a, ["registerUpdateHandler"]);
38
- return React.createElement(Progress, Object.assign({ percent: this.state.percent }, rest));
39
- }
40
- }
41
- export default class ProgressPopup {
42
- constructor(title) {
43
- this.makeProgress = null;
44
- this.progressVisible = false;
45
- this.title = title;
46
- }
47
- async initializeProgressPopup() {
48
- notification.open({
49
- message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", { n: "" + this.recordCount })),
50
- key: "export",
51
- description: React.createElement(ProgressBar, { registerUpdateHandler: (makeProgress) => {
52
- this.makeProgress = makeProgress;
53
- } }),
54
- icon: React.createElement(LoadingOutlined, null),
55
- duration: 0
56
- });
57
- this.progressVisible = true;
58
- await this.sleep(100);
59
- }
60
- setRecordCount(recordCount) {
61
- this.recordCount = recordCount;
62
- }
63
- async update(progressPercent) {
64
- if (!this.progressVisible) {
65
- await this.initializeProgressPopup();
66
- }
67
- if (progressPercent === 100) {
68
- this.close();
69
- }
70
- if (this.makeProgress) {
71
- this.makeProgress(progressPercent);
72
- }
73
- }
74
- close() {
75
- notification.success({
76
- message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", { n: "" + this.recordCount })),
77
- key: "export",
78
- description: React.createElement(Progress, { percent: 100 })
79
- });
80
- this.progressVisible = false;
81
- }
82
- error() {
83
- notification.error({
84
- message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", { n: "" + this.recordCount })),
85
- key: "export",
86
- description: React.createElement(Progress, { status: "exception", percent: 100 })
87
- });
88
- this.progressVisible = false;
89
- }
90
- sleep(ms) {
91
- return new Promise(resolve => setTimeout(resolve, ms));
92
- }
93
- }
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import React from "react";
13
+ import { LoadingOutlined } from "@ant-design/icons";
14
+ import { notification, Progress } from "antd";
15
+ import i18n from "d2core/i18n/i18n";
16
+ export class ProgressBar extends React.Component {
17
+ constructor(props) {
18
+ super(props);
19
+ this.state = {
20
+ percent: 0,
21
+ };
22
+ }
23
+ componentDidMount() {
24
+ if (this.props.registerUpdateHandler) {
25
+ this.props.registerUpdateHandler(this.makeProgress.bind(this));
26
+ }
27
+ }
28
+ componentWillUnmount() {
29
+ if (this.props.registerUpdateHandler) {
30
+ this.props.registerUpdateHandler(null);
31
+ }
32
+ }
33
+ makeProgress(percent) {
34
+ this.setState({ percent: percent });
35
+ }
36
+ render() {
37
+ const _a = this.props, { registerUpdateHandler } = _a, rest = __rest(_a, ["registerUpdateHandler"]);
38
+ return React.createElement(Progress, Object.assign({ percent: this.state.percent }, rest));
39
+ }
40
+ }
41
+ export default class ProgressPopup {
42
+ constructor(title) {
43
+ this.makeProgress = null;
44
+ this.progressVisible = false;
45
+ this.title = title;
46
+ }
47
+ async initializeProgressPopup() {
48
+ notification.open({
49
+ message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", { n: "" + this.recordCount })),
50
+ key: "export",
51
+ description: React.createElement(ProgressBar, { registerUpdateHandler: (makeProgress) => {
52
+ this.makeProgress = makeProgress;
53
+ } }),
54
+ icon: React.createElement(LoadingOutlined, null),
55
+ duration: 0
56
+ });
57
+ this.progressVisible = true;
58
+ await this.sleep(100);
59
+ }
60
+ setRecordCount(recordCount) {
61
+ this.recordCount = recordCount;
62
+ }
63
+ async update(progressPercent) {
64
+ if (!this.progressVisible) {
65
+ await this.initializeProgressPopup();
66
+ }
67
+ if (progressPercent === 100) {
68
+ this.close();
69
+ }
70
+ if (this.makeProgress) {
71
+ this.makeProgress(progressPercent);
72
+ }
73
+ }
74
+ close() {
75
+ notification.success({
76
+ message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", { n: "" + this.recordCount })),
77
+ key: "export",
78
+ description: React.createElement(Progress, { percent: 100 })
79
+ });
80
+ this.progressVisible = false;
81
+ }
82
+ error() {
83
+ notification.error({
84
+ message: this.title + (this.recordCount === undefined ? "" : i18n(" (%{n} records)", { n: "" + this.recordCount })),
85
+ key: "export",
86
+ description: React.createElement(Progress, { status: "exception", percent: 100 })
87
+ });
88
+ this.progressVisible = false;
89
+ }
90
+ sleep(ms) {
91
+ return new Promise(resolve => setTimeout(resolve, ms));
92
+ }
93
+ }
94
94
  //# sourceMappingURL=progressPopup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"progressPopup.js","sourceRoot":"","sources":["../../../../../components/grid/export/progressPopup.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,YAAY,EAAE,QAAQ,EAAC,MAAM,MAAM,CAAC;AAC5C,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAWpC,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA6C;IAChF,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG;YACT,OAAO,EAAE,CAAC;SACb,CAAC;IACN,CAAC;IAED,iBAAiB;QACb,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE;YAClC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;SAClE;IACL,CAAC;IAED,oBAAoB;QAChB,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE;YAClC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;SAC1C;IACL,CAAC;IAED,YAAY,CAAC,OAAe;QACxB,IAAI,CAAC,QAAQ,CAAC,EAAC,OAAO,EAAE,OAAO,EAAC,CAAC,CAAC;IACtC,CAAC;IAED,MAAM;QACF,MAAM,KAAmC,IAAI,CAAC,KAAK,EAA7C,EAAC,qBAAqB,OAAuB,EAAlB,IAAI,cAA/B,yBAAgC,CAAa,CAAC;QACpD,OAAO,oBAAC,QAAQ,kBAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,OAAO,IAAM,IAAI,EAAG,CAAC;IAC9D,CAAC;CACJ;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;IAM9B,YAAY,KAAa;QAHzB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AAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;YACjH,GAAG,EAAE,QAAQ;YACb,WAAW,EAAE,oBAAC,QAAQ,IAAC,OAAO,EAAE,GAAG,GAAG;SACzC,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,KAAK;QACD,YAAY,CAAC,KAAK,CAAC;YACf,OAAO,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;YACjH,GAAG,EAAE,QAAQ;YACb,WAAW,EAAE,oBAAC,QAAQ,IAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,GAAG;SAC9D,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,EAAU;QACZ,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {LoadingOutlined} from \"@ant-design/icons\";\nimport {notification, Progress} from \"antd\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {ProgressProps} from \"antd/lib/progress/progress\";\n\ninterface ProgressBarProps extends ProgressProps {\n registerUpdateHandler(updateHandler: ((percent: number) => void) | null): void\n}\n\ninterface ProgressBarState {\n percent: number\n}\n\nexport class ProgressBar extends React.Component<ProgressBarProps, ProgressBarState> {\n constructor(props: Readonly<ProgressBarProps>) {\n super(props);\n this.state = {\n percent: 0,\n };\n }\n\n componentDidMount() {\n if (this.props.registerUpdateHandler) {\n this.props.registerUpdateHandler(this.makeProgress.bind(this));\n }\n }\n\n componentWillUnmount() {\n if (this.props.registerUpdateHandler) {\n this.props.registerUpdateHandler(null);\n }\n }\n\n makeProgress(percent: number) {\n this.setState({percent: percent});\n }\n\n render() {\n const {registerUpdateHandler, ...rest} = this.props;\n return <Progress percent={this.state.percent} {...rest}/>;\n }\n}\n\nexport default class ProgressPopup {\n title: string;\n recordCount?: number;\n makeProgress: ((percent: number) => void) | null = null;\n progressVisible: boolean = false;\n\n constructor(title: string) {\n this.title = title;\n }\n\n async initializeProgressPopup() {\n notification.open({\n message: this.title + (this.recordCount === undefined ? \"\" : i18n(\" (%{n} records)\", {n: \"\" + this.recordCount})),\n key: \"export\",\n description: <ProgressBar registerUpdateHandler={(makeProgress) => {\n this.makeProgress = makeProgress;\n }}/>,\n icon: <LoadingOutlined/>,\n duration: 0\n });\n this.progressVisible = true;\n await this.sleep(100);\n }\n\n setRecordCount(recordCount: number) {\n this.recordCount = recordCount;\n }\n\n async update(progressPercent: number) {\n if (!this.progressVisible) {\n await this.initializeProgressPopup();\n }\n if (progressPercent === 100) {\n this.close();\n }\n if (this.makeProgress) {\n this.makeProgress(progressPercent);\n }\n }\n\n close() {\n notification.success({\n message: this.title + (this.recordCount === undefined ? \"\" : i18n(\" (%{n} records)\", {n: \"\" + this.recordCount})),\n key: \"export\",\n description: <Progress percent={100}/>\n });\n this.progressVisible = false;\n }\n\n error() {\n notification.error({\n message: this.title + (this.recordCount === undefined ? \"\" : i18n(\" (%{n} records)\", {n: \"\" + this.recordCount})),\n key: \"export\",\n description: <Progress status={\"exception\"} percent={100}/>\n });\n this.progressVisible = false;\n }\n\n sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n}"]}
1
+ {"version":3,"file":"progressPopup.js","sourceRoot":"","sources":["../../../../../components/grid/export/progressPopup.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM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EAAE,GAAG,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;YACjH,GAAG,EAAE,QAAQ;YACb,WAAW,EAAE,oBAAC,QAAQ,IAAC,OAAO,EAAE,GAAG,GAAG;SACzC,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,KAAK;QACD,YAAY,CAAC,KAAK,CAAC;YACf,OAAO,EAAE,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAC,CAAC,CAAC;YACjH,GAAG,EAAE,QAAQ;YACb,WAAW,EAAE,oBAAC,QAAQ,IAAC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,GAAG;SAC9D,CAAC,CAAC;QACH,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,EAAU;QACZ,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IAC3D,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {LoadingOutlined} from \"@ant-design/icons\";\nimport {notification, Progress} from \"antd\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {ProgressProps} from \"antd/lib/progress/progress\";\n\ninterface ProgressBarProps extends ProgressProps {\n registerUpdateHandler(updateHandler: ((percent: number) => void) | null): void\n}\n\ninterface ProgressBarState {\n percent: number\n}\n\nexport class ProgressBar extends React.Component<ProgressBarProps, ProgressBarState> {\n constructor(props: Readonly<ProgressBarProps>) {\n super(props);\n this.state = {\n percent: 0,\n };\n }\n\n componentDidMount() {\n if (this.props.registerUpdateHandler) {\n this.props.registerUpdateHandler(this.makeProgress.bind(this));\n }\n }\n\n componentWillUnmount() {\n if (this.props.registerUpdateHandler) {\n this.props.registerUpdateHandler(null);\n }\n }\n\n makeProgress(percent: number) {\n this.setState({percent: percent});\n }\n\n render() {\n const {registerUpdateHandler, ...rest} = this.props;\n return <Progress percent={this.state.percent} {...rest}/>;\n }\n}\n\nexport default class ProgressPopup {\n title: string;\n recordCount?: number;\n makeProgress: ((percent: number) => void) | null = null;\n progressVisible: boolean = false;\n\n constructor(title: string) {\n this.title = title;\n }\n\n async initializeProgressPopup() {\n notification.open({\n message: this.title + (this.recordCount === undefined ? \"\" : i18n(\" (%{n} records)\", {n: \"\" + this.recordCount})),\n key: \"export\",\n description: <ProgressBar registerUpdateHandler={(makeProgress) => {\n this.makeProgress = makeProgress;\n }}/>,\n icon: <LoadingOutlined/>,\n duration: 0\n });\n this.progressVisible = true;\n await this.sleep(100);\n }\n\n setRecordCount(recordCount: number) {\n this.recordCount = recordCount;\n }\n\n async update(progressPercent: number) {\n if (!this.progressVisible) {\n await this.initializeProgressPopup();\n }\n if (progressPercent === 100) {\n this.close();\n }\n if (this.makeProgress) {\n this.makeProgress(progressPercent);\n }\n }\n\n close() {\n notification.success({\n message: this.title + (this.recordCount === undefined ? \"\" : i18n(\" (%{n} records)\", {n: \"\" + this.recordCount})),\n key: \"export\",\n description: <Progress percent={100}/>\n });\n this.progressVisible = false;\n }\n\n error() {\n notification.error({\n message: this.title + (this.recordCount === undefined ? \"\" : i18n(\" (%{n} records)\", {n: \"\" + this.recordCount})),\n key: \"export\",\n description: <Progress status={\"exception\"} percent={100}/>\n });\n this.progressVisible = false;\n }\n\n sleep(ms: number): Promise<void> {\n return new Promise(resolve => setTimeout(resolve, ms));\n }\n}"]}
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,9 +1,9 @@
1
- import { expose } from "threads/worker";
2
- function clipboardExport(tableData) {
3
- const textContent = tableData.map((row) => {
4
- return row.join("\t");
5
- }).join("\r\n");
6
- return textContent;
7
- }
8
- expose(clipboardExport);
1
+ import { expose } from "threads/worker";
2
+ function clipboardExport(tableData) {
3
+ const textContent = tableData.map((row) => {
4
+ return row.join("\t");
5
+ }).join("\r\n");
6
+ return textContent;
7
+ }
8
+ expose(clipboardExport);
9
9
  //# sourceMappingURL=clipboardExport.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,9 +1,9 @@
1
- import { expose } from "threads/worker";
2
- function csvExport(tableData) {
3
- const textContent = tableData.map((row) => {
4
- return row.join(";");
5
- }).join("\r\n");
6
- return textContent;
7
- }
8
- expose(csvExport);
1
+ import { expose } from "threads/worker";
2
+ function csvExport(tableData) {
3
+ const textContent = tableData.map((row) => {
4
+ return row.join(";");
5
+ }).join("\r\n");
6
+ return textContent;
7
+ }
8
+ expose(csvExport);
9
9
  //# sourceMappingURL=csvExport.js.map
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,82 +1,82 @@
1
- import { expose } from "threads/worker";
2
- import pdfMake from "pdfmake/build/pdfmake";
3
- import pdfFonts from "pdfmake/build/vfs_fonts";
4
- import moment from "moment";
5
- import { Observable, Subject } from "threads/observable";
6
- import { LocaleHolder } from "d2core/i18n/localeHolder";
7
- pdfMake.vfs = pdfFonts.pdfMake.vfs;
8
- function getPdfConfig(tableData, pageConfig) {
9
- tableData[0] = tableData[0].map((value) => {
10
- return { text: value, style: 'tableHeader' };
11
- });
12
- tableData.forEach((row) => {
13
- row.forEach((value, index) => {
14
- if (value === undefined || value === null) {
15
- row[index] = "";
16
- }
17
- });
18
- });
19
- return {
20
- content: [{
21
- style: 'tableExample',
22
- table: {
23
- headerRows: 1,
24
- body: tableData
25
- }
26
- }],
27
- styles: {
28
- header: {
29
- fontSize: 10,
30
- bold: true,
31
- margin: [0, 0, 0, 10]
32
- },
33
- subheader: {
34
- fontSize: 9,
35
- bold: true,
36
- margin: [0, 10, 0, 5]
37
- },
38
- tableExample: {
39
- margin: [0, 5, 0, 15],
40
- },
41
- tableHeader: {
42
- bold: true,
43
- fontSize: 10,
44
- }
45
- },
46
- defaultStyle: {
47
- fontSize: 10,
48
- },
49
- footer: function (currentPage, pageCount) {
50
- return {
51
- table: {
52
- widths: ['*'],
53
- body: [
54
- [
55
- { text: `${currentPage}/${pageCount}`, alignment: 'center' },
56
- ]
57
- ]
58
- },
59
- layout: 'noBorders'
60
- };
61
- },
62
- info: {
63
- title: `Export ${moment().format(LocaleHolder.getDateTimeFormat(true, true))}`,
64
- author: 'D2000',
65
- },
66
- pageOrientation: pageConfig.pageOrientation
67
- };
68
- }
69
- const subject = new Subject();
70
- const pdfExport = {
71
- export(tableData, pageConfig) {
72
- pdfMake.createPdf(getPdfConfig(tableData, pageConfig)).getBase64((data) => {
73
- subject.next(data);
74
- subject.complete();
75
- });
76
- },
77
- handler() {
78
- return Observable.from(subject);
79
- },
80
- };
81
- expose(pdfExport);
1
+ import { expose } from "threads/worker";
2
+ import pdfMake from "pdfmake/build/pdfmake";
3
+ import pdfFonts from "pdfmake/build/vfs_fonts";
4
+ import dayjs from "dayjs";
5
+ import { Observable, Subject } from "threads/observable";
6
+ import { LocaleHolder } from "d2core/i18n/localeHolder";
7
+ pdfMake.vfs = pdfFonts.pdfMake.vfs;
8
+ function getPdfConfig(tableData, pageConfig) {
9
+ tableData[0] = tableData[0].map((value) => {
10
+ return { text: value, style: 'tableHeader' };
11
+ });
12
+ tableData.forEach((row) => {
13
+ row.forEach((value, index) => {
14
+ if (value === undefined || value === null) {
15
+ row[index] = "";
16
+ }
17
+ });
18
+ });
19
+ return {
20
+ content: [{
21
+ style: 'tableExample',
22
+ table: {
23
+ headerRows: 1,
24
+ body: tableData
25
+ }
26
+ }],
27
+ styles: {
28
+ header: {
29
+ fontSize: 10,
30
+ bold: true,
31
+ margin: [0, 0, 0, 10]
32
+ },
33
+ subheader: {
34
+ fontSize: 9,
35
+ bold: true,
36
+ margin: [0, 10, 0, 5]
37
+ },
38
+ tableExample: {
39
+ margin: [0, 5, 0, 15],
40
+ },
41
+ tableHeader: {
42
+ bold: true,
43
+ fontSize: 10,
44
+ }
45
+ },
46
+ defaultStyle: {
47
+ fontSize: 10,
48
+ },
49
+ footer: function (currentPage, pageCount) {
50
+ return {
51
+ table: {
52
+ widths: ['*'],
53
+ body: [
54
+ [
55
+ { text: `${currentPage}/${pageCount}`, alignment: 'center' },
56
+ ]
57
+ ]
58
+ },
59
+ layout: 'noBorders'
60
+ };
61
+ },
62
+ info: {
63
+ title: `Export ${dayjs().format(LocaleHolder.getDateTimeFormat(true, true))}`,
64
+ author: 'D2000',
65
+ },
66
+ pageOrientation: pageConfig.pageOrientation
67
+ };
68
+ }
69
+ const subject = new Subject();
70
+ const pdfExport = {
71
+ export(tableData, pageConfig) {
72
+ pdfMake.createPdf(getPdfConfig(tableData, pageConfig)).getBase64((data) => {
73
+ subject.next(data);
74
+ subject.complete();
75
+ });
76
+ },
77
+ handler() {
78
+ return Observable.from(subject);
79
+ },
80
+ };
81
+ expose(pdfExport);
82
82
  //# sourceMappingURL=pdfExport.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pdfExport.js","sourceRoot":"","sources":["../../../../../../components/grid/export/worker/pdfExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAA;AACrC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAE5C,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAEtD,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC;AAQnC,SAAS,YAAY,CAAC,SAAwB,EAAE,UAAsB;IAElE,SAAS,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACtC,OAAO,EAAC,IAAI,EAAE,KAAe,EAAE,KAAK,EAAE,a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BACJ;gBACD,MAAM,EAAE,WAAW;aACtB,CAAC;QACN,CAAC;QACD,IAAI,EAAE;YACF,KAAK,EAAE,UAAU,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE;YAC9E,MAAM,EAAE,OAAO;SAClB;QACD,eAAe,EAAE,UAAU,CAAC,eAAe;KAC9C,CAAC;AACN,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,SAAS,GAAG;IACd,MAAM,CAAC,SAAwB,EAAE,UAAsB;QACnD,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;YACtE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACJ,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import {expose} from \"threads/worker\"\nimport pdfMake from \"pdfmake/build/pdfmake\";\nimport {PageOrientation, TDocumentDefinitions} from \"pdfmake/interfaces\";\nimport pdfFonts from \"pdfmake/build/vfs_fonts\";\nimport moment from \"moment\";\nimport {Observable, Subject} from \"threads/observable\"\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\n\npdfMake.vfs = pdfFonts.pdfMake.vfs;\n\ninterface PageConfig {\n pageOrientation: PageOrientation\n}\n\ntype TableCell = string | { text: string, style: string }\n\nfunction getPdfConfig(tableData: TableCell[][], pageConfig: PageConfig): TDocumentDefinitions {\n // styling header\n tableData[0] = tableData[0].map((value) => {\n return {text: value as string, style: 'tableHeader'};\n });\n // escaping empty data\n tableData.forEach((row) => {\n row.forEach((value, index) => {\n if (value === undefined || value === null) {\n row[index] = \"\";\n }\n });\n });\n return {\n content: [{\n style: 'tableExample',\n table: {\n headerRows: 1,\n // dontBreakRows: true,\n // keepWithHeaderRows: 1,\n body: tableData\n }\n }],\n styles: {\n header: {\n fontSize: 10,\n bold: true,\n margin: [0, 0, 0, 10]\n },\n subheader: {\n fontSize: 9,\n bold: true,\n margin: [0, 10, 0, 5]\n },\n tableExample: {\n margin: [0, 5, 0, 15],\n\n },\n tableHeader: {\n bold: true,\n fontSize: 10,\n }\n },\n defaultStyle: {\n // alignment: 'justify',\n fontSize: 10,\n },\n footer: function (currentPage: number, pageCount: number) {\n return {\n table: {\n widths: ['*'],\n body: [\n [\n {text: `${currentPage}/${pageCount}`, alignment: 'center'},\n ]\n ]\n },\n layout: 'noBorders'\n };\n },\n info: {\n title: `Export ${moment().format(LocaleHolder.getDateTimeFormat(true, true))}`,\n author: 'D2000',\n },\n pageOrientation: pageConfig.pageOrientation\n };\n}\n\nconst subject = new Subject();\nconst pdfExport = {\n export(tableData: TableCell[][], pageConfig: PageConfig) {\n pdfMake.createPdf(getPdfConfig(tableData, pageConfig)).getBase64((data) => {\n subject.next(data);\n subject.complete();\n });\n },\n handler() {\n return Observable.from(subject);\n },\n};\n\nexpose(pdfExport);"]}
1
+ {"version":3,"file":"pdfExport.js","sourceRoot":"","sources":["../../../../../../components/grid/export/worker/pdfExport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,gBAAgB,CAAA;AACrC,OAAO,OAAO,MAAM,uBAAuB,CAAC;AAE5C,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAC,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAEtD,OAAO,CAAC,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC;AAQnC,S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,EAAE,SAAiB;YACpD,OAAO;gBACH,KAAK,EAAE;oBACH,MAAM,EAAE,CAAC,GAAG,CAAC;oBACb,IAAI,EAAE;wBACF;4BACI,EAAC,IAAI,EAAE,GAAG,WAAW,IAAI,SAAS,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAC;yBAC7D;qBACJ;iBACJ;gBACD,MAAM,EAAE,WAAW;aACtB,CAAC;QACN,CAAC;QACD,IAAI,EAAE;YACF,KAAK,EAAE,UAAU,KAAK,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE;YAC7E,MAAM,EAAE,OAAO;SAClB;QACD,eAAe,EAAE,UAAU,CAAC,eAAe;KAC9C,CAAC;AACN,CAAC;AAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAC9B,MAAM,SAAS,GAAG;IACd,MAAM,CAAC,SAAwB,EAAE,UAAsB;QACnD,OAAO,CAAC,SAAS,CAAC,YAAY,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,IAAI,EAAE,EAAE;YACtE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,CAAC,QAAQ,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IACD,OAAO;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpC,CAAC;CACJ,CAAC;AAEF,MAAM,CAAC,SAAS,CAAC,CAAC","sourcesContent":["import {expose} from \"threads/worker\"\r\nimport pdfMake from \"pdfmake/build/pdfmake\";\r\nimport {PageOrientation, TDocumentDefinitions} from \"pdfmake/interfaces\";\r\nimport pdfFonts from \"pdfmake/build/vfs_fonts\";\r\nimport dayjs from \"dayjs\";\r\nimport {Observable, Subject} from \"threads/observable\"\r\nimport {LocaleHolder} from \"d2core/i18n/localeHolder\";\r\n\r\npdfMake.vfs = pdfFonts.pdfMake.vfs;\r\n\r\ninterface PageConfig {\r\n pageOrientation: PageOrientation\r\n}\r\n\r\ntype TableCell = string | { text: string, style: string }\r\n\r\nfunction getPdfConfig(tableData: TableCell[][], pageConfig: PageConfig): TDocumentDefinitions {\r\n // styling header\r\n tableData[0] = tableData[0].map((value) => {\r\n return {text: value as string, style: 'tableHeader'};\r\n });\r\n // escaping empty data\r\n tableData.forEach((row) => {\r\n row.forEach((value, index) => {\r\n if (value === undefined || value === null) {\r\n row[index] = \"\";\r\n }\r\n });\r\n });\r\n return {\r\n content: [{\r\n style: 'tableExample',\r\n table: {\r\n headerRows: 1,\r\n // dontBreakRows: true,\r\n // keepWithHeaderRows: 1,\r\n body: tableData\r\n }\r\n }],\r\n styles: {\r\n header: {\r\n fontSize: 10,\r\n bold: true,\r\n margin: [0, 0, 0, 10]\r\n },\r\n subheader: {\r\n fontSize: 9,\r\n bold: true,\r\n margin: [0, 10, 0, 5]\r\n },\r\n tableExample: {\r\n margin: [0, 5, 0, 15],\r\n\r\n },\r\n tableHeader: {\r\n bold: true,\r\n fontSize: 10,\r\n }\r\n },\r\n defaultStyle: {\r\n // alignment: 'justify',\r\n fontSize: 10,\r\n },\r\n footer: function (currentPage: number, pageCount: number) {\r\n return {\r\n table: {\r\n widths: ['*'],\r\n body: [\r\n [\r\n {text: `${currentPage}/${pageCount}`, alignment: 'center'},\r\n ]\r\n ]\r\n },\r\n layout: 'noBorders'\r\n };\r\n },\r\n info: {\r\n title: `Export ${dayjs().format(LocaleHolder.getDateTimeFormat(true, true))}`,\r\n author: 'D2000',\r\n },\r\n pageOrientation: pageConfig.pageOrientation\r\n };\r\n}\r\n\r\nconst subject = new Subject();\r\nconst pdfExport = {\r\n export(tableData: TableCell[][], pageConfig: PageConfig) {\r\n pdfMake.createPdf(getPdfConfig(tableData, pageConfig)).getBase64((data) => {\r\n subject.next(data);\r\n subject.complete();\r\n });\r\n },\r\n handler() {\r\n return Observable.from(subject);\r\n },\r\n};\r\n\r\nexpose(pdfExport);"]}
@@ -1 +1 @@
1
- export {};
1
+ export {};
@@ -1,20 +1,20 @@
1
- import { expose } from "threads/worker";
2
- import padEnd from "lodash/padEnd";
3
- function txtExport(tableData) {
4
- let cellLengths = tableData[0].map((cell) => cell ? cell.length : 0);
5
- cellLengths = tableData.reduce((result, row) => {
6
- row.forEach((cell, index) => {
7
- result[index] = Math.max(result[index], cell ? cell.length : 0);
8
- });
9
- return result;
10
- }, cellLengths);
11
- const textContent = tableData.map((row, index) => {
12
- const rowContent = row.map((cell, index) => {
13
- return padEnd(cell, cellLengths[index] + 1);
14
- }).join("");
15
- return index === 0 ? rowContent + "\r\n" + padEnd("", cellLengths.reduce((total, cellLength) => total + cellLength + 1, 0), "-") : rowContent;
16
- }).join("\r\n");
17
- return textContent;
18
- }
19
- expose(txtExport);
1
+ import { expose } from "threads/worker";
2
+ import padEnd from "lodash/padEnd";
3
+ function txtExport(tableData) {
4
+ let cellLengths = tableData[0].map((cell) => cell ? cell.length : 0);
5
+ cellLengths = tableData.reduce((result, row) => {
6
+ row.forEach((cell, index) => {
7
+ result[index] = Math.max(result[index], cell ? cell.length : 0);
8
+ });
9
+ return result;
10
+ }, cellLengths);
11
+ const textContent = tableData.map((row, index) => {
12
+ const rowContent = row.map((cell, index) => {
13
+ return padEnd(cell, cellLengths[index] + 1);
14
+ }).join("");
15
+ return index === 0 ? rowContent + "\r\n" + padEnd("", cellLengths.reduce((total, cellLength) => total + cellLength + 1, 0), "-") : rowContent;
16
+ }).join("\r\n");
17
+ return textContent;
18
+ }
19
+ expose(txtExport);
20
20
  //# sourceMappingURL=txtExport.js.map