@opentiny/vue-renderless 3.13.2 → 3.14.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 (320) hide show
  1. package/action-sheet/index.js +20 -13
  2. package/action-sheet/vue.js +8 -7
  3. package/amount/index.js +100 -25
  4. package/amount/vue.js +102 -26
  5. package/anchor/index.js +1 -0
  6. package/area/index.js +8 -8
  7. package/area/vue.js +5 -5
  8. package/async-flowchart/index.js +16 -3
  9. package/autocomplete/index.js +58 -14
  10. package/autocomplete/vue.js +40 -12
  11. package/badge/index.js +12 -0
  12. package/badge/vue.js +6 -4
  13. package/breadcrumb/vue.js +3 -1
  14. package/breadcrumb-item/vue.js +6 -2
  15. package/button/index.js +5 -1
  16. package/calendar/index.js +2 -86
  17. package/calendar-bar/index.js +18 -4
  18. package/calendar-view/index.js +5 -1
  19. package/calendar-view/vue.js +16 -3
  20. package/card-group/vue.js +4 -2
  21. package/cascader/index.js +86 -34
  22. package/cascader/vue.js +61 -20
  23. package/cascader-menu/index.js +7 -7
  24. package/cascader-menu/vue.js +2 -3
  25. package/cascader-mobile/index.js +36 -23
  26. package/cascader-mobile/vue.js +6 -0
  27. package/cascader-node/index.js +13 -1
  28. package/cascader-node/vue.js +15 -4
  29. package/cascader-panel/index.js +1 -1
  30. package/cascader-select/column-index.js +150 -0
  31. package/cascader-select/column.js +120 -0
  32. package/cascader-select/index.js +29 -165
  33. package/cascader-select/usePicker.js +251 -0
  34. package/cascader-select/useTouch.js +65 -0
  35. package/cascader-select/vue.js +35 -47
  36. package/cell/vue.js +2 -1
  37. package/chart-bar/index.js +2 -3
  38. package/chart-core/deps/constants.js +43 -43
  39. package/chart-core/index.js +1 -1
  40. package/chart-gauge/index.js +2 -2
  41. package/chart-heatmap/index.js +17 -10
  42. package/chart-line/index.js +8 -9
  43. package/chart-tree/index.js +2 -2
  44. package/chart-waterfall/index.js +4 -6
  45. package/checkbox/index.js +18 -1
  46. package/checkbox/vue.js +15 -7
  47. package/checkbox-group/vue.js +1 -0
  48. package/col/vue.js +1 -1
  49. package/collapse/index.js +3 -3
  50. package/color-select-panel/vue.js +0 -7
  51. package/column-list-item/index.js +17 -1
  52. package/column-list-item/vue.js +8 -3
  53. package/common/bigInt.js +2 -2
  54. package/common/date.js +7 -5
  55. package/common/deps/clickoutside.js +6 -2
  56. package/common/deps/date-util.js +4 -2
  57. package/common/deps/dom.js +19 -4
  58. package/common/deps/popper.js +44 -11
  59. package/common/deps/resize-event.js +1 -0
  60. package/common/deps/touch-emulator.js +4 -1
  61. package/common/deps/tree-model/node.js +2 -2
  62. package/common/deps/tree-model/tree-store.js +2 -13
  63. package/common/deps/useRect.js +25 -0
  64. package/common/deps/vue-popper.js +38 -20
  65. package/common/index.js +2 -2
  66. package/common/runtime.js +1 -1
  67. package/common/string.js +2 -2
  68. package/common/type.js +2 -1
  69. package/common/validate/rules/enum.js +1 -1
  70. package/common/validate/rules/pattern.js +2 -2
  71. package/common/validate/rules/range.js +8 -5
  72. package/common/validate/rules/required.js +1 -1
  73. package/common/validate/rules/type.js +5 -5
  74. package/common/validate/rules/whitespace.js +1 -1
  75. package/common/validate/util.js +15 -16
  76. package/common/validate/validations/integer.js +1 -1
  77. package/common/validate/validations/method.js +1 -1
  78. package/currency/index.js +74 -7
  79. package/currency/vue.js +21 -5
  80. package/date-panel/index.js +16 -0
  81. package/date-panel/vue.js +8 -2
  82. package/date-picker-mobile/index.js +12 -0
  83. package/date-picker-mobile/vue.js +7 -1
  84. package/date-range/vue.js +15 -6
  85. package/date-table/index.js +35 -53
  86. package/date-table/vue.js +4 -2
  87. package/dialog-box/index.js +46 -14
  88. package/dialog-box/vue.js +30 -7
  89. package/dialog-select/index.js +6 -3
  90. package/dialog-select/vue.js +8 -4
  91. package/drawer/index.js +27 -5
  92. package/drawer/vue.js +14 -7
  93. package/dropdown/index.js +7 -7
  94. package/dropdown/vue.js +6 -2
  95. package/dropdown-item/index.js +9 -1
  96. package/dropdown-item/mf.js +6 -10
  97. package/dropdown-item/vue.js +20 -7
  98. package/dropdown-menu/index.js +20 -7
  99. package/dropdown-menu/vue.js +4 -3
  100. package/exception/index.js +2 -7
  101. package/exception/vue.js +7 -10
  102. package/fall-menu/index.js +5 -1
  103. package/fall-menu/vue.js +13 -2
  104. package/file-upload/index.js +68 -18
  105. package/file-upload/vue.js +38 -8
  106. package/filter-box/index.js +1 -0
  107. package/float-button/index.js +42 -0
  108. package/float-button/vue.js +101 -0
  109. package/floating-button/index.js +62 -16
  110. package/floating-button/vue.js +27 -9
  111. package/flowchart/index.js +134 -25
  112. package/flowchart/node.js +13 -4
  113. package/flowchart/vue.js +16 -4
  114. package/form/vue.js +8 -0
  115. package/form-item/index.js +5 -5
  116. package/form-item/vue.js +3 -1
  117. package/fullscreen/index.js +5 -5
  118. package/fullscreen/vue.js +3 -3
  119. package/grid/plugins/export.js +5 -2
  120. package/grid/utils/column.js +1 -0
  121. package/grid/utils/dom.js +7 -1
  122. package/image/index.js +6 -1
  123. package/image/vue.js +6 -3
  124. package/image-viewer/index.js +62 -51
  125. package/image-viewer/vue.js +17 -5
  126. package/input/index.js +81 -20
  127. package/input/vue.js +44 -18
  128. package/ip-address/index.js +61 -19
  129. package/ip-address/vue.js +22 -4
  130. package/link/vue.js +3 -1
  131. package/loading/index.js +2 -2
  132. package/loading/vue.js +8 -2
  133. package/logout/index.js +1 -1
  134. package/menu/index.js +15 -2
  135. package/menu/vue.js +22 -17
  136. package/mind-map/index.js +47 -0
  137. package/mind-map/vue.js +53 -0
  138. package/modal/index.js +44 -4
  139. package/modal/vue.js +18 -4
  140. package/multi-select/index.js +186 -11
  141. package/multi-select/vue.js +60 -15
  142. package/multi-select-item/index.js +23 -0
  143. package/multi-select-item/vue.js +31 -0
  144. package/numeric/index.js +48 -12
  145. package/numeric/vue.js +44 -19
  146. package/option/index.js +27 -9
  147. package/option/vue.js +37 -21
  148. package/option-group/index.js +3 -3
  149. package/package.json +1 -1
  150. package/pager/index.js +18 -4
  151. package/pager/vue.js +16 -5
  152. package/picker/index.js +290 -77
  153. package/picker/mb.js +42 -0
  154. package/picker/vue.js +76 -20
  155. package/picker-column/index.js +1 -1
  156. package/pop-upload/vue.js +3 -0
  157. package/popconfirm/index.js +3 -6
  158. package/popconfirm/vue.js +1 -1
  159. package/popeditor/index.js +73 -34
  160. package/popeditor/vue.js +15 -11
  161. package/popover/index.js +4 -4
  162. package/popover/vue.js +6 -6
  163. package/popup/index.js +3 -3
  164. package/popup/vue.js +5 -5
  165. package/pull-refresh/index.js +13 -13
  166. package/pull-refresh/vue.js +5 -4
  167. package/radio/index.js +0 -17
  168. package/radio/vue.js +4 -10
  169. package/rate/index.js +1 -1
  170. package/rate/vue.js +0 -2
  171. package/record/index.js +4 -1
  172. package/rich-text/clipboard.js +54 -0
  173. package/rich-text/index.js +192 -0
  174. package/rich-text/module/file-upload.js +107 -0
  175. package/rich-text/module/image-drop.js +63 -0
  176. package/rich-text/module/image-upload.js +89 -0
  177. package/rich-text/options.js +141 -0
  178. package/rich-text/table-module.js +382 -0
  179. package/rich-text/vue.js +102 -0
  180. package/{rich-text-edtior → rich-text-editor}/index.js +2 -2
  181. package/{rich-text-edtior → rich-text-editor}/vue.js +2 -5
  182. package/scrollbar/index.js +11 -11
  183. package/scrollbar/vue-bar.js +3 -3
  184. package/scrollbar/vue.js +5 -5
  185. package/search/index.js +9 -9
  186. package/search/vue.js +8 -6
  187. package/select/index.js +442 -393
  188. package/select/vue.js +278 -164
  189. package/select-dropdown/index.js +61 -3
  190. package/select-dropdown/vue.js +85 -8
  191. package/select-view/index.js +3 -1
  192. package/selected-box/index.js +2 -0
  193. package/selected-box/vue.js +6 -3
  194. package/signature/index.js +241 -0
  195. package/signature/vue.js +88 -0
  196. package/skeleton/index.js +14 -0
  197. package/skeleton/vue.js +15 -0
  198. package/skeleton-item/vue.js +15 -0
  199. package/slider/index.js +70 -17
  200. package/slider/vue.js +16 -7
  201. package/split/index.js +5 -3
  202. package/split/vue.js +4 -6
  203. package/standard-list-item/index.js +15 -1
  204. package/standard-list-item/vue.js +6 -5
  205. package/steps/index.js +25 -2
  206. package/steps/slide-bar.js +8 -1
  207. package/steps/vue.js +15 -3
  208. package/tab-item-mf/vue.js +14 -8
  209. package/tab-nav/index.js +30 -5
  210. package/tab-nav/vue.js +16 -4
  211. package/tabbar/vue.js +9 -3
  212. package/tabbar-item/vue.js +3 -2
  213. package/tabs/index.js +16 -4
  214. package/tabs/vue.js +2 -1
  215. package/tabs-mf/index.js +20 -6
  216. package/tabs-mf/vue-nav.js +26 -11
  217. package/tabs-mf/vue.js +7 -7
  218. package/tabs-mf/wheel.js +1 -0
  219. package/tag/index.js +1 -1
  220. package/tag-group/index.js +2 -1
  221. package/time/index.js +5 -2
  222. package/time/vue.js +1 -1
  223. package/time-line/index.js +3 -3
  224. package/time-line/vue.js +2 -2
  225. package/time-picker-mobile/index.js +24 -5
  226. package/time-picker-mobile/vue.js +17 -7
  227. package/time-range/index.js +2 -0
  228. package/timeline-item/vue.js +1 -1
  229. package/tooltip/index.js +6 -3
  230. package/tooltip/vue.js +4 -4
  231. package/transfer/index.js +20 -22
  232. package/transfer/vue.js +1 -6
  233. package/transfer-panel/vue.js +3 -5
  234. package/tree/index.js +21 -4
  235. package/tree/vue.js +10 -8
  236. package/tree-menu/index.js +29 -3
  237. package/tree-menu/vue.js +28 -15
  238. package/tree-node/index.js +18 -18
  239. package/tree-node/vue.js +6 -5
  240. package/types/action-sheet.type.d.ts +118 -1
  241. package/types/amount.type.d.ts +168 -1
  242. package/types/area.type.d.ts +134 -1
  243. package/types/async-flowchart.type.d.ts +72 -0
  244. package/types/autocomplete.type.d.ts +199 -1
  245. package/types/badge.type.d.ts +3 -1
  246. package/types/breadcrumb-item.type.d.ts +2 -0
  247. package/types/breadcrumb.type.d.ts +2 -0
  248. package/types/button-group.type.d.ts +3 -3
  249. package/types/button.type.d.ts +4 -0
  250. package/types/cascader-menu.type.d.ts +3 -4
  251. package/types/cascader-node.type.d.ts +5 -2
  252. package/types/cascader-panel.type-2bd03be3.d.ts +241 -0
  253. package/types/cascader-panel.type.d.ts +3 -241
  254. package/types/cascader.type.d.ts +329 -1
  255. package/types/checkbox.type.d.ts +6 -0
  256. package/types/collapse.type.d.ts +19 -2
  257. package/types/date-picker.type.d.ts +38 -1
  258. package/types/dialog-box.type.d.ts +13 -3
  259. package/types/drawer.type.d.ts +133 -1
  260. package/types/{dropdown-item.type-8ea6c633.d.ts → dropdown-item.type-8475a549.d.ts} +7 -13
  261. package/types/dropdown-item.type.d.ts +1 -1
  262. package/types/dropdown-menu.type.d.ts +1 -1
  263. package/types/dropdown.type.d.ts +1 -5
  264. package/types/fall-menu.type.d.ts +94 -1
  265. package/types/file-upload.type.d.ts +1 -1
  266. package/types/float-button.type.d.ts +123 -0
  267. package/types/form-item.type.d.ts +1 -1
  268. package/types/{form.type-d0fd42f3.d.ts → form.type-a2dc0099.d.ts} +4 -1
  269. package/types/form.type.d.ts +1 -1
  270. package/types/{index-e0250f63.d.ts → index-b012f687.d.ts} +9 -0
  271. package/types/input.type.d.ts +2 -6
  272. package/types/ip-address.type.d.ts +160 -1
  273. package/types/link.type.d.ts +6 -3
  274. package/types/loading.type.d.ts +7 -0
  275. package/types/mind-map.type.d.ts +20 -0
  276. package/types/modal.type.d.ts +29 -2
  277. package/types/numeric.type.d.ts +41 -10
  278. package/types/pager.type.d.ts +12 -0
  279. package/types/picker.type.d.ts +18 -0
  280. package/types/popconfirm.type.d.ts +86 -1
  281. package/types/popeditor.type.d.ts +4 -0
  282. package/types/popover.type.d.ts +3 -3
  283. package/types/progress.type.d.ts +2 -0
  284. package/types/radio.type.d.ts +0 -4
  285. package/types/rate.type.d.ts +236 -1
  286. package/types/search.type.d.ts +88 -1
  287. package/types/shared.type.d.ts +1 -1
  288. package/types/skeleton-item.type.d.ts +38 -0
  289. package/types/skeleton.type.d.ts +45 -0
  290. package/types/slider.type.d.ts +49 -10
  291. package/types/steps.type.d.ts +14 -3
  292. package/types/tab-bar.type.d.ts +1 -1
  293. package/types/tab-nav.type.d.ts +7 -2
  294. package/types/tabs.type.d.ts +9 -1
  295. package/types/tag-group.type.d.ts +64 -1
  296. package/types/{time-line.type-d7daa669.d.ts → time-line.type-b155cb4f.d.ts} +12 -0
  297. package/types/time-line.type.d.ts +1 -1
  298. package/types/timeline-item.type.d.ts +1 -1
  299. package/types/tooltip.type.d.ts +2 -2
  300. package/types/transfer.type.d.ts +185 -1
  301. package/types/tree-menu.type.d.ts +210 -1
  302. package/types/upload-dragger.type.d.ts +1 -1
  303. package/types/{upload-list.type-343e8c11.d.ts → upload-list.type-6d6e3d0e.d.ts} +35 -8
  304. package/types/upload-list.type.d.ts +1 -1
  305. package/types/upload.type.d.ts +1 -1
  306. package/types/user-head.type.d.ts +146 -1
  307. package/types/wizard.type.d.ts +1 -0
  308. package/upload/index.js +64 -34
  309. package/upload/vue.js +9 -5
  310. package/upload-dragger/index.js +22 -20
  311. package/upload-list/index.js +24 -18
  312. package/upload-list/vue.js +9 -4
  313. package/user/index.js +35 -26
  314. package/user/vue.js +1 -1
  315. package/user-head/index.js +3 -3
  316. package/watermark/index.js +11 -0
  317. package/wheel/index.js +3 -0
  318. package/wizard/vue.js +4 -2
  319. package/common/deps/modal-queue.js +0 -6
  320. package/common/deps/requestAnimationFrame.js +0 -25
