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,49 +1,49 @@
1
- import React from "react";
2
- import { ModalFuncProps, ModalProps } from "antd/es/Modal";
3
- export declare const enum ModalDialogMode {
4
- NO_BUTTONS = "NO_BUTTONS",
5
- OK_CANCEL = "OK_CANCEL",
6
- YES_NO = "YES_NO",
7
- YES_NO_CANCEL = "YES_NO_CANCEL",
8
- OK = "OK"
9
- }
10
- export interface ModalDialogFuncProps extends ModalFuncProps {
11
- mode: ModalDialogMode;
12
- denyText?: string;
13
- onDeny?: (...args: any[]) => any;
14
- }
15
- export interface ModalDialogProps extends Omit<ModalProps, "width"> {
16
- mode: ModalDialogMode;
17
- initialWidth?: number;
18
- initialHeight?: number;
19
- onResize?(size: {
20
- width: number;
21
- height: number;
22
- }): void;
23
- }
24
- export declare class ModalDialog extends React.Component<ModalDialogProps, {}> {
25
- constructor(props: Readonly<ModalDialogProps>);
26
- static confirm(props: ModalDialogFuncProps): {
27
- destroy: () => void;
28
- update: (newConfig: ModalFuncProps) => void;
29
- };
30
- static error(props: ModalDialogFuncProps): {
31
- destroy: () => void;
32
- update: (newConfig: ModalFuncProps) => void;
33
- };
34
- static delete(props: ModalDialogFuncProps): {
35
- destroy: () => void;
36
- update: (newConfig: ModalFuncProps) => void;
37
- };
38
- static success(props: ModalDialogFuncProps): {
39
- destroy: () => void;
40
- update: (newConfig: ModalFuncProps) => void;
41
- };
42
- static info(props: ModalDialogFuncProps): {
43
- destroy: () => void;
44
- update: (newConfig: ModalFuncProps) => void;
45
- };
46
- render(): JSX.Element;
47
- private static getModalProperties;
48
- private static getModalFuncProperties;
49
- }
1
+ import React from "react";
2
+ import { ModalFuncProps, ModalProps } from "antd/es/modal";
3
+ export declare const enum ModalDialogMode {
4
+ NO_BUTTONS = "NO_BUTTONS",
5
+ OK_CANCEL = "OK_CANCEL",
6
+ YES_NO = "YES_NO",
7
+ YES_NO_CANCEL = "YES_NO_CANCEL",
8
+ OK = "OK"
9
+ }
10
+ export interface ModalDialogFuncProps extends ModalFuncProps {
11
+ mode: ModalDialogMode;
12
+ denyText?: string;
13
+ onDeny?: (...args: any[]) => any;
14
+ }
15
+ export interface ModalDialogProps extends Omit<ModalProps, "width"> {
16
+ mode: ModalDialogMode;
17
+ initialWidth?: number;
18
+ initialHeight?: number;
19
+ onResize?(size: {
20
+ width: number;
21
+ height: number;
22
+ }): void;
23
+ }
24
+ export declare class ModalDialog extends React.Component<ModalDialogProps, {}> {
25
+ constructor(props: Readonly<ModalDialogProps>);
26
+ static confirm(props: ModalDialogFuncProps): {
27
+ destroy: () => void;
28
+ update: (newConfig: ModalFuncProps) => void;
29
+ };
30
+ static error(props: ModalDialogFuncProps): {
31
+ destroy: () => void;
32
+ update: (newConfig: ModalFuncProps) => void;
33
+ };
34
+ static delete(props: ModalDialogFuncProps): {
35
+ destroy: () => void;
36
+ update: (newConfig: ModalFuncProps) => void;
37
+ };
38
+ static success(props: ModalDialogFuncProps): {
39
+ destroy: () => void;
40
+ update: (newConfig: ModalFuncProps) => void;
41
+ };
42
+ static info(props: ModalDialogFuncProps): {
43
+ destroy: () => void;
44
+ update: (newConfig: ModalFuncProps) => void;
45
+ };
46
+ render(): React.JSX.Element;
47
+ private static getModalProperties;
48
+ private static getModalFuncProperties;
49
+ }
@@ -1,153 +1,153 @@
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 { Button, Modal } from "antd";
14
- import i18n from "d2core/i18n/i18n";
15
- import { DraggableModal } from "d2coreui/components/modal/impl";
16
- export var ModalDialogMode;
17
- (function (ModalDialogMode) {
18
- ModalDialogMode["NO_BUTTONS"] = "NO_BUTTONS";
19
- ModalDialogMode["OK_CANCEL"] = "OK_CANCEL";
20
- ModalDialogMode["YES_NO"] = "YES_NO";
21
- ModalDialogMode["YES_NO_CANCEL"] = "YES_NO_CANCEL";
22
- ModalDialogMode["OK"] = "OK";
23
- })(ModalDialogMode || (ModalDialogMode = {}));
24
- export class ModalDialog extends React.Component {
25
- constructor(props) {
26
- super(props);
27
- }
28
- static confirm(props) {
29
- let dialogHandler;
30
- const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
31
- dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
32
- });
33
- dialogHandler = Modal.confirm(modalDialogProperties);
34
- return dialogHandler;
35
- }
36
- static error(props) {
37
- let dialogHandler;
38
- const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
39
- dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
40
- });
41
- dialogHandler = Modal.error(modalDialogProperties);
42
- return dialogHandler;
43
- }
44
- static delete(props) {
45
- let dialogHandler;
46
- const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
47
- dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
48
- });
49
- if (props.okButtonProps) {
50
- props.okButtonProps.danger = true;
51
- }
52
- dialogHandler = Modal.confirm(modalDialogProperties);
53
- return dialogHandler;
54
- }
55
- static success(props) {
56
- let dialogHandler;
57
- const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
58
- dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
59
- });
60
- dialogHandler = Modal.success(modalDialogProperties);
61
- return dialogHandler;
62
- }
63
- static info(props) {
64
- let dialogHandler;
65
- const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
66
- dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
67
- });
68
- dialogHandler = Modal.info(modalDialogProperties);
69
- return dialogHandler;
70
- }
71
- render() {
72
- const modalDialogProperties = ModalDialog.getModalProperties(this.props);
73
- return (React.createElement(DraggableModal, Object.assign({}, modalDialogProperties), this.props.children));
74
- }
75
- static getModalProperties(props) {
76
- var _a, _b, _c, _d, _e;
77
- const { mode } = props, rest = __rest(props, ["mode"]);
78
- if (mode === "NO_BUTTONS") {
79
- if (rest.footer === undefined) {
80
- rest.footer = null;
81
- }
82
- }
83
- else {
84
- switch (mode) {
85
- case "OK_CANCEL":
86
- rest.okText = (_a = props.okText) !== null && _a !== void 0 ? _a : i18n("OK");
87
- rest.cancelText = (_b = props.cancelText) !== null && _b !== void 0 ? _b : i18n("Cancel");
88
- break;
89
- case "YES_NO":
90
- rest.okText = (_c = props.okText) !== null && _c !== void 0 ? _c : i18n("Yes");
91
- rest.cancelText = (_d = props.cancelText) !== null && _d !== void 0 ? _d : i18n("No");
92
- break;
93
- case "OK":
94
- rest.okText = (_e = props.okText) !== null && _e !== void 0 ? _e : i18n("OK");
95
- rest.cancelButtonProps = undefined;
96
- break;
97
- }
98
- rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, { style: { marginRight: 8 } });
99
- rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, { style: { float: "right" } });
100
- }
101
- return rest;
102
- }
103
- static getModalFuncProperties(props, performClose) {
104
- var _a, _b, _c, _d, _e, _f, _g;
105
- const { mode, denyText, onDeny } = props, rest = __rest(props, ["mode", "denyText", "onDeny"]);
106
- switch (mode) {
107
- case "OK_CANCEL":
108
- rest.okText = (_a = rest.okText) !== null && _a !== void 0 ? _a : i18n("OK");
109
- rest.cancelText = (_b = rest.cancelText) !== null && _b !== void 0 ? _b : i18n("Cancel");
110
- break;
111
- case "YES_NO":
112
- rest.okText = (_c = rest.okText) !== null && _c !== void 0 ? _c : i18n("Yes");
113
- rest.cancelText = (_d = rest.cancelText) !== null && _d !== void 0 ? _d : i18n("No");
114
- break;
115
- case "YES_NO_CANCEL":
116
- rest.okText = (_e = rest.okText) !== null && _e !== void 0 ? _e : i18n("Yes");
117
- rest.cancelText = (React.createElement(React.Fragment, null,
118
- React.createElement(Button, { onClick: (e) => {
119
- e.preventDefault();
120
- e.stopPropagation();
121
- e.nativeEvent.stopImmediatePropagation();
122
- onDeny === null || onDeny === void 0 ? void 0 : onDeny(e);
123
- performClose();
124
- } }, denyText !== null && denyText !== void 0 ? denyText : i18n("No")),
125
- React.createElement(Button, null, (_f = rest.cancelText) !== null && _f !== void 0 ? _f : i18n("Cancel"))));
126
- if (!rest.cancelButtonProps) {
127
- rest.cancelButtonProps = {};
128
- }
129
- rest.cancelButtonProps.type = "text";
130
- break;
131
- case "OK":
132
- rest.okText = (_g = props.okText) !== null && _g !== void 0 ? _g : i18n("OK");
133
- rest.cancelButtonProps = { style: { display: "none" } };
134
- }
135
- if (rest.autoFocusButton === undefined) {
136
- rest.autoFocusButton = "ok";
137
- }
138
- rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, { style: { marginRight: 8 } });
139
- if (mode !== "OK") {
140
- rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, { style: { float: "right" } });
141
- }
142
- if (mode === "YES_NO_CANCEL") {
143
- if (rest.cancelButtonProps && rest.cancelButtonProps.style) {
144
- rest.cancelButtonProps.style.padding = 0;
145
- rest.cancelButtonProps.style.marginTop = -1;
146
- rest.cancelButtonProps.style.cursor = "default";
147
- rest.cancelButtonProps.style.background = "transparent";
148
- }
149
- }
150
- return rest;
151
- }
152
- }
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 { Button, Modal } from "antd";
14
+ import i18n from "d2core/i18n/i18n";
15
+ import { DraggableModal } from "d2coreui/components/modal/impl";
16
+ export var ModalDialogMode;
17
+ (function (ModalDialogMode) {
18
+ ModalDialogMode["NO_BUTTONS"] = "NO_BUTTONS";
19
+ ModalDialogMode["OK_CANCEL"] = "OK_CANCEL";
20
+ ModalDialogMode["YES_NO"] = "YES_NO";
21
+ ModalDialogMode["YES_NO_CANCEL"] = "YES_NO_CANCEL";
22
+ ModalDialogMode["OK"] = "OK";
23
+ })(ModalDialogMode || (ModalDialogMode = {}));
24
+ export class ModalDialog extends React.Component {
25
+ constructor(props) {
26
+ super(props);
27
+ }
28
+ static confirm(props) {
29
+ let dialogHandler;
30
+ const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
31
+ dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
32
+ });
33
+ dialogHandler = Modal.confirm(modalDialogProperties);
34
+ return dialogHandler;
35
+ }
36
+ static error(props) {
37
+ let dialogHandler;
38
+ const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
39
+ dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
40
+ });
41
+ dialogHandler = Modal.error(modalDialogProperties);
42
+ return dialogHandler;
43
+ }
44
+ static delete(props) {
45
+ let dialogHandler;
46
+ const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
47
+ dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
48
+ });
49
+ if (props.okButtonProps) {
50
+ props.okButtonProps.danger = true;
51
+ }
52
+ dialogHandler = Modal.confirm(modalDialogProperties);
53
+ return dialogHandler;
54
+ }
55
+ static success(props) {
56
+ let dialogHandler;
57
+ const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
58
+ dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
59
+ });
60
+ dialogHandler = Modal.success(modalDialogProperties);
61
+ return dialogHandler;
62
+ }
63
+ static info(props) {
64
+ let dialogHandler;
65
+ const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
66
+ dialogHandler === null || dialogHandler === void 0 ? void 0 : dialogHandler.destroy();
67
+ });
68
+ dialogHandler = Modal.info(modalDialogProperties);
69
+ return dialogHandler;
70
+ }
71
+ render() {
72
+ const modalDialogProperties = ModalDialog.getModalProperties(this.props);
73
+ return (React.createElement(DraggableModal, Object.assign({}, modalDialogProperties), this.props.children));
74
+ }
75
+ static getModalProperties(props) {
76
+ var _a, _b, _c, _d, _e;
77
+ const { mode } = props, rest = __rest(props, ["mode"]);
78
+ if (mode === "NO_BUTTONS") {
79
+ if (rest.footer === undefined) {
80
+ rest.footer = null;
81
+ }
82
+ }
83
+ else {
84
+ switch (mode) {
85
+ case "OK_CANCEL":
86
+ rest.okText = (_a = props.okText) !== null && _a !== void 0 ? _a : i18n("OK");
87
+ rest.cancelText = (_b = props.cancelText) !== null && _b !== void 0 ? _b : i18n("Cancel");
88
+ break;
89
+ case "YES_NO":
90
+ rest.okText = (_c = props.okText) !== null && _c !== void 0 ? _c : i18n("Yes");
91
+ rest.cancelText = (_d = props.cancelText) !== null && _d !== void 0 ? _d : i18n("No");
92
+ break;
93
+ case "OK":
94
+ rest.okText = (_e = props.okText) !== null && _e !== void 0 ? _e : i18n("OK");
95
+ rest.cancelButtonProps = undefined;
96
+ break;
97
+ }
98
+ rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, { style: { marginRight: 8 } });
99
+ rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, { style: { float: "right" } });
100
+ }
101
+ return rest;
102
+ }
103
+ static getModalFuncProperties(props, performClose) {
104
+ var _a, _b, _c, _d, _e, _f, _g;
105
+ const { mode, denyText, onDeny } = props, rest = __rest(props, ["mode", "denyText", "onDeny"]);
106
+ switch (mode) {
107
+ case "OK_CANCEL":
108
+ rest.okText = (_a = rest.okText) !== null && _a !== void 0 ? _a : i18n("OK");
109
+ rest.cancelText = (_b = rest.cancelText) !== null && _b !== void 0 ? _b : i18n("Cancel");
110
+ break;
111
+ case "YES_NO":
112
+ rest.okText = (_c = rest.okText) !== null && _c !== void 0 ? _c : i18n("Yes");
113
+ rest.cancelText = (_d = rest.cancelText) !== null && _d !== void 0 ? _d : i18n("No");
114
+ break;
115
+ case "YES_NO_CANCEL":
116
+ rest.okText = (_e = rest.okText) !== null && _e !== void 0 ? _e : i18n("Yes");
117
+ rest.cancelText = (React.createElement(React.Fragment, null,
118
+ React.createElement(Button, { onClick: (e) => {
119
+ e.preventDefault();
120
+ e.stopPropagation();
121
+ e.nativeEvent.stopImmediatePropagation();
122
+ onDeny === null || onDeny === void 0 ? void 0 : onDeny(e);
123
+ performClose();
124
+ } }, denyText !== null && denyText !== void 0 ? denyText : i18n("No")),
125
+ React.createElement(Button, null, (_f = rest.cancelText) !== null && _f !== void 0 ? _f : i18n("Cancel"))));
126
+ if (!rest.cancelButtonProps) {
127
+ rest.cancelButtonProps = {};
128
+ }
129
+ rest.cancelButtonProps.type = "text";
130
+ break;
131
+ case "OK":
132
+ rest.okText = (_g = props.okText) !== null && _g !== void 0 ? _g : i18n("OK");
133
+ rest.cancelButtonProps = { style: { display: "none" } };
134
+ }
135
+ if (rest.autoFocusButton === undefined) {
136
+ rest.autoFocusButton = "ok";
137
+ }
138
+ rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, { style: { marginRight: 8 } });
139
+ if (mode !== "OK") {
140
+ rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, { style: { float: "right" } });
141
+ }
142
+ if (mode === "YES_NO_CANCEL") {
143
+ if (rest.cancelButtonProps && rest.cancelButtonProps.style) {
144
+ rest.cancelButtonProps.style.padding = 0;
145
+ rest.cancelButtonProps.style.marginTop = -1;
146
+ rest.cancelButtonProps.style.cursor = "default";
147
+ rest.cancelButtonProps.style.background = "transparent";
148
+ }
149
+ }
150
+ return rest;
151
+ }
152
+ }
153
153
  //# sourceMappingURL=modalDialog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"modalDialog.js","sourceRoot":"","sources":["../../../../components/modal/modalDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D,MAAM,CAAN,IAAkB,eAMjB;AAND,WAAkB,eAAe;IAC7B,4CAAyB,CAAA;IACzB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,kDAA+B,CAAA;IAC/B,4BAAS,CAAA;AACb,CAAC,EANiB,eAAe,KAAf,eAAe,QAMhC;AAiBD,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA+B;IAClE,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,KAA2B;QAC7C,IAAI,aAAmF,CAAC;QACxF,MAAM,qBAAqB,GAAG,WAAW,CAAC,sBAAsB,CAAC,KAAK,EAAE,GAAG,EAAE;YACzE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,qBAAqB,CAAC,CAAC;QACrD,OAAO,aAAa,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,KAA2B;QAC3C,IAAI,aAAmF,CAAC;QACxF,MAAM,qBAA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C,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;SACzI;QAED,IAAI,IAAI,oBAAkC,EAAE;YACxC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE;gBACxD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;aAC3D;SACJ;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {Button, Modal} from \"antd\";\nimport {ModalFuncProps, ModalProps} from \"antd/es/Modal\";\nimport i18n from \"d2core/i18n/i18n\";\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\n\nexport const enum ModalDialogMode {\n NO_BUTTONS = \"NO_BUTTONS\",\n OK_CANCEL = \"OK_CANCEL\",\n YES_NO = \"YES_NO\",\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\n OK = \"OK\",\n}\n\nexport interface ModalDialogFuncProps extends ModalFuncProps {\n mode: ModalDialogMode\n denyText?: string\n onDeny?: (...args: any[]) => any;\n}\n\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\n mode: ModalDialogMode\n initialWidth?: number,\n initialHeight?: number\n\n // resize dialog handler\n onResize?(size: { width: number, height: number }): void\n}\n\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\n constructor(props: Readonly<ModalDialogProps>) {\n super(props);\n }\n\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.confirm(modalDialogProperties);\n return dialogHandler;\n }\n\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.error(modalDialogProperties);\n return dialogHandler;\n }\n\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n if (props.okButtonProps) {\n props.okButtonProps.danger = true;\n }\n dialogHandler = Modal.confirm(modalDialogProperties);\n return dialogHandler;\n }\n\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.success(modalDialogProperties);\n return dialogHandler;\n }\n\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\n dialogHandler?.destroy();\n });\n dialogHandler = Modal.info(modalDialogProperties);\n return dialogHandler;\n }\n\n render() {\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\n return (\n <DraggableModal {...modalDialogProperties}>\n {this.props.children}\n </DraggableModal>);\n }\n\n private static getModalProperties(props: ModalDialogProps) {\n const {mode, ...rest} = props;\n if (mode === ModalDialogMode.NO_BUTTONS) {\n if (rest.footer === undefined) {\n rest.footer = null;\n }\n } else {\n switch (mode) {\n case ModalDialogMode.OK_CANCEL:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\n break;\n case ModalDialogMode.YES_NO:\n rest.okText = props.okText ?? i18n(\"Yes\");\n rest.cancelText = props.cancelText ?? i18n(\"No\");\n break;\n case ModalDialogMode.OK:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelButtonProps = undefined;\n break;\n }\n\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\n }\n return rest;\n }\n\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\n const {mode, denyText, onDeny, ...rest} = props;\n switch (mode) {\n case ModalDialogMode.OK_CANCEL:\n rest.okText = rest.okText ?? i18n(\"OK\");\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\n break;\n case ModalDialogMode.YES_NO:\n rest.okText = rest.okText ?? i18n(\"Yes\");\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\n break;\n case ModalDialogMode.YES_NO_CANCEL:\n rest.okText = rest.okText ?? i18n(\"Yes\");\n rest.cancelText = (<React.Fragment>\n <Button onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n e.nativeEvent.stopImmediatePropagation();\n onDeny?.(e);\n performClose();\n }}>{denyText ?? i18n(\"No\")}</Button>\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\n </React.Fragment>\n );\n if (!rest.cancelButtonProps) {\n rest.cancelButtonProps = {};\n }\n rest.cancelButtonProps.type = \"text\";\n break;\n case ModalDialogMode.OK:\n rest.okText = props.okText ?? i18n(\"OK\");\n rest.cancelButtonProps = {style: {display: \"none\"}};\n }\n if (rest.autoFocusButton === undefined) {\n rest.autoFocusButton = \"ok\";\n }\n\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\n\n if (mode !== ModalDialogMode.OK) {\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\n }\n\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\n rest.cancelButtonProps.style.padding = 0;\n rest.cancelButtonProps.style.marginTop = -1;\n rest.cancelButtonProps.style.cursor = \"default\";\n rest.cancelButtonProps.style.background = \"transparent\";\n }\n }\n return rest;\n }\n}"]}
