@web-utils/component 4.0.0 → 4.0.2

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 (172) hide show
  1. package/awesome-button/index.mjs +25 -55
  2. package/base.css +1 -1
  3. package/card/style.css +1 -1
  4. package/carousel/style.css +1 -1
  5. package/chat/style.css +1 -1
  6. package/chunks/{ElementForm.8w6UkiuU.mjs → ElementForm.CQ3PN5qj.mjs} +17 -35
  7. package/chunks/{ElementListeners.DOy8wyD2.mjs → ElementListeners.De_PRuIm.mjs} +56 -95
  8. package/chunks/{ElementMultiInstance.3Z28ewuh.mjs → ElementMultiInstance.DQo2wuAQ.mjs} +16 -26
  9. package/chunks/{ElementProperties.B2I48muA.mjs → ElementProperties.CosfDrlW.mjs} +16 -16
  10. package/chunks/{ElementTaskConfig.MBbkLrth.mjs → ElementTaskConfig.Bko0kgTp.mjs} +104 -113
  11. package/chunks/{FlowCondition.BfU9kw6h.mjs → FlowCondition.Y6qEYi1T.mjs} +36 -66
  12. package/chunks/{SignalAndMessage.CH6L7cYu.mjs → SignalAndMessage.Bb5PFX0N.mjs} +11 -22
  13. package/chunks/{UserTaskListeners.XXe5dC5I.mjs → UserTaskListeners.Bv3BDfEI.mjs} +45 -86
  14. package/chunks/configComponents.BDhlZU8F.mjs +23 -0
  15. package/chunks/confirmable-mixin.D9aKzKZ9.mjs +85 -0
  16. package/chunks/core.DJEgjQW6.mjs +54 -0
  17. package/chunks/dictionary.DqiP9x2m.mjs +25 -0
  18. package/chunks/dictionary.DsN-2ukC.mjs +70 -0
  19. package/chunks/form-input.B8z37eqj.mjs +31 -0
  20. package/chunks/form-item.D-H-wCPE.mjs +233 -0
  21. package/chunks/form-validate.CVarNHKX.mjs +12 -0
  22. package/chunks/helper.BiMLcEEk.mjs +41 -0
  23. package/chunks/index.9OxHjTIE.mjs +16 -0
  24. package/chunks/{index.MAFc4eFi.mjs → index.d3MV3Wq2.mjs} +43 -47
  25. package/chunks/sub-table-plus-props.BVsD71hT.mjs +30 -0
  26. package/chunks/{tab-mixin.CVr9bZtn.mjs → tab-mixin.BNK6dxLN.mjs} +1 -1
  27. package/chunks/utilSelf.Csq1766E.mjs +48 -0
  28. package/color-picker/index.mjs +19 -37
  29. package/comment/style.css +1 -1
  30. package/confirm-button/index.mjs +1 -1
  31. package/confirmable/index.mjs +1 -1
  32. package/context-menu/style.css +1 -1
  33. package/count-up/index.mjs +13 -24
  34. package/custom-scrollbar/index.mjs +1 -2
  35. package/data-operatext/style.css +1 -1
  36. package/data-panel/style.css +1 -1
  37. package/data-pay/style.css +1 -1
  38. package/data-price/style.css +1 -1
  39. package/data-rotate/style.css +1 -1
  40. package/data-table-picker/index.mjs +1 -1
  41. package/data-tabs/style.css +1 -1
  42. package/dialog-form/index.mjs +16 -28
  43. package/dynamic-table/style.css +1 -1
  44. package/easy-popup/index.mjs +22 -40
  45. package/easy-popup/style.css +1 -1
  46. package/editable-tree/index.mjs +203 -250
  47. package/editable-tree/style.css +1 -1
  48. package/element-dialog/index.mjs +30 -52
  49. package/element-dialog/style.css +1 -1
  50. package/flex-column/index.mjs +13 -25
  51. package/flex-item/index.mjs +15 -27
  52. package/flex-row/index.mjs +13 -25
  53. package/flow-designer/index.mjs +343 -374
  54. package/flow-designer/style.css +1 -1
  55. package/flow-viewer/index.mjs +64 -91
  56. package/form-block/index.mjs +33 -26
  57. package/form-card/index.mjs +25 -0
  58. package/form-cascader/index.mjs +70 -67
  59. package/form-checkbox/index.mjs +71 -0
  60. package/form-checkbox-group/index.mjs +33 -53
  61. package/form-date-picker/index.mjs +44 -73
  62. package/form-holder/index.mjs +54 -40
  63. package/form-holder/style.css +1 -0
  64. package/form-input/index.mjs +62 -40
  65. package/form-input-cron-expression/index.mjs +77 -0
  66. package/form-input-cron-expression/style.css +1 -0
  67. package/form-input-email/index.mjs +21 -33
  68. package/form-input-id-card/index.mjs +25 -38
  69. package/form-input-number/index.mjs +39 -42
  70. package/form-input-number/style.css +1 -1
  71. package/form-input-phone-number/index.mjs +26 -37
  72. package/form-input-tag/index.mjs +32 -34
  73. package/form-input-time/index.mjs +22 -37
  74. package/form-item/index.mjs +109 -101
  75. package/form-item/style.css +1 -1
  76. package/form-item-config-provider/index.mjs +18 -10
  77. package/form-item-group/index.mjs +73 -69
  78. package/form-item-group/style.css +1 -1
  79. package/form-radio-group/index.mjs +41 -36
  80. package/form-radio-group/style.css +1 -1
  81. package/form-select/index.mjs +142 -75
  82. package/form-select/style.css +1 -0
  83. package/form-switch/index.mjs +29 -34
  84. package/form-table/index.mjs +85 -0
  85. package/form-table-plus/index.mjs +109 -0
  86. package/form-textarea/index.mjs +23 -35
  87. package/form-tree-select/index.mjs +72 -0
  88. package/form-tree-select/style.css +1 -0
  89. package/form-tree-select-multiple/index.mjs +78 -0
  90. package/form-view/index.mjs +37 -69
  91. package/form-view/style.css +1 -1
  92. package/fy-curd/index.mjs +131 -140
  93. package/fy-curd/style.css +1 -1
  94. package/fy-draggable/index.mjs +16 -26
  95. package/fy-draggable/style.css +1 -1
  96. package/fy-dynamic/index.mjs +48 -57
  97. package/fy-empty/style.css +1 -1
  98. package/fy-form/style.css +1 -1
  99. package/fy-form-design/index.mjs +314 -339
  100. package/fy-form-design/style.css +1 -1
  101. package/fy-input-map/index.mjs +40 -50
  102. package/fy-input-map/style.css +1 -1
  103. package/fy-input-table/index.mjs +31 -41
  104. package/fy-u-editor/index.mjs +77 -103
  105. package/fy-upload/style.css +1 -1
  106. package/highlight-j-s/style.css +1 -1
  107. package/image-cropper/index.mjs +14 -65
  108. package/image-preview/index.mjs +17 -45
  109. package/image-preview/style.css +1 -1
  110. package/image-viewer/style.css +1 -1
  111. package/index.mjs +666 -496
  112. package/input-number/index.mjs +64 -9
  113. package/keyboard/style.css +1 -1
  114. package/monaco-editor/index.mjs +43 -71
  115. package/name-avatar/style.css +1 -1
  116. package/package.json +5 -4
  117. package/page-index/index.mjs +30 -54
  118. package/page-index-top/index.mjs +25 -47
  119. package/pageable-table/index.mjs +385 -218
  120. package/pageable-table/style.css +1 -1
  121. package/pageable-view/index.mjs +56 -95
  122. package/photo-swipe/index.mjs +51 -74
  123. package/picker-table-view/index.mjs +117 -0
  124. package/present-view/index.mjs +43 -77
  125. package/present-view/style.css +1 -1
  126. package/resize-observer/index.mjs +1 -1
  127. package/resize-observer/style.css +1 -1
  128. package/search/style.css +1 -1
  129. package/search-popover/index.mjs +28 -48
  130. package/search-popover/style.css +1 -1
  131. package/sign/index.mjs +1 -1
  132. package/sign-panel/style.css +1 -1
  133. package/skeleton-panel/index.mjs +38 -0
  134. package/skeleton-panel/style.css +1 -0
  135. package/split-pane/index.mjs +31 -49
  136. package/split-pane/style.css +1 -1
  137. package/sub-table/index.mjs +206 -0
  138. package/sub-table/style.css +1 -0
  139. package/sub-table-plus/index.mjs +231 -0
  140. package/sub-table-plus/style.css +1 -0
  141. package/swiper/index.mjs +18 -38
  142. package/swiper/style.css +1 -1
  143. package/tab/index.mjs +1 -1
  144. package/tab/style.css +1 -1
  145. package/tab-item/index.mjs +2 -2
  146. package/table-column/index.mjs +166 -37
  147. package/table-column/style.css +1 -0
  148. package/table-view/index.mjs +177 -132
  149. package/table-view/style.css +1 -1
  150. package/tabs-view/index.mjs +104 -0
  151. package/tabs-view/style.css +1 -0
  152. package/tag-render/index.mjs +13 -24
  153. package/toolbar/index.mjs +115 -58
  154. package/toolbar/style.css +1 -1
  155. package/toolbar-button/index.mjs +92 -48
  156. package/vue-cron/index.mjs +47 -65
  157. package/vue-qr-code/index.mjs +14 -32
  158. package/vue-quill-editor/index.mjs +13 -24
  159. package/vue-tags-input/index.mjs +10 -21
  160. package/vue-tree-select/index.mjs +352 -393
  161. package/vue-tree-select/style.css +1 -1
  162. package/vue-video-player/index.mjs +34 -63
  163. package/watermark/index.mjs +21 -31
  164. package/web-types.json +9240 -3840
  165. package/x-input-tag/index.mjs +29 -61
  166. package/chunks/confirmable-mixin.D4LAArE5.mjs +0 -114
  167. package/chunks/form-input-mixin.BkKiqJhi.mjs +0 -24
  168. package/chunks/form-item-mixin.CG4ZwzMC.mjs +0 -140
  169. package/chunks/input-number-mixin.CzjtGf2n.mjs +0 -60
  170. package/chunks/utilSelf.CRqpl0Cz.mjs +0 -56
  171. package/toolbar-button/style.css +0 -1
  172. /package/chunks/{form-pick-mixin.BFTIVn_i.mjs → form-pick.BFTIVn_i.mjs} +0 -0
