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

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 (273) 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 +2 -2
  222. package/src/date-range/date-range.vue +2 -2
  223. package/style/advance-select.css +1 -0
  224. package/style/breadcrumb-select.css +1 -0
  225. package/style/common.css +1 -0
  226. package/style/contextmenu.css +1 -0
  227. package/style/data-form.css +1 -0
  228. package/style/data-table.css +1 -0
  229. package/style/datatable-settings.css +1 -0
  230. package/style/date-range.css +1 -0
  231. package/style/department-condition.css +1 -0
  232. package/style/drag-list.css +1 -0
  233. package/style/dragable.css +1 -0
  234. package/style/filter-panel.css +1 -0
  235. package/style/index.css +1 -0
  236. package/style/input-condition.css +1 -0
  237. package/style/layout.css +1 -0
  238. package/style/menu.css +1 -0
  239. package/style/panel-tabs.css +1 -0
  240. package/style/panel.css +1 -0
  241. package/style/pct-filter-panel.css +1 -0
  242. package/style/progress.css +1 -0
  243. package/style/rich-text.css +1 -0
  244. package/style/{theme → src/theme}/theme.scss +6 -6
  245. package/style/var.css +1 -0
  246. /package/style/{advance-select.scss → src/advance-select.scss} +0 -0
  247. /package/style/{breadcrumb-select.scss → src/breadcrumb-select.scss} +0 -0
  248. /package/style/{common → src/common}/var.scss +0 -0
  249. /package/style/{common.scss → src/common.scss} +0 -0
  250. /package/style/{contextmenu.scss → src/contextmenu.scss} +0 -0
  251. /package/style/{data-form.scss → src/data-form.scss} +0 -0
  252. /package/style/{data-table.scss → src/data-table.scss} +0 -0
  253. /package/style/{datatable-settings.scss → src/datatable-settings.scss} +0 -0
  254. /package/style/{date-range.scss → src/date-range.scss} +0 -0
  255. /package/style/{department-condition.scss → src/department-condition.scss} +0 -0
  256. /package/style/{drag-list.scss → src/drag-list.scss} +0 -0
  257. /package/style/{dragable.scss → src/dragable.scss} +0 -0
  258. /package/style/{filter-panel.scss → src/filter-panel.scss} +0 -0
  259. /package/style/{index.scss → src/index.scss} +0 -0
  260. /package/style/{input-condition.scss → src/input-condition.scss} +0 -0
  261. /package/style/{layout.scss → src/layout.scss} +0 -0
  262. /package/style/{menu.scss → src/menu.scss} +0 -0
  263. /package/style/{mixins → src/mixins}/_var.scss +0 -0
  264. /package/style/{mixins → src/mixins}/config.scss +0 -0
  265. /package/style/{mixins → src/mixins}/function.scss +0 -0
  266. /package/style/{mixins → src/mixins}/mixins.scss +0 -0
  267. /package/style/{panel-tabs.scss → src/panel-tabs.scss} +0 -0
  268. /package/style/{panel.scss → src/panel.scss} +0 -0
  269. /package/style/{pct-filter-panel.scss → src/pct-filter-panel.scss} +0 -0
  270. /package/style/{progress.scss → src/progress.scss} +0 -0
  271. /package/style/{rich-text.scss → src/rich-text.scss} +0 -0
  272. /package/style/{theme → src/theme}/var.scss +0 -0
  273. /package/style/{var.scss → src/var.scss} +0 -0