1
+ {"version":3,"file":"modalDialog.js","sourceRoot":"","sources":["../../../../components/modal/modalDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAE,KAAK,EAAC,MAAM,MAAM,CAAC;AAEnC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,gCAAgC,CAAC;AAE9D,MAAM,CAAN,IAAkB,eAMjB;AAND,WAAkB,eAAe;IAC7B,4CAAyB,CAAA;IACzB,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;IACjB,kDAA+B,CAAA;IAC/B,4BAAS,CAAA;AACb,CAAC,EANiB,eAAe,KAAf,eAAe,QAMhC;AAiBD,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA+B;IAClE,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,OAAO,CAAC,KAA2B;QAC7C,IAAI,aAAmF,CAAC;QACxF,MAAM,qBAAqB,GAAG,WAAW,CAAC,sBAAsB,CAAC,KAAK,EAAE,GAAG,EAAE;YACzE,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,EAAE,CAAC;QAC7B,CAAC,CAAC,CAAC;QACH,aA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C,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,WAAW,EAAE,CAAC,EAAC,EAAC,CAAC,CAAC;QAE1H,IAAI,IAAI,SAAuB,EAAE,CAAC;YAC9B,IAAI,CAAC,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC,CAAC;QAC1I,CAAC;QAED,IAAI,IAAI,oBAAkC,EAAE,CAAC;YACzC,IAAI,IAAI,CAAC,iBAAiB,IAAI,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;gBACzD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;gBACzC,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;gBAC5C,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC;gBAChD,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC;YAC5D,CAAC;QACL,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {Button, Modal} from \"antd\";\r\nimport {ModalFuncProps, ModalProps} from \"antd/es/modal\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal} from \"d2coreui/components/modal/impl\";\r\n\r\nexport const enum ModalDialogMode {\r\n NO_BUTTONS = \"NO_BUTTONS\",\r\n OK_CANCEL = \"OK_CANCEL\",\r\n YES_NO = \"YES_NO\",\r\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\r\n OK = \"OK\",\r\n}\r\n\r\nexport interface ModalDialogFuncProps extends ModalFuncProps {\r\n mode: ModalDialogMode\r\n denyText?: string\r\n onDeny?: (...args: any[]) => any;\r\n}\r\n\r\nexport interface ModalDialogProps extends Omit<ModalProps, \"width\"> {\r\n mode: ModalDialogMode\r\n initialWidth?: number,\r\n initialHeight?: number\r\n\r\n // resize dialog handler\r\n onResize?(size: { width: number, height: number }): void\r\n}\r\n\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n public static confirm(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.confirm(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static error(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.error(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static delete(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = Modal.confirm(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static success(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.success(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n public static info(props: ModalDialogFuncProps): { destroy: () => void; update: (newConfig: ModalFuncProps) => void } {\r\n let dialogHandler: { destroy: () => void; update: (newConfig: ModalFuncProps) => void };\r\n const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {\r\n dialogHandler?.destroy();\r\n });\r\n dialogHandler = Modal.info(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n render() {\r\n const modalDialogProperties = ModalDialog.getModalProperties(this.props);\r\n return (\r\n <DraggableModal {...modalDialogProperties}>\r\n {this.props.children}\r\n </DraggableModal>);\r\n }\r\n\r\n private static getModalProperties(props: ModalDialogProps) {\r\n const {mode, ...rest} = props;\r\n if (mode === ModalDialogMode.NO_BUTTONS) {\r\n if (rest.footer === undefined) {\r\n rest.footer = null;\r\n }\r\n } else {\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelText = props.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = props.okText ?? i18n(\"Yes\");\r\n rest.cancelText = props.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = undefined;\r\n break;\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n return rest;\r\n }\r\n\r\n private static getModalFuncProperties(props: ModalDialogFuncProps, performClose: () => void) {\r\n const {mode, denyText, onDeny, ...rest} = props;\r\n switch (mode) {\r\n case ModalDialogMode.OK_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"OK\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"Cancel\");\r\n break;\r\n case ModalDialogMode.YES_NO:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = rest.cancelText ?? i18n(\"No\");\r\n break;\r\n case ModalDialogMode.YES_NO_CANCEL:\r\n rest.okText = rest.okText ?? i18n(\"Yes\");\r\n rest.cancelText = (<React.Fragment>\r\n <Button onClick={(e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n onDeny?.(e);\r\n performClose();\r\n }}>{denyText ?? i18n(\"No\")}</Button>\r\n <Button>{rest.cancelText ?? i18n(\"Cancel\")}</Button>\r\n </React.Fragment>\r\n );\r\n if (!rest.cancelButtonProps) {\r\n rest.cancelButtonProps = {};\r\n }\r\n rest.cancelButtonProps.type = \"text\";\r\n break;\r\n case ModalDialogMode.OK:\r\n rest.okText = props.okText ?? i18n(\"OK\");\r\n rest.cancelButtonProps = {style: {display: \"none\"}};\r\n }\r\n if (rest.autoFocusButton === undefined) {\r\n rest.autoFocusButton = \"ok\";\r\n }\r\n\r\n rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, {style: {marginRight: 8}});\r\n\r\n if (mode !== ModalDialogMode.OK) {\r\n rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, {style: {float: \"right\"}});\r\n }\r\n\r\n if (mode === ModalDialogMode.YES_NO_CANCEL) {\r\n if (rest.cancelButtonProps && rest.cancelButtonProps.style) {\r\n rest.cancelButtonProps.style.padding = 0;\r\n rest.cancelButtonProps.style.marginTop = -1;\r\n rest.cancelButtonProps.style.cursor = \"default\";\r\n rest.cancelButtonProps.style.background = \"transparent\";\r\n }\r\n }\r\n return rest;\r\n }\r\n}"]}
@@ -1,16 +1,16 @@
1
- import React from "react";
2
- import { SelectProps } from "antd";
3
- declare type EnumRepresentation<T extends string> = {
4
- [key in string]: T;
5
- };
6
- export interface EnumValuePickerProps<T extends string> extends Omit<SelectProps<T>, "onChange"> {
7
- allowedValueTypes?: T[];
8
- values: EnumRepresentation<T>;
9
- translateValue?: boolean;
10
- translationPrefix?: string;
11
- onChange(value?: T): void;
12
- }
13
- export default class EnumValuePicker<T extends string> extends React.Component<EnumValuePickerProps<T>, any> {
14
- render(): JSX.Element;
15
- }
16
- export {};
1
+ import React from "react";
2
+ import { SelectProps } from "antd";
3
+ type EnumRepresentation<T extends string> = {
4
+ [key in string]: T;
5
+ };
6
+ export interface EnumValuePickerProps<T extends string> extends Omit<SelectProps<T>, "onChange"> {
7
+ allowedValueTypes?: T[];
8
+ values: EnumRepresentation<T>;
9
+ translateValue?: boolean;
10
+ translationPrefix?: string;
11
+ onChange(value?: T): void;
12
+ }
13
+ export default class EnumValuePicker<T extends string> extends React.Component<EnumValuePickerProps<T>, any> {
14
+ render(): React.JSX.Element;
15
+ }
16
+ export {};
@@ -1,35 +1,35 @@
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 { Select } from "antd";
14
- import i18n from "d2core/i18n/i18n";
15
- export default class EnumValuePicker extends React.Component {
16
- render() {
17
- const _a = this.props, { value, allowedValueTypes, onChange, translationPrefix, values, translateValue } = _a, others = __rest(_a, ["value", "allowedValueTypes", "onChange", "translationPrefix", "values", "translateValue"]);
18
- let selectValue = value;
19
- if (selectValue !== undefined && selectValue !== null && allowedValueTypes) {
20
- if (!allowedValueTypes.includes(selectValue)) {
21
- selectValue = undefined;
22
- }
23
- }
24
- return (React.createElement(Select, Object.assign({ value: selectValue, onChange: (value) => {
25
- onChange(value !== "" ? value : undefined);
26
- } }, others), (allowedValueTypes !== null && allowedValueTypes !== void 0 ? allowedValueTypes : Object.values(values)).map((val) => {
27
- let text = val;
28
- if (translateValue) {
29
- text = i18n(translationPrefix ? translationPrefix + text : text);
30
- }
31
- return (React.createElement(Select.Option, { value: val, key: val }, text));
32
- })));
33
- }
34
- }
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 { Select } from "antd";
14
+ import i18n from "d2core/i18n/i18n";
15
+ export default class EnumValuePicker extends React.Component {
16
+ render() {
17
+ const _a = this.props, { value, allowedValueTypes, onChange, translationPrefix, values, translateValue } = _a, others = __rest(_a, ["value", "allowedValueTypes", "onChange", "translationPrefix", "values", "translateValue"]);
18
+ let selectValue = value;
19
+ if (selectValue !== undefined && selectValue !== null && allowedValueTypes) {
20
+ if (!allowedValueTypes.includes(selectValue)) {
21
+ selectValue = undefined;
22
+ }
23
+ }
24
+ return (React.createElement(Select, Object.assign({ value: selectValue, onChange: (value) => {
25
+ onChange(value !== "" ? value : undefined);
26
+ } }, others), (allowedValueTypes !== null && allowedValueTypes !== void 0 ? allowedValueTypes : Object.values(values)).map((val) => {
27
+ let text = val;
28
+ if (translateValue) {
29
+ text = i18n(translationPrefix ? translationPrefix + text : text);
30
+ }
31
+ return (React.createElement(Select.Option, { value: val, key: val }, text));
32
+ })));
33
+ }
34
+ }
35
35
  //# sourceMappingURL=enumValuePicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"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oBAAC,MAAM,CAAC,MAAM,IAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAC9B,IAAI,CACO,CACnB,CAAC;QACN,CAAC,CAAC,CACG,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from \"react\";\nimport {Select, SelectProps} from \"antd\";\nimport i18n from \"d2core/i18n/i18n\";\n\ntype EnumRepresentation<T extends string> = {[key in string]: T};\n\nexport interface EnumValuePickerProps<T extends string> extends Omit<SelectProps<T>, \"onChange\"> {\n allowedValueTypes?: T[]\n values: EnumRepresentation<T>\n translateValue?: boolean\n translationPrefix?: string\n\n onChange(value?: T): void\n}\n\nexport default class EnumValuePicker<T extends string> extends React.Component<EnumValuePickerProps<T>, any> {\n render() {\n const {value, allowedValueTypes, onChange, translationPrefix, values, translateValue, ...others} = this.props;\n let selectValue: T | null | undefined = value;\n\n if (selectValue !== undefined && selectValue !== null && allowedValueTypes) {\n if (!allowedValueTypes.includes(selectValue)) {\n selectValue = undefined;\n }\n }\n\n return (\n <Select<T> value={selectValue}\n onChange={(value) => {\n onChange(value !== \"\" ? value : undefined);\n }}\n {...others}>\n {(allowedValueTypes ?? Object.values(values) as T[]).map((val) => {\n let text: string = val;\n if (translateValue) {\n text = i18n(translationPrefix ? translationPrefix + text : text);\n }\n\n return (\n <Select.Option value={val} key={val}>\n {text}\n </Select.Option>\n );\n })}\n </Select>\n );\n }\n}"]}
