@onereach/ui-components-common 26.5.3-beta.5931.0 → 26.5.3-beta.5934.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.
- package/dist/helpers/flatten.d.ts +5 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers.js +20 -8
- package/dist/index.js +108 -107
- package/package.json +2 -2
- package/src/helpers/flatten.ts +24 -0
- package/src/helpers/index.ts +1 -0
package/dist/helpers/index.d.ts
CHANGED
package/dist/helpers.js
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
1
|
import "./dom-qGGG2YCX.js";
|
|
2
|
-
import { i as
|
|
3
|
-
const
|
|
4
|
-
const e =
|
|
5
|
-
if (
|
|
2
|
+
import { i as a } from "./isUndefined-B5qXrATz.js";
|
|
3
|
+
const i = (t, n) => {
|
|
4
|
+
const e = n.find((o) => t === o.value);
|
|
5
|
+
if (a(e))
|
|
6
6
|
throw new Error("[getItemByValue]: Item not found.");
|
|
7
7
|
return e;
|
|
8
|
-
},
|
|
8
|
+
}, h = (t, n) => t.map((e) => i(e, n)), d = async (t, n) => n.filter((e) => new RegExp(t, "i").test(e.label));
|
|
9
|
+
function p(t, n, e = 0) {
|
|
10
|
+
const o = [], s = (c, l) => {
|
|
11
|
+
c.forEach((r) => {
|
|
12
|
+
o.push({
|
|
13
|
+
...r,
|
|
14
|
+
level: l
|
|
15
|
+
}), r.children && r.children.length > 0 && n(r) && s(r.children, l + 1);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
return s(t, e), o;
|
|
19
|
+
}
|
|
9
20
|
export {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
21
|
+
p as flatten,
|
|
22
|
+
i as getItemByValue,
|
|
23
|
+
h as getItemsByValue,
|
|
24
|
+
d as searchItemsByLabel
|
|
13
25
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,120 +1,121 @@
|
|
|
1
1
|
import { DropdownClose as _, DropdownOpen as s } from "./directives.js";
|
|
2
|
-
import {
|
|
3
|
-
import { D as
|
|
4
|
-
import { D as x, T as
|
|
5
|
-
import { Spacing as
|
|
6
|
-
import { CODE_BACKSPACE as
|
|
7
|
-
import { r as
|
|
8
|
-
import { i as
|
|
9
|
-
import { g as
|
|
2
|
+
import { flatten as T, getItemByValue as a, getItemsByValue as t, searchItemsByLabel as r } from "./helpers.js";
|
|
3
|
+
import { D as A, L as O, o as D, M as C, T as i, a as N, b as X, c as S, d as P, e as L, f as M, g as l, h as m, i as u, j as I, k as n, l as g, m as p, u as H, n as F } from "./useValidationAttributes-Da9U8-T7.js";
|
|
4
|
+
import { D as x, T as B } from "./TimeFormat-CdFMIbra.js";
|
|
5
|
+
import { Spacing as d } from "./types.js";
|
|
6
|
+
import { CODE_BACKSPACE as c, CODE_BREAK as U, CODE_DELETE as V, CODE_DOWN as y, CODE_END as h, CODE_ENTER as v, CODE_ESC as W, CODE_HOME as k, CODE_LEFT as w, CODE_PAGEDOWN as K, CODE_PAGEUP as Y, CODE_RIGHT as j, CODE_SPACE as q, CODE_UP as Z, HSL_LIMITS as z, PLACEMENT_BOTTOM_END as Q, PLACEMENT_BOTTOM_START as J, PLACEMENT_LEFT_END as $, PLACEMENT_LEFT_START as ee, PLACEMENT_RIGHT_END as Ee, PLACEMENT_RIGHT_START as _e, PLACEMENT_TOP_END as se, PLACEMENT_TOP_START as Re, RX_ABBREVIATION_FROM_STRING as Te, RX_ARRAY_NOTATION as ae, RX_BV_PREFIX as te, RX_DATE as re, RX_DATE_SPLIT as oe, RX_DIGITS as Ae, RX_ENCODED_COMMA as Oe, RX_ENCODE_REVERSE as De, RX_EXTENSION as Ce, RX_HASH as ie, RX_HASH_ID as Ne, RX_HREF as Xe, RX_HTML_TAGS as Se, RX_HYPHENATE as Pe, RX_LONG_COLOR as Le, RX_LOWER_UPPER as Me, RX_NUMBER as le, RX_PLUS as me, RX_QUERY_START as ue, RX_REGEXP_REPLACE as Ie, RX_SHORT_COLOR as ne, RX_SPACES as ge, RX_SPACE_SPLIT as pe, RX_STAR as He, RX_START_SPACE_WORD as Fe, RX_TIME as fe, RX_TRIM_LEFT as xe, RX_TRIM_RIGHT as Be, RX_UNDERSCORE as be, RX_UN_KEBAB as de, exclude as Ge, extractCssVarName as ce, flattenDeep as Ue, generateColorFromString as Ve, generateHslFromString as ye, getAbbreviation as he, getHashOfString as ve, hexToRgb as We, hslToColorString as ke, include as we, isAncestor as Ke, isArray as Ye, isDescendant as je, isEmpty as qe, isEqual as Ze, isNil as ze, isNull as Qe, isNumber as Je, isObject as $e, isString as eE, normalize as EE, pxToRem as _E, rgbToHex as sE, toArray as RE } from "./utils.js";
|
|
7
|
+
import { r as aE } from "./dom-qGGG2YCX.js";
|
|
8
|
+
import { i as rE } from "./isUndefined-B5qXrATz.js";
|
|
9
|
+
import { g as AE, i as OE } from "./getPageElevations-BuZyM94T.js";
|
|
10
10
|
export {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
c as CODE_BACKSPACE,
|
|
12
|
+
U as CODE_BREAK,
|
|
13
|
+
V as CODE_DELETE,
|
|
14
|
+
y as CODE_DOWN,
|
|
15
|
+
h as CODE_END,
|
|
16
|
+
v as CODE_ENTER,
|
|
17
|
+
W as CODE_ESC,
|
|
18
|
+
k as CODE_HOME,
|
|
19
|
+
w as CODE_LEFT,
|
|
20
|
+
K as CODE_PAGEDOWN,
|
|
21
|
+
Y as CODE_PAGEUP,
|
|
22
|
+
j as CODE_RIGHT,
|
|
23
|
+
q as CODE_SPACE,
|
|
24
|
+
Z as CODE_UP,
|
|
25
|
+
A as DATE_FORMAT,
|
|
26
26
|
x as DateFormat,
|
|
27
27
|
_ as DropdownClose,
|
|
28
28
|
s as DropdownOpen,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
29
|
+
z as HSL_LIMITS,
|
|
30
|
+
O as LOCALE,
|
|
31
|
+
D as MAX_ZINDEX,
|
|
32
|
+
C as MIN_ZINDEX,
|
|
33
|
+
Q as PLACEMENT_BOTTOM_END,
|
|
34
|
+
J as PLACEMENT_BOTTOM_START,
|
|
35
|
+
$ as PLACEMENT_LEFT_END,
|
|
36
|
+
ee as PLACEMENT_LEFT_START,
|
|
37
|
+
Ee as PLACEMENT_RIGHT_END,
|
|
38
|
+
_e as PLACEMENT_RIGHT_START,
|
|
39
|
+
se as PLACEMENT_TOP_END,
|
|
40
|
+
Re as PLACEMENT_TOP_START,
|
|
41
|
+
Te as RX_ABBREVIATION_FROM_STRING,
|
|
42
|
+
ae as RX_ARRAY_NOTATION,
|
|
43
|
+
te as RX_BV_PREFIX,
|
|
44
|
+
re as RX_DATE,
|
|
45
|
+
oe as RX_DATE_SPLIT,
|
|
46
|
+
Ae as RX_DIGITS,
|
|
47
|
+
Oe as RX_ENCODED_COMMA,
|
|
48
|
+
De as RX_ENCODE_REVERSE,
|
|
49
|
+
Ce as RX_EXTENSION,
|
|
50
|
+
ie as RX_HASH,
|
|
51
|
+
Ne as RX_HASH_ID,
|
|
52
|
+
Xe as RX_HREF,
|
|
53
|
+
Se as RX_HTML_TAGS,
|
|
54
|
+
Pe as RX_HYPHENATE,
|
|
55
|
+
Le as RX_LONG_COLOR,
|
|
56
|
+
Me as RX_LOWER_UPPER,
|
|
57
|
+
le as RX_NUMBER,
|
|
58
58
|
me as RX_PLUS,
|
|
59
59
|
ue as RX_QUERY_START,
|
|
60
60
|
Ie as RX_REGEXP_REPLACE,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
61
|
+
ne as RX_SHORT_COLOR,
|
|
62
|
+
ge as RX_SPACES,
|
|
63
|
+
pe as RX_SPACE_SPLIT,
|
|
64
|
+
He as RX_STAR,
|
|
65
|
+
Fe as RX_START_SPACE_WORD,
|
|
66
|
+
fe as RX_TIME,
|
|
67
67
|
xe as RX_TRIM_LEFT,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
Ue as
|
|
78
|
-
Ve as
|
|
79
|
-
ye as
|
|
80
|
-
he as
|
|
81
|
-
|
|
82
|
-
a as
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
We as
|
|
86
|
-
ke as
|
|
87
|
-
we as
|
|
88
|
-
Ke as
|
|
89
|
-
Ye as
|
|
90
|
-
je as
|
|
91
|
-
qe as
|
|
92
|
-
Ze as
|
|
93
|
-
ze as
|
|
94
|
-
Qe as
|
|
95
|
-
Je as
|
|
96
|
-
$e as
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
EE as
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
N as
|
|
107
|
-
X as
|
|
108
|
-
S as
|
|
109
|
-
P as
|
|
110
|
-
L as
|
|
111
|
-
M as
|
|
68
|
+
Be as RX_TRIM_RIGHT,
|
|
69
|
+
be as RX_UNDERSCORE,
|
|
70
|
+
de as RX_UN_KEBAB,
|
|
71
|
+
d as Spacing,
|
|
72
|
+
i as TIME_FORMAT,
|
|
73
|
+
B as TimeFormat,
|
|
74
|
+
Ge as exclude,
|
|
75
|
+
ce as extractCssVarName,
|
|
76
|
+
T as flatten,
|
|
77
|
+
Ue as flattenDeep,
|
|
78
|
+
Ve as generateColorFromString,
|
|
79
|
+
ye as generateHslFromString,
|
|
80
|
+
he as getAbbreviation,
|
|
81
|
+
ve as getHashOfString,
|
|
82
|
+
a as getItemByValue,
|
|
83
|
+
t as getItemsByValue,
|
|
84
|
+
AE as getPageElevations,
|
|
85
|
+
We as hexToRgb,
|
|
86
|
+
ke as hslToColorString,
|
|
87
|
+
we as include,
|
|
88
|
+
Ke as isAncestor,
|
|
89
|
+
Ye as isArray,
|
|
90
|
+
je as isDescendant,
|
|
91
|
+
qe as isEmpty,
|
|
92
|
+
Ze as isEqual,
|
|
93
|
+
ze as isNil,
|
|
94
|
+
Qe as isNull,
|
|
95
|
+
Je as isNumber,
|
|
96
|
+
$e as isObject,
|
|
97
|
+
eE as isString,
|
|
98
|
+
rE as isUndefined,
|
|
99
|
+
OE as isVisible,
|
|
100
|
+
EE as normalize,
|
|
101
|
+
_E as pxToRem,
|
|
102
|
+
aE as requestAF,
|
|
103
|
+
sE as rgbToHex,
|
|
104
|
+
r as searchItemsByLabel,
|
|
105
|
+
RE as toArray,
|
|
106
|
+
N as useControlAttributes,
|
|
107
|
+
X as useDateFormat,
|
|
108
|
+
S as useDateMask,
|
|
109
|
+
P as useElevation,
|
|
110
|
+
L as useIdAttribute,
|
|
111
|
+
M as useLocale,
|
|
112
|
+
l as useOverflow,
|
|
112
113
|
m as usePopoverState,
|
|
113
114
|
u as useProxyModelValue,
|
|
114
115
|
I as useResponsive,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
n as useTheme,
|
|
117
|
+
g as useTimeFormat,
|
|
118
|
+
p as useTimeMask,
|
|
119
|
+
H as useToggle,
|
|
120
|
+
F as useValidationAttributes
|
|
120
121
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onereach/ui-components-common",
|
|
3
|
-
"version": "26.5.3-beta.
|
|
3
|
+
"version": "26.5.3-beta.5934.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"dev": "vite build --watch"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@onereach/styles": "^26.5.3-beta.
|
|
62
|
+
"@onereach/styles": "^26.5.3-beta.5934.0",
|
|
63
63
|
"@vueuse/core": "11.3.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export function flatten<T extends { children?: T[] }>(
|
|
2
|
+
items: T[],
|
|
3
|
+
shouldExpand: (item: T) => boolean,
|
|
4
|
+
level = 0,
|
|
5
|
+
): (T & { level: number })[] {
|
|
6
|
+
const result: (T & { level: number })[] = [];
|
|
7
|
+
|
|
8
|
+
const process = (itemsToProcess: T[], currentLevel: number) => {
|
|
9
|
+
itemsToProcess.forEach((item) => {
|
|
10
|
+
result.push({
|
|
11
|
+
...item,
|
|
12
|
+
level: currentLevel,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
if (item.children && item.children.length > 0 && shouldExpand(item)) {
|
|
16
|
+
process(item.children, currentLevel + 1);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
process(items, level);
|
|
22
|
+
|
|
23
|
+
return result;
|
|
24
|
+
}
|
package/src/helpers/index.ts
CHANGED