@griddo/core 10.3.6 → 10.3.8

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.
@@ -1,6 +1,11 @@
1
1
  import { ImagePosition } from "../core";
2
2
  import { FilterItemFromFilterEndPoint, HTMLHeadingTag } from "../global";
3
- import { ContentTypeNameOfUnion } from "../utilities";
3
+ export type ContentTypeName<T> = T extends {
4
+ __contentTypeName: string;
5
+ } ? T["__contentTypeName"] : string;
6
+ export type RelatedContentTypeNames<T> = T extends {
7
+ __relatedContentTypeNames: string[];
8
+ } ? T["__relatedContentTypeNames"][number] : string;
4
9
  export type FieldsDivider = string;
5
10
  export type ArrayFieldGroup<Fields> = Array<Fields>;
6
11
  export type AsyncSelect<Relations, FromList, RelatedContentType, FromDistributor> = FromList extends true ? Relations extends true ? {
@@ -166,18 +171,12 @@ export interface Reference<ContentType> {
166
171
  mode?: "auto" | "manual" | "navigation";
167
172
  order?: string;
168
173
  fixed?: Array<number>;
169
- source?: Array<ContentTypeNameOfUnion<ContentType>>;
170
- /** 0 means all */
174
+ sources?: Array<Source<ContentType>>;
171
175
  quantity?: number;
172
- filter?: ContentType extends {
173
- __contentTypeName: string;
174
- } ? Array<{
175
- id: number;
176
- label: string;
177
- source: ContentType["__contentTypeName"];
178
- } | number> : never;
179
176
  fullRelations?: boolean;
177
+ /** Indicates if we should limit results to one language */
180
178
  allLanguages?: boolean;
179
+ /** Indicates if we should first return elements with same language as the page */
181
180
  preferenceLanguage?: boolean;
182
181
  referenceId?: number;
183
182
  related?: ContentType extends {
@@ -185,13 +184,20 @@ export interface Reference<ContentType> {
185
184
  } ? number | Array<number> | Array<{
186
185
  id: number;
187
186
  label: string;
188
- source: ContentType["__contentTypeName"];
189
- }> | Record<ContentType["__contentTypeName"], FilterItemFromFilterEndPoint> : never;
190
- filterOperator?: "and" | "or" | "AND" | "OR";
191
- globalOperator?: "and" | "or" | "AND" | "OR";
187
+ source: RelatedContentTypeNames<ContentType>;
188
+ }> | Record<RelatedContentTypeNames<ContentType>, FilterItemFromFilterEndPoint> : never;
192
189
  lang?: number;
193
190
  site?: number;
194
191
  }
192
+ export interface Source<ContentType> {
193
+ structuredData: ContentTypeName<ContentType>;
194
+ filters?: Array<{
195
+ id: number;
196
+ label: string;
197
+ }> | Record<string, FilterItemFromFilterEndPoint> | Array<number>;
198
+ filterOperator?: "and" | "or" | "AND" | "OR";
199
+ globalOperator?: "and" | "or" | "AND" | "OR";
200
+ }
195
201
  export interface ReferenceNavigation {
196
202
  order?: string;
197
203
  quantity?: number;
@@ -21,9 +21,6 @@ export interface SetQueryProps<ContentType> {
21
21
  url: string;
22
22
  }>, "__relatedContentTypeNames" | "__contentTypeKind" | "__contentTypeName">>;
23
23
  /** Array of filterIds or Object of arrays of content type ids to filter the query */
24
- filterIds?: ContentType extends {
25
- __contentTypeName: string;
26
- } ? Array<number> | Record<ContentType["__contentTypeName"], FilterItemFromFilterEndPoint> : never;
27
24
  /** String as HASH to cache the query (Mostly interal use) */
28
25
  cached?: string | number | undefined;
29
26
  /** Search string, the spaces will be removed */
@@ -31,19 +28,13 @@ export interface SetQueryProps<ContentType> {
31
28
  /** Operator OR | AND */
32
29
  operator?: "and" | "or" | "AND" | "OR";
33
30
  /** Operator OR | AND */
34
- filterOperator?: "and" | "or" | "AND" | "OR";
35
31
  /** Operator OR | AND */
36
- globalOperator?: "and" | "or" | "AND" | "OR";
37
32
  /** Array of content types ids to exclude from the query */
38
33
  exclude?: Array<number>;
39
34
  /** Indicates if the data queried include a list with all the available relationship options, for example to make search filters. */
40
35
  relations?: boolean | "off" | "simple" | "full";
41
36
  /** Indicates if the query includes pending publish data */
42
37
  includePending?: boolean;
43
- /** Indicates if we should limit results to one language */
44
- allLanguages?: boolean;
45
- /** Indicates if we should first return elements with same language as the page */
46
- preferenceLanguage?: boolean;
47
38
  /** The id of a ContentType */
48
39
  referenceId?: number;
49
40
  }
@@ -88,12 +79,13 @@ export type Hideable<T> = T | null;
88
79
  export type Pretty<T> = {
89
80
  [K in keyof T]: T[K];
90
81
  } & {};
91
- export interface FilterItemFromFilterEndPoint {
92
- label: string;
93
- items: Array<{
82
+ interface RawFilterItemFromFilterEndPoint {
83
+ label?: string;
84
+ items?: Array<{
94
85
  id: number;
95
86
  label: string;
96
87
  language: number;
97
88
  }>;
98
89
  }
90
+ export type FilterItemFromFilterEndPoint = Pretty<RawFilterItemFromFilterEndPoint>;
99
91
  export {};
@@ -1,4 +1,5 @@
1
1
  import __AT__ from "@autoTypes";
2
+ import { Source } from "../api-response-fields";
2
3
  export type WithAuxText = {
3
4
  /** Sets a label text to show besides the toggle field control */
4
5
  auxText?: string;
@@ -87,9 +88,13 @@ export type WithSlugTo = {
87
88
  slugTo?: string;
88
89
  };
89
90
  export type WithSource = {
90
- /** Structured data type from which you have to load the options. */
91
+ /** Structured data from which the options must be loaded. */
91
92
  source: __AT__.PageContentTypes | __AT__.SimpleContentTypes | __AT__.TaxonomyContentTypes;
92
93
  };
94
+ export type WithSources<ContentType = unknown> = {
95
+ /** Structured data object from which the options must be loaded. */
96
+ sources: Array<Source<ContentType>>;
97
+ };
93
98
  export type ThemeColors = {
94
99
  theme: __AT__.Subthemes;
95
100
  options: Array<`#${string}`>;
@@ -140,5 +145,5 @@ export type WithRelations_AutoTypes = {
140
145
  };
141
146
  export type WithDataSources = {
142
147
  /** Array with the structured data types that the field has to load. */
143
- source: Array<__AT__.PageContentTypes | __AT__.SimpleContentTypes | __AT__.TaxonomyContentTypes>;
148
+ source: Array<Source<__AT__.PageContentTypes | __AT__.SimpleContentTypes | __AT__.TaxonomyContentTypes>>;
144
149
  };
@@ -1,6 +1,7 @@
1
1
  import { BaseUI } from "./base";
2
2
  import { ConfigTabs, Dimension } from "./props";
3
3
  import { Fields } from "../..";
4
+ import { Source } from "../api-response-fields";
4
5
  import { UIFields } from "../schema-fields/ui-fields";
5
6
  export interface ComponentAndModuleBase extends BaseUI {
6
7
  /** Type of schema. */
@@ -54,12 +55,12 @@ export interface ContentTypeModule<ContentTypeModuleProps = unknown> extends Com
54
55
  component: Capitalize<string>;
55
56
  /** Required prop as `true` for ContentType Modules */
56
57
  hasDistributorData: true;
57
- /** `data` prop requierd for ContentType modules */
58
- data: ContentTypeModuleProps extends {
58
+ /** `data` prop for ContentType modules */
59
+ data?: ContentTypeModuleProps extends {
59
60
  data?: any;
60
- } ? ContentTypeModuleProps["data"] : Omit<Fields.Reference<unknown>, "source" | "mode"> & {
61
+ } ? ContentTypeModuleProps["data"] : Omit<Fields.Reference<unknown>, "sources" | "mode"> & {
61
62
  mode: "auto" | "manual";
62
- source?: Array<string>;
63
+ sources?: Array<Source<unknown>>;
63
64
  };
64
65
  [key: string]: any;
65
66
  } & ContentTypeModuleProps;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@griddo/core",
3
3
  "description": "Reload version of Griddo Core",
4
4
  "license": "UNLICENSED",
5
- "version": "10.3.6",
5
+ "version": "10.3.8",
6
6
  "authors": [
7
7
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
8
8
  "Diego M. Béjar <diego.bejar@secuoyas.com>",
@@ -81,5 +81,5 @@
81
81
  "resolutions": {
82
82
  "colors": "1.4.0"
83
83
  },
84
- "gitHead": "34baa6e4548c125f65e0cf332d34ba452fbadf98"
84
+ "gitHead": "7e355ae2bd1b87bc210353cb2c891bd6aecb123c"
85
85
  }