@web-utils/component 4.0.1 → 4.0.3

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,9 +1,63 @@
1
- import { _ } from "../chunks/helper.BiMLcEEk.mjs";
2
- import { h as g } from "vue";
3
- import w from "../dict-render/index.mjs";
4
- import { f as v } from "../chunks/core.DJEgjQW6.mjs";
5
- import { n as F } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
6
- const x = {
1
+ import { _ as T } from "../chunks/helper.BiMLcEEk.mjs";
2
+ import { h as d } from "vue";
3
+ import { g as C } from "../chunks/dictionary.DsN-2ukC.mjs";
4
+ import { n as B } from "../chunks/_plugin-vue2_normalizer.CeySl7Fu.mjs";
5
+ import { f as V } from "../chunks/core.DJEgjQW6.mjs";
6
+ const D = {
7
+ name: "DictRender",
8
+ inheritAttrs: !1,
9
+ props: {
10
+ row: Object,
11
+ column: Object,
12
+ dictType: String,
13
+ options: Array,
14
+ treeDict: Boolean,
15
+ idAsValue: {
16
+ type: Boolean,
17
+ default: !0
18
+ },
19
+ labelAsValue: Boolean
20
+ },
21
+ data() {
22
+ return {
23
+ label: ""
24
+ };
25
+ },
26
+ computed: {
27
+ value() {
28
+ return this.row[this.column.property];
29
+ }
30
+ },
31
+ watch: {
32
+ value: {
33
+ immediate: !0,
34
+ async handler() {
35
+ var l, e;
36
+ this.dictType ? this.label = await C(this.dictType, this.value, !0, {
37
+ treeDict: this.treeDict,
38
+ idAsValue: this.idAsValue,
39
+ labelAsValue: this.labelAsValue
40
+ }) : this.label = ((e = (l = this.options) == null ? void 0 : l.find((t) => `${t.value}` == `${this.value}`)) == null ? void 0 : e.label) ?? `${this.value}`;
41
+ }
42
+ }
43
+ },
44
+ render() {
45
+ return d("span", T([{}, {
46
+ on: this.$listeners
47
+ }, {}, {
48
+ domProps: this.$attrs
49
+ }]), [this.label]);
50
+ }
51
+ }, F = null, O = null;
52
+ var $ = /* @__PURE__ */ B(
53
+ D,
54
+ F,
55
+ O,
56
+ !1,
57
+ null,
58
+ null
59
+ );
60
+ const x = $.exports, N = {
7
61
  props: {
8
62
  type: {
9
63
  type: String,
@@ -55,8 +109,8 @@ const x = {
55
109
  default() {
56
110
  return ["ascending", "descending", null];
57
111
  },
58
- validator(n) {
59
- return n.every((t) => ["ascending", "descending", null].indexOf(t) > -1);
112
+ validator(l) {
113
+ return l.every((e) => ["ascending", "descending", null].indexOf(e) > -1);
60
114
  }
61
115
  },
62
116
  dictType: String,
@@ -69,103 +123,103 @@ const x = {
69
123
  },
70
124
  labelAsValue: Boolean
71
125
  }
72
- }, N = {
126
+ }, M = {
73
127
  selection: !0,
74
128
  "single-selection": !0,
75
129
  index: !0,
76
130
  expand: !0
77
- }, O = (n, t, e, y, d) => {
131
+ }, k = (l, e, t, y, p) => {
78
132
  var i;
79
- const l = n.rowDbClick || ((i = n.$children.find((f) => f.$options.name === "TableView")) == null ? void 0 : i.rowDbClick);
80
- l == null || l(t, e, y, d);
81
- }, V = (n) => {
82
- let t = n.target;
83
- for (; t && t.tagName.toUpperCase() !== "HTML"; ) {
84
- if (t.tagName.toUpperCase() === "TD")
85
- return t;
86
- t = t.parentNode;
133
+ const n = l.rowDbClick || ((i = l.$children.find((f) => f.$options.name === "TableView")) == null ? void 0 : i.rowDbClick);
134
+ n == null || n(e, t, y, p);
135
+ }, H = (l) => {
136
+ let e = l.target;
137
+ for (; e && e.tagName.toUpperCase() !== "HTML"; ) {
138
+ if (e.tagName.toUpperCase() === "TD")
139
+ return e;
140
+ e = e.parentNode;
87
141
  }
88
142
  return null;
89
- }, D = () => {
90
- }, M = (n) => !v(n).length, k = {
143
+ }, P = () => {
144
+ }, R = (l) => !V(l).length, U = {
91
145
  name: "TableColumn",
92
146
  functional: !0,
93
- mixins: [x],
94
- render(n, {
95
- data: t,
96
- props: e,
147
+ mixins: [N],
148
+ render(l, {
149
+ data: e,
150
+ props: t,
97
151
  children: y,
98
- parent: d,
152
+ parent: p,
99
153
  listeners: {
100
- click: l
154
+ click: n
101
155
  }
102
156
  }) {
103
157
  const {
104
158
  scopedSlots: i,
105
159
  ...f
106
- } = t, {
107
- clickable: C,
160
+ } = e, {
161
+ clickable: v,
108
162
  cellClick: a,
109
163
  ...b
110
- } = e, S = {
164
+ } = t, g = {
111
165
  ...i || {}
112
- }, h = N[e.type];
113
- if (!h) {
114
- const p = i == null ? void 0 : i.default, c = C || l || a;
115
- (c || e.dictType || e.options) && (S.default = (T) => {
166
+ }, _ = M[t.type];
167
+ if (!_) {
168
+ const m = i == null ? void 0 : i.default, c = v || n || a;
169
+ (c || t.dictType || t.options) && (g.default = (A) => {
116
170
  const {
117
171
  row: o,
118
172
  column: r
119
- } = T, B = c ? (u) => {
120
- const m = V(u);
121
- l || a ? (l == null || l(o, r, o, r, m, u), a == null || a(o, r, o, r, m, u)) : O(d, o, r, m, u);
122
- } : D;
123
- let s = p == null ? void 0 : p(T);
124
- return M(s) && (s = null), (e.dictType || e.options) && !s ? g(w, {
173
+ } = A, S = c ? (u) => {
174
+ const h = H(u);
175
+ n || a ? (n == null || n(o, r, o, r, h, u), a == null || a(o, r, o, r, h, u)) : k(p, o, r, h, u);
176
+ } : P;
177
+ let s = m == null ? void 0 : m(A);
178
+ return R(s) && (s = null), (t.dictType || t.options) && !s ? d(x, {
125
179
  class: {
126
180
  "is-clickable": c
127
181
  },
128
182
  on: {
129
- click: B
183
+ click: S
130
184
  },
131
185
  attrs: {
132
186
  row: o,
133
187
  column: r,
134
- dictType: e.dictType,
135
- treeDict: e.treeDict,
136
- idAsValue: e.idAsValue,
137
- labelAsValue: e.labelAsValue,
138
- options: e.options
188
+ dictType: t.dictType,
189
+ treeDict: t.treeDict,
190
+ idAsValue: t.idAsValue,
191
+ labelAsValue: t.labelAsValue,
192
+ options: t.options
139
193
  }
140
- }) : c ? g("span", {
194
+ }) : c ? d("span", {
141
195
  class: "is-clickable",
142
196
  on: {
143
- click: B
197
+ click: S
144
198
  }
145
199
  }, [s || (o == null ? void 0 : o[r == null ? void 0 : r.property])]) : s;
146
200
  });
147
201
  }
148
- const A = {
202
+ const w = {
149
203
  ...f,
150
204
  props: {
151
205
  ...b,
152
- showOverflowTooltip: h ? !1 : b.showOverflowTooltip
206
+ showOverflowTooltip: _ ? !1 : b.showOverflowTooltip
153
207
  }
154
208
  };
155
- return g("ElTableColumn", _([{}, A, {
156
- scopedSlots: S
209
+ return d("ElTableColumn", T([{}, w, {
210
+ scopedSlots: g
157
211
  }]));
158
212
  }
159
- }, H = null, P = null;
160
- var U = /* @__PURE__ */ F(
161
- k,
162
- H,
163
- P,
213
+ }, j = null, z = null;
214
+ var E = /* @__PURE__ */ B(
215
+ U,
216
+ j,
217
+ z,
164
218
  !1,
165
219
  null,
166
220
  null
167
221
  );
168
- const K = U.exports;
222
+ const X = E.exports;
169
223
  export {
170
- K as default
224
+ X as default
171
225
  };
package/web-types.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "@web-utils/component",
5
- "version": "4.0.1",
5
+ "version": "4.0.3",
6
6
  "contributions": {
7
7
  "html": {
8
8
  "description-markup": "markdown",