@arcgis/coding-components 4.29.0-beta.47 → 4.29.0-beta.49
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/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
- package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +13 -13
- package/dist/arcgis-coding-components/index.esm.js +1 -1
- package/dist/arcgis-coding-components/{p-10a322ec.js → p-0d616249.js} +9 -9
- package/dist/arcgis-coding-components/p-2c0d6f15.js +2 -0
- package/dist/arcgis-coding-components/{p-71faf9a4.js → p-5802524a.js} +1 -1
- package/dist/arcgis-coding-components/{p-9eabda86.js → p-5ddccf04.js} +1 -1
- package/dist/arcgis-coding-components/p-7475f3a6.js +1 -0
- package/dist/arcgis-coding-components/{p-e6ede32d.js → p-7d8caba9.js} +1 -1
- package/dist/arcgis-coding-components/{p-f7d7d78d.js → p-9f6db08a.js} +1 -1
- package/dist/arcgis-coding-components/{p-e475e6cd.js → p-aefe77ce.js} +1 -1
- package/dist/arcgis-coding-components/p-ce2be55e.entry.js +1 -0
- package/dist/arcgis-coding-components/{p-ce586a8c.js → p-d425a387.js} +1 -1
- package/dist/arcgis-coding-components/{p-c084ada8.js → p-ff21f230.js} +1 -1
- package/dist/cjs/{arcade-defaults-8445d852.js → arcade-defaults-2d513b59.js} +1534 -1534
- package/dist/cjs/arcade-mode-6219f1b8.js +599 -0
- package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1404 -1408
- package/dist/cjs/arcgis-coding-components.cjs.js +2 -2
- package/dist/cjs/{cssMode-e63287bb.js → cssMode-1ec48254.js} +2 -2
- package/dist/cjs/{html-c0d4db3b.js → html-0e1741fe.js} +2 -2
- package/dist/cjs/{htmlMode-fdc44d57.js → htmlMode-279d3c29.js} +2 -2
- package/dist/cjs/{index-6a382a34.js → index-ac186201.js} +67 -24
- package/dist/cjs/index.cjs.js +2 -2
- package/dist/cjs/{javascript-a419d064.js → javascript-04f1bce0.js} +3 -3
- package/dist/cjs/{jsonMode-73aee5d2.js → jsonMode-59322f7a.js} +2 -2
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{tsMode-37d1b053.js → tsMode-17561f70.js} +2 -2
- package/dist/cjs/{typescript-53f9f36a.js → typescript-b7da8629.js} +2 -2
- package/dist/components/arcade-api.js +160 -160
- package/dist/components/arcade-contribution.js +60 -60
- package/dist/components/arcade-defaults.js +1240 -1240
- package/dist/components/arcade-mode.js +514 -513
- package/dist/components/arcade-results.js +426 -430
- package/dist/components/arcade-suggestions.js +130 -132
- package/dist/components/arcade-variables.js +157 -155
- package/dist/components/arcgis-arcade-api.d.ts +2 -2
- package/dist/components/arcgis-arcade-editor.d.ts +2 -2
- package/dist/components/arcgis-arcade-editor.js +391 -391
- package/dist/components/arcgis-arcade-results.d.ts +2 -2
- package/dist/components/arcgis-arcade-suggestions.d.ts +2 -2
- package/dist/components/arcgis-arcade-variables.d.ts +2 -2
- package/dist/components/arcgis-code-editor.d.ts +2 -2
- package/dist/components/code-editor.js +251 -251
- package/dist/components/fields.js +69 -69
- package/dist/components/functional-components.js +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/markdown.js +28 -28
- package/dist/components/utilities.js +20 -20
- package/dist/esm/{arcade-defaults-d7893362.js → arcade-defaults-0bafa696.js} +1534 -1534
- package/dist/esm/arcade-mode-c17a1fa1.js +595 -0
- package/dist/esm/arcgis-arcade-api_6.entry.js +1404 -1408
- package/dist/esm/arcgis-coding-components.js +3 -3
- package/dist/esm/{cssMode-b1771f92.js → cssMode-3d18bd2b.js} +2 -2
- package/dist/esm/{html-af635d52.js → html-2bce5d77.js} +2 -2
- package/dist/esm/{htmlMode-3021c301.js → htmlMode-69d56956.js} +2 -2
- package/dist/esm/{index-fd6b2fd8.js → index-022fb97b.js} +67 -24
- package/dist/esm/index.js +2 -2
- package/dist/esm/{javascript-70589186.js → javascript-ded5c9d7.js} +3 -3
- package/dist/esm/{jsonMode-cb509b79.js → jsonMode-0bf84cb2.js} +2 -2
- package/dist/esm/loader.js +2 -2
- package/dist/esm/{tsMode-ed90c9aa.js → tsMode-15d4e936.js} +2 -2
- package/dist/esm/{typescript-db8a0b18.js → typescript-cc4d00f0.js} +2 -2
- package/dist/types/components/arcade-api/arcade-api.d.ts +40 -40
- package/dist/types/components/arcade-api/t9n-types.d.ts +6 -6
- package/dist/types/components/arcade-editor/arcade-editor.d.ts +127 -127
- package/dist/types/components/arcade-editor/t9n-types.d.ts +6 -6
- package/dist/types/components/arcade-results/arcade-results.d.ts +47 -47
- package/dist/types/components/arcade-results/t9n-types.d.ts +11 -11
- package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +34 -34
- package/dist/types/components/arcade-suggestions/t9n-types.d.ts +4 -4
- package/dist/types/components/arcade-variables/arcade-variables.d.ts +41 -41
- package/dist/types/components/arcade-variables/t9n-types.d.ts +6 -6
- package/dist/types/components/code-editor/code-editor.d.ts +73 -73
- package/dist/types/stencil-public-runtime.d.ts +8 -0
- package/dist/types/utils/arcade-executor.d.ts +79 -79
- package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +66 -66
- package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +23 -23
- package/dist/types/utils/arcade-monaco/arcade-mode.d.ts +9 -9
- package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +7 -7
- package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +9 -9
- package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +12 -12
- package/dist/types/utils/arcade-monaco/types.d.ts +29 -29
- package/dist/types/utils/editor-suggestions.d.ts +24 -24
- package/dist/types/utils/functional-components.d.ts +1 -1
- package/dist/types/utils/markdown.d.ts +1 -1
- package/dist/types/utils/profile/editor-profile.d.ts +185 -185
- package/dist/types/utils/profile/types.d.ts +101 -101
- package/dist/types/utils/utilities.d.ts +1 -1
- package/package.json +7 -7
- package/dist/arcgis-coding-components/p-5d670bd2.js +0 -2
- package/dist/arcgis-coding-components/p-9e242e76.js +0 -1
- package/dist/arcgis-coding-components/p-ccdf0ac1.entry.js +0 -1
- package/dist/cjs/arcade-mode-b77afcc9.js +0 -598
- package/dist/esm/arcade-mode-70e22d22.js +0 -594
|
@@ -44,82 +44,82 @@ async function importRequest() {
|
|
|
44
44
|
* Returns an icon name for the field type
|
|
45
45
|
*/
|
|
46
46
|
function fieldTypeToIconName(field) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
47
|
+
switch (field?.type) {
|
|
48
|
+
case "oid":
|
|
49
|
+
return "key";
|
|
50
|
+
case "small-integer":
|
|
51
|
+
case "big-integer":
|
|
52
|
+
case "integer":
|
|
53
|
+
case "single":
|
|
54
|
+
case "double":
|
|
55
|
+
case "long":
|
|
56
|
+
return "number";
|
|
57
|
+
case "global-id":
|
|
58
|
+
case "guid":
|
|
59
|
+
return "key";
|
|
60
|
+
case "string":
|
|
61
|
+
return "string";
|
|
62
|
+
case "date":
|
|
63
|
+
return "date-time";
|
|
64
|
+
case "date-only":
|
|
65
|
+
return "calendar";
|
|
66
|
+
case "time-only":
|
|
67
|
+
return "clock";
|
|
68
|
+
case "timestamp-offset":
|
|
69
|
+
return "time-zone";
|
|
70
|
+
default:
|
|
71
|
+
return "cube";
|
|
72
|
+
}
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* Returns the Arcade type for the given field.
|
|
76
76
|
*/
|
|
77
77
|
function fieldTypeToArcadeType(field) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
78
|
+
switch (field?.type) {
|
|
79
|
+
case "small-integer":
|
|
80
|
+
case "integer":
|
|
81
|
+
case "big-integer":
|
|
82
|
+
case "single":
|
|
83
|
+
case "double":
|
|
84
|
+
case "long":
|
|
85
|
+
case "oid":
|
|
86
|
+
return "number";
|
|
87
|
+
case "global-id":
|
|
88
|
+
case "guid":
|
|
89
|
+
case "string":
|
|
90
|
+
return "text";
|
|
91
|
+
case "date":
|
|
92
|
+
return "date";
|
|
93
|
+
case "date-only":
|
|
94
|
+
return "dateOnly";
|
|
95
|
+
case "time-only":
|
|
96
|
+
return "time";
|
|
97
|
+
default:
|
|
98
|
+
return "text";
|
|
99
|
+
}
|
|
100
100
|
}
|
|
101
101
|
function supportedFields(fields) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
102
|
+
return (fields ?? []).filter((field) => {
|
|
103
|
+
switch (field.type) {
|
|
104
|
+
case "string":
|
|
105
|
+
case "small-integer":
|
|
106
|
+
case "integer":
|
|
107
|
+
case "big-integer":
|
|
108
|
+
case "single":
|
|
109
|
+
case "double":
|
|
110
|
+
case "long":
|
|
111
|
+
case "date":
|
|
112
|
+
case "date-only":
|
|
113
|
+
case "time-only":
|
|
114
|
+
case "timestamp-offset":
|
|
115
|
+
case "oid":
|
|
116
|
+
case "guid":
|
|
117
|
+
case "global-id":
|
|
118
|
+
return true;
|
|
119
|
+
default:
|
|
120
|
+
return false;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
export { importLayersFeatureLayer as a, importWebMap as b, importRequest as c, fieldTypeToArcadeType as d, importArcade as e, fieldTypeToIconName as f, importPortalPortalItem as i, supportedFields as s };
|
|
@@ -5,6 +5,6 @@ const StickyFilterInput = ({ filterValue, ...rest }) => (
|
|
|
5
5
|
// TODO: Remove when calcite-input bug with scale is fixed
|
|
6
6
|
// @ts-expect-error
|
|
7
7
|
h("div", { class: "sticky", scale: "m" },
|
|
8
|
-
|
|
8
|
+
h("calcite-input", { value: filterValue, icon: "magnifying-glass", clearable: true, ...rest })));
|
|
9
9
|
|
|
10
10
|
export { StickyFilterInput as S };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
var p=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n;});}};function S(e,t){let n=e;for(;n;){if(n===t)return !0;if(!n.parentNode)return !1;n.parentNode instanceof ShadowRoot?n=n.parentNode.host:n=n.parentNode;}return !1}function T(e,t,n=()=>{}){if(!t||t.length<=0)return;let r=new MutationObserver(o=>{for(let i of o)S(e,i.target)&&n();});return r.observe(document.documentElement,{attributes:!0,attributeFilter:t,subtree:!0}),r}function E(e,t){let n=e;for(;n;){let r=n.closest(t);if(r)return r;let o=n.getRootNode();if(o===document)return null;n=o.host;}return null}function P(e){let t=E(e,":is(.calcite-mode-light, .calcite-mode-dark)");return t&&t.classList.contains("calcite-mode-dark")?"dark":"light"}function f(e,t,n){return E(e,`[${t}]`)?.getAttribute(t)??n}function M(e){return e.nodeType===Node.ELEMENT_NODE}function c(e,t=""){if(!M(e))return !1;if(e.matches(t))return setTimeout(()=>e?.setFocus(),0),!0;for(let r=0;r<e.children.length;r
|
|
1
|
+
var p=class{constructor(){this.resolve=()=>{},this.reject=()=>{},this.promise=new Promise((t,n)=>{this.resolve=t,this.reject=n;});}};function S(e,t){let n=e;for(;n;){if(n===t)return !0;if(!n.parentNode)return !1;n.parentNode instanceof ShadowRoot?n=n.parentNode.host:n=n.parentNode;}return !1}function T(e,t,n=()=>{}){if(!t||t.length<=0)return;let r=new MutationObserver(o=>{for(let i of o)S(e,i.target)&&n();});return r.observe(document.documentElement,{attributes:!0,attributeFilter:t,subtree:!0}),r}function E(e,t){let n=e;for(;n;){let r=n.closest(t);if(r)return r;let o=n.getRootNode();if(o===document)return null;n=o.host;}return null}function P(e){let t=E(e,":is(.calcite-mode-light, .calcite-mode-dark)");return t&&t.classList.contains("calcite-mode-dark")?"dark":"light"}function f(e,t,n){return E(e,`[${t}]`)?.getAttribute(t)??n}function M(e){return e.nodeType===Node.ELEMENT_NODE}function c(e,t=""){if(!M(e))return !1;if(e.matches(t))return setTimeout(()=>e?.setFocus(),0),!0;for(let r=0;r<e.children.length;r+=1)if(c(e.children[r],t))return !0;let n=e.shadowRoot;if(n){for(let r=0;r<n.children.length;r+=1)if(c(n.children[r],t))return !0}return !1}function O(e,t){if(!e||!e.shadowRoot)return;if(e.hasAttribute("hydrated")||e.hasAttribute("calcite-hydrated")){c(e,t);return}let n=new MutationObserver(()=>{n.disconnect(),c(e,t);});n.observe(e,{attributes:!0,attributeFilter:["hydrated","calcite-hydrated"]});}function d(e){let t="";for(let n=0;n<e;n+=1)t+=((1+Math.random())*65536|0).toString(16).substring(1);return t}function $(){return [d(2),d(1),d(1),d(1),d(3)].join("-")}var x=new Set(["ar","bg","bs","ca","cs","da","de","el","en","es","et","fi","fr","he","hr","hu","id","it","ja","ko","lt","lv","nl","nb","pl","pt-BR","pt-PT","ro","ru","sk","sl","sr","sv","th","tr","uk","vi","zh-CN","zh-HK","zh-TW"]),a=new Map;async function N(e,t,n=""){let r=`${t}/${n}${e}.json`;if(a.has(r))return a.get(r);try{let o=await fetch(r);if(o.ok){let s=await o.json();return a.set(r,s),s}if(e==="en"){a.set(r,void 0);return}let i=await N("en",t,n);return a.set(r,i),i}catch{a.set(r,void 0);return}}function R(e){let t=f(e,"lang",navigator?.language||"en");if(x.has(t))return {lang:t,t9nLocale:t};let n=t.slice(0,2);return {lang:t,t9nLocale:x.has(n)?n:"en"}}var m=new WeakMap,h=new WeakMap,_=new WeakMap;async function F(e,t,n){h.set(e,t),m.set(e,T(e._hostElement,["lang"],()=>{b(e,n);})),await b(e,n);}function U(e){m.get(e)?.disconnect(),m.delete(e),h.delete(e);}async function b(e,t){let{lang:n,t9nLocale:r}=R(e._hostElement);if(n===e._lang&&r===e._t9nLocale||(n!==e._lang&&(e._lang=n),r===e._t9nLocale))return;let o=_.get(e);if(!o){let i=h.get(e)??"",s=e._hostElement.tagName.toLowerCase().replace("arcgis-",""),u=`${i}/${s}/t9n`,l=`${s}.t9n.`;o=await N(r,u,l);}e._t9nLocale=r,e._t9nStrings=o,await t?.call(e);}var v='"',w="'";function L(e,t){return new Array(t+1).join(e)}function z(e){let t=v,n=w;e.indexOf(t)>=0&&e.indexOf(n)<0&&(n=v,t=w);let o=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)((?:\\\\${n})+)`,"gu");e=e.replace(o,(s,u,l,g)=>u+l+L(n,g.length/2));let i=new RegExp(`(^|[^\\\\])((?:\\\\{2})*)(${t}+)`,"gu");return e=e.replace(i,(s,u,l,g)=>u+l+L(`\\${t}`,g.length)),t+e+t}function B(e){let t=e?e.replaceAll(/[-[\]/{}()*+?.\\^$|]/gu,"\\$&"):"^.*$";return new RegExp(t,"i")}function H(e,t={}){return (e??"").replace(/\{(.*?)\}/gu,(n,r)=>t[r]??n)}function q(e){return `\u200E${e??""}\u200E`}function D(e){return e!==null}function G(e){return e!==void 0}function V(e,t,n=!1){if(!e||!t)return !1;let r=new URL(e),o=new URL(t);return !n&&r.protocol!==o.protocol||r.host==null||o.host==null?!1:r.host.toLowerCase()===o.host.toLowerCase()&&r.port===o.port}function X(e){try{return new URL(e),!0}catch{return !1}}
|
|
2
2
|
|
|
3
|
-
export { B, D, F, G, H, N, O, P, T, U, V, X,
|
|
3
|
+
export { $, B, D, F, G, H, N, O, P, T, U, V, X, p, q, x, z };
|
|
@@ -4,29 +4,29 @@ import { IStandaloneThemeService } from 'monaco-editor/esm/vs/editor/standalone/
|
|
|
4
4
|
import { generateTokensCSSForColorMap } from 'monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js';
|
|
5
5
|
|
|
6
6
|
async function colorizeCode(code) {
|
|
7
|
-
|
|
7
|
+
return editor.colorize(code, "arcade", { tabSize: 2 });
|
|
8
8
|
}
|
|
9
9
|
async function colorizedAllCodeElements(e) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
if (!e) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const codeElements = Array.from(e.querySelectorAll("code.language-arcade"));
|
|
14
|
+
await Promise.all(codeElements.map(async (codeElement) => await colorizeCodeElement(codeElement, codeElement.textContent)));
|
|
15
15
|
}
|
|
16
16
|
async function colorizeCodeElement(e, text) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
if (!e || e.tagName !== "CODE") {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
e.innerHTML = await colorizeCode(text ?? "");
|
|
21
21
|
}
|
|
22
22
|
function generateColorizeStyles() {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
const themeService = StandaloneServices.get(IStandaloneThemeService);
|
|
24
|
+
const theme = themeService.getColorTheme();
|
|
25
|
+
return generateTokensCSSForColorMap(theme.tokenTheme.getColorMap());
|
|
26
26
|
}
|
|
27
27
|
function onColorizeThemeChanged(func) {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
const themeService = StandaloneServices.get(IStandaloneThemeService);
|
|
29
|
+
return themeService.onDidColorThemeChange(() => func());
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
@@ -2923,22 +2923,22 @@ var marked_umd = createCommonjsModule(function (module, exports) {
|
|
|
2923
2923
|
});
|
|
2924
2924
|
|
|
2925
2925
|
marked_umd.marked.use({
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2926
|
+
gfm: true,
|
|
2927
|
+
renderer: {
|
|
2928
|
+
link(href, title, text) {
|
|
2929
|
+
return `<calcite-link href="${href}" title="${title ?? text}" target="Arcade Help">${text}</calcite-link>`;
|
|
2930
|
+
}
|
|
2930
2931
|
}
|
|
2931
|
-
}
|
|
2932
2932
|
});
|
|
2933
2933
|
function convertMarkdownString(value) {
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2934
|
+
value ?? (value = "");
|
|
2935
|
+
const result = marked_umd.marked(typeof value === "string" ? value : value.value, {
|
|
2936
|
+
gfm: true,
|
|
2937
|
+
breaks: true,
|
|
2938
|
+
headerIds: false,
|
|
2939
|
+
mangle: false
|
|
2940
|
+
});
|
|
2941
|
+
return result;
|
|
2942
2942
|
}
|
|
2943
2943
|
|
|
2944
2944
|
export { colorizedAllCodeElements as a, colorizeCodeElement as b, convertMarkdownString as c, generateColorizeStyles as g, onColorizeThemeChanged as o };
|
|
@@ -4,32 +4,32 @@ import { B } from './index2.js';
|
|
|
4
4
|
* Filters a collection of items by the given keys and filter word.
|
|
5
5
|
*/
|
|
6
6
|
function filterCollection(collection, keys, filterWord, beforeFilteringFn) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
const _keys = !Array.isArray(keys) ? [keys] : keys;
|
|
11
|
-
if (!_keys.length) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
const filterExpression = B(filterWord);
|
|
15
|
-
return collection.filter((item) => {
|
|
16
|
-
if (beforeFilteringFn) {
|
|
17
|
-
const res = beforeFilteringFn(item);
|
|
18
|
-
if (res !== null || res !== undefined) {
|
|
19
|
-
return res;
|
|
20
|
-
}
|
|
7
|
+
if (!keys) {
|
|
8
|
+
return [];
|
|
21
9
|
}
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
const _keys = !Array.isArray(keys) ? [keys] : keys;
|
|
11
|
+
if (!_keys.length) {
|
|
12
|
+
return [];
|
|
13
|
+
}
|
|
14
|
+
const filterExpression = B(filterWord);
|
|
15
|
+
return collection.filter((item) => {
|
|
16
|
+
if (beforeFilteringFn) {
|
|
17
|
+
const res = beforeFilteringFn(item);
|
|
18
|
+
if (res !== null || res !== undefined) {
|
|
19
|
+
return res;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return _keys.some((key) => filterExpression.test(`${item[key] ?? ""}`));
|
|
23
|
+
});
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* Returns the url to the portal item.
|
|
27
27
|
*/
|
|
28
28
|
function portalItemPageUrl(portalItem) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
if (!portalItem) {
|
|
30
|
+
return "";
|
|
31
|
+
}
|
|
32
|
+
return `${portalItem.portal.url}/home/item.html?id=${portalItem.id}`;
|
|
33
33
|
}
|
|
34
34
|
//#endregion
|
|
35
35
|
|