@hankchen/canvas-editor-vue 0.6.1 → 0.7.0

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 (36) hide show
  1. package/dist/{useDataSourceSchema-CG9EGzwc.js → DropdownMenu-CeUNKMDQ.js} +70 -84
  2. package/dist/ExpressionPathPicker-DchGsK70.js +739 -0
  3. package/dist/{canvas-CptBzpwT.js → canvas-D3fFnBqG.js} +527 -528
  4. package/dist/canvas.js +1 -1
  5. package/dist/index.js +14 -15
  6. package/dist/layer-panel/TemplateTableForm.d.ts +1 -27
  7. package/dist/{layer-panel-Cz-tmbJJ.js → layer-panel-BouAYiDq.js} +231 -257
  8. package/dist/layer-panel.js +1 -1
  9. package/dist/property-panel/PropertyField.d.ts +9 -2
  10. package/dist/property-panel/fieldSchema.d.ts +16 -10
  11. package/dist/property-panel/fields/RowsPathField.d.ts +17 -0
  12. package/dist/property-panel/fields/index.d.ts +1 -0
  13. package/dist/property-panel/usePropertyPanel.d.ts +11 -2
  14. package/dist/{property-panel-OBqd6D8W.js → property-panel-DJQJzioT.js} +271 -213
  15. package/dist/property-panel.js +2 -2
  16. package/dist/resourceTemplate-D-DKEo7Z.js +33 -0
  17. package/dist/shared/ExpressionPathPicker.d.ts +9 -2
  18. package/dist/shared/index.d.ts +13 -10
  19. package/dist/shared/pathPickerModel.d.ts +16 -3
  20. package/dist/shared/popupPosition.d.ts +2 -2
  21. package/dist/shared/rowsPathPickerSource.d.ts +15 -0
  22. package/dist/shared/useDataSourceSchema.d.ts +6 -0
  23. package/dist/{shared-wuupBoZg.js → shared-CRDKDSpa.js} +22 -22
  24. package/dist/shared.js +9 -10
  25. package/dist/{status-bar-DCuK2R88.js → status-bar-DBf5kIXY.js} +6 -6
  26. package/dist/status-bar.js +1 -1
  27. package/dist/style.css +1 -1
  28. package/dist/uploadFile-mXJVPEzm.js +653 -0
  29. package/dist/{useTransientFeedback-CTjmMmFF.js → useTransientFeedback-BN_O7V2w.js} +43 -28
  30. package/package.json +2 -2
  31. package/dist/popupPosition-Ck5Gsvjy.js +0 -526
  32. package/dist/resourceTemplate-cdcQtp9a.js +0 -246
  33. package/dist/shared/rowsPathCompletionSource.d.ts +0 -3
  34. package/dist/shared/usePathCompletion.d.ts +0 -18
  35. package/dist/uploadFile-DbB-KhII.js +0 -520
  36. package/dist/usePathCompletion-Do17CQ6l.js +0 -220
