@fangzhongya/fang-ui 0.1.51 → 0.1.52

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 (195) hide show
  1. package/bin/fang-ui.js +2 -2
  2. package/dist/components/box-fun/index.cjs +1 -0
  3. package/dist/components/box-fun/index.js +1 -0
  4. package/dist/components/box-fun/index.scss +8 -0
  5. package/dist/components/box-fun/style/index2.scss +4 -0
  6. package/dist/components/buttons/src/data.d.ts +14 -11
  7. package/dist/components/cascaders/src/data.d.ts +14 -11
  8. package/dist/components/cascaders/src/index2.cjs +15 -8
  9. package/dist/components/cascaders/src/index2.js +15 -8
  10. package/dist/components/checks/src/data.d.ts +14 -11
  11. package/dist/components/checks/src/index2.cjs +6 -6
  12. package/dist/components/checks/src/index2.js +6 -6
  13. package/dist/components/common/list.cjs +34 -15
  14. package/dist/components/common/list.d.ts +25 -12
  15. package/dist/components/common/list.js +34 -15
  16. package/dist/components/common/use.cjs +9 -5
  17. package/dist/components/common/use.js +9 -5
  18. package/dist/components/dates/src/data.d.ts +14 -11
  19. package/dist/components/dates2/src/data.d.ts +14 -11
  20. package/dist/components/draggable/style/index2.scss +1 -0
  21. package/dist/components/edit-data/index.cjs +9 -0
  22. package/dist/components/edit-data/index.css +144 -0
  23. package/dist/components/edit-data/index.d.ts +5 -0
  24. package/dist/components/edit-data/index.js +9 -0
  25. package/dist/components/edit-data/index.scss +95 -0
  26. package/dist/components/edit-data/src/area/array-json.cjs +4 -0
  27. package/dist/components/edit-data/src/area/array-json.js +4 -0
  28. package/dist/components/edit-data/src/area/array-json2.cjs +109 -0
  29. package/dist/components/edit-data/src/area/array-json2.js +109 -0
  30. package/dist/components/edit-data/src/area/array.cjs +4 -0
  31. package/dist/components/edit-data/src/area/array.js +4 -0
  32. package/dist/components/edit-data/src/area/array2.cjs +135 -0
  33. package/dist/components/edit-data/src/area/array2.js +135 -0
  34. package/dist/components/edit-data/src/area/code.cjs +4 -0
  35. package/dist/components/edit-data/src/area/code.js +4 -0
  36. package/dist/components/edit-data/src/area/code2.cjs +52 -0
  37. package/dist/components/edit-data/src/area/code2.js +52 -0
  38. package/dist/components/edit-data/src/area/editor.cjs +4 -0
  39. package/dist/components/edit-data/src/area/editor.js +4 -0
  40. package/dist/components/edit-data/src/area/editor2.cjs +170 -0
  41. package/dist/components/edit-data/src/area/editor2.js +170 -0
  42. package/dist/components/edit-data/src/area/general.cjs +4 -0
  43. package/dist/components/edit-data/src/area/general.js +4 -0
  44. package/dist/components/edit-data/src/area/general2.cjs +88 -0
  45. package/dist/components/edit-data/src/area/general2.js +88 -0
  46. package/dist/components/edit-data/src/area/object-json.cjs +4 -0
  47. package/dist/components/edit-data/src/area/object-json.js +4 -0
  48. package/dist/components/edit-data/src/area/object-json2.cjs +109 -0
  49. package/dist/components/edit-data/src/area/object-json2.js +109 -0
  50. package/dist/components/edit-data/src/area/object.cjs +4 -0
  51. package/dist/components/edit-data/src/area/object.js +4 -0
  52. package/dist/components/edit-data/src/area/object2.cjs +116 -0
  53. package/dist/components/edit-data/src/area/object2.js +116 -0
  54. package/dist/components/edit-data/src/data/array.cjs +4 -0
  55. package/dist/components/edit-data/src/data/array.js +4 -0
  56. package/dist/components/edit-data/src/data/array2.cjs +68 -0
  57. package/dist/components/edit-data/src/data/array2.js +68 -0
  58. package/dist/components/edit-data/src/data/bigint.cjs +4 -0
  59. package/dist/components/edit-data/src/data/bigint.js +4 -0
  60. package/dist/components/edit-data/src/data/bigint2.cjs +42 -0
  61. package/dist/components/edit-data/src/data/bigint2.js +42 -0
  62. package/dist/components/edit-data/src/data/boolean.cjs +4 -0
  63. package/dist/components/edit-data/src/data/boolean.js +4 -0
  64. package/dist/components/edit-data/src/data/boolean2.cjs +53 -0
  65. package/dist/components/edit-data/src/data/boolean2.js +53 -0
  66. package/dist/components/edit-data/src/data/function.cjs +4 -0
  67. package/dist/components/edit-data/src/data/function.js +4 -0
  68. package/dist/components/edit-data/src/data/function2.cjs +61 -0
  69. package/dist/components/edit-data/src/data/function2.js +61 -0
  70. package/dist/components/edit-data/src/data/not.cjs +4 -0
  71. package/dist/components/edit-data/src/data/not.js +4 -0
  72. package/dist/components/edit-data/src/data/not2.cjs +56 -0
  73. package/dist/components/edit-data/src/data/not2.js +56 -0
  74. package/dist/components/edit-data/src/data/null.cjs +4 -0
  75. package/dist/components/edit-data/src/data/null.js +4 -0
  76. package/dist/components/edit-data/src/data/null2.cjs +24 -0
  77. package/dist/components/edit-data/src/data/null2.js +24 -0
  78. package/dist/components/edit-data/src/data/number.cjs +4 -0
  79. package/dist/components/edit-data/src/data/number.js +4 -0
  80. package/dist/components/edit-data/src/data/number2.cjs +42 -0
  81. package/dist/components/edit-data/src/data/number2.js +42 -0
  82. package/dist/components/edit-data/src/data/object.cjs +4 -0
  83. package/dist/components/edit-data/src/data/object.js +4 -0
  84. package/dist/components/edit-data/src/data/object2.cjs +68 -0
  85. package/dist/components/edit-data/src/data/object2.js +68 -0
  86. package/dist/components/edit-data/src/data/other.cjs +4 -0
  87. package/dist/components/edit-data/src/data/other.js +4 -0
  88. package/dist/components/edit-data/src/data/other2.cjs +59 -0
  89. package/dist/components/edit-data/src/data/other2.js +59 -0
  90. package/dist/components/edit-data/src/data/string.cjs +4 -0
  91. package/dist/components/edit-data/src/data/string.js +4 -0
  92. package/dist/components/edit-data/src/data/string2.cjs +43 -0
  93. package/dist/components/edit-data/src/data/string2.js +43 -0
  94. package/dist/components/edit-data/src/data/symbol.cjs +4 -0
  95. package/dist/components/edit-data/src/data/symbol.js +4 -0
  96. package/dist/components/edit-data/src/data/symbol2.cjs +55 -0
  97. package/dist/components/edit-data/src/data/symbol2.js +55 -0
  98. package/dist/components/edit-data/src/data/undefined.cjs +4 -0
  99. package/dist/components/edit-data/src/data/undefined.js +4 -0
  100. package/dist/components/edit-data/src/data/undefined2.cjs +24 -0
  101. package/dist/components/edit-data/src/data/undefined2.js +24 -0
  102. package/dist/components/edit-data/src/data.cjs +57 -0
  103. package/dist/components/edit-data/src/data.d.ts +131 -0
  104. package/dist/components/edit-data/src/data.js +57 -0
  105. package/dist/components/edit-data/src/index.cjs +4 -0
  106. package/dist/components/edit-data/src/index.js +4 -0
  107. package/dist/components/edit-data/src/index2.cjs +134 -0
  108. package/dist/components/edit-data/src/index2.js +134 -0
  109. package/dist/components/edit-data/src/util.cjs +99 -0
  110. package/dist/components/edit-data/src/util.d.ts +1 -0
  111. package/dist/components/edit-data/src/util.js +99 -0
  112. package/dist/components/edit-data/style/index2.scss +13 -0
  113. package/dist/components/edit-data-add/index.cjs +9 -0
  114. package/dist/components/edit-data-add/index.d.ts +5 -0
  115. package/dist/components/edit-data-add/index.js +9 -0
  116. package/dist/components/edit-data-add/index.scss +5 -0
  117. package/dist/components/edit-data-add/src/data.cjs +24 -0
  118. package/dist/components/edit-data-add/src/data.d.ts +36 -0
  119. package/dist/components/edit-data-add/src/data.js +24 -0
  120. package/dist/components/edit-data-add/src/index.cjs +4 -0
  121. package/dist/components/edit-data-add/src/index.js +4 -0
  122. package/dist/components/edit-data-add/src/index2.cjs +241 -0
  123. package/dist/components/edit-data-add/src/index2.js +241 -0
  124. package/dist/components/edit-data-add/style/comm.scss +38 -0
  125. package/dist/components/edit-data-add/style/index2.scss +2 -0
  126. package/dist/components/history/src/data.cjs +9 -1
  127. package/dist/components/history/src/data.d.ts +13 -1
  128. package/dist/components/history/src/data.js +9 -1
  129. package/dist/components/history/src/index2.cjs +27 -9
  130. package/dist/components/history/src/index2.js +27 -9
  131. package/dist/components/index.cjs +60 -56
  132. package/dist/components/index.d.ts +2 -0
  133. package/dist/components/index.js +4 -0
  134. package/dist/components/index.scss +3 -0
  135. package/dist/components/index2.scss +5 -2
  136. package/dist/components/labels/src/data.d.ts +14 -11
  137. package/dist/components/labels/src/index2.cjs +13 -2
  138. package/dist/components/labels/src/index2.js +13 -2
  139. package/dist/components/page/index.css +8 -0
  140. package/dist/components/retract/index.css +20 -0
  141. package/dist/components/retract/index.scss +24 -0
  142. package/dist/components/retract/src/data.cjs +10 -0
  143. package/dist/components/retract/src/data.d.ts +10 -0
  144. package/dist/components/retract/src/data.js +10 -0
  145. package/dist/components/retract/src/index2.cjs +24 -4
  146. package/dist/components/retract/src/index2.js +23 -3
  147. package/dist/components/retract/style/index2.scss +1 -0
  148. package/dist/components/selects/src/data.d.ts +14 -11
  149. package/dist/components/selects/src/index2.cjs +1 -1
  150. package/dist/components/selects/src/index2.js +1 -1
  151. package/dist/components/switchs/src/data.d.ts +14 -11
  152. package/dist/components/switchs/src/index2.cjs +9 -5
  153. package/dist/components/switchs/src/index2.js +9 -5
  154. package/dist/components/tables/common/com-limit.cjs +4 -0
  155. package/dist/components/tables/common/com-limit.js +4 -0
  156. package/dist/components/tables/common/com-limit2.cjs +91 -0
  157. package/dist/components/tables/common/com-limit2.js +91 -0
  158. package/dist/components/tables/common/com.scss +12 -0
  159. package/dist/components/tables/index.css +9 -0
  160. package/dist/components/tables/index.scss +2 -0
  161. package/dist/components/tables/src/columns2.cjs +3 -1
  162. package/dist/components/tables/src/columns2.js +7 -5
  163. package/dist/components/tablesp/index.css +9 -0
  164. package/dist/components/tablespd/index.css +9 -0
  165. package/dist/components/uploads/src/data.d.ts +14 -11
  166. package/dist/css/edit-data.css +144 -0
  167. package/dist/css/index.css +149 -0
  168. package/dist/css/page.css +8 -0
  169. package/dist/css/retract.css +20 -0
  170. package/dist/css/tables.css +9 -0
  171. package/dist/css/tablesp.css +9 -0
  172. package/dist/css/tablespd.css +9 -0
  173. package/dist/directives/adjust/index.cjs +14 -6
  174. package/dist/directives/adjust/index.js +14 -6
  175. package/dist/directives/adjustment/index.cjs +622 -0
  176. package/dist/directives/adjustment/index.d.ts +7 -0
  177. package/dist/directives/adjustment/index.js +622 -0
  178. package/dist/directives/index.cjs +18 -16
  179. package/dist/directives/index.d.ts +1 -0
  180. package/dist/directives/index.js +16 -14
  181. package/dist/expand/{chunk-A7IW6WRD.cjs → chunk-BJVT6JH7.cjs} +6 -0
  182. package/dist/expand/{chunk-L4FI5HCY.js → chunk-I5UJEJJB.js} +6 -0
  183. package/dist/expand/components.cjs +5 -5
  184. package/dist/expand/components.js +1 -1
  185. package/dist/expand/config.cjs +2 -2
  186. package/dist/expand/config.js +1 -1
  187. package/dist/icons/index.json +1 -1
  188. package/dist/index.cjs +84 -78
  189. package/dist/index.css +149 -0
  190. package/dist/index.js +20 -14
  191. package/dist/utils/util.cjs +1 -1
  192. package/dist/utils/util.js +2 -2
  193. package/dist/utils/vues/withInstall.cjs +2 -1
  194. package/dist/utils/vues/withInstall.js +2 -1
  195. package/package.json +9 -8
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const data = require("../data.cjs");
5
+ const index = require("../../../../hooks/cssname/index.cjs");
6
+ const index$1 = require("../../../../hooks/locale/index.cjs");
7
+ const index$2 = require("../../../inputs/index.cjs");
8
+ const index$3 = require("../../../button/index.cjs");
9
+ require("./editor.cjs");
10
+ const index$4 = require("../../../message/index.cjs");
11
+ const json5 = require("json5");
12
+ const editor_vue_vue_type_script_setup_true_lang = require("./editor2.cjs");
13
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
+ __name: "general",
15
+ props: {
16
+ ...data.dataDataProps,
17
+ title: { type: String, default: "设置" },
18
+ check: { type: Function }
19
+ },
20
+ emits: data.dataDataEmits,
21
+ setup(__props, { emit: __emit }) {
22
+ const cs = index.useCssName(data.name);
23
+ const { getLocale } = index$1.useLocale();
24
+ const props = __props;
25
+ const emit = __emit;
26
+ const box = vue.ref(false);
27
+ const value = vue.computed({
28
+ get() {
29
+ return props.modelValue;
30
+ },
31
+ set(value2) {
32
+ emit("update:modelValue", value2);
33
+ }
34
+ });
35
+ const inputValue = vue.computed(() => {
36
+ if (value.value) {
37
+ return json5.stringify(value.value);
38
+ } else {
39
+ return String(value.value);
40
+ }
41
+ });
42
+ const onSubmit = (v) => {
43
+ if (props.check) {
44
+ const err = props.check(v);
45
+ if (err) {
46
+ index$4.Message.error(err);
47
+ return;
48
+ }
49
+ }
50
+ value.value = v;
51
+ box.value = false;
52
+ };
53
+ const onClick = () => {
54
+ box.value = true;
55
+ };
56
+ return (_ctx, _cache) => {
57
+ return vue.openBlock(), vue.createElementBlock("div", {
58
+ class: vue.normalizeClass(vue.unref(cs).z("general"))
59
+ }, [
60
+ vue.createElementVNode("div", {
61
+ class: vue.normalizeClass(vue.unref(cs).z("general-set"))
62
+ }, [
63
+ vue.createVNode(vue.unref(index$2.Inputs), {
64
+ readonly: "",
65
+ clearable: "",
66
+ "model-value": inputValue.value
67
+ }, null, 8, ["model-value"]),
68
+ vue.createVNode(vue.unref(index$3.Button), {
69
+ type: "primary",
70
+ onClick
71
+ }, {
72
+ default: vue.withCtx(() => [
73
+ vue.createTextVNode(vue.toDisplayString(props.title), 1)
74
+ ]),
75
+ _: 1
76
+ })
77
+ ], 2),
78
+ vue.createVNode(editor_vue_vue_type_script_setup_true_lang.default, vue.mergeProps(props, {
79
+ modelValue: box.value,
80
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => box.value = $event),
81
+ value: value.value,
82
+ onSubmit
83
+ }), null, 16, ["modelValue", "value"])
84
+ ], 2);
85
+ };
86
+ }
87
+ });
88
+ exports.default = _sfc_main;
@@ -0,0 +1,88 @@
1
+ import { defineComponent, ref, computed, createElementBlock, openBlock, normalizeClass, unref, createElementVNode, createVNode, withCtx, createTextVNode, toDisplayString, mergeProps } from "vue";
2
+ import { dataDataEmits, dataDataProps, name } from "../data.js";
3
+ import { useCssName } from "../../../../hooks/cssname/index.js";
4
+ import { useLocale } from "../../../../hooks/locale/index.js";
5
+ import { Inputs } from "../../../inputs/index.js";
6
+ import { Button } from "../../../button/index.js";
7
+ import "./editor.js";
8
+ import { Message } from "../../../message/index.js";
9
+ import json5 from "json5";
10
+ import _sfc_main$1 from "./editor2.js";
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "general",
13
+ props: {
14
+ ...dataDataProps,
15
+ title: { type: String, default: "设置" },
16
+ check: { type: Function }
17
+ },
18
+ emits: dataDataEmits,
19
+ setup(__props, { emit: __emit }) {
20
+ const cs = useCssName(name);
21
+ const { getLocale } = useLocale();
22
+ const props = __props;
23
+ const emit = __emit;
24
+ const box = ref(false);
25
+ const value = computed({
26
+ get() {
27
+ return props.modelValue;
28
+ },
29
+ set(value2) {
30
+ emit("update:modelValue", value2);
31
+ }
32
+ });
33
+ const inputValue = computed(() => {
34
+ if (value.value) {
35
+ return json5.stringify(value.value);
36
+ } else {
37
+ return String(value.value);
38
+ }
39
+ });
40
+ const onSubmit = (v) => {
41
+ if (props.check) {
42
+ const err = props.check(v);
43
+ if (err) {
44
+ Message.error(err);
45
+ return;
46
+ }
47
+ }
48
+ value.value = v;
49
+ box.value = false;
50
+ };
51
+ const onClick = () => {
52
+ box.value = true;
53
+ };
54
+ return (_ctx, _cache) => {
55
+ return openBlock(), createElementBlock("div", {
56
+ class: normalizeClass(unref(cs).z("general"))
57
+ }, [
58
+ createElementVNode("div", {
59
+ class: normalizeClass(unref(cs).z("general-set"))
60
+ }, [
61
+ createVNode(unref(Inputs), {
62
+ readonly: "",
63
+ clearable: "",
64
+ "model-value": inputValue.value
65
+ }, null, 8, ["model-value"]),
66
+ createVNode(unref(Button), {
67
+ type: "primary",
68
+ onClick
69
+ }, {
70
+ default: withCtx(() => [
71
+ createTextVNode(toDisplayString(props.title), 1)
72
+ ]),
73
+ _: 1
74
+ })
75
+ ], 2),
76
+ createVNode(_sfc_main$1, mergeProps(props, {
77
+ modelValue: box.value,
78
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => box.value = $event),
79
+ value: value.value,
80
+ onSubmit
81
+ }), null, 16, ["modelValue", "value"])
82
+ ], 2);
83
+ };
84
+ }
85
+ });
86
+ export {
87
+ _sfc_main as default
88
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const objectJson_vue_vue_type_script_setup_true_lang = require("./object-json2.cjs");
4
+ exports.default = objectJson_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./object-json2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const data = require("../data.cjs");
5
+ const index = require("../../../../hooks/cssname/index.cjs");
6
+ const index$1 = require("../../../../hooks/locale/index.cjs");
7
+ const index$2 = require("../../../tabs/index.cjs");
8
+ const index$3 = require("../../../tab-pane/index.cjs");
9
+ const json5 = require("json5");
10
+ require("./object.cjs");
11
+ const index$4 = require("../../../message/index.cjs");
12
+ const object_vue_vue_type_script_setup_true_lang = require("./object2.cjs");
13
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
14
+ __name: "object-json",
15
+ props: data.dataDataProps,
16
+ emits: data.dataDataEmits,
17
+ setup(__props, { expose: __expose, emit: __emit }) {
18
+ const cs = index.useCssName(data.name);
19
+ const { getLocale } = index$1.useLocale();
20
+ const props = __props;
21
+ const emit = __emit;
22
+ const tab = vue.ref("z");
23
+ const value = vue.computed({
24
+ get() {
25
+ return props.modelValue;
26
+ },
27
+ set(value2) {
28
+ emit("update:modelValue", value2);
29
+ }
30
+ });
31
+ const getValue = (v) => {
32
+ if (v && typeof v === "object") {
33
+ return v;
34
+ } else {
35
+ if (v) {
36
+ return json5.parse(v) || {};
37
+ } else {
38
+ return {};
39
+ }
40
+ }
41
+ };
42
+ const beforeLeave = (name2) => {
43
+ if (name2 == "z") {
44
+ try {
45
+ const v = getValue(value.value);
46
+ value.value = v;
47
+ return true;
48
+ } catch (error) {
49
+ console.log("error", error);
50
+ index$4.Message.error("对象输入错误:" + error);
51
+ return false;
52
+ }
53
+ } else if (name2 == "j") {
54
+ try {
55
+ if (typeof value.value === "string") {
56
+ value.value = value.value;
57
+ } else {
58
+ const v = json5.stringify(value.value, null, 4);
59
+ value.value = v;
60
+ }
61
+ return true;
62
+ } catch (error) {
63
+ console.log("error", error);
64
+ index$4.Message.error("对象输入错误:" + error);
65
+ return false;
66
+ }
67
+ }
68
+ };
69
+ __expose({});
70
+ return (_ctx, _cache) => {
71
+ return vue.openBlock(), vue.createElementBlock("div", {
72
+ class: vue.normalizeClass(vue.unref(cs).z("area-object-json"))
73
+ }, [
74
+ vue.createVNode(vue.unref(index$2.Tabs), {
75
+ "default-value": "z",
76
+ modelValue: tab.value,
77
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tab.value = $event),
78
+ "before-leave": beforeLeave
79
+ }, {
80
+ default: vue.withCtx(() => [
81
+ vue.createVNode(vue.unref(index$3.TabPane), {
82
+ name: "z",
83
+ label: "组件(Object)"
84
+ }, {
85
+ default: vue.withCtx(() => [
86
+ vue.createVNode(object_vue_vue_type_script_setup_true_lang.default, vue.mergeProps(props, {
87
+ modelValue: value.value,
88
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event)
89
+ }), null, 16, ["modelValue"])
90
+ ]),
91
+ _: 1
92
+ }),
93
+ vue.createVNode(vue.unref(index$3.TabPane), {
94
+ name: "j",
95
+ label: "JSON(Object)"
96
+ }, {
97
+ default: vue.withCtx(() => [
98
+ vue.renderSlot(_ctx.$slots, "default")
99
+ ]),
100
+ _: 3
101
+ })
102
+ ]),
103
+ _: 3
104
+ }, 8, ["modelValue"])
105
+ ], 2);
106
+ };
107
+ }
108
+ });
109
+ exports.default = _sfc_main;
@@ -0,0 +1,109 @@
1
+ import { defineComponent, ref, computed, createElementBlock, openBlock, normalizeClass, unref, createVNode, withCtx, mergeProps, renderSlot } from "vue";
2
+ import { dataDataEmits, dataDataProps, name } from "../data.js";
3
+ import { useCssName } from "../../../../hooks/cssname/index.js";
4
+ import { useLocale } from "../../../../hooks/locale/index.js";
5
+ import { Tabs } from "../../../tabs/index.js";
6
+ import { TabPane } from "../../../tab-pane/index.js";
7
+ import json5 from "json5";
8
+ import "./object.js";
9
+ import { Message } from "../../../message/index.js";
10
+ import _sfc_main$1 from "./object2.js";
11
+ const _sfc_main = /* @__PURE__ */ defineComponent({
12
+ __name: "object-json",
13
+ props: dataDataProps,
14
+ emits: dataDataEmits,
15
+ setup(__props, { expose: __expose, emit: __emit }) {
16
+ const cs = useCssName(name);
17
+ const { getLocale } = useLocale();
18
+ const props = __props;
19
+ const emit = __emit;
20
+ const tab = ref("z");
21
+ const value = computed({
22
+ get() {
23
+ return props.modelValue;
24
+ },
25
+ set(value2) {
26
+ emit("update:modelValue", value2);
27
+ }
28
+ });
29
+ const getValue = (v) => {
30
+ if (v && typeof v === "object") {
31
+ return v;
32
+ } else {
33
+ if (v) {
34
+ return json5.parse(v) || {};
35
+ } else {
36
+ return {};
37
+ }
38
+ }
39
+ };
40
+ const beforeLeave = (name2) => {
41
+ if (name2 == "z") {
42
+ try {
43
+ const v = getValue(value.value);
44
+ value.value = v;
45
+ return true;
46
+ } catch (error) {
47
+ console.log("error", error);
48
+ Message.error("对象输入错误:" + error);
49
+ return false;
50
+ }
51
+ } else if (name2 == "j") {
52
+ try {
53
+ if (typeof value.value === "string") {
54
+ value.value = value.value;
55
+ } else {
56
+ const v = json5.stringify(value.value, null, 4);
57
+ value.value = v;
58
+ }
59
+ return true;
60
+ } catch (error) {
61
+ console.log("error", error);
62
+ Message.error("对象输入错误:" + error);
63
+ return false;
64
+ }
65
+ }
66
+ };
67
+ __expose({});
68
+ return (_ctx, _cache) => {
69
+ return openBlock(), createElementBlock("div", {
70
+ class: normalizeClass(unref(cs).z("area-object-json"))
71
+ }, [
72
+ createVNode(unref(Tabs), {
73
+ "default-value": "z",
74
+ modelValue: tab.value,
75
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => tab.value = $event),
76
+ "before-leave": beforeLeave
77
+ }, {
78
+ default: withCtx(() => [
79
+ createVNode(unref(TabPane), {
80
+ name: "z",
81
+ label: "组件(Object)"
82
+ }, {
83
+ default: withCtx(() => [
84
+ createVNode(_sfc_main$1, mergeProps(props, {
85
+ modelValue: value.value,
86
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => value.value = $event)
87
+ }), null, 16, ["modelValue"])
88
+ ]),
89
+ _: 1
90
+ }),
91
+ createVNode(unref(TabPane), {
92
+ name: "j",
93
+ label: "JSON(Object)"
94
+ }, {
95
+ default: withCtx(() => [
96
+ renderSlot(_ctx.$slots, "default")
97
+ ]),
98
+ _: 3
99
+ })
100
+ ]),
101
+ _: 3
102
+ }, 8, ["modelValue"])
103
+ ], 2);
104
+ };
105
+ }
106
+ });
107
+ export {
108
+ _sfc_main as default
109
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const object_vue_vue_type_script_setup_true_lang = require("./object2.cjs");
4
+ exports.default = object_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./object2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const vue = require("vue");
4
+ const index$4 = require("../../../no-data/index.cjs");
5
+ const index$3 = require("../../../icon/index.cjs");
6
+ const _delete = require("../../../../icons/vue/delete.cjs");
7
+ const data = require("../data.cjs");
8
+ const index = require("../../../../hooks/cssname/index.cjs");
9
+ const index$1 = require("../../../../hooks/locale/index.cjs");
10
+ require("../index.cjs");
11
+ const index$2 = require("../../../button/index.cjs");
12
+ const index$5 = require("../../../edit-data-add/index.cjs");
13
+ const index_vue_vue_type_script_setup_true_lang = require("../index2.cjs");
14
+ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
15
+ __name: "object",
16
+ props: data.dataDataProps,
17
+ emits: data.dataDataEmits,
18
+ setup(__props, { expose: __expose, emit: __emit }) {
19
+ const cs = index.useCssName(data.name);
20
+ const { getLocale } = index$1.useLocale();
21
+ const props = __props;
22
+ const emit = __emit;
23
+ const box = vue.ref(false);
24
+ const value = vue.computed({
25
+ get() {
26
+ return props.modelValue;
27
+ },
28
+ set(value2) {
29
+ emit("update:modelValue", value2);
30
+ }
31
+ });
32
+ const updateValue = (index2, v) => {
33
+ value.value[index2] = v;
34
+ };
35
+ const onAdd = () => {
36
+ box.value = true;
37
+ };
38
+ const onSubmit = (v) => {
39
+ value.value[v.label] = v.value;
40
+ };
41
+ const onDelete = (index2) => {
42
+ value.value[index2] = void 0;
43
+ delete value.value[index2];
44
+ };
45
+ __expose({});
46
+ return (_ctx, _cache) => {
47
+ return vue.openBlock(), vue.createElementBlock("div", {
48
+ class: vue.normalizeClass(vue.unref(cs).z("area-object"))
49
+ }, [
50
+ props.addable || props.editable ? (vue.openBlock(), vue.createElementBlock("div", {
51
+ key: 0,
52
+ class: vue.normalizeClass(vue.unref(cs).z("area-object-add"))
53
+ }, [
54
+ vue.createVNode(vue.unref(index$2.Button), {
55
+ type: "primary",
56
+ onClick: onAdd
57
+ }, {
58
+ default: vue.withCtx(() => [..._cache[1] || (_cache[1] = [
59
+ vue.createTextVNode(" 添加 ", -1)
60
+ ])]),
61
+ _: 1
62
+ })
63
+ ], 2)) : vue.createCommentVNode("", true),
64
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(value.value, (item, index2) => {
65
+ return vue.openBlock(), vue.createElementBlock("div", {
66
+ class: vue.normalizeClass(vue.unref(cs).z("area-comp-li")),
67
+ key: index2
68
+ }, [
69
+ vue.createElementVNode("div", {
70
+ class: vue.normalizeClass(vue.unref(cs).z("area-comp-li-div"))
71
+ }, [
72
+ vue.createElementVNode("span", {
73
+ class: vue.normalizeClass(vue.unref(cs).z("area-comp-li-name"))
74
+ }, vue.toDisplayString(index2), 3),
75
+ vue.createVNode(index_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({ ref_for: true }, props, {
76
+ type: void 0,
77
+ modelValue: item,
78
+ "onUpdate:modelValue": (val) => updateValue(index2, val)
79
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])
80
+ ], 2),
81
+ vue.createElementVNode("div", null, [
82
+ props.editable ? (vue.openBlock(), vue.createBlock(vue.unref(index$2.Button), {
83
+ key: 0,
84
+ type: "danger",
85
+ onClick: ($event) => onDelete(index2),
86
+ text: ""
87
+ }, {
88
+ default: vue.withCtx(() => [
89
+ vue.createVNode(vue.unref(index$3.Icon), { title: "删除" }, {
90
+ default: vue.withCtx(() => [
91
+ vue.createVNode(_delete.default)
92
+ ]),
93
+ _: 1
94
+ })
95
+ ]),
96
+ _: 1
97
+ }, 8, ["onClick"])) : vue.createCommentVNode("", true)
98
+ ])
99
+ ], 2);
100
+ }), 128)),
101
+ Object.keys(value.value).length == 0 ? (vue.openBlock(), vue.createBlock(vue.unref(index$4.NoData), {
102
+ key: 1,
103
+ value: "空对象"
104
+ })) : vue.createCommentVNode("", true),
105
+ vue.createVNode(vue.unref(index$5.EditDataAdd), vue.mergeProps(props, {
106
+ type: "object",
107
+ title: "新增对象",
108
+ modelValue: box.value,
109
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => box.value = $event),
110
+ onSubmit
111
+ }), null, 16, ["modelValue"])
112
+ ], 2);
113
+ };
114
+ }
115
+ });
116
+ exports.default = _sfc_main;
@@ -0,0 +1,116 @@
1
+ import { defineComponent, ref, computed, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, createBlock, createVNode, withCtx, createTextVNode, Fragment, renderList, createElementVNode, toDisplayString, mergeProps } from "vue";
2
+ import { NoData } from "../../../no-data/index.js";
3
+ import { Icon } from "../../../icon/index.js";
4
+ import Delete from "../../../../icons/vue/delete.js";
5
+ import { dataDataEmits, dataDataProps, name } from "../data.js";
6
+ import { useCssName } from "../../../../hooks/cssname/index.js";
7
+ import { useLocale } from "../../../../hooks/locale/index.js";
8
+ import "../index.js";
9
+ import { Button } from "../../../button/index.js";
10
+ import { EditDataAdd } from "../../../edit-data-add/index.js";
11
+ import _sfc_main$1 from "../index2.js";
12
+ const _sfc_main = /* @__PURE__ */ defineComponent({
13
+ __name: "object",
14
+ props: dataDataProps,
15
+ emits: dataDataEmits,
16
+ setup(__props, { expose: __expose, emit: __emit }) {
17
+ const cs = useCssName(name);
18
+ const { getLocale } = useLocale();
19
+ const props = __props;
20
+ const emit = __emit;
21
+ const box = ref(false);
22
+ const value = computed({
23
+ get() {
24
+ return props.modelValue;
25
+ },
26
+ set(value2) {
27
+ emit("update:modelValue", value2);
28
+ }
29
+ });
30
+ const updateValue = (index, v) => {
31
+ value.value[index] = v;
32
+ };
33
+ const onAdd = () => {
34
+ box.value = true;
35
+ };
36
+ const onSubmit = (v) => {
37
+ value.value[v.label] = v.value;
38
+ };
39
+ const onDelete = (index) => {
40
+ value.value[index] = void 0;
41
+ delete value.value[index];
42
+ };
43
+ __expose({});
44
+ return (_ctx, _cache) => {
45
+ return openBlock(), createElementBlock("div", {
46
+ class: normalizeClass(unref(cs).z("area-object"))
47
+ }, [
48
+ props.addable || props.editable ? (openBlock(), createElementBlock("div", {
49
+ key: 0,
50
+ class: normalizeClass(unref(cs).z("area-object-add"))
51
+ }, [
52
+ createVNode(unref(Button), {
53
+ type: "primary",
54
+ onClick: onAdd
55
+ }, {
56
+ default: withCtx(() => [..._cache[1] || (_cache[1] = [
57
+ createTextVNode(" 添加 ", -1)
58
+ ])]),
59
+ _: 1
60
+ })
61
+ ], 2)) : createCommentVNode("", true),
62
+ (openBlock(true), createElementBlock(Fragment, null, renderList(value.value, (item, index) => {
63
+ return openBlock(), createElementBlock("div", {
64
+ class: normalizeClass(unref(cs).z("area-comp-li")),
65
+ key: index
66
+ }, [
67
+ createElementVNode("div", {
68
+ class: normalizeClass(unref(cs).z("area-comp-li-div"))
69
+ }, [
70
+ createElementVNode("span", {
71
+ class: normalizeClass(unref(cs).z("area-comp-li-name"))
72
+ }, toDisplayString(index), 3),
73
+ createVNode(_sfc_main$1, mergeProps({ ref_for: true }, props, {
74
+ type: void 0,
75
+ modelValue: item,
76
+ "onUpdate:modelValue": (val) => updateValue(index, val)
77
+ }), null, 16, ["modelValue", "onUpdate:modelValue"])
78
+ ], 2),
79
+ createElementVNode("div", null, [
80
+ props.editable ? (openBlock(), createBlock(unref(Button), {
81
+ key: 0,
82
+ type: "danger",
83
+ onClick: ($event) => onDelete(index),
84
+ text: ""
85
+ }, {
86
+ default: withCtx(() => [
87
+ createVNode(unref(Icon), { title: "删除" }, {
88
+ default: withCtx(() => [
89
+ createVNode(Delete)
90
+ ]),
91
+ _: 1
92
+ })
93
+ ]),
94
+ _: 1
95
+ }, 8, ["onClick"])) : createCommentVNode("", true)
96
+ ])
97
+ ], 2);
98
+ }), 128)),
99
+ Object.keys(value.value).length == 0 ? (openBlock(), createBlock(unref(NoData), {
100
+ key: 1,
101
+ value: "空对象"
102
+ })) : createCommentVNode("", true),
103
+ createVNode(unref(EditDataAdd), mergeProps(props, {
104
+ type: "object",
105
+ title: "新增对象",
106
+ modelValue: box.value,
107
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => box.value = $event),
108
+ onSubmit
109
+ }), null, 16, ["modelValue"])
110
+ ], 2);
111
+ };
112
+ }
113
+ });
114
+ export {
115
+ _sfc_main as default
116
+ };
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
+ const array_vue_vue_type_script_setup_true_lang = require("./array2.cjs");
4
+ exports.default = array_vue_vue_type_script_setup_true_lang.default;
@@ -0,0 +1,4 @@
1
+ import _sfc_main from "./array2.js";
2
+ export {
3
+ _sfc_main as default
4
+ };