@fangzhongya/vue-archive 0.0.76 → 0.0.77
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.
- package/dist/node/index.cjs +145 -108
- package/dist/node/index.js +145 -108
- package/dist/packages/components/use/code.cjs +12 -12
- package/dist/packages/components/use/code.d.ts +25 -17
- package/dist/packages/components/use/code.js +92 -92
- package/dist/packages/components/use/edit.cjs +5 -5
- package/dist/packages/components/use/edit.js +63 -63
- package/dist/packages/components/use/retrie/any/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/any/index.vue.js +27 -49
- package/dist/packages/components/use/retrie/choice/index.d.ts +33 -2
- package/dist/packages/components/use/retrie/choice/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/choice/index.vue.js +24 -27
- package/dist/packages/components/use/retrie/input/editor/editor.cjs +1 -1
- package/dist/packages/components/use/retrie/input/editor/editor.js +50 -29
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.cjs +416 -0
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.d.ts +2 -0
- package/dist/packages/components/use/retrie/input/editor/getExtraLib.js +427 -0
- package/dist/packages/components/use/retrie/other/index.d.ts +13 -12
- package/dist/packages/components/use/retrie/other/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/other/index.vue.js +1 -1
- package/dist/packages/components/use/retrie/select/index.d.ts +33 -2
- package/dist/packages/components/use/retrie/select/index.vue.cjs +1 -1
- package/dist/packages/components/use/retrie/select/index.vue.js +26 -26
- package/dist/packages/components/use/util.cjs +3 -3
- package/dist/packages/components/use/util.d.ts +23 -25
- package/dist/packages/components/use/util.js +161 -136
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as d from "vue";
|
|
2
|
-
import { defineComponent as h, defineAsyncComponent as C, resolveComponent as g, h as
|
|
2
|
+
import { defineComponent as h, defineAsyncComponent as C, resolveComponent as g, h as n, ref as x, onMounted as b } from "vue";
|
|
3
3
|
import j from "./code.vue.js";
|
|
4
|
-
import
|
|
4
|
+
import f from "./retrie/input/index.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
6
|
import H from "./effect.vue.js";
|
|
7
7
|
import { prettierHtml as $, prettierJs as k, prettierCss as V } from "./util.js";
|
|
@@ -25,24 +25,24 @@ const U = h({
|
|
|
25
25
|
vueHtml: ""
|
|
26
26
|
};
|
|
27
27
|
},
|
|
28
|
-
setup(
|
|
29
|
-
function
|
|
30
|
-
const c = document.getElementsByTagName("head")[0], r = "data-vite-dev-id",
|
|
28
|
+
setup(u) {
|
|
29
|
+
function v(s) {
|
|
30
|
+
const c = document.getElementsByTagName("head")[0], r = "data-vite-dev-id", o = s + ".css", l = c.querySelector(`style[${r}="${o}"]`);
|
|
31
31
|
if (l)
|
|
32
32
|
return l;
|
|
33
33
|
{
|
|
34
34
|
let e = document.createElement("style");
|
|
35
|
-
return e.appendChild(document.createTextNode("")), e.setAttribute("type", "text/css"), e.setAttribute(r,
|
|
35
|
+
return e.appendChild(document.createTextNode("")), e.setAttribute("type", "text/css"), e.setAttribute(r, o), c.appendChild(e), e;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
async function
|
|
39
|
-
const
|
|
38
|
+
async function a(s, c = "", r) {
|
|
39
|
+
const o = [], l = u.value?.name;
|
|
40
40
|
let e = "";
|
|
41
41
|
Object.keys(d).forEach((y) => {
|
|
42
|
-
c.includes(y + "(") &&
|
|
43
|
-
}),
|
|
42
|
+
c.includes(y + "(") && o.push(y);
|
|
43
|
+
}), o.length > 0 && (e = `import { ${o.join(" , ")} } from 'vue';`);
|
|
44
44
|
let m = `<template>
|
|
45
|
-
${
|
|
45
|
+
${s}
|
|
46
46
|
</template>`;
|
|
47
47
|
m = await $(m);
|
|
48
48
|
let p = `${e}
|
|
@@ -61,93 +61,93 @@ ${r}
|
|
|
61
61
|
</style>
|
|
62
62
|
`;
|
|
63
63
|
}
|
|
64
|
-
function i(
|
|
64
|
+
function i(s, c, r) {
|
|
65
65
|
try {
|
|
66
|
-
const
|
|
66
|
+
const o = Object.keys(d);
|
|
67
67
|
return new Function(
|
|
68
68
|
"props",
|
|
69
69
|
"ctx",
|
|
70
70
|
"vue",
|
|
71
71
|
` "use strict";
|
|
72
|
-
const { ${
|
|
73
|
-
${
|
|
72
|
+
const { ${o.join(",")} } = vue;
|
|
73
|
+
${s}; `
|
|
74
74
|
)(c, r, d);
|
|
75
|
-
} catch (
|
|
76
|
-
console.error("Code block execution failed:",
|
|
75
|
+
} catch (o) {
|
|
76
|
+
console.error("Code block execution failed:", o);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
const
|
|
79
|
+
const t = x(null);
|
|
80
80
|
return b(() => {
|
|
81
|
-
|
|
81
|
+
t.value = v(u.value?.key);
|
|
82
82
|
}), {
|
|
83
|
-
getHmtlVue:
|
|
83
|
+
getHmtlVue: a,
|
|
84
84
|
getCodeBlock: i,
|
|
85
|
-
style:
|
|
85
|
+
style: t
|
|
86
86
|
};
|
|
87
87
|
},
|
|
88
|
-
render(
|
|
89
|
-
const
|
|
88
|
+
render(u, v, a, i, t) {
|
|
89
|
+
const s = a.value || {};
|
|
90
90
|
let c = "div";
|
|
91
|
-
|
|
91
|
+
s.component ? c = C(s.component) : s.name && (c = g(s.name));
|
|
92
92
|
const r = {};
|
|
93
|
-
r[
|
|
94
|
-
const
|
|
93
|
+
r[s.name] = c;
|
|
94
|
+
const o = async () => {
|
|
95
95
|
const e = await i.getHmtlVue(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
96
|
+
t.template,
|
|
97
|
+
t.script,
|
|
98
|
+
t.style
|
|
99
99
|
);
|
|
100
|
-
|
|
100
|
+
t.vueHtml = e;
|
|
101
101
|
}, l = () => {
|
|
102
|
-
i.style.innerHTML =
|
|
102
|
+
i.style.innerHTML = t.style, o();
|
|
103
103
|
};
|
|
104
|
-
return
|
|
104
|
+
return n(
|
|
105
105
|
"div",
|
|
106
106
|
{
|
|
107
107
|
class: "code-edit"
|
|
108
108
|
},
|
|
109
109
|
[
|
|
110
|
-
|
|
110
|
+
n(
|
|
111
111
|
"div",
|
|
112
112
|
{
|
|
113
113
|
class: "edit-effect use"
|
|
114
114
|
},
|
|
115
115
|
[
|
|
116
|
-
|
|
116
|
+
n(
|
|
117
117
|
H,
|
|
118
118
|
{
|
|
119
119
|
class: "use-component"
|
|
120
120
|
},
|
|
121
121
|
{
|
|
122
|
-
default: () =>
|
|
122
|
+
default: () => n(
|
|
123
123
|
h({
|
|
124
124
|
components: r,
|
|
125
125
|
setup(e, m) {
|
|
126
126
|
return i.getCodeBlock(
|
|
127
|
-
|
|
127
|
+
t.script,
|
|
128
128
|
e,
|
|
129
129
|
m
|
|
130
130
|
);
|
|
131
131
|
},
|
|
132
|
-
template:
|
|
132
|
+
template: t.template || "<div></div>"
|
|
133
133
|
})
|
|
134
134
|
)
|
|
135
135
|
}
|
|
136
136
|
),
|
|
137
|
-
|
|
138
|
-
html:
|
|
139
|
-
name:
|
|
140
|
-
onRefresh:
|
|
137
|
+
n(j, {
|
|
138
|
+
html: t.vueHtml,
|
|
139
|
+
name: s.name + "_edit",
|
|
140
|
+
onRefresh: o
|
|
141
141
|
})
|
|
142
142
|
]
|
|
143
143
|
),
|
|
144
|
-
|
|
144
|
+
n(
|
|
145
145
|
"div",
|
|
146
146
|
{
|
|
147
147
|
class: "edit-input"
|
|
148
148
|
},
|
|
149
149
|
[
|
|
150
|
-
|
|
150
|
+
n(
|
|
151
151
|
"div",
|
|
152
152
|
{
|
|
153
153
|
class: "but-div",
|
|
@@ -155,50 +155,50 @@ ${r}
|
|
|
155
155
|
},
|
|
156
156
|
"运行"
|
|
157
157
|
),
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
n("div", {}, [
|
|
159
|
+
n("div", {}, "template"),
|
|
160
|
+
n(
|
|
161
161
|
"div",
|
|
162
162
|
{},
|
|
163
|
-
|
|
163
|
+
n(f, {
|
|
164
164
|
format: "html",
|
|
165
165
|
check: (e) => e,
|
|
166
|
-
options: [
|
|
167
|
-
modelValue:
|
|
166
|
+
options: [s.name],
|
|
167
|
+
modelValue: t.template,
|
|
168
168
|
"onUpdate:modelValue": async (e) => {
|
|
169
|
-
|
|
169
|
+
t.template = e, t.template = await $(e);
|
|
170
170
|
}
|
|
171
171
|
})
|
|
172
172
|
)
|
|
173
173
|
]),
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
n("div", {}, [
|
|
175
|
+
n("div", {}, "script"),
|
|
176
|
+
n("div", {}, "setup(props, ctx)"),
|
|
177
|
+
n(
|
|
178
178
|
"div",
|
|
179
179
|
{},
|
|
180
|
-
|
|
180
|
+
n(f, {
|
|
181
181
|
format: "js",
|
|
182
182
|
check: (e) => e,
|
|
183
183
|
options: ["props", "ctx"],
|
|
184
|
-
modelValue:
|
|
184
|
+
modelValue: t.script,
|
|
185
185
|
"onUpdate:modelValue": async (e) => {
|
|
186
|
-
|
|
186
|
+
t.script = e, t.script = await k(e);
|
|
187
187
|
}
|
|
188
188
|
})
|
|
189
189
|
)
|
|
190
190
|
]),
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
191
|
+
n("div", {}, [
|
|
192
|
+
n("div", {}, "style"),
|
|
193
|
+
n(
|
|
194
194
|
"div",
|
|
195
195
|
{},
|
|
196
|
-
|
|
196
|
+
n(f, {
|
|
197
197
|
format: "css",
|
|
198
198
|
check: (e) => e,
|
|
199
|
-
modelValue:
|
|
199
|
+
modelValue: t.style,
|
|
200
200
|
"onUpdate:modelValue": async (e) => {
|
|
201
|
-
|
|
201
|
+
t.style = e, t.style = await V(e);
|
|
202
202
|
}
|
|
203
203
|
})
|
|
204
204
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const
|
|
1
|
+
"use strict";const t=require("vue"),p=require("../../util.cjs"),v=require("../form/index.vue.cjs"),y=require("../select/index.vue.cjs");;/* empty css */const V={class:"form-any"},h=t.defineComponent({__name:"index",props:{selects:{type:Object,default(){return{}}},config:{type:Object,default(){return{}}},modelValue:{type:null}},emits:["change"],setup(f,{emit:d}){const o=f,r=t.ref([]),u=t.ref({}),m=d,s=t.ref(""),c=[{label:"string",prop:"string"},{label:"boolean",prop:"boolean"},{label:"number",prop:"number"},{label:"array",prop:"array"},{label:"object",prop:"object"},{label:"function",prop:"function"},{label:"其他",prop:""}];t.watch(()=>o.modelValue,()=>{_()},{immediate:!0});function i(e,l){let a=Object.assign({},o.config);l?a.type=l:a.type=e,a.dataType=r.value,u.value=a}function _(){let e=[];const l=o.config.dataType||[];l&&l.length>0?(e=l.map(n=>typeof n=="string"?{label:n,prop:n.toLowerCase()}:{label:n.label,prop:p.getDataTypeType([n])}),e.map(n=>n.prop).includes("any")&&(e=[...c])):e=[...c],r.value=e,i(e[0].prop,p.isDefaultType(o.modelValue)),s.value=o.modelValue}function b(e){i(e),s.value=""}function g(...e){m("change",...e)}return(e,l)=>(t.openBlock(),t.createElementBlock("div",V,[t.createElementVNode("div",null,[t.createVNode(y,{noValue:"",onChange:b,modelValue:u.value.type,list:r.value},null,8,["modelValue","list"])]),t.createVNode(v,{config:u.value,selects:o.selects,modelValue:s.value,onChange:g},null,8,["config","selects","modelValue"])]))}});module.exports=h;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { defineComponent as V, ref as s, watch as _, createElementBlock as v, openBlock as h, createElementVNode as j, createVNode as u } from "vue";
|
|
2
|
+
import { getDataTypeType as T, isDefaultType as C } from "../../util.js";
|
|
3
|
+
import x from "../form/index.vue.js";
|
|
4
4
|
import O from "../select/index.vue.js";
|
|
5
5
|
/* empty css */
|
|
6
|
-
const k = { class: "form-any" },
|
|
6
|
+
const k = { class: "form-any" }, N = /* @__PURE__ */ V({
|
|
7
7
|
__name: "index",
|
|
8
8
|
props: {
|
|
9
9
|
/**
|
|
@@ -29,8 +29,8 @@ const k = { class: "form-any" }, D = /* @__PURE__ */ h({
|
|
|
29
29
|
}
|
|
30
30
|
},
|
|
31
31
|
emits: ["change"],
|
|
32
|
-
setup(
|
|
33
|
-
const o =
|
|
32
|
+
setup(m, { emit: f }) {
|
|
33
|
+
const o = m, n = s([]), r = s({}), d = f, c = s(""), i = [
|
|
34
34
|
{
|
|
35
35
|
label: "string",
|
|
36
36
|
prop: "string"
|
|
@@ -60,76 +60,54 @@ const k = { class: "form-any" }, D = /* @__PURE__ */ h({
|
|
|
60
60
|
prop: ""
|
|
61
61
|
}
|
|
62
62
|
];
|
|
63
|
-
|
|
63
|
+
_(
|
|
64
64
|
() => o.modelValue,
|
|
65
65
|
() => {
|
|
66
|
-
|
|
66
|
+
b();
|
|
67
67
|
},
|
|
68
68
|
{
|
|
69
69
|
immediate: !0
|
|
70
70
|
}
|
|
71
71
|
);
|
|
72
|
-
function g(e) {
|
|
73
|
-
for (let l = 0; l < a.value.length; l++) {
|
|
74
|
-
const t = a.value[l].prop;
|
|
75
|
-
if (t === e || t.startsWith(e))
|
|
76
|
-
return t;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
72
|
function p(e, l) {
|
|
80
|
-
let
|
|
81
|
-
|
|
82
|
-
const i = g(l);
|
|
83
|
-
i && (e = i);
|
|
84
|
-
}
|
|
85
|
-
let n = w(e);
|
|
86
|
-
t.type = n[0], t.dataType = e, r.value = t;
|
|
73
|
+
let a = Object.assign({}, o.config);
|
|
74
|
+
l ? a.type = l : a.type = e, a.dataType = n.value, r.value = a;
|
|
87
75
|
}
|
|
88
|
-
function
|
|
76
|
+
function b() {
|
|
89
77
|
let e = [];
|
|
90
78
|
const l = o.config.dataType || [];
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
99
|
-
else {
|
|
100
|
-
let t = l[0];
|
|
101
|
-
if (t && t != "any") {
|
|
102
|
-
const n = t.split("<")[0];
|
|
103
|
-
e = [{ label: t, prop: n.toLowerCase() }];
|
|
104
|
-
} else
|
|
105
|
-
e = b;
|
|
106
|
-
}
|
|
107
|
-
a.value = e, p(e[0].prop, x(o.modelValue)), c.value = o.modelValue;
|
|
79
|
+
l && l.length > 0 ? (e = l.map((t) => typeof t == "string" ? {
|
|
80
|
+
label: t,
|
|
81
|
+
prop: t.toLowerCase()
|
|
82
|
+
} : {
|
|
83
|
+
label: t.label,
|
|
84
|
+
prop: T([t])
|
|
85
|
+
}), e.map((t) => t.prop).includes("any") && (e = [...i])) : e = [...i], n.value = e, p(e[0].prop, C(o.modelValue)), c.value = o.modelValue;
|
|
108
86
|
}
|
|
109
|
-
function
|
|
87
|
+
function g(e) {
|
|
110
88
|
p(e), c.value = "";
|
|
111
89
|
}
|
|
112
|
-
function
|
|
90
|
+
function y(...e) {
|
|
113
91
|
d("change", ...e);
|
|
114
92
|
}
|
|
115
|
-
return (e, l) => (
|
|
116
|
-
|
|
93
|
+
return (e, l) => (h(), v("div", k, [
|
|
94
|
+
j("div", null, [
|
|
117
95
|
u(O, {
|
|
118
96
|
noValue: "",
|
|
119
|
-
onChange:
|
|
97
|
+
onChange: g,
|
|
120
98
|
modelValue: r.value.type,
|
|
121
|
-
list:
|
|
99
|
+
list: n.value
|
|
122
100
|
}, null, 8, ["modelValue", "list"])
|
|
123
101
|
]),
|
|
124
|
-
u(
|
|
102
|
+
u(x, {
|
|
125
103
|
config: r.value,
|
|
126
104
|
selects: o.selects,
|
|
127
105
|
modelValue: c.value,
|
|
128
|
-
onChange:
|
|
106
|
+
onChange: y
|
|
129
107
|
}, null, 8, ["config", "selects", "modelValue"])
|
|
130
108
|
]));
|
|
131
109
|
}
|
|
132
110
|
});
|
|
133
111
|
export {
|
|
134
|
-
|
|
112
|
+
N as default
|
|
135
113
|
};
|
|
@@ -1,10 +1,26 @@
|
|
|
1
|
+
import { DataType } from '../../util';
|
|
1
2
|
import { DefineComponent, ExtractPropTypes, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from '../../../../../vue/dist/vue.esm-bundler.js';
|
|
2
3
|
declare const _default: DefineComponent<ExtractPropTypes<{
|
|
3
4
|
modelValue: {
|
|
4
5
|
type: null;
|
|
5
6
|
};
|
|
6
7
|
dataType: {
|
|
7
|
-
type:
|
|
8
|
+
type: {
|
|
9
|
+
(arrayLength: number): DataType[];
|
|
10
|
+
(...items: DataType[]): DataType[];
|
|
11
|
+
new (arrayLength: number): DataType[];
|
|
12
|
+
new (...items: DataType[]): DataType[];
|
|
13
|
+
isArray(arg: any): arg is any[];
|
|
14
|
+
readonly prototype: any[];
|
|
15
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
16
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
17
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
18
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
19
|
+
of<T>(...items: T[]): T[];
|
|
20
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
21
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
22
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
23
|
+
}[];
|
|
8
24
|
};
|
|
9
25
|
disabled: BooleanConstructor;
|
|
10
26
|
list: {
|
|
@@ -25,7 +41,22 @@ declare const _default: DefineComponent<ExtractPropTypes<{
|
|
|
25
41
|
type: null;
|
|
26
42
|
};
|
|
27
43
|
dataType: {
|
|
28
|
-
type:
|
|
44
|
+
type: {
|
|
45
|
+
(arrayLength: number): DataType[];
|
|
46
|
+
(...items: DataType[]): DataType[];
|
|
47
|
+
new (arrayLength: number): DataType[];
|
|
48
|
+
new (...items: DataType[]): DataType[];
|
|
49
|
+
isArray(arg: any): arg is any[];
|
|
50
|
+
readonly prototype: any[];
|
|
51
|
+
from<T>(arrayLike: ArrayLike<T>): T[];
|
|
52
|
+
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
53
|
+
from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
|
|
54
|
+
from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
|
|
55
|
+
of<T>(...items: T[]): T[];
|
|
56
|
+
fromAsync<T>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T | PromiseLike<T>> | ArrayLike<T | PromiseLike<T>>): Promise<T[]>;
|
|
57
|
+
fromAsync<T, U>(iterableOrArrayLike: AsyncIterable<T> | Iterable<T> | ArrayLike<T>, mapFn: (value: Awaited<T>, index: number) => U, thisArg?: any): Promise<Awaited<U>[]>;
|
|
58
|
+
readonly [Symbol.species]: ArrayConstructor;
|
|
59
|
+
}[];
|
|
29
60
|
};
|
|
30
61
|
disabled: BooleanConstructor;
|
|
31
62
|
list: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const e=require("vue");require("@fangzhongya/utils/basic/object/mergeObject");const
|
|
1
|
+
"use strict";const e=require("vue");require("@fangzhongya/utils/basic/object/mergeObject");const C=require("@fangzhongya/utils/basic/array/toggleArray");require("@fangzhongya/utils/name/humpToLine");require("@fangzhongya/utils/name/lineToLargeHump");require("@fangzhongya/utils/basic/string/appearNum");require("@fangzhongya/utils/basic/string/firstLower");require("@fangzhongya/utils/basic/array/duplicateRemoval");require("@fangzhongya/utils/basic/array/asyncMergeArray");require("@fangzhongya/utils/basic/string/firstUpper");require("@fangzhongya/utils/urls/getSuffix");require("@fangzhongya/utils/basic/array/replaceAfter");const v=require("../../util.cjs"),S={class:"form-select"},x=["value","disabled"],A={class:"form-select-list"},T={key:0,class:"form-select-list-div"},j=["onClick"],D={key:1,class:"no-data"},L=e.defineComponent({__name:"index",props:{modelValue:{type:null},dataType:{type:[Array]},disabled:Boolean,list:{type:Array},config:{type:Object,default(){return{label:"label",prop:"prop"}}}},emits:["value","change"],setup(h,{emit:y}){const n=h,g=y,u=e.ref(),a=e.ref(!1),c=e.ref(!1),r=e.ref([]),_=e.computed(()=>r.value.map(t=>d(t)).join(",")),p=e.computed(()=>v.getDataTypeType(n.dataType||[]));e.watch(()=>n.modelValue,()=>{q()},{immediate:!0});function k(t=[]){return p.value=="string"?t.map(l=>v.getString(l)):p.value=="number"?t.map(l=>{let o=Number(l);return isNaN(o)&&(o=0),o}):t}function b(t){return new Function("",`{ return ${t}}`)}function q(){r.value=[];let t=n.modelValue,l=[];const o=b(t);if(o instanceof Array&&(l=o),n.list)for(let s=0;s<n.list.length;s++){const f=n.list[s];l.includes(i(f))&&r.value.push(f)}m()}function d(t){let l=n.config?.label;return l&&typeof t=="object"&&t?t[l]:t}function i(t){let l=n.config?.prop;return l&&typeof t=="object"&&t?t[l]:t}function B(t){return r.value.map(l=>i(l)).includes(i(t))}function w(){n.disabled||(a.value=!0)}function V(){c.value||(a.value=!1)}function E(){c.value=!0}function M(){c.value=!1}function N(t){u.value&&u.value.focus(),r.value=C.toggleArray(r.value,t,n.config.prop),m()}function m(){let t=k(r.value.map(l=>i(l)));g("value",t,JSON.stringify(t))}return(t,l)=>(e.openBlock(),e.createElementBlock("div",S,[e.createElementVNode("input",{value:_.value,readonly:"",placeholder:"请选择",type:"text",disabled:n.disabled,ref_key:"refInput",ref:u,onClick:e.withModifiers(w,["stop"]),onBlur:e.withModifiers(V,["stop"])},null,40,x),e.createElementVNode("div",{onMousemove:e.withModifiers(E,["stop"]),onMouseout:e.withModifiers(M,["stop"]),class:"form-select-box"},[e.withDirectives(e.createElementVNode("div",A,[n.list&&n.list.length>0?(e.openBlock(),e.createElementBlock("div",T,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.list,(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["form-select-list-li",{active:B(o)}]),onClick:e.withModifiers(f=>N(o),["stop"])},[e.createElementVNode("span",null,e.toDisplayString(d(o)),1)],10,j))),256))])):(e.openBlock(),e.createElementBlock("div",D,"暂无数据"))],512),[[e.vShow,a.value]])],32)]))}});module.exports=L;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as D, ref as c, computed as _, watch as L, createElementBlock as i, openBlock as r, createElementVNode as p, withModifiers as s, withDirectives as z, Fragment as E, renderList as F, normalizeClass as I, toDisplayString as O, vShow as $ } from "vue";
|
|
2
2
|
import "@fangzhongya/utils/basic/object/mergeObject";
|
|
3
3
|
import { toggleArray as J } from "@fangzhongya/utils/basic/array/toggleArray";
|
|
4
4
|
import "@fangzhongya/utils/name/humpToLine";
|
|
@@ -10,20 +10,20 @@ import "@fangzhongya/utils/basic/array/asyncMergeArray";
|
|
|
10
10
|
import "@fangzhongya/utils/basic/string/firstUpper";
|
|
11
11
|
import "@fangzhongya/utils/urls/getSuffix";
|
|
12
12
|
import "@fangzhongya/utils/basic/array/replaceAfter";
|
|
13
|
-
import {
|
|
13
|
+
import { getDataTypeType as P, getString as q } from "../../util.js";
|
|
14
14
|
const G = { class: "form-select" }, H = ["value", "disabled"], K = { class: "form-select-list" }, Q = {
|
|
15
15
|
key: 0,
|
|
16
16
|
class: "form-select-list-div"
|
|
17
17
|
}, R = ["onClick"], U = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "no-data"
|
|
20
|
-
}, ae = /* @__PURE__ */
|
|
20
|
+
}, ae = /* @__PURE__ */ D({
|
|
21
21
|
__name: "index",
|
|
22
22
|
props: {
|
|
23
23
|
modelValue: {
|
|
24
24
|
type: null
|
|
25
25
|
},
|
|
26
|
-
dataType: { type: [
|
|
26
|
+
dataType: { type: [Array] },
|
|
27
27
|
disabled: Boolean,
|
|
28
28
|
list: {
|
|
29
29
|
type: Array
|
|
@@ -40,11 +40,8 @@ const G = { class: "form-select" }, H = ["value", "disabled"], K = { class: "for
|
|
|
40
40
|
},
|
|
41
41
|
emits: ["value", "change"],
|
|
42
42
|
setup(b, { emit: k }) {
|
|
43
|
-
const o = b,
|
|
44
|
-
|
|
45
|
-
return (P(e) || [])[1];
|
|
46
|
-
});
|
|
47
|
-
z(
|
|
43
|
+
const o = b, V = k, f = c(), m = c(!1), d = c(!1), l = c([]), w = _(() => l.value.map((e) => g(e)).join(",")), y = _(() => P(o.dataType || []));
|
|
44
|
+
L(
|
|
48
45
|
() => o.modelValue,
|
|
49
46
|
() => {
|
|
50
47
|
x();
|
|
@@ -53,19 +50,19 @@ const G = { class: "form-select" }, H = ["value", "disabled"], K = { class: "for
|
|
|
53
50
|
immediate: !0
|
|
54
51
|
}
|
|
55
52
|
);
|
|
56
|
-
function
|
|
57
|
-
return
|
|
53
|
+
function C(e = []) {
|
|
54
|
+
return y.value == "string" ? e.map((t) => q(t)) : y.value == "number" ? e.map((t) => {
|
|
58
55
|
let n = Number(t);
|
|
59
56
|
return isNaN(n) && (n = 0), n;
|
|
60
57
|
}) : e;
|
|
61
58
|
}
|
|
62
|
-
function
|
|
59
|
+
function S(e) {
|
|
63
60
|
return new Function("", `{ return ${e}}`);
|
|
64
61
|
}
|
|
65
62
|
function x() {
|
|
66
63
|
l.value = [];
|
|
67
64
|
let e = o.modelValue, t = [];
|
|
68
|
-
const n =
|
|
65
|
+
const n = S(e);
|
|
69
66
|
if (n instanceof Array && (t = n), o.list)
|
|
70
67
|
for (let a = 0; a < o.list.length; a++) {
|
|
71
68
|
const v = o.list[a];
|
|
@@ -73,7 +70,7 @@ const G = { class: "form-select" }, H = ["value", "disabled"], K = { class: "for
|
|
|
73
70
|
}
|
|
74
71
|
h();
|
|
75
72
|
}
|
|
76
|
-
function
|
|
73
|
+
function g(e) {
|
|
77
74
|
let t = o.config?.label;
|
|
78
75
|
return t && typeof e == "object" && e ? e[t] : e;
|
|
79
76
|
}
|
|
@@ -93,21 +90,21 @@ const G = { class: "form-select" }, H = ["value", "disabled"], K = { class: "for
|
|
|
93
90
|
function N() {
|
|
94
91
|
d.value = !0;
|
|
95
92
|
}
|
|
96
|
-
function
|
|
93
|
+
function T() {
|
|
97
94
|
d.value = !1;
|
|
98
95
|
}
|
|
99
|
-
function
|
|
96
|
+
function j(e) {
|
|
100
97
|
f.value && f.value.focus(), l.value = J(l.value, e, o.config.prop), h();
|
|
101
98
|
}
|
|
102
99
|
function h() {
|
|
103
|
-
let e =
|
|
100
|
+
let e = C(
|
|
104
101
|
l.value.map((t) => u(t))
|
|
105
102
|
);
|
|
106
|
-
|
|
103
|
+
V("value", e, JSON.stringify(e));
|
|
107
104
|
}
|
|
108
|
-
return (e, t) => (
|
|
105
|
+
return (e, t) => (r(), i("div", G, [
|
|
109
106
|
p("input", {
|
|
110
|
-
value:
|
|
107
|
+
value: w.value,
|
|
111
108
|
readonly: "",
|
|
112
109
|
placeholder: "请选择",
|
|
113
110
|
type: "text",
|
|
@@ -119,20 +116,20 @@ const G = { class: "form-select" }, H = ["value", "disabled"], K = { class: "for
|
|
|
119
116
|
}, null, 40, H),
|
|
120
117
|
p("div", {
|
|
121
118
|
onMousemove: s(N, ["stop"]),
|
|
122
|
-
onMouseout: s(
|
|
119
|
+
onMouseout: s(T, ["stop"]),
|
|
123
120
|
class: "form-select-box"
|
|
124
121
|
}, [
|
|
125
|
-
|
|
126
|
-
o.list && o.list.length > 0 ? (
|
|
127
|
-
(
|
|
122
|
+
z(p("div", K, [
|
|
123
|
+
o.list && o.list.length > 0 ? (r(), i("div", Q, [
|
|
124
|
+
(r(!0), i(E, null, F(o.list, (n, a) => (r(), i("div", {
|
|
128
125
|
class: I(["form-select-list-li", {
|
|
129
126
|
active: A(n)
|
|
130
127
|
}]),
|
|
131
|
-
onClick: s((v) =>
|
|
128
|
+
onClick: s((v) => j(n), ["stop"])
|
|
132
129
|
}, [
|
|
133
|
-
p("span", null, O(
|
|
130
|
+
p("span", null, O(g(n)), 1)
|
|
134
131
|
], 10, R))), 256))
|
|
135
|
-
])) : (
|
|
132
|
+
])) : (r(), i("div", U, "暂无数据"))
|
|
136
133
|
], 512), [
|
|
137
134
|
[$, m.value]
|
|
138
135
|
])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("monaco-editor"),o=require("monaco-editor/esm/vs/editor/editor.api"),g=require("vue"),l=require("./getExtraLib.cjs");function c(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const n=c(u),m=c(g),i={theme:"vs",value:""},p=(e=[])=>({provideCompletionItems:(r,t)=>({suggestions:e.map(s=>({label:s,kind:n.languages.CompletionItemKind.Text,insertText:"<"+s+">${1:}</"+s+">",insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,detail:s+"组件",range:new n.Range(t.lineNumber,t.column-1,t.lineNumber,t.column)}))}),triggerCharacters:["<","$"]});function d(e){return["props","ctx"].includes(e)?e+".${1:}":e+"(${1:})"}const f=(e=[])=>(e&&e.length>0&&(e=["props","ctx",...Object.keys(m)]),{provideCompletionItems:(r,t)=>({suggestions:e.map(s=>({label:s,kind:n.languages.CompletionItemKind.Text,insertText:d(s),insertTextRules:n.languages.CompletionItemInsertTextRule.InsertAsSnippet,detail:s+"方法",range:new n.Range(t.lineNumber,t.column-1,t.lineNumber,t.column)}))}),triggerCharacters:["$"]});function b(e,r,t="typescript"){const a=n.Uri.parse(`file:///editor-${Date.now()}.ts`),s=n.editor.createModel(r,t,a);return n.editor.create(e,{...i,value:r,model:s,language:t,minimap:{enabled:!1},theme:"vs",fontSize:14,lineNumbers:"on",roundedSelection:!1,scrollBeyondLastLine:!1,automaticLayout:!0})}function y(e,r,t){if(o.languages.typescript.typescriptDefaults.setEagerModelSync(!0),t&&t?.length>0){const a=f(t);o.languages.registerCompletionItemProvider("typescript",a),o.languages.typescript.typescriptDefaults.setExtraLibs([]),o.languages.typescript.typescriptDefaults.addExtraLib(l.getGlobals(),"globals.d.ts"),o.languages.typescript.typescriptDefaults.addExtraLib(l.getVue(),"vue.d.ts")}return b(e,r,"typescript")}function v(e,r,t){const a=p(t);return o.languages.registerCompletionItemProvider("html",a),n.editor.create(e,{...i,value:r,language:"html"})}function x(e,r,t){return n.editor.create(e,{...i,value:r,language:"json"})}function I(e,r,t){return n.editor.create(e,{...i,value:r,language:"css"})}exports.getCss=I;exports.getHtml=v;exports.getJs=y;exports.getJson=x;
|