@elliemae/ds-left-navigation 3.80.0-next.6 → 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/TruncatedTooltipText.js +25 -4
- package/dist/cjs/TruncatedTooltipText.js.map +2 -2
- package/dist/cjs/constants/index.js +4 -0
- package/dist/cjs/constants/index.js.map +2 -2
- package/dist/cjs/exported-related/Icon/index.js +24 -3
- package/dist/cjs/exported-related/Icon/index.js.map +3 -3
- package/dist/cjs/exported-related/OpenWindowItem/index.js +23 -2
- package/dist/cjs/exported-related/OpenWindowItem/index.js.map +3 -3
- 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/cjs/outOfTheBox/ItemHeader/index.js +1 -1
- package/dist/cjs/outOfTheBox/ItemHeader/index.js.map +2 -2
- package/dist/cjs/outOfTheBox/ItemLink/index.js +1 -1
- package/dist/cjs/outOfTheBox/ItemLink/index.js.map +2 -2
- package/dist/cjs/outOfTheBox/ItemSubmenu/index.js +1 -1
- package/dist/cjs/outOfTheBox/ItemSubmenu/index.js.map +2 -2
- package/dist/cjs/outOfTheBox/ItemTextLabel/index.js +1 -1
- package/dist/cjs/outOfTheBox/ItemTextLabel/index.js.map +2 -2
- package/dist/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js +1 -1
- package/dist/cjs/outOfTheBox/ItemUncontrolledDrilldown/index.js.map +2 -2
- package/dist/cjs/outOfTheBox/ItemWithDate/index.js +1 -1
- package/dist/cjs/outOfTheBox/ItemWithDate/index.js.map +2 -2
- package/dist/cjs/parts/LeftNavFooterItem/index.js +2 -3
- package/dist/cjs/parts/LeftNavFooterItem/index.js.map +2 -2
- package/dist/cjs/react-desc-prop-types.js +58 -1
- package/dist/cjs/react-desc-prop-types.js.map +2 -2
- package/dist/cjs/typescript-testing/slot-props.js +8 -0
- package/dist/cjs/typescript-testing/slot-props.js.map +2 -2
- package/dist/esm/TruncatedTooltipText.js +26 -5
- package/dist/esm/TruncatedTooltipText.js.map +2 -2
- package/dist/esm/constants/index.js +4 -0
- package/dist/esm/constants/index.js.map +2 -2
- package/dist/esm/exported-related/Icon/index.js +24 -3
- package/dist/esm/exported-related/Icon/index.js.map +3 -3
- package/dist/esm/exported-related/OpenWindowItem/index.js +23 -2
- package/dist/esm/exported-related/OpenWindowItem/index.js.map +3 -3
- 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/esm/outOfTheBox/ItemHeader/index.js +1 -1
- package/dist/esm/outOfTheBox/ItemHeader/index.js.map +2 -2
- package/dist/esm/outOfTheBox/ItemLink/index.js +1 -1
- package/dist/esm/outOfTheBox/ItemLink/index.js.map +2 -2
- package/dist/esm/outOfTheBox/ItemSubmenu/index.js +1 -1
- package/dist/esm/outOfTheBox/ItemSubmenu/index.js.map +2 -2
- package/dist/esm/outOfTheBox/ItemTextLabel/index.js +1 -1
- package/dist/esm/outOfTheBox/ItemTextLabel/index.js.map +2 -2
- package/dist/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js +1 -1
- package/dist/esm/outOfTheBox/ItemUncontrolledDrilldown/index.js.map +2 -2
- package/dist/esm/outOfTheBox/ItemWithDate/index.js +1 -1
- package/dist/esm/outOfTheBox/ItemWithDate/index.js.map +2 -2
- package/dist/esm/parts/LeftNavFooterItem/index.js +2 -3
- package/dist/esm/parts/LeftNavFooterItem/index.js.map +2 -2
- package/dist/esm/react-desc-prop-types.js +58 -1
- package/dist/esm/react-desc-prop-types.js.map +2 -2
- package/dist/esm/typescript-testing/slot-props.js +8 -0
- package/dist/esm/typescript-testing/slot-props.js.map +2 -2
- package/dist/types/constants/index.d.ts +12 -0
- package/dist/types/exported-related/Icon/index.d.ts +4 -0
- 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/dist/types/react-desc-prop-types.d.ts +4 -0
- package/package.json +16 -13
|
@@ -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;AAKA,MAAM,aAAa,oBAAI,IAAI;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAA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AY,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
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 conversion_utils_exports = {};
|
|
30
|
+
__export(conversion_utils_exports, {
|
|
31
|
+
checkAndConvertItems: () => checkAndConvertItems
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(conversion_utils_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_conversionConstants = require("./conversionConstants.js");
|
|
36
|
+
var import_conversionHelpers = require("./conversionHelpers.js");
|
|
37
|
+
var import_validateIds = require("./validateIds.js");
|
|
38
|
+
var import_getHumanReadableWarnings = require("./getHumanReadableWarnings.js");
|
|
39
|
+
var import_report = require("./report.js");
|
|
40
|
+
const reportIgnoredHeaderContent = (dsId, childrenByParentId, report) => {
|
|
41
|
+
if (!dsId || !(0, import_conversionConstants.getOwn)(childrenByParentId, dsId)) return;
|
|
42
|
+
(0, import_report.markLost)(report, {
|
|
43
|
+
code: "header-content-dropped",
|
|
44
|
+
dsId,
|
|
45
|
+
message: "The header is the first leaf, so its list in childrenByParentId was ignored"
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
const convertHeaderPart = (args) => {
|
|
49
|
+
const { HeaderComponent, headerAsFirstLeaf, convertedItems, report, childrenByParentId } = args;
|
|
50
|
+
const result = {};
|
|
51
|
+
const header = HeaderComponent ? (0, import_conversionHelpers.convertHeader)(HeaderComponent, report) : null;
|
|
52
|
+
if (!HeaderComponent || !header) return result;
|
|
53
|
+
if (headerAsFirstLeaf) {
|
|
54
|
+
convertedItems.unshift(header);
|
|
55
|
+
reportIgnoredHeaderContent(HeaderComponent.dsId, childrenByParentId, report);
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
const headerContent = HeaderComponent.dsId ? (0, import_conversionConstants.getOwn)(childrenByParentId, HeaderComponent.dsId) : void 0;
|
|
59
|
+
if (!headerContent) {
|
|
60
|
+
(0, import_report.markLost)(report, {
|
|
61
|
+
code: "header-without-content",
|
|
62
|
+
dsId: HeaderComponent.dsId ?? "",
|
|
63
|
+
message: "No entry in childrenByParentId for the header, it is a disclosure with nothing to open"
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
convertedHeader: header,
|
|
68
|
+
convertedHeaderItems: headerContent ? (0, import_conversionHelpers.convertList)({ list: headerContent, isRoot: true, report, childrenByParentId }) : []
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
const checkAndConvertItems = (items, options = {}) => {
|
|
72
|
+
const { childrenByParentId = {}, HeaderComponent, BodyHeaderComponent, headerAsFirstLeaf = false } = options;
|
|
73
|
+
const report = (0, import_report.createEmptyReport)();
|
|
74
|
+
const convertedItems = (0, import_conversionHelpers.convertList)({ list: items, isRoot: true, report, childrenByParentId });
|
|
75
|
+
const { convertedHeader, convertedHeaderItems } = convertHeaderPart({
|
|
76
|
+
HeaderComponent,
|
|
77
|
+
headerAsFirstLeaf,
|
|
78
|
+
convertedItems,
|
|
79
|
+
report,
|
|
80
|
+
childrenByParentId
|
|
81
|
+
});
|
|
82
|
+
(0, import_validateIds.reportIdProblems)(convertedItems, report, convertedHeader ? [convertedHeader.dsId] : []);
|
|
83
|
+
if (convertedHeaderItems)
|
|
84
|
+
(0, import_validateIds.reportIdProblems)(convertedHeaderItems, report, convertedHeader?.dsId ? [convertedHeader.dsId] : []);
|
|
85
|
+
if (BodyHeaderComponent) {
|
|
86
|
+
(0, import_report.markLost)(report, {
|
|
87
|
+
code: "body-header-dropped",
|
|
88
|
+
dsId: BodyHeaderComponent.dsId ?? "",
|
|
89
|
+
message: "BodyHeaderComponent is not supported, the submenu is the parent of its children"
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
report.humanReadableWarnings = (0, import_getHumanReadableWarnings.getHumanReadableWarnings)(report);
|
|
93
|
+
return { convertedItems, convertedHeader, convertedHeaderItems, report };
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/index.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { getOwn } from './conversionConstants.js';\nimport { convertHeader, convertList } from './conversionHelpers.js';\nimport { reportIdProblems } from './validateIds.js';\nimport { getHumanReadableWarnings } from './getHumanReadableWarnings.js';\nimport { createEmptyReport, markLost } from './report.js';\nimport type { DSLeftNavBridgeT } from './types.js';\nimport type { DSLeftNavigationT } from '../../react-desc-prop-types.js';\n\ntype ConvertHeaderPartArgsT = {\n HeaderComponent?: DSLeftNavBridgeT.OptionsT['HeaderComponent'];\n headerAsFirstLeaf: boolean;\n convertedItems: DSLeftNavBridgeT.ResultT['convertedItems'];\n report: DSLeftNavBridgeT.ReportMutableT;\n childrenByParentId: DSLeftNavBridgeT.ChildrenByParentIdT;\n};\n\nconst reportIgnoredHeaderContent = (\n dsId: string | undefined,\n childrenByParentId: DSLeftNavBridgeT.ChildrenByParentIdT,\n report: DSLeftNavBridgeT.ReportMutableT,\n) => {\n if (!dsId || !getOwn(childrenByParentId, dsId)) return;\n markLost(report, {\n code: 'header-content-dropped',\n dsId,\n message: 'The header is the first leaf, so its list in childrenByParentId was ignored',\n });\n};\n\nconst convertHeaderPart = (args: ConvertHeaderPartArgsT) => {\n const { HeaderComponent, headerAsFirstLeaf, convertedItems, report, childrenByParentId } = args;\n const result: Pick<DSLeftNavBridgeT.ResultT, 'convertedHeader' | 'convertedHeaderItems'> = {};\n const header = HeaderComponent ? convertHeader(HeaderComponent, report) : null;\n if (!HeaderComponent || !header) return result;\n if (headerAsFirstLeaf) {\n convertedItems.unshift(header);\n reportIgnoredHeaderContent(HeaderComponent.dsId, childrenByParentId, report);\n return result;\n }\n const headerContent = HeaderComponent.dsId ? getOwn(childrenByParentId, HeaderComponent.dsId) : undefined;\n if (!headerContent) {\n markLost(report, {\n code: 'header-without-content',\n dsId: HeaderComponent.dsId ?? '',\n message: 'No entry in childrenByParentId for the header, it is a disclosure with nothing to open',\n });\n }\n return {\n convertedHeader: header,\n convertedHeaderItems: headerContent\n ? convertList({ list: headerContent, isRoot: true, report, childrenByParentId })\n : [],\n };\n};\n\n/**\n * Converts LeftNavigation items to DSLeftNavigationTree items and reports what the tree cannot carry over.\n * It is a migration aid, not a drop-in replacement: read `report.humanReadableWarnings` and `report.lostEntries`.\n * @param items - The LeftNavigation items (the flat list shown by the body).\n * @param options - Children of the submenus (`childrenByParentId`), and the `HeaderComponent` and `BodyHeaderComponent` props.\n * @returns The converted items and the report. `HeaderComponent` becomes `convertedHeader`, a disclosure, and\n * `convertedHeaderItems` is its content (the list under the header `dsId` in `childrenByParentId`) to pass as `items`\n * while it is open. A header that is only a link goes to the front of `convertedItems` with `headerAsFirstLeaf`.\n */\nexport const checkAndConvertItems = (\n items: readonly DSLeftNavigationT.GenericItemItemProps[],\n options: DSLeftNavBridgeT.OptionsT = {},\n): DSLeftNavBridgeT.ResultT => {\n const { childrenByParentId = {}, HeaderComponent, BodyHeaderComponent, headerAsFirstLeaf = false } = options;\n const report = createEmptyReport();\n const convertedItems = convertList({ list: items, isRoot: true, report, childrenByParentId });\n const { convertedHeader, convertedHeaderItems } = convertHeaderPart({\n HeaderComponent,\n headerAsFirstLeaf,\n convertedItems,\n report,\n childrenByParentId,\n });\n /** The header and each list the consumer passes as `items` are one hierarchy for the tree, so each is validated with the header. */\n reportIdProblems(convertedItems, report, convertedHeader ? [convertedHeader.dsId] : []);\n if (convertedHeaderItems)\n reportIdProblems(convertedHeaderItems, report, convertedHeader?.dsId ? [convertedHeader.dsId] : []);\n if (BodyHeaderComponent) {\n markLost(report, {\n code: 'body-header-dropped',\n dsId: BodyHeaderComponent.dsId ?? '',\n message: 'BodyHeaderComponent is not supported, the submenu is the parent of its children',\n });\n }\n report.humanReadableWarnings = getHumanReadableWarnings(report);\n return { convertedItems, convertedHeader, convertedHeaderItems, report };\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,iCAAuB;AACvB,+BAA2C;AAC3C,yBAAiC;AACjC,sCAAyC;AACzC,oBAA4C;AAY5C,MAAM,6BAA6B,CACjC,MACA,oBACA,WACG;AACH,MAAI,CAAC,QAAQ,KAAC,mCAAO,oBAAoB,IAAI,EAAG;AAChD,8B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AiB,sBAAsB,QAAQ,iBAAiB,OAAO,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC;AACpG,MAAI,qBAAqB;AACvB,gCAAS,QAAQ;AAAA,MACf,MAAM;AAAA,MACN,MAAM,oBAAoB,QAAQ;AAAA,MAClC,SAAS;AAAA,IACX,CAAC;AAAA,EACH;AACA,SAAO,4BAAwB,0DAAyB,MAAM;AAC9D,SAAO,EAAE,gBAAgB,iBAAiB,sBAAsB,OAAO;AACzE;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
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 lostCodes_exports = {};
|
|
30
|
+
__export(lostCodes_exports, {
|
|
31
|
+
WARNING_PER_LOST_CODE: () => WARNING_PER_LOST_CODE
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(lostCodes_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
const WARNING_PER_LOST_CODE = {
|
|
36
|
+
"submenu-without-children": `- Encountered submenu items without an entry in "childrenByParentId" - the tree needs the children in the data, the conversion created an empty parent`,
|
|
37
|
+
"custom-component-dropped": `- Encountered items with a custom "Component" - a treeitem cannot hold arbitrary interactive content (WCAG 4.1.2), the conversion dropped them`,
|
|
38
|
+
"skeleton-dropped": `- Encountered skeleton items - loading states are not part of the tree, the conversion dropped them`,
|
|
39
|
+
"header-item-dropped": `- Encountered an item of type header inside "items" - the tree has one header disclosure, passed as "HeaderComponent", the conversion dropped it from the list`,
|
|
40
|
+
"header-content-dropped": `- Encountered "headerAsFirstLeaf" together with a list for the header in "childrenByParentId" - a header that is the first item of the list has nothing to open, the conversion ignored that list. Drop "headerAsFirstLeaf" to keep the header as a disclosure with its content`,
|
|
41
|
+
"header-without-content": `- Encountered a "HeaderComponent" without an entry in "childrenByParentId" - the tree header is a disclosure with nothing to open. If the header is only a link, pass "headerAsFirstLeaf" to make it the first item of the list`,
|
|
42
|
+
"right-component-ctx": `- Encountered "RightComponent" on a leaf, drilldown or header, or a "labelRightSection" that is not text - the conversion kept it, but the tree only gives it "{ item }" and an empty "ctx", so it must not read "ctx". The "item" it receives is the converted tree item (another type, with only the options the tree keeps), so it must not read legacy fields either. The conversion does not inspect what it draws: remove buttons, menus or any other control inside it before rendering the converted data, a treeitem cannot hold them`,
|
|
43
|
+
"body-header-dropped": `- Encountered "BodyHeaderComponent" - the tree shows the opened submenu as the parent of its children, the conversion ignored it`,
|
|
44
|
+
"component-with-ctx-dropped": `- Encountered "LeftComponent" or "BottomComponent", or a "RightComponent" on a submenu or section - the tree has no place for them (parents draw their own arrow), the conversion dropped them`,
|
|
45
|
+
"collapsed-component-ctx": `- Encountered "CollapsedComponent" - the conversion kept it as is, but the tree only gives it "{ item }" with the converted tree item (another type, with only the options the tree keeps), so it must not read "ctx" or legacy fields of the item`,
|
|
46
|
+
"label-style-dropped": `- Encountered "labelBold" or "labelColor" - state conveyed only by weight or color fails WCAG 1.3.1 and 1.4.1, the conversion dropped them`,
|
|
47
|
+
"label-truncate-to-wrap": `- Encountered "labelOverflow: truncate" - truncated labels need a hover tooltip (1.4.13) and hide text from users who zoom (1.4.10), the conversion uses "wrap"`,
|
|
48
|
+
"aria-overrides-dropped": `- Encountered "ariaLabel", "ariaRole", "ariaLive", "ariaExpanded" or "ariaDescribedBy" - the tree computes its own names and states, the conversion dropped them`,
|
|
49
|
+
"item-options-dropped": `- Encountered item options the tree does not have (selectable on a drilldown, focuseable, openable, closable, indent, skeletonVariant, labelDataTestId, any other key of itemOpts, or a non-text labelRightSection where it cannot be shown) - the conversion dropped them, see lostEntries for the list per item`,
|
|
50
|
+
"section-in-nested-list-dropped": `- Encountered a section or separator inside a submenu or drilldown - the tree supports them only at the root level, the conversion dropped them`,
|
|
51
|
+
"missing-id": `- Encountered items without a "dsId" - the tree finds every item by its "dsId", so each one needs its own; set it before using the converted items`,
|
|
52
|
+
"duplicate-id": `- Encountered the same "dsId" on more than one item of the converted hierarchy - the tree finds items by "dsId" across all levels, so a repeated one overwrites the other's label and parent; give each item a unique "dsId" (LeftNavigation only needed it unique inside the list that is shown)`,
|
|
53
|
+
"unknown-type-dropped": `- Encountered items with a type that is not out of the box, or a "HeaderComponent" that is not a header, link, text-label or with-date - the conversion dropped them`
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=lostCodes.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/lostCodes.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["/**\n * Single source of truth for the codes of what the conversion cannot carry over: the type, the empty report and the warnings derive from it.\n */\nexport const WARNING_PER_LOST_CODE = {\n 'submenu-without-children': `- Encountered submenu items without an entry in \"childrenByParentId\" - the tree needs the children in the data, the conversion created an empty parent`,\n 'custom-component-dropped': `- Encountered items with a custom \"Component\" - a treeitem cannot hold arbitrary interactive content (WCAG 4.1.2), the conversion dropped them`,\n 'skeleton-dropped': `- Encountered skeleton items - loading states are not part of the tree, the conversion dropped them`,\n 'header-item-dropped': `- Encountered an item of type header inside \"items\" - the tree has one header disclosure, passed as \"HeaderComponent\", the conversion dropped it from the list`,\n 'header-content-dropped': `- Encountered \"headerAsFirstLeaf\" together with a list for the header in \"childrenByParentId\" - a header that is the first item of the list has nothing to open, the conversion ignored that list. Drop \"headerAsFirstLeaf\" to keep the header as a disclosure with its content`,\n 'header-without-content': `- Encountered a \"HeaderComponent\" without an entry in \"childrenByParentId\" - the tree header is a disclosure with nothing to open. If the header is only a link, pass \"headerAsFirstLeaf\" to make it the first item of the list`,\n 'right-component-ctx': `- Encountered \"RightComponent\" on a leaf, drilldown or header, or a \"labelRightSection\" that is not text - the conversion kept it, but the tree only gives it \"{ item }\" and an empty \"ctx\", so it must not read \"ctx\". The \"item\" it receives is the converted tree item (another type, with only the options the tree keeps), so it must not read legacy fields either. The conversion does not inspect what it draws: remove buttons, menus or any other control inside it before rendering the converted data, a treeitem cannot hold them`,\n 'body-header-dropped': `- Encountered \"BodyHeaderComponent\" - the tree shows the opened submenu as the parent of its children, the conversion ignored it`,\n 'component-with-ctx-dropped': `- Encountered \"LeftComponent\" or \"BottomComponent\", or a \"RightComponent\" on a submenu or section - the tree has no place for them (parents draw their own arrow), the conversion dropped them`,\n 'collapsed-component-ctx': `- Encountered \"CollapsedComponent\" - the conversion kept it as is, but the tree only gives it \"{ item }\" with the converted tree item (another type, with only the options the tree keeps), so it must not read \"ctx\" or legacy fields of the item`,\n 'label-style-dropped': `- Encountered \"labelBold\" or \"labelColor\" - state conveyed only by weight or color fails WCAG 1.3.1 and 1.4.1, the conversion dropped them`,\n 'label-truncate-to-wrap': `- Encountered \"labelOverflow: truncate\" - truncated labels need a hover tooltip (1.4.13) and hide text from users who zoom (1.4.10), the conversion uses \"wrap\"`,\n 'aria-overrides-dropped': `- Encountered \"ariaLabel\", \"ariaRole\", \"ariaLive\", \"ariaExpanded\" or \"ariaDescribedBy\" - the tree computes its own names and states, the conversion dropped them`,\n 'item-options-dropped': `- Encountered item options the tree does not have (selectable on a drilldown, focuseable, openable, closable, indent, skeletonVariant, labelDataTestId, any other key of itemOpts, or a non-text labelRightSection where it cannot be shown) - the conversion dropped them, see lostEntries for the list per item`,\n 'section-in-nested-list-dropped': `- Encountered a section or separator inside a submenu or drilldown - the tree supports them only at the root level, the conversion dropped them`,\n 'missing-id': `- Encountered items without a \"dsId\" - the tree finds every item by its \"dsId\", so each one needs its own; set it before using the converted items`,\n 'duplicate-id': `- Encountered the same \"dsId\" on more than one item of the converted hierarchy - the tree finds items by \"dsId\" across all levels, so a repeated one overwrites the other's label and parent; give each item a unique \"dsId\" (LeftNavigation only needed it unique inside the list that is shown)`,\n 'unknown-type-dropped': `- Encountered items with a type that is not out of the box, or a \"HeaderComponent\" that is not a header, link, text-label or with-date - the conversion dropped them`,\n} as const;\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADGhB,MAAM,wBAAwB;AAAA,EACnC,4BAA4B;AAAA,EAC5B,4BAA4B;AAAA,EAC5B,oBAAoB;AAAA,EACpB,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,uBAAuB;AAAA,EACvB,uBAAuB;AAAA,EACvB,8BAA8B;AAAA,EAC9B,2BAA2B;AAAA,EAC3B,uBAAuB;AAAA,EACvB,0BAA0B;AAAA,EAC1B,0BAA0B;AAAA,EAC1B,wBAAwB;AAAA,EACxB,kCAAkC;AAAA,EAClC,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,wBAAwB;AAC1B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
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 report_exports = {};
|
|
30
|
+
__export(report_exports, {
|
|
31
|
+
createEmptyReport: () => createEmptyReport,
|
|
32
|
+
markLost: () => markLost
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(report_exports);
|
|
35
|
+
var React = __toESM(require("react"));
|
|
36
|
+
var import_lostCodes = require("./lostCodes.js");
|
|
37
|
+
const createEmptyReport = () => ({
|
|
38
|
+
detectedLostsOnConversion: Object.fromEntries(
|
|
39
|
+
Object.keys(import_lostCodes.WARNING_PER_LOST_CODE).map((code) => [code, false])
|
|
40
|
+
),
|
|
41
|
+
lostEntries: [],
|
|
42
|
+
humanReadableWarnings: []
|
|
43
|
+
});
|
|
44
|
+
const markLost = (report, entry) => {
|
|
45
|
+
report.detectedLostsOnConversion[entry.code] = true;
|
|
46
|
+
report.lostEntries.push(entry);
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=report.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/report.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import { WARNING_PER_LOST_CODE } from './lostCodes.js';\nimport type { DSLeftNavBridgeT } from './types.js';\n\nexport const createEmptyReport = (): DSLeftNavBridgeT.ReportMutableT => ({\n detectedLostsOnConversion: Object.fromEntries(\n Object.keys(WARNING_PER_LOST_CODE).map((code) => [code, false]),\n ) as DSLeftNavBridgeT.ReportMutableT['detectedLostsOnConversion'],\n lostEntries: [],\n humanReadableWarnings: [],\n});\n\nexport const markLost = (report: DSLeftNavBridgeT.ReportMutableT, entry: DSLeftNavBridgeT.LostEntryT) => {\n // eslint-disable-next-line no-param-reassign\n report.detectedLostsOnConversion[entry.code] = true;\n report.lostEntries.push(entry);\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,uBAAsC;AAG/B,MAAM,oBAAoB,OAAwC;AAAA,EACvE,2BAA2B,OAAO;AAAA,IAChC,OAAO,KAAK,sCAAqB,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,CAAC;AAAA,EAChE;AAAA,EACA,aAAa,CAAC;AAAA,EACd,uBAAuB,CAAC;AAC1B;AAEO,MAAM,WAAW,CAAC,QAAyC,UAAuC;AAEvG,SAAO,0BAA0B,MAAM,IAAI,IAAI;AAC/C,SAAO,YAAY,KAAK,KAAK;AAC/B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
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 __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (let key of __getOwnPropNames(from))
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
+
}
|
|
14
|
+
return to;
|
|
15
|
+
};
|
|
16
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var types_exports = {};
|
|
26
|
+
module.exports = __toCommonJS(types_exports);
|
|
27
|
+
var React = __toESM(require("react"));
|
|
28
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/types.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { DSLeftNavigationTreeT } from '@elliemae/ds-left-navigation-tree';\nimport type { WARNING_PER_LOST_CODE } from './lostCodes.js';\nimport type { DSLeftNavigationT } from '../../react-desc-prop-types.js';\n\nexport declare namespace DSLeftNavBridgeT {\n /**\n * Each code is something LeftNavigation could do that the tree cannot carry over.\n */\n export type LostCodeT = keyof typeof WARNING_PER_LOST_CODE;\n\n export type LostEntryT = {\n code: LostCodeT;\n dsId: string;\n message: string;\n };\n\n export type ReportMutableT = {\n detectedLostsOnConversion: Record<LostCodeT, boolean>;\n lostEntries: LostEntryT[];\n humanReadableWarnings: string[];\n };\n\n /**\n * LeftNavigation keeps the hierarchy outside of the data: a submenu has no children in its item, the consumer swaps `items` when the submenu is opened.\n * This map gives the bridge the lists the consumer swaps in, keyed by the submenu dsId.\n */\n export type ChildrenByParentIdT = Record<string, readonly DSLeftNavigationT.GenericItemItemProps[]>;\n\n export type OptionsT = {\n childrenByParentId?: ChildrenByParentIdT;\n HeaderComponent?: DSLeftNavigationT.GenericItemItemProps;\n BodyHeaderComponent?: DSLeftNavigationT.GenericItemItemProps;\n /** The header is only a link, with nothing to open: it becomes the first item of the list instead of a disclosure. */\n headerAsFirstLeaf?: boolean;\n };\n\n export type ResultT = {\n convertedItems: DSLeftNavigationTreeT.Item[];\n convertedHeader?: DSLeftNavigationTreeT.Item;\n convertedHeaderItems?: DSLeftNavigationTreeT.Item[];\n report: ReportMutableT;\n };\n}\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;ACAA,YAAuB;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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 validateIds_exports = {};
|
|
30
|
+
__export(validateIds_exports, {
|
|
31
|
+
reportIdProblems: () => reportIdProblems
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(validateIds_exports);
|
|
34
|
+
var React = __toESM(require("react"));
|
|
35
|
+
var import_report = require("./report.js");
|
|
36
|
+
const collectIds = (items, ids = []) => {
|
|
37
|
+
items.forEach((item) => {
|
|
38
|
+
ids.push(item.dsId);
|
|
39
|
+
collectIds(item.itemOpts?.items ?? [], ids);
|
|
40
|
+
});
|
|
41
|
+
return ids;
|
|
42
|
+
};
|
|
43
|
+
const reportIdProblems = (items, report, extraIds = []) => {
|
|
44
|
+
const seen = /* @__PURE__ */ new Set();
|
|
45
|
+
const reported = /* @__PURE__ */ new Set();
|
|
46
|
+
[...extraIds, ...collectIds(items)].forEach((dsId) => {
|
|
47
|
+
if (!dsId) {
|
|
48
|
+
(0, import_report.markLost)(report, { code: "missing-id", dsId: "", message: "An item has no dsId" });
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (seen.has(dsId) && !reported.has(dsId)) {
|
|
52
|
+
reported.add(dsId);
|
|
53
|
+
(0, import_report.markLost)(report, { code: "duplicate-id", dsId, message: "The dsId is used by more than one item" });
|
|
54
|
+
}
|
|
55
|
+
seen.add(dsId);
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=validateIds.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/exported-related/conversion-utils/validateIds.ts", "../../../../../../../scripts/build/transpile/react-shim.js"],
|
|
4
|
+
"sourcesContent": ["import type { DSLeftNavigationTreeT } from '@elliemae/ds-left-navigation-tree';\nimport { markLost } from './report.js';\nimport type { DSLeftNavBridgeT } from './types.js';\n\ntype NewItemT = DSLeftNavigationTreeT.Item;\n\nconst collectIds = (items: readonly NewItemT[], ids: string[] = []): string[] => {\n items.forEach((item) => {\n ids.push(item.dsId);\n collectIds(item.itemOpts?.items ?? [], ids);\n });\n return ids;\n};\n\n/**\n * The tree finds items by `dsId` across every level of the list it receives, LeftNavigation only needed them unique inside each list it showed.\n * Reports the items without one and the ids that repeat, once per repeated id.\n */\nexport const reportIdProblems = (\n items: readonly NewItemT[],\n report: DSLeftNavBridgeT.ReportMutableT,\n extraIds: readonly string[] = [],\n) => {\n const seen = new Set<string>();\n const reported = new Set<string>();\n [...extraIds, ...collectIds(items)].forEach((dsId) => {\n if (!dsId) {\n markLost(report, { code: 'missing-id', dsId: '', message: 'An item has no dsId' });\n return;\n }\n if (seen.has(dsId) && !reported.has(dsId)) {\n reported.add(dsId);\n markLost(report, { code: 'duplicate-id', dsId, message: 'The dsId is used by more than one item' });\n }\n seen.add(dsId);\n });\n};\n", "import * as React from 'react';\nexport { React };\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,oBAAyB;AAKzB,MAAM,aAAa,CAAC,OAA4B,MAAgB,CAAC,MAAgB;AAC/E,QAAM,QAAQ,CAAC,SAAS;AACtB,QAAI,KAAK,KAAK,IAAI;AAClB,eAAW,KAAK,UAAU,SAAS,CAAC,GAAG,GAAG;AAAA,EAC5C,CAAC;AACD,SAAO;AACT;AAMO,MAAM,mBAAmB,CAC9B,OACA,QACA,WAA8B,CAAC,MAC5B;AACH,QAAM,OAAO,oBAAI,IAAY;AAC7B,QAAM,WAAW,oBAAI,IAAY;AACjC,GAAC,GAAG,UAAU,GAAG,WAAW,KAAK,CAAC,EAAE,QAAQ,CAAC,SAAS;AACpD,QAAI,CAAC,MAAM;AACT,kCAAS,QAAQ,EAAE,MAAM,cAAc,MAAM,IAAI,SAAS,sBAAsB,CAAC;AACjF;AAAA,IACF;AACA,QAAI,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,GAAG;AACzC,eAAS,IAAI,IAAI;AACjB,kCAAS,QAAQ,EAAE,MAAM,gBAAgB,MAAM,SAAS,yCAAyC,CAAC;AAAA,IACpG;AACA,SAAK,IAAI,IAAI;AAAA,EACf,CAAC;AACH;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|