@@ -0,0 +1,63 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ const ImageDrop = function(quill) {
3
+ this.quill = quill;
4
+ this.handleDrop = this.handleDrop.bind(this);
5
+ this.handlePaste = this.handlePaste.bind(this);
6
+ this.quill.root.addEventListener("drop", this.handleDrop, false);
7
+ this.quill.root.addEventListener("paste", this.handlePaste, false);
8
+ };
9
+ ImageDrop.prototype.handleDrop = function(event) {
10
+ event.preventDefault();
11
+ if (event.dataTransfer && event.dataTransfer.files && event.dataTransfer.files.length) {
12
+ if (document.caretRangeFromPoint) {
13
+ const selection = document.getSelection();
14
+ const range = document.caretRangeFromPoint(event.clientX, event.clientY);
15
+ if (selection && range) {
16
+ selection.setBaseAndExtent(range.startContainer, range.startOffset, range.startContainer, range.startOffset);
17
+ }
18
+ }
19
+ this.readFiles(event.dataTransfer.files, this.insert.bind(this));
20
+ }
21
+ };
22
+ ImageDrop.prototype.handlePaste = function(e) {
23
+ if (e.clipboardData && e.clipboardData.items && e.clipboardData.items.length) {
24
+ this.readFiles(
25
+ e.clipboardData.items,
26
+ function(dataUrl) {
27
+ const selection = this.quill.getSelection();
28
+ if (!selection) {
29
+ setTimeout(
30
+ function() {
31
+ this.insert(dataUrl);
32
+ }.bind(this),
33
+ 0
34
+ );
35
+ }
36
+ }.bind(this)
37
+ );
38
+ }
39
+ };
40
+ ImageDrop.prototype.insert = function(dataUrl) {
41
+ const index = (this.quill.getSelection() || {}).index || this.quill.getLength();
42
+ this.quill.insertEmbed(index, "image", dataUrl, "user");
43
+ };
44
+ ImageDrop.prototype.readFiles = function(files, callback) {
45
+ ;
46
+ [].forEach.call(files, function(file) {
47
+ if (!file.type.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon)/i)) {
48
+ return;
49
+ }
50
+ const reader = new FileReader();
51
+ reader.onload = function(e) {
52
+ callback(e.target.result);
53
+ };
54
+ const blob = file.getAsFile ? file.getAsFile() : file;
55
+ if (blob instanceof Blob) {
56
+ reader.readAsDataURL(blob);
57
+ }
58
+ });
59
+ };
60
+ var image_drop_default = ImageDrop;
61
+ export {
62
+ image_drop_default as default
63
+ };
@@ -0,0 +1,89 @@
1
+ import "../../chunk-G2ADBYYC.js";
2
+ import { xss } from "../../common/xss";
3
+ const ImageUpload = function(quill, options) {
4
+ this.quill = quill;
5
+ this.options = options || {};
6
+ this.quill.getModule("toolbar").addHandler("image", this.selectLocalImage.bind(this));
7
+ };
8
+ ImageUpload.prototype.selectLocalImage = function() {
9
+ const input = document.createElement("input");
10
+ input.setAttribute("type", "file");
11
+ input.click();
12
+ input.onchange = function() {
13
+ const file = input.files[0];
14
+ if (/^image\//.test(file.type)) {
15
+ const checkBeforeSend = this.options.checkBeforeSend || this.checkBeforeSend.bind(this);
16
+ checkBeforeSend(file, this.sendToServer.bind(this));
17
+ } else {
18
+ throw new Error("You could only upload images.");
19
+ }
20
+ }.bind(this);
21
+ };
22
+ ImageUpload.prototype.checkBeforeSend = function(file, next) {
23
+ next(file);
24
+ };
25
+ ImageUpload.prototype.sendToServer = function(file) {
26
+ if (this.options.customUploader) {
27
+ this.options.customUploader(
28
+ file,
29
+ function(dataUrl) {
30
+ this.insert(dataUrl);
31
+ }.bind(this)
32
+ );
33
+ } else {
34
+ const url = xss.filterUrl(this.options.url);
35
+ const method = this.options.method || "POST";
36
+ const name = this.options.name || "image";
37
+ const headers = this.options.headers || {};
38
+ const callbackOK = this.options.success || this.uploadImageCallbackOK.bind(this);
39
+ const callbackKO = this.options.fail || this.uploadImageCallbackKO.bind(this);
40
+ if (url) {
41
+ const fd = new FormData();
42
+ fd.append(name, file);
43
+ if (this.options.csrf) {
44
+ fd.append(this.options.csrf.token, this.options.csrf.hash);
45
+ }
46
+ const xmlHttpRequest = new XMLHttpRequest();
47
+ xmlHttpRequest.open(method, url, true);
48
+ for (let index in headers) {
49
+ xmlHttpRequest.setRequestHeader(index, headers[index]);
50
+ }
51
+ xmlHttpRequest.onload = function() {
52
+ if (xmlHttpRequest.status === 200 || xmlHttpRequest.status === 201) {
53
+ callbackOK(JSON.parse(xmlHttpRequest.responseText), this.insert.bind(this));
54
+ } else {
55
+ callbackKO({
56
+ code: xmlHttpRequest.status,
57
+ type: xmlHttpRequest.statusText,
58
+ body: xmlHttpRequest.responseText
59
+ });
60
+ }
61
+ }.bind(this);
62
+ if (this.options.withCredentials) {
63
+ xmlHttpRequest.withCredentials = true;
64
+ }
65
+ xmlHttpRequest.send(fd);
66
+ } else {
67
+ const reader = new FileReader();
68
+ reader.onload = function(event) {
69
+ callbackOK(event.target.result, this.insert.bind(this));
70
+ }.bind(this);
71
+ reader.readAsDataURL(file);
72
+ }
73
+ }
74
+ };
75
+ ImageUpload.prototype.insert = function(dataUrl) {
76
+ const index = (this.quill.getSelection() || {}).index || this.quill.getLength();
77
+ this.quill.insertEmbed(index, "image", dataUrl, "user");
78
+ this.quill.setSelection(index + 1);
79
+ };
80
+ ImageUpload.prototype.uploadImageCallbackOK = function(response, next) {
81
+ next(response);
82
+ };
83
+ ImageUpload.prototype.uploadImageCallbackKO = function(error) {
84
+ throw new Error(error);
85
+ };
86
+ var image_upload_default = ImageUpload;
87
+ export {
88
+ image_upload_default as default
89
+ };
@@ -0,0 +1,141 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ const size = ["small", false, "large", "huge"];
3
+ const underline = ["bold", "italic", "underline", "strike"];
4
+ const media = ["link", "image", "video", "file"];
5
+ const header = [{ header: [1, 2, 3, 4, 5, 6, false] }];
6
+ const script = [{ script: "sub" }, { script: "super" }];
7
+ const defaultOptions = {
8
+ theme: "snow",
9
+ boundary: document.body,
10
+ modules: {
11
+ tableModule: true,
12
+ toolbar: {
13
+ container: [
14
+ underline,
15
+ ["blockquote", "code-block"],
16
+ [{ header: 1 }, { header: 2 }],
17
+ [{ list: "ordered" }, { list: "bullet" }],
18
+ script,
19
+ [{ indent: "-1" }, { indent: "+1" }],
20
+ [{ direction: "rtl" }],
21
+ [{ size }],
22
+ header,
23
+ [{ color: [] }, { background: [] }],
24
+ [{ font: [] }],
25
+ [{ align: [] }],
26
+ ["clean"],
27
+ media
28
+ ],
29
+ handlers: {
30
+ file(value) {
31
+ if (!value) {
32
+ this.quill.format("file", false);
33
+ }
34
+ }
35
+ }
36
+ },
37
+ clipboard: { matchVisual: false }
38
+ },
39
+ placeholder: "Insert text here ...",
40
+ readOnly: false
41
+ };
42
+ const getToolbarTips = (t) => [
43
+ { Choice: ".ql-bold", title: t("ui.richText.bold") },
44
+ { Choice: ".ql-italic", title: t("ui.richText.italic") },
45
+ { Choice: ".ql-underline", title: t("ui.richText.underline") },
46
+ { Choice: ".ql-header", title: t("ui.richText.header") },
47
+ { Choice: ".ql-strike", title: t("ui.richText.strike") },
48
+ { Choice: ".ql-blockquote", title: t("ui.richText.blockquote") },
49
+ { Choice: ".ql-code-block", title: t("ui.richText.codeBlock") },
50
+ { Choice: ".ql-size", title: t("ui.richText.size") },
51
+ { Choice: '.ql-list[value="ordered"]', title: t("ui.richText.listOrdered") },
52
+ { Choice: '.ql-list[value="bullet"]', title: t("ui.richText.listBullet") },
53
+ { Choice: '.ql-header[value="1"]', title: t("ui.richText.header1") },
54
+ { Choice: '.ql-header[value="2"]', title: t("ui.richText.header2") },
55
+ { Choice: ".ql-align", title: t("ui.richText.align") },
56
+ { Choice: ".ql-color", title: t("ui.richText.color") },
57
+ { Choice: ".ql-background", title: t("ui.richText.background") },
58
+ { Choice: ".ql-image", title: t("ui.richText.image") },
59
+ { Choice: ".ql-video", title: t("ui.richText.video") },
60
+ { Choice: ".ql-link", title: t("ui.richText.link") },
61
+ { Choice: ".ql-formula", title: t("ui.richText.formula") },
62
+ { Choice: ".ql-clean", title: t("ui.richText.clean") },
63
+ { Choice: '.ql-indent[value="-1"]', title: t("ui.richText.indent1") },
64
+ { Choice: '.ql-indent[value="+1"]', title: t("ui.richText.indent2") },
65
+ {
66
+ Choice: ".ql-header .ql-picker-label",
67
+ title: t("ui.richText.pickerLabel")
68
+ },
69
+ {
70
+ Choice: '.ql-header .ql-picker-item[data-value="1"]',
71
+ title: t("ui.richText.headerPicker1")
72
+ },
73
+ {
74
+ Choice: '.ql-header .ql-picker-item[data-value="2"]',
75
+ title: t("ui.richText.headerPicker2")
76
+ },
77
+ {
78
+ Choice: '.ql-header .ql-picker-item[data-value="3"]',
79
+ title: t("ui.richText.headerPicker3")
80
+ },
81
+ {
82
+ Choice: '.ql-header .ql-picker-item[data-value="4"]',
83
+ title: t("ui.richText.headerPicker4")
84
+ },
85
+ {
86
+ Choice: '.ql-header .ql-picker-item[data-value="5"]',
87
+ title: t("ui.richText.headerPicker5")
88
+ },
89
+ {
90
+ Choice: '.ql-header .ql-picker-item[data-value="6"]',
91
+ title: t("ui.richText.headerPicker6")
92
+ },
93
+ {
94
+ Choice: ".ql-header .ql-picker-item:last-child",
95
+ title: t("ui.richText.normal")
96
+ },
97
+ {
98
+ Choice: '.ql-size .ql-picker-item[data-value="small"]',
99
+ title: t("ui.richText.sizeSmall")
100
+ },
101
+ {
102
+ Choice: '.ql-size .ql-picker-item[data-value="large"]',
103
+ title: t("ui.richText.sizeLarge")
104
+ },
105
+ {
106
+ Choice: '.ql-size .ql-picker-item[data-value="huge"]',
107
+ title: t("ui.richText.sizeHuge")
108
+ },
109
+ {
110
+ Choice: ".ql-size .ql-picker-item:nth-child(2)",
111
+ title: t("ui.richText.normal")
112
+ },
113
+ {
114
+ Choice: ".ql-align .ql-picker-item:first-child",
115
+ title: t("ui.richText.alignPicker1")
116
+ },
117
+ {
118
+ Choice: '.ql-align .ql-picker-item[data-value="center"]',
119
+ title: t("ui.richText.alignPicker2")
120
+ },
121
+ {
122
+ Choice: '.ql-align .ql-picker-item[data-value="right"]',
123
+ title: t("ui.richText.alignPicker3")
124
+ },
125
+ {
126
+ Choice: '.ql-align .ql-picker-item[data-value="justify"]',
127
+ title: t("ui.richText.alignPicker4")
128
+ },
129
+ { Choice: '.ql-script[value="sub"]', title: t("ui.richText.subScript") },
130
+ { Choice: '.ql-script[value="super"]', title: t("ui.richText.superScript") },
131
+ {
132
+ Choice: '.ql-direction[value="rtl"]',
133
+ title: t("ui.richText.directionRTL")
134
+ },
135
+ { Choice: ".ql-font", title: t("ui.richText.font") },
136
+ { Choice: ".ql-file", title: t("ui.richText.file") }
137
+ ];
138
+ export {
139
+ defaultOptions,
140
+ getToolbarTips
141
+ };
@@ -0,0 +1,382 @@
1
+ import "../chunk-G2ADBYYC.js";
2
+ import { random } from "../common/string";
3
+ import { isNull } from "../common/type";
4
+ function cellName() {
5
+ return random().toString(36).slice(2);
6
+ }
7
+ function addMatcherTable({ _quill, oper }) {
8
+ _quill.clipboard.addMatcher("TABLE", function(node, delta) {
9
+ const id = cellName();
10
+ oper.setTableId(id);
11
+ return delta;
12
+ });
13
+ }
14
+ function addMatcherTr({ _quill, oper }) {
15
+ _quill.clipboard.addMatcher("TR", function(node, delta) {
16
+ const id = cellName();
17
+ oper.setRowId(id);
18
+ return delta;
19
+ });
20
+ }
21
+ function addMatcherTd({ _quill, oper, Delta }) {
22
+ _quill.clipboard.addMatcher("TD", function(node, delta) {
23
+ const tableId = oper.getTableId();
24
+ const rowId = oper.getRowId();
25
+ const cellId = cellName();
26
+ if (delta.ops.length) {
27
+ const lastOp = delta.ops[delta.ops.length - 1];
28
+ if (typeof lastOp.insert === "string" && !lastOp.insert.endsWith("\n")) {
29
+ lastOp.insert += "\n";
30
+ }
31
+ } else {
32
+ delta.insert("\n");
33
+ }
34
+ const attributes = { td: tableId + "|" + rowId + "|" + cellId };
35
+ if (node.rowSpan) {
36
+ attributes.rowSpan = node.rowSpan;
37
+ }
38
+ if (node.colSpan) {
39
+ attributes.colSpan = node.colSpan;
40
+ }
41
+ if (node.width) {
42
+ attributes.width = node.width;
43
+ }
44
+ if (node.height) {
45
+ attributes.height = node.height;
46
+ }
47
+ return delta.compose(new Delta().retain(delta.length(), attributes));
48
+ });
49
+ }
50
+ function addMatcher3(_quill) {
51
+ _quill.clipboard.addMatcher(3, function(node, delta) {
52
+ if (["TABLE", "TR"].includes(node.parentNode.tagName)) {
53
+ return { ops: [] };
54
+ } else {
55
+ return delta;
56
+ }
57
+ });
58
+ }
59
+ function addMatcherFont(_quill) {
60
+ _quill.clipboard.addMatcher("FONT", function(node, delta) {
61
+ if (node.innerText === "") {
62
+ return { ops: [] };
63
+ } else {
64
+ return delta;
65
+ }
66
+ });
67
+ }
68
+ function addMatcher({ qil: _quill, Delta }) {
69
+ let tableId = cellName();
70
+ let rowId = cellName();
71
+ let oper = {
72
+ getTableId() {
73
+ return tableId;
74
+ },
75
+ setTableId(id) {
76
+ tableId = id;
77
+ },
78
+ getRowId() {
79
+ return rowId;
80
+ },
81
+ setRowId(id) {
82
+ rowId = id;
83
+ }
84
+ };
85
+ addMatcherTable({ _quill, oper });
86
+ addMatcherTr({ _quill, oper });
87
+ addMatcherTd({ _quill, oper, Delta });
88
+ addMatcher3(_quill);
89
+ addMatcherFont(_quill);
90
+ }
91
+ let quill = /* @__PURE__ */ Object.create(null);
92
+ function setQuill(q) {
93
+ quill = q;
94
+ }
95
+ function getQuill() {
96
+ return quill;
97
+ }
98
+ function getLeafFromQuill() {
99
+ let q = getQuill();
100
+ return q ? q.getLeaf(q.getSelection().index) : [];
101
+ }
102
+ function provideTableTrick({ Parchment }) {
103
+ class TableTrick {
104
+ static findTd(what) {
105
+ const leaf = getLeafFromQuill();
106
+ let blot = leaf[0];
107
+ while (!isNull(blot) && blot.statics.blotName !== what) {
108
+ blot = blot.parent;
109
+ }
110
+ return blot;
111
+ }
112
+ static appendCol() {
113
+ const td = TableTrick.findTd("td");
114
+ if (td) {
115
+ const table = td.parent.parent;
116
+ const tableId = table.domNode.getAttribute("table_id");
117
+ td.parent.parent.children.forEach(function(tr) {
118
+ const rowId = tr.domNode.getAttribute("row_id");
119
+ const cellId = cellName();
120
+ const tdNew = Parchment.create("td", tableId + "|" + rowId + "|" + cellId);
121
+ tr.appendChild(tdNew);
122
+ });
123
+ }
124
+ }
125
+ static appendRow() {
126
+ const td = TableTrick.findTd("td");
127
+ if (td) {
128
+ const colCount = td.parent.children.length;
129
+ const table = td.parent.parent;
130
+ const newRow = td.parent.clone();
131
+ const tableId = table.domNode.getAttribute("table_id");
132
+ const rowId = cellName();
133
+ newRow.domNode.setAttribute("row_id", rowId);
134
+ for (let i = colCount - 1; i >= 0; i--) {
135
+ const cellId = cellName();
136
+ const tdNew = Parchment.create("td", tableId + "|" + rowId + "|" + cellId);
137
+ newRow.appendChild(tdNew);
138
+ }
139
+ table.appendChild(newRow);
140
+ }
141
+ }
142
+ }
143
+ return { TableTrick };
144
+ }
145
+ function createTable({ value, Container, Parchment, Scroll }) {
146
+ let node = null;
147
+ const sizes = value.split("_");
148
+ const rowCount = Number.parseInt(sizes[1]);
149
+ const colCount = Number.parseInt(sizes[2]);
150
+ const tableId = cellName();
151
+ const table = Parchment.create("table", tableId);
152
+ for (let ri = 0; ri < rowCount; ri++) {
153
+ const rowId = cellName();
154
+ const tr = Parchment.create("tr", rowId);
155
+ table.appendChild(tr);
156
+ for (let ci = 0; ci < colCount; ci++) {
157
+ const cellId = cellName();
158
+ value = tableId + "|" + rowId + "|" + cellId;
159
+ const td = Parchment.create("td", value);
160
+ const p = Parchment.create("block");
161
+ const br = Parchment.create("break");
162
+ tr.appendChild(td);
163
+ td.appendChild(p);
164
+ p.appendChild(br);
165
+ node = p;
166
+ }
167
+ }
168
+ const leaf = getLeafFromQuill();
169
+ let blot = leaf[0];
170
+ let topBranch = null;
171
+ while (!isNull(blot) && !(blot instanceof Container || blot instanceof Scroll)) {
172
+ topBranch = blot;
173
+ blot = blot.parent;
174
+ }
175
+ blot && blot.insertBefore(table, topBranch);
176
+ return node;
177
+ }
178
+ function provideTable({ Container, Parchment, Scroll, TableTrick, TableRow }) {
179
+ class Table extends Container {
180
+ static create(value) {
181
+ if (value === "append-row") {
182
+ return TableTrick.appendRow();
183
+ } else if (value === "append-col") {
184
+ return TableTrick.appendCol();
185
+ } else if (value.includes("newtable_")) {
186
+ return createTable({ value, Container, Parchment, Scroll });
187
+ } else {
188
+ const tagName = "table";
189
+ const node = super.create(tagName);
190
+ node.setAttribute("table_id", value);
191
+ return node;
192
+ }
193
+ }
194
+ optimize() {
195
+ super.optimize();
196
+ const next = this.next;
197
+ if (!isNull(next) && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute("table_id") === this.domNode.getAttribute("table_id")) {
198
+ next.moveChildren(this);
199
+ next.remove();
200
+ }
201
+ }
202
+ }
203
+ Table.blotName = "table";
204
+ Table.tagName = "table";
205
+ Table.scope = Parchment.Scope.BLOCK_BLOT;
206
+ Table.defaultChild = "tr";
207
+ Table.allowedChildren = [TableRow];
208
+ return { Table };
209
+ }
210
+ function provideTableModule({ Container, Parchment, Module, Quill, Scroll, Delta, ContainBlot, TableRow, TableCell }) {
211
+ const { TableTrick } = provideTableTrick({ Parchment });
212
+ const { Table } = provideTable({
213
+ Container,
214
+ Parchment,
215
+ Scroll,
216
+ TableTrick,
217
+ TableRow
218
+ });
219
+ class TableModule extends Module {
220
+ constructor(qil, opt) {
221
+ super(qil, opt);
222
+ addMatcher({ qil, Delta });
223
+ setQuill(qil);
224
+ }
225
+ static register() {
226
+ Quill.register(ContainBlot, true);
227
+ Quill.register(TableRow, true);
228
+ Quill.register(Table, true);
229
+ Quill.register(TableCell, true);
230
+ }
231
+ }
232
+ return { TableModule };
233
+ }
234
+ function provideContainBlot({ Container, Parchment, Block, BlockEmbed }) {
235
+ class ContainBlot extends Container {
236
+ static create() {
237
+ return super.create("contain");
238
+ }
239
+ static formats(domNode) {
240
+ return domNode.tagName;
241
+ }
242
+ insertBefore(blot, ref) {
243
+ if (blot.statics.blotName === this.statics.blotName) {
244
+ super.insertBefore(blot.children.head, ref);
245
+ } else {
246
+ super.insertBefore(blot, ref);
247
+ }
248
+ }
249
+ formats() {
250
+ return { [this.statics.blotName]: this.statics.formats(this.domNode) };
251
+ }
252
+ replace(target) {
253
+ if (target.statics.blotName !== this.statics.blotName) {
254
+ const item = Parchment.create(this.statics.defaultChild);
255
+ target.moveChildren(item);
256
+ this.appendChild(item);
257
+ }
258
+ if (isNull(target.parent))
259
+ return;
260
+ super.replace(target);
261
+ }
262
+ }
263
+ ContainBlot.blotName = "contain";
264
+ ContainBlot.tagName = "contain";
265
+ ContainBlot.scope = Parchment.Scope.BLOCK_BLOT;
266
+ ContainBlot.defaultChild = "block";
267
+ ContainBlot.allowedChildren = [Block, BlockEmbed, Container];
268
+ return { ContainBlot };
269
+ }
270
+ function provideTableRow({ Container, Parchment }) {
271
+ class TableRow extends Container {
272
+ static create(value) {
273
+ const node = super.create("tr");
274
+ node.setAttribute("row_id", value);
275
+ return node;
276
+ }
277
+ optimize() {
278
+ super.optimize();
279
+ const next = this.next;
280
+ if (!isNull(next) && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute("row_id") === this.domNode.getAttribute("row_id")) {
281
+ next.moveChildren(this);
282
+ next.remove();
283
+ }
284
+ }
285
+ }
286
+ TableRow.blotName = "tr";
287
+ TableRow.tagName = "tr";
288
+ TableRow.scope = Parchment.Scope.BLOCK_BLOT;
289
+ TableRow.defaultChild = "td";
290
+ return { TableRow };
291
+ }
292
+ function setAttrs({ node, value }) {
293
+ const ids = value.split("|");
294
+ node.setAttribute("table_id", ids[0]);
295
+ node.setAttribute("row_id", ids[1]);
296
+ node.setAttribute("cell_id", ids[2]);
297
+ return node;
298
+ }
299
+ function provideTableCell({ Container, Parchment, Block, BlockEmbed, ContainBlot }) {
300
+ class TableCell extends ContainBlot {
301
+ static create(value) {
302
+ return setAttrs({ node: super.create("td"), value });
303
+ }
304
+ formatAt(index, length, name, value) {
305
+ super.formatAt(index, length, name, value);
306
+ const attrWhitelist = ["colSpan", "rowSpan", "width", "height"];
307
+ attrWhitelist.includes(name) && this.domNode.setAttribute(name, value);
308
+ }
309
+ formats() {
310
+ const domNode = this.domNode;
311
+ const blotName = this.statics.blotName;
312
+ const attr = (domNode2, attr2) => domNode2.getAttribute(attr2);
313
+ return {
314
+ [blotName]: `${attr(domNode, "table_id")}|${attr(domNode, "row_id")}|${attr(domNode, "row_id")}`
315
+ };
316
+ }
317
+ optimize() {
318
+ super.optimize();
319
+ if (!isNull(this.parent) && this.parent.statics.blotName !== "tr") {
320
+ const mark = Parchment.create("block");
321
+ this.parent.insertBefore(mark, this.next);
322
+ const table = Parchment.create("table", this.domNode.getAttribute("table_id"));
323
+ const tr = Parchment.create("tr", this.domNode.getAttribute("row_id"));
324
+ table.appendChild(tr);
325
+ tr.appendChild(this);
326
+ table.replace(mark);
327
+ }
328
+ if (!isNull(this.next) && this.next.prev === this && this.next.statics.blotName === this.statics.blotName && this.next.domNode.tagName === this.domNode.tagName && this.next.domNode.getAttribute("cell_id") === this.domNode.getAttribute("cell_id")) {
329
+ this.next.moveChildren(this);
330
+ this.next.remove();
331
+ }
332
+ }
333
+ }
334
+ TableCell.blotName = "td";
335
+ TableCell.tagName = "td";
336
+ TableCell.scope = Parchment.Scope.BLOCK_BLOT;
337
+ TableCell.defaultChild = "block";
338
+ TableCell.allowedChildren = [Block, BlockEmbed, Container];
339
+ return { TableCell };
340
+ }
341
+ function tableModule(Quill) {
342
+ const Container = Quill.import("blots/container");
343
+ const Scroll = Quill.import("blots/scroll");
344
+ const Module = Quill.import("core/module");
345
+ const Block = Quill.import("blots/block");
346
+ const Delta = Quill.import("delta");
347
+ const Parchment = Quill.import("parchment");
348
+ const BlockEmbed = Quill.import("blots/block/embed");
349
+ const { ContainBlot } = provideContainBlot({
350
+ Container,
351
+ Parchment,
352
+ Block,
353
+ BlockEmbed
354
+ });
355
+ const { TableRow } = provideTableRow({ Container, Parchment });
356
+ const { TableCell } = provideTableCell({
357
+ Container,
358
+ Parchment,
359
+ Block,
360
+ BlockEmbed,
361
+ ContainBlot
362
+ });
363
+ const params = {
364
+ Container,
365
+ Parchment,
366
+ Module,
367
+ Quill,
368
+ Scroll,
369
+ Delta,
370
+ ContainBlot,
371
+ TableRow,
372
+ TableCell
373
+ };
374
+ const { TableModule } = provideTableModule(params);
375
+ TableRow.allowedChildren = [TableCell];
376
+ Container.order = ["list", "contain", "td", "tr", "table"];
377
+ Quill.register("modules/tableModule", TableModule, true);
378
+ }
379
+ var table_module_default = tableModule;
380
+ export {
381
+ table_module_default as default
382
+ };