@web-utils/component 2.0.10 → 2.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.
- package/dist/chunks/3d28cc08.js +57 -0
- package/dist/chunks/{41a066be.js → 44b78389.js} +8 -8
- package/dist/chunks/5d33812d.js +147 -0
- package/dist/chunks/{61ad06b2.js → 822300f3.js} +3 -3
- package/dist/chunks/9d848bf6.js +99 -0
- package/dist/chunks/a0bb327b.js +96 -0
- package/dist/chunks/a8891d2c.js +30 -0
- package/dist/chunks/c69d5628.js +248 -0
- package/dist/chunks/de9fe802.js +24 -0
- package/dist/chunks/{5a78e0db.js → e1939731.js} +6 -5
- package/dist/components/address-input/index.js +56 -43
- package/dist/components/address-input/style.css +15 -1
- package/dist/components/aside-menu/index.js +36 -30
- package/dist/components/aside-menu/style.css +9 -1
- package/dist/components/awesome-button/index.js +35 -32
- package/dist/components/base.css +66 -1
- package/dist/components/capsule-tab/index.js +33 -27
- package/dist/components/capsule-tab/style.css +32 -1
- package/dist/components/chunk-file-uploader/index.js +88 -54
- package/dist/components/chunk-file-uploader/style.css +4 -1
- package/dist/components/chunk-file-uploader-button/index.js +31 -25
- package/dist/components/chunk-file-uploader-button/style.css +17 -1
- package/dist/components/chunk-file-uploader-drop/index.js +42 -28
- package/dist/components/chunk-file-uploader-drop/style.css +12 -1
- package/dist/components/chunk-file-uploader-file/index.js +212 -134
- package/dist/components/chunk-file-uploader-file/style.css +125 -1
- package/dist/components/chunk-file-uploader-files/index.js +34 -28
- package/dist/components/chunk-file-uploader-files/style.css +9 -1
- package/dist/components/chunk-file-uploader-list/index.js +35 -29
- package/dist/components/chunk-file-uploader-list/style.css +9 -1
- package/dist/components/chunk-file-uploader-un-support/index.js +38 -30
- package/dist/components/chunk-file-uploader-un-support/style.css +6 -1
- package/dist/components/code-mirror-editor/index.js +181 -153
- package/dist/components/code-mirror-editor/style.css +17 -1
- package/dist/components/color-picker/index.js +68 -49
- package/dist/components/confirm-button/index.js +21 -19
- package/dist/components/confirmable/index.js +19 -18
- package/dist/components/context-menu/index.js +130 -108
- package/dist/components/context-menu/style.css +88 -1
- package/dist/components/custom-scrollbar/index.js +67 -49
- package/dist/components/data-table-picker/index.js +81 -62
- package/dist/components/dynamic-table/index.js +113 -89
- package/dist/components/dynamic-table/style.css +30 -1
- package/dist/components/e-charts/index.js +201 -120
- package/dist/components/e-charts/style.css +10 -1
- package/dist/components/editable-progress/index.js +93 -60
- package/dist/components/editable-progress/style.css +37 -1
- package/dist/components/editable-tree/index.js +638 -423
- package/dist/components/editable-tree/style.css +82 -1
- package/dist/components/egd-collapse/index.js +46 -33
- package/dist/components/egd-collapse-item/index.js +76 -60
- package/dist/components/element-dialog/index.js +147 -95
- package/dist/components/element-dialog/style.css +102 -1
- package/dist/components/empty-view/index.js +34 -28
- package/dist/components/empty-view/style.css +17 -1
- package/dist/components/error-view/index.js +32 -26
- package/dist/components/error-view/style.css +17 -1
- package/dist/components/flex-column/index.js +40 -25
- package/dist/components/flex-item/index.js +57 -29
- package/dist/components/flex-row/index.js +40 -25
- package/dist/components/flex-scroller/index.js +32 -26
- package/dist/components/flex-scroller/style.css +20 -1
- package/dist/components/form-button/index.js +38 -34
- package/dist/components/form-cascader/index.js +81 -71
- package/dist/components/form-checkbox-group/index.js +113 -88
- package/dist/components/form-checkbox-group/style.css +51 -1
- package/dist/components/form-date-picker/index.js +132 -70
- package/dist/components/form-holder/index.js +39 -32
- package/dist/components/form-input/index.js +62 -56
- package/dist/components/form-input-email/index.js +60 -48
- package/dist/components/form-input-id-card/index.js +59 -53
- package/dist/components/form-input-number/index.js +68 -61
- package/dist/components/form-input-number/style.css +12 -1
- package/dist/components/form-input-phone-number/index.js +55 -49
- package/dist/components/form-input-time/index.js +59 -53
- package/dist/components/form-item/index.js +123 -80
- package/dist/components/form-item/style.css +11 -1
- package/dist/components/form-item-config-provider/index.js +26 -25
- package/dist/components/form-item-group/index.js +111 -85
- package/dist/components/form-item-group/style.css +30 -1
- package/dist/components/form-radio-group/index.js +104 -85
- package/dist/components/form-radio-group/style.css +53 -1
- package/dist/components/form-select/index.js +91 -76
- package/dist/components/form-switch/index.js +57 -51
- package/dist/components/form-textarea/index.js +57 -51
- package/dist/components/form-view/index.js +232 -165
- package/dist/components/form-view/style.css +158 -1
- package/dist/components/guide-steps/index.js +58 -44
- package/dist/components/guide-steps/style.css +34 -1
- package/dist/components/icon-card/index.js +35 -29
- package/dist/components/icon-card/style.css +56 -1
- package/dist/components/iframe-window/index.js +35 -29
- package/dist/components/iframe-window/style.css +20 -1
- package/dist/components/image-viewer/index.js +66 -48
- package/dist/components/image-viewer/style.css +21 -1
- package/dist/components/input-number/index.js +193 -127
- package/dist/components/input-number/style.css +15 -1
- package/dist/components/input-number-range/index.js +57 -45
- package/dist/components/input-number-range/style.css +12 -1
- package/dist/components/j-s-x-component/index.js +4 -4
- package/dist/components/keep-view-alive/index.js +120 -73
- package/dist/components/loading-view/index.js +32 -26
- package/dist/components/loading-view/style.css +17 -1
- package/dist/components/nav-bar/index.js +37 -27
- package/dist/components/nav-bar/style.css +17 -1
- package/dist/components/not-implement/index.js +31 -23
- package/dist/components/not-implement/style.css +15 -1
- package/dist/components/page/index.js +28 -22
- package/dist/components/page/style.css +12 -1
- package/dist/components/page-header/index.js +36 -30
- package/dist/components/page-header/style.css +14 -1
- package/dist/components/page-index/index.js +83 -62
- package/dist/components/page-index/style.css +23 -1
- package/dist/components/page-index-top/index.js +68 -53
- package/dist/components/page-skeleton/index.js +37 -31
- package/dist/components/page-skeleton/style.css +23 -1
- package/dist/components/page-skeleton-new/index.js +48 -42
- package/dist/components/page-skeleton-new/style.css +42 -1
- package/dist/components/pageable-table/index.js +253 -186
- package/dist/components/pageable-table/style.css +72 -1
- package/dist/components/pageable-view/index.js +199 -129
- package/dist/components/pageable-view/style.css +69 -1
- package/dist/components/photo-swipe/index.js +151 -110
- package/dist/components/photo-swipe/style.css +20 -1
- package/dist/components/resize-observer/index.js +68 -34
- package/dist/components/resize-observer/style.css +31 -1
- package/dist/components/search-popover/index.js +211 -153
- package/dist/components/search-popover/style.css +93 -1
- package/dist/components/sign-panel/index.js +142 -92
- package/dist/components/sign-panel/style.css +97 -1
- package/dist/components/split-pane/index.js +162 -101
- package/dist/components/split-pane/style.css +100 -1
- package/dist/components/stateful/index.js +34 -31
- package/dist/components/stateful/style.css +33 -1
- package/dist/components/static-pageable-table/index.js +44 -37
- package/dist/components/static-pageable-table/style.css +9 -1
- package/dist/components/swiper/index.js +150 -85
- package/dist/components/swiper/style.css +43 -1
- package/dist/components/tab/index.js +72 -54
- package/dist/components/tab/style.css +122 -1
- package/dist/components/tab-item/index.js +35 -30
- package/dist/components/table-column/index.js +32 -30
- package/dist/components/table-view/index.js +227 -156
- package/dist/components/table-view/style.css +95 -1
- package/dist/components/tag-render/index.js +58 -44
- package/dist/components/tag-render/style.css +33 -1
- package/dist/components/tinymce-editor/index.js +95 -79
- package/dist/components/tinymce-editor/style.css +43 -1
- package/dist/components/tinymce-wrapper/index.js +121 -92
- package/dist/components/tinymce-wrapper/style.css +36 -1
- package/dist/components/toolbar/index.js +84 -63
- package/dist/components/toolbar/style.css +39 -1
- package/dist/components/toolbar-button/index.js +48 -41
- package/dist/components/toolbar-button/style.css +21 -1
- package/dist/components/trigger/index.js +36 -29
- package/dist/components/vue-tags-input/index.js +308 -188
- package/dist/components/vue-tags-input/style.css +682 -1
- package/dist/components/watermark/index.js +37 -25
- package/dist/components/watermark/style.css +11 -1
- package/dist/components/x-dialog/index.js +93 -67
- package/dist/components/x-dialog/style.css +15 -1
- package/dist/index.css +1105 -193
- package/dist/index.es.js +7242 -4789
- package/package.json +1 -1
- package/web-types.json +1 -1
- package/dist/chunks/3a79781b.js +0 -75
- package/dist/chunks/5d4282fb.js +0 -30
- package/dist/chunks/76680a03.js +0 -24
- package/dist/chunks/8c0142e0.js +0 -81
- package/dist/chunks/97652d86.js +0 -26
- package/dist/chunks/b4acd3a6.js +0 -126
- package/dist/chunks/f71045fc.js +0 -184
|
@@ -1,158 +1,165 @@
|
|
|
1
|
-
import { cloneDeep
|
|
2
|
-
import { f as
|
|
3
|
-
import { n as
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
1
|
+
import { cloneDeep, merge, hasOwn } from "@web-utils/core";
|
|
2
|
+
import { f as filterTableColumnProperties, d as filterTableProperties, e as filterTableEvents } from "../../chunks/c69d5628.js";
|
|
3
|
+
import { n as normalizeComponent } from "../../chunks/3d28cc08.js";
|
|
4
|
+
var render = function() {
|
|
5
|
+
var _vm = this;
|
|
6
|
+
var _h = _vm.$createElement;
|
|
7
|
+
var _c = _vm._self._c || _h;
|
|
8
|
+
return _c("div", {
|
|
7
9
|
class: ["pageable-table", {
|
|
8
|
-
"auto-height":
|
|
10
|
+
"auto-height": _vm.autoHeight
|
|
9
11
|
}]
|
|
10
|
-
}, [
|
|
12
|
+
}, [_c("div", {
|
|
11
13
|
staticClass: "pageable-table-wrapper"
|
|
12
|
-
}, [
|
|
14
|
+
}, [_vm._t("toolbar"), _c("ElTable", _vm._g(_vm._b({
|
|
13
15
|
ref: "table",
|
|
14
16
|
class: ["flex-item", {
|
|
15
|
-
"header-bold":
|
|
17
|
+
"header-bold": _vm.headerBold
|
|
16
18
|
}],
|
|
17
19
|
attrs: {
|
|
18
|
-
data:
|
|
19
|
-
border:
|
|
20
|
+
"data": _vm.records,
|
|
21
|
+
"border": _vm.border
|
|
20
22
|
},
|
|
21
23
|
on: {
|
|
22
|
-
"hook:updated":
|
|
23
|
-
"sort-change":
|
|
24
|
-
"row-dblclick":
|
|
25
|
-
"current-change":
|
|
24
|
+
"hook:updated": _vm.updateTableScrollPosition,
|
|
25
|
+
"sort-change": _vm.onSortChange,
|
|
26
|
+
"row-dblclick": _vm.rowDbClick,
|
|
27
|
+
"current-change": _vm.onCurrentChange
|
|
26
28
|
},
|
|
27
|
-
scopedSlots:
|
|
29
|
+
scopedSlots: _vm._u([{
|
|
28
30
|
key: "empty",
|
|
29
31
|
fn: function() {
|
|
30
|
-
return [
|
|
31
|
-
return [
|
|
32
|
+
return [_vm._t("empty", function() {
|
|
33
|
+
return [_vm.tableStatus === _vm.TABLE_STATUS.loading ? [_c("span", {
|
|
32
34
|
staticClass: "pageable-table-loading"
|
|
33
|
-
}, [
|
|
35
|
+
}, [_c("i", {
|
|
34
36
|
staticClass: "table-status-icon el-icon-loading"
|
|
35
|
-
}),
|
|
37
|
+
}), _vm._v(" 加载中...")])] : _vm.tableStatus === _vm.TABLE_STATUS.error ? [_c("ElButton", {
|
|
36
38
|
staticClass: "pageable-table-error",
|
|
37
39
|
attrs: {
|
|
38
|
-
icon: "table-status-icon fa fa-frown-o"
|
|
40
|
+
"icon": "table-status-icon fa fa-frown-o"
|
|
39
41
|
},
|
|
40
42
|
on: {
|
|
41
|
-
click:
|
|
43
|
+
"click": _vm.refresh
|
|
42
44
|
}
|
|
43
|
-
}, [
|
|
45
|
+
}, [_vm._v(" 加载失败,点击重试! ")])] : [_vm._v(" 暂无数据 ")]];
|
|
44
46
|
})];
|
|
45
47
|
},
|
|
46
|
-
proxy:
|
|
48
|
+
proxy: true
|
|
47
49
|
}, {
|
|
48
50
|
key: "append",
|
|
49
51
|
fn: function() {
|
|
50
|
-
return [
|
|
52
|
+
return [_vm._t("append")];
|
|
51
53
|
},
|
|
52
|
-
proxy:
|
|
53
|
-
}], null,
|
|
54
|
-
}, "ElTable",
|
|
54
|
+
proxy: true
|
|
55
|
+
}], null, true)
|
|
56
|
+
}, "ElTable", _vm.filterTableProperties(_vm.mergeAttrs), false), _vm.filterTableEvents(_vm.$listeners)), [_vm.multiple && _vm.selection ? _c("TableColumn", {
|
|
55
57
|
key: "multiple",
|
|
56
58
|
attrs: {
|
|
57
|
-
type: "selection",
|
|
58
|
-
width: "45",
|
|
59
|
-
align: "center"
|
|
59
|
+
"type": "selection",
|
|
60
|
+
"width": "45",
|
|
61
|
+
"align": "center"
|
|
60
62
|
}
|
|
61
|
-
}) :
|
|
63
|
+
}) : _vm._e(), !_vm.multiple && _vm.selection ? _c("TableColumn", {
|
|
62
64
|
key: "single",
|
|
63
65
|
attrs: {
|
|
64
|
-
type: "single-selection",
|
|
66
|
+
"type": "single-selection",
|
|
65
67
|
"class-name": "single-select-column",
|
|
66
|
-
width: "45",
|
|
67
|
-
align: "center"
|
|
68
|
+
"width": "45",
|
|
69
|
+
"align": "center"
|
|
68
70
|
},
|
|
69
|
-
scopedSlots:
|
|
71
|
+
scopedSlots: _vm._u([{
|
|
70
72
|
key: "header",
|
|
71
73
|
fn: function() {
|
|
72
|
-
return [
|
|
74
|
+
return [_c("ElRadio", {
|
|
73
75
|
attrs: {
|
|
74
|
-
value: !!
|
|
75
|
-
label:
|
|
76
|
+
"value": !!_vm.currentRow,
|
|
77
|
+
"label": true
|
|
76
78
|
}
|
|
77
|
-
}, [
|
|
79
|
+
}, [_c("span")])];
|
|
78
80
|
},
|
|
79
|
-
proxy:
|
|
81
|
+
proxy: true
|
|
80
82
|
}, {
|
|
81
83
|
key: "default",
|
|
82
|
-
fn: function(
|
|
83
|
-
var
|
|
84
|
-
return [
|
|
84
|
+
fn: function(_ref) {
|
|
85
|
+
var row = _ref.row;
|
|
86
|
+
return [_c("ElRadio", {
|
|
85
87
|
attrs: {
|
|
86
|
-
label:
|
|
87
|
-
value:
|
|
88
|
+
"label": true,
|
|
89
|
+
"value": _vm.currentRow && _vm.currentRow[_vm.$attrs["row-key"] || "id"] === row[_vm.$attrs["row-key"] || "id"]
|
|
88
90
|
}
|
|
89
|
-
}, [
|
|
91
|
+
}, [_c("span")])];
|
|
90
92
|
}
|
|
91
|
-
}], null,
|
|
92
|
-
}) :
|
|
93
|
+
}], null, false, 307797321)
|
|
94
|
+
}) : _vm._e(), _vm.index ? _c("TableColumn", {
|
|
93
95
|
key: "order",
|
|
94
96
|
attrs: {
|
|
95
|
-
type: "index",
|
|
96
|
-
label: "序号",
|
|
97
|
-
width:
|
|
98
|
-
align: "center"
|
|
97
|
+
"type": "index",
|
|
98
|
+
"label": "序号",
|
|
99
|
+
"width": _vm.indexWidth,
|
|
100
|
+
"align": "center"
|
|
99
101
|
},
|
|
100
|
-
scopedSlots:
|
|
102
|
+
scopedSlots: _vm._u([{
|
|
101
103
|
key: "default",
|
|
102
|
-
fn: function(
|
|
103
|
-
var
|
|
104
|
-
return [
|
|
104
|
+
fn: function(_ref2) {
|
|
105
|
+
var $index = _ref2.$index;
|
|
106
|
+
return [_vm._v(" " + _vm._s((_vm.page.page - 1) * _vm.page.limit + $index + 1 || $index + 1) + " ")];
|
|
105
107
|
}
|
|
106
|
-
}], null,
|
|
107
|
-
}) :
|
|
108
|
-
return [
|
|
109
|
-
return
|
|
110
|
-
key: `${
|
|
111
|
-
}, "TableColumn",
|
|
112
|
-
}) :
|
|
108
|
+
}], null, false, 4238275121)
|
|
109
|
+
}) : _vm._e(), _vm._t("default", function() {
|
|
110
|
+
return [_vm.columns && _vm.columns.length ? _vm._l(_vm.headers, function(item, headerIndex) {
|
|
111
|
+
return _c("TableColumn", _vm._b({
|
|
112
|
+
key: `${item.prop}-${headerIndex}`
|
|
113
|
+
}, "TableColumn", item, false));
|
|
114
|
+
}) : _c("TableColumn", {
|
|
113
115
|
attrs: {
|
|
114
|
-
label: "点击表格行复制模板"
|
|
116
|
+
"label": "点击表格行复制模板"
|
|
115
117
|
},
|
|
116
|
-
scopedSlots:
|
|
118
|
+
scopedSlots: _vm._u([{
|
|
117
119
|
key: "default",
|
|
118
|
-
fn: function(
|
|
119
|
-
var
|
|
120
|
-
return [
|
|
120
|
+
fn: function(_ref3) {
|
|
121
|
+
var row = _ref3.row;
|
|
122
|
+
return [_c("pre", {
|
|
121
123
|
staticClass: "pointer"
|
|
122
|
-
}, [
|
|
124
|
+
}, [_vm._v(_vm._s(JSON.stringify(row, null, " ")))])];
|
|
123
125
|
}
|
|
124
126
|
}])
|
|
125
127
|
})];
|
|
126
|
-
})], 2),
|
|
128
|
+
})], 2), _c("ElPagination", {
|
|
127
129
|
staticClass: "flex-not-shrink",
|
|
128
130
|
attrs: {
|
|
129
|
-
"current-page":
|
|
130
|
-
"hide-on-single-page":
|
|
131
|
-
"page-size":
|
|
132
|
-
total:
|
|
133
|
-
background: "",
|
|
134
|
-
layout: "total, prev, pager, next, jumper"
|
|
131
|
+
"current-page": _vm.page.page,
|
|
132
|
+
"hide-on-single-page": _vm.hideOnSinglePage,
|
|
133
|
+
"page-size": _vm.page.limit,
|
|
134
|
+
"total": _vm.page.total,
|
|
135
|
+
"background": "",
|
|
136
|
+
"layout": "total, prev, pager, next, jumper"
|
|
135
137
|
},
|
|
136
138
|
on: {
|
|
137
|
-
"current-change": function(
|
|
138
|
-
|
|
139
|
+
"current-change": function(curPage) {
|
|
140
|
+
_vm.page.page = curPage;
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
})], 2)]);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
+
};
|
|
145
|
+
var staticRenderFns = [];
|
|
146
|
+
const PageableTable_vue_vue_type_style_index_0_lang = "";
|
|
147
|
+
const TABLE_STATUS = {
|
|
144
148
|
loading: 1,
|
|
145
149
|
error: -1,
|
|
146
150
|
empty: 2,
|
|
147
151
|
success: 0
|
|
148
|
-
}
|
|
152
|
+
};
|
|
153
|
+
const __vue2_script = {
|
|
149
154
|
name: "PageableTable",
|
|
150
155
|
bus: {
|
|
151
|
-
reloadTableView(
|
|
152
|
-
|
|
156
|
+
reloadTableView(viewId) {
|
|
157
|
+
if (viewId === this.viewId) {
|
|
158
|
+
this.getPage();
|
|
159
|
+
}
|
|
153
160
|
}
|
|
154
161
|
},
|
|
155
|
-
inheritAttrs:
|
|
162
|
+
inheritAttrs: false,
|
|
156
163
|
props: {
|
|
157
164
|
viewId: {
|
|
158
165
|
type: String
|
|
@@ -190,27 +197,27 @@ const r = {
|
|
|
190
197
|
autoHeight: Boolean,
|
|
191
198
|
immediate: {
|
|
192
199
|
type: Boolean,
|
|
193
|
-
default:
|
|
200
|
+
default: true
|
|
194
201
|
},
|
|
195
202
|
index: {
|
|
196
203
|
type: Boolean,
|
|
197
|
-
default:
|
|
204
|
+
default: true
|
|
198
205
|
},
|
|
199
206
|
multiple: {
|
|
200
207
|
type: Boolean,
|
|
201
|
-
default:
|
|
208
|
+
default: true
|
|
202
209
|
},
|
|
203
210
|
selection: {
|
|
204
211
|
type: Boolean,
|
|
205
|
-
default:
|
|
212
|
+
default: true
|
|
206
213
|
},
|
|
207
214
|
border: {
|
|
208
215
|
type: Boolean,
|
|
209
|
-
default:
|
|
216
|
+
default: true
|
|
210
217
|
},
|
|
211
218
|
reloadOnModelChange: {
|
|
212
219
|
type: Boolean,
|
|
213
|
-
default:
|
|
220
|
+
default: false
|
|
214
221
|
},
|
|
215
222
|
columns: {
|
|
216
223
|
type: Array
|
|
@@ -221,55 +228,73 @@ const r = {
|
|
|
221
228
|
}
|
|
222
229
|
},
|
|
223
230
|
data() {
|
|
224
|
-
let
|
|
225
|
-
this.rules && this.rules.length > 0
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
let filters = { rules: [] };
|
|
232
|
+
if (this.rules && this.rules.length > 0) {
|
|
233
|
+
filters.rules = this.rules;
|
|
234
|
+
}
|
|
235
|
+
if (this.filters) {
|
|
236
|
+
filters = this.filters;
|
|
237
|
+
}
|
|
238
|
+
if (this.filter) {
|
|
239
|
+
filters = Object.assign({}, filters, this.filter);
|
|
240
|
+
}
|
|
241
|
+
let model = {};
|
|
242
|
+
if (this.model) {
|
|
243
|
+
model = cloneDeep(this.model);
|
|
244
|
+
}
|
|
245
|
+
const limit = this.pageSize;
|
|
229
246
|
return {
|
|
230
|
-
TABLE_STATUS: Object.freeze(
|
|
231
|
-
tableStatus:
|
|
247
|
+
TABLE_STATUS: Object.freeze(TABLE_STATUS),
|
|
248
|
+
tableStatus: TABLE_STATUS.empty,
|
|
232
249
|
records: [],
|
|
233
250
|
currentRow: null,
|
|
234
251
|
page: {
|
|
235
252
|
total: 0,
|
|
236
253
|
page: 1,
|
|
237
|
-
limit
|
|
254
|
+
limit,
|
|
238
255
|
ascs: this.ascs,
|
|
239
256
|
descs: this.descs,
|
|
240
|
-
model
|
|
241
|
-
filters
|
|
257
|
+
model,
|
|
258
|
+
filters
|
|
242
259
|
}
|
|
243
260
|
};
|
|
244
261
|
},
|
|
245
262
|
computed: {
|
|
246
263
|
guard() {
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
264
|
+
if (this.reloadOnModelChange) {
|
|
265
|
+
return {
|
|
266
|
+
asc: this.page.ascs,
|
|
267
|
+
desc: this.page.descs,
|
|
268
|
+
page: this.page.page,
|
|
269
|
+
model: this.page.model,
|
|
270
|
+
filters: this.page.filters
|
|
271
|
+
};
|
|
272
|
+
} else {
|
|
273
|
+
return {
|
|
274
|
+
asc: this.page.ascs,
|
|
275
|
+
desc: this.page.descs,
|
|
276
|
+
page: this.page.page,
|
|
277
|
+
filters: this.page.filters
|
|
278
|
+
};
|
|
279
|
+
}
|
|
259
280
|
},
|
|
260
281
|
method() {
|
|
261
282
|
return this.httpGet ? httpGet : httpPost;
|
|
262
283
|
},
|
|
263
284
|
indexWidth() {
|
|
264
|
-
const
|
|
265
|
-
|
|
285
|
+
const indexStr = `${(this.page.page - 1) * this.page.limit + this.records.length}`;
|
|
286
|
+
if (indexStr.length > 3) {
|
|
287
|
+
return 50 + (indexStr.length - 3) * 10;
|
|
288
|
+
} else {
|
|
289
|
+
return 50;
|
|
290
|
+
}
|
|
266
291
|
},
|
|
267
292
|
mergeAttrs() {
|
|
268
|
-
return
|
|
293
|
+
return merge({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
|
|
269
294
|
},
|
|
270
295
|
headers() {
|
|
271
|
-
var
|
|
272
|
-
return ((
|
|
296
|
+
var _a;
|
|
297
|
+
return ((_a = this.columns) == null ? void 0 : _a.map(filterTableColumnProperties)) || [];
|
|
273
298
|
}
|
|
274
299
|
},
|
|
275
300
|
watch: {
|
|
@@ -279,15 +304,15 @@ const r = {
|
|
|
279
304
|
this.getPage();
|
|
280
305
|
},
|
|
281
306
|
model: {
|
|
282
|
-
deep:
|
|
283
|
-
handler(
|
|
284
|
-
this.setModel(
|
|
307
|
+
deep: true,
|
|
308
|
+
handler(newVal) {
|
|
309
|
+
this.setModel(newVal);
|
|
285
310
|
}
|
|
286
311
|
}
|
|
287
312
|
},
|
|
288
313
|
created() {
|
|
289
314
|
this.$watch(() => this.guard, this.getPage, {
|
|
290
|
-
deep:
|
|
315
|
+
deep: true,
|
|
291
316
|
immediate: this.immediate
|
|
292
317
|
});
|
|
293
318
|
},
|
|
@@ -298,61 +323,73 @@ const r = {
|
|
|
298
323
|
this.$refs.table.bodyWrapper.removeEventListener("scroll", this.onTableScroll);
|
|
299
324
|
},
|
|
300
325
|
methods: {
|
|
301
|
-
rowDbClick(...
|
|
302
|
-
var
|
|
303
|
-
const
|
|
304
|
-
var
|
|
305
|
-
return ((
|
|
326
|
+
rowDbClick(...args) {
|
|
327
|
+
var _a;
|
|
328
|
+
const body = this.$refs.table.$children.find((value) => {
|
|
329
|
+
var _a2;
|
|
330
|
+
return ((_a2 = value.$options) == null ? void 0 : _a2.name) === "ElTableBody";
|
|
306
331
|
});
|
|
307
|
-
|
|
332
|
+
if (body) {
|
|
333
|
+
(_a = body.$refs.tooltip) == null ? void 0 : _a.hide();
|
|
334
|
+
}
|
|
335
|
+
this.$emit("row-dblclick", ...args);
|
|
308
336
|
},
|
|
309
337
|
async updateTableScrollPosition() {
|
|
310
|
-
this.$refs.table.bodyWrapper
|
|
338
|
+
if (this.$refs.table.bodyWrapper) {
|
|
339
|
+
this.scrollTo(this.tableScrollTop, this.tableScrollLeft);
|
|
340
|
+
}
|
|
311
341
|
},
|
|
312
|
-
filterTableProperties
|
|
313
|
-
filterTableEvents
|
|
314
|
-
filterTableColumnProperties
|
|
342
|
+
filterTableProperties,
|
|
343
|
+
filterTableEvents,
|
|
344
|
+
filterTableColumnProperties,
|
|
315
345
|
onTableScroll() {
|
|
316
|
-
this.tableScrollTop = this.$refs.table.bodyWrapper.scrollTop
|
|
346
|
+
this.tableScrollTop = this.$refs.table.bodyWrapper.scrollTop;
|
|
347
|
+
this.tableScrollLeft = this.$refs.table.bodyWrapper.scrollLeft;
|
|
317
348
|
},
|
|
318
349
|
onSortChange({
|
|
319
|
-
prop
|
|
320
|
-
order
|
|
350
|
+
prop,
|
|
351
|
+
order
|
|
321
352
|
}) {
|
|
322
|
-
this.page.ascs =
|
|
353
|
+
this.page.ascs = order === "ascending" ? prop : "";
|
|
354
|
+
this.page.descs = order === "descending" ? prop : "";
|
|
323
355
|
},
|
|
324
|
-
onCurrentChange(
|
|
325
|
-
this.currentRow =
|
|
356
|
+
onCurrentChange(currentRow) {
|
|
357
|
+
this.currentRow = currentRow;
|
|
326
358
|
},
|
|
327
|
-
addRule(
|
|
328
|
-
this.removeRule(
|
|
359
|
+
addRule(rule) {
|
|
360
|
+
this.removeRule(rule.field);
|
|
361
|
+
this.page.filters.rules.push(rule);
|
|
329
362
|
},
|
|
330
|
-
addRules(
|
|
331
|
-
|
|
363
|
+
addRules(rules) {
|
|
364
|
+
rules.forEach((value) => this.addRule(value));
|
|
332
365
|
},
|
|
333
|
-
setModelField(
|
|
334
|
-
this.$set(this.page.model,
|
|
366
|
+
setModelField(field, value) {
|
|
367
|
+
this.$set(this.page.model, field, value);
|
|
335
368
|
},
|
|
336
|
-
setModel(
|
|
337
|
-
this.page.page = 1
|
|
369
|
+
setModel(model) {
|
|
370
|
+
this.page.page = 1;
|
|
371
|
+
this.page.model = cloneDeep(model);
|
|
338
372
|
},
|
|
339
|
-
deleteModelField(
|
|
340
|
-
delete this.page.model[
|
|
373
|
+
deleteModelField(field) {
|
|
374
|
+
delete this.page.model[field];
|
|
341
375
|
},
|
|
342
|
-
removeRule(
|
|
343
|
-
const
|
|
344
|
-
|
|
376
|
+
removeRule(field) {
|
|
377
|
+
const rules = this.page.filters.rules;
|
|
378
|
+
const index = rules.findIndex((value) => value.field === field);
|
|
379
|
+
if (index > -1) {
|
|
380
|
+
rules.splice(index, 1);
|
|
381
|
+
}
|
|
345
382
|
},
|
|
346
383
|
addFilter({
|
|
347
|
-
field
|
|
348
|
-
op
|
|
349
|
-
value
|
|
384
|
+
field,
|
|
385
|
+
op,
|
|
386
|
+
value
|
|
350
387
|
}) {
|
|
351
388
|
this.page.filters = Object.assign({}, this.page.filters, {
|
|
352
389
|
rules: [{
|
|
353
|
-
field
|
|
354
|
-
op
|
|
355
|
-
value
|
|
390
|
+
field,
|
|
391
|
+
op,
|
|
392
|
+
value
|
|
356
393
|
}],
|
|
357
394
|
op: "and"
|
|
358
395
|
});
|
|
@@ -364,23 +401,37 @@ const r = {
|
|
|
364
401
|
this.$refs.table.clearSelection();
|
|
365
402
|
},
|
|
366
403
|
search() {
|
|
367
|
-
this.setModel(this.model)
|
|
404
|
+
this.setModel(this.model);
|
|
405
|
+
this.getPage();
|
|
368
406
|
},
|
|
369
407
|
async getPage() {
|
|
370
|
-
var
|
|
371
|
-
if (
|
|
372
|
-
this.records = this.$attrs.data
|
|
408
|
+
var _a;
|
|
409
|
+
if (hasOwn(this.$attrs, "data")) {
|
|
410
|
+
this.records = this.$attrs.data;
|
|
411
|
+
this.page.page = 1;
|
|
412
|
+
this.page.total = this.records.length;
|
|
413
|
+
this.page.limit = this.page.total;
|
|
373
414
|
return;
|
|
374
415
|
}
|
|
375
416
|
this.records = [];
|
|
376
|
-
let
|
|
377
|
-
const { filters
|
|
378
|
-
|
|
379
|
-
|
|
417
|
+
let res;
|
|
418
|
+
const { filters, ...rest } = this.page;
|
|
419
|
+
const page = { ...rest };
|
|
420
|
+
if ((_a = filters == null ? void 0 : filters.rules) == null ? void 0 : _a.length) {
|
|
421
|
+
page.filters = { rules: filters.rules };
|
|
422
|
+
}
|
|
423
|
+
if (this.api || this.url) {
|
|
424
|
+
this.tableStatus = TABLE_STATUS.loading;
|
|
380
425
|
try {
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
426
|
+
if (this.api) {
|
|
427
|
+
res = await this.api(page);
|
|
428
|
+
}
|
|
429
|
+
if (this.url) {
|
|
430
|
+
res = await this.method(this.url, page);
|
|
431
|
+
}
|
|
432
|
+
} catch (e) {
|
|
433
|
+
this.tableStatus = TABLE_STATUS.error;
|
|
434
|
+
console.error(e);
|
|
384
435
|
return;
|
|
385
436
|
}
|
|
386
437
|
} else {
|
|
@@ -390,8 +441,17 @@ const r = {
|
|
|
390
441
|
});
|
|
391
442
|
return;
|
|
392
443
|
}
|
|
393
|
-
const { data
|
|
394
|
-
|
|
444
|
+
const { data } = res || {};
|
|
445
|
+
const { total, records } = data || {};
|
|
446
|
+
this.page.total = Number(total);
|
|
447
|
+
this.records = records;
|
|
448
|
+
if (!records || !records.length) {
|
|
449
|
+
this.tableStatus = TABLE_STATUS.empty;
|
|
450
|
+
} else {
|
|
451
|
+
this.tableStatus = TABLE_STATUS.success;
|
|
452
|
+
}
|
|
453
|
+
this.$refs.table.doLayout();
|
|
454
|
+
this.$emit("page-loaded", data);
|
|
395
455
|
},
|
|
396
456
|
async refresh() {
|
|
397
457
|
await this.getPage();
|
|
@@ -402,28 +462,35 @@ const r = {
|
|
|
402
462
|
total: this.page.total
|
|
403
463
|
};
|
|
404
464
|
},
|
|
405
|
-
scrollTo(
|
|
406
|
-
|
|
465
|
+
scrollTo(top, left) {
|
|
466
|
+
if (top) {
|
|
467
|
+
this.$refs.table.bodyWrapper.scrollTop = top;
|
|
468
|
+
}
|
|
469
|
+
if (left) {
|
|
470
|
+
this.$refs.table.bodyWrapper.scrollLeft = left;
|
|
471
|
+
}
|
|
407
472
|
}
|
|
408
473
|
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
474
|
+
};
|
|
475
|
+
const __cssModules = {};
|
|
476
|
+
var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
477
|
+
__vue2_script,
|
|
478
|
+
render,
|
|
479
|
+
staticRenderFns,
|
|
480
|
+
false,
|
|
481
|
+
__vue2_injectStyles,
|
|
416
482
|
null,
|
|
417
483
|
null,
|
|
418
484
|
null
|
|
419
485
|
);
|
|
420
|
-
function
|
|
421
|
-
for (let
|
|
422
|
-
this[
|
|
486
|
+
function __vue2_injectStyles(context) {
|
|
487
|
+
for (let o in __cssModules) {
|
|
488
|
+
this[o] = __cssModules[o];
|
|
489
|
+
}
|
|
423
490
|
}
|
|
424
|
-
const
|
|
425
|
-
return
|
|
491
|
+
const PageableTable = /* @__PURE__ */ function() {
|
|
492
|
+
return __component__.exports;
|
|
426
493
|
}();
|
|
427
494
|
export {
|
|
428
|
-
|
|
495
|
+
PageableTable as default
|
|
429
496
|
};
|