@me-framework/me-ui-antdv-next 0.0.28 → 0.0.29

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,18 @@
1
+ /**
2
+ * MeInputProperty 纯函数校验与转换逻辑
3
+ *
4
+ * 此模块不依赖 Vue,便于复用与单测。
5
+ */
6
+ /** 生成简单唯一 id(组件内部用于定位行,避免用 key 定位导致表格重建丢焦点) */
7
+ export declare function genId(): string;
8
+ /** 将 key 统一为用于比较的小写形式(大小写不敏感) */
9
+ export declare function normalizeKey(key: string): string;
10
+ /**
11
+ * 找出重复的 key(大小写不敏感)。
12
+ * @returns 重复的原始 key 集合(含所有重复出现项的去重字符数组)
13
+ */
14
+ export declare function checkDuplicateKeys(rows: {
15
+ key: string;
16
+ }[]): string[];
17
+ /** 判断某 key 是否处于重复集合中(大小写不敏感) */
18
+ export declare function isDuplicateKey(key: string, duplicates: string[]): boolean;
@@ -1 +1 @@
1
- .me-load-json{display:inline-block}.me-load-json__editor{flex-direction:column;flex:1;width:100%;height:100%;min-height:400px;display:flex}.me-load-json__editor .editor{flex:1;width:100%;height:100%;min-height:0}.me-load-json-modal .ant-modal-body{flex-direction:column;min-height:400px;padding:0;display:flex}.me-load-json-modal .ant-modal-content{flex-direction:column;height:100%;display:flex}.me-load-json-modal .ant-modal{height:80vh;max-height:80vh}.me-load-json-modal.me-modal-wrap--fullscreen .ant-modal{height:100vh;max-height:100vh;padding-bottom:0;top:0}.me-load-json-modal.me-modal-wrap--fullscreen .ant-modal-body{flex:1;min-height:0}
1
+ .me-load-json{display:inline-block}.me-load-json__editor{flex-direction:column;flex:1;width:100%;height:100%;min-height:400px;display:flex}.me-load-json__editor .editor{flex:1;width:100%;height:100%;min-height:0}.me-load-json .me-modal__body{flex-direction:column;display:flex}.me-load-json__footer{justify-content:space-between;align-items:center;gap:12px;width:100%;display:flex}.me-load-json__footer-left,.me-load-json__footer-right{align-items:center;gap:8px;display:flex}
@@ -1,10 +1,11 @@
1
- import { computed as e, createBlock as t, createElementBlock as n, createElementVNode as r, createTextVNode as i, createVNode as a, defineComponent as o, onMounted as s, onUnmounted as c, openBlock as l, ref as u, renderSlot as d, resolveComponent as f, resolveDynamicComponent as p, toDisplayString as m, unref as h, watch as g, withCtx as _, withModifiers as v } from "vue";
2
- import { Download as y, Maximize as b, Minimize as x, Upload as S } from "@lucide/vue";
3
- import { message as C, theme as w } from "antdv-next";
4
- import T from "jsoneditor";
1
+ import { t as e } from "../chunks/modal-D4Tl-Qzk.js";
2
+ import { createElementBlock as t, createElementVNode as n, createTextVNode as r, createVNode as i, defineComponent as a, openBlock as o, ref as s, renderSlot as c, resolveComponent as l, unref as u, watch as d, withCtx as f } from "vue";
3
+ import { Download as p, Upload as m } from "@lucide/vue";
4
+ import { message as h } from "antdv-next";
5
+ import g from "jsoneditor";
5
6
  import "jsoneditor/dist/jsoneditor.min.css";
6
7
  //#region src/utils/index.ts