@@ -1,51 +1,163 @@
1
- var _ = Object.defineProperty, $ = Object.defineProperties;
2
- var w = Object.getOwnPropertyDescriptors;
3
- var p = Object.getOwnPropertySymbols;
4
- var b = Object.prototype.hasOwnProperty, m = Object.prototype.propertyIsEnumerable;
5
- var f = (t, e, a) => e in t ? _(t, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : t[e] = a, o = (t, e) => {
6
- for (var a in e || (e = {}))
7
- b.call(e, a) && f(t, a, e[a]);
8
- if (p)
9
- for (var a of p(e))
10
- m.call(e, a) && f(t, a, e[a]);
11
- return t;
12
- }, c = (t, e) => $(t, w(e));
13
- var y = (t, e) => {
14
- var a = {};
15
- for (var s in t)
16
- b.call(t, s) && e.indexOf(s) < 0 && (a[s] = t[s]);
17
- if (t != null && p)
18
- for (var s of p(t))
19
- e.indexOf(s) < 0 && m.call(t, s) && (a[s] = t[s]);
20
- return a;
21
- };
22
- var g = (t, e, a) => new Promise((s, l) => {
23
- var u = (r) => {
24
- try {
25
- i(a.next(r));
26
- } catch (h) {
27
- l(h);
1
+ import { copy as R, hasOwn as v } from "@web-utils/core";
2
+ import S from "element-ui/lib/message";
3
+ import { merge as f } from "@web-utils/integrations/lodash";
4
+ import { f as _, g as P, h as B } from "../chunks/index.d3MV3Wq2.mjs";
5
+ import { g as A } from "../chunks/dictionary.DsN-2ukC.mjs";
6
+ import { _ as C } from "../chunks/helper.BiMLcEEk.mjs";
7
+ import "vue";
8
+ import { n as b } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
9
+ import { isEqual as K } from "lodash-es";
10
+ function L(t) {
11
+ R(
12
+ t,
13
+ () => S.success({ duration: 1e3, message: "复制成功!", type: "success" }),
14
+ () => S.error({ duration: 1e3, message: "复制失败!", type: "error" })
15
+ );
16
+ }
17
+ const F = {
18
+ name: "TableColumnFilterable",
19
+ functional: !0,
20
+ /**
21
+ *
22
+ * @param h
23
+ * @param context {FunctionalContext}
24
+ * @returns {JSX.Element}
25
+ */
26
+ render(t, e) {
27
+ const {
28
+ data: {
29
+ key: s
30
+ },
31
+ props: l,
32
+ parent: {
33
+ records: i
34
+ },
35
+ scopedSlots: a
36
+ } = e, {
37
+ hide: o,
38
+ isVNode: n,
39
+ filterable: r,
40
+ allowSort: g,
41
+ autoUpdate: d,
42
+ scopedSlots: T,
43
+ prop: m,
44
+ ...x
45
+ } = l, y = `${s}-${r}${d ? `-${Math.random()}`.replace("0.", "") : ""}`, u = {
46
+ props: {
47
+ prop: m,
48
+ ...x
49
+ }
50
+ };
51
+ if (r) {
52
+ const $ = [...new Set(i.map((c) => c[m]).filter((c) => c))].map((c) => ({
53
+ text: c,
54
+ value: c
55
+ }));
56
+ u.props.filterMethod = (c, w, k) => {
57
+ const E = k.property;
58
+ return w[E] === c;
59
+ }, u.props.filters = $;
28
60
  }
29
- }, d = (r) => {
30
- try {
31
- i(a.throw(r));
32
- } catch (h) {
33
- l(h);
61
+ const h = T || a;
62
+ return h != null && h.default ? t("ElTableColumn", C([{}, u, {
63
+ scopedSlots: h,
64
+ key: y
65
+ }])) : t("TableColumn", C([{}, u, {
66
+ key: y
67
+ }]));
68
+ }
69
+ }, z = null, O = null;
70
+ var W = /* @__PURE__ */ b(
71
+ F,
72
+ z,
73
+ O,
74
+ !1,
75
+ null,
76
+ null
77
+ );
78
+ const V = W.exports, D = {
79
+ name: "TableColumnFilter",
80
+ props: {
81
+ columns: {
82
+ type: Array,
83
+ default: () => []
84
+ },
85
+ visible: Boolean
86
+ }
87
+ };
88
+ var M = function() {
89
+ var e = this, s = e._self._c;
90
+ return s("ElDrawer", { staticClass: "table-column-filter", attrs: { visible: e.visible, title: "表格设置", "append-to-body": "" }, on: { "update:visible": (l) => e.$emit("update:visible", l) } }, [s("ElTable", { attrs: { data: e.columns, border: "" } }, [s("ElTableColumn", { attrs: { label: "列名" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
91
+ return [e._v(" " + e._s(l.label) + " ")];
92
+ } }]) }), s("ElTableColumn", { attrs: { label: "隐藏", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
93
+ return [s("ElCheckbox", { model: { value: l.hide, callback: function(i) {
94
+ e.$set(l, "hide", i);
95
+ }, expression: "row.hide" } })];
96
+ } }]) }), s("ElTableColumn", { attrs: { label: "冻结", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
97
+ return [s("ElCheckbox", { model: { value: l.fixed, callback: function(i) {
98
+ e.$set(l, "fixed", i);
99
+ }, expression: "row.fixed" } })];
100
+ } }]) }), s("ElTableColumn", { attrs: { label: "过滤", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
101
+ return [s("ElCheckbox", { model: { value: l.filterable, callback: function(i) {
102
+ e.$set(l, "filterable", i);
103
+ }, expression: "row.filterable" } })];
104
+ } }]) }), s("ElTableColumn", { attrs: { label: "排序", align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
105
+ return [s("ElCheckbox", { attrs: { title: l.allowSort ? null : "该列不支持排序!", disabled: !l.allowSort }, model: { value: l.sortable, callback: function(i) {
106
+ e.$set(l, "sortable", i);
107
+ }, expression: "row.sortable" } })];
108
+ } }]) })], 1)], 1);
109
+ }, U = [], N = /* @__PURE__ */ b(
110
+ D,
111
+ M,
112
+ U,
113
+ !1,
114
+ null,
115
+ null
116
+ );
117
+ const H = N.exports, j = {
118
+ props: {
119
+ useVisibilityChange: Boolean
120
+ },
121
+ created() {
122
+ this.useVisibilityChange && document.addEventListener("visibilitychange", this.onPageVisibleChange);
123
+ },
124
+ beforeDestroy() {
125
+ this.useVisibilityChange && document.removeEventListener("visibilitychange", this.onPageVisibleChange);
126
+ },
127
+ methods: {
128
+ onPageVisibleChange() {
129
+ var t, e;
130
+ document.hidden ? (t = this.onPageHidden) == null || t.call(this) : (e = this.onPageVisible) == null || e.call(this);
34
131
  }
35
- }, i = (r) => r.done ? s(r.value) : Promise.resolve(r.value).then(u, d);
36
- i((a = a.apply(t, e)).next());
37
- });
38
- import { hasOwn as v } from "@web-utils/core";
39
- import { cloneDeep as S, merge as C } from "@web-utils/integrations/lodash";
40
- import { f as T, h as k, i as B } from "../chunks/index.MAFc4eFi.mjs";
41
- import { n as P } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
42
- const n = {
132
+ }
133
+ };
134
+ function Q(t, e) {
135
+ const s = t.map((i) => {
136
+ const { hide: a, filterable: o, allowSort: n, sortable: r, fixed: g, ...d } = i;
137
+ return d;
138
+ }), l = e.map((i) => {
139
+ const { hide: a, filterable: o, allowSort: n, sortable: r, fixed: g, ...d } = i;
140
+ return d;
141
+ });
142
+ return K(s, l);
143
+ }
144
+ function q(t) {
145
+ let e = "";
146
+ for (const s in t)
147
+ e += `<TableColumn prop="${s}" label="${s}"/>
148
+ `;
149
+ return e;
150
+ }
151
+ const p = {
43
152
  loading: 1,
44
153
  error: -1,
45
154
  empty: 2,
46
155
  success: 0
47
- }, E = {
156
+ }, I = {
48
157
  name: "PageableTable",
158
+ components: { TableColumnFilter: H, TableColumnFilterable: V },
159
+ mixins: [j],
160
+ emits: ["page-loaded", "row-dblclick"],
49
161
  bus: {
50
162
  reloadTableView(t) {
51
163
  t === this.viewId && this.getPage();
@@ -53,37 +165,22 @@ const n = {
53
165
  },
54
166
  inheritAttrs: !1,
55
167
  props: {
56
- viewId: {
57
- type: String
58
- },
59
- url: {
60
- type: String
168
+ selectionWidth: {
169
+ type: String,
170
+ default: "45"
61
171
  },
62
- httpGet: Boolean,
172
+ viewId: String,
173
+ url: String,
63
174
  hideOnSinglePage: Boolean,
64
- api: {
65
- type: Function
66
- },
67
- filters: {
68
- type: Object
69
- },
70
- filter: {
71
- type: Object
72
- },
73
- rules: {
175
+ api: Function,
176
+ model: Object,
177
+ ascs: {
74
178
  type: Array,
75
179
  default: () => []
76
180
  },
77
- model: {
78
- type: Object
79
- },
80
- ascs: {
81
- type: String,
82
- default: ""
83
- },
84
181
  descs: {
85
- type: String,
86
- default: ""
182
+ type: Array,
183
+ default: () => []
87
184
  },
88
185
  headerBold: Boolean,
89
186
  autoHeight: Boolean,
@@ -111,34 +208,41 @@ const n = {
111
208
  type: Boolean,
112
209
  default: !1
113
210
  },
114
- columns: {
115
- type: Array
116
- },
211
+ columns: Array,
117
212
  pageSize: {
118
213
  type: Number,
119
214
  default: 25
120
- }
215
+ },
216
+ dicOptions: {
217
+ type: Array,
218
+ default: () => []
219
+ },
220
+ paging: {
221
+ type: Boolean,
222
+ default: !0
223
+ },
224
+ clickRowSelect: Boolean,
225
+ payloadStyle: String,
226
+ rowKey: {
227
+ type: String,
228
+ default: "id"
229
+ },
230
+ disabledRowKeys: Array,
231
+ selectExport: Boolean
121
232
  },
122
233
  data() {
123
- let t = { rules: [] };
124
- this.rules && this.rules.length > 0 && (t.rules = this.rules), this.filters && (t = this.filters), this.filter && (t = o(o({}, t), this.filter));
125
- let e = {};
126
- this.model && (e = S(this.model));
127
- const a = this.pageSize;
234
+ const t = this.pageSize;
128
235
  return {
129
- TABLE_STATUS: Object.freeze(n),
130
- tableStatus: n.empty,
236
+ TABLE_STATUS: Object.freeze(p),
237
+ tableStatus: p.empty,
131
238
  records: [],
132
239
  currentRow: null,
133
- page: {
134
- total: 0,
135
- page: 1,
136
- limit: a,
137
- ascs: this.ascs,
138
- descs: this.descs,
139
- model: e,
140
- filters: t
141
- }
240
+ showSettings: !1,
241
+ selectedRows: [],
242
+ page: { total: 0, page: 1, limit: t, ascs: this.ascs, descs: this.descs },
243
+ tableColumns: [],
244
+ expandColumn: null,
245
+ renderKey: 1
142
246
  };
143
247
  },
144
248
  computed: {
@@ -147,199 +251,262 @@ const n = {
147
251
  asc: this.page.ascs,
148
252
  desc: this.page.descs,
149
253
  page: this.page.page,
150
- model: this.page.model,
151
- filters: this.page.filters
152
- } : {
153
- asc: this.page.ascs,
154
- desc: this.page.descs,
155
- page: this.page.page,
156
- filters: this.page.filters
157
- };
158
- },
159
- method() {
160
- return this.httpGet ? this.httpGet : this.httpPost;
254
+ limit: this.page.limit,
255
+ model: this.model
256
+ } : { asc: this.page.ascs, desc: this.page.descs, page: this.page.page, limit: this.page.limit };
161
257
  },
162
258
  indexWidth() {
163
- const t = `${(this.page.page - 1) * this.page.limit + this.records.length}`;
164
- return t.length > 3 ? 50 + (t.length - 3) * 10 : 50;
259
+ var e;
260
+ const t = `${(this.page.page - 1) * this.page.limit + (((e = this.records) == null ? void 0 : e.length) ?? 0)}`;
261
+ return t.length > 3 ? 60 + (t.length - 3) * 10 : 60;
165
262
  },
166
263
  mergeAttrs() {
167
- return C({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
264
+ return f({}, this.$attrs, { height: this.autoHeight ? null : "auto" });
168
265
  },
169
266
  headers() {
170
267
  var t;
171
- return ((t = this.columns) == null ? void 0 : t.map(T)) || [];
268
+ return ((t = this.columns) == null ? void 0 : t.map(_)) || [];
172
269
  }
173
270
  },
174
271
  watch: {
175
272
  url: { handler: "reload" },
176
273
  api: { handler: "reload" },
177
- "$attrs.data"() {
178
- this.getPage();
179
- },
180
- model: {
181
- deep: !0,
182
- handler(t) {
183
- this.setModel(t);
184
- }
185
- }
274
+ "$attrs.data": "getPage"
186
275
  },
187
276
  created() {
188
- this.$watch(() => this.guard, this.getPage, {
189
- deep: !0,
190
- immediate: this.immediate
191
- });
277
+ this.$watch(() => this.guard, this.getPage, { deep: !0, immediate: this.immediate }), this.$watch(
278
+ () => ({ columns: this.columns, renderKey: this.renderKey }),
279
+ (t) => {
280
+ const e = [];
281
+ let s = null;
282
+ if (t) {
283
+ const l = this.$slots.default, { columns: i } = t;
284
+ l ? l.forEach((a) => {
285
+ if (!a.isComment && a.data) {
286
+ const { attrs: o, props: n, scopedSlots: r } = a.data;
287
+ a.data.props = a.data.props || {}, a.data.props.type === "expand" ? s = {
288
+ ...o,
289
+ ...n,
290
+ scopedSlots: r,
291
+ hide: !1,
292
+ filterable: !1,
293
+ allowSort: a.data.props.sortable !== !1,
294
+ sortable: !1,
295
+ fixed: a.data.props.fixed
296
+ } : e.push({
297
+ ...o,
298
+ ...n,
299
+ scopedSlots: r,
300
+ hide: !1,
301
+ isVNode: !0,
302
+ filterable: !1,
303
+ allowSort: a.data.props.sortable !== !1,
304
+ sortable: !1,
305
+ fixed: a.data.props.fixed
306
+ });
307
+ }
308
+ }) : i && i.forEach((a) => {
309
+ a.type === "expand" ? s = {
310
+ ...a,
311
+ props: a,
312
+ hide: !1,
313
+ filterable: !1,
314
+ allowSort: a.sortable !== !1,
315
+ sortable: !1,
316
+ fixed: a.fixed
317
+ } : e.push({
318
+ ...a,
319
+ props: a,
320
+ hide: !1,
321
+ filterable: !1,
322
+ allowSort: a.sortable !== !1,
323
+ sortable: !1,
324
+ fixed: a.fixed
325
+ });
326
+ }), this.updateExpandColumn(s), this.updateColumns(e);
327
+ }
328
+ },
329
+ { immediate: !0 }
330
+ );
192
331
  },
193
332
  mounted() {
194
333
  this.$refs.table.bodyWrapper.addEventListener("scroll", this.onTableScroll);
195
334
  },
335
+ beforeUpdate() {
336
+ this.renderKey++;
337
+ },
196
338
  beforeDestroy() {
197
339
  this.$refs.table.bodyWrapper.removeEventListener("scroll", this.onTableScroll);
198
340
  },
199
341
  methods: {
200
342
  rowDbClick(...t) {
201
- var a;
202
- const e = this.$refs.table.$children.find((s) => {
343
+ this.hideTooltip(), this.$emit("row-dblclick", ...t);
344
+ },
345
+ rowClick(t, e, s) {
346
+ if (this.clickRowSelect && this.selectable(t)) {
347
+ const l = this.$refs.table;
348
+ if (this.selectedRows.find((a) => a[this.rowKey] === t[this.rowKey])) {
349
+ l.toggleRowSelection(t, !1);
350
+ return;
351
+ }
352
+ l.toggleRowSelection(t);
353
+ }
354
+ },
355
+ hideTooltip() {
356
+ var e;
357
+ const t = this.$refs.table.$children.find((s) => {
203
358
  var l;
204
359
  return ((l = s.$options) == null ? void 0 : l.name) === "ElTableBody";
205
360
  });
206
- e && ((a = e.$refs.tooltip) == null || a.hide()), this.$emit("row-dblclick", ...t);
361
+ (e = t == null ? void 0 : t.$refs.tooltip) == null || e.hide();
207
362
  },
208
363
  updateTableScrollPosition() {
209
364
  this.$refs.table.bodyWrapper && this.scrollTo(this.tableScrollTop, this.tableScrollLeft);
210
365
  },
211
366
  filterTableProperties: B,
212
- filterTableEvents: k,
213
- filterTableColumnProperties: T,
367
+ filterTableEvents: P,
368
+ filterTableColumnProperties: _,
214
369
  onTableScroll() {
215
370
  this.tableScrollTop = this.$refs.table.bodyWrapper.scrollTop, this.tableScrollLeft = this.$refs.table.bodyWrapper.scrollLeft;
216
371
  },
372
+ copy: (t) => L(q(t)),
217
373
  onSortChange({ prop: t, order: e }) {
218
- this.page.ascs = e === "ascending" ? t : "", this.page.descs = e === "descending" ? t : "";
374
+ this.payloadStyle !== "body" ? (this.page.ascs = e === "ascending" ? t : "", this.page.descs = e === "descending" ? t : "") : (this.page.ascs = e === "ascending" ? [t] : this.ascs, this.page.descs = e === "descending" ? [t] : this.descs);
219
375
  },
220
376
  onCurrentChange(t) {
221
- this.currentRow = t;
222
- },
223
- /**
224
- *
225
- * @param {FilterRule} rule
226
- */
227
- addRule(t) {
228
- this.removeRule(t.field), this.page.filters.rules.push(t);
229
- },
230
- addRules(t) {
231
- t.forEach((e) => this.addRule(e));
232
- },
233
- setModelField(t, e) {
234
- this.$set(this.page.model, t, e);
235
- },
236
- setModel(t) {
237
- this.page.page = 1, this.page.model = S(t);
238
- },
239
- deleteModelField(t) {
240
- delete this.page.model[t];
241
- },
242
- removeRule(t) {
243
- const e = this.page.filters.rules, a = e.findIndex((s) => s.field === t);
244
- a > -1 && e.splice(a, 1);
245
- },
246
- addFilter({ field: t, op: e, value: a }) {
247
- this.page.filters = c(o({}, this.page.filters), {
248
- rules: [
249
- {
250
- field: t,
251
- op: e,
252
- value: a
253
- }
254
- ],
255
- op: "and"
256
- });
377
+ this.selectable(t) && (this.currentRow = t);
257
378
  },
258
- clearFilters() {
259
- this.page.filters = {};
379
+ handleSelectionChange(t) {
380
+ this.selectedRows = t;
260
381
  },
261
382
  clearSelection() {
262
383
  this.$refs.table.clearSelection();
263
384
  },
264
- search() {
265
- this.setModel(this.model), this.getPage();
385
+ getPageQuery() {
386
+ let t;
387
+ return this.payloadStyle !== "body" ? t = { ...this.page, current: this.page.page, size: this.page.limit, ...this.model || {} } : t = { page: { ...this.page, current: this.page.page, size: this.page.limit }, example: this.model || {} }, this.selectExport && (this.rowKey ? t.exportKeys = this.selectedRows.map((e) => e[this.rowKey]) : t.exportKeys = this.selectedRows.map((e) => this.records.indexOf(e))), t;
266
388
  },
267
- getPage() {
268
- return g(this, null, function* () {
269
- var r;
270
- if (v(this.$attrs, "data")) {
271
- this.records = this.$attrs.data, this.page.page = 1, this.page.total = this.records.length, this.page.limit = this.page.total;
272
- return;
273
- }
274
- this.records = [];
275
- let t;
276
- const i = this.page, { filters: e } = i, a = y(i, ["filters"]), s = o({}, a);
277
- if ((r = e == null ? void 0 : e.rules) != null && r.length && (s.filters = { rules: e.rules }), this.api || this.url) {
278
- this.tableStatus = n.loading;
279
- try {
280
- this.api && (t = yield this.api(s)), this.url && (t = yield this.method(this.url, s));
281
- } catch (h) {
282
- this.tableStatus = n.error, console.error(h);
283
- return;
284
- }
285
- } else {
286
- this.$notify.warning({
287
- title: "开发提示!",
288
- message: "PageableTable 请提供 url(String) 或 api(Function) 属性"
289
- });
389
+ async getPage(t) {
390
+ var o;
391
+ if (v(this.$attrs, "data") && this.$attrs.data !== !1) {
392
+ this.records = this.$attrs.data, this.page.page = 1, this.page.total = (o = this.records) == null ? void 0 : o.length, this.page.limit = this.page.total;
393
+ return;
394
+ }
395
+ t !== !1 && (this.records = []);
396
+ let e;
397
+ const s = this.getPageQuery();
398
+ if (this.api || this.url) {
399
+ t !== !1 && (this.tableStatus = p.loading);
400
+ try {
401
+ this.api && (e = await this.api(s));
402
+ } catch {
403
+ this.tableStatus = p.error;
290
404
  return;
291
405
  }
292
- const { data: l } = t || {}, { total: u, records: d } = l || {};
293
- this.page.total = Number(u), this.records = d, !d || !d.length ? this.tableStatus = n.empty : this.tableStatus = n.success, this.$refs.table.doLayout(), this.$emit("page-loaded", l);
294
- });
406
+ } else {
407
+ this.$notify.warning({
408
+ title: "开发提示!",
409
+ message: "PageableTable 请提供 url(String) 或 api(Function) 属性"
410
+ });
411
+ return;
412
+ }
413
+ const {
414
+ data: { data: l }
415
+ } = e || {}, { total: i, records: a } = l || {};
416
+ this.page.total = Number(i), this.records = await this.mapRow(a), !a || !a.length ? this.tableStatus = p.empty : this.tableStatus = p.success, this.doLayout(), this.$emit("page-loaded", l);
295
417
  },
296
- refresh() {
297
- return g(this, null, function* () {
298
- yield this.getPage();
299
- });
418
+ doLayout() {
419
+ var t;
420
+ (t = this.$refs.table) == null || t.doLayout();
421
+ },
422
+ async refresh(t) {
423
+ await this.getPage(t);
300
424
  },
301
425
  reload() {
302
- this.page = c(o({}, this.$options.data.call(this).page), {
303
- total: this.page.total
304
- });
426
+ this.page = { ...this.$options.data.call(this).page, limit: this.page.limit };
305
427
  },
306
428
  scrollTo(t, e) {
307
429
  t && (this.$refs.table.bodyWrapper.scrollTop = t), e && (this.$refs.table.bodyWrapper.scrollLeft = e);
430
+ },
431
+ toggleRowSelection(t, e) {
432
+ this.$refs.table.toggleRowSelection(t, e);
433
+ },
434
+ mapRow(t) {
435
+ return t.map((e) => (this.dicOptions.forEach(async (s) => {
436
+ var l;
437
+ e[`$${s.prop}`] = e[s.prop], s.dicData ? e[s.prop] = ((l = s.dicData.find((i) => i.value === e[s.prop])) == null ? void 0 : l.label) || e[s.prop] : e[s.prop] = await A(s.dicType, e[s.prop]);
438
+ }), e));
439
+ },
440
+ toggleSettings() {
441
+ this.showSettings = !this.showSettings;
442
+ },
443
+ selectable(t) {
444
+ var e;
445
+ return !(t != null && t.disabled) && !((e = this.disabledRowKeys) != null && e.includes(t == null ? void 0 : t[this.rowKey]));
446
+ },
447
+ updateExpandColumn(t) {
448
+ t && this.expandColumn ? f(this.expandColumn, t) : this.expandColumn = t;
449
+ },
450
+ updateColumns(t) {
451
+ if (!Q(this.tableColumns, t)) {
452
+ const e = {};
453
+ this.tableColumns.forEach((s) => {
454
+ e[s.prop] = s;
455
+ }), t.map((s) => {
456
+ const l = e[s.prop];
457
+ if (l) {
458
+ const { hide: i, filterable: a, allowSort: o, sortable: n, fixed: r } = l;
459
+ return f(l, s), l.hide = i, l.filterable = a, l.allowSort = o, l.sortable = n, l.fixed = r, l;
460
+ }
461
+ return s;
462
+ }), this.tableColumns = t;
463
+ }
464
+ },
465
+ onPageVisible() {
466
+ this.refresh(!1);
308
467
  }
309
468
  }
310
469
  };
311
- var x = function() {
312
- var e = this, a = e._self._c;
313
- return a("div", { class: ["pageable-table", { "auto-height": e.autoHeight }] }, [a("div", { staticClass: "pageable-table-wrapper" }, [e._t("toolbar"), a("ElTable", e._g(e._b({ ref: "table", class: ["flex-item", { "header-bold": e.headerBold }], attrs: { data: e.records, border: e.border }, on: { "hook:updated": e.updateTableScrollPosition, "sort-change": e.onSortChange, "row-dblclick": e.rowDbClick, "current-change": e.onCurrentChange }, scopedSlots: e._u([{ key: "empty", fn: function() {
470
+ var J = function() {
471
+ var e = this, s = e._self._c;
472
+ return s("div", { class: ["pageable-table", { "auto-height": e.autoHeight }] }, [s("div", { staticClass: "pageable-table-wrapper" }, [e._t("toolbar", null, { selectedRows: e.selectedRows }), s("ElTable", e._g(e._b({ ref: "table", class: ["flex-item", { "header-bold": e.headerBold }], attrs: { data: e.records, border: e.border, stripe: "", size: "medium" }, on: { "hook:updated": e.updateTableScrollPosition, "sort-change": e.onSortChange, "row-dblclick": e.rowDbClick, "row-click": e.rowClick, "cell-click": e.hideTooltip, "current-change": e.onCurrentChange, "selection-change": e.handleSelectionChange }, scopedSlots: e._u([{ key: "empty", fn: function() {
314
473
  return [e._t("empty", function() {
315
- return [e.tableStatus === e.TABLE_STATUS.loading ? [a("span", { staticClass: "pageable-table-loading" }, [a("i", { staticClass: "table-status-icon el-icon-loading" }), e._v(" 加载中...")])] : e.tableStatus === e.TABLE_STATUS.error ? [a("ElButton", { staticClass: "pageable-table-error", attrs: { icon: "table-status-icon fa fa-frown-o" }, on: { click: e.refresh } }, [e._v(" 加载失败,点击重试! ")])] : [e._v(" 暂无数据 ")]];
474
+ return [e.tableStatus === e.TABLE_STATUS.loading ? [s("span", { staticClass: "pageable-table-loading" }, [s("i", { staticClass: "table-status-icon el-icon-loading" }), e._v(" 加载中... ")])] : e.tableStatus === e.TABLE_STATUS.error ? [s("ElButton", { staticClass: "pageable-table-error", attrs: { icon: "table-status-icon el-icon-error" }, on: { click: e.refresh } }, [e._v("加载失败,点击重试!")])] : s("ElEmpty")];
316
475
  })];
317
476
  }, proxy: !0 }, { key: "append", fn: function() {
318
477
  return [e._t("append")];
319
- }, proxy: !0 }], null, !0) }, "ElTable", e.filterTableProperties(e.mergeAttrs), !1), e.filterTableEvents(e.$listeners)), [e.multiple && e.selection ? a("TableColumn", { key: "multiple", attrs: { type: "selection", width: "45", align: "center" } }) : e._e(), !e.multiple && e.selection ? a("TableColumn", { key: "single", attrs: { type: "single-selection", "class-name": "single-select-column", width: "45", align: "center" }, scopedSlots: e._u([{ key: "header", fn: function() {
320
- return [a("ElRadio", { attrs: { value: !!e.currentRow, label: !0 } }, [a("span")])];
321
- }, proxy: !0 }, { key: "default", fn: function({ row: s }) {
322
- return [a("ElRadio", { attrs: { label: !0, value: e.currentRow && e.currentRow[e.$attrs["row-key"] || "id"] === s[e.$attrs["row-key"] || "id"] } }, [a("span")])];
323
- } }], null, !1, 307797321) }) : e._e(), e.index ? a("TableColumn", { key: "order", attrs: { type: "index", label: "序号", width: e.indexWidth, align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ $index: s }) {
324
- return [e._v(" " + e._s((e.page.page - 1) * e.page.limit + s + 1 || s + 1) + " ")];
325
- } }], null, !1, 4238275121) }) : e._e(), e._t("default", function() {
326
- return [e.columns && e.columns.length ? e._l(e.headers, function(s, l) {
327
- return a("TableColumn", e._b({ key: `${s.prop}-${l}` }, "TableColumn", s, !1));
328
- }) : a("TableColumn", { attrs: { label: "点击表格行复制模板" }, scopedSlots: e._u([{ key: "default", fn: function({ row: s }) {
329
- return [a("pre", { staticClass: "pointer" }, [e._v(e._s(JSON.stringify(s, null, " ")))])];
330
- } }]) })];
331
- })], 2), a("ElPagination", { staticClass: "flex-not-shrink", attrs: { "current-page": e.page.page, "hide-on-single-page": e.hideOnSinglePage, "page-size": e.page.limit, total: e.page.total, background: "", layout: "total, prev, pager, next, jumper" }, on: { "current-change": (s) => {
332
- e.page.page = s;
333
- } } })], 2)]);
334
- }, A = [], R = /* @__PURE__ */ P(
335
- E,
336
- x,
337
- A,
478
+ }, proxy: !0 }], null, !0) }, "ElTable", e.filterTableProperties(e.mergeAttrs), !1), e.filterTableEvents(e.$listeners)), [e.expandColumn ? s("TableColumnFilterable", e._b({}, "TableColumnFilterable", e.expandColumn, !1)) : e._e(), e.multiple && e.selection ? s("TableColumn", { key: "multiple", attrs: { type: "selection", selectable: e.selectable, width: e.selectionWidth, align: "center" } }) : e._e(), !e.multiple && e.selection ? s("TableColumn", { key: "single", attrs: { sortable: !1, type: "single-selection", "class-name": "single-select-column", width: e.selectionWidth, align: "center" }, scopedSlots: e._u([{ key: "header", fn: function() {
479
+ return [s("ElRadio", { attrs: { value: !!e.currentRow, label: !0 } }, [s("span")])];
480
+ }, proxy: !0 }, { key: "default", fn: function({ row: l }) {
481
+ return [s("ElRadio", { attrs: { label: !0, disabled: !e.selectable(l), value: e.currentRow && e.currentRow[e.$attrs["row-key"] || e.rowKey || "id"] === l[e.$attrs["row-key"] || e.rowKey || "id"] } }, [s("span")])];
482
+ } }], null, !1, 1270221895) }) : e._e(), e.index ? s("TableColumn", { key: "order", attrs: { type: "index", label: "序号", width: e.indexWidth, align: "center" }, scopedSlots: e._u([{ key: "default", fn: function({ $index: l }) {
483
+ return [e._v(" " + e._s((e.page.page - 1) * e.page.limit + l + 1 || l + 1) + " ")];
484
+ } }], null, !1, 4238275121) }) : e._e(), e.tableColumns ? e._l(e.tableColumns.filter((l) => !l.hide), function(l, i) {
485
+ var a, o;
486
+ return s("TableColumnFilterable", e._b({ key: `${((a = l.props) == null ? void 0 : a.prop) || l.prop}-${i}`, scopedSlots: e._u([e.$scopedSlots[((o = l.props) == null ? void 0 : o.prop) || l.prop] ? { key: "default", fn: function({ row: n }) {
487
+ var r;
488
+ return [e._t(((r = l.props) == null ? void 0 : r.prop) || l.prop, null, { row: n })];
489
+ } } : null], null, !0) }, "TableColumnFilterable", l, !1));
490
+ }) : [s("TableColumn", { attrs: { label: "点击表格行复制模板" }, scopedSlots: e._u([{ key: "default", fn: function({ row: l }) {
491
+ return [s("pre", { staticClass: "pointer", on: { click: function(i) {
492
+ return e.copy(l);
493
+ } } }, [e._v(e._s(JSON.stringify(l, null, " ")))])];
494
+ } }]) })]], 2), e.paging ? s("ElPagination", { staticClass: "flex-not-shrink", attrs: { "current-page": e.page.page, "hide-on-single-page": e.hideOnSinglePage, "page-size": e.page.limit, total: e.page.total, "page-sizes": [10, 25, 50, 100, 500, 1e3, 2e3], background: "", layout: "total, sizes, prev, pager, next, jumper" }, on: { "size-change": (l) => {
495
+ e.page.limit = l;
496
+ }, "current-change": (l) => {
497
+ e.page.page = l;
498
+ } } }) : e._e(), s("TableColumnFilter", { attrs: { visible: e.showSettings, columns: e.tableColumns }, on: { "update:visible": function(l) {
499
+ e.showSettings = l;
500
+ } } })], 2), s("ResizeObserver", { on: { notify: e.doLayout } })], 1);
501
+ }, X = [], G = /* @__PURE__ */ b(
502
+ I,
503
+ J,
504
+ X,
338
505
  !1,
339
506
  null,
340
507
  null
341
508
  );
342
- const j = R.exports;
509
+ const re = G.exports;
343
510
  export {
344
- j as default
511
+ re as default
345
512
  };