mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-09 05:26:24 +09:00
Ref https://github.com/webstudio-is/webstudio/issues/2532 - fixed collection icon color - allow to specify expression in embed template children - tweaked default collection template - allow to specify variable aliases in embed template children - renamed collectionItem variable to Collection Item - moved collection component to "Data" category - fix broken canvas when bind object to text content - add better tooltips why cannot remove parameter and used variables
68 lines
1.4 KiB
TypeScript
68 lines
1.4 KiB
TypeScript
import { ListViewIcon } from "@webstudio-is/icons/svg";
|
|
import type {
|
|
WsComponentMeta,
|
|
WsComponentPropsMeta,
|
|
} from "./components/component-meta";
|
|
|
|
export const portalComponent = "Slot";
|
|
|
|
export const collectionComponent = "ws:collection";
|
|
|
|
const collectionMeta: WsComponentMeta = {
|
|
category: "data",
|
|
order: 7,
|
|
type: "container",
|
|
label: "Collection",
|
|
icon: ListViewIcon,
|
|
stylable: false,
|
|
template: [
|
|
{
|
|
type: "instance",
|
|
component: collectionComponent,
|
|
props: [
|
|
{
|
|
name: "data",
|
|
type: "json",
|
|
value: [
|
|
"Collection Item 1",
|
|
"Collection Item 2",
|
|
"Collection Item 3",
|
|
],
|
|
},
|
|
{
|
|
name: "item",
|
|
type: "parameter",
|
|
variableName: "collectionItem",
|
|
variableAlias: "Collection Item",
|
|
},
|
|
],
|
|
children: [
|
|
{
|
|
type: "instance",
|
|
component: "Box",
|
|
children: [{ type: "expression", value: "collectionItem" }],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
};
|
|
|
|
const collectionPropsMeta: WsComponentPropsMeta = {
|
|
props: {
|
|
data: {
|
|
required: true,
|
|
control: "json",
|
|
type: "json",
|
|
},
|
|
},
|
|
initialProps: ["data"],
|
|
};
|
|
|
|
export const coreMetas = {
|
|
[collectionComponent]: collectionMeta,
|
|
};
|
|
|
|
export const corePropsMetas = {
|
|
[collectionComponent]: collectionPropsMeta,
|
|
};
|