@zealsolutions/zeal-ui 1.0.0-alpha.374 → 1.0.0-alpha.375
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.
- package/dist/components/sop-diff/index.js +57 -55
- package/dist/components/tiptap/index.js +1122 -1118
- package/dist/legacyHtml-qIyv-9pf.js +129 -0
- package/dist/utils/index.js +26 -20
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { n as D } from "../../legacyHtml-qIyv-9pf.js";
|
|
2
|
+
import { computed as F, openBlock as f, createElementBlock as b, createElementVNode as v, toDisplayString as x, createCommentVNode as S, Fragment as B, renderList as V, normalizeClass as T, createStaticVNode as U } from "vue";
|
|
3
|
+
import { _ as j } from "../../_plugin-vue_export-helper-CHgC5LLL.js";
|
|
4
|
+
const H = (e) => e === ">", A = (e) => e === "<", P = (e) => /^\s+$/.test(e), L = (e) => /^\s*<[^>]+>\s*$/.test(e), W = (e) => !L(e);
|
|
4
5
|
class O {
|
|
5
6
|
constructor(t, i, n) {
|
|
6
7
|
this.start_in_before = t, this.start_in_after = i, this.length = n, this.end_in_before = t + n - 1, this.end_in_after = i + n - 1;
|
|
@@ -13,7 +14,7 @@ function N(e) {
|
|
|
13
14
|
const l = e[r];
|
|
14
15
|
switch (t) {
|
|
15
16
|
case "tag":
|
|
16
|
-
|
|
17
|
+
H(l) ? (i += ">", n.push(i), i = "", t = P(l) ? "whitespace" : "char") : i += l;
|
|
17
18
|
break;
|
|
18
19
|
case "char":
|
|
19
20
|
A(l) ? (i && n.push(i), i = "<", t = "tag") : /\s/.test(l) ? (i && n.push(i), i = l, t = "whitespace") : /[\w#@]+/i.test(l) ? i += l : (i && n.push(i), i = l);
|
|
@@ -27,11 +28,11 @@ function N(e) {
|
|
|
27
28
|
}
|
|
28
29
|
return i && n.push(i), n;
|
|
29
30
|
}
|
|
30
|
-
function
|
|
31
|
+
function $(e, t, i, n, r, a, l) {
|
|
31
32
|
let u = n, s = a, d = 0, c = {}, p;
|
|
32
33
|
for (let o = n; o < r; o++) {
|
|
33
|
-
const
|
|
34
|
-
for (let R = 0,
|
|
34
|
+
const m = {}, g = e[o], y = i[g];
|
|
35
|
+
for (let R = 0, q = y.length; R < q; R++) {
|
|
35
36
|
const h = y[R];
|
|
36
37
|
if (h < a)
|
|
37
38
|
continue;
|
|
@@ -39,17 +40,17 @@ function H(e, t, i, n, r, a, l) {
|
|
|
39
40
|
break;
|
|
40
41
|
c[h - 1] == null && (c[h - 1] = 0);
|
|
41
42
|
const k = c[h - 1] + 1;
|
|
42
|
-
|
|
43
|
+
m[h] = k, k > d && (u = o - k + 1, s = h - k + 1, d = k);
|
|
43
44
|
}
|
|
44
|
-
c =
|
|
45
|
+
c = m;
|
|
45
46
|
}
|
|
46
47
|
return d !== 0 && (p = new O(u, s, d)), p;
|
|
47
48
|
}
|
|
48
49
|
function C(e, t, i, n, r, a, l, u) {
|
|
49
|
-
const s =
|
|
50
|
+
const s = $(e, t, i, n, r, a, l);
|
|
50
51
|
return s != null && (n < s.start_in_before && a < s.start_in_after && C(e, t, i, n, s.start_in_before, a, s.start_in_after, u), u.push(s), s.end_in_before <= r && s.end_in_after <= l && C(e, t, i, s.end_in_before + 1, r, s.end_in_after + 1, l, u)), u;
|
|
51
52
|
}
|
|
52
|
-
function
|
|
53
|
+
function z(e) {
|
|
53
54
|
if (e.find_these == null)
|
|
54
55
|
throw new Error("params must have find_these key");
|
|
55
56
|
if (e.in_these == null)
|
|
@@ -64,11 +65,11 @@ function W(e) {
|
|
|
64
65
|
}
|
|
65
66
|
return t;
|
|
66
67
|
}
|
|
67
|
-
function
|
|
68
|
-
const i = [], n =
|
|
68
|
+
function Q(e, t) {
|
|
69
|
+
const i = [], n = z({ find_these: e, in_these: t });
|
|
69
70
|
return C(e, t, n, 0, e.length, 0, t.length, i);
|
|
70
71
|
}
|
|
71
|
-
function
|
|
72
|
+
function Y(e, t) {
|
|
72
73
|
if (e == null)
|
|
73
74
|
throw new Error("before_tokens?");
|
|
74
75
|
if (t == null)
|
|
@@ -79,10 +80,10 @@ function z(e, t) {
|
|
|
79
80
|
"true,false": "insert",
|
|
80
81
|
"false,true": "delete",
|
|
81
82
|
"true,true": "none"
|
|
82
|
-
}, l =
|
|
83
|
+
}, l = Q(e, t);
|
|
83
84
|
l.push(new O(e.length, t.length, 0));
|
|
84
85
|
for (let c = 0, p = l.length; c < p; c++) {
|
|
85
|
-
const o = l[c],
|
|
86
|
+
const o = l[c], m = i === o.start_in_before, g = n === o.start_in_after, y = a[[m, g].toString()];
|
|
86
87
|
y !== "none" && r.push({
|
|
87
88
|
action: y,
|
|
88
89
|
start_in_before: i,
|
|
@@ -120,35 +121,35 @@ function I(e, t) {
|
|
|
120
121
|
let i = "", n = 0;
|
|
121
122
|
const r = t.length;
|
|
122
123
|
for (; !(n >= r); ) {
|
|
123
|
-
const a = G(n, t,
|
|
124
|
+
const a = G(n, t, W);
|
|
124
125
|
if (n += a.length, a.length !== 0 && (i += "<" + e + ">" + a.join("") + "</" + e + ">"), n >= r)
|
|
125
126
|
break;
|
|
126
|
-
const l = G(n, t,
|
|
127
|
+
const l = G(n, t, L);
|
|
127
128
|
n += l.length, i += l.join("");
|
|
128
129
|
}
|
|
129
130
|
return i;
|
|
130
131
|
}
|
|
131
|
-
const
|
|
132
|
+
const _ = {
|
|
132
133
|
equal: (e, t) => t.slice(e.start_in_before, +e.end_in_before + 1 || 9e9).join(""),
|
|
133
134
|
insert: (e, t, i) => I("ins", i.slice(e.start_in_after, +e.end_in_after + 1 || 9e9)),
|
|
134
135
|
delete: (e, t) => I("del", t.slice(e.start_in_before, +e.end_in_before + 1 || 9e9))
|
|
135
136
|
};
|
|
136
|
-
|
|
137
|
-
function
|
|
137
|
+
_.replace = (e, t, i) => _.delete(e, t, i) + _.insert(e, t, i);
|
|
138
|
+
function J(e, t, i) {
|
|
138
139
|
let n = "";
|
|
139
140
|
for (let r = 0, a = i.length; r < a; r++) {
|
|
140
141
|
const l = i[r];
|
|
141
|
-
n +=
|
|
142
|
+
n += _[l.action](l, e, t);
|
|
142
143
|
}
|
|
143
144
|
return n;
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
+
function K(e, t) {
|
|
146
147
|
if (e === t)
|
|
147
148
|
return e;
|
|
148
|
-
const i = N(e ?? ""), n = N(t ?? ""), r =
|
|
149
|
-
return
|
|
149
|
+
const i = N(e ?? ""), n = N(t ?? ""), r = Y(i, n);
|
|
150
|
+
return J(i, n, r);
|
|
150
151
|
}
|
|
151
|
-
const
|
|
152
|
+
const X = {
|
|
152
153
|
sop: {
|
|
153
154
|
title: (e) => [e.SOPCode, e.Name].filter(Boolean).join(" — "),
|
|
154
155
|
fields: [
|
|
@@ -345,18 +346,19 @@ function M(e) {
|
|
|
345
346
|
const t = String(e).trim().toLowerCase();
|
|
346
347
|
return t === "true" || t === "1" || t === "yes" ? "Yes" : t === "false" || t === "0" || t === "no" ? "No" : String(e);
|
|
347
348
|
}
|
|
348
|
-
|
|
349
|
-
|
|
349
|
+
const E = (e, t) => e.rich ? D(t) : t;
|
|
350
|
+
function he(e, t, i = {}, n = null) {
|
|
351
|
+
const r = X[e];
|
|
350
352
|
if (!r || !t)
|
|
351
353
|
return { title: "", sections: [] };
|
|
352
354
|
const a = { ...t, ...i }, l = n ? { ...n, ...i } : null, u = r.fields.map((s) => {
|
|
353
|
-
const d = s.bool ? M(a[s.key]) : a[s.key];
|
|
355
|
+
const d = s.bool ? M(a[s.key]) : E(s, a[s.key]);
|
|
354
356
|
if (!l)
|
|
355
357
|
return w(d) ? { label: s.label, value: d, rich: !!s.rich } : null;
|
|
356
|
-
const c = s.bool ? M(l[s.key]) : l[s.key];
|
|
358
|
+
const c = s.bool ? M(l[s.key]) : E(s, l[s.key]);
|
|
357
359
|
return !w(d) && !w(c) ? null : {
|
|
358
360
|
label: s.label,
|
|
359
|
-
value:
|
|
361
|
+
value: K(String(d ?? ""), String(c ?? "")),
|
|
360
362
|
rich: !!s.rich,
|
|
361
363
|
// original field richness — the modal uses it to pre-wrap plain diffs
|
|
362
364
|
diff: !0
|
|
@@ -364,25 +366,25 @@ function fe(e, t, i = {}, n = null) {
|
|
|
364
366
|
}).filter(Boolean);
|
|
365
367
|
return { title: r.title(n || t), sections: u };
|
|
366
368
|
}
|
|
367
|
-
const
|
|
369
|
+
const Z = { class: "flex flex-col h-full overflow-hidden" }, ee = { class: "text-style-sub-header font-medium text-app-950 leading-[1.3]" }, te = {
|
|
368
370
|
key: 0,
|
|
369
371
|
"data-testid": "preview-diff-legend",
|
|
370
372
|
class: "border-b-[1px] border-steel-300 dark:border-line px-6 py-[10px] flex items-center gap-[16px] text-[12px] text-[#697277] dark:text-content-muted shrink-0"
|
|
371
|
-
},
|
|
373
|
+
}, ie = /* @__PURE__ */ U('<span class="font-semibold" data-v-6cebbfea>Unpublished draft changes</span><span class="flex items-center gap-[5px]" data-v-6cebbfea><span class="inline-block w-[14px] h-[10px] rounded-[2px]" style="background-color:#d4fcbc;" data-v-6cebbfea></span>Added</span><span class="flex items-center gap-[5px]" data-v-6cebbfea><span class="inline-block w-[14px] h-[10px] rounded-[2px]" style="background-color:#fbb6c2;" data-v-6cebbfea></span>Removed</span>', 3), ne = {
|
|
372
374
|
key: 0,
|
|
373
375
|
"data-testid": "preview-diff-loading",
|
|
374
376
|
class: "italic"
|
|
375
|
-
},
|
|
377
|
+
}, re = { class: "flex-1 min-h-0 overflow-y-auto px-6 py-5" }, le = {
|
|
376
378
|
key: 0,
|
|
377
379
|
"data-testid": "preview-empty",
|
|
378
380
|
class: "text-[14px] text-[#697277] dark:text-content-muted"
|
|
379
|
-
},
|
|
381
|
+
}, ae = {
|
|
380
382
|
key: 1,
|
|
381
383
|
class: "flex flex-col gap-6"
|
|
382
|
-
},
|
|
384
|
+
}, se = { class: "font-semibold text-[13px] text-[#326d68] dark:text-proclusteal-950 leading-[1.2] mb-[6px]" }, oe = ["innerHTML"], ce = ["innerHTML"], ue = {
|
|
383
385
|
key: 2,
|
|
384
386
|
class: "text-[15px] text-black-950 dark:text-content leading-[1.5] whitespace-pre-wrap"
|
|
385
|
-
},
|
|
387
|
+
}, de = {
|
|
386
388
|
__name: "SopCompare",
|
|
387
389
|
props: {
|
|
388
390
|
title: { type: String, default: "" },
|
|
@@ -390,38 +392,38 @@ const K = { class: "flex flex-col h-full overflow-hidden" }, X = { class: "text-
|
|
|
390
392
|
loading: { type: Boolean, default: !1 }
|
|
391
393
|
},
|
|
392
394
|
setup(e) {
|
|
393
|
-
const t = e, i =
|
|
394
|
-
return (n, r) => (f(), b("div",
|
|
395
|
-
v("p",
|
|
396
|
-
i.value || e.loading ? (f(), b("div",
|
|
397
|
-
|
|
398
|
-
e.loading ? (f(), b("span",
|
|
395
|
+
const t = e, i = F(() => t.sections.some((n) => n.diff));
|
|
396
|
+
return (n, r) => (f(), b("div", Z, [
|
|
397
|
+
v("p", ee, x(e.title), 1),
|
|
398
|
+
i.value || e.loading ? (f(), b("div", te, [
|
|
399
|
+
ie,
|
|
400
|
+
e.loading ? (f(), b("span", ne, "Loading changes…")) : S("", !0)
|
|
399
401
|
])) : S("", !0),
|
|
400
|
-
v("div",
|
|
401
|
-
e.sections.length ? (f(), b("div",
|
|
402
|
-
(f(!0), b(
|
|
402
|
+
v("div", re, [
|
|
403
|
+
e.sections.length ? (f(), b("div", ae, [
|
|
404
|
+
(f(!0), b(B, null, V(e.sections, (a, l) => (f(), b("section", {
|
|
403
405
|
key: l,
|
|
404
406
|
"data-testid": "preview-section"
|
|
405
407
|
}, [
|
|
406
|
-
v("p",
|
|
408
|
+
v("p", se, x(a.label), 1),
|
|
407
409
|
a.diff ? (f(), b("div", {
|
|
408
410
|
key: 0,
|
|
409
|
-
class:
|
|
411
|
+
class: T(["preview-content text-[15px] text-black-950 dark:text-content leading-[1.5]", { "whitespace-pre-wrap": !a.rich }]),
|
|
410
412
|
innerHTML: a.value
|
|
411
|
-
}, null, 10,
|
|
413
|
+
}, null, 10, oe)) : a.rich ? (f(), b("div", {
|
|
412
414
|
key: 1,
|
|
413
415
|
class: "preview-content text-[15px] text-black-950 dark:text-content leading-[1.5]",
|
|
414
416
|
innerHTML: a.value
|
|
415
|
-
}, null, 8,
|
|
417
|
+
}, null, 8, ce)) : (f(), b("p", ue, x(a.value), 1))
|
|
416
418
|
]))), 128))
|
|
417
|
-
])) : (f(), b("p",
|
|
419
|
+
])) : (f(), b("p", le, " There is no content to preview yet. "))
|
|
418
420
|
])
|
|
419
421
|
]));
|
|
420
422
|
}
|
|
421
|
-
},
|
|
423
|
+
}, pe = /* @__PURE__ */ j(de, [["__scopeId", "data-v-6cebbfea"]]);
|
|
422
424
|
export {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
+
pe as SopCompare,
|
|
426
|
+
he as buildPreview,
|
|
425
427
|
w as hasContent,
|
|
426
|
-
|
|
428
|
+
K as htmlDiff
|
|
427
429
|
};
|