1
+ {"version":3,"file":"enumValuePicker.js","sourceRoot":"","sources":["../../../../components/picker/enumValuePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAc,MAAM,MAAM,CAAC;AACzC,OAAO,IAAI,MAAM,kBAAkB,CAAC;AAapC,MAAM,CAAC,OAAO,OAAO,eAAkC,SAAQ,KAAK,CAAC,SAAuC;IACxG,MAAM;QACF,MAAM,KAA6F,IAAI,CAAC,KAAK,EAAvG,EAAC,KAAK,EAAE,iBAAiB,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,EAAE,cAAc,OAAyB,EAApB,MAAM,cAAzF,2FAA0F,CAAa,CAAC;QAC9G,IAAI,WAAW,GAAyB,KAAK,CAAC;QAE9C,IAAI,WAAW,KAAK,SAAS,IAAI,WAAW,KAAK,IAAI,IAAI,iBAAiB,EAAE,CAAC;YACzE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;gBAC3C,WAAW,GAAG,SAAS,CAAC;YAC5B,CAAC;QACL,CAAC;QAED,OAAO,CACH,oBAAC,MAAM,kBAAI,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE;gBAChB,QAAQ,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YAC/C,CAAC,IACG,MAAM,GAChB,CAAC,iBAAiB,aAAjB,iBAAiB,cAAjB,iBAAiB,GAAI,MAAM,CAAC,MAAM,CAAC,MAAM,CAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YAC7D,IAAI,IAAI,GAAW,GAAG,CAAC;YACvB,IAAI,cAAc,EAAE,CAAC;gBACjB,IAAI,GAAG,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YACrE,CAAC;YAED,OAAO,CACH,oBAAC,MAAM,CAAC,MAAM,IAAC,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAC9B,IAAI,CACO,CACnB,CAAC;QACN,CAAC,CAAC,CACG,CACZ,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {Select, SelectProps} from \"antd\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\n\r\ntype EnumRepresentation<T extends string> = {[key in string]: T};\r\n\r\nexport interface EnumValuePickerProps<T extends string> extends Omit<SelectProps<T>, \"onChange\"> {\r\n allowedValueTypes?: T[]\r\n values: EnumRepresentation<T>\r\n translateValue?: boolean\r\n translationPrefix?: string\r\n\r\n onChange(value?: T): void\r\n}\r\n\r\nexport default class EnumValuePicker<T extends string> extends React.Component<EnumValuePickerProps<T>, any> {\r\n render() {\r\n const {value, allowedValueTypes, onChange, translationPrefix, values, translateValue, ...others} = this.props;\r\n let selectValue: T | null | undefined = value;\r\n\r\n if (selectValue !== undefined && selectValue !== null && allowedValueTypes) {\r\n if (!allowedValueTypes.includes(selectValue)) {\r\n selectValue = undefined;\r\n }\r\n }\r\n\r\n return (\r\n <Select<T> value={selectValue}\r\n onChange={(value) => {\r\n onChange(value !== \"\" ? value : undefined);\r\n }}\r\n {...others}>\r\n {(allowedValueTypes ?? Object.values(values) as T[]).map((val) => {\r\n let text: string = val;\r\n if (translateValue) {\r\n text = i18n(translationPrefix ? translationPrefix + text : text);\r\n }\r\n\r\n return (\r\n <Select.Option value={val} key={val}>\r\n {text}\r\n </Select.Option>\r\n );\r\n })}\r\n </Select>\r\n );\r\n }\r\n}"]}
@@ -1,10 +1,10 @@
1
- export default class PlatformSpecific {
2
- static INSTANCE: PlatformSpecific;
3
- getCurrentWindowName(): string;
4
- configurationChangesDisabled(): boolean;
5
- reloadPageInPredefinedState(): void;
6
- reloadPageInFactoryState(): void;
7
- saveWindowConfiguration(): void;
8
- exportWindowConfiguration(): void;
9
- saveContent(fileName: string, content: string, encodeContent?: boolean): void;
10
- }
1
+ export default class PlatformSpecific {
2
+ static INSTANCE: PlatformSpecific;
3
+ getCurrentWindowName(): string;
4
+ configurationChangesDisabled(): boolean;
5
+ reloadPageInPredefinedState(): void;
6
+ reloadPageInFactoryState(): void;
7
+ saveWindowConfiguration(): void;
8
+ exportWindowConfiguration(): void;
9
+ saveContent(fileName: string, content: string, encodeContent?: boolean): void;
10
+ }