@firecms/core 3.0.0-canary.96 → 3.0.0-canary.97
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/index.es.js +30 -16
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +31 -18
- package/dist/index.umd.js.map +1 -1
- package/dist/util/icon_list.d.ts +5 -1
- package/package.json +7 -7
- package/src/components/HomePage/DefaultHomePage.tsx +22 -13
- package/src/components/SearchIconsView.tsx +4 -1
- package/src/util/icon_list.ts +15 -9
package/dist/index.umd.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react"), require("notistack"), require("object-hash"), require("@firecms/formex"), require("@firecms/ui"), require("react-fast-compare"), require("react-router-dom"), require("date-fns"), require("date-fns/locale"), require("react-use-measure"), require("react-dropzone"), require("@hello-pangea/dnd"), require("react-image-file-resizer"), require("js
|
|
3
|
-
})(this, function(exports2, jsxRuntime, React, notistack, hash, formex, ui, equal, reactRouterDom, dateFns, locales, useMeasure, reactDropzone, dnd, Resizer,
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react/jsx-runtime"), require("react"), require("notistack"), require("object-hash"), require("@firecms/formex"), require("@firecms/ui"), require("react-fast-compare"), require("react-router-dom"), require("date-fns"), require("date-fns/locale"), require("react-use-measure"), require("react-dropzone"), require("@hello-pangea/dnd"), require("react-image-file-resizer"), require("fuse.js"), require("react-window"), require("yup"), require("markdown-it"), require("react-markdown-editor-lite"), require("@radix-ui/react-portal")) : typeof define === "function" && define.amd ? define(["exports", "react/jsx-runtime", "react", "notistack", "object-hash", "@firecms/formex", "@firecms/ui", "react-fast-compare", "react-router-dom", "date-fns", "date-fns/locale", "react-use-measure", "react-dropzone", "@hello-pangea/dnd", "react-image-file-resizer", "fuse.js", "react-window", "yup", "markdown-it", "react-markdown-editor-lite", "@radix-ui/react-portal"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global["FireCMS Core"] = {}, global.jsxRuntime, global.React, global.notistack, global.hash, global.formex, global.ui, global.equal, global.reactRouterDom, global.dateFns, global.locales, global.useMeasure, global.reactDropzone, global.dnd, global.Resizer, global.Fuse, global.reactWindow, global.yup, global.MarkdownIt, global.MdEditor, global.Portal));
|
|
3
|
+
})(this, function(exports2, jsxRuntime, React, notistack, hash, formex, ui, equal, reactRouterDom, dateFns, locales, useMeasure, reactDropzone, dnd, Resizer, Fuse, reactWindow, yup, MarkdownIt, MdEditor, Portal) {
|
|
4
4
|
"use strict";
|
|
5
5
|
function _interopNamespaceDefault(e) {
|
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
}
|
|
21
21
|
const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
|
|
22
22
|
const locales__namespace = /* @__PURE__ */ _interopNamespaceDefault(locales);
|
|
23
|
-
const JsSearch__namespace = /* @__PURE__ */ _interopNamespaceDefault(JsSearch);
|
|
24
23
|
const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
|
|
25
24
|
const Portal__namespace = /* @__PURE__ */ _interopNamespaceDefault(Portal);
|
|
26
25
|
const SnackbarProvider = ({ children }) => {
|
|
@@ -2656,15 +2655,20 @@
|
|
|
2656
2655
|
zoom_out: "find glass look magnifier magnifying minus negative scale search see size smaller",
|
|
2657
2656
|
zoom_out_map: "arrows destination location maps move place stop"
|
|
2658
2657
|
};
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2658
|
+
console.log("iconKeys", ui.iconKeys);
|
|
2659
|
+
const map = ui.iconKeys.map((importName) => {
|
|
2660
|
+
const iconSynonym = importName in iconSynonyms ? iconSynonyms[importName] : "";
|
|
2662
2661
|
return {
|
|
2663
2662
|
key: importName,
|
|
2664
|
-
|
|
2665
|
-
synonyms: iconSynonyms[importName] ?? []
|
|
2663
|
+
synonyms: iconSynonym
|
|
2666
2664
|
};
|
|
2667
|
-
})
|
|
2665
|
+
});
|
|
2666
|
+
const iconsSearch = new Fuse(map, {
|
|
2667
|
+
isCaseSensitive: false,
|
|
2668
|
+
shouldSort: true,
|
|
2669
|
+
distance: 0,
|
|
2670
|
+
keys: ["key", "synonyms"]
|
|
2671
|
+
});
|
|
2668
2672
|
function hashString(str) {
|
|
2669
2673
|
let hash2 = 0;
|
|
2670
2674
|
let i;
|
|
@@ -11421,11 +11425,6 @@
|
|
|
11421
11425
|
direction
|
|
11422
11426
|
};
|
|
11423
11427
|
}
|
|
11424
|
-
const search = new JsSearch__namespace.Search("url");
|
|
11425
|
-
search.addIndex("name");
|
|
11426
|
-
search.addIndex("description");
|
|
11427
|
-
search.addIndex("group");
|
|
11428
|
-
search.addIndex("path");
|
|
11429
11428
|
function DefaultHomePage({
|
|
11430
11429
|
additionalActions,
|
|
11431
11430
|
additionalChildrenStart,
|
|
@@ -11434,6 +11433,7 @@
|
|
|
11434
11433
|
const context = useFireCMSContext();
|
|
11435
11434
|
const customizationController = useCustomizationController();
|
|
11436
11435
|
const navigationController = useNavigationController();
|
|
11436
|
+
const fuse = React.useRef(null);
|
|
11437
11437
|
if (!navigationController.topLevelNavigation)
|
|
11438
11438
|
throw Error("Navigation not ready in FireCMSHomePage");
|
|
11439
11439
|
const {
|
|
@@ -11448,15 +11448,25 @@
|
|
|
11448
11448
|
const [filteredUrls, setFilteredUrls] = React.useState(null);
|
|
11449
11449
|
const filteredNavigationEntries = filteredUrls ? navigationEntries.filter((entry) => filteredUrls.includes(entry.url)) : navigationEntries;
|
|
11450
11450
|
React.useEffect(() => {
|
|
11451
|
-
|
|
11451
|
+
fuse.current = new Fuse(navigationEntries, {
|
|
11452
|
+
keys: [
|
|
11453
|
+
"name",
|
|
11454
|
+
"description",
|
|
11455
|
+
"group",
|
|
11456
|
+
"path"
|
|
11457
|
+
]
|
|
11458
|
+
});
|
|
11452
11459
|
}, [navigationEntries]);
|
|
11453
11460
|
const updateSearchResults = React.useCallback(
|
|
11454
11461
|
(value) => {
|
|
11455
11462
|
if (!value || value === "") {
|
|
11456
11463
|
setFilteredUrls(null);
|
|
11457
11464
|
} else {
|
|
11458
|
-
const searchResult =
|
|
11459
|
-
|
|
11465
|
+
const searchResult = fuse.current?.search(value);
|
|
11466
|
+
console.log("Search result", searchResult);
|
|
11467
|
+
if (searchResult) {
|
|
11468
|
+
setFilteredUrls(searchResult.map((e) => e.item.url));
|
|
11469
|
+
}
|
|
11460
11470
|
}
|
|
11461
11471
|
},
|
|
11462
11472
|
[]
|
|
@@ -13591,7 +13601,9 @@
|
|
|
13591
13601
|
setKeys(null);
|
|
13592
13602
|
} else {
|
|
13593
13603
|
const searchResult = iconsSearch.search(value);
|
|
13594
|
-
|
|
13604
|
+
const limit = 50;
|
|
13605
|
+
const limited = searchResult.slice(0, limit);
|
|
13606
|
+
setKeys(limited.map((e) => e.item.key));
|
|
13595
13607
|
}
|
|
13596
13608
|
}, UPDATE_SEARCH_INDEX_WAIT_MS),
|
|
13597
13609
|
[]
|
|
@@ -13603,6 +13615,7 @@
|
|
|
13603
13615
|
};
|
|
13604
13616
|
}, [query, updateSearchResults]);
|
|
13605
13617
|
const icons = keys === null ? ui.coolIconKeys : keys;
|
|
13618
|
+
console.log("Icons", icons);
|
|
13606
13619
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
13607
13620
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
13608
13621
|
ui.SearchBar,
|