@ctzy-web-client/plugin-component-vue 1.0.8 → 1.0.9
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.
- package/package.json +3 -3
- package/es/_virtual/_plugin-vue_export-helper.mjs +0 -9
- package/es/advance-select/advance-operation.mjs +0 -43
- package/es/advance-select/advance-option.mjs +0 -125
- package/es/advance-select/advance-select.mjs +0 -359
- package/es/advance-select/events-helpers.mjs +0 -29
- package/es/advance-select/index.mjs +0 -13
- package/es/advance-select/use-advance-option.mjs +0 -43
- package/es/advance-select/use-advance-select.mjs +0 -117
- package/es/application-slot/application-slot.mjs +0 -51
- package/es/application-slot/breadcrumb-item.mjs +0 -23
- package/es/application-slot/header-tools-item.mjs +0 -23
- package/es/application-slot/index.mjs +0 -16
- package/es/breadcrumb-select/breadcrumb-select.mjs +0 -155
- package/es/breadcrumb-select/index.mjs +0 -6
- package/es/components.mjs +0 -22
- package/es/contextmenu/contextmenu-item.mjs +0 -21
- package/es/contextmenu/contextmenu.mjs +0 -64
- package/es/contextmenu/index.mjs +0 -10
- package/es/contextmenu/use-contextmenu.mjs +0 -85
- package/es/data-form/data-form-item.mjs +0 -53
- package/es/data-form/data-form.mjs +0 -175
- package/es/data-form/dynamic-component.mjs +0 -23
- package/es/data-form/form-components/Blots/AtBlot.mjs +0 -25
- package/es/data-form/form-components/bwa-date-picker.mjs +0 -45
- package/es/data-form/form-components/bwa-date-time-picker.mjs +0 -50
- package/es/data-form/form-components/bwa-input-float.mjs +0 -43
- package/es/data-form/form-components/bwa-input-integer.mjs +0 -56
- package/es/data-form/form-components/bwa-input.mjs +0 -38
- package/es/data-form/form-components/bwa-multi-select.mjs +0 -35
- package/es/data-form/form-components/bwa-rich-text-tinymce.mjs +0 -234
- package/es/data-form/form-components/bwa-rich-text.mjs +0 -325
- package/es/data-form/form-components/bwa-select.mjs +0 -76
- package/es/data-form/form-components/bwa-textarea.mjs +0 -33
- package/es/data-form/form-components/bwa-upload.mjs +0 -159
- package/es/data-form/form-components/bwa-user-multi-select.mjs +0 -30
- package/es/data-form/form-components/bwa-user-select.mjs +0 -69
- package/es/data-form/index.mjs +0 -34
- package/es/data-table/data-column-view.mjs +0 -131
- package/es/data-table/data-table-card.mjs +0 -118
- package/es/data-table/data-table-column.mjs +0 -56
- package/es/data-table/data-table.mjs +0 -369
- package/es/data-table/dynamic-component.mjs +0 -48
- package/es/data-table/index.mjs +0 -13
- package/es/data-table/use-datatable-drag.mjs +0 -110
- package/es/datatable-settings/datatable-settings.mjs +0 -309
- package/es/datatable-settings/index.mjs +0 -6
- package/es/date-range/date-picker.mjs +0 -128
- package/es/date-range/date-range.mjs +0 -177
- package/es/date-range/index.mjs +0 -6
- package/es/drag-list/constants.mjs +0 -3
- package/es/drag-list/drag-item.mjs +0 -49
- package/es/drag-list/drag-list.mjs +0 -56
- package/es/drag-list/index.mjs +0 -6
- package/es/drag-list/use-drag-list.mjs +0 -154
- package/es/dragable/constants.mjs +0 -4
- package/es/dragable/dragable-item.mjs +0 -25
- package/es/dragable/dragable-operation.mjs +0 -32
- package/es/dragable/dragable.mjs +0 -31
- package/es/dragable/index.mjs +0 -15
- package/es/dragable/use-dragable.mjs +0 -134
- package/es/filter-panel/conditions/condition.mjs +0 -30
- package/es/filter-panel/conditions/date-range-condition.mjs +0 -46
- package/es/filter-panel/conditions/department-condition/department-condition.mjs +0 -81
- package/es/filter-panel/conditions/department-condition/department-node.mjs +0 -74
- package/es/filter-panel/conditions/index.mjs +0 -21
- package/es/filter-panel/conditions/input-condition.mjs +0 -83
- package/es/filter-panel/conditions/multi-user-condition.mjs +0 -64
- package/es/filter-panel/conditions/multiple-menu-condition.mjs +0 -41
- package/es/filter-panel/conditions/single-menu-condition.mjs +0 -68
- package/es/filter-panel/conditions/single-user-condition.mjs +0 -64
- package/es/filter-panel/filter-panel-item.mjs +0 -47
- package/es/filter-panel/filter-panel.mjs +0 -180
- package/es/filter-panel/index.mjs +0 -15
- package/es/filter-panel/use-filter-panel-item.mjs +0 -52
- package/es/filter-panel/use-filter-panel.mjs +0 -135
- package/es/hooks/use-data/index.mjs +0 -152
- package/es/index.mjs +0 -27
- package/es/layout/index.mjs +0 -6
- package/es/layout/layout.mjs +0 -86
- package/es/make-installer.mjs +0 -34
- package/es/math/Rectangle.mjs +0 -25
- package/es/menu/index.mjs +0 -6
- package/es/menu/menu-item.mjs +0 -75
- package/es/menu/menu.mjs +0 -60
- package/es/node_modules/.pnpm/@vueuse_core@9.6.0_vue@3.2.41/node_modules/@vueuse/core/index.mjs +0 -6372
- package/es/node_modules/.pnpm/@vueuse_shared@9.6.0_vue@3.2.41/node_modules/@vueuse/shared/index.mjs +0 -1517
- package/es/panel/index.mjs +0 -6
- package/es/panel/panel.mjs +0 -55
- package/es/panel-tabs/index.mjs +0 -6
- package/es/panel-tabs/panel-tabs.mjs +0 -66
- package/es/pct-filter-panel/index.mjs +0 -10
- package/es/pct-filter-panel/pct-compents/index.mjs +0 -10
- package/es/pct-filter-panel/pct-compents/pct-Input-condition.mjs +0 -71
- package/es/pct-filter-panel/pct-compents/pct-date-range-condition.mjs +0 -74
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition.mjs +0 -186
- package/es/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.mjs +0 -147
- package/es/pct-filter-panel/pct-filter-panel-item.mjs +0 -48
- package/es/pct-filter-panel/pct-filter-panel.mjs +0 -251
- package/es/pct-filter-panel/use-filter-panel-item.mjs +0 -56
- package/es/pct-filter-panel/use-filter-panel.mjs +0 -127
- package/es/plugins.mjs +0 -5
- package/es/progress/index.mjs +0 -10
- package/es/progress/progress-item.mjs +0 -68
- package/es/progress/progress.mjs +0 -74
- package/es/progress/use-progress.mjs +0 -46
- package/es/utils/db.mjs +0 -9
- package/es/utils.mjs +0 -99
- package/es/where-filter-panel/index.mjs +0 -1
- package/es/where-filter-panel/use-where-filter-panel.mjs +0 -18
- package/es/where-filter-panel/where-filter-panel.mjs +0 -17
- package/lib/_virtual/_plugin-vue_export-helper.js +0 -13
- package/lib/advance-select/advance-operation.js +0 -47
- package/lib/advance-select/advance-option.js +0 -129
- package/lib/advance-select/advance-select.js +0 -363
- package/lib/advance-select/events-helpers.js +0 -33
- package/lib/advance-select/index.js +0 -20
- package/lib/advance-select/use-advance-option.js +0 -47
- package/lib/advance-select/use-advance-select.js +0 -122
- package/lib/application-slot/application-slot.js +0 -55
- package/lib/application-slot/breadcrumb-item.js +0 -27
- package/lib/application-slot/header-tools-item.js +0 -27
- package/lib/application-slot/index.js +0 -23
- package/lib/breadcrumb-select/breadcrumb-select.js +0 -159
- package/lib/breadcrumb-select/index.js +0 -11
- package/lib/components.js +0 -26
- package/lib/contextmenu/contextmenu-item.js +0 -25
- package/lib/contextmenu/contextmenu.js +0 -68
- package/lib/contextmenu/index.js +0 -16
- package/lib/contextmenu/use-contextmenu.js +0 -89
- package/lib/data-form/data-form-item.js +0 -57
- package/lib/data-form/data-form.js +0 -179
- package/lib/data-form/dynamic-component.js +0 -27
- package/lib/data-form/form-components/Blots/AtBlot.js +0 -31
- package/lib/data-form/form-components/bwa-date-picker.js +0 -49
- package/lib/data-form/form-components/bwa-date-time-picker.js +0 -54
- package/lib/data-form/form-components/bwa-input-float.js +0 -47
- package/lib/data-form/form-components/bwa-input-integer.js +0 -60
- package/lib/data-form/form-components/bwa-input.js +0 -42
- package/lib/data-form/form-components/bwa-multi-select.js +0 -39
- package/lib/data-form/form-components/bwa-rich-text-tinymce.js +0 -242
- package/lib/data-form/form-components/bwa-rich-text.js +0 -333
- package/lib/data-form/form-components/bwa-select.js +0 -80
- package/lib/data-form/form-components/bwa-textarea.js +0 -37
- package/lib/data-form/form-components/bwa-upload.js +0 -163
- package/lib/data-form/form-components/bwa-user-multi-select.js +0 -34
- package/lib/data-form/form-components/bwa-user-select.js +0 -73
- package/lib/data-form/index.js +0 -40
- package/lib/data-table/data-column-view.js +0 -135
- package/lib/data-table/data-table-card.js +0 -122
- package/lib/data-table/data-table-column.js +0 -60
- package/lib/data-table/data-table.js +0 -373
- package/lib/data-table/dynamic-component.js +0 -56
- package/lib/data-table/index.js +0 -20
- package/lib/data-table/use-datatable-drag.js +0 -114
- package/lib/datatable-settings/datatable-settings.js +0 -313
- package/lib/datatable-settings/index.js +0 -11
- package/lib/date-range/date-picker.js +0 -136
- package/lib/date-range/date-range.js +0 -185
- package/lib/date-range/index.js +0 -11
- package/lib/drag-list/constants.js +0 -7
- package/lib/drag-list/drag-item.js +0 -53
- package/lib/drag-list/drag-list.js +0 -60
- package/lib/drag-list/index.js +0 -11
- package/lib/drag-list/use-drag-list.js +0 -158
- package/lib/dragable/constants.js +0 -9
- package/lib/dragable/dragable-item.js +0 -29
- package/lib/dragable/dragable-operation.js +0 -36
- package/lib/dragable/dragable.js +0 -35
- package/lib/dragable/index.js +0 -22
- package/lib/dragable/use-dragable.js +0 -138
- package/lib/filter-panel/conditions/condition.js +0 -34
- package/lib/filter-panel/conditions/date-range-condition.js +0 -50
- package/lib/filter-panel/conditions/department-condition/department-condition.js +0 -85
- package/lib/filter-panel/conditions/department-condition/department-node.js +0 -78
- package/lib/filter-panel/conditions/index.js +0 -26
- package/lib/filter-panel/conditions/input-condition.js +0 -87
- package/lib/filter-panel/conditions/multi-user-condition.js +0 -68
- package/lib/filter-panel/conditions/multiple-menu-condition.js +0 -45
- package/lib/filter-panel/conditions/single-menu-condition.js +0 -72
- package/lib/filter-panel/conditions/single-user-condition.js +0 -68
- package/lib/filter-panel/filter-panel-item.js +0 -51
- package/lib/filter-panel/filter-panel.js +0 -184
- package/lib/filter-panel/index.js +0 -20
- package/lib/filter-panel/use-filter-panel-item.js +0 -56
- package/lib/filter-panel/use-filter-panel.js +0 -139
- package/lib/hooks/use-data/index.js +0 -157
- package/lib/index.js +0 -60
- package/lib/layout/index.js +0 -11
- package/lib/layout/layout.js +0 -90
- package/lib/make-installer.js +0 -62
- package/lib/math/Rectangle.js +0 -29
- package/lib/menu/index.js +0 -11
- package/lib/menu/menu-item.js +0 -79
- package/lib/menu/menu.js +0 -64
- package/lib/node_modules/.pnpm/@vueuse_core@9.6.0_vue@3.2.41/node_modules/@vueuse/core/index.js +0 -6635
- package/lib/node_modules/.pnpm/@vueuse_shared@9.6.0_vue@3.2.41/node_modules/@vueuse/shared/index.js +0 -1628
- package/lib/panel/index.js +0 -11
- package/lib/panel/panel.js +0 -59
- package/lib/panel-tabs/index.js +0 -11
- package/lib/panel-tabs/panel-tabs.js +0 -70
- package/lib/pct-filter-panel/index.js +0 -14
- package/lib/pct-filter-panel/pct-compents/index.js +0 -16
- package/lib/pct-filter-panel/pct-compents/pct-Input-condition.js +0 -75
- package/lib/pct-filter-panel/pct-compents/pct-date-range-condition.js +0 -78
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition.js +0 -190
- package/lib/pct-filter-panel/pct-compents/pct-multiple-menu-condition2.js +0 -151
- package/lib/pct-filter-panel/pct-filter-panel-item.js +0 -52
- package/lib/pct-filter-panel/pct-filter-panel.js +0 -255
- package/lib/pct-filter-panel/use-filter-panel-item.js +0 -60
- package/lib/pct-filter-panel/use-filter-panel.js +0 -131
- package/lib/plugins.js +0 -9
- package/lib/progress/index.js +0 -16
- package/lib/progress/progress-item.js +0 -72
- package/lib/progress/progress.js +0 -78
- package/lib/progress/use-progress.js +0 -51
- package/lib/utils/db.js +0 -17
- package/lib/utils.js +0 -110
- package/lib/where-filter-panel/index.js +0 -2
- package/lib/where-filter-panel/use-where-filter-panel.js +0 -22
- package/lib/where-filter-panel/where-filter-panel.js +0 -21
- package/style/advance-select.css +0 -1
- package/style/breadcrumb-select.css +0 -1
- package/style/common.css +0 -1
- package/style/contextmenu.css +0 -1
- package/style/data-form.css +0 -1
- package/style/data-table.css +0 -1
- package/style/datatable-settings.css +0 -1
- package/style/date-range.css +0 -1
- package/style/department-condition.css +0 -1
- package/style/drag-list.css +0 -1
- package/style/dragable.css +0 -1
- package/style/filter-panel.css +0 -1
- package/style/index.css +0 -1
- package/style/input-condition.css +0 -1
- package/style/layout.css +0 -1
- package/style/menu.css +0 -1
- package/style/panel-tabs.css +0 -1
- package/style/panel.css +0 -1
- package/style/pct-filter-panel.css +0 -1
- package/style/progress.css +0 -1
- package/style/rich-text.css +0 -1
- package/style/var.css +0 -1
- /package/style/{src/advance-select.scss → advance-select.scss} +0 -0
- /package/style/{src/breadcrumb-select.scss → breadcrumb-select.scss} +0 -0
- /package/style/{src/common → common}/var.scss +0 -0
- /package/style/{src/common.scss → common.scss} +0 -0
- /package/style/{src/contextmenu.scss → contextmenu.scss} +0 -0
- /package/style/{src/data-form.scss → data-form.scss} +0 -0
- /package/style/{src/data-table.scss → data-table.scss} +0 -0
- /package/style/{src/datatable-settings.scss → datatable-settings.scss} +0 -0
- /package/style/{src/date-range.scss → date-range.scss} +0 -0
- /package/style/{src/department-condition.scss → department-condition.scss} +0 -0
- /package/style/{src/drag-list.scss → drag-list.scss} +0 -0
- /package/style/{src/dragable.scss → dragable.scss} +0 -0
- /package/style/{src/filter-panel.scss → filter-panel.scss} +0 -0
- /package/style/{src/index.scss → index.scss} +0 -0
- /package/style/{src/input-condition.scss → input-condition.scss} +0 -0
- /package/style/{src/layout.scss → layout.scss} +0 -0
- /package/style/{src/menu.scss → menu.scss} +0 -0
- /package/style/{src/mixins → mixins}/_var.scss +0 -0
- /package/style/{src/mixins → mixins}/config.scss +0 -0
- /package/style/{src/mixins → mixins}/function.scss +0 -0
- /package/style/{src/mixins → mixins}/mixins.scss +0 -0
- /package/style/{src/panel-tabs.scss → panel-tabs.scss} +0 -0
- /package/style/{src/panel.scss → panel.scss} +0 -0
- /package/style/{src/pct-filter-panel.scss → pct-filter-panel.scss} +0 -0
- /package/style/{src/progress.scss → progress.scss} +0 -0
- /package/style/{src/rich-text.scss → rich-text.scss} +0 -0
- /package/style/{src/theme → theme}/theme.scss +0 -0
- /package/style/{src/theme → theme}/var.scss +0 -0
- /package/style/{src/var.scss → var.scss} +0 -0
|
@@ -1,369 +0,0 @@
|
|
|
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 };
|
|
@@ -1,48 +0,0 @@
|
|
|
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 };
|
package/es/data-table/index.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
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 };
|
|
@@ -1,110 +0,0 @@
|
|
|
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 };
|