d2coreui 23.0.51 → 23.0.53

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 (281) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +154 -0
  3. package/components/clipboard/clipboardUtils.d.ts +11 -0
  4. package/components/clipboard/clipboardUtils.js +16 -4
  5. package/components/clipboard/clipboardUtils.js.map +1 -1
  6. package/components/codemirror/SyntaxHighlighter.d.ts +13 -0
  7. package/components/codemirror/SyntaxHighlighter.js +6 -1
  8. package/components/codemirror/SyntaxHighlighter.js.map +1 -1
  9. package/components/collapse/expandable.d.ts +10 -0
  10. package/components/collapse/expandable.js +4 -0
  11. package/components/collapse/expandable.js.map +1 -1
  12. package/components/color/colorPicker.d.ts +16 -0
  13. package/components/color/colorPicker.js +4 -0
  14. package/components/color/colorPicker.js.map +1 -1
  15. package/components/color/colorSwatch.d.ts +16 -0
  16. package/components/color/colorSwatch.js +23 -2
  17. package/components/color/colorSwatch.js.map +1 -1
  18. package/components/color/colorUtils.d.ts +9 -0
  19. package/components/color/colorUtils.js +15 -0
  20. package/components/color/colorUtils.js.map +1 -1
  21. package/components/date/dateRangeInput.d.ts +76 -0
  22. package/components/date/dateRangeInput.js +63 -12
  23. package/components/date/dateRangeInput.js.map +1 -1
  24. package/components/date/dateRangeInputAdvancedPanel.d.ts +27 -0
  25. package/components/date/dateRangeInputAdvancedPanel.js +7 -0
  26. package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
  27. package/components/date/dateRangeInputConfirm.d.ts +18 -0
  28. package/components/date/dateRangeInputConfirm.js +12 -0
  29. package/components/date/dateRangeInputConfirm.js.map +1 -1
  30. package/components/date/dateTimeInput.d.ts +99 -0
  31. package/components/date/dateTimeInput.js +78 -6
  32. package/components/date/dateTimeInput.js.map +1 -1
  33. package/components/date/durationInput.d.ts +37 -0
  34. package/components/date/durationInput.js +26 -3
  35. package/components/date/durationInput.js.map +1 -1
  36. package/components/date/savedIntervals.d.ts +63 -0
  37. package/components/date/savedIntervals.js +37 -0
  38. package/components/date/savedIntervals.js.map +1 -1
  39. package/components/date/savedIntervalsDialog.d.ts +13 -0
  40. package/components/date/savedIntervalsDialog.js +7 -2
  41. package/components/date/savedIntervalsDialog.js.map +1 -1
  42. package/components/form/NiceFormItem.d.ts +9 -0
  43. package/components/form/NiceFormItem.js +4 -0
  44. package/components/form/NiceFormItem.js.map +1 -1
  45. package/components/grid/cell/beanAccessor.d.ts +12 -0
  46. package/components/grid/cell/beanAccessor.js +8 -0
  47. package/components/grid/cell/beanAccessor.js.map +1 -1
  48. package/components/grid/cell/bigNumberCellEditor.d.ts +9 -0
  49. package/components/grid/cell/bigNumberCellEditor.js +19 -0
  50. package/components/grid/cell/bigNumberCellEditor.js.map +1 -1
  51. package/components/grid/cell/cellControl.d.ts +4 -0
  52. package/components/grid/cell/cellControl.js +14 -0
  53. package/components/grid/cell/cellControl.js.map +1 -1
  54. package/components/grid/cell/cellEditorUtils.d.ts +6 -0
  55. package/components/grid/cell/cellEditorUtils.js +6 -0
  56. package/components/grid/cell/cellEditorUtils.js.map +1 -1
  57. package/components/grid/cell/customEnumCellEditor.d.ts +6 -0
  58. package/components/grid/cell/customEnumCellEditor.js +10 -0
  59. package/components/grid/cell/customEnumCellEditor.js.map +1 -1
  60. package/components/grid/cell/dataGridCellEditorComponent.d.ts +26 -0
  61. package/components/grid/cell/dataGridCellEditorComponent.js +21 -0
  62. package/components/grid/cell/dataGridCellEditorComponent.js.map +1 -1
  63. package/components/grid/cell/dateCellEditor.d.ts +6 -0
  64. package/components/grid/cell/dateCellEditor.js +10 -0
  65. package/components/grid/cell/dateCellEditor.js.map +1 -1
  66. package/components/grid/cell/dragListenerFeature.d.ts +6 -0
  67. package/components/grid/cell/dragListenerFeature.js +6 -0
  68. package/components/grid/cell/dragListenerFeature.js.map +1 -1
  69. package/components/grid/cell/durationCellEditor.d.ts +6 -0
  70. package/components/grid/cell/durationCellEditor.js +14 -0
  71. package/components/grid/cell/durationCellEditor.js.map +1 -1
  72. package/components/grid/cell/hexaOctetStringCellEditor.d.ts +6 -0
  73. package/components/grid/cell/hexaOctetStringCellEditor.js +14 -0
  74. package/components/grid/cell/hexaOctetStringCellEditor.js.map +1 -1
  75. package/components/grid/cell/hexaValueCellEditor.d.ts +6 -0
  76. package/components/grid/cell/hexaValueCellEditor.js +14 -0
  77. package/components/grid/cell/hexaValueCellEditor.js.map +1 -1
  78. package/components/grid/cell/numberCellEditor.d.ts +6 -0
  79. package/components/grid/cell/numberCellEditor.js +15 -0
  80. package/components/grid/cell/numberCellEditor.js.map +1 -1
  81. package/components/grid/cell/rangeSelector.d.ts +7 -0
  82. package/components/grid/cell/rangeSelector.js +59 -5
  83. package/components/grid/cell/rangeSelector.js.map +1 -1
  84. package/components/grid/cell/simpleStatusTextCellEditor.d.ts +7 -0
  85. package/components/grid/cell/simpleStatusTextCellEditor.js +11 -0
  86. package/components/grid/cell/simpleStatusTextCellEditor.js.map +1 -1
  87. package/components/grid/cell/statusTextCellEditor.d.ts +7 -0
  88. package/components/grid/cell/statusTextCellEditor.js +17 -0
  89. package/components/grid/cell/statusTextCellEditor.js.map +1 -1
  90. package/components/grid/cell/tableDefaultRowStyleRules.d.ts +31 -0
  91. package/components/grid/cell/tableDefaultRowStyleRules.js +5 -0
  92. package/components/grid/cell/tableDefaultRowStyleRules.js.map +1 -1
  93. package/components/grid/cell/textCellEditor.d.ts +6 -0
  94. package/components/grid/cell/textCellEditor.js +15 -0
  95. package/components/grid/cell/textCellEditor.js.map +1 -1
  96. package/components/grid/cell/withAgGridHooks.d.ts +8 -0
  97. package/components/grid/cell/withAgGridHooks.js +8 -0
  98. package/components/grid/cell/withAgGridHooks.js.map +1 -1
  99. package/components/grid/columnUtils.d.ts +7 -0
  100. package/components/grid/columnUtils.js +7 -0
  101. package/components/grid/columnUtils.js.map +1 -1
  102. package/components/grid/config/columnTransfer.d.ts +18 -0
  103. package/components/grid/config/columnTransfer.js +14 -3
  104. package/components/grid/config/columnTransfer.js.map +1 -1
  105. package/components/grid/config/dataGridEditor.d.ts +31 -0
  106. package/components/grid/config/dataGridEditor.js +14 -2
  107. package/components/grid/config/dataGridEditor.js.map +1 -1
  108. package/components/grid/config/rowHeightCalculator.d.ts +11 -0
  109. package/components/grid/config/rowHeightCalculator.js +11 -0
  110. package/components/grid/config/rowHeightCalculator.js.map +1 -1
  111. package/components/grid/config/rowStylePicker.d.ts +19 -0
  112. package/components/grid/config/rowStylePicker.js +12 -0
  113. package/components/grid/config/rowStylePicker.js.map +1 -1
  114. package/components/grid/dataGrid.d.ts +331 -0
  115. package/components/grid/dataGrid.js +168 -11
  116. package/components/grid/dataGrid.js.map +1 -1
  117. package/components/grid/detail/detailHeaderPanel.d.ts +11 -0
  118. package/components/grid/detail/detailHeaderPanel.js +5 -0
  119. package/components/grid/detail/detailHeaderPanel.js.map +1 -1
  120. package/components/grid/export/contextMenu.d.ts +31 -0
  121. package/components/grid/export/contextMenu.js +8 -0
  122. package/components/grid/export/contextMenu.js.map +1 -1
  123. package/components/grid/export/progressPopup.d.ts +21 -0
  124. package/components/grid/export/progressPopup.js +17 -0
  125. package/components/grid/export/progressPopup.js.map +1 -1
  126. package/components/grid/export/worker/pdfExport.js +5 -0
  127. package/components/grid/export/worker/pdfExport.js.map +1 -1
  128. package/components/grid/extendedDataGrid.d.ts +241 -0
  129. package/components/grid/extendedDataGrid.js +121 -2
  130. package/components/grid/extendedDataGrid.js.map +1 -1
  131. package/components/grid/filter/customColumnFilter.d.ts +5 -0
  132. package/components/grid/filter/customColumnFilter.js +5 -0
  133. package/components/grid/filter/customColumnFilter.js.map +1 -1
  134. package/components/grid/filter/dataGridColumnFilter.d.ts +19 -0
  135. package/components/grid/filter/dataGridColumnFilter.js +19 -0
  136. package/components/grid/filter/dataGridColumnFilter.js.map +1 -1
  137. package/components/grid/filter/dateColumnFilter.d.ts +6 -0
  138. package/components/grid/filter/dateColumnFilter.js +6 -0
  139. package/components/grid/filter/dateColumnFilter.js.map +1 -1
  140. package/components/grid/filter/textColumnFilter.d.ts +6 -0
  141. package/components/grid/filter/textColumnFilter.js +6 -0
  142. package/components/grid/filter/textColumnFilter.js.map +1 -1
  143. package/components/grid/filter/wildcardQuickFilterEngine.d.ts +21 -0
  144. package/components/grid/filter/wildcardQuickFilterEngine.js +21 -0
  145. package/components/grid/filter/wildcardQuickFilterEngine.js.map +1 -1
  146. package/components/grid/header/simpleHeader.d.ts +17 -0
  147. package/components/grid/header/simpleHeader.js +20 -0
  148. package/components/grid/header/simpleHeader.js.map +1 -1
  149. package/components/grid/panel/dataGridPagination.d.ts +10 -0
  150. package/components/grid/panel/dataGridPagination.js +5 -0
  151. package/components/grid/panel/dataGridPagination.js.map +1 -1
  152. package/components/grid/panel/loadingOverlay.d.ts +5 -0
  153. package/components/grid/panel/loadingOverlay.js +4 -0
  154. package/components/grid/panel/loadingOverlay.js.map +1 -1
  155. package/components/grid/panel/noRecordsOverlay.d.ts +6 -0
  156. package/components/grid/panel/noRecordsOverlay.js +5 -0
  157. package/components/grid/panel/noRecordsOverlay.js.map +1 -1
  158. package/components/grid/panel/tablePagination.d.ts +4 -0
  159. package/components/grid/panel/tablePagination.js +4 -0
  160. package/components/grid/panel/tablePagination.js.map +1 -1
  161. package/components/icons/dropdownArrow.d.ts +3 -0
  162. package/components/icons/dropdownArrow.js +2 -0
  163. package/components/icons/dropdownArrow.js.map +1 -1
  164. package/components/icons/undoIcon.d.ts +2 -0
  165. package/components/icons/undoIcon.js +2 -0
  166. package/components/icons/undoIcon.js.map +1 -1
  167. package/components/input/autoCompleteInput.d.ts +29 -0
  168. package/components/input/autoCompleteInput.js +7 -0
  169. package/components/input/autoCompleteInput.js.map +1 -1
  170. package/components/input/draftUtils.d.ts +7 -0
  171. package/components/input/draftUtils.js +9 -0
  172. package/components/input/draftUtils.js.map +1 -1
  173. package/components/input/hexaFormattedInput.d.ts +9 -0
  174. package/components/input/hexaFormattedInput.js +3 -0
  175. package/components/input/hexaFormattedInput.js.map +1 -1
  176. package/components/input/mask/helpers.d.ts +27 -0
  177. package/components/input/mask/helpers.js +27 -0
  178. package/components/input/mask/helpers.js.map +1 -1
  179. package/components/input/mask/inputMaskCore.d.ts +80 -0
  180. package/components/input/mask/inputMaskCore.js +90 -0
  181. package/components/input/mask/inputMaskCore.js.map +1 -1
  182. package/components/input/mask/pattern.d.ts +24 -0
  183. package/components/input/mask/pattern.js +26 -0
  184. package/components/input/mask/pattern.js.map +1 -1
  185. package/components/input/maskedInput.d.ts +53 -0
  186. package/components/input/maskedInput.js +44 -4
  187. package/components/input/maskedInput.js.map +1 -1
  188. package/components/input/passwordInput.d.ts +7 -0
  189. package/components/input/passwordInput.js +8 -0
  190. package/components/input/passwordInput.js.map +1 -1
  191. package/components/input/simpleAutoComplete.d.ts +6 -0
  192. package/components/input/simpleAutoComplete.js +6 -0
  193. package/components/input/simpleAutoComplete.js.map +1 -1
  194. package/components/input/textarea/extractSpansOfClasses.d.ts +17 -0
  195. package/components/input/textarea/extractSpansOfClasses.js +26 -1
  196. package/components/input/textarea/extractSpansOfClasses.js.map +1 -1
  197. package/components/input/textarea/getRanges.d.ts +7 -0
  198. package/components/input/textarea/getRanges.js +11 -0
  199. package/components/input/textarea/getRanges.js.map +1 -1
  200. package/components/input/textarea/getType.d.ts +5 -0
  201. package/components/input/textarea/getType.js +5 -0
  202. package/components/input/textarea/getType.js.map +1 -1
  203. package/components/input/textarea/highlighedContents.d.ts +4 -0
  204. package/components/input/textarea/highlighedContents.js +5 -0
  205. package/components/input/textarea/highlighedContents.js.map +1 -1
  206. package/components/input/textarea/mentionsWithHighlighting.d.ts +25 -0
  207. package/components/input/textarea/mentionsWithHighlighting.js +14 -0
  208. package/components/input/textarea/mentionsWithHighlighting.js.map +1 -1
  209. package/components/keyboard/keyboardUtils.d.ts +6 -0
  210. package/components/keyboard/keyboardUtils.js +6 -0
  211. package/components/keyboard/keyboardUtils.js.map +1 -1
  212. package/components/modal/draggableModalProvider.d.ts +6 -0
  213. package/components/modal/draggableModalProvider.js +7 -0
  214. package/components/modal/draggableModalProvider.js.map +1 -1
  215. package/components/modal/impl/clamp.js +1 -0
  216. package/components/modal/impl/clamp.js.map +1 -1
  217. package/components/modal/impl/draggableModal.d.ts +1 -0
  218. package/components/modal/impl/draggableModal.js +6 -0
  219. package/components/modal/impl/draggableModal.js.map +1 -1
  220. package/components/modal/impl/draggableModalContext.js +1 -0
  221. package/components/modal/impl/draggableModalContext.js.map +1 -1
  222. package/components/modal/impl/draggableModalInner.js +12 -1
  223. package/components/modal/impl/draggableModalInner.js.map +1 -1
  224. package/components/modal/impl/draggableModalReducer.d.ts +7 -1
  225. package/components/modal/impl/draggableModalReducer.js +6 -1
  226. package/components/modal/impl/draggableModalReducer.js.map +1 -1
  227. package/components/modal/impl/draggableModalStyles.d.ts +17 -0
  228. package/components/modal/impl/draggableModalStyles.js +157 -126
  229. package/components/modal/impl/draggableModalStyles.js.map +1 -1
  230. package/components/modal/impl/getWindowSize.js +1 -0
  231. package/components/modal/impl/getWindowSize.js.map +1 -1
  232. package/components/modal/impl/index.js +1 -0
  233. package/components/modal/impl/index.js.map +1 -1
  234. package/components/modal/impl/resizeHandle.d.ts +1 -0
  235. package/components/modal/impl/resizeHandle.js +4 -1
  236. package/components/modal/impl/resizeHandle.js.map +1 -1
  237. package/components/modal/impl/useDrag.js +1 -0
  238. package/components/modal/impl/useDrag.js.map +1 -1
  239. package/components/modal/impl/usePrevious.js +1 -0
  240. package/components/modal/impl/usePrevious.js.map +1 -1
  241. package/components/modal/impl/useResize.js +1 -0
  242. package/components/modal/impl/useResize.js.map +1 -1
  243. package/components/modal/modalDialog.d.ts +85 -0
  244. package/components/modal/modalDialog.js +80 -10
  245. package/components/modal/modalDialog.js.map +1 -1
  246. package/components/picker/enumValuePicker.d.ts +17 -0
  247. package/components/picker/enumValuePicker.js +4 -0
  248. package/components/picker/enumValuePicker.js.map +1 -1
  249. package/components/platformSpecific.d.ts +17 -0
  250. package/components/platformSpecific.js +16 -0
  251. package/components/platformSpecific.js.map +1 -1
  252. package/components/scrollTo/onlyText.d.ts +5 -0
  253. package/components/scrollTo/onlyText.js +5 -0
  254. package/components/scrollTo/onlyText.js.map +1 -1
  255. package/components/scrollTo/scrollTo.d.ts +56 -0
  256. package/components/scrollTo/scrollTo.js +40 -3
  257. package/components/scrollTo/scrollTo.js.map +1 -1
  258. package/components/style/withCss.d.ts +15 -0
  259. package/components/style/withCss.js +6 -0
  260. package/components/style/withCss.js.map +1 -1
  261. package/components/table/dragSortingTable.d.ts +15 -0
  262. package/components/table/dragSortingTable.js +12 -0
  263. package/components/table/dragSortingTable.js.map +1 -1
  264. package/components/text/impl/innerSize.js +2 -0
  265. package/components/text/impl/innerSize.js.map +1 -1
  266. package/components/text/impl/series.d.ts +10 -0
  267. package/components/text/impl/series.js +10 -0
  268. package/components/text/impl/series.js.map +1 -1
  269. package/components/text/impl/shallowEqual.js +1 -0
  270. package/components/text/impl/shallowEqual.js.map +1 -1
  271. package/components/text/impl/whilst.d.ts +7 -0
  272. package/components/text/impl/whilst.js +7 -0
  273. package/components/text/impl/whilst.js.map +1 -1
  274. package/components/text/textFit.d.ts +24 -0
  275. package/components/text/textFit.js +29 -1
  276. package/components/text/textFit.js.map +1 -1
  277. package/i18n/componentsLocaleHolder.d.ts +9 -0
  278. package/i18n/componentsLocaleHolder.js +9 -0
  279. package/i18n/componentsLocaleHolder.js.map +1 -1
  280. package/package.json +4 -3
  281. package/style/index.less +240 -240
