@ctzy-web-client/plugin-component-vue 1.0.9 → 1.0.10

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 (272) hide show
  1. package/es/_virtual/_plugin-vue_export-helper.mjs +9 -0
  2. package/es/advance-select/advance-operation.mjs +43 -0
  3. package/es/advance-select/advance-option.mjs +125 -0
  4. package/es/advance-select/advance-select.mjs +359 -0
  5. package/es/advance-select/events-helpers.mjs +29 -0
  6. package/es/advance-select/index.mjs +13 -0
  7. package/es/advance-select/use-advance-option.mjs +43 -0
  8. package/es/advance-select/use-advance-select.mjs +117 -0
  9. package/es/application-slot/application-slot.mjs +51 -0
  10. package/es/application-slot/breadcrumb-item.mjs +23 -0
  11. package/es/application-slot/header-tools-item.mjs +23 -0
  12. package/es/application-slot/index.mjs +16 -0
  13. package/es/breadcrumb-select/breadcrumb-select.mjs +155 -0
  14. package/es/breadcrumb-select/index.mjs +6 -0
  15. package/es/components.mjs +22 -0
  16. package/es/contextmenu/contextmenu-item.mjs +21 -0
  17. package/es/contextmenu/contextmenu.mjs +64 -0
  18. package/es/contextmenu/index.mjs +10 -0
  19. package/es/contextmenu/use-contextmenu.mjs +85 -0
  20. package/es/data-form/data-form-item.mjs +53 -0
  21. package/es/data-form/data-form.mjs +175 -0
  22. package/es/data-form/dynamic-component.mjs +23 -0
  23. package/es/data-form/form-components/Blots/AtBlot.mjs +25 -0
  24. package/es/data-form/form-components/bwa-date-picker.mjs +45 -0
  25. package/es/data-form/form-components/bwa-date-time-picker.mjs +50 -0
  26. package/es/data-form/form-components/bwa-input-float.mjs +43 -0
  27. package/es/data-form/form-components/bwa-input-integer.mjs +56 -0
  28. package/es/data-form/form-components/bwa-input.mjs +38 -0
  29. package/es/data-form/form-components/bwa-multi-select.mjs +35 -0
  30. package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +234 -0
  31. package/es/data-form/form-components/bwa-rich-text.mjs +325 -0
  32. package/es/data-form/form-components/bwa-select.mjs +76 -0
  33. package/es/data-form/form-components/bwa-textarea.mjs +33 -0
  34. package/es/data-form/form-components/bwa-upload.mjs +159 -0
  35. package/es/data-form/form-components/bwa-user-multi-select.mjs +30 -0
  36. package/es/data-form/form-components/bwa-user-select.mjs +69 -0
  37. package/es/data-form/index.mjs +34 -0
  38. package/es/data-table/data-column-view.mjs +131 -0
  39. package/es/data-table/data-table-card.mjs +118 -0
  40. package/es/data-table/data-table-column.mjs +56 -0
  41. package/es/data-table/data-table.mjs +369 -0
  42. package/es/data-table/dynamic-component.mjs +48 -0
  43. package/es/data-table/index.mjs +13 -0
  44. package/es/data-table/use-datatable-drag.mjs +110 -0
  45. package/es/datatable-settings/datatable-settings.mjs +309 -0
  46. package/es/datatable-settings/index.mjs +6 -0
  47. package/es/date-range/date-picker.mjs +128 -0
  48. package/es/date-range/date-range.mjs +177 -0
  49. package/es/date-range/index.mjs +6 -0
  50. package/es/drag-list/constants.mjs +3 -0
  51. package/es/drag-list/drag-item.mjs +49 -0
  52. package/es/drag-list/drag-list.mjs +56 -0
  53. package/es/drag-list/index.mjs +6 -0
  54. package/es/drag-list/use-drag-list.mjs +154 -0
  55. package/es/dragable/constants.mjs +4 -0
  56. package/es/dragable/dragable-item.mjs +25 -0
  57. package/es/dragable/dragable-operation.mjs +32 -0
  58. package/es/dragable/dragable.mjs +31 -0
  59. package/es/dragable/index.mjs +15 -0
  60. package/es/dragable/use-dragable.mjs +134 -0
  61. package/es/filter-panel/conditions/condition.mjs +30 -0
  62. package/es/filter-panel/conditions/date-range-condition.mjs +46 -0
  63. package/es/filter-panel/conditions/department-condition/department-condition.mjs +81 -0
  64. package/es/filter-panel/conditions/department-condition/department-node.mjs +74 -0
  65. package/es/filter-panel/conditions/index.mjs +21 -0
  66. package/es/filter-panel/conditions/input-condition.mjs +83 -0
  67. package/es/filter-panel/conditions/multi-user-condition.mjs +64 -0
  68. package/es/filter-panel/conditions/multiple-menu-condition.mjs +41 -0
  69. package/es/filter-panel/conditions/single-menu-condition.mjs +68 -0
  70. package/es/filter-panel/conditions/single-user-condition.mjs +64 -0
  71. package/es/filter-panel/filter-panel-item.mjs +47 -0
  72. package/es/filter-panel/filter-panel.mjs +180 -0
  73. package/es/filter-panel/index.mjs +15 -0
  74. package/es/filter-panel/use-filter-panel-item.mjs +52 -0
  75. package/es/filter-panel/use-filter-panel.mjs +135 -0
  76. package/es/hooks/use-data/index.mjs +152 -0
  77. package/es/index.mjs +27 -0
  78. package/es/layout/index.mjs +6 -0
  79. package/es/layout/layout.mjs +86 -0
  80. package/es/make-installer.mjs +34 -0
  81. package/es/math/Rectangle.mjs +25 -0
  82. package/es/menu/index.mjs +6 -0
  83. package/es/menu/menu-item.mjs +75 -0
  84. package/es/menu/menu.mjs +60 -0
  85. package/es/node_modules/.pnpm/@vueuse_core@9.6.0_vue@3.2.41/node_modules/@vueuse/core/index.mjs +6372 -0
  86. package/es/node_modules/.pnpm/@vueuse_shared@9.6.0_vue@3.2.41/node_modules/@vueuse/shared/index.mjs +1517 -0
  87. package/es/panel/index.mjs +6 -0
  88. package/es/panel/panel.mjs +55 -0
  89. package/es/panel-tabs/index.mjs +6 -0
  90. package/es/panel-tabs/panel-tabs.mjs +66 -0
  91. package/es/pct-filter-panel/index.mjs +10 -0
  92. package/es/pct-filter-panel/pct-compents/index.mjs +10 -0
  93. package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +71 -0
  94. package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +74 -0
  95. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +186 -0
  96. package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +147 -0
  97. package/es/pct-filter-panel/pct-filter-panel-item.mjs +48 -0
  98. package/es/pct-filter-panel/pct-filter-panel.mjs +251 -0
  99. package/es/pct-filter-panel/use-filter-panel-item.mjs +56 -0
  100. package/es/pct-filter-panel/use-filter-panel.mjs +127 -0
  101. package/es/plugins.mjs +5 -0
  102. package/es/progress/index.mjs +10 -0
  103. package/es/progress/progress-item.mjs +68 -0
  104. package/es/progress/progress.mjs +74 -0
  105. package/es/progress/use-progress.mjs +46 -0
  106. package/es/utils/db.mjs +9 -0
  107. package/es/utils.mjs +99 -0
  108. package/es/where-filter-panel/index.mjs +1 -0
  109. package/es/where-filter-panel/use-where-filter-panel.mjs +18 -0
  110. package/es/where-filter-panel/where-filter-panel.mjs +17 -0
  111. package/lib/_virtual/_plugin-vue_export-helper.js +13 -0
  112. package/lib/advance-select/advance-operation.js +47 -0
  113. package/lib/advance-select/advance-option.js +129 -0
  114. package/lib/advance-select/advance-select.js +363 -0
  115. package/lib/advance-select/events-helpers.js +33 -0
  116. package/lib/advance-select/index.js +20 -0
  117. package/lib/advance-select/use-advance-option.js +47 -0
  118. package/lib/advance-select/use-advance-select.js +122 -0
  119. package/lib/application-slot/application-slot.js +55 -0
  120. package/lib/application-slot/breadcrumb-item.js +27 -0
  121. package/lib/application-slot/header-tools-item.js +27 -0
  122. package/lib/application-slot/index.js +23 -0
  123. package/lib/breadcrumb-select/breadcrumb-select.js +159 -0
  124. package/lib/breadcrumb-select/index.js +11 -0
  125. package/lib/components.js +26 -0
  126. package/lib/contextmenu/contextmenu-item.js +25 -0
  127. package/lib/contextmenu/contextmenu.js +68 -0
  128. package/lib/contextmenu/index.js +16 -0
  129. package/lib/contextmenu/use-contextmenu.js +89 -0
  130. package/lib/data-form/data-form-item.js +57 -0
  131. package/lib/data-form/data-form.js +179 -0
  132. package/lib/data-form/dynamic-component.js +27 -0
  133. package/lib/data-form/form-components/Blots/AtBlot.js +31 -0
  134. package/lib/data-form/form-components/bwa-date-picker.js +49 -0
  135. package/lib/data-form/form-components/bwa-date-time-picker.js +54 -0
  136. package/lib/data-form/form-components/bwa-input-float.js +47 -0
  137. package/lib/data-form/form-components/bwa-input-integer.js +60 -0
  138. package/lib/data-form/form-components/bwa-input.js +42 -0
  139. package/lib/data-form/form-components/bwa-multi-select.js +39 -0
  140. package/lib/data-form/form-components/bwa-rich-text-tinymce.js +242 -0
  141. package/lib/data-form/form-components/bwa-rich-text.js +333 -0
  142. package/lib/data-form/form-components/bwa-select.js +80 -0
  143. package/lib/data-form/form-components/bwa-textarea.js +37 -0
  144. package/lib/data-form/form-components/bwa-upload.js +163 -0
  145. package/lib/data-form/form-components/bwa-user-multi-select.js +34 -0
  146. package/lib/data-form/form-components/bwa-user-select.js +73 -0
  147. package/lib/data-form/index.js +40 -0
  148. package/lib/data-table/data-column-view.js +135 -0
  149. package/lib/data-table/data-table-card.js +122 -0
  150. package/lib/data-table/data-table-column.js +60 -0
  151. package/lib/data-table/data-table.js +373 -0
  152. package/lib/data-table/dynamic-component.js +56 -0
  153. package/lib/data-table/index.js +20 -0
  154. package/lib/data-table/use-datatable-drag.js +114 -0
  155. package/lib/datatable-settings/datatable-settings.js +313 -0
  156. package/lib/datatable-settings/index.js +11 -0
  157. package/lib/date-range/date-picker.js +136 -0
  158. package/lib/date-range/date-range.js +185 -0
  159. package/lib/date-range/index.js +11 -0
  160. package/lib/drag-list/constants.js +7 -0
  161. package/lib/drag-list/drag-item.js +53 -0
  162. package/lib/drag-list/drag-list.js +60 -0
  163. package/lib/drag-list/index.js +11 -0
  164. package/lib/drag-list/use-drag-list.js +158 -0
  165. package/lib/dragable/constants.js +9 -0
  166. package/lib/dragable/dragable-item.js +29 -0
  167. package/lib/dragable/dragable-operation.js +36 -0
  168. package/lib/dragable/dragable.js +35 -0
  169. package/lib/dragable/index.js +22 -0
  170. package/lib/dragable/use-dragable.js +138 -0
  171. package/lib/filter-panel/conditions/condition.js +34 -0
  172. package/lib/filter-panel/conditions/date-range-condition.js +50 -0
  173. package/lib/filter-panel/conditions/department-condition/department-condition.js +85 -0
  174. package/lib/filter-panel/conditions/department-condition/department-node.js +78 -0
  175. package/lib/filter-panel/conditions/index.js +26 -0
  176. package/lib/filter-panel/conditions/input-condition.js +87 -0
  177. package/lib/filter-panel/conditions/multi-user-condition.js +68 -0
  178. package/lib/filter-panel/conditions/multiple-menu-condition.js +45 -0
  179. package/lib/filter-panel/conditions/single-menu-condition.js +72 -0
  180. package/lib/filter-panel/conditions/single-user-condition.js +68 -0
  181. package/lib/filter-panel/filter-panel-item.js +51 -0
  182. package/lib/filter-panel/filter-panel.js +184 -0
  183. package/lib/filter-panel/index.js +20 -0
  184. package/lib/filter-panel/use-filter-panel-item.js +56 -0
  185. package/lib/filter-panel/use-filter-panel.js +139 -0
  186. package/lib/hooks/use-data/index.js +157 -0
  187. package/lib/index.js +60 -0
  188. package/lib/layout/index.js +11 -0
  189. package/lib/layout/layout.js +90 -0
  190. package/lib/make-installer.js +62 -0
  191. package/lib/math/Rectangle.js +29 -0
  192. package/lib/menu/index.js +11 -0
  193. package/lib/menu/menu-item.js +79 -0
  194. package/lib/menu/menu.js +64 -0
  195. package/lib/node_modules/.pnpm/@vueuse_core@9.6.0_vue@3.2.41/node_modules/@vueuse/core/index.js +6635 -0
  196. package/lib/node_modules/.pnpm/@vueuse_shared@9.6.0_vue@3.2.41/node_modules/@vueuse/shared/index.js +1628 -0
  197. package/lib/panel/index.js +11 -0
  198. package/lib/panel/panel.js +59 -0
  199. package/lib/panel-tabs/index.js +11 -0
  200. package/lib/panel-tabs/panel-tabs.js +70 -0
  201. package/lib/pct-filter-panel/index.js +14 -0
  202. package/lib/pct-filter-panel/pct-compents/index.js +16 -0
  203. package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +75 -0
  204. package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +78 -0
  205. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +190 -0
  206. package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +151 -0
  207. package/lib/pct-filter-panel/pct-filter-panel-item.js +52 -0
  208. package/lib/pct-filter-panel/pct-filter-panel.js +255 -0
  209. package/lib/pct-filter-panel/use-filter-panel-item.js +60 -0
  210. package/lib/pct-filter-panel/use-filter-panel.js +131 -0
  211. package/lib/plugins.js +9 -0
  212. package/lib/progress/index.js +16 -0
  213. package/lib/progress/progress-item.js +72 -0
  214. package/lib/progress/progress.js +78 -0
  215. package/lib/progress/use-progress.js +51 -0
  216. package/lib/utils/db.js +17 -0
  217. package/lib/utils.js +110 -0
  218. package/lib/where-filter-panel/index.js +2 -0
  219. package/lib/where-filter-panel/use-where-filter-panel.js +22 -0
  220. package/lib/where-filter-panel/where-filter-panel.js +21 -0
  221. package/package.json +1 -1
  222. package/style/advance-select.css +1 -0
  223. package/style/breadcrumb-select.css +1 -0
  224. package/style/common.css +1 -0
  225. package/style/contextmenu.css +1 -0
  226. package/style/data-form.css +1 -0
  227. package/style/data-table.css +1 -0
  228. package/style/datatable-settings.css +1 -0
  229. package/style/date-range.css +1 -0
  230. package/style/department-condition.css +1 -0
  231. package/style/drag-list.css +1 -0
  232. package/style/dragable.css +1 -0
  233. package/style/filter-panel.css +1 -0
  234. package/style/index.css +1 -0
  235. package/style/input-condition.css +1 -0
  236. package/style/layout.css +1 -0
  237. package/style/menu.css +1 -0
  238. package/style/panel-tabs.css +1 -0
  239. package/style/panel.css +1 -0
  240. package/style/pct-filter-panel.css +1 -0
  241. package/style/progress.css +1 -0
  242. package/style/rich-text.css +1 -0
  243. package/style/var.css +1 -0
  244. /package/style/{advance-select.scss → src/advance-select.scss} +0 -0
  245. /package/style/{breadcrumb-select.scss → src/breadcrumb-select.scss} +0 -0
  246. /package/style/{common → src/common}/var.scss +0 -0
  247. /package/style/{common.scss → src/common.scss} +0 -0
  248. /package/style/{contextmenu.scss → src/contextmenu.scss} +0 -0
  249. /package/style/{data-form.scss → src/data-form.scss} +0 -0
  250. /package/style/{data-table.scss → src/data-table.scss} +0 -0
  251. /package/style/{datatable-settings.scss → src/datatable-settings.scss} +0 -0
  252. /package/style/{date-range.scss → src/date-range.scss} +0 -0
  253. /package/style/{department-condition.scss → src/department-condition.scss} +0 -0
  254. /package/style/{drag-list.scss → src/drag-list.scss} +0 -0
  255. /package/style/{dragable.scss → src/dragable.scss} +0 -0
  256. /package/style/{filter-panel.scss → src/filter-panel.scss} +0 -0
  257. /package/style/{index.scss → src/index.scss} +0 -0
  258. /package/style/{input-condition.scss → src/input-condition.scss} +0 -0
  259. /package/style/{layout.scss → src/layout.scss} +0 -0
  260. /package/style/{menu.scss → src/menu.scss} +0 -0
  261. /package/style/{mixins → src/mixins}/_var.scss +0 -0
  262. /package/style/{mixins → src/mixins}/config.scss +0 -0
  263. /package/style/{mixins → src/mixins}/function.scss +0 -0
  264. /package/style/{mixins → src/mixins}/mixins.scss +0 -0
  265. /package/style/{panel-tabs.scss → src/panel-tabs.scss} +0 -0
  266. /package/style/{panel.scss → src/panel.scss} +0 -0
  267. /package/style/{pct-filter-panel.scss → src/pct-filter-panel.scss} +0 -0
  268. /package/style/{progress.scss → src/progress.scss} +0 -0
  269. /package/style/{rich-text.scss → src/rich-text.scss} +0 -0
  270. /package/style/{theme → src/theme}/theme.scss +0 -0
  271. /package/style/{theme → src/theme}/var.scss +0 -0
  272. /package/style/{var.scss → src/var.scss} +0 -0
