@atlaskit/editor-core 151.1.2 → 151.3.1

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 (343) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/cjs/create-editor/ReactEditorView.js +22 -8
  3. package/dist/cjs/create-editor/create-plugins-list.js +30 -11
  4. package/dist/cjs/labs/next/presets/cxhtml.js +1 -2
  5. package/dist/cjs/labs/next/presets/default.js +3 -1
  6. package/dist/cjs/nodeviews/ReactNodeView.js +2 -2
  7. package/dist/cjs/nodeviews/SelectionBasedNodeView.js +6 -0
  8. package/dist/cjs/plugins/analytics/types/enums.js +1 -0
  9. package/dist/cjs/plugins/annotation/utils.js +19 -8
  10. package/dist/cjs/plugins/avatar-group/index.js +2 -1
  11. package/dist/cjs/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  12. package/dist/cjs/plugins/before-primaryToolbar/index.js +26 -0
  13. package/dist/cjs/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +28 -0
  14. package/dist/cjs/plugins/code-bidi-warning/index.js +5 -2
  15. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/main.js +12 -3
  16. package/dist/cjs/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +15 -5
  17. package/dist/cjs/plugins/code-block/index.js +3 -3
  18. package/dist/cjs/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  19. package/dist/cjs/plugins/code-block/pm-plugins/main.js +11 -3
  20. package/dist/cjs/plugins/extension/extension-api.js +10 -2
  21. package/dist/cjs/plugins/extension/ui/styles.js +1 -1
  22. package/dist/cjs/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  23. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +172 -0
  24. package/dist/cjs/plugins/find-replace/index.js +14 -137
  25. package/dist/cjs/plugins/find-replace/ui/Find.js +16 -9
  26. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +9 -2
  27. package/dist/cjs/plugins/find-replace/ui/Replace.js +11 -3
  28. package/dist/cjs/plugins/find-replace/ui/styles.js +44 -35
  29. package/dist/cjs/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -4
  30. package/dist/cjs/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  31. package/dist/cjs/plugins/fragment/index.js +34 -0
  32. package/dist/cjs/plugins/fragment/plugin-key.js +11 -0
  33. package/dist/cjs/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +1 -1
  34. package/dist/cjs/plugins/index.js +16 -0
  35. package/dist/cjs/plugins/list/actions/conversions.js +39 -71
  36. package/dist/cjs/plugins/list/transforms.js +7 -1
  37. package/dist/cjs/plugins/media/index.js +2 -3
  38. package/dist/cjs/plugins/media/nodeviews/mediaGroup.js +3 -1
  39. package/dist/cjs/plugins/media/nodeviews/mediaInline.js +12 -5
  40. package/dist/cjs/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  41. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +6 -4
  42. package/dist/cjs/plugins/media/nodeviews/styles.js +6 -1
  43. package/dist/cjs/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  44. package/dist/cjs/plugins/media/pm-plugins/main.js +49 -15
  45. package/dist/cjs/plugins/media/toolbar/commands.js +59 -0
  46. package/dist/cjs/plugins/media/toolbar/filePreviewItem.js +7 -2
  47. package/dist/cjs/plugins/media/toolbar/index.js +90 -3
  48. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  49. package/dist/cjs/plugins/media/utils/media-common.js +1 -1
  50. package/dist/cjs/plugins/media/utils/media-files.js +5 -1
  51. package/dist/cjs/plugins/panel/actions.js +2 -2
  52. package/dist/cjs/plugins/panel/index.js +3 -3
  53. package/dist/cjs/plugins/panel/nodeviews/panel.js +2 -2
  54. package/dist/cjs/plugins/panel/toolbar.js +10 -5
  55. package/dist/cjs/plugins/panel/utils.js +15 -0
  56. package/dist/cjs/plugins/rank.js +3 -2
  57. package/dist/cjs/plugins/selection/pm-plugins/selection-main.js +49 -1
  58. package/dist/cjs/plugins/status/ui/statusPicker.js +4 -2
  59. package/dist/cjs/plugins/table/commands/insert.js +1 -0
  60. package/dist/cjs/plugins/table/index.js +3 -2
  61. package/dist/cjs/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -3
  62. package/dist/cjs/plugins/table/pm-plugins/main.js +26 -3
  63. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  64. package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  65. package/dist/cjs/plugins/table/transforms/column-width.js +14 -5
  66. package/dist/cjs/plugins/table/transforms/fix-tables.js +43 -6
  67. package/dist/cjs/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  68. package/dist/cjs/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  69. package/dist/cjs/plugins/table/ui/common-styles.css.js +1 -1
  70. package/dist/cjs/plugins/table/ui/consts.js +1 -1
  71. package/dist/cjs/plugins/table/ui/messages.js +1 -1
  72. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  73. package/dist/cjs/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  74. package/dist/cjs/plugins/tasks-and-decisions/pm-plugins/main.js +2 -2
  75. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  76. package/dist/cjs/plugins/text-formatting/index.js +2 -1
  77. package/dist/cjs/plugins/type-ahead/ui/TypeAheadList.js +1 -0
  78. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +77 -26
  79. package/dist/cjs/ui/Appearance/FullPage/MainToolbar.js +32 -9
  80. package/dist/cjs/ui/ColorPalette/Color/index.js +8 -18
  81. package/dist/cjs/ui/ColorPalette/index.js +7 -4
  82. package/dist/cjs/ui/ColorPickerButton/index.js +1 -1
  83. package/dist/cjs/ui/ConfigPanel/ConfigPanel.js +114 -61
  84. package/dist/cjs/ui/ConfigPanel/FormContent.js +39 -26
  85. package/dist/cjs/ui/ConfigPanel/transformers.js +490 -248
  86. package/dist/cjs/ui/ConfigPanel/utils.js +2 -10
  87. package/dist/cjs/ui/DropdownMenu/index.js +3 -1
  88. package/dist/cjs/ui/LinkSearch/LinkSearchListItem.js +1 -1
  89. package/dist/cjs/ui/Resizer/index.js +9 -1
  90. package/dist/cjs/version-wrapper.js +1 -1
  91. package/dist/cjs/version.json +1 -1
  92. package/dist/es2019/create-editor/ReactEditorView.js +19 -8
  93. package/dist/es2019/create-editor/create-plugins-list.js +31 -12
  94. package/dist/es2019/labs/next/presets/cxhtml.js +1 -2
  95. package/dist/es2019/labs/next/presets/default.js +3 -1
  96. package/dist/es2019/nodeviews/ReactNodeView.js +1 -1
  97. package/dist/es2019/nodeviews/SelectionBasedNodeView.js +11 -0
  98. package/dist/es2019/plugins/analytics/types/enums.js +1 -0
  99. package/dist/es2019/plugins/annotation/utils.js +18 -7
  100. package/dist/es2019/plugins/avatar-group/index.js +2 -1
  101. package/dist/es2019/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +3 -2
  102. package/dist/es2019/plugins/before-primaryToolbar/index.js +15 -0
  103. package/dist/es2019/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  104. package/dist/es2019/plugins/code-bidi-warning/index.js +8 -2
  105. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/main.js +12 -2
  106. package/dist/es2019/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +16 -5
  107. package/dist/es2019/plugins/code-block/index.js +3 -2
  108. package/dist/es2019/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  109. package/dist/es2019/plugins/code-block/pm-plugins/main.js +11 -3
  110. package/dist/es2019/plugins/extension/extension-api.js +9 -2
  111. package/dist/es2019/plugins/extension/ui/styles.js +6 -0
  112. package/dist/es2019/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  113. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +152 -0
  114. package/dist/es2019/plugins/find-replace/index.js +15 -128
  115. package/dist/es2019/plugins/find-replace/ui/Find.js +18 -10
  116. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +11 -3
  117. package/dist/es2019/plugins/find-replace/ui/Replace.js +12 -4
  118. package/dist/es2019/plugins/find-replace/ui/styles.js +37 -47
  119. package/dist/es2019/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  120. package/dist/es2019/plugins/floating-toolbar/ui/EmojiPickerButton.js +10 -2
  121. package/dist/es2019/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  122. package/dist/es2019/plugins/fragment/index.js +22 -0
  123. package/dist/es2019/plugins/fragment/plugin-key.js +2 -0
  124. package/dist/es2019/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  125. package/dist/es2019/plugins/index.js +2 -0
  126. package/dist/es2019/plugins/list/actions/conversions.js +38 -69
  127. package/dist/es2019/plugins/list/transforms.js +5 -1
  128. package/dist/es2019/plugins/media/index.js +2 -2
  129. package/dist/es2019/plugins/media/nodeviews/mediaGroup.js +2 -1
  130. package/dist/es2019/plugins/media/nodeviews/mediaInline.js +8 -4
  131. package/dist/es2019/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  132. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +7 -5
  133. package/dist/es2019/plugins/media/nodeviews/styles.js +2 -0
  134. package/dist/es2019/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  135. package/dist/es2019/plugins/media/pm-plugins/main.js +32 -17
  136. package/dist/es2019/plugins/media/toolbar/commands.js +47 -0
  137. package/dist/es2019/plugins/media/toolbar/filePreviewItem.js +6 -2
  138. package/dist/es2019/plugins/media/toolbar/index.js +90 -3
  139. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/index.js +7 -1
  140. package/dist/es2019/plugins/media/utils/media-common.js +1 -1
  141. package/dist/es2019/plugins/media/utils/media-files.js +6 -1
  142. package/dist/es2019/plugins/panel/actions.js +2 -2
  143. package/dist/es2019/plugins/panel/index.js +5 -5
  144. package/dist/es2019/plugins/panel/nodeviews/panel.js +2 -2
  145. package/dist/es2019/plugins/panel/toolbar.js +10 -5
  146. package/dist/es2019/plugins/panel/utils.js +8 -1
  147. package/dist/es2019/plugins/rank.js +3 -2
  148. package/dist/es2019/plugins/selection/pm-plugins/selection-main.js +48 -1
  149. package/dist/es2019/plugins/status/ui/statusPicker.js +4 -2
  150. package/dist/es2019/plugins/table/commands/insert.js +1 -2
  151. package/dist/es2019/plugins/table/index.js +2 -1
  152. package/dist/es2019/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  153. package/dist/es2019/plugins/table/pm-plugins/main.js +25 -4
  154. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  155. package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  156. package/dist/es2019/plugins/table/transforms/column-width.js +13 -3
  157. package/dist/es2019/plugins/table/transforms/fix-tables.js +43 -5
  158. package/dist/es2019/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  159. package/dist/es2019/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  160. package/dist/es2019/plugins/table/ui/common-styles.css.js +5 -1
  161. package/dist/es2019/plugins/table/ui/consts.js +2 -2
  162. package/dist/es2019/plugins/table/ui/messages.js +1 -1
  163. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  164. package/dist/es2019/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  165. package/dist/es2019/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  166. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  167. package/dist/es2019/plugins/text-formatting/index.js +3 -2
  168. package/dist/es2019/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  169. package/dist/es2019/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  170. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +60 -27
  171. package/dist/es2019/ui/Appearance/FullPage/MainToolbar.js +51 -7
  172. package/dist/es2019/ui/ColorPalette/Color/index.js +9 -18
  173. package/dist/es2019/ui/ColorPalette/index.js +7 -4
  174. package/dist/es2019/ui/ColorPickerButton/index.js +1 -1
  175. package/dist/es2019/ui/ConfigPanel/ConfigPanel.js +101 -49
  176. package/dist/es2019/ui/ConfigPanel/FormContent.js +35 -26
  177. package/dist/es2019/ui/ConfigPanel/transformers.js +243 -72
  178. package/dist/es2019/ui/ConfigPanel/utils.js +1 -2
  179. package/dist/es2019/ui/Dropdown/index.js +2 -1
  180. package/dist/es2019/ui/DropdownMenu/index.js +7 -3
  181. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -0
  182. package/dist/es2019/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  183. package/dist/es2019/ui/LinkSearch/LinkSearchListItem.js +2 -2
  184. package/dist/es2019/ui/Resizer/index.js +9 -1
  185. package/dist/es2019/version-wrapper.js +1 -1
  186. package/dist/es2019/version.json +1 -1
  187. package/dist/esm/create-editor/ReactEditorView.js +22 -8
  188. package/dist/esm/create-editor/create-plugins-list.js +31 -12
  189. package/dist/esm/labs/next/presets/cxhtml.js +1 -2
  190. package/dist/esm/labs/next/presets/default.js +3 -1
  191. package/dist/esm/nodeviews/ReactNodeView.js +2 -2
  192. package/dist/esm/nodeviews/SelectionBasedNodeView.js +7 -0
  193. package/dist/esm/plugins/analytics/types/enums.js +1 -0
  194. package/dist/esm/plugins/annotation/utils.js +18 -7
  195. package/dist/esm/plugins/avatar-group/index.js +2 -1
  196. package/dist/esm/plugins/avatar-group/ui/AvatarGroupPluginWrapper.js +5 -2
  197. package/dist/esm/plugins/before-primaryToolbar/index.js +15 -0
  198. package/dist/esm/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.js +12 -0
  199. package/dist/esm/plugins/code-bidi-warning/index.js +5 -2
  200. package/dist/esm/plugins/code-bidi-warning/pm-plugins/main.js +12 -3
  201. package/dist/esm/plugins/code-bidi-warning/pm-plugins/plugin-factory.js +15 -5
  202. package/dist/esm/plugins/code-block/index.js +3 -3
  203. package/dist/esm/plugins/code-block/nodeviews/highlighting-code-block.js +6 -3
  204. package/dist/esm/plugins/code-block/pm-plugins/main.js +11 -3
  205. package/dist/esm/plugins/extension/extension-api.js +9 -2
  206. package/dist/esm/plugins/extension/ui/styles.js +1 -1
  207. package/dist/esm/plugins/feature-flags-context/feature-flags-from-props.js +4 -2
  208. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +155 -0
  209. package/dist/esm/plugins/find-replace/index.js +14 -131
  210. package/dist/esm/plugins/find-replace/ui/Find.js +17 -10
  211. package/dist/esm/plugins/find-replace/ui/FindReplace.js +10 -3
  212. package/dist/esm/plugins/find-replace/ui/Replace.js +11 -4
  213. package/dist/esm/plugins/find-replace/ui/styles.js +39 -18
  214. package/dist/esm/plugins/floating-toolbar/ui/DropdownMenu.js +2 -1
  215. package/dist/esm/plugins/floating-toolbar/ui/EmojiPickerButton.js +9 -4
  216. package/dist/esm/plugins/floating-toolbar/ui/Toolbar.js +1 -1
  217. package/dist/esm/plugins/fragment/index.js +22 -0
  218. package/dist/esm/plugins/fragment/plugin-key.js +2 -0
  219. package/dist/esm/plugins/hyperlink/ui/HyperlinkAddToolbar/HyperlinkAddToolbar.js +2 -2
  220. package/dist/esm/plugins/index.js +2 -0
  221. package/dist/esm/plugins/list/actions/conversions.js +38 -71
  222. package/dist/esm/plugins/list/transforms.js +7 -1
  223. package/dist/esm/plugins/media/index.js +2 -3
  224. package/dist/esm/plugins/media/nodeviews/mediaGroup.js +2 -1
  225. package/dist/esm/plugins/media/nodeviews/mediaInline.js +11 -6
  226. package/dist/esm/plugins/media/nodeviews/mediaNodeUpdater.js +3 -3
  227. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +7 -5
  228. package/dist/esm/plugins/media/nodeviews/styles.js +2 -0
  229. package/dist/esm/plugins/media/pm-plugins/alt-text/ui/AltTextEdit.js +5 -1
  230. package/dist/esm/plugins/media/pm-plugins/main.js +47 -16
  231. package/dist/esm/plugins/media/toolbar/commands.js +45 -0
  232. package/dist/esm/plugins/media/toolbar/filePreviewItem.js +6 -2
  233. package/dist/esm/plugins/media/toolbar/index.js +88 -3
  234. package/dist/esm/plugins/media/ui/ResizableMediaSingle/index.js +9 -1
  235. package/dist/esm/plugins/media/utils/media-common.js +1 -1
  236. package/dist/esm/plugins/media/utils/media-files.js +6 -1
  237. package/dist/esm/plugins/panel/actions.js +2 -2
  238. package/dist/esm/plugins/panel/index.js +5 -5
  239. package/dist/esm/plugins/panel/nodeviews/panel.js +2 -2
  240. package/dist/esm/plugins/panel/toolbar.js +9 -4
  241. package/dist/esm/plugins/panel/utils.js +13 -0
  242. package/dist/esm/plugins/rank.js +3 -2
  243. package/dist/esm/plugins/selection/pm-plugins/selection-main.js +50 -1
  244. package/dist/esm/plugins/status/ui/statusPicker.js +4 -2
  245. package/dist/esm/plugins/table/commands/insert.js +1 -2
  246. package/dist/esm/plugins/table/index.js +3 -2
  247. package/dist/esm/plugins/table/nodeviews/OverflowShadowsObserver.js +1 -2
  248. package/dist/esm/plugins/table/pm-plugins/main.js +27 -4
  249. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/colgroup.js +2 -2
  250. package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/resize-state.js +2 -0
  251. package/dist/esm/plugins/table/transforms/column-width.js +13 -3
  252. package/dist/esm/plugins/table/transforms/fix-tables.js +42 -4
  253. package/dist/esm/plugins/table/ui/FloatingContextualButton/index.js +3 -2
  254. package/dist/esm/plugins/table/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
  255. package/dist/esm/plugins/table/ui/common-styles.css.js +1 -1
  256. package/dist/esm/plugins/table/ui/consts.js +2 -2
  257. package/dist/esm/plugins/table/ui/messages.js +1 -1
  258. package/dist/esm/plugins/tasks-and-decisions/nodeviews/decisionItem.js +1 -1
  259. package/dist/esm/plugins/tasks-and-decisions/nodeviews/taskItem.js +1 -1
  260. package/dist/esm/plugins/tasks-and-decisions/pm-plugins/main.js +3 -3
  261. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +2 -1
  262. package/dist/esm/plugins/text-formatting/index.js +3 -2
  263. package/dist/esm/plugins/type-ahead/ui/TypeAheadList.js +2 -1
  264. package/dist/esm/plugins/type-ahead/ui/TypeAheadListItem.js +2 -1
  265. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +67 -27
  266. package/dist/esm/ui/Appearance/FullPage/MainToolbar.js +20 -7
  267. package/dist/esm/ui/ColorPalette/Color/index.js +9 -16
  268. package/dist/esm/ui/ColorPalette/index.js +7 -4
  269. package/dist/esm/ui/ColorPickerButton/index.js +1 -1
  270. package/dist/esm/ui/ConfigPanel/ConfigPanel.js +113 -62
  271. package/dist/esm/ui/ConfigPanel/FormContent.js +39 -26
  272. package/dist/esm/ui/ConfigPanel/transformers.js +488 -248
  273. package/dist/esm/ui/ConfigPanel/utils.js +1 -6
  274. package/dist/esm/ui/Dropdown/index.js +2 -1
  275. package/dist/esm/ui/DropdownMenu/index.js +7 -3
  276. package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -0
  277. package/dist/esm/ui/ElementBrowser/components/ElementList/ElementList.js +1 -0
  278. package/dist/esm/ui/LinkSearch/LinkSearchListItem.js +2 -2
  279. package/dist/esm/ui/Resizer/index.js +9 -1
  280. package/dist/esm/version-wrapper.js +1 -1
  281. package/dist/esm/version.json +1 -1
  282. package/dist/types/labs/next/full-page.d.ts +1 -1
  283. package/dist/types/nodeviews/ReactNodeView.d.ts +1 -1
  284. package/dist/types/nodeviews/SelectionBasedNodeView.d.ts +1 -0
  285. package/dist/types/plugins/analytics/types/enums.d.ts +1 -0
  286. package/dist/types/plugins/analytics/types/events.d.ts +7 -1
  287. package/dist/types/plugins/annotation/utils.d.ts +1 -1
  288. package/dist/types/plugins/avatar-group/index.d.ts +1 -0
  289. package/dist/types/plugins/avatar-group/ui/AvatarGroupPluginWrapper.d.ts +1 -0
  290. package/dist/types/plugins/before-primaryToolbar/index.d.ts +5 -0
  291. package/dist/types/plugins/before-primaryToolbar/ui/BeforePrimaryToolbarWrapper.d.ts +5 -0
  292. package/dist/types/plugins/code-bidi-warning/index.d.ts +4 -2
  293. package/dist/types/plugins/code-bidi-warning/pm-plugins/main.d.ts +4 -2
  294. package/dist/types/plugins/code-bidi-warning/pm-plugins/plugin-factory.d.ts +2 -1
  295. package/dist/types/plugins/code-bidi-warning/pm-plugins/types.d.ts +1 -0
  296. package/dist/types/plugins/code-block/index.d.ts +1 -1
  297. package/dist/types/plugins/code-block/nodeviews/highlighting-code-block.d.ts +12 -1
  298. package/dist/types/plugins/code-block/pm-plugins/main.d.ts +3 -1
  299. package/dist/types/plugins/code-block/types.d.ts +2 -0
  300. package/dist/types/plugins/feature-flags-context/get-enabled-feature-flag-keys.d.ts +1 -1
  301. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +15 -0
  302. package/dist/types/plugins/find-replace/index.d.ts +1 -0
  303. package/dist/types/plugins/find-replace/ui/Find.d.ts +1 -0
  304. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +1 -0
  305. package/dist/types/plugins/find-replace/ui/Replace.d.ts +1 -0
  306. package/dist/types/plugins/find-replace/ui/styles.d.ts +5 -14
  307. package/dist/types/plugins/floating-toolbar/ui/EmojiPickerButton.d.ts +1 -1
  308. package/dist/types/plugins/fragment/index.d.ts +5 -0
  309. package/dist/types/plugins/fragment/plugin-key.d.ts +2 -0
  310. package/dist/types/plugins/index.d.ts +2 -0
  311. package/dist/types/plugins/media/nodeviews/mediaInline.d.ts +3 -2
  312. package/dist/types/plugins/media/nodeviews/mediaNodeUpdater.d.ts +2 -2
  313. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  314. package/dist/types/plugins/media/nodeviews/styles.d.ts +2 -0
  315. package/dist/types/plugins/media/toolbar/commands.d.ts +3 -0
  316. package/dist/types/plugins/media/toolbar/filePreviewItem.d.ts +2 -0
  317. package/dist/types/plugins/media/types.d.ts +0 -1
  318. package/dist/types/plugins/panel/actions.d.ts +1 -1
  319. package/dist/types/plugins/panel/types.d.ts +8 -2
  320. package/dist/types/plugins/quick-insert/index.d.ts +2 -1
  321. package/dist/types/plugins/table/commands/insert.d.ts +3 -0
  322. package/dist/types/plugins/table/pm-plugins/main.d.ts +2 -1
  323. package/dist/types/plugins/table/pm-plugins/table-resizing/utils/types.d.ts +1 -0
  324. package/dist/types/plugins/table/transforms/column-width.d.ts +4 -1
  325. package/dist/types/plugins/table/transforms/fix-tables.d.ts +3 -2
  326. package/dist/types/plugins/table/types.d.ts +8 -0
  327. package/dist/types/plugins/table/ui/consts.d.ts +1 -1
  328. package/dist/types/types/editor-appearance-component.d.ts +2 -2
  329. package/dist/types/types/editor-props.d.ts +11 -1
  330. package/dist/types/types/feature-flags.d.ts +13 -0
  331. package/dist/types/types/index.d.ts +1 -1
  332. package/dist/types/ui/Appearance/FullPage/FullPageToolbar.d.ts +2 -2
  333. package/dist/types/ui/Appearance/FullPage/MainToolbar.d.ts +10 -1
  334. package/dist/types/ui/ColorPalette/Color/index.d.ts +8 -5
  335. package/dist/types/ui/ColorPalette/index.d.ts +1 -0
  336. package/dist/types/ui/ConfigPanel/transformers.d.ts +7 -1
  337. package/dist/types/ui/ConfigPanel/utils.d.ts +0 -1
  338. package/dist/types/ui/Resizer/index.d.ts +1 -0
  339. package/package.json +14 -10
  340. package/dist/cjs/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -38
  341. package/dist/es2019/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  342. package/dist/esm/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.js +0 -28
  343. package/dist/types/plugins/floating-toolbar/ui/EditorRemoveEmojiIcon.d.ts +0 -1