@@ -1 +1 @@
1
- {"version":3,"file":"draggableModalStyles.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAgBxC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAwB,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC;IACjC,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB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AAO,MAAM,oBAAoB;8BACpC,KAAK,CAAC,QAAQ;;;;;;;;;cAS9B,QAAQ;oCACc,aAAa,CAAC,iBAAiB;;;;;;;;;;;;;;;;cAgBrD,QAAQ;;;;kCAIY,iBAAiB;;SAE1C;QAOD,iBAAiB,EAAE,GAAG,CAAA;cAChB,QAAQ,IAAI,QAAQ;kCACA,KAAK,CAAC,OAAO;;SAEtC;QACD,KAAK,EAAE,GAAG,CAAA;;;;;;;;uBAQK,KAAK,CAAC,OAAO,MAAM,oBAAoB;SACrD;QACD,YAAY,EAAE,GAAG,CAAA;;sBAEH,cAAc;uBACb,cAAc;qBAChB,UAAU;sBACT,UAAU;;SAEvB;QACD,iBAAiB,EAAE,GAAG,CAAA;;qBAET,cAAc,GAAG,KAAK,CAAC,UAAU;sBAChC,cAAc,GAAG,KAAK,CAAC,UAAU;qBAClC,UAAU;sBACT,UAAU;sBACV,KAAK,CAAC,aAAa,MAAM,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB;;;SAG/E;KACJ,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import {createStyles} from \"antd-style\";\n\n/** the antd tokens the header-button geometry is derived from */\ninterface HeaderButtonToken {\n controlHeight: number\n padding: number\n marginXXS: number\n lineHeightHeading5: number\n fontSizeHeading5: number\n}\n\n/**\n * Geometry of the buttons in the top-right corner of the header. Mirrors antd's own close-button\n * math (prepareToken in antd/es/modal/style) so our maximize button lines up with antd's close\n * button, and so the title knows how much room to leave for them.\n */\nexport const headerButtonGeometry = (token: HeaderButtonToken) => {\n const size = token.controlHeight;\n const headerHeight = token.lineHeightHeading5 * token.fontSizeHeading5 + token.padding * 2;\n const inset = (headerHeight - size) / 2;\n const gap = token.marginXXS;\n return {\n /** inset-inline-end of the button sitting left of the close button */\n secondButtonInset: inset + size + gap,\n /** horizontal space the title has to leave free so `count` buttons do not cover it */\n reserve: (count: number): number => count <= 0 ? 0 : inset + count * size + (count - 1) * gap,\n }\n};\n\n/**\n * Styles of the resizable/draggable modal.\n *\n * Only what dragging + resizing actually needs is defined here (flex layout so the body can\n * grow/scroll, the drag cursor on the title, the resize handle). Everything that antd 5 styles\n * through its own Modal tokens - header/footer spacing, title typography - is deliberately NOT\n * overridden, so the dialog looks like a plain antd 5 Modal. The exception is the content inset,\n * see below.\n */\nexport const useDraggableModalStyles = createStyles(({token, css, prefixCls}) => {\n const modalCls = `.${prefixCls}-modal`;\n\n // antd's default horizontal contentPadding, mirrored here because the parts carry it themselves\n const contentPaddingInline = token.paddingContentHorizontalLG;\n\n /*\n * That inset is split between the content and the body. The body is the scroll container, and a\n * scrollbar is always drawn at its border edge - so the content keeps the outer slice to push the\n * body's scrollbars off the dialog edge, and the body keeps the rest as the gap between a\n * scrollbar and the text (which is also what absorbs negative margins, see the body rule).\n */\n const scrollbarInset = token.paddingXS;\n const bodyPaddingInline = contentPaddingInline - scrollbarInset;\n\n const headerButtons = headerButtonGeometry(token);\n\n // the grab area reaches slightly outside the content so it does not sit on top of the footer buttons\n const handleSize = 44;\n const handleOverhang = 10;\n // the visible corner marker inside the grab area\n const markerSize = 12;\n\n return {\n wrap: css`\n overflow: hidden !important;\n\n ${modalCls} {\n display: flex;\n max-width: none;\n transform-origin: 50% 50% !important;\n }\n\n /*\n * rc-dialog puts an unclassed wrapper div between .ant-modal and .ant-modal-content.\n * As a flex item with width:auto it only shrink-wraps its content, so the dialog would\n * not follow the resized width. The focus sentinels matched by the same selector keep\n * their inline width:0, so they are not affected.\n */\n ${modalCls} > div {\n width: 100%;\n }\n\n /* the height comes from the modal state - content has to fill it and lay the parts out vertically */\n ${modalCls}-content {\n display: flex;\n flex-direction: column;\n flex: 1;\n width: 100%;\n height: 100%;\n /*\n * Deliberate deviation from the antd 5 default: the content carries no inset at all.\n * The top one belongs to the title (so the whole header area can be grabbed for\n * dragging) and the bottom one to the footer, which keeps both dividers surrounded by\n * padding instead of glued to the text. Horizontally it keeps only the slice the\n * body's scrollbars are drawn in, so they never sit on the dialog edge.\n */\n padding: 0 ${scrollbarInset}px;\n }\n\n ${modalCls}-header,\n ${modalCls}-footer {\n flex: 0 0 auto;\n /*\n * When the app configures dividers (Modal headerBorderBottom / footerBorderTop\n * tokens - d2ui does), antd draws them on the header/footer box. Bleed the box back\n * out over the content's scrollbar slice so the lines still span the dialog; the\n * title/buttons keep their own full inset and do not move.\n */\n margin-inline: -${scrollbarInset}px;\n }\n\n /*\n * The header contributes no spacing of its own - all of it lives on the drag area inside\n * (see the title style below), so every pixel down to the divider drags the dialog. The gap\n * to the body stays at the antd default (marginXS) and sits below the divider.\n */\n ${modalCls}-header {\n padding: 0;\n margin-bottom: ${token.marginXS}px;\n }\n\n /*\n * Mirror of the header: the footer carries the content's bottom inset itself, so the\n * divider has padding below it instead of sitting right on the buttons. The gap above the\n * divider stays at the antd default (marginSM).\n */\n ${modalCls}-footer {\n padding: ${token.padding}px ${contentPaddingInline}px;\n margin-top: ${token.marginSM}px;\n }\n\n /*\n * The maximize button reuses antd's .ant-modal-close markup so it looks and behaves like\n * the close button next to it (hover, focus ring, icon size); it only gets parked one\n * button width to the left. antd positions the close button with a two-class selector, so\n * this override has to be at least as specific.\n */\n ${modalCls} .ant-design-draggable-modal-maximize {\n inset-inline-end: ${headerButtons.secondButtonInset}px;\n }\n\n /*\n * The only part that shrinks/grows with the dialog; min-height:0 lets it actually shrink\n * in a flex column.\n *\n * Most of the horizontal inset lives here and not on the content on purpose. The body is\n * the scroll container, so anything sticking out of its content box becomes a horizontal\n * scrollbar - and antd's own <Row gutter={n}> does exactly that: it sets\n * margin-inline: -n/2 and is therefore n px wider than its parent (the matching padding\n * on each Col puts the visible content back, so only the scrollbar shows it). With the\n * whole inset on the content the body was flush with its children and every dialog whose\n * form starts with a gutter row had a permanent n/2 px horizontal scrollbar. Owning the\n * padding, the body absorbs those negative margins like a plain antd modal body does.\n */\n ${modalCls}-body {\n flex: 1 1 auto;\n min-height: 0;\n overflow: auto;\n padding-inline: ${bodyPaddingInline}px;\n }\n `,\n /*\n * The bottom inset normally lives on the footer (see above). Dialogs rendered without one -\n * every NO_BUTTONS ModalDialog, and anything passing footer={null} - would otherwise have\n * their content flush against the bottom edge, so the content takes the inset back. The\n * extra selector level is needed to outweigh the padding-block: 0 above.\n */\n wrapWithoutFooter: css`\n ${modalCls} ${modalCls}-content {\n padding-bottom: ${token.padding}px;\n }\n `,\n title: css`\n cursor: move;\n user-select: none;\n /*\n * Carries the whole header inset - the content's vertical padding and the horizontal\n * padding the header would otherwise have - so the entire header area is a drag handle,\n * right up to the dialog edges and down to the divider.\n */\n padding: ${token.padding}px ${contentPaddingInline}px;\n `,\n resizeHandle: css`\n position: absolute;\n right: -${handleOverhang}px;\n bottom: -${handleOverhang}px;\n width: ${handleSize}px;\n height: ${handleSize}px;\n cursor: se-resize;\n `,\n resizeHandleInner: css`\n position: absolute;\n right: ${handleOverhang + token.paddingXXS}px;\n bottom: ${handleOverhang + token.paddingXXS}px;\n width: ${markerSize}px;\n height: ${markerSize}px;\n border: ${token.lineWidthBold}px ${token.lineType} ${token.colorTextTertiary};\n border-top: 0;\n border-left: 0;\n `,\n };\n});\n"]}
1
+ {"version":3,"file":"draggableModalStyles.js","sourceRoot":"","sources":["../../../../../components/modal/impl/draggableModalStyles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAWxC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAwB,EAAE,EAAE;IAC7D,MAAM,IAAI,GAAG,KAAK,CAAC,aAAa,CAAC;IACjC,MAAM,YAAY,GAAG,KAAK,CAAC,kBAAkB,GAAG,KAAK,CAAC,gBAAgB,GAAG,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;IAC3F,MAAM,KAAK,GAAG,CAAC,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,KAAK,CAAC,SAAS,CAAC;IAC5B,OAAO;QACH,sEAAsE;QACtE,iB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QAAQ;;;;kCAIY,iBAAiB;;SAE1C;QACD;;;;;WAKG;QACH,iBAAiB,EAAE,GAAG,CAAA;cAChB,QAAQ,IAAI,QAAQ;kCACA,KAAK,CAAC,OAAO;;SAEtC;QACD,KAAK,EAAE,GAAG,CAAA;;;;;;;;uBAQK,KAAK,CAAC,OAAO,MAAM,oBAAoB;SACrD;QACD,YAAY,EAAE,GAAG,CAAA;;sBAEH,cAAc;uBACb,cAAc;qBAChB,UAAU;sBACT,UAAU;;SAEvB;QACD,iBAAiB,EAAE,GAAG,CAAA;;qBAET,cAAc,GAAG,KAAK,CAAC,UAAU;sBAChC,cAAc,GAAG,KAAK,CAAC,UAAU;qBAClC,UAAU;sBACT,UAAU;sBACV,KAAK,CAAC,aAAa,MAAM,KAAK,CAAC,QAAQ,IAAI,KAAK,CAAC,iBAAiB;;;SAG/E;KACJ,CAAC;AACN,CAAC,CAAC,CAAC","sourcesContent":["import {createStyles} from \"antd-style\";\r\n\r\n/** the antd tokens the header-button geometry is derived from */\r\ninterface HeaderButtonToken {\r\n controlHeight: number\r\n padding: number\r\n marginXXS: number\r\n lineHeightHeading5: number\r\n fontSizeHeading5: number\r\n}\r\n\r\n/**\r\n * Geometry of the buttons in the top-right corner of the header. Mirrors antd's own close-button\r\n * math (prepareToken in antd/es/modal/style) so our maximize button lines up with antd's close\r\n * button, and so the title knows how much room to leave for them.\r\n */\r\nexport const headerButtonGeometry = (token: HeaderButtonToken) => {\r\n const size = token.controlHeight;\r\n const headerHeight = token.lineHeightHeading5 * token.fontSizeHeading5 + token.padding * 2;\r\n const inset = (headerHeight - size) / 2;\r\n const gap = token.marginXXS;\r\n return {\r\n /** inset-inline-end of the button sitting left of the close button */\r\n secondButtonInset: inset + size + gap,\r\n /** horizontal space the title has to leave free so `count` buttons do not cover it */\r\n reserve: (count: number): number => count <= 0 ? 0 : inset + count * size + (count - 1) * gap,\r\n }\r\n};\r\n\r\n/**\r\n * Styles of the resizable/draggable modal.\r\n *\r\n * Only what dragging + resizing actually needs is defined here (flex layout so the body can\r\n * grow/scroll, the drag cursor on the title, the resize handle). Everything that antd 5 styles\r\n * through its own Modal tokens - header/footer spacing, title typography - is deliberately NOT\r\n * overridden, so the dialog looks like a plain antd 5 Modal. The exception is the content inset,\r\n * see below.\r\n */\r\nexport const useDraggableModalStyles = createStyles(({token, css, prefixCls}) => {\r\n const modalCls = `.${prefixCls}-modal`;\r\n\r\n // antd's default horizontal contentPadding, mirrored here because the parts carry it themselves\r\n const contentPaddingInline = token.paddingContentHorizontalLG;\r\n\r\n /*\r\n * That inset is split between the content and the body. The body is the scroll container, and a\r\n * scrollbar is always drawn at its border edge - so the content keeps the outer slice to push the\r\n * body's scrollbars off the dialog edge, and the body keeps the rest as the gap between a\r\n * scrollbar and the text (which is also what absorbs negative margins, see the body rule).\r\n */\r\n const scrollbarInset = token.paddingXS;\r\n const bodyPaddingInline = contentPaddingInline - scrollbarInset;\r\n\r\n const headerButtons = headerButtonGeometry(token);\r\n\r\n // the grab area reaches slightly outside the content so it does not sit on top of the footer buttons\r\n const handleSize = 44;\r\n const handleOverhang = 10;\r\n // the visible corner marker inside the grab area\r\n const markerSize = 12;\r\n\r\n return {\r\n wrap: css`\r\n overflow: hidden !important;\r\n\r\n ${modalCls} {\r\n display: flex;\r\n max-width: none;\r\n transform-origin: 50% 50% !important;\r\n }\r\n\r\n /*\r\n * rc-dialog puts an unclassed wrapper div between .ant-modal and .ant-modal-content.\r\n * As a flex item with width:auto it only shrink-wraps its content, so the dialog would\r\n * not follow the resized width. The focus sentinels matched by the same selector keep\r\n * their inline width:0, so they are not affected.\r\n */\r\n ${modalCls} > div {\r\n width: 100%;\r\n }\r\n\r\n /* the height comes from the modal state - content has to fill it and lay the parts out vertically */\r\n ${modalCls}-content {\r\n display: flex;\r\n flex-direction: column;\r\n flex: 1;\r\n width: 100%;\r\n height: 100%;\r\n /*\r\n * Deliberate deviation from the antd 5 default: the content carries no inset at all.\r\n * The top one belongs to the title (so the whole header area can be grabbed for\r\n * dragging) and the bottom one to the footer, which keeps both dividers surrounded by\r\n * padding instead of glued to the text. Horizontally it keeps only the slice the\r\n * body's scrollbars are drawn in, so they never sit on the dialog edge.\r\n */\r\n padding: 0 ${scrollbarInset}px;\r\n }\r\n\r\n ${modalCls}-header,\r\n ${modalCls}-footer {\r\n flex: 0 0 auto;\r\n /*\r\n * When the app configures dividers (Modal headerBorderBottom / footerBorderTop\r\n * tokens - d2ui does), antd draws them on the header/footer box. Bleed the box back\r\n * out over the content's scrollbar slice so the lines still span the dialog; the\r\n * title/buttons keep their own full inset and do not move.\r\n */\r\n margin-inline: -${scrollbarInset}px;\r\n }\r\n\r\n /*\r\n * The header contributes no spacing of its own - all of it lives on the drag area inside\r\n * (see the title style below), so every pixel down to the divider drags the dialog. The gap\r\n * to the body stays at the antd default (marginXS) and sits below the divider.\r\n */\r\n ${modalCls}-header {\r\n padding: 0;\r\n margin-bottom: ${token.marginXS}px;\r\n }\r\n\r\n /*\r\n * Mirror of the header: the footer carries the content's bottom inset itself, so the\r\n * divider has padding below it instead of sitting right on the buttons. The gap above the\r\n * divider stays at the antd default (marginSM).\r\n */\r\n ${modalCls}-footer {\r\n padding: ${token.padding}px ${contentPaddingInline}px;\r\n margin-top: ${token.marginSM}px;\r\n }\r\n\r\n /*\r\n * The maximize button reuses antd's .ant-modal-close markup so it looks and behaves like\r\n * the close button next to it (hover, focus ring, icon size); it only gets parked one\r\n * button width to the left. antd positions the close button with a two-class selector, so\r\n * this override has to be at least as specific.\r\n */\r\n ${modalCls} .ant-design-draggable-modal-maximize {\r\n inset-inline-end: ${headerButtons.secondButtonInset}px;\r\n }\r\n\r\n /*\r\n * The only part that shrinks/grows with the dialog; min-height:0 lets it actually shrink\r\n * in a flex column.\r\n *\r\n * Most of the horizontal inset lives here and not on the content on purpose. The body is\r\n * the scroll container, so anything sticking out of its content box becomes a horizontal\r\n * scrollbar - and antd's own <Row gutter={n}> does exactly that: it sets\r\n * margin-inline: -n/2 and is therefore n px wider than its parent (the matching padding\r\n * on each Col puts the visible content back, so only the scrollbar shows it). With the\r\n * whole inset on the content the body was flush with its children and every dialog whose\r\n * form starts with a gutter row had a permanent n/2 px horizontal scrollbar. Owning the\r\n * padding, the body absorbs those negative margins like a plain antd modal body does.\r\n */\r\n ${modalCls}-body {\r\n flex: 1 1 auto;\r\n min-height: 0;\r\n overflow: auto;\r\n padding-inline: ${bodyPaddingInline}px;\r\n }\r\n `,\r\n /*\r\n * The bottom inset normally lives on the footer (see above). Dialogs rendered without one -\r\n * every NO_BUTTONS ModalDialog, and anything passing footer={null} - would otherwise have\r\n * their content flush against the bottom edge, so the content takes the inset back. The\r\n * extra selector level is needed to outweigh the padding-block: 0 above.\r\n */\r\n wrapWithoutFooter: css`\r\n ${modalCls} ${modalCls}-content {\r\n padding-bottom: ${token.padding}px;\r\n }\r\n `,\r\n title: css`\r\n cursor: move;\r\n user-select: none;\r\n /*\r\n * Carries the whole header inset - the content's vertical padding and the horizontal\r\n * padding the header would otherwise have - so the entire header area is a drag handle,\r\n * right up to the dialog edges and down to the divider.\r\n */\r\n padding: ${token.padding}px ${contentPaddingInline}px;\r\n `,\r\n resizeHandle: css`\r\n position: absolute;\r\n right: -${handleOverhang}px;\r\n bottom: -${handleOverhang}px;\r\n width: ${handleSize}px;\r\n height: ${handleSize}px;\r\n cursor: se-resize;\r\n `,\r\n resizeHandleInner: css`\r\n position: absolute;\r\n right: ${handleOverhang + token.paddingXXS}px;\r\n bottom: ${handleOverhang + token.paddingXXS}px;\r\n width: ${markerSize}px;\r\n height: ${markerSize}px;\r\n border: ${token.lineWidthBold}px ${token.lineType} ${token.colorTextTertiary};\r\n border-top: 0;\r\n border-left: 0;\r\n `,\r\n };\r\n});\r\n"]}
@@ -1,3 +1,4 @@
1
+ // https://github.com/CUBETIQ/antd-modal/
1
2
  export const getWindowSize = () => ({
2
3
  width: window.innerWidth || 0,
3
4
  height: window.innerHeight || 0,
@@ -1 +1 @@
1
- {"version":3,"file":"getWindowSize.js","sourceRoot":"","sources":["../../../../../components/modal/impl/getWindowSize.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,aAAa,GAAG,GAAsC,EAAE,CAAC,CAAC;IACnE,KAAK,EAAE,MAAM,CAAC,UAAU,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,WAAW,IAAI,CAAC;CAClC,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nexport const getWindowSize = (): { width: number; height: number } => ({\r\n width: window.innerWidth || 0,\r\n height: window.innerHeight || 0,\r\n})\r\n"]}
1
+ {"version":3,"file":"getWindowSize.js","sourceRoot":"","sources":["../../../../../components/modal/impl/getWindowSize.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAsC,EAAE,CAAC,CAAC;IACnE,KAAK,EAAE,MAAM,CAAC,UAAU,IAAI,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC,WAAW,IAAI,CAAC;CAClC,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nexport const getWindowSize = (): { width: number; height: number } => ({\r\n width: window.innerWidth || 0,\r\n height: window.innerHeight || 0,\r\n})\r\n"]}
@@ -1,3 +1,4 @@
1
+ // https://github.com/CUBETIQ/antd-modal/
1
2
  export * from './draggableModal';
2
3
  export * from './draggableModalContext';
3
4
  export * from '../draggableModalProvider';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../components/modal/impl/index.ts"],"names":[],"mappings":"AAEA,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nexport * from './draggableModal'\r\nexport * from './draggableModalContext'\r\nexport * from '../draggableModalProvider'\r\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../components/modal/impl/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,cAAc,kBAAkB,CAAA;AAChC,cAAc,yBAAyB,CAAA;AACvC,cAAc,2BAA2B,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nexport * from './draggableModal'\r\nexport * from './draggableModalContext'\r\nexport * from '../draggableModalProvider'\r\n"]}
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  export interface ResizeHandleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
3
+ /** class of the visible corner marker inside the grab area */
3
4
  innerClassName?: string;
4
5
  }
5
6
  export declare const ResizeHandle: ({ className, innerClassName, ...props }: ResizeHandleProps) => React.ReactElement;
@@ -1,3 +1,4 @@
1
+ // https://github.com/CUBETIQ/antd-modal/
1
2
  var __rest = (this && this.__rest) || function (s, e) {
2
3
  var t = {};
3
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -12,7 +13,9 @@ var __rest = (this && this.__rest) || function (s, e) {
12
13
  import * as React from 'react';
13
14
  export const ResizeHandle = (_a) => {
14
15
  var { className, innerClassName } = _a, props = __rest(_a, ["className", "innerClassName"]);
15
- return (React.createElement("div", Object.assign({ className: `ant-design-draggable-modal-resize-handle ${className !== null && className !== void 0 ? className : ''}` }, props),
16
+ return (
17
+ // the legacy class names are kept as styling hooks for the app (e.g. .compact-modal)
18
+ React.createElement("div", Object.assign({ className: `ant-design-draggable-modal-resize-handle ${className !== null && className !== void 0 ? className : ''}` }, props),
16
19
  React.createElement("div", { className: `ant-design-draggable-modal-resize-handle-inner ${innerClassName !== null && innerClassName !== void 0 ? innerClassName : ''}` })));
17
20
  };
18
21
  //# sourceMappingURL=resizeHandle.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resizeHandle.js","sourceRoot":"","sources":["../../../../../components/modal/impl/resizeHandle.tsx"],"names":[],"mappings":";;;;;;;;;;;AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAwD,EAAsB,EAAE;QAAhF,EAAC,SAAS,EAAE,cAAc,OAA8B,EAAzB,KAAK,cAApC,+BAAqC,CAAD;IAA6C,OAAA,CAE1G,2CAAK,SAAS,EAAE,4CAA4C,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE,IAAM,KAAK;QACpF,6BAAK,SAAS,EAAE,kDAAkD,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,EAAE,EAAE,GAAG,CACzF,CACT,CAAA;CAAA,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\n\nimport * as React from 'react'\n\nexport interface ResizeHandleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {\n /** class of the visible corner marker inside the grab area */\n innerClassName?: string\n}\n\nexport const ResizeHandle = ({className, innerClassName, ...props}: ResizeHandleProps): React.ReactElement => (\n // the legacy class names are kept as styling hooks for the app (e.g. .compact-modal)\n <div className={`ant-design-draggable-modal-resize-handle ${className ?? ''}`} {...props}>\n <div className={`ant-design-draggable-modal-resize-handle-inner ${innerClassName ?? ''}`}/>\n </div>\n)\n"]}
1
+ {"version":3,"file":"resizeHandle.js","sourceRoot":"","sources":["../../../../../components/modal/impl/resizeHandle.tsx"],"names":[],"mappings":"AAAA,yCAAyC;;;;;;;;;;;;AAEzC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAwD,EAAsB,EAAE;QAAhF,EAAC,SAAS,EAAE,cAAc,OAA8B,EAAzB,KAAK,cAApC,+BAAqC,CAAD;IAA6C,OAAA;IAC1G,qFAAqF;IACrF,2CAAK,SAAS,EAAE,4CAA4C,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,EAAE,IAAM,KAAK;QACpF,6BAAK,SAAS,EAAE,kDAAkD,cAAc,aAAd,cAAc,cAAd,cAAc,GAAI,EAAE,EAAE,GAAG,CACzF,CACT,CAAA;CAAA,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\n\r\nexport interface ResizeHandleProps extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {\r\n /** class of the visible corner marker inside the grab area */\r\n innerClassName?: string\r\n}\r\n\r\nexport const ResizeHandle = ({className, innerClassName, ...props}: ResizeHandleProps): React.ReactElement => (\r\n // the legacy class names are kept as styling hooks for the app (e.g. .compact-modal)\r\n <div className={`ant-design-draggable-modal-resize-handle ${className ?? ''}`} {...props}>\r\n <div className={`ant-design-draggable-modal-resize-handle-inner ${innerClassName ?? ''}`}/>\r\n </div>\r\n)\r\n"]}
@@ -1,3 +1,4 @@
1
+ // https://github.com/CUBETIQ/antd-modal/
1
2
  import { useCallback, useEffect, useState } from 'react';
2
3
  export const useDrag = (x, y, onDrag) => {
3
4
  const [dragging, setDragging] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"file":"useDrag.js","sourceRoot":"","sources":["../../../../../components/modal/impl/useDrag.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAEtD,MAAM,CAAC,MAAM,OAAO,GAAG,CACnB,CAAS,EACT,CAAS,EACT,MAAgD,EACjB,EAAE;IACjC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAA;IAC/C,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC;QACrD,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;KAChB,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,CAAmB,EAAE,EAAE;QACpB,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,mBAA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AG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,OAAO,WAAW,CAAA;AACtB,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {useCallback, useEffect, useState} from 'react'\r\n\r\nexport const useDrag = (\r\n x: number,\r\n y: number,\r\n onDrag: (args: { x: number; y: number }) => void,\r\n): ((e: React.MouseEvent) => void) => {\r\n const [dragging, setDragging] = useState(false)\r\n const [initialDragState, setInitialDragState] = useState({\r\n initX: 0,\r\n initY: 0,\r\n mouseDownX: 0,\r\n mouseDownY: 0,\r\n })\r\n\r\n const onMouseDown = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.preventDefault()\r\n setInitialDragState({\r\n initX: x,\r\n initY: y,\r\n mouseDownX: e.clientX,\r\n mouseDownY: e.clientY,\r\n })\r\n setDragging(true)\r\n },\r\n [x, y, setDragging, setInitialDragState],\r\n )\r\n\r\n useEffect(() => {\r\n const onMouseMove = (e: MouseEvent): void => {\r\n if (dragging) {\r\n const { initX, mouseDownX, initY, mouseDownY } = initialDragState\r\n let dx = e.clientX - mouseDownX\r\n let dy = e.clientY - mouseDownY\r\n const x = initX + dx\r\n const y = initY + dy\r\n onDrag({ x, y })\r\n }\r\n }\r\n window.addEventListener('mousemove', onMouseMove, { passive: true })\r\n return () => window.removeEventListener('mousemove', onMouseMove)\r\n }, [initialDragState, dragging, onDrag])\r\n\r\n useEffect(() => {\r\n const onMouseUp = (): void => {\r\n setDragging(false)\r\n }\r\n window.addEventListener('mouseup', onMouseUp)\r\n return () => window.removeEventListener('mouseup', onMouseUp)\r\n }, [setDragging])\r\n\r\n return onMouseDown\r\n}\r\n"]}
1
+ {"version":3,"file":"useDrag.js","sourceRoot":"","sources":["../../../../../components/modal/impl/useDrag.ts"],"names":[],"mappings":"AAAA,yCAAyC;AA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AE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;YACpB,CAAC;QACL,CAAC,CAAA;QACD,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAA;QACpE,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;IACrE,CAAC,EAAE,CAAC,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAA;IAExC,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,SAAS,GAAG,GAAS,EAAE;YACzB,WAAW,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,CAAA;QACD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;QAC7C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,OAAO,WAAW,CAAA;AACtB,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {useCallback, useEffect, useState} from 'react'\r\n\r\nexport const useDrag = (\r\n x: number,\r\n y: number,\r\n onDrag: (args: { x: number; y: number }) => void,\r\n): ((e: React.MouseEvent) => void) => {\r\n const [dragging, setDragging] = useState(false)\r\n const [initialDragState, setInitialDragState] = useState({\r\n initX: 0,\r\n initY: 0,\r\n mouseDownX: 0,\r\n mouseDownY: 0,\r\n })\r\n\r\n const onMouseDown = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.preventDefault()\r\n setInitialDragState({\r\n initX: x,\r\n initY: y,\r\n mouseDownX: e.clientX,\r\n mouseDownY: e.clientY,\r\n })\r\n setDragging(true)\r\n },\r\n [x, y, setDragging, setInitialDragState],\r\n )\r\n\r\n useEffect(() => {\r\n const onMouseMove = (e: MouseEvent): void => {\r\n if (dragging) {\r\n const { initX, mouseDownX, initY, mouseDownY } = initialDragState\r\n let dx = e.clientX - mouseDownX\r\n let dy = e.clientY - mouseDownY\r\n const x = initX + dx\r\n const y = initY + dy\r\n onDrag({ x, y })\r\n }\r\n }\r\n window.addEventListener('mousemove', onMouseMove, { passive: true })\r\n return () => window.removeEventListener('mousemove', onMouseMove)\r\n }, [initialDragState, dragging, onDrag])\r\n\r\n useEffect(() => {\r\n const onMouseUp = (): void => {\r\n setDragging(false)\r\n }\r\n window.addEventListener('mouseup', onMouseUp)\r\n return () => window.removeEventListener('mouseup', onMouseUp)\r\n }, [setDragging])\r\n\r\n return onMouseDown\r\n}\r\n"]}
@@ -1,3 +1,4 @@
1
+ // https://github.com/CUBETIQ/antd-modal/
1
2
  import { useEffect, useRef } from 'react';
2
3
  export const usePrevious = (value) => {
3
4
  const ref = useRef(value);
@@ -1 +1 @@
1
- {"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../../../../components/modal/impl/usePrevious.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAA;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,KAAQ,EAAK,EAAE;IAC1C,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAA;IAC5B,SAAS,CAAC,GAAG,EAAE;QACX,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;IACvB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACX,OAAO,GAAG,CAAC,OAAO,CAAA;AACtB,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport {useEffect, useRef} from 'react'\r\n\r\nexport const usePrevious = <T>(value: T): T => {\r\n const ref = useRef<T>(value)\r\n useEffect(() => {\r\n ref.current = value\r\n }, [value])\r\n return ref.current\r\n}\r\n"]}
1
+ {"version":3,"file":"usePrevious.js","sourceRoot":"","sources":["../../../../../components/modal/impl/usePrevious.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,OAAO,EAAC,SAAS,EAAE,MAAM,EAAC,MAAM,OAAO,CAAA;AAEvC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAI,KAAQ,EAAK,EAAE;IAC1C,MAAM,GAAG,GAAG,MAAM,CAAI,KAAK,CAAC,CAAA;IAC5B,SAAS,CAAC,GAAG,EAAE;QACX,GAAG,CAAC,OAAO,GAAG,KAAK,CAAA;IACvB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAA;IACX,OAAO,GAAG,CAAC,OAAO,CAAA;AACtB,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport {useEffect, useRef} from 'react'\r\n\r\nexport const usePrevious = <T>(value: T): T => {\r\n const ref = useRef<T>(value)\r\n useEffect(() => {\r\n ref.current = value\r\n }, [value])\r\n return ref.current\r\n}\r\n"]}
@@ -1,3 +1,4 @@
1
+ // https://github.com/CUBETIQ/antd-modal/
1
2
  import { useCallback, useEffect, useState } from 'react';
2
3
  export const useResize = (x, y, width, height, onResize) => {
3
4
  const [dragging, setDragging] = useState(false);
@@ -1 +1 @@
1
- {"version":3,"file":"useResize.js","sourceRoot":"","sources":["../../../../../components/modal/impl/useResize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAWtD,MAAM,CAAC,MAAM,SAAS,GAAG,CACrB,CAAS,EACT,CAAS,EACT,KAAa,EACb,MAAc,EACd,QAAiF,EAClD,EAAE;IACjC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAe;QACnE,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,CAAC;Q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C,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;IACrE,CAAC,EAAE,CAAC,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;IAE1C,SAAS,CAAC,GAAG,EAAE;QACX,MAAM,SAAS,GAAG,GAAS,EAAE;YACzB,WAAW,CAAC,KAAK,CAAC,CAAA;QACtB,CAAC,CAAA;QACD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,OAAO,WAAW,CAAA;AACtB,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {useCallback, useEffect, useState} from 'react'\r\n\r\ninterface InitialState {\r\n initX: number\r\n initY: number\r\n initWidth: number\r\n initHeight: number\r\n mouseDownX: number\r\n mouseDownY: number\r\n}\r\n\r\nexport const useResize = (\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n onResize: (args: { x: number; y: number; width: number; height: number }) => void,\r\n): ((e: React.MouseEvent) => void) => {\r\n const [dragging, setDragging] = useState(false);\r\n const [initialDragState, setInitialDragState] = useState<InitialState>({\r\n initX: 0,\r\n initY: 0,\r\n initWidth: 0,\r\n initHeight: 0,\r\n mouseDownX: 0,\r\n mouseDownY: 0,\r\n })\r\n\r\n const onMouseDown = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.preventDefault()\r\n setInitialDragState({\r\n initX: x,\r\n initY: y,\r\n initWidth: width,\r\n initHeight: height,\r\n mouseDownX: e.clientX,\r\n mouseDownY: e.clientY,\r\n })\r\n setDragging(true)\r\n },\r\n [width, height, setDragging, setInitialDragState, x, y],\r\n )\r\n\r\n useEffect(() => {\r\n const onMouseMove = (e: MouseEvent): void => {\r\n if (dragging) {\r\n const {\r\n initX,\r\n initY,\r\n initWidth,\r\n mouseDownX,\r\n initHeight,\r\n mouseDownY,\r\n } = initialDragState\r\n let dx = e.clientX - mouseDownX\r\n let dy = e.clientY - mouseDownY\r\n const width = initWidth + dx;\r\n const height = initHeight + dy;\r\n return onResize({ x: initX, y: initY, width, height })\r\n }\r\n }\r\n window.addEventListener('mousemove', onMouseMove, { passive: true })\r\n return () => window.removeEventListener('mousemove', onMouseMove)\r\n }, [initialDragState, dragging, onResize])\r\n\r\n useEffect(() => {\r\n const onMouseUp = (): void => {\r\n setDragging(false)\r\n }\r\n window.addEventListener('mouseup', onMouseUp);\r\n return () => window.removeEventListener('mouseup', onMouseUp)\r\n }, [setDragging])\r\n\r\n return onMouseDown\r\n}\r\n"]}
1
+ {"version":3,"file":"useResize.js","sourceRoot":"","sources":["../../../../../components/modal/impl/useResize.ts"],"names":[],"mappings":"AAAA,yCAAyC;AAGzC,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAA;AAWtD,MAAM,CAAC,MAAM,SAAS,GAAG,CACrB,CAAS,EACT,CAAS,EACT,KAAa,EACb,MAAc,EACd,QAAiF,EAClD,EAAE;IACjC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAe;QACnE,KAAK,EAAE,CAAC;QACR,KAAK,EAAE,CAAC;QACR,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;QACb,UAAU,EAAE,CAAC;KAChB,CAAC,CAAA;IAEF,MAAM,WAAW,GAAG,WAAW,CAC3B,CAAC,CAAmB,EAAE,EAAE;QACpB,CAAC,CAAC,cAAc,EAAE,CAAA;QAClB,mBAAmB,CAAC;YAChB,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,CAAC;YACR,SAA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,CAAA;QACD,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;IACjE,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAA;IAEjB,OAAO,WAAW,CAAA;AACtB,CAAC,CAAA","sourcesContent":["// https://github.com/CUBETIQ/antd-modal/\r\n\r\nimport * as React from 'react'\r\nimport {useCallback, useEffect, useState} from 'react'\r\n\r\ninterface InitialState {\r\n initX: number\r\n initY: number\r\n initWidth: number\r\n initHeight: number\r\n mouseDownX: number\r\n mouseDownY: number\r\n}\r\n\r\nexport const useResize = (\r\n x: number,\r\n y: number,\r\n width: number,\r\n height: number,\r\n onResize: (args: { x: number; y: number; width: number; height: number }) => void,\r\n): ((e: React.MouseEvent) => void) => {\r\n const [dragging, setDragging] = useState(false);\r\n const [initialDragState, setInitialDragState] = useState<InitialState>({\r\n initX: 0,\r\n initY: 0,\r\n initWidth: 0,\r\n initHeight: 0,\r\n mouseDownX: 0,\r\n mouseDownY: 0,\r\n })\r\n\r\n const onMouseDown = useCallback(\r\n (e: React.MouseEvent) => {\r\n e.preventDefault()\r\n setInitialDragState({\r\n initX: x,\r\n initY: y,\r\n initWidth: width,\r\n initHeight: height,\r\n mouseDownX: e.clientX,\r\n mouseDownY: e.clientY,\r\n })\r\n setDragging(true)\r\n },\r\n [width, height, setDragging, setInitialDragState, x, y],\r\n )\r\n\r\n useEffect(() => {\r\n const onMouseMove = (e: MouseEvent): void => {\r\n if (dragging) {\r\n const {\r\n initX,\r\n initY,\r\n initWidth,\r\n mouseDownX,\r\n initHeight,\r\n mouseDownY,\r\n } = initialDragState\r\n let dx = e.clientX - mouseDownX\r\n let dy = e.clientY - mouseDownY\r\n const width = initWidth + dx;\r\n const height = initHeight + dy;\r\n return onResize({ x: initX, y: initY, width, height })\r\n }\r\n }\r\n window.addEventListener('mousemove', onMouseMove, { passive: true })\r\n return () => window.removeEventListener('mousemove', onMouseMove)\r\n }, [initialDragState, dragging, onResize])\r\n\r\n useEffect(() => {\r\n const onMouseUp = (): void => {\r\n setDragging(false)\r\n }\r\n window.addEventListener('mouseup', onMouseUp);\r\n return () => window.removeEventListener('mouseup', onMouseUp)\r\n }, [setDragging])\r\n\r\n return onMouseDown\r\n}\r\n"]}
@@ -2,41 +2,126 @@ import React from "react";
2
2
  import { ModalFuncProps } from "antd/es/modal";
3
3
  import { DraggableModalProps } from "d2coreui/components/modal/impl";
4
4
  import { HookAPI } from "antd/es/modal/useModal";
5
+ /**
6
+ * Button set of a {@link ModalDialog}. Button labels are localized and can be overridden with `okText` /
7
+ * `cancelText` (and `denyText`).
8
+ */
5
9
  export declare const enum ModalDialogMode {
10
+ /**
11
+ * No footer, unless a `footer` is given explicitly. Honored only by the component; the static methods show
12
+ * antd's default buttons.
13
+ */
6
14
  NO_BUTTONS = "NO_BUTTONS",
15
+ /** "OK" and "Cancel" buttons. */
7
16
  OK_CANCEL = "OK_CANCEL",
17
+ /** "Yes" and "No" buttons; "No" acts as cancel. */
8
18
  YES_NO = "YES_NO",
19
+ /**
20
+ * "Yes", "No" and "Cancel" buttons: "Yes" calls `onOk`, "No" calls `onDeny` and "Cancel" `onCancel`.
21
+ * Supported only by the static methods; the component renders antd's default buttons in this mode.
22
+ */
9
23
  YES_NO_CANCEL = "YES_NO_CANCEL",
24
+ /** Only an "OK" button (see the note at {@link ModalDialog} about the component). */
10
25
  OK = "OK"
11
26
  }
27
+ /**
28
+ * Options of the static {@link ModalDialog} methods: antd `ModalFuncProps` plus the button mode.
29
+ * `autoFocusButton` defaults to `"ok"`.
30
+ */
12
31
  export interface ModalDialogFuncProps extends ModalFuncProps {
32
+ /** Button set of the dialog. */
13
33
  mode: ModalDialogMode;
34
+ /** Label of the "No" button in {@link ModalDialogMode.YES_NO_CANCEL} mode; defaults to localized "No". */
14
35
  denyText?: string;
36
+ /**
37
+ * Called with the click event when the "No" button is clicked in {@link ModalDialogMode.YES_NO_CANCEL} mode;
38
+ * the dialog is closed afterwards.
39
+ */
15
40
  onDeny?: (...args: any[]) => any;
16
41
  }
42
+ /**
43
+ * Props of the {@link ModalDialog} component: antd `ModalProps` (except `width`) plus `initialWidth`,
44
+ * `initialHeight`, `maximizable` and `onResize` of the draggable modal, and the button mode.
45
+ */
17
46
  export interface ModalDialogProps extends DraggableModalProps {
47
+ /** Button set of the dialog. */
18
48
  mode: ModalDialogMode;
19
49
  }
50
+ /**
51
+ * Dialog with a predefined, localized button set (see {@link ModalDialogMode}).
52
+ *
53
+ * As a component it renders a draggable (by the title), resizable (bottom-right handle) and maximizable antd
54
+ * `Modal` that is kept inside the window and destroyed when hidden. It must be rendered inside a
55
+ * `DraggableModalProvider` (`d2coreui/components/modal/draggableModalProvider`), otherwise it throws.
56
+ * Note that in {@link ModalDialogMode.OK} mode the component still renders the Cancel button; only the static
57
+ * methods hide it.
58
+ *
59
+ * The static methods open imperative antd dialogs; register the app's modal API once with
60
+ * {@link ModalDialog.setModalInstance}. They modify the passed `okButtonProps` / `cancelButtonProps` objects and
61
+ * replace their `style`.
62
+ *
63
+ * @example
64
+ * <DraggableModalProvider>
65
+ * <ModalDialog mode={ModalDialogMode.OK_CANCEL} open={open} title="Rename"
66
+ * initialWidth={480} initialHeight={240}
67
+ * onOk={save} onCancel={() => setOpen(false)}>
68
+ * <Input value={name} onChange={e => setName(e.target.value)}/>
69
+ * </ModalDialog>
70
+ * </DraggableModalProvider>
71
+ *
72
+ * @example
73
+ * ModalDialog.confirm({
74
+ * mode: ModalDialogMode.YES_NO_CANCEL,
75
+ * title: "Save changes?",
76
+ * onOk: save,
77
+ * onDeny: discard,
78
+ * });
79
+ */
20
80
  export declare class ModalDialog extends React.Component<ModalDialogProps, {}> {
21
81
  private static modalStatic;
22
82
  constructor(props: Readonly<ModalDialogProps>);
83
+ /**
84
+ * Registers the antd `modal` API from `App.useApp()` for the static methods, so that their dialogs inherit the app's
85
+ * theme, locale and context. Until it is called they fall back to antd's static `Modal` functions.
86
+ */
23
87
  static setModalInstance(instance: HookAPI): void;
88
+ /**
89
+ * Opens a confirmation dialog (antd `confirm`) with the buttons of `props.mode`.
90
+ * @returns a handle to close or update the dialog.
91
+ */
24
92
  static confirm(props: ModalDialogFuncProps): {
25
93
  destroy: () => void;
26
94
  update: (newConfig: ModalFuncProps) => void;
27
95
  };
96
+ /**
97
+ * Opens an error dialog (antd `error`) with the buttons of `props.mode`.
98
+ * @returns a handle to close or update the dialog.
99
+ */
28
100
  static error(props: ModalDialogFuncProps): {
29
101
  destroy: () => void;
30
102
  update: (newConfig: ModalFuncProps) => void;
31
103
  };
104
+ /**
105
+ * Opens a confirmation dialog like {@link ModalDialog.confirm} with a danger OK button. The button is marked as
106
+ * danger only when `props.okButtonProps` is passed (an empty object is enough).
107
+ * @returns a handle to close or update the dialog.
108
+ */
32
109
  static delete(props: ModalDialogFuncProps): {
33
110
  destroy: () => void;
34
111
  update: (newConfig: ModalFuncProps) => void;
35
112
  };
113
+ /**
114
+ * Opens a success dialog (antd `success`) with the buttons of `props.mode`.
115
+ * @returns a handle to close or update the dialog.
116
+ */
36
117
  static success(props: ModalDialogFuncProps): {
37
118
  destroy: () => void;
38
119
  update: (newConfig: ModalFuncProps) => void;
39
120
  };
121
+ /**
122
+ * Opens an information dialog (antd `info`) with the buttons of `props.mode`.
123
+ * @returns a handle to close or update the dialog.
124
+ */
40
125
  static info(props: ModalDialogFuncProps): {
41
126
  destroy: () => void;
42
127
  update: (newConfig: ModalFuncProps) => void;
@@ -13,21 +13,74 @@ import React from "react";
13
13
  import { Button, Modal } from "antd";
14
14
  import i18n from "d2core/i18n/i18n";
15
15
  import { DraggableModal } from "d2coreui/components/modal/impl";
16
+ /**
17
+ * Button set of a {@link ModalDialog}. Button labels are localized and can be overridden with `okText` /
18
+ * `cancelText` (and `denyText`).
19
+ */
16
20
  export var ModalDialogMode;
17
21
  (function (ModalDialogMode) {
22
+ /**
23
+ * No footer, unless a `footer` is given explicitly. Honored only by the component; the static methods show
24
+ * antd's default buttons.
25
+ */
18
26
  ModalDialogMode["NO_BUTTONS"] = "NO_BUTTONS";
27
+ /** "OK" and "Cancel" buttons. */
19
28
  ModalDialogMode["OK_CANCEL"] = "OK_CANCEL";
29
+ /** "Yes" and "No" buttons; "No" acts as cancel. */
20
30
  ModalDialogMode["YES_NO"] = "YES_NO";
31
+ /**
32
+ * "Yes", "No" and "Cancel" buttons: "Yes" calls `onOk`, "No" calls `onDeny` and "Cancel" `onCancel`.
33
+ * Supported only by the static methods; the component renders antd's default buttons in this mode.
34
+ */
21
35
  ModalDialogMode["YES_NO_CANCEL"] = "YES_NO_CANCEL";
36
+ /** Only an "OK" button (see the note at {@link ModalDialog} about the component). */
22
37
  ModalDialogMode["OK"] = "OK";
23
38
  })(ModalDialogMode || (ModalDialogMode = {}));
39
+ /**
40
+ * Dialog with a predefined, localized button set (see {@link ModalDialogMode}).
41
+ *
42
+ * As a component it renders a draggable (by the title), resizable (bottom-right handle) and maximizable antd
43
+ * `Modal` that is kept inside the window and destroyed when hidden. It must be rendered inside a
44
+ * `DraggableModalProvider` (`d2coreui/components/modal/draggableModalProvider`), otherwise it throws.
45
+ * Note that in {@link ModalDialogMode.OK} mode the component still renders the Cancel button; only the static
46
+ * methods hide it.
47
+ *
48
+ * The static methods open imperative antd dialogs; register the app's modal API once with
49
+ * {@link ModalDialog.setModalInstance}. They modify the passed `okButtonProps` / `cancelButtonProps` objects and
50
+ * replace their `style`.
51
+ *
52
+ * @example
53
+ * <DraggableModalProvider>
54
+ * <ModalDialog mode={ModalDialogMode.OK_CANCEL} open={open} title="Rename"
55
+ * initialWidth={480} initialHeight={240}
56
+ * onOk={save} onCancel={() => setOpen(false)}>
57
+ * <Input value={name} onChange={e => setName(e.target.value)}/>
58
+ * </ModalDialog>
59
+ * </DraggableModalProvider>
60
+ *
61
+ * @example
62
+ * ModalDialog.confirm({
63
+ * mode: ModalDialogMode.YES_NO_CANCEL,
64
+ * title: "Save changes?",
65
+ * onOk: save,
66
+ * onDeny: discard,
67
+ * });
68
+ */
24
69
  export class ModalDialog extends React.Component {
25
70
  constructor(props) {
26
71
  super(props);
27
72
  }
73
+ /**
74
+ * Registers the antd `modal` API from `App.useApp()` for the static methods, so that their dialogs inherit the app's
75
+ * theme, locale and context. Until it is called they fall back to antd's static `Modal` functions.
76
+ */
28
77
  static setModalInstance(instance) {
29
78
  ModalDialog.modalStatic = instance;
30
79
  }
80
+ /**
81
+ * Opens a confirmation dialog (antd `confirm`) with the buttons of `props.mode`.
82
+ * @returns a handle to close or update the dialog.
83
+ */
31
84
  static confirm(props) {
32
85
  let dialogHandler;
33
86
  const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
@@ -37,6 +90,10 @@ export class ModalDialog extends React.Component {
37
90
  dialogHandler = method(modalDialogProperties);
38
91
  return dialogHandler;
39
92
  }
93
+ /**
94
+ * Opens an error dialog (antd `error`) with the buttons of `props.mode`.
95
+ * @returns a handle to close or update the dialog.
96
+ */
40
97
  static error(props) {
41
98
  let dialogHandler;
42
99
  const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
@@ -46,6 +103,11 @@ export class ModalDialog extends React.Component {
46
103
  dialogHandler = method(modalDialogProperties);
47
104
  return dialogHandler;
48
105
  }
106
+ /**
107
+ * Opens a confirmation dialog like {@link ModalDialog.confirm} with a danger OK button. The button is marked as
108
+ * danger only when `props.okButtonProps` is passed (an empty object is enough).
109
+ * @returns a handle to close or update the dialog.
110
+ */
49
111
  static delete(props) {
50
112
  let dialogHandler;
51
113
  const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
@@ -58,6 +120,10 @@ export class ModalDialog extends React.Component {
58
120
  dialogHandler = method(modalDialogProperties);
59
121
  return dialogHandler;
60
122
  }
123
+ /**
124
+ * Opens a success dialog (antd `success`) with the buttons of `props.mode`.
125
+ * @returns a handle to close or update the dialog.
126
+ */
61
127
  static success(props) {
62
128
  let dialogHandler;
63
129
  const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
@@ -67,6 +133,10 @@ export class ModalDialog extends React.Component {
67
133
  dialogHandler = method(modalDialogProperties);
68
134
  return dialogHandler;
69
135
  }
136
+ /**
137
+ * Opens an information dialog (antd `info`) with the buttons of `props.mode`.
138
+ * @returns a handle to close or update the dialog.
139
+ */
70
140
  static info(props) {
71
141
  let dialogHandler;
72
142
  const modalDialogProperties = ModalDialog.getModalFuncProperties(props, () => {
@@ -83,22 +153,22 @@ export class ModalDialog extends React.Component {
83
153
  static getModalProperties(props) {
84
154
  var _a, _b, _c, _d, _e;
85
155
  const { mode } = props, rest = __rest(props, ["mode"]);
86
- if (mode === "NO_BUTTONS") {
156
+ if (mode === "NO_BUTTONS" /* ModalDialogMode.NO_BUTTONS */) {
87
157
  if (rest.footer === undefined) {
88
158
  rest.footer = null;
89
159
  }
90
160
  }
91
161
  else {
92
162
  switch (mode) {
93
- case "OK_CANCEL":
163
+ case "OK_CANCEL" /* ModalDialogMode.OK_CANCEL */:
94
164
  rest.okText = (_a = props.okText) !== null && _a !== void 0 ? _a : i18n("OK");
95
165
  rest.cancelText = (_b = props.cancelText) !== null && _b !== void 0 ? _b : i18n("Cancel");
96
166
  break;
97
- case "YES_NO":
167
+ case "YES_NO" /* ModalDialogMode.YES_NO */:
98
168
  rest.okText = (_c = props.okText) !== null && _c !== void 0 ? _c : i18n("Yes");
99
169
  rest.cancelText = (_d = props.cancelText) !== null && _d !== void 0 ? _d : i18n("No");
100
170
  break;
101
- case "OK":
171
+ case "OK" /* ModalDialogMode.OK */:
102
172
  rest.okText = (_e = props.okText) !== null && _e !== void 0 ? _e : i18n("OK");
103
173
  rest.cancelButtonProps = undefined;
104
174
  break;
@@ -112,15 +182,15 @@ export class ModalDialog extends React.Component {
112
182
  var _a, _b, _c, _d, _e, _f, _g;
113
183
  const { mode, denyText, onDeny } = props, rest = __rest(props, ["mode", "denyText", "onDeny"]);
114
184
  switch (mode) {
115
- case "OK_CANCEL":
185
+ case "OK_CANCEL" /* ModalDialogMode.OK_CANCEL */:
116
186
  rest.okText = (_a = rest.okText) !== null && _a !== void 0 ? _a : i18n("OK");
117
187
  rest.cancelText = (_b = rest.cancelText) !== null && _b !== void 0 ? _b : i18n("Cancel");
118
188
  break;
119
- case "YES_NO":
189
+ case "YES_NO" /* ModalDialogMode.YES_NO */:
120
190
  rest.okText = (_c = rest.okText) !== null && _c !== void 0 ? _c : i18n("Yes");
121
191
  rest.cancelText = (_d = rest.cancelText) !== null && _d !== void 0 ? _d : i18n("No");
122
192
  break;
123
- case "YES_NO_CANCEL":
193
+ case "YES_NO_CANCEL" /* ModalDialogMode.YES_NO_CANCEL */:
124
194
  rest.okText = (_e = rest.okText) !== null && _e !== void 0 ? _e : i18n("Yes");
125
195
  rest.cancelText = (React.createElement(React.Fragment, null,
126
196
  React.createElement(Button, { onClick: (e) => {
@@ -136,7 +206,7 @@ export class ModalDialog extends React.Component {
136
206
  }
137
207
  rest.cancelButtonProps.type = "text";
138
208
  break;
139
- case "OK":
209
+ case "OK" /* ModalDialogMode.OK */:
140
210
  rest.okText = (_g = props.okText) !== null && _g !== void 0 ? _g : i18n("OK");
141
211
  rest.cancelButtonProps = { style: { display: "none" } };
142
212
  }
@@ -144,10 +214,10 @@ export class ModalDialog extends React.Component {
144
214
  rest.autoFocusButton = "ok";
145
215
  }
146
216
  rest.okButtonProps = Object.assign(rest.okButtonProps !== undefined ? rest.okButtonProps : {}, { style: { marginRight: 8 } });
147
- if (mode !== "OK") {
217
+ if (mode !== "OK" /* ModalDialogMode.OK */) {
148
218
  rest.cancelButtonProps = Object.assign(rest.cancelButtonProps !== undefined ? rest.cancelButtonProps : {}, { style: { float: "right" } });
149
219
  }
150
- if (mode === "YES_NO_CANCEL") {
220
+ if (mode === "YES_NO_CANCEL" /* ModalDialogMode.YES_NO_CANCEL */) {
151
221
  if (rest.cancelButtonProps && rest.cancelButtonProps.style) {
152
222
  rest.cancelButtonProps.style.padding = 0;
153
223
  rest.cancelButtonProps.style.marginTop = -1;
@@ -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,EAAsB,MAAM,gCAAgC,CAAC;AAGnF,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;AAYD,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA+B;IAGlE,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IAEM,MAAM,CAAC,gBAAgB,CAAC,QAAiB;QAC5C,WAAW,CAAC,WAAW,GAAG,QAAQ,CAAC;IACvC,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,MAAM,MAAM,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC;QACzF,aAAa,GAAG,MAAM,CAAC,qBAAqB,CAAC,CAAC;QAC9C,OAAO,aAAa,CAAC;IACzB,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,KAA2B;QAC3C,IAAI,a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nimport {Button, Modal} from \"antd\";\r\nimport {ModalFuncProps} from \"antd/es/modal\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal, DraggableModalProps} from \"d2coreui/components/modal/impl\";\r\nimport {HookAPI} from \"antd/es/modal/useModal\";\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 DraggableModalProps {\r\n mode: ModalDialogMode\r\n}\r\n\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n private static modalStatic: HookAPI;\r\n\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n public static setModalInstance(instance: HookAPI) {\r\n ModalDialog.modalStatic = instance;\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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n dialogHandler = method(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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.error : Modal.error;\r\n dialogHandler = method(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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = method(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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.success : Modal.success;\r\n dialogHandler = method(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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.info : Modal.info;\r\n dialogHandler = method(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
+ {"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,EAAsB,MAAM,gCAAgC,CAAC;AAGnF;;;GAGG;AACH,MAAM,CAAN,IAAkB,eAiBjB;AAjBD,WAAkB,eAAe;IAC7B;;;OAGG;IACH,4CAAyB,CAAA;IACzB,iCAAiC;IACjC,0CAAuB,CAAA;IACvB,mDAAmD;IACnD,oCAAiB,CAAA;IACjB;;;OAGG;IACH,kDAA+B,CAAA;IAC/B,qFAAqF;IACrF,4BAAS,CAAA;AACb,CAAC,EAjBiB,eAAe,KAAf,eAAe,QAiBhC;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,OAAO,WAAY,SAAQ,KAAK,CAAC,SAA+B;IAGlE,YAAY,KAAiC;QACzC,KAAK,CAAC,KAAK,CAAC,CAAC;IACjB,C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AAI,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,wDAAkC,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} from \"antd/es/modal\";\r\nimport i18n from \"d2core/i18n/i18n\";\r\nimport {DraggableModal, DraggableModalProps} from \"d2coreui/components/modal/impl\";\r\nimport {HookAPI} from \"antd/es/modal/useModal\";\r\n\r\n/**\r\n * Button set of a {@link ModalDialog}. Button labels are localized and can be overridden with `okText` /\r\n * `cancelText` (and `denyText`).\r\n */\r\nexport const enum ModalDialogMode {\r\n /**\r\n * No footer, unless a `footer` is given explicitly. Honored only by the component; the static methods show\r\n * antd's default buttons.\r\n */\r\n NO_BUTTONS = \"NO_BUTTONS\",\r\n /** \"OK\" and \"Cancel\" buttons. */\r\n OK_CANCEL = \"OK_CANCEL\",\r\n /** \"Yes\" and \"No\" buttons; \"No\" acts as cancel. */\r\n YES_NO = \"YES_NO\",\r\n /**\r\n * \"Yes\", \"No\" and \"Cancel\" buttons: \"Yes\" calls `onOk`, \"No\" calls `onDeny` and \"Cancel\" `onCancel`.\r\n * Supported only by the static methods; the component renders antd's default buttons in this mode.\r\n */\r\n YES_NO_CANCEL = \"YES_NO_CANCEL\",\r\n /** Only an \"OK\" button (see the note at {@link ModalDialog} about the component). */\r\n OK = \"OK\",\r\n}\r\n\r\n/**\r\n * Options of the static {@link ModalDialog} methods: antd `ModalFuncProps` plus the button mode.\r\n * `autoFocusButton` defaults to `\"ok\"`.\r\n */\r\nexport interface ModalDialogFuncProps extends ModalFuncProps {\r\n /** Button set of the dialog. */\r\n mode: ModalDialogMode\r\n /** Label of the \"No\" button in {@link ModalDialogMode.YES_NO_CANCEL} mode; defaults to localized \"No\". */\r\n denyText?: string\r\n /**\r\n * Called with the click event when the \"No\" button is clicked in {@link ModalDialogMode.YES_NO_CANCEL} mode;\r\n * the dialog is closed afterwards.\r\n */\r\n onDeny?: (...args: any[]) => any;\r\n}\r\n\r\n/**\r\n * Props of the {@link ModalDialog} component: antd `ModalProps` (except `width`) plus `initialWidth`,\r\n * `initialHeight`, `maximizable` and `onResize` of the draggable modal, and the button mode.\r\n */\r\nexport interface ModalDialogProps extends DraggableModalProps {\r\n /** Button set of the dialog. */\r\n mode: ModalDialogMode\r\n}\r\n\r\n/**\r\n * Dialog with a predefined, localized button set (see {@link ModalDialogMode}).\r\n *\r\n * As a component it renders a draggable (by the title), resizable (bottom-right handle) and maximizable antd\r\n * `Modal` that is kept inside the window and destroyed when hidden. It must be rendered inside a\r\n * `DraggableModalProvider` (`d2coreui/components/modal/draggableModalProvider`), otherwise it throws.\r\n * Note that in {@link ModalDialogMode.OK} mode the component still renders the Cancel button; only the static\r\n * methods hide it.\r\n *\r\n * The static methods open imperative antd dialogs; register the app's modal API once with\r\n * {@link ModalDialog.setModalInstance}. They modify the passed `okButtonProps` / `cancelButtonProps` objects and\r\n * replace their `style`.\r\n *\r\n * @example\r\n * <DraggableModalProvider>\r\n * <ModalDialog mode={ModalDialogMode.OK_CANCEL} open={open} title=\"Rename\"\r\n * initialWidth={480} initialHeight={240}\r\n * onOk={save} onCancel={() => setOpen(false)}>\r\n * <Input value={name} onChange={e => setName(e.target.value)}/>\r\n * </ModalDialog>\r\n * </DraggableModalProvider>\r\n *\r\n * @example\r\n * ModalDialog.confirm({\r\n * mode: ModalDialogMode.YES_NO_CANCEL,\r\n * title: \"Save changes?\",\r\n * onOk: save,\r\n * onDeny: discard,\r\n * });\r\n */\r\nexport class ModalDialog extends React.Component<ModalDialogProps, {}> {\r\n private static modalStatic: HookAPI;\r\n\r\n constructor(props: Readonly<ModalDialogProps>) {\r\n super(props);\r\n }\r\n\r\n /**\r\n * Registers the antd `modal` API from `App.useApp()` for the static methods, so that their dialogs inherit the app's\r\n * theme, locale and context. Until it is called they fall back to antd's static `Modal` functions.\r\n */\r\n public static setModalInstance(instance: HookAPI) {\r\n ModalDialog.modalStatic = instance;\r\n }\r\n\r\n /**\r\n * Opens a confirmation dialog (antd `confirm`) with the buttons of `props.mode`.\r\n * @returns a handle to close or update the dialog.\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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n /**\r\n * Opens an error dialog (antd `error`) with the buttons of `props.mode`.\r\n * @returns a handle to close or update the dialog.\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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.error : Modal.error;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n /**\r\n * Opens a confirmation dialog like {@link ModalDialog.confirm} with a danger OK button. The button is marked as\r\n * danger only when `props.okButtonProps` is passed (an empty object is enough).\r\n * @returns a handle to close or update the dialog.\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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.confirm : Modal.confirm;\r\n if (props.okButtonProps) {\r\n props.okButtonProps.danger = true;\r\n }\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n /**\r\n * Opens a success dialog (antd `success`) with the buttons of `props.mode`.\r\n * @returns a handle to close or update the dialog.\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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.success : Modal.success;\r\n dialogHandler = method(modalDialogProperties);\r\n return dialogHandler;\r\n }\r\n\r\n /**\r\n * Opens an information dialog (antd `info`) with the buttons of `props.mode`.\r\n * @returns a handle to close or update the dialog.\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 const method = ModalDialog.modalStatic ? ModalDialog.modalStatic.info : Modal.info;\r\n dialogHandler = method(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,20 +1,37 @@
1
1
  import React from "react";
2
2
  import { SelectProps } from "antd";
3
3
  import { DefaultOptionType } from "rc-select/lib/Select";
4
+ /** Type of enum values supported by {@link EnumValuePicker}. */
4
5
  type EnumTypes = string | number;
6
+ /** Enum object mapping enum keys to their values. */
5
7
  type EnumRepresentation<T extends EnumTypes> = {
6
8
  [key in string]: T;
7
9
  };
10
+ /** Props of {@link EnumValuePicker}; other props are passed to antd `Select`. */
8
11
  interface EnumValuePickerProps<T extends EnumTypes> extends Omit<SelectProps<T>, "onChange"> {
12
+ /**
13
+ * Restricts the offered options to these values; a current `value` not in the list is displayed as empty.
14
+ * Options are rebuilt only when `values` changes, not when this list changes.
15
+ */
9
16
  allowedValueTypes?: T[];
17
+ /** The enum object (TypeScript enum or plain key-to-value map); one option per key, labelled by the key. */
10
18
  values: EnumRepresentation<T>;
19
+ /** Translates option labels with `i18n`. */
11
20
  translateValue?: boolean;
21
+ /** Prefix prepended to the key to form the translation key when {@link EnumValuePickerProps.translateValue} is set. */
12
22
  translationPrefix?: string;
23
+ /** Called with the selected enum value; `undefined` when the selection is cleared. */
13
24
  onChange?: (value?: T) => void;
14
25
  }
26
+ /** State of {@link EnumValuePicker}. */
15
27
  interface EnumValuePickerState {
28
+ /** Select options built from the enum. */
16
29
  options: DefaultOptionType[];
17
30
  }
31
+ /**
32
+ * antd `Select` offering the values of an enum, labelled by the (optionally translated) enum keys.
33
+ * Numeric keys (reverse mappings of numeric TypeScript enums) are skipped.
34
+ */
18
35
  export default class EnumValuePicker<T extends EnumTypes> extends React.Component<EnumValuePickerProps<T>, EnumValuePickerState> {
19
36
  constructor(props: Readonly<EnumValuePickerProps<T>>);
20
37
  componentDidUpdate(prevProps: Readonly<EnumValuePickerProps<T>>): void;