@@ -0,0 +1,369 @@
1
+ import { createElementVNode, defineComponent, useAttrs, ref, computed, unref, watch, provide, reactive, nextTick, onUnmounted, openBlock, createElementBlock, normalizeClass, renderSlot, createVNode, mergeProps, withCtx, createBlock, createCommentVNode, Fragment, renderList, createTextVNode, toDisplayString, normalizeStyle } from 'vue';
2
+ import { ElMessage, ElTable, ElTableColumn, ElPagination } from 'element-plus';
3
+ import { useService, useGlobalConfig, dataTableKey, useNamespace, useEventDispatcher } from '@ctzy-web-client/web-base-client-vue';
4
+ import DynamicComponent from './dynamic-component.mjs';
5
+ import DataTableColumn from './data-table-column.mjs';
6
+ import { useDataTableDrag } from './use-datatable-drag.mjs';
7
+ import { get } from 'lodash';
8
+ import { Subject, debounceTime, Observable, filter, map, delayWhen, from, skipWhile } from 'rxjs';
9
+ import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
10
+
11
+ const _hoisted_1 = /* @__PURE__ */ createElementVNode("i", { class: "ptp-icon ptp-buzhou-yidong" }, null, -1);
12
+ const __default__ = defineComponent({ name: "BwaDataTable" });
13
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
14
+ props: {
15
+ dataTable: {
16
+ type: Object,
17
+ required: true
18
+ },
19
+ autoLoad: {
20
+ type: Boolean,
21
+ default: true
22
+ },
23
+ showIndex: {
24
+ type: Boolean,
25
+ default: false
26
+ },
27
+ indexColumnLabel: {
28
+ type: String,
29
+ default: "\u7F16\u53F7"
30
+ },
31
+ selection: {
32
+ type: Boolean,
33
+ default: false
34
+ },
35
+ paginationLayout: {
36
+ type: String,
37
+ default: "sizes, prev, pager, next, jumper"
38
+ },
39
+ paginationPageSizes: {
40
+ type: Array,
41
+ default: () => [10, 20, 50, 100, 200]
42
+ },
43
+ showPagination: {
44
+ type: Boolean,
45
+ default: true
46
+ },
47
+ whereParamName: {
48
+ type: String,
49
+ default: ""
50
+ },
51
+ showDrag: {
52
+ type: Boolean,
53
+ default: false
54
+ },
55
+ border: {
56
+ type: Boolean,
57
+ default: true
58
+ }
59
+ },
60
+ emits: ["drag"],
61
+ setup(__props, { emit }) {
62
+ var _a;
63
+ const props = __props;
64
+ const attrs = useAttrs();
65
+ const userService = useService("UserService");
66
+ const elTable = ref(null);
67
+ const dataTable = props.dataTable;
68
+ dataTable._userService = (_a = userService.value) == null ? void 0 : _a.getUserList;
69
+ const dataTableEl = ref(null);
70
+ const displayColumns = computed(
71
+ () => unref(dataTable).getDisplayColumns() || []
72
+ );
73
+ watch(
74
+ computed(() => props.whereParamName),
75
+ (whereParamName) => {
76
+ dataTable.setWhereParamName(whereParamName || "");
77
+ },
78
+ { immediate: true, flush: "sync" }
79
+ );
80
+ const searchParams = computed(() => props.searchParams);
81
+ const debounceDelay = useGlobalConfig("debounceDelay", 500);
82
+ provide(
83
+ dataTableKey,
84
+ reactive({
85
+ dataTable,
86
+ displayColumns
87
+ })
88
+ );
89
+ const ns = useNamespace("datatable");
90
+ const { barRectangle } = useDataTableDrag(
91
+ dataTableEl,
92
+ ".bwa-datatable__drag",
93
+ ".el-table__row",
94
+ { emit }
95
+ );
96
+ const processing = ref(false);
97
+ const data = computed(() => {
98
+ return props.dataTable.data;
99
+ });
100
+ useEventDispatcher(dataTable, "load-successfully", async (res) => {
101
+ if (res.code != 0) {
102
+ return;
103
+ }
104
+ const _userService = unref(userService);
105
+ if (!_userService) {
106
+ return;
107
+ }
108
+ let columns = dataTable.getColumns();
109
+ const componentNames = ["BwaUserSelect", "BwaUserMultiSelect"];
110
+ columns = columns.filter((column) => componentNames.includes(column.formComponent)).filter((column) => column.visible).filter((column) => column.isExtend);
111
+ if (!columns.length) {
112
+ return;
113
+ }
114
+ processing.value = true;
115
+ const data2 = res.data;
116
+ let ids = data2.reduce((result, item) => {
117
+ return result.concat(
118
+ columns.reduce((result2, column) => {
119
+ let value = get(item, column.fullAttrName);
120
+ value = Array.isArray(value) ? value : value ? [value] : [];
121
+ return result2.concat(value);
122
+ }, [])
123
+ );
124
+ }, []).map((id) => id + "");
125
+ ids = [...new Set(ids)];
126
+ try {
127
+ const userListResult = await _userService.getUserListByIds(ids);
128
+ if (userListResult.code != 0) {
129
+ return;
130
+ }
131
+ for (const column of columns) {
132
+ column.componentProps = column.componentProps || {};
133
+ column.componentProps.options = (userListResult.data || []).map(
134
+ (item) => ({
135
+ label: item.label,
136
+ value: item.value
137
+ })
138
+ );
139
+ }
140
+ console.log(userListResult);
141
+ } finally {
142
+ processing.value = false;
143
+ }
144
+ });
145
+ const sortHandle = (column, prop, order) => {
146
+ let sortColumn2 = "";
147
+ let sortType = "";
148
+ if (column.order) {
149
+ sortColumn2 = column.prop;
150
+ sortType = column.order == "descending" ? 0 : 1;
151
+ dataTable.setParam("sortColumn", sortColumn2);
152
+ dataTable.setParam("sortType", sortType);
153
+ } else {
154
+ dataTable.setParam("sortColumn", sortColumn2);
155
+ dataTable.setParam("sortType", sortType);
156
+ }
157
+ dataTable.load();
158
+ };
159
+ useEventDispatcher(dataTable, "load-successfully", (res) => {
160
+ if (!elTable.value) {
161
+ return;
162
+ }
163
+ unref(elTable).store.updateSelectionByRowKey();
164
+ if (res.code != 0) {
165
+ ElMessage.error(res.msg);
166
+ }
167
+ });
168
+ function sortColumn(array) {
169
+ array.forEach((item) => {
170
+ var _a2, _b;
171
+ item.no = (_a2 = item.getColumnIndex) == null ? void 0 : _a2.call(item);
172
+ if ((_b = item.children) == null ? void 0 : _b.length) {
173
+ sortColumn(item.children);
174
+ }
175
+ });
176
+ array.sort((cur, pre) => cur.no - pre.no);
177
+ }
178
+ const tableSelectSubject = new Subject();
179
+ const selectionChange = tableSelectSubject.next.bind(tableSelectSubject);
180
+ const totalPage = computed(() => dataTable.getTotalPage());
181
+ const tableSelectSubscription = tableSelectSubject.pipe(debounceTime(debounceDelay)).subscribe(unref(dataTable).setSelection.bind(unref(dataTable)));
182
+ const selectChangeAPIObservable = new Observable(
183
+ (observer) => useEventDispatcher(
184
+ props.dataTable,
185
+ "select-change",
186
+ observer.next.bind(observer)
187
+ )
188
+ ).pipe(
189
+ filter((selection) => {
190
+ if (!unref(elTable)) {
191
+ return false;
192
+ }
193
+ const selectionRows = unref(elTable).getSelectionRows();
194
+ if (selectionRows.length !== selection.length) {
195
+ return true;
196
+ }
197
+ const primaryKey = dataTable.primaryKey;
198
+ return !selectionRows.every(
199
+ (item) => selection.find((itm) => item[primaryKey] === item[primaryKey])
200
+ );
201
+ })
202
+ ).subscribe((selection) => {
203
+ unref(elTable).clearSelection();
204
+ for (const item of selection) {
205
+ unref(elTable).toggleRowSelection(item, true);
206
+ }
207
+ });
208
+ if (props.autoLoad) {
209
+ dataTable.load();
210
+ }
211
+ const searchParamsSubscription = new Observable(
212
+ (observer) => useEventDispatcher(
213
+ props.dataTable.filterPanel,
214
+ "params-change",
215
+ observer.next.bind(observer)
216
+ )
217
+ ).pipe(
218
+ filter(() => props.dataTable.filterPanel.ready),
219
+ debounceTime(unref(debounceDelay))
220
+ ).subscribe(() => {
221
+ props.dataTable.load();
222
+ });
223
+ const subscription = props.dataTable.getDisplayColumnsSubject().pipe(
224
+ map(() => unref(elTable)),
225
+ delayWhen(() => from(nextTick())),
226
+ map((elTable2) => elTable2 == null ? void 0 : elTable2.store),
227
+ skipWhile((store) => !store)
228
+ ).subscribe((store) => {
229
+ sortColumn(unref(store.states._columns));
230
+ store.updateColumns();
231
+ store.scheduleLayout();
232
+ });
233
+ onUnmounted(() => {
234
+ selectChangeAPIObservable.unsubscribe();
235
+ subscription.unsubscribe();
236
+ tableSelectSubscription.unsubscribe();
237
+ searchParamsSubscription.unsubscribe();
238
+ });
239
+ return (_ctx, _cache) => {
240
+ return openBlock(), createElementBlock("div", {
241
+ class: normalizeClass(unref(ns).b()),
242
+ ref_key: "dataTableEl",
243
+ ref: dataTableEl
244
+ }, [
245
+ renderSlot(_ctx.$slots, "default", { dataTable: unref(dataTable) }, () => [
246
+ createVNode(unref(ElTable), mergeProps({
247
+ class: "content",
248
+ height: "100%",
249
+ ref_key: "elTable",
250
+ ref: elTable,
251
+ data: unref(data),
252
+ "row-key": unref(dataTable).primaryKey,
253
+ "show-header": "",
254
+ stripe: ""
255
+ }, unref(attrs), {
256
+ onSelectionChange: unref(selectionChange),
257
+ onSortChange: sortHandle,
258
+ border: __props.border
259
+ }), {
260
+ empty: withCtx(() => [
261
+ renderSlot(_ctx.$slots, "empty-table")
262
+ ]),
263
+ default: withCtx(() => [
264
+ __props.showDrag ? (openBlock(), createBlock(unref(ElTableColumn), {
265
+ key: 0,
266
+ width: "40px"
267
+ }, {
268
+ default: withCtx(() => [
269
+ createElementVNode("div", {
270
+ class: normalizeClass(unref(ns).e("drag"))
271
+ }, [
272
+ renderSlot(_ctx.$slots, "default", {}, () => [
273
+ _hoisted_1
274
+ ])
275
+ ], 2)
276
+ ]),
277
+ _: 3
278
+ })) : createCommentVNode("v-if", true),
279
+ __props.selection ? renderSlot(_ctx.$slots, "selection", { key: 1 }, () => [
280
+ createVNode(unref(ElTableColumn), {
281
+ type: "selection",
282
+ align: "center",
283
+ width: "56",
284
+ "reserve-selection": true
285
+ })
286
+ ]) : createCommentVNode("v-if", true),
287
+ __props.showIndex ? renderSlot(_ctx.$slots, "index", { key: 2 }, () => [
288
+ createVNode(unref(ElTableColumn), {
289
+ type: "index",
290
+ width: "60",
291
+ align: "center",
292
+ label: __props.indexColumnLabel
293
+ }, null, 8, ["label"])
294
+ ]) : createCommentVNode("v-if", true),
295
+ renderSlot(_ctx.$slots, "table-columns", { dataTable: unref(dataTable) }, () => [
296
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(displayColumns), (item) => {
297
+ return openBlock(), createBlock(DataTableColumn, mergeProps({
298
+ "column-key": item.attrName,
299
+ key: item.attrName,
300
+ label: item.title,
301
+ prop: item.fullAttrName,
302
+ "min-width": item.width,
303
+ align: item.align
304
+ }, item.componentProps, {
305
+ sortable: item.sortable == "custom"
306
+ }), {
307
+ header: withCtx(() => [
308
+ renderSlot(_ctx.$slots, `table-header-col-${item.attrName}`, {}, () => [
309
+ createTextVNode(toDisplayString(item.title), 1)
310
+ ])
311
+ ]),
312
+ default: withCtx(({ row, $index }) => [
313
+ unref(data).length ? renderSlot(_ctx.$slots, "table-col-" + item.attrName, {
314
+ key: 0,
315
+ row,
316
+ index: $index,
317
+ column: item,
318
+ dataTable: unref(dataTable)
319
+ }, () => [
320
+ createVNode(unref(DynamicComponent), {
321
+ column: item,
322
+ record: row
323
+ }, null, 8, ["column", "record"])
324
+ ]) : createCommentVNode("v-if", true)
325
+ ]),
326
+ _: 2
327
+ }, 1040, ["column-key", "label", "prop", "min-width", "align", "sortable"]);
328
+ }), 128))
329
+ ]),
330
+ renderSlot(_ctx.$slots, "column-append")
331
+ ]),
332
+ _: 3
333
+ }, 16, ["data", "row-key", "onSelectionChange", "border"])
334
+ ]),
335
+ __props.showPagination ? (openBlock(), createElementBlock("div", {
336
+ key: 0,
337
+ class: normalizeClass(unref(ns).e("pagination"))
338
+ }, [
339
+ createElementVNode("div", {
340
+ class: normalizeClass(unref(ns).e("pagination-info"))
341
+ }, " \u5171" + toDisplayString(unref(totalPage)) + "\u9875\uFF0C" + toDisplayString(unref(dataTable).totalRecCount) + "\u6761 ", 3),
342
+ createVNode(unref(ElPagination), {
343
+ currentPage: unref(dataTable).pageNum,
344
+ "page-sizes": __props.paginationPageSizes,
345
+ "page-size": unref(dataTable).pageSize,
346
+ layout: __props.paginationLayout,
347
+ total: unref(dataTable).totalRecCount,
348
+ onSizeChange: _cache[0] || (_cache[0] = ($event) => unref(dataTable).setPageSize($event)),
349
+ onCurrentChange: _cache[1] || (_cache[1] = ($event) => unref(dataTable).pageTo($event)),
350
+ teleported: false
351
+ }, null, 8, ["currentPage", "page-sizes", "page-size", "layout", "total"])
352
+ ], 2)) : createCommentVNode("v-if", true),
353
+ unref(barRectangle) ? (openBlock(), createElementBlock("div", {
354
+ key: 1,
355
+ class: normalizeClass(unref(ns).e("dragbar")),
356
+ style: normalizeStyle({
357
+ left: unref(barRectangle).left + "px",
358
+ top: unref(barRectangle).top + "px",
359
+ width: unref(barRectangle).width + "px",
360
+ height: unref(barRectangle).height + "px"
361
+ })
362
+ }, null, 6)) : createCommentVNode("v-if", true)
363
+ ], 2);
364
+ };
365
+ }
366
+ });
367
+ var DataTable = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "data-table.vue"]]);
368
+
369
+ export { DataTable as default };
@@ -0,0 +1,48 @@
1
+ import { computed, h, unref } from 'vue';
2
+ import get from 'lodash/get';
3
+ import { useDynamicComponent } from '../utils.mjs';
4
+
5
+ const formatValue = (column, value) => {
6
+ const options = column.componentProps.options || [];
7
+ const _value = Array.isArray(value) ? value : [value];
8
+ const labels = _value.map((v) => {
9
+ var _a;
10
+ return (_a = options.find((option) => option.value === v)) != null ? _a : null;
11
+ });
12
+ if (labels.includes(null)) {
13
+ return null;
14
+ }
15
+ return labels.map((item) => item.label).join(",");
16
+ };
17
+ var DynamicComponent = {
18
+ props: {
19
+ column: Object,
20
+ record: Object
21
+ },
22
+ emits: ["on-change"],
23
+ setup(props, context) {
24
+ const {
25
+ component,
26
+ params
27
+ } = useDynamicComponent(props, context, "BwaDataColumnView", "fullAttrName");
28
+ const viewType = computed(() => props.column.formComponent === "BwaRichText" ? "html" : "");
29
+ return () => {
30
+ var _a;
31
+ let value = get(props.record, props.column.fullAttrName);
32
+ if (Array.isArray((_a = props.column.componentProps) == null ? void 0 : _a.options)) {
33
+ value = formatValue(props.column, value) || value;
34
+ }
35
+ return h(unref(component), {
36
+ ...unref(params),
37
+ value,
38
+ type: props.column.type,
39
+ align: props.column.align,
40
+ rule: props.column.rule,
41
+ template: props.column.template,
42
+ defaultValue: props.column.default || "-"
43
+ });
44
+ };
45
+ }
46
+ };
47
+
48
+ export { DynamicComponent as default };
@@ -0,0 +1,13 @@
1
+ import { withInstall } from 'element-plus/es/utils/vue/install';
2
+ import DataTable from './data-table.mjs';
3
+ import DataTableColumn from './data-table-column.mjs';
4
+ import DataColumnView from './data-column-view.mjs';
5
+
6
+ const BwaDataTable = withInstall(DataTable, {
7
+ DataTableColumn,
8
+ DataColumnView
9
+ });
10
+ const BwaDataTableColumn = withInstall(DataTableColumn);
11
+ const BwaDataColumnView = withInstall(DataColumnView);
12
+
13
+ export { BwaDataColumnView, BwaDataTable, BwaDataTableColumn, BwaDataTable as default };
@@ -0,0 +1,110 @@
1
+ import { ref, onMounted, unref, onBeforeUnmount } from 'vue';
2
+ import { fromEvent, filter, tap, map, switchMap, takeUntil } from 'rxjs';
3
+ import { Rectangle } from '../math/Rectangle.mjs';
4
+
5
+ const useDataTableDrag = (el, dragClass, itemClass, context) => {
6
+ let mousedownSubscription = null;
7
+ let barRectangle = ref(null);
8
+ onMounted(() => {
9
+ let mouseDownObservable = fromEvent(unref(el), "mousedown");
10
+ let mousemoveObservable = fromEvent(unref(document), "mousemove");
11
+ let mouseupObservable = fromEvent(unref(document), "mouseup");
12
+ let rectangles = [];
13
+ let cloneEl = null;
14
+ let offsetX = 0;
15
+ let offsetY = 0;
16
+ let targetIndex = -1;
17
+ mousedownSubscription = mouseDownObservable.pipe(filter((event) => {
18
+ const list = Array.from(unref(el).querySelectorAll(dragClass));
19
+ const item = list.find((item2) => item2.contains(event.target));
20
+ if (item) {
21
+ event.index = list.indexOf(item);
22
+ const row = Array.from(unref(el).querySelectorAll(itemClass)).find((row2) => row2.contains(item));
23
+ const _cloneEl = row.cloneNode(true);
24
+ const boundary = row.getBoundingClientRect();
25
+ cloneEl = document.createElement("div");
26
+ cloneEl.className = "bwa-datatable";
27
+ const tableEl = document.createElement("table");
28
+ tableEl.className = "el-table";
29
+ const tbodyEl = document.createElement("tbody");
30
+ cloneEl.append(tableEl);
31
+ tableEl.appendChild(tbodyEl);
32
+ tbodyEl.appendChild(_cloneEl);
33
+ offsetX = event.x - boundary.left;
34
+ offsetY = event.y - boundary.top;
35
+ console.log();
36
+ Object.assign(cloneEl.style, {
37
+ position: "absolute",
38
+ left: event.clientX - offsetX + "px",
39
+ top: event.clientY - offsetY + "px",
40
+ zIndex: "9999",
41
+ height: boundary.height + "px",
42
+ width: boundary.width + "px",
43
+ opacity: "0.6",
44
+ pointerEvents: "none"
45
+ });
46
+ document.body.appendChild(cloneEl);
47
+ document.body.style.cursor = "move";
48
+ document.body.style.userSelect = "none";
49
+ }
50
+ return !!item;
51
+ }), tap(() => {
52
+ rectangles = Array.from(unref(el).querySelectorAll(itemClass)).map((item) => {
53
+ const {
54
+ x,
55
+ y,
56
+ width,
57
+ height
58
+ } = item.getBoundingClientRect();
59
+ return new Rectangle(x, y, width, height);
60
+ });
61
+ }), map((event) => {
62
+ return {
63
+ index: event.index,
64
+ x: event.clientX,
65
+ y: event.clientY
66
+ };
67
+ }), switchMap(({
68
+ index,
69
+ x,
70
+ y
71
+ }) => {
72
+ return mousemoveObservable.pipe(takeUntil(mouseupObservable.pipe(tap(() => {
73
+ if (targetIndex !== -1) {
74
+ context.emit("drag", index, targetIndex);
75
+ }
76
+ cloneEl == null ? void 0 : cloneEl.remove();
77
+ rectangles = [];
78
+ offsetX = offsetY = 0;
79
+ document.body.style.cursor = "";
80
+ document.body.style.userSelect = "";
81
+ barRectangle.value = null;
82
+ targetIndex = -1;
83
+ }))), map((event) => {
84
+ Object.assign(cloneEl.style, {
85
+ left: event.clientX - offsetX + "px",
86
+ top: event.clientY - offsetY + "px"
87
+ });
88
+ const rectangle = rectangles.find((rectangle2) => rectangle2.pointIn(event.x, event.y));
89
+ if (!rectangle) {
90
+ targetIndex = -1;
91
+ barRectangle.value = null;
92
+ return;
93
+ }
94
+ targetIndex = rectangles.indexOf(rectangle);
95
+ const direction = event.clientY >= rectangle.cy ? "after" : "before";
96
+ targetIndex = targetIndex + (direction === "after" ? 1 : 0);
97
+ barRectangle.value = new Rectangle(rectangle.left, direction === "after" ? rectangle.bottom : rectangle.top, rectangle.width, 2);
98
+ }));
99
+ })).subscribe((info) => {
100
+ });
101
+ });
102
+ onBeforeUnmount(() => {
103
+ mousedownSubscription == null ? void 0 : mousedownSubscription.unsubscribe();
104
+ });
105
+ return {
106
+ barRectangle
107
+ };
108
+ };
109
+
110
+ export { useDataTableDrag };