@@ -1,7 +1,7 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
- import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
2
  import _regeneratorRuntime from "@babel/runtime/regenerator";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
4
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
5
5
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
6
6
  import _typeof from "@babel/runtime/helpers/typeof";
7
7
 
@@ -11,7 +11,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
11
11
 
12
12
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
13
 
14
- import { isFieldset, isDateRange, isTabGroup, isExpand, getFieldSerializer, getFieldDeserializer } from '@atlaskit/editor-common/extensions';
14
+ import { isFieldset, isDateRange, isTabGroup, isTabField, isExpand, getFieldSerializer, getFieldDeserializer } from '@atlaskit/editor-common/extensions';
15
15
  import { getNameFromDuplicateField, isDuplicateField } from './utils';
16
16
 
17
17
  var isOption = function isOption(option) {
@@ -21,10 +21,9 @@ var isOption = function isOption(option) {
21
21
  var isOptions = function isOptions(options) {
22
22
  return Array.isArray(options) && options.every(isOption);
23
23
  };
24
- /** maps the typed-values from the Form values object */
25
-
26
24
 
27
- function extract(value, field) {
25
+ /** maps the typed-values from the Form values object */
26
+ function extract(value, field, options) {
28
27
  if (isOptions(value)) {
29
28
  return value.map(function (item) {
30
29
  return item.value;
@@ -39,229 +38,463 @@ function extract(value, field) {
39
38
  }
40
39
 
41
40
  return Number(value);
41
+ } // Workaround for https://product-fabric.atlassian.net/browse/DST-2701
42
+ else if (options !== null && options !== void 0 && options.useDefaultValue && value === undefined && 'defaultValue' in field) {
43
+ return field.defaultValue;
42
44
  }
43
45
 
44
46
  return value;
45
47
  }
46
48
 
49
+ export var findDuplicateFields = function findDuplicateFields(fields) {
50
+ return findDuplicateFieldsInternal(flattenFields(fields));
51
+ };
52
+
53
+ var findDuplicateFieldsInternal = function findDuplicateFieldsInternal(fields) {
54
+ var allowDuplicatesMap = {};
55
+ return fields.find(function (field) {
56
+ if (isExpand(field)) {
57
+ return findDuplicateFieldsInternal(field.fields);
58
+ } else if (isTabGroup(field)) {
59
+ return field.fields.find(function (tabField) {
60
+ return findDuplicateFieldsInternal(tabField.fields);
61
+ });
62
+ } else if (allowDuplicatesMap[field.name] === undefined) {
63
+ allowDuplicatesMap[field.name] = !!field.allowDuplicates;
64
+ return;
65
+ } else if (!field.allowDuplicates || !allowDuplicatesMap[field.name]) {
66
+ return field;
67
+ }
68
+
69
+ return;
70
+ });
71
+ };
72
+
47
73
  export var serialize = /*#__PURE__*/function () {
48
74
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(manifest, data, fields) {
49
- var depth,
75
+ var options,
50
76
  result,
51
- _loop,
52
- name,
53
- _ret,
77
+ _options$depth,
78
+ depth,
79
+ parentType,
80
+ flattenedFields,
81
+ fillResults,
82
+ parameters,
54
83
  hasDuplicateFields,
55
- _args3 = arguments;
84
+ _args2 = arguments;
56
85
 
57
- return _regeneratorRuntime.wrap(function _callee2$(_context3) {
86
+ return _regeneratorRuntime.wrap(function _callee2$(_context2) {
58
87
  while (1) {
59
- switch (_context3.prev = _context3.next) {
88
+ switch (_context2.prev = _context2.next) {
60
89
  case 0:
61
- depth = _args3.length > 3 && _args3[3] !== undefined ? _args3[3] : 0;
90
+ options = _args2.length > 3 && _args2[3] !== undefined ? _args2[3] : {};
62
91
  result = [];
92
+ _options$depth = options.depth, depth = _options$depth === void 0 ? 0 : _options$depth, parentType = options.parentType;
93
+ flattenedFields = flattenFields(fields);
94
+ fillResults = flattenedFields.map( /*#__PURE__*/function () {
95
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(field) {
96
+ var tabGroupData, tabData, expandData, fieldsetData, value;
97
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
98
+ while (1) {
99
+ switch (_context.prev = _context.next) {
100
+ case 0:
101
+ if (!isTabGroup(field)) {
102
+ _context.next = 7;
103
+ break;
104
+ }
105
+
106
+ _context.next = 3;
107
+ return serializeTabGroupField(manifest, field, data);
108
+
109
+ case 3:
110
+ tabGroupData = _context.sent;
111
+ result.push.apply(result, _toConsumableArray(tabGroupData));
112
+ _context.next = 30;
113
+ break;
63
114
 
64
- if (!data) {
65
- _context3.next = 13;
66
- break;
67
- }
115
+ case 7:
116
+ if (!isTabField(field)) {
117
+ _context.next = 14;
118
+ break;
119
+ }
68
120
 
69
- _loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop(name) {
70
- var field, value, tabs, resolveTabValues, i, tabField, fieldSerializer, fieldsetFields, extracted;
71
- return _regeneratorRuntime.wrap(function _loop$(_context2) {
72
- while (1) {
73
- switch (_context2.prev = _context2.next) {
74
- case 0:
75
- field = fields.find(function (field) {
76
- return field.name === getNameFromDuplicateField(name);
77
- });
121
+ _context.next = 10;
122
+ return serializeTabField(manifest, field, data);
78
123
 
79
- if (!(field === undefined)) {
80
- _context2.next = 3;
124
+ case 10:
125
+ tabData = _context.sent;
126
+ result.push.apply(result, _toConsumableArray(tabData));
127
+ _context.next = 30;
81
128
  break;
82
- }
83
129
 
84
- return _context2.abrupt("return", "continue");
130
+ case 14:
131
+ if (!isExpand(field)) {
132
+ _context.next = 21;
133
+ break;
134
+ }
85
135
 
86
- case 3:
87
- // ignore undefined values
88
- value = extract(data[name], field);
136
+ _context.next = 17;
137
+ return serializeExpandField(manifest, field, data);
89
138
 
90
- if (!(value === undefined)) {
91
- _context2.next = 6;
139
+ case 17:
140
+ expandData = _context.sent;
141
+ result.push.apply(result, _toConsumableArray(expandData));
142
+ _context.next = 30;
92
143
  break;
93
- }
94
144
 
95
- return _context2.abrupt("return", "continue");
145
+ case 21:
146
+ if (!(isFieldset(field) && depth === 0)) {
147
+ _context.next = 28;
148
+ break;
149
+ }
96
150
 
97
- case 6:
98
- if (!isTabGroup(field)) {
99
- _context2.next = 21;
100
- break;
101
- }
151
+ _context.next = 24;
152
+ return serializeFieldset(manifest, field, data, depth);
102
153
 
103
- tabs = field.fields;
104
- value = {};
154
+ case 24:
155
+ fieldsetData = _context.sent;
105
156
 
106
- resolveTabValues = /*#__PURE__*/function () {
107
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(tabField, groupData) {
108
- return _regeneratorRuntime.wrap(function _callee$(_context) {
109
- while (1) {
110
- switch (_context.prev = _context.next) {
111
- case 0:
112
- _context.next = 2;
113
- return serialize(manifest, groupData[tabField.name] || {}, tabField.fields);
157
+ if (fieldsetData) {
158
+ result.push(fieldsetData);
159
+ }
114
160
 
115
- case 2:
116
- return _context.abrupt("return", _context.sent);
161
+ _context.next = 30;
162
+ break;
117
163
 
118
- case 3:
119
- case "end":
120
- return _context.stop();
121
- }
122
- }
123
- }, _callee);
124
- }));
164
+ case 28:
165
+ value = extract(data[field.name], field, {
166
+ useDefaultValue: true
167
+ }); // ignore undefined values
125
168
 
126
- return function resolveTabValues(_x4, _x5) {
127
- return _ref2.apply(this, arguments);
128
- };
129
- }();
169
+ if (value !== undefined) {
170
+ result.push(_defineProperty({}, field.name, value));
171
+ }
130
172
 
131
- i = 0;
173
+ case 30:
174
+ case "end":
175
+ return _context.stop();
176
+ }
177
+ }
178
+ }, _callee);
179
+ }));
180
+
181
+ return function (_x4) {
182
+ return _ref2.apply(this, arguments);
183
+ };
184
+ }());
185
+ _context2.next = 7;
186
+ return Promise.all(fillResults);
187
+
188
+ case 7:
189
+ // Crunch fields down to parameters
190
+ parameters = result.reduce(function (obj, current) {
191
+ for (var _key in current) {
192
+ obj[_key] = current[_key];
193
+ }
132
194
 
133
- case 11:
134
- if (!(i < tabs.length)) {
135
- _context2.next = 19;
136
- break;
137
- }
195
+ return obj;
196
+ }, {}); // Fix up duplicate values (currently only for fieldsets)
138
197
 
139
- tabField = tabs[i];
140
- _context2.next = 15;
141
- return resolveTabValues(tabField, data[field.name] || {});
198
+ hasDuplicateFields = parentType === 'fieldset' && !!flattenedFields.find(function (field) {
199
+ return field.allowDuplicates;
200
+ });
142
201
 
143
- case 15:
144
- value[tabField.name] = _context2.sent;
202
+ if (!hasDuplicateFields) {
203
+ _context2.next = 11;
204
+ break;
205
+ }
145
206
 
146
- case 16:
147
- i++;
148
- _context2.next = 11;
149
- break;
207
+ return _context2.abrupt("return", serializeMergeDuplicateFieldData(parameters, data, flattenedFields));
150
208
 
151
- case 19:
152
- _context2.next = 37;
153
- break;
209
+ case 11:
210
+ return _context2.abrupt("return", parameters);
154
211
 
155
- case 21:
156
- if (!isExpand(field)) {
157
- _context2.next = 27;
158
- break;
159
- }
212
+ case 12:
213
+ case "end":
214
+ return _context2.stop();
215
+ }
216
+ }
217
+ }, _callee2);
218
+ }));
160
219
 
161
- _context2.next = 24;
162
- return serialize(manifest, data[field.name] || {}, field.fields);
220
+ return function serialize(_x, _x2, _x3) {
221
+ return _ref.apply(this, arguments);
222
+ };
223
+ }();
163
224
 
164
- case 24:
165
- value = _context2.sent;
166
- _context2.next = 37;
167
- break;
225
+ var serializeFieldset = /*#__PURE__*/function () {
226
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(manifest, field, data, depth) {
227
+ var fieldSerializer, fieldsetFields, fieldParams, extracted;
228
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
229
+ while (1) {
230
+ switch (_context3.prev = _context3.next) {
231
+ case 0:
232
+ _context3.prev = 0;
233
+ _context3.next = 3;
234
+ return getFieldSerializer(manifest, field.options.transformer);
168
235
 
169
- case 27:
170
- if (!(isFieldset(field) && depth === 0)) {
171
- _context2.next = 37;
172
- break;
173
- }
236
+ case 3:
237
+ fieldSerializer = _context3.sent;
238
+ _context3.next = 10;
239
+ break;
174
240
 
175
- _context2.next = 30;
176
- return getFieldSerializer(manifest, field.options.transformer);
241
+ case 6:
242
+ _context3.prev = 6;
243
+ _context3.t0 = _context3["catch"](0);
177
244
 
178
- case 30:
179
- fieldSerializer = _context2.sent;
245
+ if (!(data[field.name] !== undefined)) {
246
+ _context3.next = 10;
247
+ break;
248
+ }
180
249
 
181
- if (!fieldSerializer) {
182
- _context2.next = 37;
183
- break;
184
- }
250
+ throw _context3.t0;
251
+
252
+ case 10:
253
+ if (fieldSerializer) {
254
+ _context3.next = 12;
255
+ break;
256
+ }
185
257
 
186
- fieldsetFields = field.fields;
187
- _context2.next = 35;
188
- return serialize(manifest, value, fieldsetFields, depth + 1);
258
+ return _context3.abrupt("return");
259
+
260
+ case 12:
261
+ fieldsetFields = field.fields;
262
+ fieldParams = extract(data[field.name], field, {
263
+ useDefaultValue: true
264
+ }) || {};
265
+ _context3.next = 16;
266
+ return serialize(manifest, fieldParams, fieldsetFields, {
267
+ depth: depth + 1,
268
+ parentType: 'fieldset'
269
+ });
189
270
 
190
- case 35:
191
- extracted = _context2.sent;
192
- value = fieldSerializer(extracted);
271
+ case 16:
272
+ extracted = _context3.sent;
273
+ return _context3.abrupt("return", _defineProperty({}, field.name, fieldSerializer(extracted)));
193
274
 
194
- case 37:
195
- result.push(_defineProperty({}, field.name, value));
275
+ case 18:
276
+ case "end":
277
+ return _context3.stop();
278
+ }
279
+ }
280
+ }, _callee3, null, [[0, 6]]);
281
+ }));
196
282
 
197
- case 38:
198
- case "end":
199
- return _context2.stop();
200
- }
201
- }
202
- }, _loop);
283
+ return function serializeFieldset(_x5, _x6, _x7, _x8) {
284
+ return _ref3.apply(this, arguments);
285
+ };
286
+ }();
287
+
288
+ var serializeExpandField = /*#__PURE__*/function () {
289
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(manifest, field, data) {
290
+ var expandData, value, results, fieldName;
291
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
292
+ while (1) {
293
+ switch (_context4.prev = _context4.next) {
294
+ case 0:
295
+ expandData = field.hasGroupedValues ? data[field.name] || {} : data;
296
+ _context4.next = 3;
297
+ return serialize(manifest, expandData, field.fields, {
298
+ parentType: 'expand'
203
299
  });
204
- _context3.t0 = _regeneratorRuntime.keys(data);
205
300
 
206
- case 5:
207
- if ((_context3.t1 = _context3.t0()).done) {
208
- _context3.next = 13;
209
- break;
301
+ case 3:
302
+ value = _context4.sent;
303
+ results = [];
304
+
305
+ if (!field.hasGroupedValues) {
306
+ for (fieldName in value) {
307
+ results.push(_defineProperty({}, fieldName, value[fieldName]));
308
+ }
309
+ } else {
310
+ results.push(_defineProperty({}, field.name, value));
210
311
  }
211
312
 
212
- name = _context3.t1.value;
213
- return _context3.delegateYield(_loop(name), "t2", 8);
313
+ return _context4.abrupt("return", results);
214
314
 
215
- case 8:
216
- _ret = _context3.t2;
315
+ case 7:
316
+ case "end":
317
+ return _context4.stop();
318
+ }
319
+ }
320
+ }, _callee4);
321
+ }));
322
+
323
+ return function serializeExpandField(_x9, _x10, _x11) {
324
+ return _ref5.apply(this, arguments);
325
+ };
326
+ }();
327
+
328
+ var resolveTabValues = /*#__PURE__*/function () {
329
+ var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(manifest, tabField, groupData) {
330
+ var tabFieldParams;
331
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
332
+ while (1) {
333
+ switch (_context5.prev = _context5.next) {
334
+ case 0:
335
+ tabFieldParams = tabField.hasGroupedValues ? groupData[tabField.name] || {} : groupData;
336
+ _context5.next = 3;
337
+ return serialize(manifest, tabFieldParams, tabField.fields, {
338
+ parentType: 'tab'
339
+ });
340
+
341
+ case 3:
342
+ return _context5.abrupt("return", _context5.sent);
343
+
344
+ case 4:
345
+ case "end":
346
+ return _context5.stop();
347
+ }
348
+ }
349
+ }, _callee5);
350
+ }));
351
+
352
+ return function resolveTabValues(_x12, _x13, _x14) {
353
+ return _ref6.apply(this, arguments);
354
+ };
355
+ }();
356
+
357
+ var serializeTabGroupField = /*#__PURE__*/function () {
358
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(manifest, field, data) {
359
+ var tabs, results, value, i, tabField, tabFieldParameters, fieldName, _fieldName;
217
360
 
218
- if (!(_ret === "continue")) {
219
- _context3.next = 11;
361
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
362
+ while (1) {
363
+ switch (_context6.prev = _context6.next) {
364
+ case 0:
365
+ tabs = field.fields;
366
+ results = [];
367
+ value = {};
368
+ i = 0;
369
+
370
+ case 4:
371
+ if (!(i < tabs.length)) {
372
+ _context6.next = 13;
220
373
  break;
221
374
  }
222
375
 
223
- return _context3.abrupt("continue", 5);
376
+ tabField = tabs[i];
377
+ _context6.next = 8;
378
+ return resolveTabValues(manifest, tabField, field.hasGroupedValues ? data[field.name] || {} : data);
224
379
 
225
- case 11:
226
- _context3.next = 5;
380
+ case 8:
381
+ tabFieldParameters = _context6.sent;
382
+
383
+ if (tabField.hasGroupedValues) {
384
+ // Keep namespaced by tab
385
+ value[tabField.name] = tabFieldParameters;
386
+ } else {
387
+ // Copy into tabGroup value
388
+ for (fieldName in tabFieldParameters) {
389
+ value[fieldName] = tabFieldParameters[fieldName];
390
+ }
391
+ }
392
+
393
+ case 10:
394
+ i++;
395
+ _context6.next = 4;
227
396
  break;
228
397
 
229
398
  case 13:
230
- // when there are duplicate fields we return an array eg. [{ title: 'one' }, { title: 'two' }]
231
- // when there aren't we return an object eg. { title: 'one' }
232
- hasDuplicateFields = !!Object.keys(data).find(function (key) {
233
- return isDuplicateField(key);
234
- });
235
-
236
- if (!hasDuplicateFields) {
237
- _context3.next = 16;
238
- break;
399
+ // Now for tabGroup...
400
+ if (field.hasGroupedValues) {
401
+ results.push(_defineProperty({}, field.name, value));
402
+ } else {
403
+ for (_fieldName in value) {
404
+ results.push(_defineProperty({}, _fieldName, value));
405
+ }
239
406
  }
240
407
 
241
- return _context3.abrupt("return", result);
408
+ return _context6.abrupt("return", results);
242
409
 
243
- case 16:
244
- return _context3.abrupt("return", result.reduce(function (obj, current) {
245
- for (var key in current) {
246
- obj[key] = current[key];
410
+ case 15:
411
+ case "end":
412
+ return _context6.stop();
413
+ }
414
+ }
415
+ }, _callee6);
416
+ }));
417
+
418
+ return function serializeTabGroupField(_x15, _x16, _x17) {
419
+ return _ref7.apply(this, arguments);
420
+ };
421
+ }();
422
+
423
+ var serializeTabField = /*#__PURE__*/function () {
424
+ var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(manifest, field, data) {
425
+ var results, tabField, tabFieldParameters, fieldName;
426
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
427
+ while (1) {
428
+ switch (_context7.prev = _context7.next) {
429
+ case 0:
430
+ results = [];
431
+ tabField = field;
432
+ _context7.next = 4;
433
+ return resolveTabValues(manifest, tabField, data);
434
+
435
+ case 4:
436
+ tabFieldParameters = _context7.sent;
437
+
438
+ if (tabField.hasGroupedValues) {
439
+ // Keep namespaced by tab
440
+ results.push(_defineProperty({}, tabField.name, tabFieldParameters));
441
+ } else {
442
+ // Copy into tabGroup value
443
+ for (fieldName in tabFieldParameters) {
444
+ results.push(_defineProperty({}, fieldName, tabFieldParameters[fieldName]));
247
445
  }
446
+ }
248
447
 
249
- return obj;
250
- }, {}));
448
+ return _context7.abrupt("return", results);
251
449
 
252
- case 17:
450
+ case 7:
253
451
  case "end":
254
- return _context3.stop();
452
+ return _context7.stop();
255
453
  }
256
454
  }
257
- }, _callee2);
455
+ }, _callee7);
258
456
  }));
