@web-utils/component 3.8.3 → 4.0.1

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