@teambit/lanes.hooks.use-lane-components 0.0.37 → 0.0.38
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/use-lane-components.d.ts +4 -3
- package/dist/use-lane-components.js +11 -5
- package/dist/use-lane-components.js.map +1 -1
- package/package-tar/teambit-lanes.hooks.use-lane-components-0.0.38.tgz +0 -0
- package/package.json +4 -3
- package/{preview-1664721514780.js → preview-1664735485436.js} +0 -0
- package/use-lane-components.tsx +15 -7
- package/package-tar/teambit-lanes.hooks.use-lane-components-0.0.37.tgz +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { DataQueryResult } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
2
|
-
import {
|
|
2
|
+
import { LanesQuery } from '@teambit/lanes.ui.models.lanes-model';
|
|
3
3
|
import { ComponentModel } from '@teambit/component';
|
|
4
|
-
|
|
4
|
+
import { LaneId } from '@teambit/lane-id';
|
|
5
|
+
export declare function useLaneComponents(laneId?: LaneId): {
|
|
5
6
|
components?: Array<ComponentModel>;
|
|
6
7
|
} & Omit<DataQueryResult<LanesQuery, {
|
|
7
|
-
ids: string[];
|
|
8
|
+
ids: (string | undefined)[];
|
|
8
9
|
}>, 'data'>;
|
|
@@ -20,9 +20,11 @@ const GET_LANE_COMPONENTS = (0, client_1.gql) `
|
|
|
20
20
|
lanes {
|
|
21
21
|
id
|
|
22
22
|
list(ids: $ids) {
|
|
23
|
-
id
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
id {
|
|
24
|
+
name
|
|
25
|
+
scope
|
|
26
|
+
}
|
|
27
|
+
hash
|
|
26
28
|
components {
|
|
27
29
|
...componentOverviewFields
|
|
28
30
|
}
|
|
@@ -37,9 +39,13 @@ const GET_LANE_COMPONENTS = (0, client_1.gql) `
|
|
|
37
39
|
}
|
|
38
40
|
${component_1.componentOverviewFields}
|
|
39
41
|
`;
|
|
40
|
-
function useLaneComponents(
|
|
42
|
+
function useLaneComponents(laneId) {
|
|
43
|
+
/**
|
|
44
|
+
* query from context if exists
|
|
45
|
+
*/
|
|
41
46
|
const _a = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(GET_LANE_COMPONENTS, {
|
|
42
|
-
variables: { ids: [
|
|
47
|
+
variables: { ids: [laneId === null || laneId === void 0 ? void 0 : laneId.toString()] },
|
|
48
|
+
skip: !laneId,
|
|
43
49
|
}), { data } = _a, rest = __rest(_a, ["data"]);
|
|
44
50
|
const components = data === null || data === void 0 ? void 0 : data.lanes.list[0].components.map((component) => {
|
|
45
51
|
const componentModel = component_1.ComponentModel.from(Object.assign(Object.assign({}, component), { host: data.getHost.id }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-lane-components.js","sourceRoot":"","sources":["../use-lane-components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0GAA+F;AAC/F,2CAAqC;AAErC,kDAA6E;
|
|
1
|
+
{"version":3,"file":"use-lane-components.js","sourceRoot":"","sources":["../use-lane-components.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0GAA+F;AAC/F,2CAAqC;AAErC,kDAA6E;AAG7E,MAAM,mBAAmB,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;IAsB3B,mCAAuB;CAC1B,CAAC;AAEF,SAAgB,iBAAiB,CAAC,MAAe;IAG/C;;OAEG;IAEH,MAAM,KAAoB,IAAA,oDAAY,EAAC,mBAAmB,EAAE;QAC1D,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE,CAAC,EAAE;QACxC,IAAI,EAAE,CAAC,MAAM;KACd,CAAC,EAHI,EAAE,IAAI,OAGV,EAHe,IAAI,cAAf,QAAiB,CAGrB,CAAC;IAEH,MAAM,UAAU,GAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAClE,MAAM,cAAc,GAAG,0BAAc,CAAC,IAAI,iCAAM,SAAS,KAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAG,CAAC;QACpF,OAAO,cAAc,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,uCACK,IAAI,KACP,UAAU,IACV;AACJ,CAAC;AArBD,8CAqBC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/lanes.hooks.use-lane-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"homepage": "https://bit.dev/teambit/lanes/hooks/use-lane-components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"componentId": {
|
|
7
7
|
"scope": "teambit.lanes",
|
|
8
8
|
"name": "hooks/use-lane-components",
|
|
9
|
-
"version": "0.0.
|
|
9
|
+
"version": "0.0.38"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@teambit/
|
|
12
|
+
"@teambit/lane-id": "0.0.97",
|
|
13
|
+
"@teambit/lanes.ui.models.lanes-model": "0.0.1",
|
|
13
14
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.496"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
File without changes
|
package/use-lane-components.tsx
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { useDataQuery, DataQueryResult } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
2
2
|
import { gql } from '@apollo/client';
|
|
3
|
-
import {
|
|
3
|
+
import { LanesQuery } from '@teambit/lanes.ui.models.lanes-model';
|
|
4
4
|
import { ComponentModel, componentOverviewFields } from '@teambit/component';
|
|
5
|
+
import { LaneId } from '@teambit/lane-id';
|
|
5
6
|
|
|
6
7
|
const GET_LANE_COMPONENTS = gql`
|
|
7
8
|
query LaneComponent($ids: [String!], $extensionId: String) {
|
|
8
9
|
lanes {
|
|
9
10
|
id
|
|
10
11
|
list(ids: $ids) {
|
|
11
|
-
id
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
id {
|
|
13
|
+
name
|
|
14
|
+
scope
|
|
15
|
+
}
|
|
16
|
+
hash
|
|
14
17
|
components {
|
|
15
18
|
...componentOverviewFields
|
|
16
19
|
}
|
|
@@ -26,11 +29,16 @@ const GET_LANE_COMPONENTS = gql`
|
|
|
26
29
|
${componentOverviewFields}
|
|
27
30
|
`;
|
|
28
31
|
|
|
29
|
-
export function useLaneComponents(
|
|
32
|
+
export function useLaneComponents(laneId?: LaneId): {
|
|
30
33
|
components?: Array<ComponentModel>;
|
|
31
|
-
} & Omit<DataQueryResult<LanesQuery, { ids: string[] }>, 'data'> {
|
|
34
|
+
} & Omit<DataQueryResult<LanesQuery, { ids: (string | undefined)[] }>, 'data'> {
|
|
35
|
+
/**
|
|
36
|
+
* query from context if exists
|
|
37
|
+
*/
|
|
38
|
+
|
|
32
39
|
const { data, ...rest } = useDataQuery(GET_LANE_COMPONENTS, {
|
|
33
|
-
variables: { ids: [
|
|
40
|
+
variables: { ids: [laneId?.toString()] },
|
|
41
|
+
skip: !laneId,
|
|
34
42
|
});
|
|
35
43
|
|
|
36
44
|
const components = data?.lanes.list[0].components.map((component) => {
|
|
Binary file
|