259
457
 
260
- return function serialize(_x, _x2, _x3) {
261
- return _ref.apply(this, arguments);
458
+ return function serializeTabField(_x18, _x19, _x20) {
459
+ return _ref8.apply(this, arguments);
262
460
  };
263
461
  }();
264
462
 
463
+ var serializeMergeDuplicateFieldData = function serializeMergeDuplicateFieldData(parameters, formData, flattenedFields) {
464
+ // Weed out all the non-duplicate field names
465
+ var allDuplicateFieldNames = Object.keys(formData).filter(function (key) {
466
+ return isDuplicateField(key);
467
+ });
468
+ return flattenedFields.reduce(function (newParams, field) {
469
+ var paramValue = parameters[field.name];
470
+
471
+ if (!field.allowDuplicates && paramValue !== undefined) {
472
+ newParams[field.name] = paramValue;
473
+ } else {
474
+ // extract the given duplicate values through the field
475
+ var duplicateValues = allDuplicateFieldNames.filter(function (name) {
476
+ return getNameFromDuplicateField(name) === field.name;
477
+ }).map(function (duplicateFieldName) {
478
+ return extract(formData[duplicateFieldName], field, {
479
+ useDefaultValue: true
480
+ });
481
+ }); // Merge and ensure that all values are worth serializing
482
+
483
+ var mergedValues = [paramValue].concat(_toConsumableArray(duplicateValues)).filter(function (value) {
484
+ return value !== undefined;
485
+ });
486
+
487
+ if (mergedValues.length > 0) {
488
+ // Replace so the duplicate field values are saved under the
489
+ // fieldName as an array
490
+ newParams[field.name] = mergedValues;
491
+ }
492
+ }
493
+
494
+ return newParams;
495
+ }, {});
496
+ };
497
+
265
498
  function injectDefaultValues(data, fields) {
266
499
  var copy = _toConsumableArray(convertToParametersArray(data));
267
500
 
@@ -269,7 +502,7 @@ function injectDefaultValues(data, fields) {
269
502
  _step;
270
503
 
271
504
  try {
272
- var _loop2 = function _loop2() {
505
+ var _loop = function _loop() {
273
506
  var field = _step.value;
274
507
  var name = field.name;
275
508
  var fieldIndex = copy.findIndex(function (item) {
@@ -297,9 +530,9 @@ function injectDefaultValues(data, fields) {
297
530
  };
298
531
 
299
532
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
300
- var _ret2 = _loop2();
533
+ var _ret = _loop();
301
534
 
302
- if (_ret2 === "continue") continue;
535
+ if (_ret === "continue") continue;
303
536
  }
304
537
  } catch (err) {
305
538
  _iterator.e(err);
@@ -307,198 +540,205 @@ function injectDefaultValues(data, fields) {
307
540
  _iterator.f();
308
541
  }
309
542
 
310
- if (doParametersContainDuplicateFields(copy)) {
311
- return copy;
312
- }
313
-
314
543
  return convertToParametersObject(copy);
315
544
  }
545
+ /**
546
+ * Flattens the given FieldDefinition[] so it resembles the expected data
547
+ * structure in result Parameters.
548
+ */
549
+
550
+
551
+ var flattenFields = function flattenFields(fields) {
552
+ var flattenAccumulator = function flattenAccumulator(accumulator, field) {
553
+ if (isTabGroup(field)) {
554
+ if (field.hasGroupedValues) {
555
+ accumulator.push(field);
556
+ } else {
557
+ var flattenedTabs = field.fields.reduce(function (tabAccumulator, tab) {
558
+ return tabAccumulator.concat(tab.hasGroupedValues ? tab : tab.fields.reduce(flattenAccumulator, []));
559
+ }, []);
560
+ accumulator.push.apply(accumulator, _toConsumableArray(flattenedTabs));
561
+ }
562
+ } else if (isExpand(field)) {
563
+ if (field.hasGroupedValues) {
564
+ accumulator.push(field);
565
+ } else {
566
+ var flattenedExpand = field.fields.reduce(flattenAccumulator, []);
567
+ accumulator.push.apply(accumulator, _toConsumableArray(flattenedExpand));
568
+ }
569
+ } else {
570
+ accumulator.push(field);
571
+ }
572
+
573
+ return accumulator;
574
+ };
575
+
576
+ return fields.reduce(flattenAccumulator, []);
577
+ };
316
578
 
317
579
  export var deserialize = /*#__PURE__*/function () {
318
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(manifest, data, fields) {
580
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(manifest, data, fields) {
319
581
  var depth,
320
582
  dataArray,
321
583
  result,
322
584
  errors,
585
+ flattenedFields,
323
586
  _iterator2,
324
587
  _step2,
325
- _loop3,
326
- _ret3,
327
- _args5 = arguments;
588
+ _loop2,
589
+ _ret2,
590
+ _args9 = arguments;
328
591
 
329
- return _regeneratorRuntime.wrap(function _callee3$(_context5) {
592
+ return _regeneratorRuntime.wrap(function _callee8$(_context9) {
330
593
  while (1) {
331
- switch (_context5.prev = _context5.next) {
594
+ switch (_context9.prev = _context9.next) {
332
595
  case 0:
333
- depth = _args5.length > 3 && _args5[3] !== undefined ? _args5[3] : 0;
596
+ depth = _args9.length > 3 && _args9[3] !== undefined ? _args9[3] : 0;
334
597
  dataArray = convertToParametersArray(data);
335
598
  result = [];
336
599
  errors = [];
600
+ flattenedFields = flattenFields(fields);
337
601
  _iterator2 = _createForOfIteratorHelper(dataArray);
338
- _context5.prev = 5;
339
- _loop3 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop3() {
602
+ _context9.prev = 6;
603
+ _loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
340
604
  var item, _Object$entries$, name, originalValue, field, value, fieldDeserializer;
341
605
 
342
- return _regeneratorRuntime.wrap(function _loop3$(_context4) {
606
+ return _regeneratorRuntime.wrap(function _loop2$(_context8) {
343
607
  while (1) {
344
- switch (_context4.prev = _context4.next) {
608
+ switch (_context8.prev = _context8.next) {
345
609
  case 0:
346
610
  item = _step2.value;
347
611
  _Object$entries$ = _slicedToArray(Object.entries(item)[0], 2), name = _Object$entries$[0], originalValue = _Object$entries$[1];
348
- field = fields.find(function (field) {
612
+ field = flattenedFields.find(function (field) {
349
613
  return field.name === getNameFromDuplicateField(name);
350
614
  });
351
615
 
352
616
  if (!(field === undefined)) {
353
- _context4.next = 5;
617
+ _context8.next = 5;
354
618
  break;
355
619
  }
356
620
 
357
- return _context4.abrupt("return", "continue");
621
+ return _context8.abrupt("return", "continue");
358
622
 
359
623
  case 5:
360
624
  value = extract(originalValue, field);
361
625
 
362
626
  if (!(value === undefined)) {
363
- _context4.next = 8;
627
+ _context8.next = 8;
364
628
  break;
365
629
  }
366
630
 
367
- return _context4.abrupt("return", "continue");
631
+ return _context8.abrupt("return", "continue");
368
632
 
369
633
  case 8:
370
634
  if (!(isFieldset(field) && depth === 0)) {
371
- _context4.next = 24;
635
+ _context8.next = 24;
372
636
  break;
373
637
  }
374
638
 
375
- _context4.next = 11;
639
+ _context8.next = 11;
376
640
  return getFieldDeserializer(manifest, field.options.transformer);
377
641
 
378
642
  case 11:
379
- fieldDeserializer = _context4.sent;
643
+ fieldDeserializer = _context8.sent;
380
644
 
381
645
  if (!fieldDeserializer) {
382
- _context4.next = 24;
646
+ _context8.next = 24;
383
647
  break;
384
648
  }
385
649
 
386
- _context4.prev = 13;
650
+ _context8.prev = 13;
387
651
  value = fieldDeserializer(value);
388
- _context4.next = 21;
652
+ _context8.next = 21;
389
653
  break;
390
654
 
391
655
  case 17:
392
- _context4.prev = 17;
393
- _context4.t0 = _context4["catch"](13);
394
- errors.push(_defineProperty({}, name, _context4.t0.message));
395
- return _context4.abrupt("return", "continue");
656
+ _context8.prev = 17;
657
+ _context8.t0 = _context8["catch"](13);
658
+ errors.push(_defineProperty({}, name, _context8.t0.message));
659
+ return _context8.abrupt("return", "continue");
396
660
 
397
661
  case 21:
398
- _context4.next = 23;
662
+ _context8.next = 23;
399
663
  return deserialize(manifest, value, field.fields, depth + 1);
400
664
 
401
665
  case 23:
402
- value = _context4.sent;
666
+ value = _context8.sent;
403
667
 
404
668
  case 24:
405
669
  result.push(_defineProperty({}, name, value));
406
670
 
407
671
  case 25:
408
672
  case "end":
409
- return _context4.stop();
673
+ return _context8.stop();
410
674
  }
411
675
  }
412
- }, _loop3, null, [[13, 17]]);
676
+ }, _loop2, null, [[13, 17]]);
413
677
  });
414
678
 
415
679
  _iterator2.s();
416
680
 
417
- case 8:
681
+ case 9:
418
682
  if ((_step2 = _iterator2.n()).done) {
419
- _context5.next = 15;
683
+ _context9.next = 16;
420
684
  break;
421
685
  }
422
686
 
423
- return _context5.delegateYield(_loop3(), "t0", 10);
687
+ return _context9.delegateYield(_loop2(), "t0", 11);
424
688
 
425
- case 10:
426
- _ret3 = _context5.t0;
689
+ case 11:
690
+ _ret2 = _context9.t0;
427
691
 
428
- if (!(_ret3 === "continue")) {
429
- _context5.next = 13;
692
+ if (!(_ret2 === "continue")) {
693
+ _context9.next = 14;
430
694
  break;
431
695
  }
432
696
 
433
- return _context5.abrupt("continue", 13);
697
+ return _context9.abrupt("continue", 14);
434
698
 
435
- case 13:
436
- _context5.next = 8;
699
+ case 14:
700
+ _context9.next = 9;
437
701
  break;
438
702
 
439
- case 15:
440
- _context5.next = 20;
703
+ case 16:
704
+ _context9.next = 21;
441
705
  break;
442
706
 
443
- case 17:
444
- _context5.prev = 17;
445
- _context5.t1 = _context5["catch"](5);
707
+ case 18:
708
+ _context9.prev = 18;
709
+ _context9.t1 = _context9["catch"](6);
446
710
 
447
- _iterator2.e(_context5.t1);
711
+ _iterator2.e(_context9.t1);
448
712
 
449
- case 20:
450
- _context5.prev = 20;
713
+ case 21:
714
+ _context9.prev = 21;
451
715
 
452
716
  _iterator2.f();
453
717
 
454
- return _context5.finish(20);
718
+ return _context9.finish(21);
455
719
 
456
- case 23:
720
+ case 24:
457
721
  result = convertToParametersObject(result);
458
722
 
459
723
  if (errors.length > 0) {
460
724
  result.errors = convertToParametersObject(errors);
461
725
  }
462
726
 
463
- return _context5.abrupt("return", injectDefaultValues(result, fields));
727
+ return _context9.abrupt("return", injectDefaultValues(result, flattenedFields));
464
728
 
465
- case 26:
729
+ case 27:
466
730
  case "end":
467
- return _context5.stop();
731
+ return _context9.stop();
468
732
  }
469
733
  }
470
- }, _callee3, null, [[5, 17, 20, 23]]);
734
+ }, _callee8, null, [[6, 18, 21, 24]]);
471
735
  }));
472
736
 
473
- return function deserialize(_x6, _x7, _x8) {
474
- return _ref3.apply(this, arguments);
737
+ return function deserialize(_x21, _x22, _x23) {
738
+ return _ref9.apply(this, arguments);
475
739
  };
476
740
  }();
477
741
 
478
- var doParametersContainDuplicateFields = function doParametersContainDuplicateFields(parameters) {
479
- var keyMap = new Set();
480
-
481
- var _iterator3 = _createForOfIteratorHelper(parameters),
482
- _step3;
483
-
484
- try {
485
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
486
- var param = _step3.value;
487
- var key = Object.keys(param)[0];
488
-
489
- if (keyMap.has(key)) {
490
- return true;
491
- }
492
-
493
- keyMap.add(key);
494
- }
495
- } catch (err) {
496
- _iterator3.e(err);
497
- } finally {
498
- _iterator3.f();
499
- }
500
- };
501
-
502
742
  var convertToParametersObject = function convertToParametersObject() {
503
743
  var parameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
504
744
 
@@ -507,17 +747,17 @@ var convertToParametersObject = function convertToParametersObject() {
507
747
  }
508
748
 
509
749
  return parameters.reduce(function (obj, current) {
510
- for (var key in current) {
750
+ for (var _key2 in current) {
511
751
  var keys = Object.keys(obj);
512
- var resultKey = key;
752
+ var resultKey = _key2;
513
753
  var idx = 1;
514
754
 
515
755
  while (keys.indexOf(resultKey) >= 0) {
516
- resultKey = "".concat(getNameFromDuplicateField(key), ":").concat(idx);
756
+ resultKey = "".concat(getNameFromDuplicateField(_key2), ":").concat(idx);
517
757
  idx++;
518
758
  }
519
759
 
520
- obj[resultKey] = current[key];
760
+ obj[resultKey] = current[_key2];
521
761
  }
522
762
 
523
763
  return obj;