@web-utils/component 2.7.16 → 2.7.17

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,276 +1,142 @@
1
- import { c } from "../../chunks/config.46422d7f.js";
2
- import { d as l, o as r, u, j as a } from "../../chunks/util.23fe58fb.js";
3
- import { isBlank as o } from "@web-utils/core";
4
- import { n as h } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
5
- var p = function() {
6
- var t = this, e = t.$createElement, i = t._self._c || e;
7
- return t.boxVisible ? i("div", [i(t.dialogType, t._b({
1
+ import { isEmpty as a } from "@web-utils/core";
2
+ import { d as l } from "../../chunks/util.23fe58fb.js";
3
+ import { n } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
4
+ var r = function() {
5
+ var e = this, t = e.$createElement, o = e._self._c || t;
6
+ return o(e.dialogType, e._b({
8
7
  tag: "Component",
9
- class: ["avue-dialog", "avue-crud__dialog", {
10
- "avue-dialog--fullscreen": t.fullscreen
11
- }],
8
+ staticClass: "dialog-form",
12
9
  attrs: {
13
- "lock-scroll": "",
14
- "show-full-screen": "",
15
- "destroy-on-close": t.crud.tableOption.dialogDestroy,
16
- "wrapper-closable": t.crud.tableOption.dialogClickModal,
17
- direction: t.direction,
18
- "custom-class": t.crud.tableOption.dialogCustomClass,
19
- "modal-append-to-body": "",
20
- "append-to-body": "",
21
- top: t.dialogTop,
22
- title: t.dialogTitle,
23
- "close-on-press-escape": t.crud.tableOption.dialogEscape,
24
- "close-on-click-modal": t.optVal(t.crud.tableOption.dialogClickModal, !1),
25
- modal: t.crud.tableOption.dialogModal,
26
- "show-close": t.crud.tableOption.dialogCloseBtn,
27
- visible: t.boxVisible,
28
- "before-close": t.hide
10
+ visible: e.visible,
11
+ "destroy-on-close": "",
12
+ "before-close": e.beforeClose
29
13
  },
30
14
  on: {
31
- "update:visible": function(s) {
32
- t.boxVisible = s;
15
+ "update:visible": function(i) {
16
+ e.visible = i;
33
17
  }
34
18
  }
35
- }, "Component", t.params, !1), [i("FyForm", t._b({
36
- ref: "tableForm",
19
+ }, "Component", e.dialog, !1), [o("FyForm", {
20
+ ref: "form",
37
21
  attrs: {
38
- status: t.disabled,
39
- option: t.option
22
+ option: Object.assign({}, e.deepClone(e.option), {
23
+ menuBtn: !1
24
+ }),
25
+ status: e.disabled
40
26
  },
41
27
  on: {
42
- "update:status": function(s) {
43
- t.disabled = s;
28
+ "update:status": function(i) {
29
+ e.disabled = i;
44
30
  },
45
- change: t.handleChange,
46
- submit: t.handleSubmit,
47
- "reset-change": t.hide,
48
- "tab-click": t.handleTabClick,
49
- error: t.handleError
31
+ submit: e.handleSubmit,
32
+ "reset-change": e.close
50
33
  },
51
- scopedSlots: t._u([t._l(t.crud.formSlot, function(s) {
52
- return {
53
- key: t.getSlotName(s),
54
- fn: function(d) {
55
- return [t._t(s, null, null, Object.assign(d, {
56
- type: t.boxType
57
- }))];
58
- }
59
- };
60
- })], null, !0),
61
34
  model: {
62
- value: t.crud.tableForm,
63
- callback: function(s) {
64
- t.$set(t.crud, "tableForm", s);
35
+ value: e.data,
36
+ callback: function(i) {
37
+ e.data = i;
65
38
  },
66
- expression: "crud.tableForm"
39
+ expression: "data"
67
40
  }
68
- }, "FyForm", t.uploadFun({}, t.crud), !1)), i("span", {
41
+ }), e.isEmpty(e.option.menuBtn, !0) ? o("span", {
69
42
  staticClass: "avue-dialog__footer",
70
- class: `avue-dialog__footer--${t.dialogMenuPosition}`
71
- }, [t.optVal(t.option.submitBtn, !0) && !t.isView ? i("ElButton", {
43
+ class: `avue-dialog__footer--${e.menuPosition}`
44
+ }, [e.isEmpty(e.option.submitBtn, !0) ? o("ElButton", {
72
45
  attrs: {
73
- disabled: t.disabled,
74
- size: t.crud.controlSize,
75
- icon: t.option.submitIcon,
46
+ size: e.$AVUE.size,
47
+ icon: e.option.submitIcon,
48
+ loading: e.disabled,
76
49
  type: "primary"
77
50
  },
78
51
  on: {
79
- click: t.submit
52
+ click: e.submit
80
53
  }
81
- }, [t._v(t._s(t.option.submitText))]) : t._e(), t.optVal(t.option.emptyBtn, !0) && !t.isView ? i("ElButton", {
54
+ }, [e._v(e._s(e.option.submitText))]) : e._e(), e.isEmpty(e.option.emptyBtn, !0) ? o("ElButton", {
82
55
  attrs: {
83
- disabled: t.disabled,
84
- size: t.crud.controlSize,
85
- icon: t.option.emptyIcon
56
+ disabled: e.disabled,
57
+ size: e.$AVUE.size,
58
+ icon: e.option.emptyIcon
86
59
  },
87
60
  on: {
88
- click: t.reset
61
+ click: e.reset
89
62
  }
90
- }, [t._v(t._s(t.option.emptyText))]) : t._e(), t._t("menuForm", null, {
91
- disabled: t.disabled,
92
- size: t.crud.controlSize,
93
- type: t.boxType
94
- })], 2)], 1)], 1) : t._e();
95
- }, b = [];
96
- const m = {
63
+ }, [e._v(e._s(e.option.emptyText))]) : e._e()], 1) : e._e()], 1);
64
+ }, c = [];
65
+ const d = {
97
66
  name: "DialogForm",
98
- inject: ["crud"],
99
- props: {
100
- value: {
101
- type: Object,
102
- default: () => ({})
103
- }
104
- },
105
67
  data() {
106
68
  return {
69
+ opt: {},
107
70
  disabled: !1,
108
- boxType: "",
109
- fullscreen: !1,
110
- size: null,
111
- boxVisible: !1
71
+ callback: null,
72
+ visible: !1,
73
+ dialog: {
74
+ closeOnClickModal: !1
75
+ },
76
+ isDrawer: !1,
77
+ option: {
78
+ submitText: "提交",
79
+ emptyText: "关闭",
80
+ submitIcon: "el-icon-check",
81
+ emptyIcon: "el-icon-close",
82
+ column: []
83
+ },
84
+ data: {}
112
85
  };
113
86
  },
114
87
  computed: {
115
- option() {
116
- const t = l(this.crud.tableOption);
117
- return t.boxType = this.boxType, t.column = l(this.crud.propOption), t.menuBtn = !1, this.isAdd ? (t.submitBtn = t.saveBtn, t.submitText = this.crud.menuIcon("saveBtn"), t.submitIcon = this.crud.getBtnIcon("saveBtn")) : this.isEdit ? (t.submitBtn = t.updateBtn, t.submitText = this.crud.menuIcon("updateBtn"), t.submitIcon = this.crud.getBtnIcon("updateBtn")) : this.isView && (t.detail = !0), t.emptyBtn = t.cancelBtn, t.emptyText = this.crud.menuIcon("cancelBtn"), t.emptyIcon = this.crud.getBtnIcon("cancelBtn"), this.crud.isGroup || (t.dicFlag = !1, t.dicData = this.crud.DIC), o(t.dicFlag) || t.column.forEach((e) => {
118
- e.boxType = this.boxType, e.dicFlag = e.dicFlag || t.dicFlag;
119
- }), t;
120
- },
121
- isView() {
122
- return this.boxType === "view";
123
- },
124
- isAdd() {
125
- return this.boxType === "add";
126
- },
127
- isEdit() {
128
- return this.boxType === "edit";
129
- },
130
- direction() {
131
- return this.crud.tableOption.dialogDirection;
132
- },
133
- width() {
134
- return r(`${this.crud.tableOption.dialogWidth}`, this.crud.isMobile ? "100%" : `${c.dialogWidth}`);
135
- },
136
88
  dialogType() {
137
89
  return this.isDrawer ? "ElDrawer" : "ElementDialog";
138
90
  },
139
- dialogTop() {
140
- return !this.isDrawer && !this.fullscreen ? this.crud.tableOption.dialogTop : "0";
141
- },
142
- isDrawer() {
143
- return this.crud.tableOption.dialogType === "drawer";
144
- },
145
- params() {
146
- return this.isDrawer ? {
147
- size: this.fullscreen ? "100%" : this.width,
148
- direction: this.crud.tableOption.dialogDirection
149
- } : {
150
- width: this.width,
151
- fullscreen: this.fullscreen
152
- };
153
- },
154
- dialogTitle() {
155
- const t = `${this.boxType}`;
156
- if (!o(this.boxType)) {
157
- const e = {
158
- tipStartTitle: "当前表格已选择",
159
- tipEndTitle: "项",
160
- editTitle: "编 辑",
161
- copyTitle: "复 制",
162
- addTitle: "新 增",
163
- viewTitle: "查 看",
164
- filterTitle: "过滤条件",
165
- showTitle: "列显隐"
166
- };
167
- return this.crud.tableOption[`${t}Title`] || e[`${t}Title`];
168
- }
169
- return "";
170
- },
171
- dialogMenuPosition() {
172
- return this.crud.option.dialogMenuPosition || "right";
91
+ menuPosition() {
92
+ return this.opt.menuPosition || "center";
173
93
  }
174
94
  },
175
95
  methods: {
176
- isBlank: o,
177
- optVal: r,
178
- uploadFun: u,
96
+ isEmpty: a,
97
+ deepClone: l,
179
98
  submit() {
180
- this.$refs.tableForm.submit();
99
+ this.$refs.form.submit();
181
100
  },
182
101
  reset() {
183
- this.$refs.tableForm.resetForm(!1);
184
- },
185
- getSlotName(t) {
186
- return t.replace("Form", "");
187
- },
188
- initFun() {
189
- ["clearValidate", "validate", "resetForm", "validateField"].forEach((t) => {
190
- this.crud[t] = this.$refs.tableForm[t];
191
- });
192
- },
193
- handleChange() {
194
- this.crud.setVal();
195
- },
196
- handleTabClick(t, e) {
197
- this.crud.$emit("tab-click", t, e);
102
+ this.$refs.form.resetForm();
198
103
  },
199
- handleFullScreen() {
200
- this.isDrawer && (o(this.size) ? this.size = "100%" : this.size = ""), this.fullscreen = !this.fullscreen;
104
+ beforeClose(e) {
105
+ e(), this.close();
201
106
  },
202
- handleError(t) {
203
- this.crud.$emit("error", t);
107
+ show(e) {
108
+ this.opt = e, this.callback = e.callback;
109
+ const t = this.deepClone(e);
110
+ ["callback", "option", "data"].forEach((o) => delete t[o]), this.dialog = Object.assign(this.dialog, t), this.dialog.size = this.dialog.width, this.isDrawer = this.dialog.type === "drawer", this.option = Object.assign(this.option, e.option), this.data = e.data, this.visible = !0;
204
111
  },
205
- handleSubmit(t, e) {
206
- this.isAdd ? this.rowSave(e) : this.isEdit && this.rowUpdate(e);
207
- },
208
- // 保存
209
- rowSave(t) {
210
- this.crud.$emit(
211
- "row-save",
212
- a(this.crud.tableForm),
213
- this.closeDialog,
214
- t
215
- );
216
- },
217
- // 更新
218
- rowUpdate(t) {
219
- this.crud.$emit(
220
- "row-update",
221
- a(this.crud.tableForm),
222
- this.crud.tableIndex,
223
- this.closeDialog,
224
- t
225
- );
226
- },
227
- closeDialog(t) {
228
- t = l(t), t && (() => {
229
- if (this.isEdit) {
230
- const { parentList: i, index: s } = this.crud.findData(t[this.crud.rowKey]);
231
- i && i.splice(s, 1, t);
232
- } else if (this.isAdd) {
233
- const { item: i } = this.crud.findData(t[this.crud.rowParentKey]);
234
- i ? (i[this.crud.childrenKey] || this.$set(i, this.crud.childrenKey, []), this.crud.tableOption.lazy && this.$set(i, this.crud.hasChildrenKey, !0), i[this.crud.childrenKey].push(t)) : this.crud.list.push(t);
235
- }
236
- })(), this.hide();
237
- },
238
- // 隐藏表单
239
- hide(t) {
112
+ close() {
240
113
  const e = () => {
241
- t && t(), this.crud.tableIndex = -1, this.crud.tableForm = {}, this.crud.setVal(), this.boxVisible = !1;
114
+ this.visible = !1, this.$destroy(), this.$el.remove();
242
115
  };
243
- typeof this.crud.beforeClose == "function" ? this.crud.beforeClose(e, this.boxType) : e();
116
+ typeof this.dialog.beforeClose == "function" ? this.dialog.beforeClose(e) : e();
244
117
  },
245
- // 显示表单
246
- show(t) {
247
- this.boxType = t;
248
- const e = () => {
249
- this.fullscreen = this.crud.tableOption.dialogFullscreen, this.boxVisible = !0, this.$nextTick(() => {
250
- this.initFun();
251
- });
252
- };
253
- typeof this.crud.beforeOpen == "function" ? this.crud.beforeOpen(e, this.boxType) : e();
118
+ handleSubmit(e, t) {
119
+ this.callback && this.callback({ data: e, close: this.close, done: t });
254
120
  }
255
121
  }
256
- }, n = {};
257
- var f = /* @__PURE__ */ h(
258
- m,
259
- p,
260
- b,
122
+ }, s = {};
123
+ var m = /* @__PURE__ */ n(
124
+ d,
125
+ r,
126
+ c,
261
127
  !1,
262
- g,
128
+ u,
263
129
  null,
264
130
  null,
265
131
  null
266
132
  );
267
- function g(t) {
268
- for (let e in n)
269
- this[e] = n[e];
133
+ function u(e) {
134
+ for (let t in s)
135
+ this[t] = s[t];
270
136
  }
271
- const F = /* @__PURE__ */ function() {
272
- return f.exports;
137
+ const h = /* @__PURE__ */ function() {
138
+ return m.exports;
273
139
  }();
274
140
  export {
275
- F as default
141
+ h as default
276
142
  };
@@ -1,10 +1,10 @@
1
- import { c as a } from "../../chunks/config.46422d7f.js";
2
- import { d as l, o as n, u, j as c } from "../../chunks/util.23fe58fb.js";
1
+ import { c as d } from "../../chunks/config.46422d7f.js";
2
+ import { d as l, o as a, u, j as n } from "../../chunks/util.23fe58fb.js";
3
3
  import { isBlank as r } from "@web-utils/core";
4
4
  import { n as h } from "../../chunks/vueComponentNormalizer.71e2aa87.js";
5
5
  var p = function() {
6
6
  var t = this, e = t.$createElement, i = t._self._c || e;
7
- return t.boxVisible ? i("div", [i(t.dialogType, t._b({
7
+ return t.boxVisible ? i(t.dialogType, t._b({
8
8
  tag: "Component",
9
9
  class: {
10
10
  "dialog-form": !t.isView
@@ -91,7 +91,7 @@ var p = function() {
91
91
  disabled: t.disabled,
92
92
  size: t.crud.controlSize,
93
93
  type: t.boxType
94
- })], 2)], 1)], 1) : t._e();
94
+ })], 2)], 1) : t._e();
95
95
  }, b = [];
96
96
  const m = {
97
97
  name: "FyDialogForm",
@@ -105,7 +105,6 @@ const m = {
105
105
  data() {
106
106
  return {
107
107
  disabled: !1,
108
- config: a,
109
108
  boxType: "",
110
109
  fullscreen: !1,
111
110
  size: null,
@@ -132,7 +131,7 @@ const m = {
132
131
  return this.crud.tableOption.dialogDirection;
133
132
  },
134
133
  width() {
135
- return n(`${this.crud.tableOption.dialogWidth}`, this.crud.isMobile ? "100%" : `${a.dialogWidth}`);
134
+ return a(`${this.crud.tableOption.dialogWidth}`, this.crud.isMobile ? "100%" : `${d.dialogWidth}`);
136
135
  },
137
136
  dialogType() {
138
137
  return this.isDrawer ? "ElDrawer" : "ElementDialog";
@@ -174,7 +173,7 @@ const m = {
174
173
  }
175
174
  },
176
175
  methods: {
177
- optVal: n,
176
+ optVal: a,
178
177
  uploadFun: u,
179
178
  submit() {
180
179
  this.$refs.tableForm.submit();
@@ -209,7 +208,7 @@ const m = {
209
208
  rowSave(t) {
210
209
  this.crud.$emit(
211
210
  "row-save",
212
- c(this.crud.tableForm, ["$"]),
211
+ n(this.crud.tableForm, ["$"]),
213
212
  this.closeDialog,
214
213
  t
215
214
  );
@@ -218,7 +217,7 @@ const m = {
218
217
  rowUpdate(t) {
219
218
  this.crud.$emit(
220
219
  "row-update",
221
- c(this.crud.tableForm, ["$"]),
220
+ n(this.crud.tableForm, ["$"]),
222
221
  this.crud.tableIndex,
223
222
  this.closeDialog,
224
223
  t
@@ -256,7 +255,7 @@ const m = {
256
255
  typeof this.crud.beforeOpen == "function" ? this.crud.beforeOpen(e, this.boxType) : e();
257
256
  }
258
257
  }
259
- }, d = {};
258
+ }, c = {};
260
259
  var f = /* @__PURE__ */ h(
261
260
  m,
262
261
  p,
@@ -268,8 +267,8 @@ var f = /* @__PURE__ */ h(
268
267
  null
269
268
  );
270
269
  function y(t) {
271
- for (let e in d)
272
- this[e] = d[e];
270
+ for (let e in c)
271
+ this[e] = c[e];
273
272
  }
274
273
  const x = /* @__PURE__ */ function() {
275
274
  return f.exports;
@@ -231,8 +231,8 @@ const d = /* @__PURE__ */ function() {
231
231
  data: {
232
232
  option: t
233
233
  }
234
- });
235
- return i.$mount(), document.body.appendChild(i.$el), i.show(), i;
234
+ }).$mount();
235
+ return document.body.appendChild(i.$el), i.show(), i;
236
236
  }, g = {
237
237
  name: "ImageCropper",
238
238
  imageCropper: u,
@@ -241,8 +241,8 @@ const w = /* @__PURE__ */ function() {
241
241
  }
242
242
  }, o = new i({
243
243
  data: a
244
- });
245
- return o.$mount(), document.body.appendChild(o.$el), o.isShow = !0, o;
244
+ }).$mount();
245
+ return document.body.appendChild(o.$el), o.isShow = !0, o;
246
246
  }, x = {
247
247
  name: "ImagePreview",
248
248
  imagePreview: p,