@mrts/soltw 0.3.21 → 0.3.24
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/index.d.ts +125 -10
- package/dist/index.js +3298 -10
- package/dist/index.jsx +2893 -10
- package/package.json +2 -2
- package/dist/Block.d.ts +0 -13
- package/dist/Block.js +0 -33
- package/dist/Block.jsx +0 -24
- package/dist/items/IdLabel.d.ts +0 -15
- package/dist/items/IdLabel.js +0 -19
- package/dist/items/IdLabel.jsx +0 -19
- package/dist/items/Item.d.ts +0 -25
- package/dist/items/Item.js +0 -79
- package/dist/items/Item.jsx +0 -64
- package/dist/items/ItemGroup.d.ts +0 -24
- package/dist/items/ItemGroup.js +0 -87
- package/dist/items/ItemGroup.jsx +0 -64
- package/dist/node_modules/solid-js/dist/solid.js +0 -677
- package/dist/node_modules/solid-js/dist/solid.jsx +0 -654
- package/dist/node_modules/solid-js/web/dist/web.js +0 -694
- package/dist/node_modules/solid-js/web/dist/web.jsx +0 -678
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -1893
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.jsx +0 -1893
- package/dist/packages/common/dist/index.js +0 -4
- package/dist/packages/common/dist/index.jsx +0 -4
- package/dist/packages/common/dist/messages/index.js +0 -1
- package/dist/packages/common/dist/messages/index.jsx +0 -1
- package/dist/packages/common/dist/messages/logMessages.js +0 -14
- package/dist/packages/common/dist/messages/logMessages.jsx +0 -14
- package/dist/packages/common/dist/strings/index.js +0 -1
- package/dist/packages/common/dist/strings/index.jsx +0 -1
- package/dist/packages/common/dist/strings/tokenize.js +0 -47
- package/dist/packages/common/dist/strings/tokenize.jsx +0 -47
- package/dist/soltw.d.ts +0 -7
- package/dist/soltw.js +0 -10
- package/dist/soltw.jsx +0 -7
- package/dist/stylers/SVTStyler.d.ts +0 -32
- package/dist/stylers/SVTStyler.js +0 -65
- package/dist/stylers/SVTStyler.jsx +0 -65
- package/dist/stylers/Stylers.d.ts +0 -12
- package/dist/stylers/Stylers.js +0 -23
- package/dist/stylers/Stylers.jsx +0 -23
- package/dist/stylers/base.styler.d.ts +0 -6
- package/dist/stylers/base.styler.js +0 -71
- package/dist/stylers/base.styler.jsx +0 -71
- package/dist/stylers/index.js +0 -4
- package/dist/stylers/index.jsx +0 -4
- package/dist/stylers/normalizers.d.ts +0 -6
- package/dist/stylers/normalizers.js +0 -32
- package/dist/stylers/normalizers.jsx +0 -32
- package/dist/stylers/types.d.ts +0 -14
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrts/soltw",
|
|
3
3
|
"description": "S O L T W : SolidJS + tailwindcss ui components",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.24",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "9e127f5f0082dc4b9afdd957f0a8bfb51a6527f2"
|
|
44
44
|
}
|
package/dist/Block.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ISVTStyler, TagListArgument } from "./stylers/types.js";
|
|
2
|
-
import { Component, ParentProps } from "solid-js";
|
|
3
|
-
|
|
4
|
-
//#region src/Block.d.ts
|
|
5
|
-
type TProps = ParentProps & {
|
|
6
|
-
vtags?: TagListArgument;
|
|
7
|
-
styler?: ISVTStyler;
|
|
8
|
-
class?: string;
|
|
9
|
-
element?: string;
|
|
10
|
-
};
|
|
11
|
-
declare const Block: Component<TProps>;
|
|
12
|
-
//#endregion
|
|
13
|
-
export { Block };
|
package/dist/Block.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "./node_modules/solid-js/dist/solid.js";
|
|
2
|
-
import { Dynamic } from "./node_modules/solid-js/web/dist/web.js";
|
|
3
|
-
import { twMerge } from "./node_modules/tailwind-merge/dist/bundle-mjs.js";
|
|
4
|
-
import { Stylers } from "./stylers/Stylers.js";
|
|
5
|
-
import "./stylers/index.js";
|
|
6
|
-
|
|
7
|
-
//#region src/Block.tsx
|
|
8
|
-
const Block = (props) => {
|
|
9
|
-
const elementTag = () => props.element ?? "div";
|
|
10
|
-
const currentStyler = () => {
|
|
11
|
-
if (props.styler) return props.styler;
|
|
12
|
-
else return Stylers.base;
|
|
13
|
-
};
|
|
14
|
-
function blockClasses() {
|
|
15
|
-
const classes = currentStyler().classes("block", props.vtags) ?? [];
|
|
16
|
-
if (props.class) classes.push(props.class);
|
|
17
|
-
return twMerge(classes);
|
|
18
|
-
}
|
|
19
|
-
return createComponent(Dynamic, {
|
|
20
|
-
get component() {
|
|
21
|
-
return elementTag();
|
|
22
|
-
},
|
|
23
|
-
get ["class"]() {
|
|
24
|
-
return blockClasses();
|
|
25
|
-
},
|
|
26
|
-
get children() {
|
|
27
|
-
return props.children;
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
//#endregion
|
|
33
|
-
export { Block };
|
package/dist/Block.jsx
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { twMerge } from "./node_modules/tailwind-merge/dist/bundle-mjs.jsx";
|
|
2
|
-
import { Stylers } from "./stylers/Stylers.jsx";
|
|
3
|
-
import { Dynamic } from "./node_modules/solid-js/web/dist/web.jsx";
|
|
4
|
-
import "./stylers/index.jsx";
|
|
5
|
-
|
|
6
|
-
//#region src/Block.tsx
|
|
7
|
-
const Block = (props) => {
|
|
8
|
-
const elementTag = () => props.element ?? "div";
|
|
9
|
-
const currentStyler = () => {
|
|
10
|
-
if (props.styler) return props.styler;
|
|
11
|
-
else return Stylers.base;
|
|
12
|
-
};
|
|
13
|
-
function blockClasses() {
|
|
14
|
-
const classes = currentStyler().classes("block", props.vtags) ?? [];
|
|
15
|
-
if (props.class) classes.push(props.class);
|
|
16
|
-
return twMerge(classes);
|
|
17
|
-
}
|
|
18
|
-
return <Dynamic component={elementTag()} class={blockClasses()}>
|
|
19
|
-
{props.children}
|
|
20
|
-
</Dynamic>;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
//#endregion
|
|
24
|
-
export { Block };
|
package/dist/items/IdLabel.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region src/items/IdLabel.d.ts
|
|
2
|
-
interface IdLabel {
|
|
3
|
-
id: string;
|
|
4
|
-
label: string;
|
|
5
|
-
[x: string | symbol]: unknown;
|
|
6
|
-
}
|
|
7
|
-
type IdLabelDef = {
|
|
8
|
-
id: string;
|
|
9
|
-
label?: string;
|
|
10
|
-
[x: string | symbol]: unknown;
|
|
11
|
-
};
|
|
12
|
-
type IdLabelArg = IdLabelDef | [string, string] | string;
|
|
13
|
-
declare function buildIdLabel(arg: IdLabelArg): IdLabel;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { IdLabel, IdLabelArg, IdLabelDef, buildIdLabel };
|
package/dist/items/IdLabel.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/items/IdLabel.ts
|
|
2
|
-
function buildIdLabel(arg) {
|
|
3
|
-
if (typeof arg == "string") return {
|
|
4
|
-
id: arg,
|
|
5
|
-
label: arg
|
|
6
|
-
};
|
|
7
|
-
else if (Array.isArray(arg)) return {
|
|
8
|
-
id: arg[0],
|
|
9
|
-
label: arg[1]
|
|
10
|
-
};
|
|
11
|
-
else {
|
|
12
|
-
const r = Object.assign({}, arg);
|
|
13
|
-
if (r.label == void 0) r["label"] = r.id;
|
|
14
|
-
return r;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { buildIdLabel };
|
package/dist/items/IdLabel.jsx
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//#region src/items/IdLabel.ts
|
|
2
|
-
function buildIdLabel(arg) {
|
|
3
|
-
if (typeof arg == "string") return {
|
|
4
|
-
id: arg,
|
|
5
|
-
label: arg
|
|
6
|
-
};
|
|
7
|
-
else if (Array.isArray(arg)) return {
|
|
8
|
-
id: arg[0],
|
|
9
|
-
label: arg[1]
|
|
10
|
-
};
|
|
11
|
-
else {
|
|
12
|
-
const r = Object.assign({}, arg);
|
|
13
|
-
if (r.label == void 0) r["label"] = r.id;
|
|
14
|
-
return r;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
//#endregion
|
|
19
|
-
export { buildIdLabel };
|
package/dist/items/Item.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { IdLabel, IdLabelArg } from "./IdLabel.js";
|
|
2
|
-
import { ISVTStyler, TagListArgument } from "../stylers/types.js";
|
|
3
|
-
import { Component } from "solid-js";
|
|
4
|
-
|
|
5
|
-
//#region src/items/Item.d.ts
|
|
6
|
-
type TItemClass = {
|
|
7
|
-
item?: string;
|
|
8
|
-
selected?: string;
|
|
9
|
-
disabled?: string;
|
|
10
|
-
disabler?: string;
|
|
11
|
-
};
|
|
12
|
-
type TItemClassArg = TItemClass | string;
|
|
13
|
-
type TItemProps = {
|
|
14
|
-
idLabel: IdLabelArg;
|
|
15
|
-
callback?: (item: IdLabel) => void;
|
|
16
|
-
selected?: boolean;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
clickableWhendisabled?: boolean;
|
|
19
|
-
styler?: ISVTStyler;
|
|
20
|
-
vtags?: TagListArgument;
|
|
21
|
-
class?: TItemClassArg;
|
|
22
|
-
};
|
|
23
|
-
declare const Item: Component<TItemProps>;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { Item, TItemClass, TItemClassArg, TItemProps };
|
package/dist/items/Item.js
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { buildIdLabel } from "./IdLabel.js";
|
|
2
|
-
import { Show, createComponent, createMemo, createRenderEffect } from "../node_modules/solid-js/dist/solid.js";
|
|
3
|
-
import { className, delegateEvents, insert, template } from "../node_modules/solid-js/web/dist/web.js";
|
|
4
|
-
import { twMerge } from "../node_modules/tailwind-merge/dist/bundle-mjs.js";
|
|
5
|
-
import { Stylers } from "../stylers/Stylers.js";
|
|
6
|
-
|
|
7
|
-
//#region src/items/Item.tsx
|
|
8
|
-
var _tmpl$ = /* @__PURE__ */ template(`<div>`);
|
|
9
|
-
const Item = (props) => {
|
|
10
|
-
const itemData = () => buildIdLabel(props.idLabel);
|
|
11
|
-
const currentSTags = () => {
|
|
12
|
-
const r = [];
|
|
13
|
-
r.push("item");
|
|
14
|
-
if (props.selected) r.push("item:selected");
|
|
15
|
-
if (props.disabled) r.push("item:disabled");
|
|
16
|
-
return r;
|
|
17
|
-
};
|
|
18
|
-
const currentStyler = () => {
|
|
19
|
-
if (props.styler) return props.styler;
|
|
20
|
-
else return Stylers.base;
|
|
21
|
-
};
|
|
22
|
-
const classProp = createMemo(() => {
|
|
23
|
-
if (props.class == void 0) return {};
|
|
24
|
-
else if (typeof props.class == "string") return { item: props.class };
|
|
25
|
-
else return props.class;
|
|
26
|
-
});
|
|
27
|
-
const itemClasses = () => {
|
|
28
|
-
console.log("itemClasses", props.idLabel);
|
|
29
|
-
const stags = currentSTags();
|
|
30
|
-
const styler = currentStyler();
|
|
31
|
-
const rawClasses = [];
|
|
32
|
-
const stylerClasses = styler ? styler.classes(stags, props.vtags) : void 0;
|
|
33
|
-
rawClasses.push(...stylerClasses ?? []);
|
|
34
|
-
if (props.callback) rawClasses.push("select-none cursor-pointer");
|
|
35
|
-
const customClasses = classProp();
|
|
36
|
-
if (customClasses.item) rawClasses.push(customClasses.item);
|
|
37
|
-
if (props.selected && customClasses.selected) {
|
|
38
|
-
console.log("SELECTED", props.idLabel);
|
|
39
|
-
rawClasses.push(customClasses.selected);
|
|
40
|
-
}
|
|
41
|
-
if (props.disabled && customClasses.disabled) rawClasses.push(customClasses.disabled);
|
|
42
|
-
rawClasses.push("relative");
|
|
43
|
-
return twMerge(rawClasses);
|
|
44
|
-
};
|
|
45
|
-
const disablerClasses = createMemo(() => {
|
|
46
|
-
const rawClasses = [];
|
|
47
|
-
if (currentStyler()) rawClasses.push(...currentStyler().classes("item/disabler", props.vtags));
|
|
48
|
-
if (classProp().disabler) rawClasses.push(classProp().disabler);
|
|
49
|
-
rawClasses.push("absolute inset-0");
|
|
50
|
-
return twMerge(rawClasses);
|
|
51
|
-
});
|
|
52
|
-
function handleClick() {
|
|
53
|
-
if (props.callback != void 0) props.callback(itemData());
|
|
54
|
-
}
|
|
55
|
-
return (() => {
|
|
56
|
-
var _el$ = _tmpl$();
|
|
57
|
-
_el$.$$click = handleClick;
|
|
58
|
-
insert(_el$, () => itemData().label, null);
|
|
59
|
-
insert(_el$, createComponent(Show, {
|
|
60
|
-
get when() {
|
|
61
|
-
return props.disabled;
|
|
62
|
-
},
|
|
63
|
-
get children() {
|
|
64
|
-
var _el$2 = _tmpl$();
|
|
65
|
-
_el$2.$$click = (e) => {
|
|
66
|
-
if (!props.clickableWhendisabled) e.stopPropagation();
|
|
67
|
-
};
|
|
68
|
-
createRenderEffect(() => className(_el$2, disablerClasses()));
|
|
69
|
-
return _el$2;
|
|
70
|
-
}
|
|
71
|
-
}), null);
|
|
72
|
-
createRenderEffect(() => className(_el$, itemClasses()));
|
|
73
|
-
return _el$;
|
|
74
|
-
})();
|
|
75
|
-
};
|
|
76
|
-
delegateEvents(["click"]);
|
|
77
|
-
|
|
78
|
-
//#endregion
|
|
79
|
-
export { Item };
|
package/dist/items/Item.jsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { buildIdLabel } from "./IdLabel.jsx";
|
|
2
|
-
import { Show, createMemo } from "../node_modules/solid-js/dist/solid.jsx";
|
|
3
|
-
import { twMerge } from "../node_modules/tailwind-merge/dist/bundle-mjs.jsx";
|
|
4
|
-
import { Stylers } from "../stylers/Stylers.jsx";
|
|
5
|
-
|
|
6
|
-
//#region src/items/Item.tsx
|
|
7
|
-
const Item = (props) => {
|
|
8
|
-
const itemData = () => buildIdLabel(props.idLabel);
|
|
9
|
-
const currentSTags = () => {
|
|
10
|
-
const r = [];
|
|
11
|
-
r.push("item");
|
|
12
|
-
if (props.selected) r.push("item:selected");
|
|
13
|
-
if (props.disabled) r.push("item:disabled");
|
|
14
|
-
return r;
|
|
15
|
-
};
|
|
16
|
-
const currentStyler = () => {
|
|
17
|
-
if (props.styler) return props.styler;
|
|
18
|
-
else return Stylers.base;
|
|
19
|
-
};
|
|
20
|
-
const classProp = createMemo(() => {
|
|
21
|
-
if (props.class == void 0) return {};
|
|
22
|
-
else if (typeof props.class == "string") return { item: props.class };
|
|
23
|
-
else return props.class;
|
|
24
|
-
});
|
|
25
|
-
const itemClasses = () => {
|
|
26
|
-
console.log("itemClasses", props.idLabel);
|
|
27
|
-
const stags = currentSTags();
|
|
28
|
-
const styler = currentStyler();
|
|
29
|
-
const rawClasses = [];
|
|
30
|
-
const stylerClasses = styler ? styler.classes(stags, props.vtags) : void 0;
|
|
31
|
-
rawClasses.push(...stylerClasses ?? []);
|
|
32
|
-
if (props.callback) rawClasses.push("select-none cursor-pointer");
|
|
33
|
-
const customClasses = classProp();
|
|
34
|
-
if (customClasses.item) rawClasses.push(customClasses.item);
|
|
35
|
-
if (props.selected && customClasses.selected) {
|
|
36
|
-
console.log("SELECTED", props.idLabel);
|
|
37
|
-
rawClasses.push(customClasses.selected);
|
|
38
|
-
}
|
|
39
|
-
if (props.disabled && customClasses.disabled) rawClasses.push(customClasses.disabled);
|
|
40
|
-
rawClasses.push("relative");
|
|
41
|
-
return twMerge(rawClasses);
|
|
42
|
-
};
|
|
43
|
-
const disablerClasses = createMemo(() => {
|
|
44
|
-
const rawClasses = [];
|
|
45
|
-
if (currentStyler()) rawClasses.push(...currentStyler().classes("item/disabler", props.vtags));
|
|
46
|
-
if (classProp().disabler) rawClasses.push(classProp().disabler);
|
|
47
|
-
rawClasses.push("absolute inset-0");
|
|
48
|
-
return twMerge(rawClasses);
|
|
49
|
-
});
|
|
50
|
-
function handleClick() {
|
|
51
|
-
if (props.callback != void 0) props.callback(itemData());
|
|
52
|
-
}
|
|
53
|
-
return <div onClick={handleClick} class={itemClasses()}>
|
|
54
|
-
{itemData().label}
|
|
55
|
-
<Show when={props.disabled}>
|
|
56
|
-
<div class={disablerClasses()} onClick={(e) => {
|
|
57
|
-
if (!props.clickableWhendisabled) e.stopPropagation();
|
|
58
|
-
}}></div>
|
|
59
|
-
</Show>
|
|
60
|
-
</div>;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
//#endregion
|
|
64
|
-
export { Item };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IdLabel, IdLabelArg } from "./IdLabel.js";
|
|
2
|
-
import { TagListArgument } from "../stylers/types.js";
|
|
3
|
-
import { TItemClassArg } from "./Item.js";
|
|
4
|
-
import { Component } from "solid-js";
|
|
5
|
-
|
|
6
|
-
//#region src/items/ItemGroup.d.ts
|
|
7
|
-
type TProps = {
|
|
8
|
-
items: IdLabelArg[];
|
|
9
|
-
callback?: (item: IdLabel) => void;
|
|
10
|
-
class?: string | {
|
|
11
|
-
group?: string;
|
|
12
|
-
item?: TItemClassArg;
|
|
13
|
-
};
|
|
14
|
-
selection?: string | {
|
|
15
|
-
[id: string]: boolean;
|
|
16
|
-
};
|
|
17
|
-
vtags?: TagListArgument | {
|
|
18
|
-
group?: TagListArgument;
|
|
19
|
-
item?: TagListArgument;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
declare const ItemGroup: Component<TProps>;
|
|
23
|
-
//#endregion
|
|
24
|
-
export { ItemGroup };
|
package/dist/items/ItemGroup.js
DELETED
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { buildIdLabel } from "./IdLabel.js";
|
|
2
|
-
import { For, createComponent, createMemo } from "../node_modules/solid-js/dist/solid.js";
|
|
3
|
-
import { twMerge } from "../node_modules/tailwind-merge/dist/bundle-mjs.js";
|
|
4
|
-
import { argTokenizeBySpaces } from "../packages/common/dist/strings/tokenize.js";
|
|
5
|
-
import { Item } from "./Item.js";
|
|
6
|
-
import { Block } from "../Block.js";
|
|
7
|
-
|
|
8
|
-
//#region src/items/ItemGroup.tsx
|
|
9
|
-
const ItemGroup = (props) => {
|
|
10
|
-
const items = () => props.items.map(buildIdLabel);
|
|
11
|
-
const currentVTags = createMemo(() => {
|
|
12
|
-
const item = [];
|
|
13
|
-
const group = [];
|
|
14
|
-
const _vtags = props.vtags;
|
|
15
|
-
if (Array.isArray(_vtags) || typeof _vtags == "string") group.push(...argTokenizeBySpaces(_vtags));
|
|
16
|
-
else if (typeof _vtags == "object" && _vtags != null) {
|
|
17
|
-
group.push(...argTokenizeBySpaces(_vtags.group));
|
|
18
|
-
item.push(...argTokenizeBySpaces(_vtags.item));
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
group,
|
|
22
|
-
item
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
const classes = createMemo(() => {
|
|
26
|
-
let group = "";
|
|
27
|
-
let item = "";
|
|
28
|
-
if (typeof props.class == "string") group = props.class;
|
|
29
|
-
else if (props.class != void 0) {
|
|
30
|
-
props.class;
|
|
31
|
-
group = props.class.group ?? "";
|
|
32
|
-
item = props.class.item ?? "";
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
group,
|
|
36
|
-
item
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
const blockClasses = () => {
|
|
40
|
-
return twMerge("flex flex-row gap-1", classes().group);
|
|
41
|
-
};
|
|
42
|
-
const itemClasses = () => {
|
|
43
|
-
return classes().item;
|
|
44
|
-
};
|
|
45
|
-
const callCallback = (item) => {
|
|
46
|
-
if (props.callback) props.callback(item);
|
|
47
|
-
};
|
|
48
|
-
const itemSelected = (id) => {
|
|
49
|
-
if (typeof props.selection == "string") return id == props.selection;
|
|
50
|
-
else if (typeof props.selection == "object") return !!props.selection[id];
|
|
51
|
-
return false;
|
|
52
|
-
};
|
|
53
|
-
return createComponent(Block, {
|
|
54
|
-
get ["class"]() {
|
|
55
|
-
return blockClasses();
|
|
56
|
-
},
|
|
57
|
-
get vtags() {
|
|
58
|
-
return currentVTags().group;
|
|
59
|
-
},
|
|
60
|
-
get children() {
|
|
61
|
-
return createComponent(For, {
|
|
62
|
-
get each() {
|
|
63
|
-
return items();
|
|
64
|
-
},
|
|
65
|
-
children: (item) => {
|
|
66
|
-
const selected = () => itemSelected(item.id);
|
|
67
|
-
return createComponent(Item, {
|
|
68
|
-
idLabel: item,
|
|
69
|
-
get selected() {
|
|
70
|
-
return selected();
|
|
71
|
-
},
|
|
72
|
-
callback: () => callCallback(item),
|
|
73
|
-
get ["class"]() {
|
|
74
|
-
return itemClasses();
|
|
75
|
-
},
|
|
76
|
-
get vtags() {
|
|
77
|
-
return currentVTags().item;
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
//#endregion
|
|
87
|
-
export { ItemGroup };
|
package/dist/items/ItemGroup.jsx
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { buildIdLabel } from "./IdLabel.jsx";
|
|
2
|
-
import { For, createMemo } from "../node_modules/solid-js/dist/solid.jsx";
|
|
3
|
-
import { twMerge } from "../node_modules/tailwind-merge/dist/bundle-mjs.jsx";
|
|
4
|
-
import { argTokenizeBySpaces } from "../packages/common/dist/strings/tokenize.jsx";
|
|
5
|
-
import { Item } from "./Item.jsx";
|
|
6
|
-
import { Block } from "../Block.jsx";
|
|
7
|
-
|
|
8
|
-
//#region src/items/ItemGroup.tsx
|
|
9
|
-
const ItemGroup = (props) => {
|
|
10
|
-
const items = () => props.items.map(buildIdLabel);
|
|
11
|
-
const currentVTags = createMemo(() => {
|
|
12
|
-
const item = [];
|
|
13
|
-
const group = [];
|
|
14
|
-
const _vtags = props.vtags;
|
|
15
|
-
if (Array.isArray(_vtags) || typeof _vtags == "string") group.push(...argTokenizeBySpaces(_vtags));
|
|
16
|
-
else if (typeof _vtags == "object" && _vtags != null) {
|
|
17
|
-
group.push(...argTokenizeBySpaces(_vtags.group));
|
|
18
|
-
item.push(...argTokenizeBySpaces(_vtags.item));
|
|
19
|
-
}
|
|
20
|
-
return {
|
|
21
|
-
group,
|
|
22
|
-
item
|
|
23
|
-
};
|
|
24
|
-
});
|
|
25
|
-
const classes = createMemo(() => {
|
|
26
|
-
let group = "";
|
|
27
|
-
let item = "";
|
|
28
|
-
if (typeof props.class == "string") group = props.class;
|
|
29
|
-
else if (props.class != void 0) {
|
|
30
|
-
props.class;
|
|
31
|
-
group = props.class.group ?? "";
|
|
32
|
-
item = props.class.item ?? "";
|
|
33
|
-
}
|
|
34
|
-
return {
|
|
35
|
-
group,
|
|
36
|
-
item
|
|
37
|
-
};
|
|
38
|
-
});
|
|
39
|
-
const blockClasses = () => {
|
|
40
|
-
return twMerge("flex flex-row gap-1", classes().group);
|
|
41
|
-
};
|
|
42
|
-
const itemClasses = () => {
|
|
43
|
-
return classes().item;
|
|
44
|
-
};
|
|
45
|
-
const callCallback = (item) => {
|
|
46
|
-
if (props.callback) props.callback(item);
|
|
47
|
-
};
|
|
48
|
-
const itemSelected = (id) => {
|
|
49
|
-
if (typeof props.selection == "string") return id == props.selection;
|
|
50
|
-
else if (typeof props.selection == "object") return !!props.selection[id];
|
|
51
|
-
return false;
|
|
52
|
-
};
|
|
53
|
-
return <Block class={blockClasses()} vtags={currentVTags().group}>
|
|
54
|
-
<For each={items()}>
|
|
55
|
-
{(item) => {
|
|
56
|
-
const selected = () => itemSelected(item.id);
|
|
57
|
-
return <Item idLabel={item} selected={selected()} callback={() => callCallback(item)} class={itemClasses()} vtags={currentVTags().item}></Item>;
|
|
58
|
-
}}
|
|
59
|
-
</For>
|
|
60
|
-
</Block>;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
//#endregion
|
|
64
|
-
export { ItemGroup };
|