@@ -1,220 +0,0 @@
1
- import { a as e } from "./layerPath-uy2ywyld.js";
2
- import { a as t, g as n, i as r, m as i, r as a } from "./popupPosition-Ck5Gsvjy.js";
3
- import { nextTick as o, onMounted as s, onScopeDispose as c, reactive as l, toValue as u, watch as d } from "vue";
4
- //#region ../canvas-editor/src/shared/rowsPathCandidates.ts
5
- function f(e) {
6
- return e.type === "array" || e.items !== void 0;
7
- }
8
- function p(e) {
9
- return !f(e) && e.properties === void 0;
10
- }
11
- function m(e, t, n) {
12
- let r = {
13
- path: n === "" ? e : `${n}.${e}`,
14
- segment: e
15
- };
16
- return t.description !== void 0 && (r.description = t.description), t.title !== void 0 && (r.title = t.title), f(t) && (r.type = "array"), r;
17
- }
18
- function h(e, t) {
19
- let n = [];
20
- if (e.properties !== void 0) for (let [r, i] of e.properties) p(i) || n.push(m(r, i, t));
21
- return n;
22
- }
23
- function g(e, t) {
24
- if (e === null) return null;
25
- let r = t.split("."), i = t.endsWith(".") ? "" : r[r.length - 1], a = r.slice(0, -1), o = e;
26
- for (let e of a) {
27
- if (f(o)) return null;
28
- let t = n(o, [e]);
29
- if (t === null) return null;
30
- o = t;
31
- }
32
- return f(o) || p(o) ? null : {
33
- partial: i,
34
- candidates: h(o, a.join("."))
35
- };
36
- }
37
- function _(t, n, r) {
38
- if (r === null) return null;
39
- if (t === null || n === null) return r;
40
- let a = null;
41
- for (let o = 0; o < n.length; o += 1) {
42
- if (n[o] !== "template") continue;
43
- let s = e(t, n.slice(0, o));
44
- if (s === null || s.type !== "TableLayer" || (a = i(a ?? r, s.rowsPath), a === null)) return null;
45
- }
46
- return a ?? r;
47
- }
48
- //#endregion
49
- //#region src/shared/rowsPathCompletionSource.ts
50
- function v(e) {
51
- return e === null ? null : (t) => {
52
- let n = g(e, t);
53
- return n === null ? null : {
54
- partial: n.partial,
55
- candidates: n.candidates.map((e) => e.type === "array" ? {
56
- ...e,
57
- type: "行数组"
58
- } : e)
59
- };
60
- };
61
- }
62
- //#endregion
63
- //#region src/shared/usePathCompletion.ts
64
- var y = [
65
- "ArrowLeft",
66
- "ArrowRight",
67
- "Home",
68
- "End",
69
- "PageUp",
70
- "PageDown"
71
- ];
72
- function b(e) {
73
- return {
74
- kind: "fragment",
75
- start: -2,
76
- end: e.length + 2,
77
- raw: "",
78
- expr: e,
79
- error: null,
80
- diagnostic: null
81
- };
82
- }
83
- function x(e) {
84
- let n = l({
85
- open: !1,
86
- items: [],
87
- activeIndex: 0,
88
- top: 0,
89
- left: 0
90
- }), i = null, f = !1, p = "";
91
- function m() {
92
- n.open = !1, n.items = [], n.activeIndex = 0, p = "";
93
- }
94
- function h() {
95
- if (!n.open || !i) return;
96
- let t = r(i), o = e.popupEl ? u(e.popupEl) : null, s = a({
97
- anchor: t,
98
- popupWidth: o?.offsetWidth ?? 0,
99
- popupHeight: o?.offsetHeight ?? 0,
100
- viewportWidth: window.innerWidth,
101
- viewportHeight: window.innerHeight
102
- });
103
- n.top = s.top, n.left = s.left;
104
- }
105
- function g(t, r = !1) {
106
- if (!u(e.enabled)) {
107
- m();
108
- return;
109
- }
110
- let a = i;
111
- if (!a) {
112
- m();
113
- return;
114
- }
115
- let s = a.value.slice(0, a.selectionStart ?? a.value.length);
116
- if (s === "" && !r) {
117
- m();
118
- return;
119
- }
120
- let c = e.resolve(s);
121
- if (!c) {
122
- m();
123
- return;
124
- }
125
- let l = r ? c.candidates : c.candidates.filter((e) => e.segment.startsWith(c.partial));
126
- if (l.length === 0) {
127
- m();
128
- return;
129
- }
130
- p = c.partial, (n.open || t) && (n.items = l, n.activeIndex = 0, n.open = !0, h(), o(h));
131
- }
132
- function _(e) {
133
- let r = i;
134
- if (!n.open || f || !r) return;
135
- let a = n.items[e ?? n.activeIndex];
136
- if (!a) return;
137
- let o = r.value.slice(0, r.selectionStart ?? r.value.length), s = t(r.value, b(o), o.length, p, a);
138
- if (!s) {
139
- m();
140
- return;
141
- }
142
- r.value = s.value, r.setSelectionRange(s.cursor, s.cursor), r.dispatchEvent(new Event("input", { bubbles: !0 })), r.dispatchEvent(new Event("change", { bubbles: !0 })), m();
143
- }
144
- function v(e) {
145
- f || e.isComposing || g(!0);
146
- }
147
- function x() {
148
- f = !0;
149
- }
150
- function S() {
151
- f = !1, g(!0);
152
- }
153
- function C(e) {
154
- return f || e.isComposing || e.keyCode === 229;
155
- }
156
- function w(e) {
157
- if (!C(e)) {
158
- if (e.key === " " && (e.ctrlKey || e.metaKey)) {
159
- e.preventDefault(), g(!0, !0);
160
- return;
161
- }
162
- if (n.open) {
163
- if (e.key === "ArrowDown" || e.key === "ArrowUp") {
164
- e.preventDefault();
165
- let t = n.items.length;
166
- t > 0 && (n.activeIndex = (n.activeIndex + (e.key === "ArrowDown" ? 1 : t - 1)) % t);
167
- return;
168
- }
169
- if (e.key === "Enter" || e.key === "Tab") {
170
- e.preventDefault(), _();
171
- return;
172
- }
173
- e.key === "Escape" && (e.preventDefault(), m());
174
- }
175
- }
176
- }
177
- function T(e) {
178
- n.open && !C(e) && y.includes(e.key) && g(!1);
179
- }
180
- function E() {
181
- f || g(!1);
182
- }
183
- function D() {
184
- m();
185
- }
186
- function O(e) {
187
- n.open && e.target !== i && m();
188
- }
189
- function k() {
190
- h();
191
- }
192
- let A = [
193
- ["input", v],
194
- ["keydown", w],
195
- ["keyup", T],
196
- ["click", E],
197
- ["blur", D],
198
- ["compositionstart", x],
199
- ["compositionend", S]
200
- ];
201
- function j(e) {
202
- for (let [t, n] of A) e.addEventListener(t, n);
203
- }
204
- function M(e) {
205
- for (let [t, n] of A) e.removeEventListener(t, n);
206
- }
207
- function N(e) {
208
- i !== e && (i && M(i), i = e, e && j(e));
209
- }
210
- return s(() => N(e.target.value)), d(e.target, (e) => N(e)), d(() => u(e.enabled), (e) => {
211
- e || m();
212
- }), document.addEventListener("mousedown", O), window.addEventListener("scroll", k, !0), window.addEventListener("resize", k), c(() => {
213
- i && M(i), document.removeEventListener("mousedown", O), window.removeEventListener("scroll", k, !0), window.removeEventListener("resize", k);
214
- }), {
215
- popup: n,
216
- accept: _
217
- };
218
- }
219
- //#endregion
220
- export { v as n, _ as r, x as t };