@fangzhongya/page 0.0.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.
Files changed (53) hide show
  1. package/README.md +11 -0
  2. package/dist/array-BVDKMOD7.cjs +56 -0
  3. package/dist/array-DF5dKg_I.js +56 -0
  4. package/dist/boolean-CRnQP8xw.cjs +53 -0
  5. package/dist/boolean-_6yy8HAk.js +53 -0
  6. package/dist/button-editor-CAoFo90o.cjs +130 -0
  7. package/dist/button-editor-CcDUGH-p.js +131 -0
  8. package/dist/choice-C2EtQx15.cjs +92 -0
  9. package/dist/choice-Da0KhSqy.js +92 -0
  10. package/dist/class-D4wqwdp6.cjs +69 -0
  11. package/dist/class-DEhbKupu.js +69 -0
  12. package/dist/code-ByDX8VyE.js +57 -0
  13. package/dist/code-D_c8L97a.cjs +57 -0
  14. package/dist/codes-JsogPxe_.js +240 -0
  15. package/dist/codes-SsHelxy1.cjs +240 -0
  16. package/dist/codes.css +28 -0
  17. package/dist/color-BkNnjOah.js +53 -0
  18. package/dist/color-C_tr4O7e.cjs +53 -0
  19. package/dist/editor-BYMhYIRN.cjs +62 -0
  20. package/dist/editor-DalhYR-Q.js +62 -0
  21. package/dist/emits-BMijilxI.cjs +81 -0
  22. package/dist/emits-Bw0lbdTu.cjs +36 -0
  23. package/dist/emits-Dbd3qZ6W.js +81 -0
  24. package/dist/emits-KNWePDCi.js +36 -0
  25. package/dist/general-CSPNay-X.cjs +54 -0
  26. package/dist/general-CxOdXWgx.js +54 -0
  27. package/dist/icon-CLpX27eC.js +58 -0
  28. package/dist/icon-Dsqcps7B.cjs +58 -0
  29. package/dist/index-C5atHkSE.cjs +76210 -0
  30. package/dist/index-wb1Ag0of.js +76211 -0
  31. package/dist/index.cjs +9 -0
  32. package/dist/index.css +258 -0
  33. package/dist/index.js +9 -0
  34. package/dist/number-BmVW8K_E.js +69 -0
  35. package/dist/number-sHlMr3LR.cjs +69 -0
  36. package/dist/object-Bb9KeI-8.cjs +56 -0
  37. package/dist/object-vWWUhwjq.js +56 -0
  38. package/dist/page-COadbdNM.js +3002 -0
  39. package/dist/page-DEhMa4kp.cjs +3001 -0
  40. package/dist/page.cjs +5 -0
  41. package/dist/page.js +5 -0
  42. package/dist/props-CQPBTWY-.cjs +387 -0
  43. package/dist/props-DDXfZarK.js +387 -0
  44. package/dist/props.css +29 -0
  45. package/dist/slots-DTHucbpJ.js +139 -0
  46. package/dist/slots-DixInFAv.cjs +139 -0
  47. package/dist/string-Cb09VE7i.cjs +54 -0
  48. package/dist/string-XxsCUm0A.js +54 -0
  49. package/dist/style-2VtVKyIu.cjs +81 -0
  50. package/dist/style-Bj6ckwYY.js +69 -0
  51. package/dist/style-CARwnhEM.js +81 -0
  52. package/dist/style-CZJA2xg_.cjs +69 -0
  53. package/package.json +83 -0
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # fang-page
2
+
3
+ 页面设计
4
+
5
+ <!-- vue-ts-responsive-grid-layout -->
6
+
7
+ 最小化
8
+
9
+ 支持 直接编辑 原生div的元素的h()对象编辑
10
+
11
+ ref
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index$1 = require("@fangzhongya/fang-ui/components/edit-data/index");
4
+ require("@fangzhongya/fang-ui/components/edit-data/style/index2.scss");
5
+ const require$$0 = require("vue");
6
+ const index = require("./index-C5atHkSE.cjs");
7
+ const _sfc_main = /* @__PURE__ */ require$$0.defineComponent({
8
+ __name: "array",
9
+ props: {
10
+ /**
11
+ * 设置的值
12
+ */
13
+ prop: { type: String, default: "" },
14
+ config: {
15
+ type: Object,
16
+ default() {
17
+ return {};
18
+ }
19
+ },
20
+ /**
21
+ * 名称
22
+ */
23
+ label: String,
24
+ /**
25
+ * 值对象
26
+ */
27
+ modelValue: {
28
+ type: Object,
29
+ default() {
30
+ return {};
31
+ }
32
+ }
33
+ },
34
+ emits: ["blur"],
35
+ setup(__props, { emit: __emit }) {
36
+ const props = __props;
37
+ const emit = __emit;
38
+ return (_ctx, _cache) => {
39
+ const _component_EditData = index$1.EditData;
40
+ return require$$0.openBlock(), require$$0.createBlock(index._sfc_main, require$$0.normalizeProps(require$$0.guardReactiveProps(props)), {
41
+ default: require$$0.withCtx(() => [
42
+ require$$0.createVNode(_component_EditData, {
43
+ isJson: "",
44
+ isConfirmUpdate: "",
45
+ type: __props.config.type,
46
+ modelValue: props.modelValue[props.prop],
47
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue[props.prop] = $event),
48
+ onBlur: _cache[1] || (_cache[1] = () => emit("blur"))
49
+ }, null, 8, ["type", "modelValue"])
50
+ ]),
51
+ _: 1
52
+ }, 16);
53
+ };
54
+ }
55
+ });
56
+ exports.default = _sfc_main;
@@ -0,0 +1,56 @@
1
+ import { EditData } from "@fangzhongya/fang-ui/components/edit-data/index";
2
+ import "@fangzhongya/fang-ui/components/edit-data/style/index2.scss";
3
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createVNode } from "vue";
4
+ import { _ as _sfc_main$1 } from "./index-wb1Ag0of.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "array",
7
+ props: {
8
+ /**
9
+ * 设置的值
10
+ */
11
+ prop: { type: String, default: "" },
12
+ config: {
13
+ type: Object,
14
+ default() {
15
+ return {};
16
+ }
17
+ },
18
+ /**
19
+ * 名称
20
+ */
21
+ label: String,
22
+ /**
23
+ * 值对象
24
+ */
25
+ modelValue: {
26
+ type: Object,
27
+ default() {
28
+ return {};
29
+ }
30
+ }
31
+ },
32
+ emits: ["blur"],
33
+ setup(__props, { emit: __emit }) {
34
+ const props = __props;
35
+ const emit = __emit;
36
+ return (_ctx, _cache) => {
37
+ const _component_EditData = EditData;
38
+ return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(props)), {
39
+ default: withCtx(() => [
40
+ createVNode(_component_EditData, {
41
+ isJson: "",
42
+ isConfirmUpdate: "",
43
+ type: __props.config.type,
44
+ modelValue: props.modelValue[props.prop],
45
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue[props.prop] = $event),
46
+ onBlur: _cache[1] || (_cache[1] = () => emit("blur"))
47
+ }, null, 8, ["type", "modelValue"])
48
+ ]),
49
+ _: 1
50
+ }, 16);
51
+ };
52
+ }
53
+ });
54
+ export {
55
+ _sfc_main as default
56
+ };
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const index$1 = require("@fangzhongya/fang-ui/components/switch/index");
4
+ require("@fangzhongya/fang-ui/components/switch/style/index2.scss");
5
+ const require$$0 = require("vue");
6
+ const index = require("./index-C5atHkSE.cjs");
7
+ const _sfc_main = /* @__PURE__ */ require$$0.defineComponent({
8
+ __name: "boolean",
9
+ props: {
10
+ /**
11
+ * 设置的值
12
+ */
13
+ prop: { type: String, default: "" },
14
+ config: {
15
+ type: Object,
16
+ default() {
17
+ return {};
18
+ }
19
+ },
20
+ /**
21
+ * 名称
22
+ */
23
+ label: String,
24
+ /**
25
+ * 值对象
26
+ */
27
+ modelValue: {
28
+ type: Object,
29
+ default() {
30
+ return {};
31
+ }
32
+ }
33
+ },
34
+ emits: ["blur"],
35
+ setup(__props, { emit: __emit }) {
36
+ const props = __props;
37
+ const emit = __emit;
38
+ return (_ctx, _cache) => {
39
+ const _component_Switch = index$1.Switch;
40
+ return require$$0.openBlock(), require$$0.createBlock(index._sfc_main, require$$0.normalizeProps(require$$0.guardReactiveProps(props)), {
41
+ default: require$$0.withCtx(() => [
42
+ require$$0.createVNode(_component_Switch, require$$0.mergeProps(props.config?.config, {
43
+ modelValue: props.modelValue[props.prop],
44
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue[props.prop] = $event),
45
+ onBlur: _cache[1] || (_cache[1] = () => emit("blur"))
46
+ }), null, 16, ["modelValue"])
47
+ ]),
48
+ _: 1
49
+ }, 16);
50
+ };
51
+ }
52
+ });
53
+ exports.default = _sfc_main;
@@ -0,0 +1,53 @@
1
+ import { Switch } from "@fangzhongya/fang-ui/components/switch/index";
2
+ import "@fangzhongya/fang-ui/components/switch/style/index2.scss";
3
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, mergeProps } from "vue";
4
+ import { _ as _sfc_main$1 } from "./index-wb1Ag0of.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "boolean",
7
+ props: {
8
+ /**
9
+ * 设置的值
10
+ */
11
+ prop: { type: String, default: "" },
12
+ config: {
13
+ type: Object,
14
+ default() {
15
+ return {};
16
+ }
17
+ },
18
+ /**
19
+ * 名称
20
+ */
21
+ label: String,
22
+ /**
23
+ * 值对象
24
+ */
25
+ modelValue: {
26
+ type: Object,
27
+ default() {
28
+ return {};
29
+ }
30
+ }
31
+ },
32
+ emits: ["blur"],
33
+ setup(__props, { emit: __emit }) {
34
+ const props = __props;
35
+ const emit = __emit;
36
+ return (_ctx, _cache) => {
37
+ const _component_Switch = Switch;
38
+ return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(props)), {
39
+ default: withCtx(() => [
40
+ createVNode(_component_Switch, mergeProps(props.config?.config, {
41
+ modelValue: props.modelValue[props.prop],
42
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue[props.prop] = $event),
43
+ onBlur: _cache[1] || (_cache[1] = () => emit("blur"))
44
+ }), null, 16, ["modelValue"])
45
+ ]),
46
+ _: 1
47
+ }, 16);
48
+ };
49
+ }
50
+ });
51
+ export {
52
+ _sfc_main as default
53
+ };
@@ -0,0 +1,130 @@
1
+ "use strict";
2
+ const index$1 = require("@fangzhongya/fang-ui/components/button/index");
3
+ require("@fangzhongya/fang-ui/components/button/style/index2.scss");
4
+ const require$$0 = require("vue");
5
+ const index = require("./index-C5atHkSE.cjs");
6
+ const _sfc_main = /* @__PURE__ */ require$$0.defineComponent({
7
+ __name: "button-editor",
8
+ props: {
9
+ prop: {
10
+ type: String
11
+ },
12
+ // 需要编辑的数据
13
+ modelValue: {
14
+ type: [String, Function, Object, Array]
15
+ },
16
+ // 弹框标题
17
+ title: {
18
+ type: String,
19
+ default: "编辑器"
20
+ },
21
+ // 数据的默认的配置
22
+ config: {
23
+ type: [Object, String],
24
+ default() {
25
+ return {};
26
+ }
27
+ },
28
+ // 数据类型
29
+ type: {
30
+ type: String
31
+ },
32
+ // 头展示数据
33
+ top: {
34
+ type: String
35
+ },
36
+ but: {
37
+ type: [Number, String]
38
+ },
39
+ nobox: {
40
+ type: Boolean
41
+ }
42
+ },
43
+ emits: ["update:modelValue", "submit"],
44
+ setup(__props, { expose: __expose, emit: __emit }) {
45
+ const cs = index.getClass("editor-button");
46
+ const props = __props;
47
+ const emit = __emit;
48
+ const editorObj = require$$0.inject("editor");
49
+ function submit(v) {
50
+ if (v) {
51
+ emit("update:modelValue", v);
52
+ emit("submit", v);
53
+ } else {
54
+ emit("update:modelValue", void 0);
55
+ emit("submit", void 0);
56
+ }
57
+ }
58
+ function setBox() {
59
+ require$$0.nextTick(() => {
60
+ if (editorObj) {
61
+ Object.keys(props).forEach((v) => {
62
+ editorObj[v] = props[v] || "";
63
+ });
64
+ editorObj.value = props.modelValue;
65
+ editorObj.submit = submit;
66
+ editorObj.box = true;
67
+ }
68
+ });
69
+ }
70
+ function onClick() {
71
+ if (!props.nobox) {
72
+ setBox();
73
+ }
74
+ }
75
+ __expose({
76
+ setBox
77
+ });
78
+ return (_ctx, _cache) => {
79
+ const _component_Button = index$1.Button;
80
+ return require$$0.openBlock(), require$$0.createElementBlock("div", {
81
+ class: require$$0.normalizeClass(require$$0.unref(cs)()),
82
+ onClick: _cache[0] || (_cache[0] = require$$0.withModifiers(($event) => onClick(), ["stop"]))
83
+ }, [
84
+ require$$0.renderSlot(_ctx.$slots, "default", {}, () => [
85
+ props.but == 1 ? (require$$0.openBlock(), require$$0.createBlock(_component_Button, {
86
+ key: 0,
87
+ type: "primary"
88
+ }, {
89
+ default: require$$0.withCtx(() => [..._cache[1] || (_cache[1] = [
90
+ require$$0.createTextVNode("方法", -1)
91
+ ])]),
92
+ _: 1
93
+ })) : props.but == 2 ? (require$$0.openBlock(), require$$0.createBlock(_component_Button, {
94
+ key: 1,
95
+ type: "primary"
96
+ }, {
97
+ default: require$$0.withCtx(() => [..._cache[2] || (_cache[2] = [
98
+ require$$0.createTextVNode("事件", -1)
99
+ ])]),
100
+ _: 1
101
+ })) : props.but ? (require$$0.openBlock(), require$$0.createBlock(_component_Button, {
102
+ key: 2,
103
+ type: "primary"
104
+ }, {
105
+ default: require$$0.withCtx(() => [
106
+ require$$0.createTextVNode(require$$0.toDisplayString(props.but), 1)
107
+ ]),
108
+ _: 1
109
+ })) : (require$$0.openBlock(), require$$0.createElementBlock("svg", {
110
+ key: 3,
111
+ class: require$$0.normalizeClass(require$$0.unref(cs)("icon")),
112
+ viewBox: "0 0 1024 1024",
113
+ xmlns: "http://www.w3.org/2000/svg",
114
+ "data-v-ea893728": ""
115
+ }, [..._cache[3] || (_cache[3] = [
116
+ require$$0.createElementVNode("path", {
117
+ fill: "currentColor",
118
+ d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"
119
+ }, null, -1),
120
+ require$$0.createElementVNode("path", {
121
+ fill: "currentColor",
122
+ d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
123
+ }, null, -1)
124
+ ])], 2))
125
+ ])
126
+ ], 2);
127
+ };
128
+ }
129
+ });
130
+ exports._sfc_main = _sfc_main;
@@ -0,0 +1,131 @@
1
+ import { Button } from "@fangzhongya/fang-ui/components/button/index";
2
+ import "@fangzhongya/fang-ui/components/button/style/index2.scss";
3
+ import { defineComponent, inject, createElementBlock, openBlock, withModifiers, normalizeClass, unref, renderSlot, createBlock, withCtx, createTextVNode, toDisplayString, createElementVNode, nextTick } from "vue";
4
+ import { g as getClass } from "./index-wb1Ag0of.js";
5
+ const _sfc_main = /* @__PURE__ */ defineComponent({
6
+ __name: "button-editor",
7
+ props: {
8
+ prop: {
9
+ type: String
10
+ },
11
+ // 需要编辑的数据
12
+ modelValue: {
13
+ type: [String, Function, Object, Array]
14
+ },
15
+ // 弹框标题
16
+ title: {
17
+ type: String,
18
+ default: "编辑器"
19
+ },
20
+ // 数据的默认的配置
21
+ config: {
22
+ type: [Object, String],
23
+ default() {
24
+ return {};
25
+ }
26
+ },
27
+ // 数据类型
28
+ type: {
29
+ type: String
30
+ },
31
+ // 头展示数据
32
+ top: {
33
+ type: String
34
+ },
35
+ but: {
36
+ type: [Number, String]
37
+ },
38
+ nobox: {
39
+ type: Boolean
40
+ }
41
+ },
42
+ emits: ["update:modelValue", "submit"],
43
+ setup(__props, { expose: __expose, emit: __emit }) {
44
+ const cs = getClass("editor-button");
45
+ const props = __props;
46
+ const emit = __emit;
47
+ const editorObj = inject("editor");
48
+ function submit(v) {
49
+ if (v) {
50
+ emit("update:modelValue", v);
51
+ emit("submit", v);
52
+ } else {
53
+ emit("update:modelValue", void 0);
54
+ emit("submit", void 0);
55
+ }
56
+ }
57
+ function setBox() {
58
+ nextTick(() => {
59
+ if (editorObj) {
60
+ Object.keys(props).forEach((v) => {
61
+ editorObj[v] = props[v] || "";
62
+ });
63
+ editorObj.value = props.modelValue;
64
+ editorObj.submit = submit;
65
+ editorObj.box = true;
66
+ }
67
+ });
68
+ }
69
+ function onClick() {
70
+ if (!props.nobox) {
71
+ setBox();
72
+ }
73
+ }
74
+ __expose({
75
+ setBox
76
+ });
77
+ return (_ctx, _cache) => {
78
+ const _component_Button = Button;
79
+ return openBlock(), createElementBlock("div", {
80
+ class: normalizeClass(unref(cs)()),
81
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => onClick(), ["stop"]))
82
+ }, [
83
+ renderSlot(_ctx.$slots, "default", {}, () => [
84
+ props.but == 1 ? (openBlock(), createBlock(_component_Button, {
85
+ key: 0,
86
+ type: "primary"
87
+ }, {
88
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
89
+ createTextVNode("方法", -1)
90
+ ])]),
91
+ _: 1
92
+ })) : props.but == 2 ? (openBlock(), createBlock(_component_Button, {
93
+ key: 1,
94
+ type: "primary"
95
+ }, {
96
+ default: withCtx(() => [..._cache[2] || (_cache[2] = [
97
+ createTextVNode("事件", -1)
98
+ ])]),
99
+ _: 1
100
+ })) : props.but ? (openBlock(), createBlock(_component_Button, {
101
+ key: 2,
102
+ type: "primary"
103
+ }, {
104
+ default: withCtx(() => [
105
+ createTextVNode(toDisplayString(props.but), 1)
106
+ ]),
107
+ _: 1
108
+ })) : (openBlock(), createElementBlock("svg", {
109
+ key: 3,
110
+ class: normalizeClass(unref(cs)("icon")),
111
+ viewBox: "0 0 1024 1024",
112
+ xmlns: "http://www.w3.org/2000/svg",
113
+ "data-v-ea893728": ""
114
+ }, [..._cache[3] || (_cache[3] = [
115
+ createElementVNode("path", {
116
+ fill: "currentColor",
117
+ d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"
118
+ }, null, -1),
119
+ createElementVNode("path", {
120
+ fill: "currentColor",
121
+ d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
122
+ }, null, -1)
123
+ ])], 2))
124
+ ])
125
+ ], 2);
126
+ };
127
+ }
128
+ });
129
+ export {
130
+ _sfc_main as _
131
+ };
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const es = require("element-plus/es");
4
+ require("element-plus/es/components/base/style/css");
5
+ require("element-plus/es/components/select/style/css");
6
+ require("element-plus/es/components/option/style/css");
7
+ const require$$0 = require("vue");
8
+ const index = require("./index-C5atHkSE.cjs");
9
+ const _sfc_main = /* @__PURE__ */ require$$0.defineComponent({
10
+ __name: "choice",
11
+ props: {
12
+ /**
13
+ * 设置的值
14
+ */
15
+ prop: { type: String, default: "" },
16
+ config: {
17
+ type: Object,
18
+ default() {
19
+ return {};
20
+ }
21
+ },
22
+ /**
23
+ * 名称
24
+ */
25
+ label: String,
26
+ /**
27
+ * 值对象
28
+ */
29
+ modelValue: {
30
+ type: Object,
31
+ default() {
32
+ return {};
33
+ }
34
+ }
35
+ },
36
+ emits: ["blur"],
37
+ setup(__props, { emit: __emit }) {
38
+ const props = __props;
39
+ const emit = __emit;
40
+ function setLabel(v) {
41
+ let label = props.config.config?.label || "label";
42
+ if (label && typeof v == "object" && v) {
43
+ if (typeof label === "function") {
44
+ return label(v);
45
+ } else {
46
+ return v[label];
47
+ }
48
+ } else {
49
+ return v;
50
+ }
51
+ }
52
+ function setProp(v) {
53
+ let prop = props.config.config?.prop || "value";
54
+ if (prop && typeof v == "object" && v) {
55
+ if (typeof prop === "function") {
56
+ return prop(v);
57
+ } else {
58
+ return v[prop];
59
+ }
60
+ } else {
61
+ return v;
62
+ }
63
+ }
64
+ return (_ctx, _cache) => {
65
+ const _component_el_option = es.ElOption;
66
+ const _component_el_select = es.ElSelect;
67
+ return require$$0.openBlock(), require$$0.createBlock(index._sfc_main, require$$0.normalizeProps(require$$0.guardReactiveProps(props)), {
68
+ default: require$$0.withCtx(() => [
69
+ require$$0.createVNode(_component_el_select, {
70
+ modelValue: props.modelValue[props.prop],
71
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue[props.prop] = $event),
72
+ clearable: "",
73
+ placeholder: "请选择"
74
+ }, {
75
+ default: require$$0.withCtx(() => [
76
+ (require$$0.openBlock(true), require$$0.createElementBlock(require$$0.Fragment, null, require$$0.renderList(props.config.options, (item, key) => {
77
+ return require$$0.openBlock(), require$$0.createBlock(_component_el_option, {
78
+ key,
79
+ label: setLabel(item),
80
+ value: setProp(item)
81
+ }, null, 8, ["label", "value"]);
82
+ }), 128))
83
+ ]),
84
+ _: 1
85
+ }, 8, ["modelValue"])
86
+ ]),
87
+ _: 1
88
+ }, 16);
89
+ };
90
+ }
91
+ });
92
+ exports.default = _sfc_main;
@@ -0,0 +1,92 @@
1
+ import { ElSelect, ElOption } from "element-plus/es";
2
+ import "element-plus/es/components/base/style/css";
3
+ import "element-plus/es/components/select/style/css";
4
+ import "element-plus/es/components/option/style/css";
5
+ import { defineComponent, createBlock, openBlock, normalizeProps, guardReactiveProps, withCtx, createVNode, createElementBlock, Fragment, renderList } from "vue";
6
+ import { _ as _sfc_main$1 } from "./index-wb1Ag0of.js";
7
+ const _sfc_main = /* @__PURE__ */ defineComponent({
8
+ __name: "choice",
9
+ props: {
10
+ /**
11
+ * 设置的值
12
+ */
13
+ prop: { type: String, default: "" },
14
+ config: {
15
+ type: Object,
16
+ default() {
17
+ return {};
18
+ }
19
+ },
20
+ /**
21
+ * 名称
22
+ */
23
+ label: String,
24
+ /**
25
+ * 值对象
26
+ */
27
+ modelValue: {
28
+ type: Object,
29
+ default() {
30
+ return {};
31
+ }
32
+ }
33
+ },
34
+ emits: ["blur"],
35
+ setup(__props, { emit: __emit }) {
36
+ const props = __props;
37
+ const emit = __emit;
38
+ function setLabel(v) {
39
+ let label = props.config.config?.label || "label";
40
+ if (label && typeof v == "object" && v) {
41
+ if (typeof label === "function") {
42
+ return label(v);
43
+ } else {
44
+ return v[label];
45
+ }
46
+ } else {
47
+ return v;
48
+ }
49
+ }
50
+ function setProp(v) {
51
+ let prop = props.config.config?.prop || "value";
52
+ if (prop && typeof v == "object" && v) {
53
+ if (typeof prop === "function") {
54
+ return prop(v);
55
+ } else {
56
+ return v[prop];
57
+ }
58
+ } else {
59
+ return v;
60
+ }
61
+ }
62
+ return (_ctx, _cache) => {
63
+ const _component_el_option = ElOption;
64
+ const _component_el_select = ElSelect;
65
+ return openBlock(), createBlock(_sfc_main$1, normalizeProps(guardReactiveProps(props)), {
66
+ default: withCtx(() => [
67
+ createVNode(_component_el_select, {
68
+ modelValue: props.modelValue[props.prop],
69
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => props.modelValue[props.prop] = $event),
70
+ clearable: "",
71
+ placeholder: "请选择"
72
+ }, {
73
+ default: withCtx(() => [
74
+ (openBlock(true), createElementBlock(Fragment, null, renderList(props.config.options, (item, key) => {
75
+ return openBlock(), createBlock(_component_el_option, {
76
+ key,
77
+ label: setLabel(item),
78
+ value: setProp(item)
79
+ }, null, 8, ["label", "value"]);
80
+ }), 128))
81
+ ]),
82
+ _: 1
83
+ }, 8, ["modelValue"])
84
+ ]),
85
+ _: 1
86
+ }, 16);
87
+ };
88
+ }
89
+ });
90
+ export {
91
+ _sfc_main as default
92
+ };