@web-utils/form-ui 1.0.0-beta84 → 1.0.0-beta86

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.
@@ -1,14 +1,14 @@
1
1
  import { s as e } from "./ClVh1Lek.mjs";
2
2
  import { goBack as t, hasAuthority as n } from "../api/index.mjs";
3
- import { toolbarContextKey as r } from "../constants/index.mjs";
4
- import { t as i } from "./mnqSaATq.mjs";
5
- import "element-plus/es";
3
+ import { tableViewContextKey as r, toolbarContextKey as i } from "../constants/index.mjs";
4
+ import { t as a } from "./mnqSaATq.mjs";
5
+ import { ElMessage as o } from "element-plus/es";
6
6
  import "element-plus/es/components/base/style/css";
7
- import { Comment as a, createVNode as o } from "vue";
8
- import { NOOP as s, capitalize as c } from "@web-utils/core";
7
+ import { Comment as s, createVNode as c } from "vue";
8
+ import { NOOP as l, capitalize as u, copy as d } from "@web-utils/core";
9
9
  import "element-plus/es/components/message/style/css";
10
10
  //#region src/components/toolbar/Toolbar.vue?vue&type=script&lang.jsx
11
- var l = {
11
+ var f = {
12
12
  back: {
13
13
  label: "返回",
14
14
  type: "primary",
@@ -117,11 +117,15 @@ var l = {
117
117
  separateLine: !1,
118
118
  circle: !0
119
119
  }
120
- }, u = {
120
+ }, p = {
121
121
  name: "Toolbar",
122
122
  provide() {
123
- return { [r]: this };
123
+ return { [i]: this };
124
124
  },
125
+ inject: { tableView: {
126
+ from: r,
127
+ default: null
128
+ } },
125
129
  props: {
126
130
  searchable: Boolean,
127
131
  refreshable: Boolean,
@@ -143,20 +147,20 @@ var l = {
143
147
  goBack() {
144
148
  t(this.$route.path);
145
149
  },
146
- createButton(t, { label: n, icon: r, type: a, separateLine: l = !0, loadable: u, circle: d, onClick: f, title: p }) {
150
+ createButton(t, { label: n, icon: r, type: i, separateLine: o = !0, loadable: s, circle: d, onClick: f, title: p }) {
147
151
  var m;
148
152
  let h, g = ((m = this.label) == null ? void 0 : m[t]) || n;
149
153
  return h = f || (["back", "cancel"].includes(t) ? this.goBack : (n) => {
150
- (e(this.$attrs, { withOn: !0 })[`on${c(t)}`] || s)(n);
151
- }), o(i, {
152
- "separate-line": l,
154
+ (e(this.$attrs, { withOn: !0 })[`on${u(t)}`] || l)(n);
155
+ }), c(a, {
156
+ "separate-line": o,
153
157
  icon: r,
154
158
  title: p,
155
159
  label: g,
156
- loadable: u,
160
+ loadable: s,
157
161
  circle: d,
158
162
  footer: this.footer,
159
- type: a,
163
+ type: i,
160
164
  onClick: h
161
165
  }, null);
162
166
  },
@@ -164,19 +168,19 @@ var l = {
164
168
  var e, t, r;
165
169
  let { createButton: i } = this;
166
170
  return (r = (((e = (t = this.$slots)["toolbar-left"]) == null ? void 0 : e.call(t)) || this.buttons.flatMap((e) => {
167
- let t = l[e];
171
+ let t = f[e];
168
172
  if (t) {
169
173
  var n, r;
170
174
  return ((n = (r = this.$slots)[e]) == null ? void 0 : n.call(r)) || i(e, t);
171
175
  } else if (e === "slot") {
172
- var o, s;
173
- let e = ((o = (s = this.$slots).default) == null ? void 0 : o.call(s, {
176
+ var a, o;
177
+ let e = ((a = (o = this.$slots).default) == null ? void 0 : a.call(o, {
174
178
  buttons: this.buttons,
175
179
  footer: this.footer
176
180
  })) ?? null;
177
181
  if (e && e.length === 1) {
178
182
  var c;
179
- return e == null || (c = e[0]) == null || (c = c.children) == null ? void 0 : c.filter((e) => e.type !== a);
183
+ return e == null || (c = e[0]) == null || (c = c.children) == null ? void 0 : c.filter((e) => e.type !== s);
180
184
  }
181
185
  return e || [];
182
186
  } else return null;
@@ -190,21 +194,37 @@ var l = {
190
194
  this.getSettingsButton(),
191
195
  this.getSearchButton()
192
196
  ];
197
+ if (process.env.NODE_ENV === "development") {
198
+ var s;
199
+ (s = this.tableView) != null && s.toggleSearch && a.push(this.createButton("copyColumnWidth", {
200
+ label: "复制列宽",
201
+ title: "复制列宽",
202
+ icon: "el-icon-document-copy",
203
+ separateLine: !1,
204
+ circle: !0,
205
+ onClick: () => {
206
+ let e = Array.from(this.$el.parentNode.querySelectorAll(".el-table__header > colgroup > col"));
207
+ e = e.filter((t, n) => n > 1 && n < e.length - 1).map((e) => `width="${e.getAttribute("width")}"`).join("\n"), d(e, () => {
208
+ o.success("复制成功");
209
+ });
210
+ }
211
+ }));
212
+ }
193
213
  return i || a;
194
214
  },
195
215
  getSearchButton() {
196
- return this.searchable ? this.createButton("search", l.search) : null;
216
+ return this.searchable ? this.createButton("search", f.search) : null;
197
217
  },
198
218
  getRefreshButton() {
199
- return this.refreshable ? this.createButton("reload", l.reload) : null;
219
+ return this.refreshable ? this.createButton("reload", f.reload) : null;
200
220
  },
201
221
  getSettingsButton() {
202
- return this.refreshable ? this.createButton("settings", l.settings) : null;
222
+ return this.refreshable ? this.createButton("settings", f.settings) : null;
203
223
  }
204
224
  },
205
225
  render() {
206
- return this.footer ? o("div", { class: "footer-bar" }, [this.getLeftButtons()]) : o("div", { class: "toolbar" }, [o("div", { class: "toolbar-left" }, [this.getLeftButtons()]), o("div", { class: "toolbar-right" }, [this.getRightButtons()])]);
226
+ return this.footer ? c("div", { class: "footer-bar" }, [this.getLeftButtons()]) : c("div", { class: "toolbar" }, [c("div", { class: "toolbar-left" }, [this.getLeftButtons()]), c("div", { class: "toolbar-right" }, [this.getRightButtons()])]);
207
227
  }
208
228
  };
209
229
  //#endregion
210
- export { u as t };
230
+ export { p as t };
@@ -1,5 +1,5 @@
1
1
  import { n as e, o as t } from "./b0ve2YgF.mjs";
2
- import { t as n } from "./FZqu01np2.mjs";
2
+ import { t as n } from "./BTGrh7dw2.mjs";
3
3
  import { allProps as r, predicate as i } from "../props/tree-select.mjs";
4
4
  import { createVNode as a, mergeProps as o } from "vue";
5
5
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { t as e } from "./B1MSrc6f.mjs";
2
- import { t } from "./SLYmepqR.mjs";
2
+ import { t } from "./HFLY8Wla.mjs";
3
3
  import { t as n } from "./mnqSaATq.mjs";
4
4
  import { t as r } from "./tzjUpVIj.mjs";
5
5
  import { n as i } from "./b0ve2YgF.mjs";
@@ -52,7 +52,11 @@ var I = {
52
52
  showSummary: Boolean,
53
53
  selectionWidth: String,
54
54
  fetchApi: Function,
55
- delApi: Function
55
+ delApi: Function,
56
+ rowKey: {
57
+ type: [Function, String],
58
+ default: "id"
59
+ }
56
60
  }, L = {
57
61
  name: "SubTable",
58
62
  emits: {
@@ -191,6 +195,7 @@ function V(e, i, m, h, g, N) {
191
195
  "show-summary": e.showSummary,
192
196
  "selection-width": e.selectionWidth
193
197
  }, e.$attrs, {
198
+ "row-key": e.rowKey,
194
199
  "hide-on-single-page": "",
195
200
  selection: N.enabled,
196
201
  "row-db-click": e.rowDbClick,
@@ -409,6 +414,7 @@ function V(e, i, m, h, g, N) {
409
414
  "api",
410
415
  "show-summary",
411
416
  "selection-width",
417
+ "row-key",
412
418
  "selection",
413
419
  "row-db-click",
414
420
  "onSelectionChange"
@@ -1,6 +1,6 @@
1
1
  import { commonAutoBindProps as e, commonManualBindProps as t } from "../props/common.mjs";
2
2
  import { n, o as r } from "./b0ve2YgF.mjs";
3
- import { n as i, t as a } from "./61ccpSFj2.mjs";
3
+ import { n as i, t as a } from "./DWN5uzm02.mjs";
4
4
  import { createVNode as o, mergeProps as s, ref as c, useModel as l } from "vue";
5
5
  //#region src/components/table/form-table.ts
6
6
  var u = {