@pie-lib/text-select 4.0.7-next.20261019093941 → 4.0.7-next.20261019151920
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.
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
function e(t) {
|
|
3
3
|
var n, r, i = "";
|
|
4
4
|
if (typeof t == "string" || typeof t == "number") i += t;
|
|
5
|
-
else if (typeof t == "object")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
else if (typeof t == "object") {
|
|
6
|
+
if (Array.isArray(t)) {
|
|
7
|
+
var a = t.length;
|
|
8
|
+
for (n = 0; n < a; n++) t[n] && (r = e(t[n])) && (i && (i += " "), i += r);
|
|
9
|
+
} else for (r in t) t[r] && (i && (i += " "), i += r);
|
|
10
|
+
}
|
|
9
11
|
return i;
|
|
10
12
|
}
|
|
11
13
|
function t() {
|
|
@@ -49,7 +49,7 @@ var { translator: g } = m, _ = f("@pie-lib:text-select:token-select"), v = i("di
|
|
|
49
49
|
selectedCount = () => this.props.tokens.filter((e) => e.selected).length;
|
|
50
50
|
canSelectMore = (e) => {
|
|
51
51
|
let { maxNoOfSelections: t } = this.props;
|
|
52
|
-
return t === 1
|
|
52
|
+
return t === 1 || (_("[canSelectMore] maxNoOfSelections: ", t, "selectedCount: ", e), t <= 0 || isFinite(t) && e < t);
|
|
53
53
|
};
|
|
54
54
|
toggleToken = (t) => {
|
|
55
55
|
let n = (t.target.closest?.(`.${e.rootClassName}`))?.dataset?.indexkey;
|
|
@@ -100,7 +100,7 @@ var S = {
|
|
|
100
100
|
text: ""
|
|
101
101
|
};
|
|
102
102
|
getClassAndIconConfig = () => {
|
|
103
|
-
let { selectable: t, selected: n, className: i, disabled: a, highlight: o, correct: s, animationsDisabled: c, isMissing: l, operable: u } = this.props, d = "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0, f = r.rootClassName;
|
|
103
|
+
let { selectable: t, selected: n, className: i, disabled: a, highlight: o, correct: s, animationsDisabled: c, isMissing: l, operable: u } = this.props, d = "ontouchstart" in window || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0, f = r.rootClassName, m, v;
|
|
104
104
|
if (s === void 0 && n && a) return {
|
|
105
105
|
className: e(f, "selectedToken", "disabledBlack", i),
|
|
106
106
|
Component: p
|
|
@@ -122,8 +122,8 @@ var S = {
|
|
|
122
122
|
} : {
|
|
123
123
|
className: e(f, a && "disabled", t && !a && !d && "selectableToken", n && !a && "selectedToken", n && a && "disabledAndSelected", o && t && !a && !n && "highlight", u && !t && !n && "unavailable", c && "print", i),
|
|
124
124
|
Component: p,
|
|
125
|
-
Container:
|
|
126
|
-
Icon:
|
|
125
|
+
Container: m,
|
|
126
|
+
Icon: v
|
|
127
127
|
};
|
|
128
128
|
};
|
|
129
129
|
render() {
|
|
@@ -9,7 +9,8 @@ var r = (e, t) => t.children ? t.children.reduce(r, e) : t.value ? e + t.value :
|
|
|
9
9
|
end: t.position.end.offset
|
|
10
10
|
};
|
|
11
11
|
return e.concat([n]);
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
|
+
return e;
|
|
13
14
|
}, []), c = (e, t) => {
|
|
14
15
|
let n = [], r = e.children.reduce(function(e, t) {
|
|
15
16
|
if (t.type === "WhiteSpaceNode" && t.value === "\n") {
|
|
@@ -41,7 +42,8 @@ var r = (e, t) => t.children ? t.children.reduce(r, e) : t.value ? e + t.value :
|
|
|
41
42
|
end: t.position.end.offset
|
|
42
43
|
};
|
|
43
44
|
return e.concat([n]);
|
|
44
|
-
}
|
|
45
|
+
}
|
|
46
|
+
return e;
|
|
45
47
|
}, e) : e, e) : e, []), d = class {
|
|
46
48
|
constructor(e) {
|
|
47
49
|
this.results = e;
|
|
@@ -53,8 +55,7 @@ var r = (e, t) => t.children ? t.children.reduce(r, e) : t.value ? e + t.value :
|
|
|
53
55
|
return this.results.filter((e) => e.type === "within-selection").map((e) => e.token);
|
|
54
56
|
}
|
|
55
57
|
}, f = (e, n) => {
|
|
56
|
-
let { start: r, end: i } = e, a = (e) => r >= e.start && r < e.end, o = (e) => i > e.start && i <= e.end
|
|
57
|
-
return new d(t(n.map((e) => {
|
|
58
|
+
let { start: r, end: i } = e, a = (e) => r >= e.start && r < e.end, o = (e) => i > e.start && i <= e.end, s = n.map((e) => {
|
|
58
59
|
if (r === e.start && i === e.end) return {
|
|
59
60
|
token: e,
|
|
60
61
|
type: "exact-fit"
|
|
@@ -67,7 +68,8 @@ var r = (e, t) => t.children ? t.children.reduce(r, e) : t.value ? e + t.value :
|
|
|
67
68
|
token: e,
|
|
68
69
|
type: "overlap"
|
|
69
70
|
};
|
|
70
|
-
})
|
|
71
|
+
});
|
|
72
|
+
return new d(t(s));
|
|
71
73
|
}, p = (t) => {
|
|
72
74
|
if (Array.isArray(t)) {
|
|
73
75
|
let n = e(t);
|
|
@@ -76,7 +78,8 @@ var r = (e, t) => t.children ? t.children.reduce(r, e) : t.value ? e + t.value :
|
|
|
76
78
|
if (n === -1 && r !== -1) throw Error(`sort does not support intersecting tokens. a: ${e.start}-${e.end}, b: ${t.start}-${t.end}`);
|
|
77
79
|
return n;
|
|
78
80
|
}), n;
|
|
79
|
-
}
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
80
83
|
}, m = (e, t) => {
|
|
81
84
|
let n = e || "";
|
|
82
85
|
return !Array.isArray(t) || t.length === 0 ? [{
|
|
@@ -25,11 +25,15 @@ var f = l("@pie-lib:text-select:token-text"), p = s("span")(() => ({
|
|
|
25
25
|
}
|
|
26
26
|
})), m = ({ text: e, predefined: t, onClick: r, correct: i }) => {
|
|
27
27
|
let a = (e || "").replace(/\n/g, "<br>");
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (t) {
|
|
29
|
+
let e = n("predefined", i && "correct");
|
|
30
|
+
return /* @__PURE__ */ c(p, {
|
|
31
|
+
onClick: r,
|
|
32
|
+
className: e,
|
|
33
|
+
dangerouslySetInnerHTML: { __html: a }
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return /* @__PURE__ */ c("span", { dangerouslySetInnerHTML: { __html: a } });
|
|
33
37
|
}, h = [
|
|
34
38
|
"\n",
|
|
35
39
|
" ",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/text-select",
|
|
3
|
-
"version": "4.0.7-next.
|
|
3
|
+
"version": "4.0.7-next.20261019151920",
|
|
4
4
|
"description": "Some react components for text selection",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,14 +12,14 @@
|
|
|
12
12
|
"@emotion/styled": "^11.14.1",
|
|
13
13
|
"@mui/icons-material": "^7.3.4",
|
|
14
14
|
"@mui/material": "^7.3.4",
|
|
15
|
-
"@pie-element/shared-utils": "0.1.6-next.
|
|
15
|
+
"@pie-element/shared-utils": "0.1.6-next.20261019151920",
|
|
16
16
|
"@pie-framework/parse-english": "^1.0.0",
|
|
17
|
-
"@pie-lib/render-ui": "8.0.7-next.
|
|
18
|
-
"@pie-lib/style-utils": "3.0.2-next.
|
|
19
|
-
"@pie-lib/translator": "5.0.2-next.
|
|
17
|
+
"@pie-lib/render-ui": "8.0.7-next.20261019151920",
|
|
18
|
+
"@pie-lib/style-utils": "3.0.2-next.20261019151920",
|
|
19
|
+
"@pie-lib/translator": "5.0.2-next.20261019151920",
|
|
20
20
|
"debug": "^4.1.1",
|
|
21
21
|
"prop-types": "^15.6.2",
|
|
22
|
-
"@pie-element/shared-lodash": "0.1.3-next.
|
|
22
|
+
"@pie-element/shared-lodash": "0.1.3-next.20261019151920",
|
|
23
23
|
"clsx": "^2.1.1"
|
|
24
24
|
},
|
|
25
25
|
"type": "module",
|