@omnia/velcron 8.0.289-dev → 8.0.291-dev

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.
@@ -60,7 +60,7 @@ export interface VelcronComponentDefinition extends VelcronDefinition {
60
60
  icon?: any;
61
61
  }
62
62
  export type VelcronCustomComponentDefinition = VelcronComponentDefinition;
63
- export type BuiltInPropertyEditorType = "text" | "number" | "slider" | "switch" | "alignment" | "color" | "flow" | "icon" | "image" | "typography" | "spacing" | "color-schema-type" | "blueprint" | "background" | "grid" | "reference" | "select" | "property-resolver";
63
+ export type BuiltInPropertyEditorType = "text" | "number" | "slider" | "switch" | "alignment" | "color" | "flow" | "icon" | "image" | "typography" | "spacing" | "color-schema-type" | "blueprint" | "background" | "grid" | "reference" | "select" | "property-resolver" | "link-resolver";
64
64
  export type EditorLocation = "inline" | "pane" | "toolbar";
65
65
  export interface VelcronEditor<TSettings = any> {
66
66
  name?: string;
@@ -13,6 +13,7 @@ export interface BuiltInComponentRenderers {
13
13
  "velcron": unknown;
14
14
  "flex": unknown;
15
15
  "row": unknown;
16
+ "grid": unknown;
16
17
  "column": unknown;
17
18
  "card": unknown;
18
19
  "text": unknown;
@@ -180,6 +181,13 @@ export interface VelcronFlexDefinition extends VelcronDefinition, VelcronColorSt
180
181
  height?: number | string;
181
182
  minHeight?: number | string;
182
183
  }
184
+ export interface VelcronGridDefinition extends VelcronDefinition {
185
+ type: "grid";
186
+ minColumnWidth?: number | string;
187
+ columns?: number | Array<string>;
188
+ gapX?: number | string;
189
+ gapY?: number | string;
190
+ }
183
191
  export interface VelcronFlexRowDefinition extends VelcronDefinition, VelcronColorStyling, VelcronDefinitionHasEffects, VelcronDefinitionHasOverflow {
184
192
  type: "row";
185
193
  events?: VelcronOnPressEvent;
@@ -50,6 +50,8 @@ export interface VelcronPropertyMapping {
50
50
  export interface VelcronPropertyResolverEditorSettings {
51
51
  properties: Array<VelcronPropertyMapping>;
52
52
  }
53
+ export interface VelcronLinkResolverEditorSettings {
54
+ }
53
55
  export interface VelcronBlueprintEditorSettings {
54
56
  type: "container" | "icon" | "button";
55
57
  }
@@ -113,3 +115,6 @@ export interface VelcronSelectEditor extends VelcronEditor<VelcronSelectEditorSe
113
115
  export interface VelcronPropertyResolverEditor extends VelcronEditor<VelcronPropertyResolverEditorSettings> {
114
116
  type: "property-resolver";
115
117
  }
118
+ export interface VelcronLinkResolverEditor extends VelcronEditor<VelcronLinkResolverEditorSettings> {
119
+ type: "link-resolver";
120
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/velcron",
3
3
  "license": "MIT",
4
- "version": "8.0.289-dev",
4
+ "version": "8.0.291-dev",
5
5
  "description": "Provide Omnia Velcron Stuffs.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -3,6 +3,7 @@ export declare const VelcronConstants: {
3
3
  velcron: string;
4
4
  flex: string;
5
5
  row: string;
6
+ grid: string;
6
7
  column: string;
7
8
  card: string;
8
9
  text: string;
@@ -6,6 +6,7 @@ exports.VelcronConstants = {
6
6
  velcron: "velcron",
7
7
  flex: "flex",
8
8
  row: "row",
9
+ grid: "grid",
9
10
  column: "column",
10
11
  card: "card",
11
12
  text: "text",
@@ -276,6 +276,40 @@ class VelcronStyles {
276
276
  styleBase["minWidth"] = this.unitProvider.formatDimension(minWidth);
277
277
  this.insertBackgroundColor(styleBase, flexDefinition, renderCtx);
278
278
  }
279
+ else if (definition.type === VelcronConstants_1.VelcronConstants.components.grid) {
280
+ const spacingBlueprint = renderCtx.theming.get.spacing();
281
+ const flexDefinition = definition;
282
+ const columns = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.columns);
283
+ const minWidth = VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.minColumnWidth);
284
+ const gapX = flexDefinition.gapX || flexDefinition?.gapX?.toString() === "0" ?
285
+ (0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapX), spacingBlueprint) :
286
+ (0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapY), spacingBlueprint);
287
+ const gapY = flexDefinition.gapY || flexDefinition?.gapY?.toString() === "0" ?
288
+ (0, __1.getSpacingValueFromBlueprint)(VelcronData_1.VelcronData.dataBind(renderCtx, flexDefinition.gapY), spacingBlueprint) :
289
+ gapX;
290
+ styleBase["display"] = "grid";
291
+ if (minWidth) {
292
+ const widthWithDimension = this.unitProvider.formatDimension(minWidth);
293
+ styleBase["gridTemplateColumns"] = `repeat(auto-fit,minmax(${widthWithDimension}, 1fr))`;
294
+ }
295
+ else if (columns) {
296
+ let templateColumnString = "";
297
+ if (VelcronData_1.VelcronData.isArray(columns)) {
298
+ columns.forEach((col) => {
299
+ templateColumnString += `${col} `;
300
+ });
301
+ }
302
+ else {
303
+ const columnNumber = Number.parseInt(columns);
304
+ for (let i = 0; i < columnNumber; i++) {
305
+ templateColumnString += "1fr ";
306
+ }
307
+ }
308
+ styleBase["gridTemplateColumns"] = templateColumnString;
309
+ }
310
+ styleBase["rowGap"] = this.unitProvider.formatDimension(gapY);
311
+ styleBase["columnGap"] = this.unitProvider.formatDimension(gapX);
312
+ }
279
313
  if (definition.border) {
280
314
  const typedDefinition = definition;
281
315
  this.insertBorderStyles(styleBase, typedDefinition.border, renderCtx);
@@ -16,6 +16,7 @@ export declare class VelcronEditorBuilder {
16
16
  gridEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
17
17
  widthEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
18
18
  propertyResolverEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
19
+ linkResolverEditor: (name: string, stateMapping: string) => VelcronEditorBuilder;
19
20
  };
20
21
  build(): VelcronEditor<any>[];
21
22
  }
@@ -142,6 +142,14 @@ class VelcronEditorBuilder {
142
142
  state: this.formatStateMapping(stateMapping),
143
143
  });
144
144
  return this;
145
+ },
146
+ linkResolverEditor: (name, stateMapping) => {
147
+ this.editors.push({
148
+ name: name,
149
+ type: "link-resolver",
150
+ state: this.formatStateMapping(stateMapping),
151
+ });
152
+ return this;
145
153
  }
146
154
  };
147
155
  }