@elliemae/ds-left-navigation 3.80.0-next.58 → 3.80.0-next.60
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/cjs/exported-related/conversion-utils/conversionConstants.js +64 -0
- package/dist/cjs/exported-related/conversion-utils/conversionConstants.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/conversionHelpers.js +192 -0
- package/dist/cjs/exported-related/conversion-utils/conversionHelpers.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/convertItemOpts.js +187 -0
- package/dist/cjs/exported-related/conversion-utils/convertItemOpts.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/getHumanReadableWarnings.js +37 -0
- package/dist/cjs/exported-related/conversion-utils/getHumanReadableWarnings.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/index.js +95 -0
- package/dist/cjs/exported-related/conversion-utils/index.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/lostCodes.js +55 -0
- package/dist/cjs/exported-related/conversion-utils/lostCodes.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/report.js +48 -0
- package/dist/cjs/exported-related/conversion-utils/report.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/types.js +28 -0
- package/dist/cjs/exported-related/conversion-utils/types.js.map +7 -0
- package/dist/cjs/exported-related/conversion-utils/validateIds.js +58 -0
- package/dist/cjs/exported-related/conversion-utils/validateIds.js.map +7 -0
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/exported-related/conversion-utils/conversionConstants.js +34 -0
- package/dist/esm/exported-related/conversion-utils/conversionConstants.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/conversionHelpers.js +172 -0
- package/dist/esm/exported-related/conversion-utils/conversionHelpers.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/convertItemOpts.js +157 -0
- package/dist/esm/exported-related/conversion-utils/convertItemOpts.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/getHumanReadableWarnings.js +7 -0
- package/dist/esm/exported-related/conversion-utils/getHumanReadableWarnings.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/index.js +65 -0
- package/dist/esm/exported-related/conversion-utils/index.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/lostCodes.js +25 -0
- package/dist/esm/exported-related/conversion-utils/lostCodes.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/report.js +18 -0
- package/dist/esm/exported-related/conversion-utils/report.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/types.js +2 -0
- package/dist/esm/exported-related/conversion-utils/types.js.map +7 -0
- package/dist/esm/exported-related/conversion-utils/validateIds.js +28 -0
- package/dist/esm/exported-related/conversion-utils/validateIds.js.map +7 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +2 -2
- package/dist/types/exported-related/conversion-utils/conversionConstants.d.ts +20 -0
- package/dist/types/exported-related/conversion-utils/conversionHelpers.d.ts +25 -0
- package/dist/types/exported-related/conversion-utils/convertItemOpts.d.ts +22 -0
- package/dist/types/exported-related/conversion-utils/getHumanReadableWarnings.d.ts +7 -0
- package/dist/types/exported-related/conversion-utils/index.d.ts +12 -0
- package/dist/types/exported-related/conversion-utils/lostCodes.d.ts +23 -0
- package/dist/types/exported-related/conversion-utils/report.d.ts +3 -0
- package/dist/types/exported-related/conversion-utils/types.d.ts +37 -0
- package/dist/types/exported-related/conversion-utils/validateIds.d.ts +9 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +13 -12
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var conversionConstants_exports = {};
|
|
30
|
+
__export(conversionConstants_exports, {
|
|
31
|
+
DRILLDOWN_TYPES: () => DRILLDOWN_TYPES,
|
|
32
|
+
DROPPED_TYPE_CODES: () => DROPPED_TYPE_CODES,
|
|
33
|
+
HEADER_TYPES: () => HEADER_TYPES,
|
|
34
|
+
LEAF_TYPES: () => LEAF_TYPES,
|
|
35
|
+
NO_RAIL_TYPES: () => NO_RAIL_TYPES,
|
|
36
|
+
OUT_OF_THE_BOX_TYPES: () => OUT_OF_THE_BOX_TYPES,
|
|
37
|
+
getOwn: () => getOwn
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(conversionConstants_exports);
|
|
40
|
+
var React = __toESM(require("react"));
|
|
41
|
+
var import_constants = require("../../constants/index.js");
|
|
42
|
+
const DRILLDOWN_TYPES = [
|
|
43
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN,
|
|
44
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN
|
|
45
|
+
];
|
|
46
|
+
const LEAF_TYPES = [
|
|
47
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_LINK,
|
|
48
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_TEXT_LABEL,
|
|
49
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_WITH_DATE
|
|
50
|
+
];
|
|
51
|
+
const getOwn = (map, key) => Object.prototype.hasOwnProperty.call(map, key) ? map[key] : void 0;
|
|
52
|
+
const HEADER_TYPES = [import_constants.ITEM_TYPES.LEFT_NAV_ITEM_HEADER, ...LEAF_TYPES];
|
|
53
|
+
const OUT_OF_THE_BOX_TYPES = Object.values(import_constants.ITEM_TYPES);
|
|
54
|
+
const NO_RAIL_TYPES = [
|
|
55
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_TEXT_LABEL,
|
|
56
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_WITH_DATE,
|
|
57
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN,
|
|
58
|
+
import_constants.ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN
|
|
59
|
+
];
|
|
60
|
+
const DROPPED_TYPE_CODES = {
|
|
61
|
+
[import_constants.ITEM_TYPES.LEFT_NAV_ITEM_HEADER]: ["header-item-dropped", "Header items are not part of the list"],
|
|
62
|
+
[import_constants.ITEM_TYPES.LEFT_NAV_ITEM_SKELETON]: ["skeleton-dropped", "Skeleton items are not supported"]
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=conversionConstants.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/conversionConstants.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { ITEM_TYPES } from '../../constants/index.js';\n\nexport const DRILLDOWN_TYPES: string[] = [\n ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN,\n ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN,\n];\nexport const LEAF_TYPES: string[] = [\n ITEM_TYPES.LEFT_NAV_ITEM_LINK,\n ITEM_TYPES.LEFT_NAV_ITEM_TEXT_LABEL,\n ITEM_TYPES.LEFT_NAV_ITEM_WITH_DATE,\n];\n\n/**\n * Reads only own entries, so ids and types like \"constructor\" or \"toString\" do not resolve to inherited members.\n */\nexport const getOwn = <T>(map: Record<string, T>, key: string): T | undefined =>\n Object.prototype.hasOwnProperty.call(map, key) ? map[key] : undefined;\n\n/**\n * The types a `HeaderComponent` can have and still be the tree header: a header, or a leaf when the header is only a link.\n */\nexport const HEADER_TYPES: string[] = [ITEM_TYPES.LEFT_NAV_ITEM_HEADER, ...LEAF_TYPES];\n\nexport const OUT_OF_THE_BOX_TYPES: string[] = Object.values(ITEM_TYPES);\n\n/**\n * LeftNavigation renders no `CollapsedComponent` for these types (it forces it to null), so they were never in its rail.\n */\nexport const NO_RAIL_TYPES: string[] = [\n ITEM_TYPES.LEFT_NAV_ITEM_TEXT_LABEL,\n ITEM_TYPES.LEFT_NAV_ITEM_WITH_DATE,\n ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN,\n ITEM_TYPES.LEFT_NAV_ITEM_UNCONTROLLED_DRILLDOWN,\n];\n\nexport const DROPPED_TYPE_CODES = {\n [ITEM_TYPES.LEFT_NAV_ITEM_HEADER]: ['header-item-dropped', 'Header items are not part of the list'],\n [ITEM_TYPES.LEFT_NAV_ITEM_SKELETON]: ['skeleton-dropped', 'Skeleton items are not supported'],\n} as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAA2B;AAEpB,MAAM,kBAA4B;AAAA,EACvC,4BAAW;AAAA,EACX,4BAAW;AACb;AACO,MAAM,aAAuB;AAAA,EAClC,4BAAW;AAAA,EACX,4BAAW;AAAA,EACX,4BAAW;AACb;AAKO,MAAM,SAAS,CAAI,KAAwB,QAChD,OAAO,UAAU,eAAe,KAAK,KAAK,GAAG,IAAI,IAAI,GAAG,IAAI;AAKvD,MAAM,eAAyB,CAAC,4BAAW,sBAAsB,GAAG,UAAU;AAE9E,MAAM,uBAAiC,OAAO,OAAO,2BAAU;AAK/D,MAAM,gBAA0B;AAAA,EACrC,4BAAW;AAAA,EACX,4BAAW;AAAA,EACX,4BAAW;AAAA,EACX,4BAAW;AACb;AAEO,MAAM,qBAAqB;AAAA,EAChC,CAAC,4BAAW,oBAAoB,GAAG,CAAC,uBAAuB,uCAAuC;AAAA,EAClG,CAAC,4BAAW,sBAAsB,GAAG,CAAC,oBAAoB,kCAAkC;AAC9F;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var conversionHelpers_exports = {};
|
|
30
|
+
__export(conversionHelpers_exports, {
|
|
31
|
+
convertHeader: () => convertHeader,
|
|
32
|
+
convertList: () => convertList
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(conversionHelpers_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_ds_left_navigation_tree = require("@elliemae/ds-left-navigation-tree");
|
|
37
|
+
var import_constants = require("../../constants/index.js");
|
|
38
|
+
var import_conversionConstants = require("./conversionConstants.js");
|
|
39
|
+
var import_convertItemOpts = require("./convertItemOpts.js");
|
|
40
|
+
var import_report = require("./report.js");
|
|
41
|
+
const convertCollapsed = (item, report) => {
|
|
42
|
+
if (!item.CollapsedComponent || import_conversionConstants.NO_RAIL_TYPES.includes(item.type ?? "")) return {};
|
|
43
|
+
(0, import_report.markLost)(report, {
|
|
44
|
+
code: "collapsed-component-ctx",
|
|
45
|
+
dsId: item.dsId ?? "",
|
|
46
|
+
message: "CollapsedComponent is kept, it only receives { item }"
|
|
47
|
+
});
|
|
48
|
+
return { CollapsedComponent: item.CollapsedComponent };
|
|
49
|
+
};
|
|
50
|
+
const joinSectionLabel = (label, rightSection) => typeof label === "string" && typeof rightSection === "string" ? `${label}, ${rightSection}` : label;
|
|
51
|
+
const convertSubmenu = (item, args) => {
|
|
52
|
+
const { report, childrenByParentId, recurse } = args;
|
|
53
|
+
const dsId = item.dsId ?? "";
|
|
54
|
+
const children = (0, import_conversionConstants.getOwn)(childrenByParentId, dsId);
|
|
55
|
+
if (!children)
|
|
56
|
+
(0, import_report.markLost)(report, { code: "submenu-without-children", dsId, message: "No entry in childrenByParentId" });
|
|
57
|
+
return {
|
|
58
|
+
dsId,
|
|
59
|
+
type: import_ds_left_navigation_tree.LEFT_NAVIGATION_TREE_ITEM_TYPES.PARENT,
|
|
60
|
+
...convertCollapsed(item, report),
|
|
61
|
+
itemOpts: { ...(0, import_convertItemOpts.convertItemOpts)({ item, report, kind: "submenu" }), items: recurse(children ?? []) }
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
const convertDrilldown = (item, args) => {
|
|
65
|
+
const { report, recurse } = args;
|
|
66
|
+
const dsId = item.dsId ?? "";
|
|
67
|
+
const { startOpened, isOpened, items = [] } = item.itemOpts ?? {};
|
|
68
|
+
const opts = (0, import_convertItemOpts.convertItemOpts)({ item, report, kind: "drilldown" });
|
|
69
|
+
const isControlled = item.type === import_constants.ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN;
|
|
70
|
+
return {
|
|
71
|
+
dsId,
|
|
72
|
+
type: import_ds_left_navigation_tree.LEFT_NAVIGATION_TREE_ITEM_TYPES.PARENT,
|
|
73
|
+
...convertCollapsed(item, report),
|
|
74
|
+
itemOpts: {
|
|
75
|
+
...opts,
|
|
76
|
+
...isControlled && { isOpened: !!isOpened },
|
|
77
|
+
...!isControlled && startOpened !== void 0 && { startOpened },
|
|
78
|
+
items: recurse(items)
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
const convertOne = (item, args) => {
|
|
83
|
+
const { report } = args;
|
|
84
|
+
const dsId = item.dsId ?? "";
|
|
85
|
+
const { type } = item;
|
|
86
|
+
if (typeof type !== "string") {
|
|
87
|
+
(0, import_report.markLost)(report, {
|
|
88
|
+
code: "custom-component-dropped",
|
|
89
|
+
dsId,
|
|
90
|
+
message: "Items with a custom Component are not supported"
|
|
91
|
+
});
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (import_conversionConstants.LEAF_TYPES.includes(type)) {
|
|
95
|
+
return {
|
|
96
|
+
dsId,
|
|
97
|
+
type: import_ds_left_navigation_tree.LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF,
|
|
98
|
+
...convertCollapsed(item, report),
|
|
99
|
+
itemOpts: (0, import_convertItemOpts.convertItemOpts)({ item, report, kind: "leaf" })
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (type === import_constants.ITEM_TYPES.LEFT_NAV_ITEM_SUBMENU) return convertSubmenu(item, args);
|
|
103
|
+
if (import_conversionConstants.DRILLDOWN_TYPES.includes(type)) return convertDrilldown(item, args);
|
|
104
|
+
const [code, message] = (0, import_conversionConstants.getOwn)(import_conversionConstants.DROPPED_TYPE_CODES, type) ?? [
|
|
105
|
+
"unknown-type-dropped",
|
|
106
|
+
`Type "${type}" is not out of the box`
|
|
107
|
+
];
|
|
108
|
+
(0, import_report.markLost)(report, { code, dsId, message });
|
|
109
|
+
return null;
|
|
110
|
+
};
|
|
111
|
+
const convertSection = (item, report, items) => {
|
|
112
|
+
const { label, labelRightSection } = item.itemOpts ?? {};
|
|
113
|
+
const joinable = typeof label === "string" && typeof labelRightSection === "string";
|
|
114
|
+
const opts = (0, import_convertItemOpts.convertItemOpts)({ item, report, kind: "section", joinable });
|
|
115
|
+
return {
|
|
116
|
+
dsId: item.dsId ?? "",
|
|
117
|
+
type: import_ds_left_navigation_tree.LEFT_NAVIGATION_TREE_ITEM_TYPES.SECTION,
|
|
118
|
+
itemOpts: {
|
|
119
|
+
...opts,
|
|
120
|
+
label: joinSectionLabel(label, labelRightSection),
|
|
121
|
+
items
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
};
|
|
125
|
+
const convertList = (args) => {
|
|
126
|
+
const { list, isRoot, report, ancestors = [] } = args;
|
|
127
|
+
const converted = [];
|
|
128
|
+
let sectionItems = null;
|
|
129
|
+
list.forEach((item) => {
|
|
130
|
+
const { type, dsId = "" } = item;
|
|
131
|
+
const isSection = type === import_constants.ITEM_TYPES.LEFT_NAV_ITEM_SECTION;
|
|
132
|
+
if (isSection || type === import_constants.ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR) {
|
|
133
|
+
if (!isRoot) {
|
|
134
|
+
(0, import_report.markLost)(report, {
|
|
135
|
+
code: "section-in-nested-list-dropped",
|
|
136
|
+
dsId,
|
|
137
|
+
message: "Sections and separators are only supported at the root level"
|
|
138
|
+
});
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
sectionItems = isSection ? [] : null;
|
|
142
|
+
converted.push(sectionItems ? convertSection(item, report, sectionItems) : { dsId, type: import_ds_left_navigation_tree.LEFT_NAVIGATION_TREE_ITEM_TYPES.SEPARATOR });
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
const ancestorKey = dsId || item;
|
|
146
|
+
const isOwnAncestor = ancestors.includes(ancestorKey);
|
|
147
|
+
const convertedItem = convertOne(item, {
|
|
148
|
+
report,
|
|
149
|
+
childrenByParentId: args.childrenByParentId,
|
|
150
|
+
recurse: (children) => isOwnAncestor ? [] : convertList({ ...args, list: children, isRoot: false, ancestors: [...ancestors, ancestorKey] })
|
|
151
|
+
});
|
|
152
|
+
if (!convertedItem) return;
|
|
153
|
+
if (sectionItems) sectionItems.push(convertedItem);
|
|
154
|
+
else converted.push(convertedItem);
|
|
155
|
+
});
|
|
156
|
+
return converted;
|
|
157
|
+
};
|
|
158
|
+
const convertHeader = (header, report) => {
|
|
159
|
+
if (header.type === import_constants.ITEM_TYPES.LEFT_NAV_ITEM_SKELETON) {
|
|
160
|
+
const [code, message] = import_conversionConstants.DROPPED_TYPE_CODES[import_constants.ITEM_TYPES.LEFT_NAV_ITEM_SKELETON];
|
|
161
|
+
(0, import_report.markLost)(report, { code, dsId: header.dsId ?? "", message });
|
|
162
|
+
return null;
|
|
163
|
+
}
|
|
164
|
+
if (typeof header.type !== "string" || !import_conversionConstants.OUT_OF_THE_BOX_TYPES.includes(header.type)) {
|
|
165
|
+
(0, import_report.markLost)(report, {
|
|
166
|
+
code: "custom-component-dropped",
|
|
167
|
+
dsId: header.dsId ?? "",
|
|
168
|
+
message: "A HeaderComponent with a custom Component is not supported"
|
|
169
|
+
});
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
if (!import_conversionConstants.HEADER_TYPES.includes(header.type)) {
|
|
173
|
+
(0, import_report.markLost)(report, {
|
|
174
|
+
code: "unknown-type-dropped",
|
|
175
|
+
dsId: header.dsId ?? "",
|
|
176
|
+
message: `A HeaderComponent of type "${header.type}" is not supported, use a header or a leaf type`
|
|
177
|
+
});
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
dsId: header.dsId ?? "",
|
|
182
|
+
type: import_ds_left_navigation_tree.LEFT_NAVIGATION_TREE_ITEM_TYPES.LEAF,
|
|
183
|
+
...convertCollapsed(header, report),
|
|
184
|
+
/** A header of a leaf type is drawn by LeftNavigation as that leaf (a with-date header shows its date), so it converts as one. */
|
|
185
|
+
itemOpts: (0, import_convertItemOpts.convertItemOpts)({
|
|
186
|
+
item: header,
|
|
187
|
+
report,
|
|
188
|
+
kind: header.type === import_constants.ITEM_TYPES.LEFT_NAV_ITEM_HEADER ? "header" : "leaf"
|
|
189
|
+
})
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
//# sourceMappingURL=conversionHelpers.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/conversionHelpers.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import {\n LEFT_NAVIGATION_TREE_ITEM_TYPES as TREE_TYPES,\n type DSLeftNavigationTreeT,\n} from '@elliemae/ds-left-navigation-tree';\nimport { ITEM_TYPES } from '../../constants/index.js';\nimport type { DSLeftNavigationT } from '../../react-desc-prop-types.js';\nimport {\n DRILLDOWN_TYPES,\n DROPPED_TYPE_CODES,\n HEADER_TYPES,\n LEAF_TYPES,\n NO_RAIL_TYPES,\n OUT_OF_THE_BOX_TYPES,\n getOwn,\n} from './conversionConstants.js';\nimport { convertItemOpts } from './convertItemOpts.js';\nimport { markLost } from './report.js';\nimport type { DSLeftNavBridgeT } from './types.js';\n\ntype OldItemT = DSLeftNavigationT.GenericItemItemProps;\ntype NewItemT = DSLeftNavigationTreeT.Item;\ntype ReportT = DSLeftNavBridgeT.ReportMutableT;\n\ntype ConvertListArgsT = {\n list: readonly OldItemT[];\n isRoot: boolean;\n /** The dsIds (or the items themselves, when they have none) of the submenus and drilldowns being expanded, to stop a branch that contains itself. */\n ancestors?: readonly (string | OldItemT)[];\n report: ReportT;\n childrenByParentId: DSLeftNavBridgeT.ChildrenByParentIdT;\n};\n\nconst convertCollapsed = (item: OldItemT, report: ReportT): Partial<NewItemT> => {\n if (!item.CollapsedComponent || NO_RAIL_TYPES.includes(item.type ?? '')) return {};\n markLost(report, {\n code: 'collapsed-component-ctx',\n dsId: item.dsId ?? '',\n message: 'CollapsedComponent is kept, it only receives { item }',\n });\n return { CollapsedComponent: item.CollapsedComponent as unknown as NewItemT['CollapsedComponent'] };\n};\n\nconst joinSectionLabel = (label: unknown, rightSection: unknown) =>\n typeof label === 'string' && typeof rightSection === 'string' ? `${label}, ${rightSection}` : label;\n\ntype RecurseT = (children: readonly OldItemT[]) => NewItemT[];\n\nconst convertSubmenu = (item: OldItemT, args: ConvertOneArgsT): NewItemT => {\n const { report, childrenByParentId, recurse } = args;\n const dsId = item.dsId ?? '';\n const children = getOwn(childrenByParentId, dsId);\n if (!children)\n markLost(report, { code: 'submenu-without-children', dsId, message: 'No entry in childrenByParentId' });\n return {\n dsId,\n type: TREE_TYPES.PARENT,\n ...convertCollapsed(item, report),\n itemOpts: { ...convertItemOpts({ item, report, kind: 'submenu' }), items: recurse(children ?? []) },\n };\n};\n\n/**\n * Both legacy drilldowns already open their children in place, so they map one to one to a tree parent. The open state\n * follows the legacy type: the controlled one reads only `isOpened` (closed when omitted), the uncontrolled one only\n * `startOpened`. The tree treats a parent as controlled when `isOpened` is defined, so each option is carried only where\n * LeftNavigation used it.\n */\nconst convertDrilldown = (item: OldItemT, args: ConvertOneArgsT): NewItemT => {\n const { report, recurse } = args;\n const dsId = item.dsId ?? '';\n const { startOpened, isOpened, items = [] } = item.itemOpts ?? {};\n const opts = convertItemOpts({ item, report, kind: 'drilldown' });\n const isControlled = item.type === ITEM_TYPES.LEFT_NAV_ITEM_CONTROLLED_DRILLDOWN;\n return {\n dsId,\n type: TREE_TYPES.PARENT,\n ...convertCollapsed(item, report),\n itemOpts: {\n ...opts,\n ...(isControlled && { isOpened: !!isOpened }),\n ...(!isControlled && startOpened !== undefined && { startOpened }),\n items: recurse(items),\n },\n };\n};\n\ntype ConvertOneArgsT = Omit<ConvertListArgsT, 'list' | 'isRoot'> & { recurse: RecurseT };\n\n/**\n * Converts one item that is neither a section nor a separator. Returns null when the tree cannot carry it over.\n */\nconst convertOne = (item: OldItemT, args: ConvertOneArgsT): NewItemT | null => {\n const { report } = args;\n const dsId = item.dsId ?? '';\n const { type } = item;\n\n if (typeof type !== 'string') {\n markLost(report, {\n code: 'custom-component-dropped',\n dsId,\n message: 'Items with a custom Component are not supported',\n });\n return null;\n }\n if (LEAF_TYPES.includes(type)) {\n return {\n dsId,\n type: TREE_TYPES.LEAF,\n ...convertCollapsed(item, report),\n itemOpts: convertItemOpts({ item, report, kind: 'leaf' }),\n };\n }\n if (type === ITEM_TYPES.LEFT_NAV_ITEM_SUBMENU) return convertSubmenu(item, args);\n if (DRILLDOWN_TYPES.includes(type)) return convertDrilldown(item, args);\n const [code, message] = getOwn(DROPPED_TYPE_CODES as Record<string, readonly [string, string]>, type) ?? [\n 'unknown-type-dropped',\n `Type \"${type}\" is not out of the box`,\n ];\n markLost(report, { code: code as DSLeftNavBridgeT.LostCodeT, dsId, message });\n return null;\n};\n\nconst convertSection = (item: OldItemT, report: ReportT, items: NewItemT[]): NewItemT => {\n const { label, labelRightSection } = item.itemOpts ?? {};\n const joinable = typeof label === 'string' && typeof labelRightSection === 'string';\n const opts = convertItemOpts({ item, report, kind: 'section', joinable });\n return {\n dsId: item.dsId ?? '',\n type: TREE_TYPES.SECTION,\n itemOpts: {\n ...opts,\n label: joinSectionLabel(label, labelRightSection) as NonNullable<NewItemT['itemOpts']>['label'],\n items,\n },\n };\n};\n\n/**\n * LeftNavigation lists are flat: a section is a label and the items that follow it belong to it until the next section or separator.\n * The tree holds the children of a section inside it, so the conversion groups them.\n */\nexport const convertList = (args: ConvertListArgsT): NewItemT[] => {\n const { list, isRoot, report, ancestors = [] } = args;\n const converted: NewItemT[] = [];\n let sectionItems: NewItemT[] | null = null;\n\n list.forEach((item) => {\n const { type, dsId = '' } = item;\n const isSection = type === ITEM_TYPES.LEFT_NAV_ITEM_SECTION;\n if (isSection || type === ITEM_TYPES.LEFT_NAV_ITEM_SEPARATOR) {\n if (!isRoot) {\n markLost(report, {\n code: 'section-in-nested-list-dropped',\n dsId,\n message: 'Sections and separators are only supported at the root level',\n });\n return;\n }\n sectionItems = isSection ? [] : null;\n converted.push(sectionItems ? convertSection(item, report, sectionItems) : { dsId, type: TREE_TYPES.SEPARATOR });\n return;\n }\n /** An item that is its own ancestor (by dsId, or by identity when it has none) would expand forever: its repeated branch stays empty and `duplicate-id` or `missing-id` reports it. */\n const ancestorKey = dsId || item;\n const isOwnAncestor = ancestors.includes(ancestorKey);\n const convertedItem = convertOne(item, {\n report,\n childrenByParentId: args.childrenByParentId,\n recurse: (children) =>\n isOwnAncestor\n ? []\n : convertList({ ...args, list: children, isRoot: false, ancestors: [...ancestors, ancestorKey] }),\n });\n if (!convertedItem) return;\n if (sectionItems) sectionItems.push(convertedItem);\n else converted.push(convertedItem);\n });\n return converted;\n};\n\n/**\n * Returns null when the header cannot be carried over: a skeleton (the same policy as the items of the list), or a custom\n * `Component` (no type, or a type that is not out of the box).\n */\nexport const convertHeader = (header: OldItemT, report: ReportT): NewItemT | null => {\n if (header.type === ITEM_TYPES.LEFT_NAV_ITEM_SKELETON) {\n const [code, message] = DROPPED_TYPE_CODES[ITEM_TYPES.LEFT_NAV_ITEM_SKELETON];\n markLost(report, { code, dsId: header.dsId ?? '', message });\n return null;\n }\n if (typeof header.type !== 'string' || !OUT_OF_THE_BOX_TYPES.includes(header.type)) {\n markLost(report, {\n code: 'custom-component-dropped',\n dsId: header.dsId ?? '',\n message: 'A HeaderComponent with a custom Component is not supported',\n });\n return null;\n }\n if (!HEADER_TYPES.includes(header.type)) {\n markLost(report, {\n code: 'unknown-type-dropped',\n dsId: header.dsId ?? '',\n message: `A HeaderComponent of type \"${header.type}\" is not supported, use a header or a leaf type`,\n });\n return null;\n }\n return {\n dsId: header.dsId ?? '',\n type: TREE_TYPES.LEAF,\n ...convertCollapsed(header, report),\n /** A header of a leaf type is drawn by LeftNavigation as that leaf (a with-date header shows its date), so it converts as one. */\n itemOpts: convertItemOpts({\n item: header,\n report,\n kind: header.type === ITEM_TYPES.LEFT_NAV_ITEM_HEADER ? 'header' : 'leaf',\n }),\n };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,qCAGO;AACP,uBAA2B;AAE3B,iCAQO;AACP,6BAAgC;AAChC,oBAAyB;AA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BAAW,wBAAwB;AACrD,UAAM,CAAC,MAAM,OAAO,IAAI,8CAAmB,4BAAW,sBAAsB;AAC5E,gCAAS,QAAQ,EAAE,MAAM,MAAM,OAAO,QAAQ,IAAI,QAAQ,CAAC;AAC3D,WAAO;AAAA,EACT;AACA,MAAI,OAAO,OAAO,SAAS,YAAY,CAAC,gDAAqB,SAAS,OAAO,IAAI,GAAG;AAClF,gCAAS,QAAQ;AAAA,MACf,MAAM;AAAA,MACN,MAAM,OAAO,QAAQ;AAAA,MACrB,SAAS;AAAA,IACX,CAAC;AACD,WAAO;AAAA,EACT;AACA,MAAI,CAAC,wCAAa,SAAS,OAAO,IAAI,GAAG;AACvC,gCAAS,QAAQ;AAAA,MACf,MAAM;AAAA,MACN,MAAM,OAAO,QAAQ;AAAA,MACrB,SAAS,8BAA8B,OAAO,IAAI;AAAA,IACpD,CAAC;AACD,WAAO;AAAA,EACT;AACA,SAAO;AAAA,IACL,MAAM,OAAO,QAAQ;AAAA,IACrB,MAAM,+BAAAA,gCAAW;AAAA,IACjB,GAAG,iBAAiB,QAAQ,MAAM;AAAA;AAAA,IAElC,cAAU,wCAAgB;AAAA,MACxB,MAAM;AAAA,MACN;AAAA,MACA,MAAM,OAAO,SAAS,4BAAW,uBAAuB,WAAW;AAAA,IACrE,CAAC;AAAA,EACH;AACF;",
|
|
6
|
+
"names": ["TREE_TYPES"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var convertItemOpts_exports = {};
|
|
30
|
+
__export(convertItemOpts_exports, {
|
|
31
|
+
convertItemOpts: () => convertItemOpts
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(convertItemOpts_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_constants = require("../../constants/index.js");
|
|
37
|
+
var import_report = require("./report.js");
|
|
38
|
+
const CONSUMER_SELECTABLE_TYPES = [import_constants.ITEM_TYPES.LEFT_NAV_ITEM_TEXT_LABEL, import_constants.ITEM_TYPES.LEFT_NAV_ITEM_WITH_DATE];
|
|
39
|
+
const convertSelectable = (item) => {
|
|
40
|
+
const { selectable } = item.itemOpts ?? {};
|
|
41
|
+
return selectable !== void 0 && CONSUMER_SELECTABLE_TYPES.includes(item.type ?? "") ? { selectable } : {};
|
|
42
|
+
};
|
|
43
|
+
const KNOWN_OPTS = /* @__PURE__ */ new Set([
|
|
44
|
+
"label",
|
|
45
|
+
"labelBold",
|
|
46
|
+
"labelColor",
|
|
47
|
+
"labelOverflow",
|
|
48
|
+
"labelRightSection",
|
|
49
|
+
"selectable",
|
|
50
|
+
"focuseable",
|
|
51
|
+
"startOpened",
|
|
52
|
+
"isOpened",
|
|
53
|
+
"openable",
|
|
54
|
+
"closable",
|
|
55
|
+
"indent",
|
|
56
|
+
"LeftComponent",
|
|
57
|
+
"RightComponent",
|
|
58
|
+
"BottomComponent",
|
|
59
|
+
"ariaLabel",
|
|
60
|
+
"ariaRole",
|
|
61
|
+
"ariaLive",
|
|
62
|
+
"ariaExpanded",
|
|
63
|
+
"ariaDescribedBy",
|
|
64
|
+
"items",
|
|
65
|
+
"labelDataTestId",
|
|
66
|
+
"skeletonVariant"
|
|
67
|
+
]);
|
|
68
|
+
const DROPPED_OPTS = ["focuseable", "openable", "closable", "indent", "skeletonVariant", "labelDataTestId"];
|
|
69
|
+
const ARIA_OPTS = ["ariaLabel", "ariaRole", "ariaLive", "ariaExpanded", "ariaDescribedBy"];
|
|
70
|
+
const toRightComponent = (node) => (
|
|
71
|
+
// LeftNavigation shows labelRightSection as plain content, the tree renders it through RightComponent
|
|
72
|
+
function RightSection() {
|
|
73
|
+
return import_react.default.createElement(import_react.default.Fragment, null, node);
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
const EMPTY_CTX = {
|
|
77
|
+
leftNavProps: {},
|
|
78
|
+
selectedItem: null,
|
|
79
|
+
selectedParent: null
|
|
80
|
+
};
|
|
81
|
+
const carryRightComponent = (Old, rightSection) => function CarriedRightComponent({ item }) {
|
|
82
|
+
return import_react.default.createElement(
|
|
83
|
+
import_react.default.Fragment,
|
|
84
|
+
null,
|
|
85
|
+
rightSection,
|
|
86
|
+
Old ? import_react.default.createElement(Old, { item, ctx: EMPTY_CTX }) : null
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
const reportStyleLosses = (opts, dsId, report) => {
|
|
90
|
+
if (opts.labelOverflow === "truncate") {
|
|
91
|
+
(0, import_report.markLost)(report, {
|
|
92
|
+
code: "label-truncate-to-wrap",
|
|
93
|
+
dsId,
|
|
94
|
+
message: 'labelOverflow "truncate" is not supported, labels wrap'
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
if (opts.labelBold !== void 0 || opts.labelColor !== void 0) {
|
|
98
|
+
(0, import_report.markLost)(report, { code: "label-style-dropped", dsId, message: "labelBold and labelColor are not supported" });
|
|
99
|
+
}
|
|
100
|
+
if (ARIA_OPTS.some((key) => opts[key] !== void 0)) {
|
|
101
|
+
(0, import_report.markLost)(report, {
|
|
102
|
+
code: "aria-overrides-dropped",
|
|
103
|
+
dsId,
|
|
104
|
+
message: "aria overrides are not supported, the tree computes them"
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const reportDroppedComponents = ({
|
|
109
|
+
item,
|
|
110
|
+
report,
|
|
111
|
+
carriesRight
|
|
112
|
+
}) => {
|
|
113
|
+
const opts = item.itemOpts ?? {};
|
|
114
|
+
const dropped = [
|
|
115
|
+
opts.RightComponent && !carriesRight ? "RightComponent" : void 0,
|
|
116
|
+
opts.LeftComponent ? "LeftComponent" : void 0,
|
|
117
|
+
opts.BottomComponent ? "BottomComponent" : void 0
|
|
118
|
+
].filter(Boolean);
|
|
119
|
+
if (dropped.length === 0) return;
|
|
120
|
+
(0, import_report.markLost)(report, {
|
|
121
|
+
code: "component-with-ctx-dropped",
|
|
122
|
+
dsId: item.dsId ?? "",
|
|
123
|
+
message: `Not supported: ${dropped.join(", ")}`
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
const droppedRightSection = (opts, joinable) => opts.labelRightSection !== void 0 && !joinable ? ["labelRightSection"] : [];
|
|
127
|
+
const convertCarriedRightComponent = (args, carriesRight) => {
|
|
128
|
+
const { item, report, joinable = false } = args;
|
|
129
|
+
const opts = item.itemOpts ?? {};
|
|
130
|
+
(0, import_report.markLost)(report, {
|
|
131
|
+
code: "right-component-ctx",
|
|
132
|
+
dsId: item.dsId ?? "",
|
|
133
|
+
message: "RightComponent is kept, it only receives { item } and an empty ctx"
|
|
134
|
+
});
|
|
135
|
+
return {
|
|
136
|
+
RightComponent: carryRightComponent(opts.RightComponent, carriesRight ? opts.labelRightSection : void 0),
|
|
137
|
+
droppedOpts: carriesRight ? [] : droppedRightSection(opts, joinable)
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
const convertRightSection = (args) => {
|
|
141
|
+
const { item, report } = args;
|
|
142
|
+
const { labelRightSection } = item.itemOpts ?? {};
|
|
143
|
+
if (typeof labelRightSection !== "string") {
|
|
144
|
+
(0, import_report.markLost)(report, {
|
|
145
|
+
code: "right-component-ctx",
|
|
146
|
+
dsId: item.dsId ?? "",
|
|
147
|
+
message: "labelRightSection is not text, it is drawn as is: remove any control inside it"
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
return { RightComponent: toRightComponent(labelRightSection), droppedOpts: [] };
|
|
151
|
+
};
|
|
152
|
+
const convertRightSide = (args) => {
|
|
153
|
+
const { item, report, kind, joinable = false } = args;
|
|
154
|
+
const opts = item.itemOpts ?? {};
|
|
155
|
+
const carriesRight = kind === "leaf" || kind === "drilldown";
|
|
156
|
+
const carriesRightComponent = carriesRight || kind === "header";
|
|
157
|
+
reportDroppedComponents({ item, report, carriesRight: carriesRightComponent });
|
|
158
|
+
if (carriesRightComponent && opts.RightComponent) return convertCarriedRightComponent(args, carriesRight);
|
|
159
|
+
if (carriesRight && opts.labelRightSection !== void 0) return convertRightSection(args);
|
|
160
|
+
return { droppedOpts: droppedRightSection(opts, joinable) };
|
|
161
|
+
};
|
|
162
|
+
const convertItemOpts = (args) => {
|
|
163
|
+
const { item, report } = args;
|
|
164
|
+
const dsId = item.dsId ?? "";
|
|
165
|
+
const opts = item.itemOpts ?? {};
|
|
166
|
+
const converted = { ...convertSelectable(item) };
|
|
167
|
+
if (opts.label !== void 0) converted.label = opts.label;
|
|
168
|
+
if (opts.labelOverflow !== void 0 && opts.labelOverflow !== "truncate") {
|
|
169
|
+
converted.labelOverflow = opts.labelOverflow;
|
|
170
|
+
}
|
|
171
|
+
reportStyleLosses(opts, dsId, report);
|
|
172
|
+
const { RightComponent, droppedOpts: droppedRight } = convertRightSide(args);
|
|
173
|
+
if (RightComponent) converted.RightComponent = RightComponent;
|
|
174
|
+
const droppedSelectable = args.kind === "drilldown" && opts.selectable !== void 0 ? ["selectable"] : [];
|
|
175
|
+
const customKeys = Object.keys(opts).filter((key) => !KNOWN_OPTS.has(key) && opts[key] !== void 0);
|
|
176
|
+
const droppedOpts = [
|
|
177
|
+
...droppedSelectable,
|
|
178
|
+
...DROPPED_OPTS.filter((key) => opts[key] !== void 0),
|
|
179
|
+
...customKeys,
|
|
180
|
+
...droppedRight
|
|
181
|
+
];
|
|
182
|
+
if (droppedOpts.length > 0) {
|
|
183
|
+
(0, import_report.markLost)(report, { code: "item-options-dropped", dsId, message: `Not supported: ${droppedOpts.join(", ")}` });
|
|
184
|
+
}
|
|
185
|
+
return converted;
|
|
186
|
+
};
|
|
187
|
+
//# sourceMappingURL=convertItemOpts.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/convertItemOpts.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport type { DSLeftNavigationTreeT } from '@elliemae/ds-left-navigation-tree';\nimport { ITEM_TYPES } from '../../constants/index.js';\nimport type { DSLeftNavigationT } from '../../react-desc-prop-types.js';\nimport { markLost } from './report.js';\nimport type { DSLeftNavBridgeT } from './types.js';\n\ntype OldItemT = DSLeftNavigationT.GenericItemItemProps;\ntype NewItemOptsT = DSLeftNavigationTreeT.ItemOpts;\ntype ReportT = DSLeftNavBridgeT.ReportMutableT;\ntype OldOptsT = OldItemT['itemOpts'];\ntype OldRightComponentPropsT = DSLeftNavigationT.ComponentProps;\n\n/**\n * LeftNavigation lets the consumer decide `selectable` only on these types. The others set it themselves (a link is always\n * selectable, a submenu, a header or a section follow their own state), so there is nothing to carry or to report.\n */\nconst CONSUMER_SELECTABLE_TYPES: string[] = [ITEM_TYPES.LEFT_NAV_ITEM_TEXT_LABEL, ITEM_TYPES.LEFT_NAV_ITEM_WITH_DATE];\n\nconst convertSelectable = (item: OldItemT): Pick<NewItemOptsT, 'selectable'> => {\n const { selectable } = item.itemOpts ?? {};\n return selectable !== undefined && CONSUMER_SELECTABLE_TYPES.includes(item.type ?? '') ? { selectable } : {};\n};\n\n/**\n * Every key LeftNavigation knows in `itemOpts`. `ItemOptsT` also accepts any other key, which the tree has no place for.\n */\nconst KNOWN_OPTS = new Set([\n 'label',\n 'labelBold',\n 'labelColor',\n 'labelOverflow',\n 'labelRightSection',\n 'selectable',\n 'focuseable',\n 'startOpened',\n 'isOpened',\n 'openable',\n 'closable',\n 'indent',\n 'LeftComponent',\n 'RightComponent',\n 'BottomComponent',\n 'ariaLabel',\n 'ariaRole',\n 'ariaLive',\n 'ariaExpanded',\n 'ariaDescribedBy',\n 'items',\n 'labelDataTestId',\n 'skeletonVariant',\n]);\n\nconst DROPPED_OPTS = ['focuseable', 'openable', 'closable', 'indent', 'skeletonVariant', 'labelDataTestId'] as const;\n\nconst ARIA_OPTS = ['ariaLabel', 'ariaRole', 'ariaLive', 'ariaExpanded', 'ariaDescribedBy'] as const;\n\nconst toRightComponent = (node: unknown): NewItemOptsT['RightComponent'] =>\n // LeftNavigation shows labelRightSection as plain content, the tree renders it through RightComponent\n function RightSection() {\n return React.createElement(React.Fragment, null, node as React.ReactNode);\n };\n\n/**\n * The tree gives its components `{ item }`, LeftNavigation gave `{ item, ctx }`. Components that read `ctx` get an empty one.\n */\nconst EMPTY_CTX = {\n leftNavProps: {},\n selectedItem: null,\n selectedParent: null,\n} as unknown as OldRightComponentPropsT['ctx'];\n\n/**\n * LeftNavigation draws `labelRightSection` and then `RightComponent` on the right side of an item, the tree has one `RightComponent`.\n */\nconst carryRightComponent = (Old: OldOptsT['RightComponent'], rightSection: unknown): NewItemOptsT['RightComponent'] =>\n function CarriedRightComponent({ item }) {\n return React.createElement(\n React.Fragment,\n null,\n rightSection as React.ReactNode,\n Old\n ? React.createElement(Old, { item: item as unknown as OldRightComponentPropsT['item'], ctx: EMPTY_CTX })\n : null,\n );\n };\n\nconst reportStyleLosses = (opts: OldOptsT, dsId: string, report: ReportT) => {\n if (opts.labelOverflow === 'truncate') {\n markLost(report, {\n code: 'label-truncate-to-wrap',\n dsId,\n message: 'labelOverflow \"truncate\" is not supported, labels wrap',\n });\n }\n if (opts.labelBold !== undefined || opts.labelColor !== undefined) {\n markLost(report, { code: 'label-style-dropped', dsId, message: 'labelBold and labelColor are not supported' });\n }\n if (ARIA_OPTS.some((key) => opts[key] !== undefined)) {\n markLost(report, {\n code: 'aria-overrides-dropped',\n dsId,\n message: 'aria overrides are not supported, the tree computes them',\n });\n }\n};\n\ntype ConvertItemOptsArgsT = {\n item: OldItemT;\n report: ReportT;\n /**\n * Leaves and drilldowns carry `RightComponent` and `labelRightSection`, the header only its `RightComponent`.\n * Submenus and the header keep their right side only as the chevron, and the tree draws its own arrow, so it is dropped.\n */\n kind: 'leaf' | 'drilldown' | 'submenu' | 'header' | 'section';\n /** The caller merges labelRightSection into the label (sections), so it is not lost. */\n joinable?: boolean;\n};\n\ntype RightSideResultT = { RightComponent?: NewItemOptsT['RightComponent']; droppedOpts: string[] };\n\nconst reportDroppedComponents = ({\n item,\n report,\n carriesRight,\n}: {\n item: OldItemT;\n report: ReportT;\n carriesRight: boolean;\n}) => {\n const opts = item.itemOpts ?? {};\n const dropped = [\n opts.RightComponent && !carriesRight ? 'RightComponent' : undefined,\n opts.LeftComponent ? 'LeftComponent' : undefined,\n opts.BottomComponent ? 'BottomComponent' : undefined,\n ].filter(Boolean);\n if (dropped.length === 0) return;\n markLost(report, {\n code: 'component-with-ctx-dropped',\n dsId: item.dsId ?? '',\n message: `Not supported: ${dropped.join(', ')}`,\n });\n};\n\nconst droppedRightSection = (opts: OldOptsT, joinable: boolean) =>\n opts.labelRightSection !== undefined && !joinable ? ['labelRightSection'] : [];\n\n/**\n * The header also draws its `RightComponent` (the tree renders it, LeftNavigation did), but never drew `labelRightSection`.\n */\nconst convertCarriedRightComponent = (args: ConvertItemOptsArgsT, carriesRight: boolean): RightSideResultT => {\n const { item, report, joinable = false } = args;\n const opts = item.itemOpts ?? {};\n markLost(report, {\n code: 'right-component-ctx',\n dsId: item.dsId ?? '',\n message: 'RightComponent is kept, it only receives { item } and an empty ctx',\n });\n return {\n RightComponent: carryRightComponent(opts.RightComponent, carriesRight ? opts.labelRightSection : undefined),\n droppedOpts: carriesRight ? [] : droppedRightSection(opts, joinable),\n };\n};\n\n/**\n * A `labelRightSection` that is not text is drawn as is, so a control inside it would be a second focusable element in the\n * treeitem: the conversion keeps it and reports it, as it does with a carried `RightComponent`.\n */\nconst convertRightSection = (args: ConvertItemOptsArgsT): RightSideResultT => {\n const { item, report } = args;\n const { labelRightSection } = item.itemOpts ?? {};\n if (typeof labelRightSection !== 'string') {\n markLost(report, {\n code: 'right-component-ctx',\n dsId: item.dsId ?? '',\n message: 'labelRightSection is not text, it is drawn as is: remove any control inside it',\n });\n }\n return { RightComponent: toRightComponent(labelRightSection), droppedOpts: [] };\n};\n\n/**\n * The right side of an item: leaves and drilldowns keep `RightComponent` and `labelRightSection`, the header only its\n * `RightComponent`, the other kinds lose them.\n */\nconst convertRightSide = (args: ConvertItemOptsArgsT): RightSideResultT => {\n const { item, report, kind, joinable = false } = args;\n const opts = item.itemOpts ?? {};\n const carriesRight = kind === 'leaf' || kind === 'drilldown';\n const carriesRightComponent = carriesRight || kind === 'header';\n reportDroppedComponents({ item, report, carriesRight: carriesRightComponent });\n if (carriesRightComponent && opts.RightComponent) return convertCarriedRightComponent(args, carriesRight);\n if (carriesRight && opts.labelRightSection !== undefined) return convertRightSection(args);\n return { droppedOpts: droppedRightSection(opts, joinable) };\n};\n\n/**\n * Builds the tree item options shared by every converted type and records what could not be carried over.\n */\nexport const convertItemOpts = (args: ConvertItemOptsArgsT): NewItemOptsT => {\n const { item, report } = args;\n const dsId = item.dsId ?? '';\n const opts = item.itemOpts ?? {};\n const converted: NewItemOptsT = { ...convertSelectable(item) };\n if (opts.label !== undefined) converted.label = opts.label;\n if (opts.labelOverflow !== undefined && opts.labelOverflow !== 'truncate') {\n converted.labelOverflow = opts.labelOverflow;\n }\n reportStyleLosses(opts, dsId, report);\n\n const { RightComponent, droppedOpts: droppedRight } = convertRightSide(args);\n if (RightComponent) converted.RightComponent = RightComponent;\n /** LeftNavigation drilldowns keep the consumer's `selectable`, the tree has it on leaves only. */\n const droppedSelectable = args.kind === 'drilldown' && opts.selectable !== undefined ? ['selectable'] : [];\n const customKeys = Object.keys(opts).filter((key) => !KNOWN_OPTS.has(key) && opts[key] !== undefined);\n const droppedOpts = [\n ...droppedSelectable,\n ...DROPPED_OPTS.filter((key) => opts[key] !== undefined),\n ...customKeys,\n ...droppedRight,\n ];\n if (droppedOpts.length > 0) {\n markLost(report, { code: 'item-options-dropped', dsId, message: `Not supported: ${droppedOpts.join(', ')}` });\n }\n return converted;\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAAkB;AAElB,uBAA2B;AAE3B,oBAAyB;AAazB,MAAM,4BAAsC,CAAC,4BAAW,0BAA0B,4BAAW,uBAAuB;AAEpH,MAAM,oBAAoB,CAAC,SAAqD;AAC9E,QAAM,EAAE,WAAW,IAAI,KAAK,YAAY,CAAC;AACzC,SAAO,eAAe,UAAa,0BAA0B,SAAS,KAAK,QAAQ,EAAE,IAAI,EAAE,WAAW,IAAI,CAAC;AAC7G;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AK,GAAG,MAAM,MAAS;AACpG,QAAM,cAAc;AAAA,IAClB,GAAG;AAAA,IACH,GAAG,aAAa,OAAO,CAAC,QAAQ,KAAK,GAAG,MAAM,MAAS;AAAA,IACvD,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACA,MAAI,YAAY,SAAS,GAAG;AAC1B,gCAAS,QAAQ,EAAE,MAAM,wBAAwB,MAAM,SAAS,kBAAkB,YAAY,KAAK,IAAI,CAAC,GAAG,CAAC;AAAA,EAC9G;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["React"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var getHumanReadableWarnings_exports = {};
|
|
30
|
+
__export(getHumanReadableWarnings_exports, {
|
|
31
|
+
getHumanReadableWarnings: () => getHumanReadableWarnings
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(getHumanReadableWarnings_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_lostCodes = require("./lostCodes.js");
|
|
36
|
+
const getHumanReadableWarnings = (report) => Object.keys(import_lostCodes.WARNING_PER_LOST_CODE).filter((code) => report.detectedLostsOnConversion[code]).map((code) => import_lostCodes.WARNING_PER_LOST_CODE[code]);
|
|
37
|
+
//# sourceMappingURL=getHumanReadableWarnings.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/getHumanReadableWarnings.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { WARNING_PER_LOST_CODE } from './lostCodes.js';\nimport type { DSLeftNavBridgeT } from './types.js';\n\n/**\n * given the report, it will return a human readable list of warnings\n * @param report - The report to get the warnings from.\n * @returns A list of human readable warnings.\n */\nexport const getHumanReadableWarnings = (report: DSLeftNavBridgeT.ReportMutableT): string[] =>\n (Object.keys(WARNING_PER_LOST_CODE) as DSLeftNavBridgeT.LostCodeT[])\n .filter((code) => report.detectedLostsOnConversion[code])\n .map((code) => WARNING_PER_LOST_CODE[code]);\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsC;AAQ/B,MAAM,2BAA2B,CAAC,WACtC,OAAO,KAAK,sCAAqB,EAC/B,OAAO,CAAC,SAAS,OAAO,0BAA0B,IAAI,CAAC,EACvD,IAAI,CAAC,SAAS,uCAAsB,IAAI,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|