geekplus-digital-ui 0.1.28 → 0.1.30

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.
@@ -1,5 +1,5 @@
1
1
  export const DEditor: import('vue').DefineComponent<{}, {
2
- $emit: (event: "add-image" | "update:model-value", ...args: any[]) => void;
2
+ $emit: (event: "update:model-value", ...args: any[]) => void;
3
3
  disabled: boolean;
4
4
  modelValue: string;
5
5
  mode: string;
@@ -1,5 +1,5 @@
1
1
  declare const _default: import('vue').DefineComponent<{}, {
2
- $emit: (event: "add-image" | "update:model-value", ...args: any[]) => void;
2
+ $emit: (event: "update:model-value", ...args: any[]) => void;
3
3
  disabled: boolean;
4
4
  modelValue: string;
5
5
  mode: string;
@@ -1,14 +1,15 @@
1
- import { ref as n, computed as s, createApp as $, watch as b, nextTick as F, onBeforeUnmount as M, openBlock as w, createElementBlock as G, normalizeClass as J, withDirectives as K, createVNode as x, unref as C, vShow as Q, normalizeStyle as W, createBlock as X, createCommentVNode as Y } from "vue";
2
- import { i18nChangeLanguage as Z } from "@wangeditor-next/editor";
3
- import { Toolbar as _, Editor as ee } from "@wangeditor-next/editor-for-vue";
1
+ import { ref as a, computed as s, createApp as W, watch as h, nextTick as G, onBeforeUnmount as J, openBlock as x, createElementBlock as K, normalizeClass as Q, withDirectives as X, createVNode as I, unref as y, vShow as Y, normalizeStyle as Z, createBlock as _, createCommentVNode as ee } from "vue";
2
+ import { i18nChangeLanguage as te } from "@wangeditor-next/editor";
3
+ import { Toolbar as oe, Editor as le } from "@wangeditor-next/editor-for-vue";
4
4
  import './editor2.css';import './editor.css';/* empty css */
5
5
  import "../../../hooks/index.js";
6
- import { useFormItem as te, ElImageViewer as oe } from "element-plus";
7
- import le from "./code-collapse.vue.js";
6
+ import { useFormItem as ae, ElImageViewer as ne } from "element-plus";
7
+ import re from "./code-collapse.vue.js";
8
+ import { normalizeTableColumnWidths as B } from "./table-width.js";
8
9
  /* empty css */
9
- import ae from "../../../_virtual/_plugin-vue_export-helper.js";
10
- import { useLocale as ne } from "../../../hooks/use-locale/index.js";
11
- const re = /* @__PURE__ */ Object.assign({
10
+ import ie from "../../../_virtual/_plugin-vue_export-helper.js";
11
+ import { useLocale as de } from "../../../hooks/use-locale/index.js";
12
+ const ce = /* @__PURE__ */ Object.assign({
12
13
  name: "DEditor"
13
14
  }, {
14
15
  __name: "editor",
@@ -47,107 +48,110 @@ const re = /* @__PURE__ */ Object.assign({
47
48
  },
48
49
  placeholder: String
49
50
  },
50
- emits: ["add-image", "update:model-value"],
51
- setup(l, { emit: I }) {
52
- const o = l, V = I, B = n(null), r = n(null), h = n(""), y = n(0), u = n(!1), m = n([]), f = n(0), p = /* @__PURE__ */ new Map(), { t: S, getLocale: N } = ne(), { formItem: E } = te(), A = s(() => N()), R = (e) => {
51
+ emits: ["update:model-value"],
52
+ setup(n, { emit: S }) {
53
+ const o = n, N = S, z = a(null), r = a(null), V = a(""), u = a(""), m = a(null), E = a(0), f = a(!1), p = a([]), g = a(0), v = /* @__PURE__ */ new Map(), { t: A, getLocale: R } = de(), { formItem: k } = ae(), T = s(() => R()), L = (e) => {
53
54
  r.value = Object.seal(e);
54
- }, L = (e) => {
55
- let t = e;
56
- t === "<p><br></p>" && (t = ""), t !== h.value && (h.value = t, V("update:model-value", t), E?.validate("change"), E?.validate("blur"));
57
55
  }, O = (e) => {
56
+ let t = e;
57
+ t === "<p><br></p>" && (t = "");
58
+ const l = B(t);
59
+ l !== u.value && (m.value = l, u.value = l, N("update:model-value", l), k?.validate("change"), k?.validate("blur"));
60
+ }, j = (e) => {
58
61
  if (!o.disabled)
59
62
  return;
60
63
  const t = e?.target?.closest?.("img");
61
64
  if (!t)
62
65
  return;
63
- const a = r.value?.getEditableContainer?.(), i = Array.from(a?.querySelectorAll?.("img") || []);
66
+ const l = r.value?.getEditableContainer?.(), i = Array.from(l?.querySelectorAll?.("img") || []);
64
67
  if (i.length === 0)
65
68
  return;
66
- const g = (d) => d?.currentSrc || d?.src || d?.getAttribute?.("data-src") || "", v = i.map(g).filter(Boolean);
67
- if (v.length === 0)
69
+ const b = (d) => d?.currentSrc || d?.src || d?.getAttribute?.("data-src") || "", C = i.map(b).filter(Boolean);
70
+ if (C.length === 0)
68
71
  return;
69
- const P = g(t), k = v.findIndex((d) => d === P);
70
- m.value = v, f.value = k >= 0 ? k : 0, u.value = !0, e?.stopPropagation?.();
71
- }, T = (e) => {
72
+ const F = b(t), w = C.findIndex((d) => d === F);
73
+ p.value = C, g.value = w >= 0 ? w : 0, f.value = !0, e?.stopPropagation?.();
74
+ }, U = (e) => {
72
75
  if (o.disabled) {
73
- O(e);
76
+ j(e);
74
77
  return;
75
78
  }
76
79
  r.value?.focus?.();
77
- }, j = () => {
78
- u.value = !1, m.value = [], f.value = 0;
80
+ }, D = () => {
81
+ f.value = !1, p.value = [], g.value = 0;
79
82
  }, c = () => {
80
- p.forEach(({ app: e, host: t, pre: a }) => {
81
- t?.isConnected && a?.isConnected && t.parentNode && t.parentNode.insertBefore(a, t), e.unmount(), t?.remove();
82
- }), p.clear();
83
- }, z = (e) => {
83
+ v.forEach(({ app: e, host: t, pre: l }) => {
84
+ t?.isConnected && l?.isConnected && t.parentNode && t.parentNode.insertBefore(l, t), e.unmount(), t?.remove();
85
+ }), v.clear();
86
+ }, H = (e) => {
84
87
  const t = document.createElement("div");
85
88
  e.parentNode?.insertBefore(t, e);
86
- const a = $(le), i = a.mount(t);
87
- (i.contentRef?.value || i.contentRef)?.appendChild(e), p.set(e, {
88
- app: a,
89
+ const l = W(re), i = l.mount(t);
90
+ (i.contentRef?.value || i.contentRef)?.appendChild(e), v.set(e, {
91
+ app: l,
89
92
  host: t,
90
93
  pre: e
91
94
  });
92
- }, U = () => {
95
+ }, q = () => {
93
96
  const e = r.value?.getEditableContainer?.()?.querySelectorAll("pre");
94
97
  e && e.forEach((t) => {
95
- t.parentElement?.tagName !== "DETAILS" && z(t);
98
+ t.parentElement?.tagName !== "DETAILS" && H(t);
96
99
  });
97
- }, D = s(() => ({
100
+ }, M = s(() => ({
98
101
  ...o.toolbarConfig
99
- })), H = s(() => ({
100
- placeholder: o.disabled ? "" : o.placeholder || S("d.editor.placeholder"),
102
+ })), P = s(() => ({
103
+ placeholder: o.disabled ? "" : o.placeholder || A("d.editor.placeholder"),
101
104
  readOnly: o.disabled,
102
105
  ...o.editorConfig
103
- })), q = s(() => ({
104
- "--minHeight": o.border ? `${o.minHeight}px` : ""
106
+ })), $ = s(() => ({
107
+ "--minHeight": o.disabled ? "" : `${o.minHeight}px`
105
108
  }));
106
- return b(A, (e) => {
107
- Z(e === "zh-cn" ? "zh-CN" : "en");
108
- }, { immediate: !0 }), b(() => o.disabled, () => {
109
- c(), y.value++;
110
- }), b(() => o.modelValue, () => {
111
- o.disabled ? F(() => {
112
- c(), U();
109
+ return h(T, (e) => {
110
+ te(e === "zh-cn" ? "zh-CN" : "en");
111
+ }, { immediate: !0 }), h(() => o.disabled, () => {
112
+ c(), E.value++;
113
+ }), h(() => o.modelValue, () => {
114
+ const e = B(o.modelValue);
115
+ u.value = e, m.value === o.modelValue ? m.value = null : V.value = e, o.disabled ? G(() => {
116
+ c(), q();
113
117
  }) : c();
114
- }, { immediate: !0 }), M(() => {
118
+ }, { immediate: !0 }), J(() => {
115
119
  c(), r.value?.destroy?.();
116
- }), (e, t) => (w(), G("div", {
120
+ }), (e, t) => (x(), K("div", {
117
121
  ref_key: "rootRef",
118
- ref: B,
119
- key: y.value,
120
- class: J(["d-editor", { "editor-border": l.border, "editor-disabled": l.disabled }])
122
+ ref: z,
123
+ key: E.value,
124
+ class: Q(["d-editor", { "editor-border": n.border, "editor-disabled": n.disabled }])
121
125
  }, [
122
- K(x(C(_), {
126
+ X(I(y(oe), {
123
127
  class: "toolbar-container",
124
128
  editor: r.value,
125
- "default-config": D.value,
126
- mode: l.mode
129
+ "default-config": M.value,
130
+ mode: n.mode
127
131
  }, null, 8, ["editor", "default-config", "mode"]), [
128
- [Q, l.showToolbar && !l.disabled]
132
+ [Y, n.showToolbar && !n.disabled]
129
133
  ]),
130
- x(C(ee), {
134
+ I(y(le), {
131
135
  class: "editor-container",
132
- style: W(q.value),
133
- "model-value": l.modelValue,
134
- "default-config": H.value,
135
- mode: l.mode,
136
- onOnCreated: R,
137
- "onUpdate:modelValue": L,
138
- onClick: T
136
+ style: Z($.value),
137
+ "model-value": V.value,
138
+ "default-config": P.value,
139
+ mode: n.mode,
140
+ onOnCreated: L,
141
+ "onUpdate:modelValue": O,
142
+ onClick: U
139
143
  }, null, 8, ["style", "model-value", "default-config", "mode"]),
140
- u.value ? (w(), X(C(oe), {
144
+ f.value ? (x(), _(y(ne), {
141
145
  key: 0,
142
- "url-list": m.value,
143
- "initial-index": f.value,
146
+ "url-list": p.value,
147
+ "initial-index": g.value,
144
148
  "hide-on-click-modal": "",
145
149
  teleported: "",
146
- onClose: j
147
- }, null, 8, ["url-list", "initial-index"])) : Y("", !0)
150
+ onClose: D
151
+ }, null, 8, ["url-list", "initial-index"])) : ee("", !0)
148
152
  ], 2));
149
153
  }
150
- }), be = /* @__PURE__ */ ae(re, [["__scopeId", "data-v-fa74014a"]]);
154
+ }), Ve = /* @__PURE__ */ ie(ce, [["__scopeId", "data-v-f8d9c2e5"]]);
151
155
  export {
152
- be as default
156
+ Ve as default
153
157
  };
@@ -1 +1 @@
1
- .d-editor[data-v-fa74014a]{width:100%}.d-editor.w-e-full-screen-container[data-v-fa74014a]{z-index:1000}.d-editor .toolbar-container[data-v-fa74014a]{border-bottom:1px solid var(--el-border-color)}.d-editor .toolbar-container[data-v-fa74014a] .w-e-toolbar{border-radius:4px}.d-editor .toolbar-container[data-v-fa74014a] .w-e-drop-panel{z-index:100}.d-editor .editor-container[data-v-fa74014a]{min-height:var(--minHeight);background:var(--el-fill-color-blank);border-radius:4px}.d-editor .editor-container[data-v-fa74014a] p[id^=w-e-element-paragraph-]{margin:10px 0}.d-editor .editor-container[data-v-fa74014a] .w-e-text-placeholder{font-style:normal;font-size:14px;line-height:normal;top:11px}.d-editor .editor-container[data-v-fa74014a] .w-e-image-container{width:500px}.d-editor .editor-container[data-v-fa74014a] pre :deep(code){text-shadow:none}.d-editor.editor-disabled[data-v-fa74014a]:not(.editor-border) div[id^=w-e-textarea-]{padding:0}.d-editor.editor-disabled[data-v-fa74014a]:not(.editor-border) p[id^=w-e-element-paragraph-]:first-child{margin-top:0}.d-editor.editor-disabled[data-v-fa74014a]:not(.editor-border) p[id^=w-e-element-paragraph-]:last-child{margin-bottom:0}.editor-border[data-v-fa74014a]{border:1px solid var(--el-border-color);border-radius:4px;background:var(--el-bg-color);transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.editor-border[data-v-fa74014a]:hover{border-color:var(--el-text-color-disabled)}.editor-disabled .editor-container[data-v-fa74014a] img{cursor:zoom-in}.el-form-item.is-error .editor-border[data-v-fa74014a]{border:1px solid var(--el-color-danger)}
1
+ .d-editor[data-v-f8d9c2e5]{width:100%}.d-editor.w-e-full-screen-container[data-v-f8d9c2e5]{z-index:1000}.d-editor .toolbar-container[data-v-f8d9c2e5]{border-bottom:1px solid var(--el-border-color)}.d-editor .toolbar-container[data-v-f8d9c2e5] .w-e-toolbar{border-radius:4px}.d-editor .toolbar-container[data-v-f8d9c2e5] .w-e-drop-panel{z-index:100}.d-editor .editor-container[data-v-f8d9c2e5]{min-height:var(--minHeight);background:var(--el-fill-color-blank);border-radius:4px}.d-editor .editor-container[data-v-f8d9c2e5] p[id^=w-e-element-paragraph-]{margin:10px 0}.d-editor .editor-container[data-v-f8d9c2e5] .w-e-text-placeholder{font-style:normal;font-size:14px;line-height:normal;top:11px}.d-editor .editor-container[data-v-f8d9c2e5] .w-e-image-container{width:500px}.d-editor .editor-container[data-v-f8d9c2e5] pre :deep(code){text-shadow:none}.d-editor.editor-disabled[data-v-f8d9c2e5]:not(.editor-border) div[id^=w-e-textarea-]{padding:0}.d-editor.editor-disabled[data-v-f8d9c2e5]:not(.editor-border) p[id^=w-e-element-paragraph-]:first-child{margin-top:0}.d-editor.editor-disabled[data-v-f8d9c2e5]:not(.editor-border) p[id^=w-e-element-paragraph-]:last-child{margin-bottom:0}.editor-border[data-v-f8d9c2e5]{border:1px solid var(--el-border-color);border-radius:4px;background:var(--el-bg-color);transition:border-color .2s cubic-bezier(.645,.045,.355,1)}.editor-border[data-v-f8d9c2e5]:hover{border-color:var(--el-text-color-disabled)}.editor-disabled .editor-container[data-v-f8d9c2e5] img{cursor:zoom-in}.el-form-item.is-error .editor-border[data-v-f8d9c2e5]{border:1px solid var(--el-color-danger)}
@@ -0,0 +1 @@
1
+ export function normalizeTableColumnWidths(html: any): any;
@@ -0,0 +1,63 @@
1
+ const d = /<table[\s>]/i, h = /<col(?:group)?[\s>]/i, p = /* @__PURE__ */ new Set(["TD", "TH"]), g = (t) => d.test(t) && h.test(t), l = (t) => {
2
+ if (t == null)
3
+ return "";
4
+ const e = `${t}`.trim();
5
+ return !e || e === "auto" ? "" : /^\d+(?:\.\d+)?$/.test(e) ? `${e}px` : e;
6
+ }, a = (t) => {
7
+ const e = l(t);
8
+ if (!e)
9
+ return null;
10
+ const r = Number.parseFloat(e);
11
+ return Number.isFinite(r) ? r : null;
12
+ }, A = (t) => t ? l(
13
+ t.getAttribute("width") || t.style?.width || t.getAttribute("data-width")
14
+ ) : "", c = (t, e) => {
15
+ if (!t || !e)
16
+ return !1;
17
+ let r = !1;
18
+ t.style.width !== e && (t.style.width = e, r = !0);
19
+ const n = a(e);
20
+ if (n != null) {
21
+ const s = `${n}`;
22
+ t.getAttribute("width") !== s && (t.setAttribute("width", s), r = !0);
23
+ }
24
+ return r;
25
+ }, b = (t) => {
26
+ if (t.length === 0)
27
+ return "";
28
+ if (t.length === 1)
29
+ return t[0];
30
+ const e = t.map(a);
31
+ return e.every((r) => r != null) ? `${e.reduce((r, n) => r + n, 0)}px` : t[0];
32
+ }, y = (t) => {
33
+ const e = Array.from(t.querySelectorAll("colgroup col"));
34
+ if (e.length === 0)
35
+ return !1;
36
+ const r = e.map(A);
37
+ if (r.every((o) => !o))
38
+ return !1;
39
+ let n = !1;
40
+ e.forEach((o, u) => {
41
+ n = c(o, r[u]) || n;
42
+ });
43
+ const s = t.querySelector("tr");
44
+ if (!s)
45
+ return n;
46
+ let i = 0;
47
+ return Array.from(s.children).filter((o) => p.has(o.tagName)).forEach((o) => {
48
+ const u = Number.parseInt(o.getAttribute("colspan") || "1", 10) || 1, f = r.slice(i, i + u).filter(Boolean);
49
+ n = c(o, b(f)) || n, i += u;
50
+ }), n;
51
+ }, T = (t) => {
52
+ if (!t || typeof t != "string" || !g(t) || typeof document > "u")
53
+ return t;
54
+ const e = document.createElement("template");
55
+ e.innerHTML = t;
56
+ let r = !1;
57
+ return e.content.querySelectorAll("table").forEach((n) => {
58
+ r = y(n) || r;
59
+ }), r ? e.innerHTML : t;
60
+ };
61
+ export {
62
+ T as normalizeTableColumnWidths
63
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekplus-digital-ui",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",