@teambit/lanes.hooks.use-lane-components 0.0.201 → 0.0.203
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 -6
- package/dist/use-lane-components.js +22 -21
- package/dist/use-lane-components.js.map +1 -1
- package/package-tar/teambit-lanes.hooks.use-lane-components-0.0.203.tgz +0 -0
- package/package.json +3 -4
- package/use-lane-components.tsx +23 -13
- package/package-tar/teambit-lanes.hooks.use-lane-components-0.0.201.tgz +0 -0
- /package/dist/{preview-1688699804087.js → preview-1689218262868.js} +0 -0
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { DataQueryResult } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
2
|
-
import { LanesQuery } from '@teambit/lanes.ui.models.lanes-model';
|
|
3
1
|
import { ComponentModel } from '@teambit/component';
|
|
4
2
|
import { LaneId } from '@teambit/lane-id';
|
|
5
|
-
export declare
|
|
3
|
+
export declare type UseLaneComponentsResult = {
|
|
6
4
|
components?: Array<ComponentModel>;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
loading?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function useLaneComponents(laneId?: LaneId): UseLaneComponentsResult;
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.useLaneComponents = void 0;
|
|
15
4
|
const ui_foundation_ui_hooks_use_data_query_1 = require("@teambit/ui-foundation.ui.hooks.use-data-query");
|
|
16
5
|
const client_1 = require("@apollo/client");
|
|
17
6
|
const component_1 = require("@teambit/component");
|
|
18
7
|
const GET_LANE_COMPONENTS = (0, client_1.gql) `
|
|
19
|
-
query LaneComponent($ids: [String!], $extensionId: String) {
|
|
8
|
+
query LaneComponent($ids: [String!], $extensionId: String, $skipList: Boolean!) {
|
|
20
9
|
lanes {
|
|
21
10
|
id
|
|
22
|
-
list(ids: $ids) {
|
|
11
|
+
list(ids: $ids) @skip(if: $skipList) {
|
|
23
12
|
id {
|
|
24
13
|
name
|
|
25
14
|
scope
|
|
@@ -32,6 +21,16 @@ const GET_LANE_COMPONENTS = (0, client_1.gql) `
|
|
|
32
21
|
...componentOverviewFields
|
|
33
22
|
}
|
|
34
23
|
}
|
|
24
|
+
default {
|
|
25
|
+
id {
|
|
26
|
+
name
|
|
27
|
+
scope
|
|
28
|
+
}
|
|
29
|
+
hash
|
|
30
|
+
components {
|
|
31
|
+
...componentOverviewFields
|
|
32
|
+
}
|
|
33
|
+
}
|
|
35
34
|
}
|
|
36
35
|
getHost(id: $extensionId) {
|
|
37
36
|
id
|
|
@@ -40,18 +39,20 @@ const GET_LANE_COMPONENTS = (0, client_1.gql) `
|
|
|
40
39
|
${component_1.componentOverviewFields}
|
|
41
40
|
`;
|
|
42
41
|
function useLaneComponents(laneId) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
const _a = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(GET_LANE_COMPONENTS, {
|
|
47
|
-
variables: { ids: [laneId === null || laneId === void 0 ? void 0 : laneId.toString()] },
|
|
42
|
+
var _a;
|
|
43
|
+
const { data, loading } = (0, ui_foundation_ui_hooks_use_data_query_1.useDataQuery)(GET_LANE_COMPONENTS, {
|
|
44
|
+
variables: { ids: [laneId === null || laneId === void 0 ? void 0 : laneId.toString()], skipList: laneId === null || laneId === void 0 ? void 0 : laneId.isDefault() },
|
|
48
45
|
skip: !laneId,
|
|
49
|
-
})
|
|
50
|
-
const
|
|
46
|
+
});
|
|
47
|
+
const rawComps = (data === null || data === void 0 ? void 0 : data.lanes.list) && (data === null || data === void 0 ? void 0 : data.lanes.list.length) > 0 ? data === null || data === void 0 ? void 0 : data.lanes.list[0] : data === null || data === void 0 ? void 0 : data.lanes.default;
|
|
48
|
+
const components = (_a = rawComps === null || rawComps === void 0 ? void 0 : rawComps.components) === null || _a === void 0 ? void 0 : _a.map((component) => {
|
|
51
49
|
const componentModel = component_1.ComponentModel.from(Object.assign(Object.assign({}, component), { host: data.getHost.id }));
|
|
52
50
|
return componentModel;
|
|
53
51
|
});
|
|
54
|
-
return
|
|
52
|
+
return {
|
|
53
|
+
loading,
|
|
54
|
+
components,
|
|
55
|
+
};
|
|
55
56
|
}
|
|
56
57
|
exports.useLaneComponents = useLaneComponents;
|
|
57
58
|
//# sourceMappingURL=use-lane-components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-lane-components.js","sourceRoot":"","sources":["../use-lane-components.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-lane-components.js","sourceRoot":"","sources":["../use-lane-components.tsx"],"names":[],"mappings":";;;AAAA,0GAA8E;AAC9E,2CAAqC;AACrC,kDAA6E;AAG7E,MAAM,mBAAmB,GAAG,IAAA,YAAG,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAgC3B,mCAAuB;CAC1B,CAAC;AAOF,SAAgB,iBAAiB,CAAC,MAAe;;IAC/C,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,IAAA,oDAAY,EAAC,mBAAmB,EAAE;QAC1D,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,SAAS,EAAE,EAAE;QACvE,IAAI,EAAE,CAAC,MAAM;KACd,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,IAAI,KAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,IAAI,CAAC,MAAM,IAAG,CAAC,CAAC,CAAC,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,CAAC,OAAO,CAAC;IAE7G,MAAM,UAAU,GAAG,MAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,0CAAE,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QACzD,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,OAAO;QACL,OAAO;QACP,UAAU;KACX,CAAC;AACJ,CAAC;AAjBD,8CAiBC"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teambit/lanes.hooks.use-lane-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.203",
|
|
4
4
|
"homepage": "https://bit.cloud/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.203"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@teambit/lane-id": "0.0.
|
|
13
|
-
"@teambit/lanes.ui.models.lanes-model": "0.0.155",
|
|
12
|
+
"@teambit/lane-id": "0.0.257",
|
|
14
13
|
"@teambit/ui-foundation.ui.hooks.use-data-query": "0.0.500"
|
|
15
14
|
},
|
|
16
15
|
"devDependencies": {
|
package/use-lane-components.tsx
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { useDataQuery
|
|
1
|
+
import { useDataQuery } from '@teambit/ui-foundation.ui.hooks.use-data-query';
|
|
2
2
|
import { gql } from '@apollo/client';
|
|
3
|
-
import { LanesQuery } from '@teambit/lanes.ui.models.lanes-model';
|
|
4
3
|
import { ComponentModel, componentOverviewFields } from '@teambit/component';
|
|
5
4
|
import { LaneId } from '@teambit/lane-id';
|
|
6
5
|
|
|
7
6
|
const GET_LANE_COMPONENTS = gql`
|
|
8
|
-
query LaneComponent($ids: [String!], $extensionId: String) {
|
|
7
|
+
query LaneComponent($ids: [String!], $extensionId: String, $skipList: Boolean!) {
|
|
9
8
|
lanes {
|
|
10
9
|
id
|
|
11
|
-
list(ids: $ids) {
|
|
10
|
+
list(ids: $ids) @skip(if: $skipList) {
|
|
12
11
|
id {
|
|
13
12
|
name
|
|
14
13
|
scope
|
|
@@ -21,6 +20,16 @@ const GET_LANE_COMPONENTS = gql`
|
|
|
21
20
|
...componentOverviewFields
|
|
22
21
|
}
|
|
23
22
|
}
|
|
23
|
+
default {
|
|
24
|
+
id {
|
|
25
|
+
name
|
|
26
|
+
scope
|
|
27
|
+
}
|
|
28
|
+
hash
|
|
29
|
+
components {
|
|
30
|
+
...componentOverviewFields
|
|
31
|
+
}
|
|
32
|
+
}
|
|
24
33
|
}
|
|
25
34
|
getHost(id: $extensionId) {
|
|
26
35
|
id
|
|
@@ -29,25 +38,26 @@ const GET_LANE_COMPONENTS = gql`
|
|
|
29
38
|
${componentOverviewFields}
|
|
30
39
|
`;
|
|
31
40
|
|
|
32
|
-
export
|
|
41
|
+
export type UseLaneComponentsResult = {
|
|
33
42
|
components?: Array<ComponentModel>;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* query from context if exists
|
|
37
|
-
*/
|
|
43
|
+
loading?: boolean;
|
|
44
|
+
};
|
|
38
45
|
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
export function useLaneComponents(laneId?: LaneId): UseLaneComponentsResult {
|
|
47
|
+
const { data, loading } = useDataQuery(GET_LANE_COMPONENTS, {
|
|
48
|
+
variables: { ids: [laneId?.toString()], skipList: laneId?.isDefault() },
|
|
41
49
|
skip: !laneId,
|
|
42
50
|
});
|
|
43
51
|
|
|
44
|
-
const
|
|
52
|
+
const rawComps = data?.lanes.list && data?.lanes.list.length > 0 ? data?.lanes.list[0] : data?.lanes.default;
|
|
53
|
+
|
|
54
|
+
const components = rawComps?.components?.map((component) => {
|
|
45
55
|
const componentModel = ComponentModel.from({ ...component, host: data.getHost.id });
|
|
46
56
|
return componentModel;
|
|
47
57
|
});
|
|
48
58
|
|
|
49
59
|
return {
|
|
50
|
-
|
|
60
|
+
loading,
|
|
51
61
|
components,
|
|
52
62
|
};
|
|
53
63
|
}
|
|
Binary file
|
|
File without changes
|