@web-utils/component 2.8.0 → 2.8.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.
@@ -0,0 +1,126 @@
1
+ const p = /[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, O = /^[a-zA-Z_$][0-9a-zA-Z_$]*$/;
2
+ let s, y;
3
+ const N = {
4
+ // table of character substitutions
5
+ "\b": "\\b",
6
+ " ": "\\t",
7
+ "\n": "\\n",
8
+ "\f": "\\f",
9
+ "\r": "\\r",
10
+ '"': '\\"',
11
+ "'": "\\'",
12
+ "\\": "\\\\"
13
+ };
14
+ let h;
15
+ function x(f, n = {}) {
16
+ const e = n.space || 2, t = n.dropQuotesOnKeys !== !1, r = n.dropQuotesOnNumbers || !1, l = n.inlineShortArrays || !1, u = n.inlineShortArraysDepth || 1, a = n.quoteType || "single", c = n.minify || !1;
17
+ r && S(f);
18
+ let o = d(f, null, c ? void 0 : e, t, a);
19
+ if (l && !c) {
20
+ let i = j(o);
21
+ if (u > 1)
22
+ for (let m = 1; m < u && (o = i, i = j(o), i !== o); m++)
23
+ ;
24
+ o = i;
25
+ }
26
+ return o;
27
+ }
28
+ function S(f) {
29
+ if (!$(f))
30
+ return;
31
+ const n = Object.keys(f);
32
+ n && n.forEach(function(e) {
33
+ const t = f[e];
34
+ if (typeof t == "string") {
35
+ const r = t - 0;
36
+ f[e] = isNaN(r) ? t : r;
37
+ } else
38
+ ($(t) || Array.isArray(t)) && S(t);
39
+ });
40
+ }
41
+ function $(f) {
42
+ return f && typeof f == "object";
43
+ }
44
+ function j(f, n) {
45
+ if (n || (n = 80), typeof n != "number" || n < 20)
46
+ throw Error(`Invalid width '${n}'. Expecting number equal or larger than 20.`);
47
+ const e = f.split(`
48
+ `);
49
+ let t = 0, r = null, l = [];
50
+ for (; t < e.length; ) {
51
+ const u = !!e[t].match(/\[/), a = !!e[t].match(/\],?/);
52
+ if (u && !a)
53
+ l = [e[t]], r = t;
54
+ else if (a && !u && r) {
55
+ l.push((e[t] || "").trim());
56
+ const c = l.join(" ");
57
+ c.length < n && (e.splice(r, t - r + 1, c), t = r), r = null, l = [];
58
+ } else
59
+ r && l.push((e[t] || "").trim());
60
+ t += 1;
61
+ }
62
+ return e.join(`
63
+ `);
64
+ }
65
+ function d(f, n, e, t, r) {
66
+ let l;
67
+ if (s = "", y = "", typeof e == "number")
68
+ for (l = 0; l < e; l += 1)
69
+ y += " ";
70
+ else
71
+ typeof e == "string" && (y = e);
72
+ if (h = n, n && typeof n != "function" && (typeof n != "object" || typeof n.length != "number"))
73
+ throw new Error("JSON.stringify");
74
+ return b("", { "": f }, t, r);
75
+ }
76
+ function b(f, n, e, t) {
77
+ let r, l, u, a;
78
+ const c = s;
79
+ let o, i = n[f];
80
+ switch (i && typeof i == "object" && typeof i.toJSON == "function" && (i = i.toJSON(f)), typeof h == "function" && (i = h.call(n, f, i)), typeof i) {
81
+ case "function":
82
+ return i;
83
+ case "string":
84
+ return g(i, t);
85
+ case "number":
86
+ return isFinite(i) ? String(i) : "null";
87
+ case "boolean":
88
+ case "null":
89
+ return String(i);
90
+ case "object":
91
+ if (!i)
92
+ return "null";
93
+ if (s += y, o = [], Object.prototype.toString.apply(i) === "[object Array]") {
94
+ for (a = i.length, r = 0; r < a; r += 1)
95
+ o[r] = b(r, i, e, t) || "null";
96
+ return u = o.length === 0 ? "[]" : s ? `[
97
+ ${s}${o.join(`,
98
+ ${s}`)}
99
+ ${c}]` : `[${o.join(",")}]`, s = c, u;
100
+ }
101
+ if (h && typeof h == "object")
102
+ for (a = h.length, r = 0; r < a; r += 1)
103
+ typeof h[r] == "string" && (l = h[r], u = b(l, i, e, t), u && o.push((e ? A(l, t) : g(l, t)) + (s ? ": " : ":") + u));
104
+ else
105
+ for (l in i)
106
+ Object.prototype.hasOwnProperty.call(i, l) && (u = b(l, i, e, t), u && o.push((e ? A(l, t) : g(l, t)) + (s ? ": " : ":") + u));
107
+ return u = o.length === 0 ? "{}" : s ? `{
108
+ ${s}${o.join(`,
109
+ ${s}`)}
110
+ ${c}}` : `{${o.join(",")}}`, s = c, u;
111
+ }
112
+ }
113
+ function g(f, n) {
114
+ p.lastIndex = 0;
115
+ let e = '"';
116
+ return n === "single" && (e = "'"), p.test(f) ? e + f.replace(p, function(t) {
117
+ const r = N[t];
118
+ return typeof r == "string" ? r : `\\u${`0000${t.charCodeAt(0).toString(16)}`.slice(-4)}`;
119
+ }) + e : e + f + e;
120
+ }
121
+ function A(f, n) {
122
+ return O.test(f) ? f : g(f, n);
123
+ }
124
+ export {
125
+ x as c
126
+ };
@@ -13,7 +13,7 @@ var h = function() {
13
13
  data: e.value
14
14
  }
15
15
  }, [e._l(e.columns, function(a) {
16
- return t("ElTableColumn", {
16
+ return t("TableColumn", {
17
17
  key: a.prop,
18
18
  attrs: {
19
19
  prop: a.prop,
@@ -22,8 +22,8 @@ var h = function() {
22
22
  },
23
23
  scopedSlots: e._u([{
24
24
  key: "default",
25
- fn: function(l) {
26
- var n = l.row, r = l.$index;
25
+ fn: function(n) {
26
+ var l = n.row, r = n.$index;
27
27
  return [t("ElFormItem", {
28
28
  style: {
29
29
  marginBottom: e.inputDisabled ? "0px" : "16px"
@@ -40,9 +40,9 @@ var h = function() {
40
40
  placeholder: e.inputDisabled ? "" : `请输入${a.label}!`
41
41
  },
42
42
  model: {
43
- value: n[a.prop],
43
+ value: l[a.prop],
44
44
  callback: function(s) {
45
- e.$set(n, a.prop, s);
45
+ e.$set(l, a.prop, s);
46
46
  },
47
47
  expression: "row[column.prop]"
48
48
  }
@@ -50,7 +50,7 @@ var h = function() {
50
50
  }
51
51
  }], null, !0)
52
52
  });
53
- }), e.inputDisabled ? e._e() : t("ElTableColumn", {
53
+ }), e.inputDisabled ? e._e() : t("TableColumn", {
54
54
  attrs: {
55
55
  label: "操作",
56
56
  width: "60",
@@ -59,7 +59,7 @@ var h = function() {
59
59
  scopedSlots: e._u([{
60
60
  key: "default",
61
61
  fn: function(a) {
62
- var l = a.row, n = a.column, r = a.$index;
62
+ var n = a.row, l = a.column, r = a.$index;
63
63
  return [t("i", {
64
64
  staticClass: "el-icon-minus dynamic-table-action-icon",
65
65
  staticStyle: {
@@ -72,7 +72,7 @@ var h = function() {
72
72
  },
73
73
  on: {
74
74
  click: function(s) {
75
- return s.stopPropagation(), e.removeRow(l, r, n);
75
+ return s.stopPropagation(), e.removeRow(n, r, l);
76
76
  }
77
77
  }
78
78
  })];
@@ -0,0 +1,156 @@
1
+ import { n } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
2
+ const l = ["disabled", "size", "statusIcon", "inlineMessage", "autoLabelWidth", "hideRequiredAsterisk", "$emit", "validate", "clearValidate"], d = ["$emit", "validate", "clearValidate"], c = {
3
+ name: "FormBlock",
4
+ inject: {
5
+ elForm: {
6
+ default: {}
7
+ }
8
+ },
9
+ provide() {
10
+ return {
11
+ elForm: this.formConfig
12
+ };
13
+ },
14
+ props: {
15
+ blockTitle: String,
16
+ active: Boolean,
17
+ enabled: Boolean,
18
+ disabled: Boolean,
19
+ wrapRow: {
20
+ type: Boolean,
21
+ default: !0
22
+ },
23
+ gutter: {
24
+ type: Number,
25
+ default: 20
26
+ },
27
+ collapse: Boolean
28
+ },
29
+ data() {
30
+ const e = {};
31
+ return l.forEach((t) => {
32
+ e[t] = null;
33
+ }), {
34
+ expand: !0,
35
+ formConfig: e
36
+ };
37
+ },
38
+ computed: {
39
+ formCfg() {
40
+ const e = {
41
+ enabled: this.enabled,
42
+ forbidden: this.disabled
43
+ };
44
+ return l.forEach((t) => {
45
+ e[t] = this.elForm[t];
46
+ }), e;
47
+ }
48
+ },
49
+ watch: {
50
+ collapse: {
51
+ immediate: !0,
52
+ handler(e) {
53
+ this.expand = !e;
54
+ }
55
+ },
56
+ formCfg: {
57
+ immediate: !0,
58
+ handler() {
59
+ this.formConfig.disabled = this.available(), l.forEach((e) => {
60
+ var t;
61
+ e !== "disabled" && (d.includes(e) ? this.formConfig[e] = (t = this.elForm[e]) == null ? void 0 : t.bind(this.elForm) : this.formConfig[e] = this.elForm[e]);
62
+ });
63
+ }
64
+ }
65
+ },
66
+ mounted() {
67
+ this.dispatch("FormView", "FormView.addTab", [this]);
68
+ },
69
+ beforeDestroy() {
70
+ this.dispatch("FormView", "FormView.removeTab", [this]);
71
+ },
72
+ methods: {
73
+ available() {
74
+ return this.disabled ? this.disabled : this.enabled ? !this.enabled : this.elForm.disabled;
75
+ },
76
+ dispatch(e, t, a) {
77
+ let o = this.$parent || this.$root, i = o.$options.name;
78
+ for (; o && (!i || i !== e); )
79
+ o = o.$parent, o && (i = o.$options.name);
80
+ o && o.$emit.apply(o, [t].concat(a));
81
+ },
82
+ renderDefault() {
83
+ const e = this.$createElement, {
84
+ wrapRow: t,
85
+ gutter: a,
86
+ formConfig: o,
87
+ $scopedSlots: i
88
+ } = this;
89
+ return t ? e("ElRow", {
90
+ attrs: {
91
+ gutter: a
92
+ }
93
+ }, [i.default({
94
+ disabled: o.disabled
95
+ })]) : i.default({
96
+ disabled: o.disabled
97
+ });
98
+ },
99
+ toggle() {
100
+ this.expand = !this.expand;
101
+ },
102
+ open() {
103
+ this.expand = !0;
104
+ }
105
+ },
106
+ render() {
107
+ const e = arguments[0], {
108
+ renderDefault: t,
109
+ blockTitle: a,
110
+ active: o,
111
+ expand: i,
112
+ toggle: r
113
+ } = this;
114
+ return e("div", {
115
+ class: ["form-block", {
116
+ "default-active": o
117
+ }]
118
+ }, [e("div", {
119
+ class: "form-block-title",
120
+ on: {
121
+ click: r
122
+ }
123
+ }, [e("span", {
124
+ class: "flex-item"
125
+ }, [a]), " ", e("i", {
126
+ class: i ? "el-icon-arrow-down" : "el-icon-arrow-right"
127
+ })]), e("ElCollapseTransition", [e("div", {
128
+ directives: [{
129
+ name: "show",
130
+ value: i
131
+ }]
132
+ }, [t()])])]);
133
+ }
134
+ };
135
+ let m, h;
136
+ const s = {};
137
+ var f = /* @__PURE__ */ n(
138
+ c,
139
+ m,
140
+ h,
141
+ !1,
142
+ u,
143
+ null,
144
+ null,
145
+ null
146
+ );
147
+ function u(e) {
148
+ for (let t in s)
149
+ this[t] = s[t];
150
+ }
151
+ const b = /* @__PURE__ */ function() {
152
+ return f.exports;
153
+ }();
154
+ export {
155
+ b as default
156
+ };
@@ -0,0 +1 @@
1
+ .form-block{padding-bottom:10px;background-color:#fff}.form-block-title{display:flex;flex-direction:row;align-items:center;height:30px;margin:0 0 10px;padding:0 10px;color:#333;font-weight:700;font-size:14px;line-height:30px;background-color:#f3f5fb;cursor:pointer}
@@ -0,0 +1,99 @@
1
+ var i = Object.defineProperty;
2
+ var a = Object.getOwnPropertySymbols;
3
+ var p = Object.prototype.hasOwnProperty, c = Object.prototype.propertyIsEnumerable;
4
+ var l = (r, e, t) => e in r ? i(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, n = (r, e) => {
5
+ for (var t in e || (e = {}))
6
+ p.call(e, t) && l(r, t, e[t]);
7
+ if (a)
8
+ for (var t of a(e))
9
+ c.call(e, t) && l(r, t, e[t]);
10
+ return r;
11
+ };
12
+ import { f as m } from "../chunks/form-input-mixin.124653d9.mjs";
13
+ import { d, n as f } from "../chunks/index.57f871af.mjs";
14
+ import { XInputTag as _ } from "@web-utils/component";
15
+ import { n as y } from "../chunks/vueComponentNormalizer.446f5dc4.mjs";
16
+ var v = function() {
17
+ var r = this, e = r.$createElement, t = r._self._c || e;
18
+ return t("FormItem", r._b({
19
+ attrs: {
20
+ block: r.block,
21
+ rules: r.computeRules,
22
+ disabled: r.inputDisabled
23
+ },
24
+ scopedSlots: r._u([{
25
+ key: "default",
26
+ fn: function() {
27
+ return [t("XInputTag", r._g(r._b({
28
+ attrs: {
29
+ value: r.value,
30
+ readonly: r.readonly,
31
+ disabled: r.inputDisabled,
32
+ placeholder: r.computePlaceholder,
33
+ "array-mode": r.arrayMode
34
+ },
35
+ on: {
36
+ input: function(o) {
37
+ return r.$emit("input", o);
38
+ }
39
+ }
40
+ }, "XInputTag", r.inputProps, !1), r.listeners))];
41
+ },
42
+ proxy: !0
43
+ }, {
44
+ key: "error",
45
+ fn: function(o) {
46
+ var s = o.error;
47
+ return [r._t("error", null, {
48
+ error: s
49
+ })];
50
+ }
51
+ }, {
52
+ key: "label",
53
+ fn: function() {
54
+ return [r._t("label")];
55
+ },
56
+ proxy: !0
57
+ }], null, !0)
58
+ }, "FormItem", r.formItemProps, !1));
59
+ }, b = [];
60
+ const I = Object.keys(_.props).filter((r) => !["value", "placeholder", "disabled"].includes(r)), h = {
61
+ name: "FormInputTag",
62
+ mixins: [m],
63
+ props: {
64
+ value: [Array, String],
65
+ block: {
66
+ type: Boolean,
67
+ default: !0
68
+ },
69
+ arrayMode: {
70
+ type: Boolean,
71
+ default: !0
72
+ }
73
+ },
74
+ computed: {
75
+ inputProps() {
76
+ return d(n(n({}, f(this.$attrs)), this.$props), I);
77
+ }
78
+ }
79
+ }, u = {};
80
+ var g = /* @__PURE__ */ y(
81
+ h,
82
+ v,
83
+ b,
84
+ !1,
85
+ k,
86
+ null,
87
+ null,
88
+ null
89
+ );
90
+ function k(r) {
91
+ for (let e in u)
92
+ this[e] = u[e];
93
+ }
94
+ const $ = /* @__PURE__ */ function() {
95
+ return g.exports;
96
+ }();
97
+ export {
98
+ $ as default
99
+ };