7
- function E(e = {}) {
8
+ function _(e = {}) {
8
9
  let { accept: t = "*", multiple: n = !1 } = e;
9
10
  return new Promise((e) => {
10
11
  let r = document.createElement("input");
@@ -32,7 +33,7 @@ function E(e = {}) {
32
33
  }
33
34
  //#endregion
34
35
  //#region src/components/load-json/index.vue?vue&type=script&setup=true&lang.ts
35
- var D = { class: "me-load-json" }, O = { class: "me-load-json__title-row" }, k = { class: "me-load-json__title-text" }, A = ["title"], j = { class: "me-load-json__editor" }, M = { class: "me-load-json__footer" }, N = { class: "me-load-json__footer-left" }, P = { class: "me-load-json__footer-right" }, F = /* @__PURE__ */ o({
36
+ var v = { class: "me-load-json" }, y = { class: "me-load-json__editor" }, b = { class: "me-load-json__footer" }, x = { class: "me-load-json__footer-left" }, S = { class: "me-load-json__footer-right" }, C = /* @__PURE__ */ a({
36
37
  name: "MeLoadJson",
37
38
  __name: "index",
38
39
  props: {
@@ -41,35 +42,10 @@ var D = { class: "me-load-json" }, O = { class: "me-load-json__title-row" }, k =
41
42
  width: { default: 800 }
42
43
  },
43
44
  emits: ["change"],
44
- setup(o, { expose: F, emit: I }) {
45
- let { defaultAlgorithm: L, darkAlgorithm: R } = w, z = o, B = I, V = u(!1), H = u(!1), U = u(), W = u(null), G = null, K = u(!1), q = () => {
46
- K.value = !K.value, requestAnimationFrame(() => {
47
- requestAnimationFrame(() => {
48
- window.dispatchEvent(new Event("resize"));
49
- });
50
- });
51
- }, J = e(() => {
52
- let e = ["me-load-json-modal-wrap"];
53
- return K.value && e.push("me-modal-wrap--fullscreen"), e.join(" ");
54
- }), Y = u(!1), X = () => {
55
- typeof document < "u" && (Y.value = document.documentElement.classList.contains("dark"));
56
- }, Z = null;
57
- s(() => {
58
- X(), typeof document < "u" && (Z = new MutationObserver(() => {
59
- X();
60
- }), Z.observe(document.documentElement, {
61
- attributes: !0,
62
- attributeFilter: ["class"]
63
- }));
64
- }), c(() => {
65
- Z?.disconnect(), Z = null;
66
- });
67
- let Q = e(() => ({
68
- algorithm: Y.value ? R : L,
69
- token: { borderRadius: 6 }
70
- }));
71
- g(W, (e) => {
72
- e ? G = new T(e, {
45
+ setup(a, { expose: C, emit: w }) {
46
+ let T = a, E = w, D = s(!1), O = s(!1), k = s(), A = s(null), j = null;
47
+ d(A, (e) => {
48
+ e ? j = new g(e, {
73
49
  mode: "code",
74
50
  modes: [
75
51
  "tree",
@@ -81,34 +57,34 @@ var D = { class: "me-load-json" }, O = { class: "me-load-json__title-row" }, k =
81
57
  language: "zh-CN",
82
58
  indentation: 2,
83
59
  onChange: () => {
84
- if (G) try {
85
- G.get(), H.value = !1;
60
+ if (j) try {
61
+ j.get(), O.value = !1;
86
62
  } catch {
87
- H.value = !0;
63
+ O.value = !0;
88
64
  }
89
65
  },
90
66
  onValidationError: (e) => {
91
- H.value = e.length > 0;
67
+ O.value = e.length > 0;
92
68
  }
93
- }, z.data || {}) : (G?.destroy(), G = null);
94
- }, { flush: "post" }), g(() => z.data, (e) => {
95
- G && V.value && (G.set(e || {}), H.value = !1);
69
+ }, T.data || {}) : (j?.destroy(), j = null);
70
+ }, { flush: "post" }), d(() => T.data, (e) => {
71
+ j && D.value && (j.set(e || {}), O.value = !1);
96
72
  });
97
- let $ = () => {
98
- V.value = !0;
99
- }, ee = () => {
100
- V.value = !1;
101
- }, te = () => {
102
- if (G) try {
103
- let e = G.get(), t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t), r = document.createElement("a");
73
+ let M = () => {
74
+ D.value = !0;
75
+ }, N = () => {
76
+ D.value = !1;
77
+ }, P = () => {
78
+ if (j) try {
79
+ let e = j.get(), t = new Blob([JSON.stringify(e, null, 2)], { type: "application/json" }), n = URL.createObjectURL(t), r = document.createElement("a");
104
80
  r.href = n;
105
81
  let i = /* @__PURE__ */ new Date(), a = (e) => e.toString().padStart(2, "0"), o = `${`${i.getFullYear()}-${a(i.getMonth() + 1)}-${a(i.getDate())}`}_${`${a(i.getHours())}:${a(i.getMinutes())}:${a(i.getSeconds())}`}`;
106
- r.download = `${z.title || "data"}_${o}.json`, r.click(), URL.revokeObjectURL(n);
82
+ r.download = `${T.title || "data"}_${o}.json`, r.click(), URL.revokeObjectURL(n);
107
83
  } catch {
108
- C.error("JSON 格式错误,无法导出");
84
+ h.error("JSON 格式错误,无法导出");
109
85
  }
110
- }, ne = async () => {
111
- let e = await E({
86
+ }, F = async () => {
87
+ let e = await _({
112
88
  accept: ".json",
113
89
  multiple: !1
114
90
  });
@@ -117,95 +93,85 @@ var D = { class: "me-load-json" }, O = { class: "me-load-json__title-row" }, k =
117
93
  t.readAsText(e, "utf-8"), t.onload = () => {
118
94
  try {
119
95
  let e = JSON.parse(t.result);
120
- G?.set(e), H.value = !1;
96
+ j?.set(e), O.value = !1;
121
97
  } catch {
122
- C.error("JSON 文件解析失败,请检查文件格式");
98
+ h.error("JSON 文件解析失败,请检查文件格式");
123
99
  }
124
100
  };
125
- }, re = () => {
126
- if (G) try {
127
- let e = G.get();
128
- U.value = e, B("change", e), V.value = !1;
101
+ }, I = () => {
102
+ if (j) try {
103
+ let e = j.get();
104
+ k.value = e, E("change", e), D.value = !1;
129
105
  } catch {
130
- C.error("JSON 格式错误,请检查");
106
+ h.error("JSON 格式错误,请检查");
131
107
  }
132
108
  };
133
- return F({
134
- getData: () => U.value,
135
- open: $
136
- }), (e, s) => {
137
- let c = f("a-button"), u = f("a-modal"), g = f("a-config-provider");
138
- return l(), n("div", D, [r("div", { onClick: $ }, [d(e.$slots, "default", {}, () => [a(c, {
109
+ return C({
110
+ getData: () => k.value,
111
+ open: M
112
+ }), (s, d) => {
113
+ let h = l("a-button");
114
+ return o(), t("div", v, [n("div", { onClick: M }, [c(s.$slots, "default", {}, () => [i(h, {
139
115
  type: "primary",
140
116
  size: "small"
141
117
  }, {
142
- icon: _(() => [a(h(y), { size: 14 })]),
143
- default: _(() => [s[1] ||= i(" 导入 JSON ", -1)]),
118
+ icon: f(() => [i(u(p), { size: 14 })]),
119
+ default: f(() => [d[1] ||= r(" 导入 JSON ", -1)]),
144
120
  _: 1
145
- })])]), a(g, { theme: Q.value }, {
146
- default: _(() => [a(u, {
147
- open: V.value,
148
- "onUpdate:open": s[0] ||= (e) => V.value = e,
149
- width: o.width,
150
- "wrap-class-name": J.value,
151
- footer: null,
152
- title: void 0,
153
- class: "me-load-json-modal",
154
- onCancel: ee
121
+ })])]), i(e, {
122
+ open: D.value,
123
+ "onUpdate:open": d[0] ||= (e) => D.value = e,
124
+ title: a.title,
125
+ width: a.width,
126
+ height: "80vh",
127
+ onCancel: N
128
+ }, {
129
+ footer: f(() => [n("div", b, [n("div", x, [c(s.$slots, "footer-left", {}, () => [i(h, {
130
+ size: "small",
131
+ onClick: P
155
132
  }, {
156
- title: _(() => [r("div", O, [r("span", k, m(o.title), 1), r("span", {
157
- class: "me-load-json__fullscreen-btn",
158
- role: "button",
159
- title: K.value ? "退出全屏" : "全屏",
160
- onClick: v(q, ["stop"])
161
- }, [(l(), t(p(K.value ? h(x) : h(b)), { size: 16 }))], 8, A)])]),
162
- default: _(() => [r("div", j, [r("div", {
163
- ref_key: "editorContainerRef",
164
- ref: W,
165
- class: "editor"
166
- }, null, 512)]), r("div", M, [r("div", N, [d(e.$slots, "footer-left", {}, () => [a(c, {
133
+ icon: f(() => [i(u(p), { size: 14 })]),
134
+ default: f(() => [d[2] ||= r(" 导出 ", -1)]),
135
+ _: 1
136
+ })])]), n("div", S, [
137
+ i(h, {
138
+ size: "small",
139
+ onClick: F
140
+ }, {
141
+ icon: f(() => [i(u(m), { size: 14 })]),
142
+ default: f(() => [d[3] ||= r(" 导入 ", -1)]),
143
+ _: 1
144
+ }),
145
+ i(h, {
146
+ type: "primary",
167
147
  size: "small",
168
- onClick: te
148
+ disabled: O.value,
149
+ onClick: I
169
150
  }, {
170
- icon: _(() => [a(h(y), { size: 14 })]),
171
- default: _(() => [s[2] ||= i(" 导出 ", -1)]),
151
+ default: f(() => [...d[4] ||= [r(" 确定 ", -1)]]),
172
152
  _: 1
173
- })])]), r("div", P, [
174
- a(c, {
175
- size: "small",
176
- onClick: ne
177
- }, {
178
- icon: _(() => [a(h(S), { size: 14 })]),
179
- default: _(() => [s[3] ||= i(" 导入 ", -1)]),
180
- _: 1
181
- }),
182
- a(c, {
183
- type: "primary",
184
- size: "small",
185
- disabled: H.value,
186
- onClick: re
187
- }, {
188
- default: _(() => [...s[4] ||= [i(" 确定 ", -1)]]),
189
- _: 1
190
- }, 8, ["disabled"]),
191
- d(e.$slots, "footer-right")
192
- ])])]),
193
- _: 3
194
- }, 8, [
195
- "open",
196
- "width",
197
- "wrap-class-name"
198
- ])]),
153
+ }, 8, ["disabled"]),
154
+ c(s.$slots, "footer-right")
155
+ ])])]),
156
+ default: f(() => [n("div", y, [n("div", {
157
+ ref_key: "editorContainerRef",
158
+ ref: A,
159
+ class: "editor"
160
+ }, null, 512)])]),
199
161
  _: 3
200
- }, 8, ["theme"])]);
162
+ }, 8, [
163
+ "open",
164
+ "title",
165
+ "width"
166
+ ])]);
201
167
  };
202
168
  }
203
169
  });
204
170
  //#endregion
205
171
  //#region src/components/load-json/index.ts
206
- F.install = (e) => {
207
- e.component("MeLoadJson", F);
172
+ C.install = (e) => {
173
+ e.component("MeLoadJson", C);
208
174
  };
209
- var I = F;
175
+ var w = C;
210
176
  //#endregion
211
- export { F as MeLoadJson, I as default };
177
+ export { C as MeLoadJson, w as default };
@@ -1,11 +1,11 @@
1
1
  import { MeLoadJsonProps } from './types';
2
- declare var __VLS_1: {}, __VLS_35: {}, __VLS_73: {};
2
+ declare var __VLS_1: {}, __VLS_24: {}, __VLS_62: {};
3
3
  type __VLS_Slots = {} & {
4
4
  default?: (props: typeof __VLS_1) => any;
5
5
  } & {
6
- 'footer-left'?: (props: typeof __VLS_35) => any;
6
+ 'footer-left'?: (props: typeof __VLS_24) => any;
7
7
  } & {
8
- 'footer-right'?: (props: typeof __VLS_73) => any;
8
+ 'footer-right'?: (props: typeof __VLS_62) => any;
9
9
  };
10
10
  declare const __VLS_base: import('vue').DefineComponent<MeLoadJsonProps, {
11
11
  /** 获取最终结果数据 */