@@ -0,0 +1,52 @@
1
+ import { inject, computed, unref, onMounted, onBeforeUnmount } from 'vue';
2
+ import { filterPanelKey } from '@ctzy-web-client/web-base-client-vue';
3
+
4
+ const useFilterPanelItem = (props) => {
5
+ const filterPanelContext = inject(filterPanelKey);
6
+ const filterPanel = computed(() => filterPanelContext.filterPanel);
7
+ const column = computed(() => {
8
+ if (!unref(filterPanel)) {
9
+ return null;
10
+ }
11
+ return unref(filterPanel).getColumn(props.prop);
12
+ });
13
+ const value = computed({
14
+ get: () => {
15
+ if (!unref(column)) {
16
+ return null;
17
+ }
18
+ return unref(filterPanel).getFilterParam(unref(column));
19
+ },
20
+ set: (v) => {
21
+ if (!unref(column)) {
22
+ return;
23
+ }
24
+ unref(filterPanel).setFilterParam(unref(column), v);
25
+ }
26
+ });
27
+ const allowClose = computed(() => {
28
+ var _a;
29
+ return props.close || !!((_a = unref(column)) == null ? void 0 : _a.closable);
30
+ });
31
+ const closeHandle = () => {
32
+ if (!unref(column)) {
33
+ return;
34
+ }
35
+ unref(filterPanel).closeColumn(unref(column));
36
+ unref(filterPanel).dataTable.refresh();
37
+ };
38
+ onMounted(() => {
39
+ unref(filterPanel).changeOriginFilterParams();
40
+ });
41
+ onBeforeUnmount(() => {
42
+ unref(filterPanel).changeOriginFilterParams();
43
+ });
44
+ return {
45
+ value,
46
+ column,
47
+ allowClose,
48
+ closeHandle
49
+ };
50
+ };
51
+
52
+ export { useFilterPanelItem };
@@ -0,0 +1,135 @@
1
+ import { useProp } from 'element-plus';
2
+ import { useService, useEventDispatcher, useValue } from '@ctzy-web-client/web-base-client-vue';
3
+ import { computed, unref, watch, nextTick, onBeforeUnmount, getCurrentInstance, withCtx, resolveComponent } from 'vue';
4
+ import { Observable } from 'rxjs';
5
+ import { dataModelDB } from '../utils/db.mjs';
6
+
7
+ const useFilterPanel = (props, context) => {
8
+ var _a;
9
+ const dataTable = useProp("dataTable");
10
+ const filterPanel = computed(() => unref(dataTable).filterPanel);
11
+ const filterPanelTable = dataModelDB.filterPanel;
12
+ const currentFilterColumns = computed(() => unref(filterPanel).getAppliedColumns());
13
+ const userService = useService("UserService");
14
+ const _userID = ((_a = userService == null ? void 0 : userService.userInfo) == null ? void 0 : _a.id) || "0";
15
+ const searchParams = computed(() => unref(filterPanel)._filterParams);
16
+ const selectedColumnAttrNames = computed({
17
+ get: () => unref(filterPanel).getSelectedColumnAttrNames(),
18
+ set: (v) => {
19
+ const oldSelectedColumnAttrNames = selectedColumnAttrNames.value;
20
+ unref(filterPanel).setSelectedColumnAttrNames(v);
21
+ if (unref(filterPanel).ready) {
22
+ const existsOldAttrNames = oldSelectedColumnAttrNames.filter((attrName) => v.includes(attrName));
23
+ if (existsOldAttrNames.length < oldSelectedColumnAttrNames.length) {
24
+ unref(dataTable).refresh();
25
+ }
26
+ }
27
+ }
28
+ });
29
+ const closableColumns = computed(() => unref(filterPanel).getSearchClosableColumns());
30
+ const searchValue = computed({
31
+ get: () => unref(filterPanel).getSearchValue(),
32
+ set: (v) => unref(filterPanel).setSeachValue(v)
33
+ });
34
+ const isChange = computed(() => unref(filterPanel).isChange());
35
+ watch(useProp("searchAttr"), (searchAttr) => {
36
+ unref(filterPanel).setSearchAttr(searchAttr);
37
+ }, {
38
+ immediate: true
39
+ });
40
+ watch(useProp("searchFields"), (searchFields) => {
41
+ unref(filterPanel).setSearchFields(searchFields);
42
+ }, {
43
+ immediate: true
44
+ });
45
+ const handleFieldSearch = (value) => {
46
+ unref(filterPanel).fieldSearchValue = value;
47
+ };
48
+ const handleReset = () => {
49
+ unref(filterPanel).resetFilterParams();
50
+ context.emit("reset");
51
+ };
52
+ useEventDispatcher(filterPanel, "params-change", () => {
53
+ const _filterPanel = unref(filterPanel);
54
+ context.emit("filter", {
55
+ ..._filterPanel.getFilterParams(),
56
+ [_filterPanel.getSearchAttr()]: _filterPanel.getSearchValue()
57
+ });
58
+ });
59
+ const appName = useValue("AppName");
60
+ const selectedColumnChangeSubscription = new Observable((observer) => useEventDispatcher(filterPanel, "selected-column-change", observer.next.bind(observer))).subscribe(async () => {
61
+ var _a2;
62
+ const _appName = unref(appName);
63
+ const _tableName = unref(dataTable).name;
64
+ let result = await filterPanelTable.where("[app+tableName+userID]").equals([_appName, _tableName, _userID]).toArray();
65
+ let filterPanelOrder = result.length ? (_a2 = result[0].order) != null ? _a2 : [] : [];
66
+ const attrNames = unref(filterPanel).getSelectedColumnAttrNames();
67
+ attrNames.sort((a1, a2) => {
68
+ const index1 = filterPanelOrder.indexOf(a1);
69
+ const index2 = filterPanelOrder.indexOf(a2);
70
+ if (index1 === -1 && index2 === -1) {
71
+ return 1;
72
+ }
73
+ if (index1 === -1) {
74
+ return 1;
75
+ }
76
+ if (index2 === -1) {
77
+ return -1;
78
+ }
79
+ return index1 - index2;
80
+ });
81
+ filterPanelTable.put({
82
+ app: _appName,
83
+ tableName: _tableName,
84
+ userID: _userID,
85
+ order: attrNames
86
+ });
87
+ });
88
+ const loadFilterPanelItemOrder = () => {
89
+ filterPanelTable.where("[app+tableName+userID]").equals([unref(appName), unref(dataTable).name, _userID]).toArray((res) => {
90
+ var _a2, _b;
91
+ selectedColumnAttrNames.value = (_b = (_a2 = res[0]) == null ? void 0 : _a2.order) != null ? _b : [];
92
+ nextTick(() => {
93
+ unref(filterPanel).ready = true;
94
+ unref(filterPanel).changeOriginFilterParams();
95
+ unref(filterPanel).changeOriginSearchValue();
96
+ });
97
+ });
98
+ };
99
+ if (!unref(filterPanel).isInited) {
100
+ useEventDispatcher(filterPanel, "initCompleted", loadFilterPanelItemOrder);
101
+ } else {
102
+ loadFilterPanelItemOrder();
103
+ }
104
+ onBeforeUnmount(() => {
105
+ selectedColumnChangeSubscription.unsubscribe();
106
+ });
107
+ const columns = computed(() => unref(filterPanel).getColumns());
108
+ const instance = getCurrentInstance();
109
+ watch(computed(() => unref(columns).map((column) => column.componentTitle)), withCtx(() => {
110
+ for (const column of unref(columns)) {
111
+ const component = resolveComponent(column.component || "BwaMultipleMenuCondition");
112
+ if (!component) {
113
+ unref(column).componentTitle = "";
114
+ return;
115
+ }
116
+ unref(column).componentTitle = component.__conditionTitle__;
117
+ }
118
+ }, instance), {
119
+ immediate: true
120
+ });
121
+ return {
122
+ dataTable,
123
+ filterPanel,
124
+ currentFilterColumns,
125
+ searchParams,
126
+ selectedColumnAttrNames,
127
+ closableColumns,
128
+ handleFieldSearch,
129
+ searchValue,
130
+ isChange,
131
+ handleReset
132
+ };
133
+ };
134
+
135
+ export { useFilterPanel };
@@ -0,0 +1,152 @@
1
+ import { useService, HttpRequest, useGlobalConfig, filterPanelItemKey, useEventDispatcher } from '@ctzy-web-client/web-base-client-vue';
2
+ import { useProp, ElMessage } from 'element-plus';
3
+ import { ref, inject, computed, unref, watch, onBeforeUnmount } from 'vue';
4
+ import { Observable, debounceTime, combineLatest, filter, map, tap, from, catchError, of, mergeAll } from 'rxjs';
5
+ import { isEqual } from 'lodash';
6
+
7
+ const dataProps = {
8
+ dataTable: {
9
+ type: Object
10
+ },
11
+ itfInfo: {
12
+ type: Object
13
+ },
14
+ labelAttr: {
15
+ type: String
16
+ },
17
+ valueAttr: {
18
+ type: String
19
+ },
20
+ searchAttr: {
21
+ type: String
22
+ },
23
+ lazy: {
24
+ type: Boolean,
25
+ default: true
26
+ }
27
+ };
28
+ function useData(disabled, search) {
29
+ const httpRequest = useService(HttpRequest);
30
+ const data = ref([]);
31
+ const debounceDelay = useGlobalConfig("debounceDelay", 500);
32
+ const filterPanelItem = inject(filterPanelItemKey, null);
33
+ const _dataTable = useProp("dataTable");
34
+ const dataTable = ref(null);
35
+ const itfInfo = useProp("itfInfo");
36
+ const _labelAttr = useProp("labelAttr");
37
+ const labelAttr = computed(() => unref(_labelAttr) || "label");
38
+ const _valueAttr = useProp("valueAttr");
39
+ const valueAttr = computed(() => unref(_valueAttr) || "value");
40
+ const _searchAttr = useProp("searchAttr");
41
+ const searchAttr = computed(() => unref(_searchAttr) || "search");
42
+ const lazy = useProp("lazy");
43
+ const loading = ref(false);
44
+ const searchAttrObserable = new Observable((observer) => watch(searchAttr, (value, oldValue) => {
45
+ observer.next([value, oldValue]);
46
+ }, {
47
+ immediate: true
48
+ }));
49
+ const searchObserable = new Observable((observer) => watch(search, observer.next.bind(observer), {
50
+ immediate: true
51
+ })).pipe(debounceTime(unref(debounceDelay)));
52
+ const searchObservable = combineLatest([searchAttrObserable, searchObserable]).pipe(debounceTime(unref(debounceDelay)), filter(() => !unref(disabled)));
53
+ const disabledObservable = new Observable((observer) => watch(disabled, observer.next.bind(observer), {
54
+ immediate: true
55
+ }));
56
+ if (unref(_dataTable)) {
57
+ dataTable.value = unref(_dataTable).clone();
58
+ const loadDataSubscription = new Observable((observer) => useEventDispatcher(dataTable, "load-successfully", observer.next.bind(observer))).subscribe((res) => {
59
+ if (res.code != 0) {
60
+ data.value = [];
61
+ ElMessage.error(res.msg);
62
+ return;
63
+ }
64
+ data.value = (res.data || []).map((item) => ({
65
+ value: item[unref(valueAttr)],
66
+ label: item[unref(labelAttr)]
67
+ }));
68
+ });
69
+ const loadingSubscription = new Observable((observer) => watch(computed(() => unref(dataTable).locking), observer.next.bind(observer), {
70
+ immediate: true
71
+ })).subscribe((locking) => {
72
+ loading.value = locking;
73
+ });
74
+ const searchSubscription = searchObservable.subscribe(([[searchAttr2, oldSearchAttr], search2]) => {
75
+ if (oldSearchAttr) {
76
+ unref(dataTable).removeParam(oldSearchAttr);
77
+ }
78
+ if (searchAttr2) {
79
+ unref(dataTable).setParam(searchAttr2, search2);
80
+ }
81
+ unref(dataTable).refresh();
82
+ });
83
+ unref(dataTable).setParam(unref(searchAttr), "");
84
+ const disabledSubscription = disabledObservable.pipe(filter((disabled2) => !disabled2)).subscribe(() => {
85
+ unref(dataTable).refresh();
86
+ });
87
+ onBeforeUnmount(() => {
88
+ loadDataSubscription.unsubscribe();
89
+ loadingSubscription.unsubscribe();
90
+ searchSubscription.unsubscribe();
91
+ disabledSubscription.unsubscribe();
92
+ });
93
+ } else if (unref(itfInfo)) {
94
+ const _itfInfo = computed(() => ({
95
+ url: unref(itfInfo).url,
96
+ method: unref(itfInfo).method || "POST",
97
+ options: unref(itfInfo).options || {}
98
+ }));
99
+ const inputParamsOberserble = new Observable((observer) => {
100
+ watch(computed(() => unref(itfInfo).params), (newVal = {}, oldVall) => {
101
+ if (!isEqual(oldVall, newVal)) {
102
+ observer.next(newVal);
103
+ }
104
+ }, {
105
+ immediate: true
106
+ });
107
+ });
108
+ const paramsObserable = combineLatest([searchAttrObserable, searchObserable, inputParamsOberserble]).pipe(map(([[searchAttr2], search2, params]) => ({
109
+ ...params,
110
+ [searchAttr2]: search2
111
+ })));
112
+ let inited = false;
113
+ const subscription = combineLatest([paramsObserable, disabledObservable]).pipe(tap(() => {
114
+ loading.value = true;
115
+ }), debounceTime(unref(debounceDelay)), filter(([_, disabled2]) => {
116
+ return !inited && !unref(lazy) || !disabled2;
117
+ }), map(([params]) => ({
118
+ ...unref(_itfInfo),
119
+ params
120
+ })), map(({
121
+ url,
122
+ method,
123
+ params,
124
+ options
125
+ }) => from(unref(httpRequest)[method.toLowerCase()](url, params, options)).pipe(catchError(() => of({
126
+ code: 1,
127
+ msg: "\u7F51\u7EDC\u5F02\u5E38\uFF01"
128
+ })))), mergeAll()).subscribe((result) => {
129
+ try {
130
+ inited = true;
131
+ if (result.code != 0) {
132
+ data.value = [];
133
+ ElMessage.error(result.msg);
134
+ return;
135
+ }
136
+ data.value = (result.data || []).map((item) => ({
137
+ value: item[unref(valueAttr)],
138
+ label: item[unref(labelAttr)]
139
+ }));
140
+ } finally {
141
+ loading.value = false;
142
+ }
143
+ });
144
+ onBeforeUnmount(subscription.unsubscribe.bind(subscription));
145
+ }
146
+ return {
147
+ data,
148
+ loading
149
+ };
150
+ }
151
+
152
+ export { dataProps, useData };
package/es/index.mjs ADDED
@@ -0,0 +1,27 @@
1
+ import { makeInstaller } from './make-installer.mjs';
2
+ import components from './components.mjs';
3
+ import plugins from './plugins.mjs';
4
+ export { BwaDataForm, BwaDataFormItem } from './data-form/index.mjs';
5
+ export { BwaDataColumnView, BwaDataTable, BwaDataTableColumn } from './data-table/index.mjs';
6
+ export { BwaFilterPanel, BwaFilterpanelItem } from './filter-panel/index.mjs';
7
+ export { BwaAdvanceOperation, BwaAdvanceOption, BwaAdvanceSelect } from './advance-select/index.mjs';
8
+ export { BwaDateRange } from './date-range/index.mjs';
9
+ export { BwaApplicationSlot, BwaBreadcrumbItem, BwaHeaderToolsItem } from './application-slot/index.mjs';
10
+ export { BwaLayout } from './layout/index.mjs';
11
+ export { BwaMenu } from './menu/index.mjs';
12
+ export { BwaPanel } from './panel/index.mjs';
13
+ export { BwaPanelTab } from './panel-tabs/index.mjs';
14
+ export { BwaContextmenu } from './contextmenu/index.mjs';
15
+ export { BwaBreadcrumbSelect } from './breadcrumb-select/index.mjs';
16
+ export { BwaDataTableSetting } from './datatable-settings/index.mjs';
17
+ export { BwaDraglist } from './drag-list/index.mjs';
18
+ export { BwaProgress, BwaProgressItem } from './progress/index.mjs';
19
+ export { BwaDragable, BwaDragableItem, BwaDragableOperation } from './dragable/index.mjs';
20
+ export { useContextmenu } from './contextmenu/use-contextmenu.mjs';
21
+
22
+ const install = makeInstaller([...components, ...plugins]);
23
+ var index = {
24
+ install
25
+ };
26
+
27
+ export { index as default, install };
@@ -0,0 +1,6 @@
1
+ import { withInstall } from 'element-plus/es/utils/vue/install';
2
+ import Layout from './layout.mjs';
3
+
4
+ const BwaLayout = withInstall(Layout);
5
+
6
+ export { BwaLayout, BwaLayout as default };
@@ -0,0 +1,86 @@
1
+ import { defineComponent, computed, unref, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, withCtx, renderSlot, createElementVNode } from 'vue';
2
+ import { useRouter } from 'vue-router';
3
+ import { useNamespace, useService } from '@ctzy-web-client/web-base-client-vue';
4
+ import { BwaMenu } from '../menu/index.mjs';
5
+ import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
6
+
7
+ const __default__ = defineComponent({
8
+ name: "BwaLayout"
9
+ });
10
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
11
+ setup(__props) {
12
+ ;
13
+ const router = useRouter();
14
+ const ns = useNamespace("layout");
15
+ const menuService = useService("MenuService");
16
+ const isCollapsed = computed(() => {
17
+ var _a, _b;
18
+ return (_b = (_a = unref(menuService)) == null ? void 0 : _a.isCollapsed) != null ? _b : false;
19
+ });
20
+ const menus = computed(() => {
21
+ var _a, _b;
22
+ return (_b = (_a = unref(menuService)) == null ? void 0 : _a.getMenus()) != null ? _b : [];
23
+ });
24
+ const currentMenuID = computed(
25
+ () => {
26
+ var _a, _b, _c;
27
+ return (_c = (_b = (_a = unref(menuService)) == null ? void 0 : _a.getCurrentMenu()) == null ? void 0 : _b.id) != null ? _c : "";
28
+ }
29
+ );
30
+ const handleSelect = (menu) => {
31
+ if (!menu) {
32
+ return;
33
+ }
34
+ switch (menu == null ? void 0 : menu.type) {
35
+ case 0:
36
+ unref(menuService).setCurrentMenuById(menu.id);
37
+ router.push(menu.path);
38
+ break;
39
+ case 1:
40
+ let openLink = "";
41
+ if (path.toLowerCase().indexOf("https://") == 0 || path.toLowerCase().indexOf("http://") == 0) {
42
+ openLink = path;
43
+ } else if (path.startsWith("//")) {
44
+ openLink = location.protocol + path;
45
+ } else {
46
+ openLink = path;
47
+ }
48
+ window.open(openLink);
49
+ break;
50
+ }
51
+ };
52
+ return (_ctx, _cache) => {
53
+ const _component_ElScrollbar = resolveComponent("ElScrollbar");
54
+ return openBlock(), createElementBlock("div", {
55
+ class: normalizeClass([unref(ns).b(), "justify-between"])
56
+ }, [
57
+ createVNode(_component_ElScrollbar, {
58
+ class: normalizeClass(unref(ns).e("menu-wrapper")),
59
+ height: "100%"
60
+ }, {
61
+ default: withCtx(() => [
62
+ renderSlot(_ctx.$slots, "left-panel", {}, () => [
63
+ createVNode(unref(BwaMenu), {
64
+ class: normalizeClass(unref(ns).e("menu")),
65
+ menus: unref(menus),
66
+ currentMenuID: unref(currentMenuID),
67
+ collapsed: unref(isCollapsed),
68
+ onSelect: handleSelect
69
+ }, null, 8, ["class", "menus", "currentMenuID", "collapsed"])
70
+ ]),
71
+ renderSlot(_ctx.$slots, "left-panel-append")
72
+ ]),
73
+ _: 3
74
+ }, 8, ["class"]),
75
+ createElementVNode("div", {
76
+ class: normalizeClass(unref(ns).e("main"))
77
+ }, [
78
+ renderSlot(_ctx.$slots, "default")
79
+ ], 2)
80
+ ], 2);
81
+ };
82
+ }
83
+ });
84
+ var Layout = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "layout.vue"]]);
85
+
86
+ export { Layout as default };
@@ -0,0 +1,34 @@
1
+ import ElementPlus from 'element-plus';
2
+ import * as icons from '@element-plus/icons';
3
+ import zhCn from 'element-plus/es/locale/lang/zh-cn';
4
+ import { provideGlobalConfig } from '@ctzy-web-client/web-base-client-vue';
5
+
6
+ const INSTALLED_KEY = Symbol("INSTALLED_KEY");
7
+ const makeInstaller = (components = []) => {
8
+ const install = (app, options) => {
9
+ if (app[INSTALLED_KEY]) {
10
+ return;
11
+ }
12
+ app[INSTALLED_KEY] = true;
13
+ options = {
14
+ ...options,
15
+ locale: zhCn
16
+ };
17
+ app.use(ElementPlus, options);
18
+ app.use({
19
+ install: (app2) => {
20
+ Object.keys(icons).forEach((key) => app2.component(icons[key].name, icons[key]));
21
+ }
22
+ });
23
+ components.forEach((component) => app.use(component));
24
+ if (options) {
25
+ provideGlobalConfig({
26
+ ...options,
27
+ namespace: "bwa"
28
+ }, app, true);
29
+ }
30
+ };
31
+ return install;
32
+ };
33
+
34
+ export { makeInstaller };
@@ -0,0 +1,25 @@
1
+ class Rectangle {
2
+ constructor(x, y, width, height) {
3
+ if (width < 0) {
4
+ x = x - (width = -width);
5
+ }
6
+ if (height < 0) {
7
+ y = y - (height = -height);
8
+ }
9
+ this.x = x;
10
+ this.y = y;
11
+ this.width = width;
12
+ this.height = height;
13
+ this.left = x;
14
+ this.top = y;
15
+ this.right = x + width;
16
+ this.bottom = y + height;
17
+ this.cx = x + width / 2;
18
+ this.cy = y + height / 2;
19
+ }
20
+ pointIn(x, y) {
21
+ return x >= this.left && x <= this.right && y >= this.top && y <= this.bottom;
22
+ }
23
+ }
24
+
25
+ export { Rectangle };
@@ -0,0 +1,6 @@
1
+ import { withInstall } from 'element-plus/es/utils/vue/install';
2
+ import Menu from './menu.mjs';
3
+
4
+ const BwaMenu = withInstall(Menu);
5
+
6
+ export { BwaMenu, BwaMenu as default };
@@ -0,0 +1,75 @@
1
+ import { defineComponent, computed, resolveComponent, unref, openBlock, createBlock, withCtx, createElementBlock, normalizeClass, createCommentVNode, createElementVNode, toDisplayString, Fragment, renderList } from 'vue';
2
+ import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
3
+ import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
4
+
5
+ const __default__ = defineComponent({
6
+ name: "BwaMenuItem"
7
+ });
8
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
9
+ props: {
10
+ item: {
11
+ type: Object,
12
+ required: true
13
+ }
14
+ },
15
+ setup(__props) {
16
+ const props = __props;
17
+ const ns = useNamespace("menu");
18
+ const id = computed(() => {
19
+ if (typeof props.id !== "number" && !props.item.id) {
20
+ return "";
21
+ }
22
+ return props.item.id + "";
23
+ });
24
+ const children = computed(() => {
25
+ var _a;
26
+ return ((_a = props.item) == null ? void 0 : _a.children) || [];
27
+ });
28
+ return (_ctx, _cache) => {
29
+ const _component_ElMenuItem = resolveComponent("ElMenuItem");
30
+ const _component_BwaMenuItem = resolveComponent("BwaMenuItem");
31
+ const _component_ElSubMenu = resolveComponent("ElSubMenu");
32
+ return !unref(children).length ? (openBlock(), createBlock(_component_ElMenuItem, {
33
+ key: 0,
34
+ index: unref(id)
35
+ }, {
36
+ default: withCtx(() => [
37
+ __props.item.iconName ? (openBlock(), createElementBlock("i", {
38
+ key: 0,
39
+ class: normalizeClass(["ptp-icon", `ptp-${__props.item.iconName}`])
40
+ }, null, 2)) : createCommentVNode("v-if", true),
41
+ createElementVNode("span", {
42
+ class: normalizeClass(unref(ns).be("item", "content"))
43
+ }, toDisplayString(__props.item.title), 3)
44
+ ]),
45
+ _: 1
46
+ }, 8, ["index"])) : (openBlock(), createBlock(_component_ElSubMenu, {
47
+ key: 1,
48
+ index: unref(id),
49
+ "popper-class": unref(ns).b("sub")
50
+ }, {
51
+ title: withCtx(() => [
52
+ __props.item.iconName ? (openBlock(), createElementBlock("i", {
53
+ key: 0,
54
+ class: normalizeClass(["ptp-icon", `ptp-${__props.item.iconName}`])
55
+ }, null, 2)) : createCommentVNode("v-if", true),
56
+ createElementVNode("span", {
57
+ class: normalizeClass(unref(ns).be("item", "content"))
58
+ }, toDisplayString(__props.item.title), 3)
59
+ ]),
60
+ default: withCtx(() => [
61
+ (openBlock(true), createElementBlock(Fragment, null, renderList(unref(children), (child) => {
62
+ return openBlock(), createBlock(_component_BwaMenuItem, {
63
+ item: child,
64
+ key: child.id
65
+ }, null, 8, ["item"]);
66
+ }), 128))
67
+ ]),
68
+ _: 1
69
+ }, 8, ["index", "popper-class"]));
70
+ };
71
+ }
72
+ });
73
+ var MenuItem = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "menu-item.vue"]]);
74
+
75
+ export { MenuItem as default };
@@ -0,0 +1,60 @@
1
+ import { defineComponent, resolveComponent, openBlock, createBlock, normalizeClass, unref, withCtx, createElementBlock, Fragment, renderList } from 'vue';
2
+ import { useNamespace } from '@ctzy-web-client/web-base-client-vue';
3
+ import MenuItem from './menu-item.mjs';
4
+ import _export_sfc from '../_virtual/_plugin-vue_export-helper.mjs';
5
+
6
+ const __default__ = defineComponent({
7
+ name: "BwaMenu"
8
+ });
9
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
10
+ props: {
11
+ currentMenuID: String,
12
+ menus: {
13
+ type: Array,
14
+ default: () => []
15
+ },
16
+ collapsed: { type: Boolean, default: false }
17
+ },
18
+ emits: ["select"],
19
+ setup(__props, { emit }) {
20
+ const props = __props;
21
+ const ns = useNamespace("menu");
22
+ const getMenuById = (id) => {
23
+ const menus = props.menus || [];
24
+ let list = [...menus];
25
+ for (let i = 0; i < list.length; i++) {
26
+ const item = list[i];
27
+ if (item.id === id) {
28
+ return item;
29
+ }
30
+ list = list.concat(item.children || []);
31
+ }
32
+ return null;
33
+ };
34
+ const handleSelect = (id) => {
35
+ emit("select", getMenuById(id));
36
+ };
37
+ return (_ctx, _cache) => {
38
+ const _component_ElMenu = resolveComponent("ElMenu");
39
+ return openBlock(), createBlock(_component_ElMenu, {
40
+ "default-active": __props.currentMenuID,
41
+ class: normalizeClass([unref(ns).b(), __props.collapsed ? unref(ns).m("collapsed") : ""]),
42
+ collapse: __props.collapsed,
43
+ onSelect: handleSelect
44
+ }, {
45
+ default: withCtx(() => [
46
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.menus, (item) => {
47
+ return openBlock(), createBlock(MenuItem, {
48
+ key: item.id,
49
+ item
50
+ }, null, 8, ["item"]);
51
+ }), 128))
52
+ ]),
53
+ _: 1
54
+ }, 8, ["default-active", "class", "collapse"]);
55
+ };
56
+ }
57
+ });
58
+ var Menu = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "menu.vue"]]);
59
+
60
+ export { Menu as default };