@dotcms/client 0.0.1-alpha.14 → 0.0.1-alpha.15
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/package.json +1 -1
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/editor/listeners/listeners.js +25 -1
- package/src/lib/editor/listeners/listeners.js.map +1 -1
- package/src/lib/editor/models/client.model.d.ts +4 -0
- package/src/lib/editor/models/client.model.js +4 -0
- package/src/lib/editor/models/client.model.js.map +1 -1
- package/src/lib/editor/models/listeners.model.d.ts +5 -1
- package/src/lib/editor/models/listeners.model.js +4 -0
- package/src/lib/editor/models/listeners.model.js.map +1 -1
- package/src/lib/editor/sdk-editor-vtl.js +2 -1
- package/src/lib/editor/sdk-editor-vtl.js.map +1 -1
- package/src/lib/editor/sdk-editor.d.ts +6 -0
- package/src/lib/editor/sdk-editor.js +14 -0
- package/src/lib/editor/sdk-editor.js.map +1 -1
- package/src/lib/editor/utils/editor.utils.d.ts +1 -0
- package/src/lib/editor/utils/editor.utils.js +6 -0
- package/src/lib/editor/utils/editor.utils.js.map +1 -1
- package/src/lib/query-builder/sdk-query-builder.d.ts +43 -0
- package/src/lib/query-builder/sdk-query-builder.js +54 -0
- package/src/lib/query-builder/sdk-query-builder.js.map +1 -0
- package/src/lib/query-builder/utils/index.d.ts +91 -0
- package/src/lib/query-builder/utils/index.js +115 -0
- package/src/lib/query-builder/utils/index.js.map +1 -0
- package/src/lib/query-builder/utils/lucene-syntax/Equals.d.ts +83 -0
- package/src/lib/query-builder/utils/lucene-syntax/Equals.js +101 -0
- package/src/lib/query-builder/utils/lucene-syntax/Equals.js.map +1 -0
- package/src/lib/query-builder/utils/lucene-syntax/Field.d.ts +23 -0
- package/src/lib/query-builder/utils/lucene-syntax/Field.js +31 -0
- package/src/lib/query-builder/utils/lucene-syntax/Field.js.map +1 -0
- package/src/lib/query-builder/utils/lucene-syntax/NotOperand.d.ts +22 -0
- package/src/lib/query-builder/utils/lucene-syntax/NotOperand.js +30 -0
- package/src/lib/query-builder/utils/lucene-syntax/NotOperand.js.map +1 -0
- package/src/lib/query-builder/utils/lucene-syntax/Operand.d.ts +44 -0
- package/src/lib/query-builder/utils/lucene-syntax/Operand.js +55 -0
- package/src/lib/query-builder/utils/lucene-syntax/Operand.js.map +1 -0
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
package/src/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export * from './lib/client/sdk-js-client';
|
|
|
2
2
|
export * from './lib/editor/sdk-editor';
|
|
3
3
|
export * from './lib/editor/models/editor.model';
|
|
4
4
|
export * from './lib/editor/models/client.model';
|
|
5
|
+
export * from './lib/query-builder/sdk-query-builder';
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/client/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/sdk/client/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AACjD,cAAc,uCAAuC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CUSTOMER_ACTIONS, postMessageToEditor } from '../models/client.model';
|
|
2
2
|
import { NOTIFY_CUSTOMER } from '../models/listeners.model';
|
|
3
|
-
import { findVTLData, findDotElement, getClosestContainerData, getPageElementBound } from '../utils/editor.utils';
|
|
3
|
+
import { findVTLData, findDotElement, getClosestContainerData, getPageElementBound, scrollIsInBottom } from '../utils/editor.utils';
|
|
4
4
|
/**
|
|
5
5
|
* Default reload function that reloads the current window.
|
|
6
6
|
*/
|
|
@@ -57,6 +57,19 @@ export function listenEditorMessages() {
|
|
|
57
57
|
break;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
if (event.data.name === NOTIFY_CUSTOMER.EMA_SCROLL_INSIDE_IFRAME) {
|
|
61
|
+
const direction = event.data.direction;
|
|
62
|
+
if ((window.scrollY === 0 && direction === 'up') ||
|
|
63
|
+
(scrollIsInBottom() && direction === 'down')) {
|
|
64
|
+
/**
|
|
65
|
+
* If the iframe scroll is in the top of bottom, we dont send anything.
|
|
66
|
+
* This to avoid the lost of scrollend event
|
|
67
|
+
**/
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const scrollY = direction === 'up' ? -120 : 120;
|
|
71
|
+
window.scrollBy({ left: 0, top: scrollY, behavior: 'smooth' });
|
|
72
|
+
}
|
|
60
73
|
};
|
|
61
74
|
window.addEventListener('message', messageCallback);
|
|
62
75
|
subscriptions.push({
|
|
@@ -139,7 +152,18 @@ export function scrollHandler() {
|
|
|
139
152
|
});
|
|
140
153
|
window.lastScrollYPosition = window.scrollY;
|
|
141
154
|
};
|
|
155
|
+
const scrollEndCallback = () => {
|
|
156
|
+
postMessageToEditor({
|
|
157
|
+
action: CUSTOMER_ACTIONS.IFRAME_SCROLL_END
|
|
158
|
+
});
|
|
159
|
+
};
|
|
142
160
|
window.addEventListener('scroll', scrollCallback);
|
|
161
|
+
window.addEventListener('scrollend', scrollEndCallback);
|
|
162
|
+
subscriptions.push({
|
|
163
|
+
type: 'listener',
|
|
164
|
+
event: 'scroll',
|
|
165
|
+
callback: scrollEndCallback
|
|
166
|
+
});
|
|
143
167
|
subscriptions.push({
|
|
144
168
|
type: 'listener',
|
|
145
169
|
event: 'scroll',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/listeners/listeners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAgC,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EACH,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"listeners.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/listeners/listeners.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE/E,OAAO,EAAgC,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,EACH,WAAW,EACX,cAAc,EACd,uBAAuB,EACvB,mBAAmB,EACnB,gBAAgB,EACnB,MAAM,uBAAuB,CAAC;AAQ/B;;GAEG;AACH,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;AAEvD;;GAEG;AACH,IAAI,gBAAgB,GAA2B;IAC3C,QAAQ,EAAE,eAAe;CAC5B,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,MAA8B;IAC9D,gBAAgB,GAAG,MAAM,CAAC;AAC9B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAmC,EAAE,CAAC;AAEhE;;;;;GAKG;AACH,SAAS,SAAS;IACd,MAAM,UAAU,GAAG,KAAK,CAAC,IAAI,CACzB,QAAQ,CAAC,gBAAgB,CAAC,+BAA+B,CAAC,CACzC,CAAC;IACtB,MAAM,YAAY,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAErD,mBAAmB,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC,UAAU;QACnC,OAAO,EAAE,YAAY;KACxB,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,SAAS,UAAU;IACf,gBAAgB,EAAE,QAAQ,EAAE,CAAC;AACjC,CAA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;QACf,QAAQ,EAAE,cAAc;KAC3B,CAAC,CAAC;AACP,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB;IAClC,MAAM,sBAAsB,GAAG,GAAG,EAAE;QAChC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;IACnD,CAAC,CAAC;IAEF,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;IACxD,aAAa,CAAC,IAAI,CAAC;QACf,IAAI,EAAE,UAAU;QAChB,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,sBAAsB;KACnC,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,UAAU;IACtB,mBAAmB,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC,WAAW;KACvC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -21,6 +21,10 @@ export declare enum CUSTOMER_ACTIONS {
|
|
|
21
21
|
* Tell the editor that the page is being scrolled
|
|
22
22
|
*/
|
|
23
23
|
IFRAME_SCROLL = "scroll",
|
|
24
|
+
/**
|
|
25
|
+
* Tell the editor that the page has stopped scrolling
|
|
26
|
+
*/
|
|
27
|
+
IFRAME_SCROLL_END = "scroll-end",
|
|
24
28
|
/**
|
|
25
29
|
* Ping the editor to see if the page is inside the editor
|
|
26
30
|
*/
|
|
@@ -22,6 +22,10 @@ export var CUSTOMER_ACTIONS;
|
|
|
22
22
|
* Tell the editor that the page is being scrolled
|
|
23
23
|
*/
|
|
24
24
|
CUSTOMER_ACTIONS["IFRAME_SCROLL"] = "scroll";
|
|
25
|
+
/**
|
|
26
|
+
* Tell the editor that the page has stopped scrolling
|
|
27
|
+
*/
|
|
28
|
+
CUSTOMER_ACTIONS["IFRAME_SCROLL_END"] = "scroll-end";
|
|
25
29
|
/**
|
|
26
30
|
* Ping the editor to see if the page is inside the editor
|
|
27
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/client.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"client.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/client.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,gBA6CX;AA7CD,WAAY,gBAAgB;IACxB;;OAEG;IACH,iDAA6B,CAAA;IAC7B;;OAEG;IACH,6CAAyB,CAAA;IACzB;;OAEG;IACH,qDAAiC,CAAA;IACjC;;OAEG;IACH,4CAAwB,CAAA;IACxB;;OAEG;IACH,oDAAgC,CAAA;IAChC;;OAEG;IACH,+CAA2B,CAAA;IAC3B;;OAEG;IACH,+DAA2C,CAAA;IAC3C;;;OAGG;IACH,qFAAiE,CAAA;IACjE;;OAEG;IACH,yFAAqE,CAAA;IAErE;;OAEG;IACH,iDAA6B,CAAA;IAE7B,iCAAa,CAAA;AACjB,CAAC,EA7CW,gBAAgB,KAAhB,gBAAgB,QA6C3B;AAcD;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAc,OAA4B;IACzE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -16,7 +16,11 @@ export declare enum NOTIFY_CUSTOMER {
|
|
|
16
16
|
/**
|
|
17
17
|
* Received pong from the editor
|
|
18
18
|
*/
|
|
19
|
-
EMA_EDITOR_PONG = "ema-editor-pong"
|
|
19
|
+
EMA_EDITOR_PONG = "ema-editor-pong",
|
|
20
|
+
/**
|
|
21
|
+
* Received scroll event trigger from the editor
|
|
22
|
+
*/
|
|
23
|
+
EMA_SCROLL_INSIDE_IFRAME = "scroll-inside-iframe"
|
|
20
24
|
}
|
|
21
25
|
type ListenerCallbackMessage = (event: MessageEvent) => void;
|
|
22
26
|
type ListenerCallbackPointer = (event: PointerEvent) => void;
|
|
@@ -18,5 +18,9 @@ export var NOTIFY_CUSTOMER;
|
|
|
18
18
|
* Received pong from the editor
|
|
19
19
|
*/
|
|
20
20
|
NOTIFY_CUSTOMER["EMA_EDITOR_PONG"] = "ema-editor-pong";
|
|
21
|
+
/**
|
|
22
|
+
* Received scroll event trigger from the editor
|
|
23
|
+
*/
|
|
24
|
+
NOTIFY_CUSTOMER["EMA_SCROLL_INSIDE_IFRAME"] = "scroll-inside-iframe";
|
|
21
25
|
})(NOTIFY_CUSTOMER || (NOTIFY_CUSTOMER = {}));
|
|
22
26
|
//# sourceMappingURL=listeners.model.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listeners.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/listeners.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,
|
|
1
|
+
{"version":3,"file":"listeners.model.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/models/listeners.model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,CAAN,IAAY,eAkBX;AAlBD,WAAY,eAAe;IACvB;;OAEG;IACH,sDAAmC,CAAA;IACnC;;OAEG;IACH,4DAAyC,CAAA;IACzC;;OAEG;IACH,sDAAmC,CAAA;IACnC;;OAEG;IAEH,oEAAiD,CAAA;AACrD,CAAC,EAlBW,eAAe,KAAf,eAAe,QAkB1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { listenEditorMessages, listenHoveredContentlet, pingEditor, preserveScrollOnIframe, scrollHandler } from './listeners/listeners';
|
|
2
|
-
import { isInsideEditor } from './sdk-editor';
|
|
2
|
+
import { isInsideEditor, addClassToEmptyContentlets } from './sdk-editor';
|
|
3
3
|
/**
|
|
4
4
|
* This is the main entry point for the SDK VTL.
|
|
5
5
|
* This is added to VTL Script in the EditPage
|
|
@@ -16,5 +16,6 @@ if (isInsideEditor()) {
|
|
|
16
16
|
scrollHandler();
|
|
17
17
|
preserveScrollOnIframe();
|
|
18
18
|
listenHoveredContentlet();
|
|
19
|
+
addClassToEmptyContentlets();
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=sdk-editor-vtl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-editor-vtl.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/editor/sdk-editor-vtl.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,sBAAsB,EACtB,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"sdk-editor-vtl.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/editor/sdk-editor-vtl.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,sBAAsB,EACtB,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,cAAc,CAAC;AAQ1E;;;;;;;;;GASG;AACH,IAAI,cAAc,EAAE,EAAE,CAAC;IACnB,UAAU,EAAE,CAAC;IACb,oBAAoB,EAAE,CAAC;IACvB,aAAa,EAAE,CAAC;IAChB,sBAAsB,EAAE,CAAC;IACzB,uBAAuB,EAAE,CAAC;IAC1B,0BAA0B,EAAE,CAAC;AACjC,CAAC"}
|
|
@@ -21,3 +21,9 @@ export declare function initEditor(config?: DotCMSPageEditorConfig): void;
|
|
|
21
21
|
* Destroys the editor by removing event listeners and disconnecting observers.
|
|
22
22
|
*/
|
|
23
23
|
export declare function destroyEditor(): void;
|
|
24
|
+
/**
|
|
25
|
+
* Adds a class to empty contentlets.
|
|
26
|
+
*
|
|
27
|
+
* @export
|
|
28
|
+
*/
|
|
29
|
+
export declare function addClassToEmptyContentlets(): void;
|
|
@@ -51,4 +51,18 @@ export function destroyEditor() {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Adds a class to empty contentlets.
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
*/
|
|
59
|
+
export function addClassToEmptyContentlets() {
|
|
60
|
+
const contentlets = document.querySelectorAll('[data-dot-object="contentlet"]');
|
|
61
|
+
contentlets.forEach((contentlet) => {
|
|
62
|
+
if (contentlet.clientHeight) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
contentlet.classList.add('empty-contentlet');
|
|
66
|
+
});
|
|
67
|
+
}
|
|
54
68
|
//# sourceMappingURL=sdk-editor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-editor.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/editor/sdk-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG9E;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC7C,mBAAmB,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC,iBAAiB;QAC1C,OAAO,EAAE;YACL,GAAG,EAAE,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;SAC/D;KACJ,CAAC,CAAC;AACP,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc;IAC1B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC;AACpC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,MAA+B;IACtD,IAAI,MAAM,EAAE,CAAC;QACT,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,UAAU,EAAE,CAAC;IACb,oBAAoB,EAAE,CAAC;IACvB,uBAAuB,EAAE,CAAC;IAC1B,aAAa,EAAE,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa;IACzB,aAAa,CAAC,OAAO,CAAC,CAAC,YAAY,EAAE,EAAE;QACnC,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,MAAM,CAAC,mBAAmB,CAAC,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,QAAyB,CAAC,CAAC;QAC3F,CAAC;QAED,IAAI,YAAY,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;QACvC,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
1
|
+
{"version":3,"file":"sdk-editor.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/editor/sdk-editor.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,UAAU,EACV,aAAa,EACb,mBAAmB,EACnB,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAG9E;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAgB;IAC7C,mBAAmB,CAAC;QAChB,MAAM,EAAE,gBAAgB,CAAC,iBAAiB;QAC1C,OAAO,EAAE;YACL,GAAG,EAAE,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAA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125
125
|
};
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
+
export function scrollIsInBottom() {
|
|
129
|
+
const documentHeight = document.documentElement.scrollHeight;
|
|
130
|
+
const viewportHeight = window.innerHeight;
|
|
131
|
+
const scrollY = window.scrollY;
|
|
132
|
+
return scrollY + viewportHeight >= documentHeight;
|
|
133
|
+
}
|
|
128
134
|
//# sourceMappingURL=editor.utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/utils/editor.utils.ts"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA4B;IAC5D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAChC,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAC1B,SAAS,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,CAC3C,CAAC;QAEtB,OAAO;YACH,CAAC,EAAE,aAAa,CAAC,CAAC;YAClB,CAAC,EAAE,aAAa,CAAC,CAAC;YAClB,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC;aACzC,CAAC;YACF,WAAW,EAAE,mBAAmB,CAAC,aAAa,EAAE,WAAW,CAAC;SAC/D,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAC/B,aAAsB,EACtB,WAA6B;IAE7B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAClC,MAAM,cAAc,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;QAE1D,OAAO;YACH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,CAAC,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAC9C,OAAO;YACH,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC;YACvC,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;SACvC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
1
|
+
{"version":3,"file":"editor.utils.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/editor/utils/editor.utils.ts"],"names":[],"mappings":"AA2BA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAA4B;IAC5D,OAAO,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAChC,MAAM,aAAa,GAAG,SAAS,CAAC,qBAAqB,EAAE,CAAC;QACxD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAC1B,SAAS,CAAC,gBAAgB,CAAC,gCAAgC,CAAC,CAC3C,CAAC;QAEtB,OAAO;YACH,CAAC,EAAE,aAAa,CAAC,CAAC;YAClB,CAAC,EAAE,aAAa,CAAC,CAAC;YAClB,KAAK,EAAE,aAAa,CAAC,KAAK;YAC1B,MAAM,EAAE,aAAa,CAAC,MAAM;YAC5B,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gBACpB,SAAS,EAAE,gBAAgB,CAAC,SAAS,CAAC;aACzC,CAAC;YACF,WAAW,EAAE,mBAAmB,CAAC,aAAa,EAAE,WAAW,CAAC;SAC/D,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAC/B,aAAsB,EACtB,WAA6B;IAE7B,OAAO,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QAClC,MAAM,cAAc,GAAG,UAAU,CAAC,qBAAqB,EAAE,CAAC;QAE1D,OAAO;YACH,CAAC,EAAE,CAAC;YACJ,CAAC,EAAE,cAAc,CAA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E;QAC9C,OAAO;YACH,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC;YACvC,IAAI,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC;SACvC,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC;AAED,MAAM,UAAU,gBAAgB;IAC5B,MAAM,cAAc,GAAG,QAAQ,CAAC,eAAe,CAAC,YAAY,CAAC;IAC7D,MAAM,cAAc,GAAG,MAAM,CAAC,WAAW,CAAC;IAC1C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC;IAE/B,OAAO,OAAO,GAAG,cAAc,IAAI,cAAc,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Equals } from './utils/lucene-syntax/Equals';
|
|
2
|
+
import { Field } from './utils/lucene-syntax/Field';
|
|
3
|
+
/**
|
|
4
|
+
* 'QueryBuilder' Is a Typescript class that provides the ability to build a query string using the Lucene syntax in a more readable way.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class QueryBuilder
|
|
8
|
+
*/
|
|
9
|
+
export declare class QueryBuilder {
|
|
10
|
+
#private;
|
|
11
|
+
/**
|
|
12
|
+
* This method appends to the query a field that should be included in the search.
|
|
13
|
+
*
|
|
14
|
+
* Ex: "+myField:"
|
|
15
|
+
*
|
|
16
|
+
* @param {string} field - The field that should be included in the search.
|
|
17
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
18
|
+
* @memberof QueryBuilder
|
|
19
|
+
*/
|
|
20
|
+
field(field: string): Field;
|
|
21
|
+
/**
|
|
22
|
+
* This method appends to the query a field that should be excluded from the search.
|
|
23
|
+
*
|
|
24
|
+
* Ex: "-myField:"
|
|
25
|
+
*
|
|
26
|
+
* @param {string} field - The field that should be excluded from the search.
|
|
27
|
+
* @return {*} {Field} - An instance of a Lucene Exclude Field. An exclude field is a key used to exclude for a specific value in a document.
|
|
28
|
+
* @memberof QueryBuilder
|
|
29
|
+
*/
|
|
30
|
+
excludeField(field: string): Field;
|
|
31
|
+
/**
|
|
32
|
+
* This method allows to pass a raw query string to the query builder.
|
|
33
|
+
* This raw query should end in Equals.
|
|
34
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
35
|
+
*
|
|
36
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
37
|
+
*
|
|
38
|
+
* @param {string} query - A raw query string.
|
|
39
|
+
* @return {*} {Equals} - An instance of Equals. A term is a value used to search for a specific value in a document.
|
|
40
|
+
* @memberof QueryBuilder
|
|
41
|
+
*/
|
|
42
|
+
raw(query: string): Equals;
|
|
43
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
var _QueryBuilder_query;
|
|
2
|
+
import { __classPrivateFieldGet } from "tslib";
|
|
3
|
+
import { buildExcludeField, buildField, buildRawEquals } from './utils';
|
|
4
|
+
/**
|
|
5
|
+
* 'QueryBuilder' Is a Typescript class that provides the ability to build a query string using the Lucene syntax in a more readable way.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class QueryBuilder
|
|
9
|
+
*/
|
|
10
|
+
export class QueryBuilder {
|
|
11
|
+
constructor() {
|
|
12
|
+
_QueryBuilder_query.set(this, '');
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This method appends to the query a field that should be included in the search.
|
|
16
|
+
*
|
|
17
|
+
* Ex: "+myField:"
|
|
18
|
+
*
|
|
19
|
+
* @param {string} field - The field that should be included in the search.
|
|
20
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
21
|
+
* @memberof QueryBuilder
|
|
22
|
+
*/
|
|
23
|
+
field(field) {
|
|
24
|
+
return buildField(__classPrivateFieldGet(this, _QueryBuilder_query, "f"), field);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* This method appends to the query a field that should be excluded from the search.
|
|
28
|
+
*
|
|
29
|
+
* Ex: "-myField:"
|
|
30
|
+
*
|
|
31
|
+
* @param {string} field - The field that should be excluded from the search.
|
|
32
|
+
* @return {*} {Field} - An instance of a Lucene Exclude Field. An exclude field is a key used to exclude for a specific value in a document.
|
|
33
|
+
* @memberof QueryBuilder
|
|
34
|
+
*/
|
|
35
|
+
excludeField(field) {
|
|
36
|
+
return buildExcludeField(__classPrivateFieldGet(this, _QueryBuilder_query, "f"), field);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This method allows to pass a raw query string to the query builder.
|
|
40
|
+
* This raw query should end in Equals.
|
|
41
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
42
|
+
*
|
|
43
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
44
|
+
*
|
|
45
|
+
* @param {string} query - A raw query string.
|
|
46
|
+
* @return {*} {Equals} - An instance of Equals. A term is a value used to search for a specific value in a document.
|
|
47
|
+
* @memberof QueryBuilder
|
|
48
|
+
*/
|
|
49
|
+
raw(query) {
|
|
50
|
+
return buildRawEquals(__classPrivateFieldGet(this, _QueryBuilder_query, "f"), query);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
_QueryBuilder_query = new WeakMap();
|
|
54
|
+
//# sourceMappingURL=sdk-query-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-query-builder.js","sourceRoot":"","sources":["../../../../../../../libs/sdk/client/src/lib/query-builder/sdk-query-builder.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIxE;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IAAzB;QACI,8BAAS,EAAE,EAAC;IA0ChB,CAAC;IAxCG;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,UAAU,CAAC,uBAAA,IAAI,2BAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,iBAAiB,CAAC,uBAAA,IAAI,2BAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,KAAa;QACb,OAAO,cAAc,CAAC,uBAAA,IAAI,2BAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;CACJ"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Equals } from './lucene-syntax/Equals';
|
|
2
|
+
import { Field } from './lucene-syntax/Field';
|
|
3
|
+
import { NotOperand } from './lucene-syntax/NotOperand';
|
|
4
|
+
import { Operand } from './lucene-syntax/Operand';
|
|
5
|
+
/**
|
|
6
|
+
* Enum for common Operands
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
export declare enum OPERAND {
|
|
12
|
+
OR = "OR",
|
|
13
|
+
AND = "AND",
|
|
14
|
+
NOT = "NOT"
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This function removes extra spaces from a string.
|
|
18
|
+
*
|
|
19
|
+
* @export
|
|
20
|
+
* @param {string} str
|
|
21
|
+
* @return {*} {string}
|
|
22
|
+
*/
|
|
23
|
+
export declare function sanitizeQuery(str: string): string;
|
|
24
|
+
/**
|
|
25
|
+
* This function sanitizes a term by adding quotes if it contains spaces.
|
|
26
|
+
* In lucene, a term with spaces should be enclosed in quotes.
|
|
27
|
+
*
|
|
28
|
+
* @export
|
|
29
|
+
* @param {string} term
|
|
30
|
+
* @return {*} {string}
|
|
31
|
+
*/
|
|
32
|
+
export declare function sanitizePhrases(term: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* This function builds a term to be used in a lucene query.
|
|
35
|
+
* We need to sanitize the term before adding it to the query.
|
|
36
|
+
*
|
|
37
|
+
* @export
|
|
38
|
+
* @param {string} query
|
|
39
|
+
* @param {string} term
|
|
40
|
+
* @return {*} {Equals}
|
|
41
|
+
*/
|
|
42
|
+
export declare function buildEquals(query: string, term: string): Equals;
|
|
43
|
+
/**
|
|
44
|
+
* This function builds a term to be used in a lucene query.
|
|
45
|
+
* We need to sanitize the raw query before adding it to the query.
|
|
46
|
+
*
|
|
47
|
+
* @export
|
|
48
|
+
* @param {string} query
|
|
49
|
+
* @param {string} raw
|
|
50
|
+
* @return {*} {Equals}
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildRawEquals(query: string, raw: string): Equals;
|
|
53
|
+
/**
|
|
54
|
+
* This function builds a field to be used in a lucene query.
|
|
55
|
+
* We need to format the field before adding it to the query.
|
|
56
|
+
*
|
|
57
|
+
* @export
|
|
58
|
+
* @param {string} query
|
|
59
|
+
* @param {string} field
|
|
60
|
+
* @return {*} {Field}
|
|
61
|
+
*/
|
|
62
|
+
export declare function buildField(query: string, field: string): Field;
|
|
63
|
+
/**
|
|
64
|
+
* This function builds an exclude field to be used in a lucene query.
|
|
65
|
+
* We need to format the field before adding it to the query.
|
|
66
|
+
*
|
|
67
|
+
* @export
|
|
68
|
+
* @param {string} query
|
|
69
|
+
* @param {string} field
|
|
70
|
+
* @return {*} {Field}
|
|
71
|
+
*/
|
|
72
|
+
export declare function buildExcludeField(query: string, field: string): Field;
|
|
73
|
+
/**
|
|
74
|
+
* This function builds an operand to be used in a lucene query.
|
|
75
|
+
* We need to format the operand before adding it to the query.
|
|
76
|
+
*
|
|
77
|
+
* @export
|
|
78
|
+
* @param {string} query
|
|
79
|
+
* @param {OPERAND} operand
|
|
80
|
+
* @return {*} {Operand}
|
|
81
|
+
*/
|
|
82
|
+
export declare function buildOperand(query: string, operand: OPERAND): Operand;
|
|
83
|
+
/**
|
|
84
|
+
* This function builds a NOT operand to be used in a lucene query.
|
|
85
|
+
* We need to format the operand before adding it to the query.
|
|
86
|
+
*
|
|
87
|
+
* @export
|
|
88
|
+
* @param {string} query
|
|
89
|
+
* @return {*} {NotOperand}
|
|
90
|
+
*/
|
|
91
|
+
export declare function buildNotOperand(query: string): NotOperand;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Equals } from './lucene-syntax/Equals';
|
|
2
|
+
import { Field } from './lucene-syntax/Field';
|
|
3
|
+
import { NotOperand } from './lucene-syntax/NotOperand';
|
|
4
|
+
import { Operand } from './lucene-syntax/Operand';
|
|
5
|
+
/**
|
|
6
|
+
* Enum for common Operands
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @enum {number}
|
|
10
|
+
*/
|
|
11
|
+
export var OPERAND;
|
|
12
|
+
(function (OPERAND) {
|
|
13
|
+
OPERAND["OR"] = "OR";
|
|
14
|
+
OPERAND["AND"] = "AND";
|
|
15
|
+
OPERAND["NOT"] = "NOT";
|
|
16
|
+
})(OPERAND || (OPERAND = {}));
|
|
17
|
+
/**
|
|
18
|
+
* This function removes extra spaces from a string.
|
|
19
|
+
*
|
|
20
|
+
* @export
|
|
21
|
+
* @param {string} str
|
|
22
|
+
* @return {*} {string}
|
|
23
|
+
*/
|
|
24
|
+
export function sanitizeQuery(str) {
|
|
25
|
+
return str.replace(/\s{2,}/g, ' ').trim();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* This function sanitizes a term by adding quotes if it contains spaces.
|
|
29
|
+
* In lucene, a term with spaces should be enclosed in quotes.
|
|
30
|
+
*
|
|
31
|
+
* @export
|
|
32
|
+
* @param {string} term
|
|
33
|
+
* @return {*} {string}
|
|
34
|
+
*/
|
|
35
|
+
export function sanitizePhrases(term) {
|
|
36
|
+
return term.includes(' ') ? `"${term}"` : term;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* This function builds a term to be used in a lucene query.
|
|
40
|
+
* We need to sanitize the term before adding it to the query.
|
|
41
|
+
*
|
|
42
|
+
* @export
|
|
43
|
+
* @param {string} query
|
|
44
|
+
* @param {string} term
|
|
45
|
+
* @return {*} {Equals}
|
|
46
|
+
*/
|
|
47
|
+
export function buildEquals(query, term) {
|
|
48
|
+
const newQuery = query + sanitizePhrases(term);
|
|
49
|
+
return new Equals(newQuery);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* This function builds a term to be used in a lucene query.
|
|
53
|
+
* We need to sanitize the raw query before adding it to the query.
|
|
54
|
+
*
|
|
55
|
+
* @export
|
|
56
|
+
* @param {string} query
|
|
57
|
+
* @param {string} raw
|
|
58
|
+
* @return {*} {Equals}
|
|
59
|
+
*/
|
|
60
|
+
export function buildRawEquals(query, raw) {
|
|
61
|
+
const newQuery = query + ` ${raw}`;
|
|
62
|
+
return new Equals(sanitizeQuery(newQuery));
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* This function builds a field to be used in a lucene query.
|
|
66
|
+
* We need to format the field before adding it to the query.
|
|
67
|
+
*
|
|
68
|
+
* @export
|
|
69
|
+
* @param {string} query
|
|
70
|
+
* @param {string} field
|
|
71
|
+
* @return {*} {Field}
|
|
72
|
+
*/
|
|
73
|
+
export function buildField(query, field) {
|
|
74
|
+
const newQuery = query + ` +${field}:`;
|
|
75
|
+
return new Field(newQuery);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* This function builds an exclude field to be used in a lucene query.
|
|
79
|
+
* We need to format the field before adding it to the query.
|
|
80
|
+
*
|
|
81
|
+
* @export
|
|
82
|
+
* @param {string} query
|
|
83
|
+
* @param {string} field
|
|
84
|
+
* @return {*} {Field}
|
|
85
|
+
*/
|
|
86
|
+
export function buildExcludeField(query, field) {
|
|
87
|
+
const newQuery = query + ` -${field}:`;
|
|
88
|
+
return new Field(newQuery);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This function builds an operand to be used in a lucene query.
|
|
92
|
+
* We need to format the operand before adding it to the query.
|
|
93
|
+
*
|
|
94
|
+
* @export
|
|
95
|
+
* @param {string} query
|
|
96
|
+
* @param {OPERAND} operand
|
|
97
|
+
* @return {*} {Operand}
|
|
98
|
+
*/
|
|
99
|
+
export function buildOperand(query, operand) {
|
|
100
|
+
const newQuery = query + ` ${operand} `;
|
|
101
|
+
return new Operand(newQuery);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* This function builds a NOT operand to be used in a lucene query.
|
|
105
|
+
* We need to format the operand before adding it to the query.
|
|
106
|
+
*
|
|
107
|
+
* @export
|
|
108
|
+
* @param {string} query
|
|
109
|
+
* @return {*} {NotOperand}
|
|
110
|
+
*/
|
|
111
|
+
export function buildNotOperand(query) {
|
|
112
|
+
const newQuery = query + ` ${OPERAND.NOT} `;
|
|
113
|
+
return new NotOperand(newQuery);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../libs/sdk/client/src/lib/query-builder/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD;;;;;GAKG;AACH,MAAM,CAAN,IAAY,OAIX;AAJD,WAAY,OAAO;IACf,oBAAS,CAAA;IACT,sBAAW,CAAA;IACX,sBAAW,CAAA;AACf,CAAC,EAJW,OAAO,KAAP,OAAO,QAIlB;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IACxC,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AACnD,CAAC;AAED;;;;;;;;GAQ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NotOperand';
|
|
3
|
+
import { Operand } from './Operand';
|
|
4
|
+
/**
|
|
5
|
+
* 'Equal' Is a Typescript class that provides the ability to use terms in the lucene query string.
|
|
6
|
+
* A term is a value used to search for a specific value in a document. It can be a word or a phrase.
|
|
7
|
+
*
|
|
8
|
+
* Ex: myValue or "My Value"
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @class Equal
|
|
12
|
+
*/
|
|
13
|
+
export declare class Equals {
|
|
14
|
+
#private;
|
|
15
|
+
private query;
|
|
16
|
+
constructor(query: string);
|
|
17
|
+
/**
|
|
18
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
19
|
+
*
|
|
20
|
+
* Ex: "-myValue"
|
|
21
|
+
*
|
|
22
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
23
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
24
|
+
* @memberof Equal
|
|
25
|
+
*/
|
|
26
|
+
excludeField(field: string): Field;
|
|
27
|
+
/**
|
|
28
|
+
* This method appends to the query a field that should be included in the search.
|
|
29
|
+
*
|
|
30
|
+
* Ex: "+myField:"
|
|
31
|
+
*
|
|
32
|
+
* @param {string} field - The field that should be included in the search.
|
|
33
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
34
|
+
* @memberof Equal
|
|
35
|
+
*/
|
|
36
|
+
field(field: string): Field;
|
|
37
|
+
/**
|
|
38
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
39
|
+
*
|
|
40
|
+
* Ex: "OR"
|
|
41
|
+
*
|
|
42
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
43
|
+
* @memberof Equal
|
|
44
|
+
*/
|
|
45
|
+
or(): Operand;
|
|
46
|
+
/**
|
|
47
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
48
|
+
*
|
|
49
|
+
* Ex: "AND"
|
|
50
|
+
*
|
|
51
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
52
|
+
* @memberof Equal
|
|
53
|
+
*/
|
|
54
|
+
and(): Operand;
|
|
55
|
+
/**
|
|
56
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
57
|
+
*
|
|
58
|
+
* Ex: "NOT"
|
|
59
|
+
*
|
|
60
|
+
* @return {*} {NotOperand} - An instance of a Lucene Not Operand. A not operand is a logical operator used to exclude terms or phrases in a query.
|
|
61
|
+
* @memberof Equal
|
|
62
|
+
*/
|
|
63
|
+
not(): NotOperand;
|
|
64
|
+
/**
|
|
65
|
+
* This method allows to pass a raw query string to the query builder.
|
|
66
|
+
* This raw query should end in a Lucene Equal.
|
|
67
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
68
|
+
*
|
|
69
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
70
|
+
*
|
|
71
|
+
* @param {string} query - A raw query string.
|
|
72
|
+
* @return {*} {Equal} - An instance of a Lucene Equal. A term is a value used to search for a specific value in a document.
|
|
73
|
+
* @memberof QueryBuilder
|
|
74
|
+
*/
|
|
75
|
+
raw(query: string): Equals;
|
|
76
|
+
/**
|
|
77
|
+
* This method returns the final query string.
|
|
78
|
+
*
|
|
79
|
+
* @return {*} {string} - The final query string.
|
|
80
|
+
* @memberof Equal
|
|
81
|
+
*/
|
|
82
|
+
build(): string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var _Equals_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { OPERAND, buildExcludeField, buildField, buildNotOperand, buildOperand, buildRawEquals, sanitizeQuery } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* 'Equal' Is a Typescript class that provides the ability to use terms in the lucene query string.
|
|
6
|
+
* A term is a value used to search for a specific value in a document. It can be a word or a phrase.
|
|
7
|
+
*
|
|
8
|
+
* Ex: myValue or "My Value"
|
|
9
|
+
*
|
|
10
|
+
* @export
|
|
11
|
+
* @class Equal
|
|
12
|
+
*/
|
|
13
|
+
export class Equals {
|
|
14
|
+
constructor(query) {
|
|
15
|
+
this.query = query;
|
|
16
|
+
_Equals_query.set(this, '');
|
|
17
|
+
__classPrivateFieldSet(this, _Equals_query, this.query, "f");
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
21
|
+
*
|
|
22
|
+
* Ex: "-myValue"
|
|
23
|
+
*
|
|
24
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
25
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
26
|
+
* @memberof Equal
|
|
27
|
+
*/
|
|
28
|
+
excludeField(field) {
|
|
29
|
+
return buildExcludeField(__classPrivateFieldGet(this, _Equals_query, "f"), field);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* This method appends to the query a field that should be included in the search.
|
|
33
|
+
*
|
|
34
|
+
* Ex: "+myField:"
|
|
35
|
+
*
|
|
36
|
+
* @param {string} field - The field that should be included in the search.
|
|
37
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
38
|
+
* @memberof Equal
|
|
39
|
+
*/
|
|
40
|
+
field(field) {
|
|
41
|
+
return buildField(__classPrivateFieldGet(this, _Equals_query, "f"), field);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
45
|
+
*
|
|
46
|
+
* Ex: "OR"
|
|
47
|
+
*
|
|
48
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
49
|
+
* @memberof Equal
|
|
50
|
+
*/
|
|
51
|
+
or() {
|
|
52
|
+
return buildOperand(__classPrivateFieldGet(this, _Equals_query, "f"), OPERAND.OR);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
56
|
+
*
|
|
57
|
+
* Ex: "AND"
|
|
58
|
+
*
|
|
59
|
+
* @return {*} {Operand} - An instance of a Lucene Operand. An operand is a logical operator used to combine terms or phrases in a query.
|
|
60
|
+
* @memberof Equal
|
|
61
|
+
*/
|
|
62
|
+
and() {
|
|
63
|
+
return buildOperand(__classPrivateFieldGet(this, _Equals_query, "f"), OPERAND.AND);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* This method appends to the query an operand to use logic operators in the query.
|
|
67
|
+
*
|
|
68
|
+
* Ex: "NOT"
|
|
69
|
+
*
|
|
70
|
+
* @return {*} {NotOperand} - An instance of a Lucene Not Operand. A not operand is a logical operator used to exclude terms or phrases in a query.
|
|
71
|
+
* @memberof Equal
|
|
72
|
+
*/
|
|
73
|
+
not() {
|
|
74
|
+
return buildNotOperand(__classPrivateFieldGet(this, _Equals_query, "f"));
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This method allows to pass a raw query string to the query builder.
|
|
78
|
+
* This raw query should end in a Lucene Equal.
|
|
79
|
+
* This method is useful when you want to append a complex query or an already written query to the query builder.
|
|
80
|
+
*
|
|
81
|
+
* Ex: "+myField: value AND (someOtherValue OR anotherValue)"
|
|
82
|
+
*
|
|
83
|
+
* @param {string} query - A raw query string.
|
|
84
|
+
* @return {*} {Equal} - An instance of a Lucene Equal. A term is a value used to search for a specific value in a document.
|
|
85
|
+
* @memberof QueryBuilder
|
|
86
|
+
*/
|
|
87
|
+
raw(query) {
|
|
88
|
+
return buildRawEquals(__classPrivateFieldGet(this, _Equals_query, "f"), query);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This method returns the final query string.
|
|
92
|
+
*
|
|
93
|
+
* @return {*} {string} - The final query string.
|
|
94
|
+
* @memberof Equal
|
|
95
|
+
*/
|
|
96
|
+
build() {
|
|
97
|
+
return sanitizeQuery(__classPrivateFieldGet(this, _Equals_query, "f"));
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
_Equals_query = new WeakMap();
|
|
101
|
+
//# sourceMappingURL=Equals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Equals.js","sourceRoot":"","sources":["../../../../../../../../../libs/sdk/client/src/lib/query-builder/utils/lucene-syntax/Equals.ts"],"names":[],"mappings":";;AAIA,OAAO,EACH,OAAO,EACP,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,YAAY,EACZ,cAAc,EACd,aAAa,EAChB,MAAM,IAAI,CAAC;AAEZ;;;;;;;;GAQG;AACH,MAAM,OAAO,MAAM;IAGf,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFjC,wBAAS,EAAE,EAAC;QAGR,uBAAA,IAAI,iBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,iBAAiB,CAAC,uBAAA,IAAI,qBAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,UAAU,CAAC,uBAAA,IAAI,qBAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;OAOG;IACH,EAAE;QACE,OAAO,YAAY,CAAC,uBAAA,IAAI,qBAAO,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;OAOG;IACH,GAAG;QACC,OAAO,YAAY,CAAC,uBAAA,IAAI,qBAAO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC;IAED;;;;;;;OAOG;IACH,GAAG;QACC,OAAO,eAAe,CAAC,uBAAA,IAAI,qBAAO,CAAC,CAAC;IACxC,CAAC;IAED;;;;;;;;;;OAUG;IACH,GAAG,CAAC,KAAa;QACb,OAAO,cAAc,CAAC,uBAAA,IAAI,qBAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;OAKG;IACH,KAAK;QACD,OAAO,aAAa,CAAC,uBAAA,IAAI,qBAAO,CAAC,CAAC;IACtC,CAAC;CACJ"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Equals } from './Equals';
|
|
2
|
+
/**
|
|
3
|
+
* 'Field' class is used to build a query with a field.
|
|
4
|
+
* A Lucene Field is a key used to search for a specific value in a document.
|
|
5
|
+
*
|
|
6
|
+
* @export
|
|
7
|
+
* @class Field
|
|
8
|
+
*/
|
|
9
|
+
export declare class Field {
|
|
10
|
+
#private;
|
|
11
|
+
private query;
|
|
12
|
+
constructor(query: string);
|
|
13
|
+
/**
|
|
14
|
+
* This method appends to the query a term that should be included in the search..
|
|
15
|
+
*
|
|
16
|
+
* Ex: myValue or "My value"
|
|
17
|
+
*
|
|
18
|
+
* @param {string} term - The term that should be included in the search.
|
|
19
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
20
|
+
* @memberof Field
|
|
21
|
+
*/
|
|
22
|
+
equals(term: string): Equals;
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var _Field_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { buildEquals } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* 'Field' class is used to build a query with a field.
|
|
6
|
+
* A Lucene Field is a key used to search for a specific value in a document.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class Field
|
|
10
|
+
*/
|
|
11
|
+
export class Field {
|
|
12
|
+
constructor(query) {
|
|
13
|
+
this.query = query;
|
|
14
|
+
_Field_query.set(this, '');
|
|
15
|
+
__classPrivateFieldSet(this, _Field_query, this.query, "f");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This method appends to the query a term that should be included in the search..
|
|
19
|
+
*
|
|
20
|
+
* Ex: myValue or "My value"
|
|
21
|
+
*
|
|
22
|
+
* @param {string} term - The term that should be included in the search.
|
|
23
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
24
|
+
* @memberof Field
|
|
25
|
+
*/
|
|
26
|
+
equals(term) {
|
|
27
|
+
return buildEquals(__classPrivateFieldGet(this, _Field_query, "f"), term);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
_Field_query = new WeakMap();
|
|
31
|
+
//# sourceMappingURL=Field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Field.js","sourceRoot":"","sources":["../../../../../../../../../libs/sdk/client/src/lib/query-builder/utils/lucene-syntax/Field.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,OAAO,KAAK;IAEd,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QADjC,uBAAS,EAAE,EAAC;QAER,uBAAA,IAAI,gBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACf,OAAO,WAAW,CAAC,uBAAA,IAAI,oBAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Equals } from './Equals';
|
|
2
|
+
/**
|
|
3
|
+
* 'NotOperand' Is a Typescript class that provides the ability to use the NOT operand in the lucene query string.
|
|
4
|
+
*
|
|
5
|
+
* @export
|
|
6
|
+
* @class NotOperand
|
|
7
|
+
*/
|
|
8
|
+
export declare class NotOperand {
|
|
9
|
+
#private;
|
|
10
|
+
private query;
|
|
11
|
+
constructor(query: string);
|
|
12
|
+
/**
|
|
13
|
+
* This method appends to the query a term that should be included in the search.
|
|
14
|
+
*
|
|
15
|
+
* Ex: myValue or "My value"
|
|
16
|
+
*
|
|
17
|
+
* @param {string} term - The term that should be included in the search.
|
|
18
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
19
|
+
* @memberof NotOperand
|
|
20
|
+
*/
|
|
21
|
+
equals(term: string): Equals;
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
var _NotOperand_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { buildEquals } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* 'NotOperand' Is a Typescript class that provides the ability to use the NOT operand in the lucene query string.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class NotOperand
|
|
9
|
+
*/
|
|
10
|
+
export class NotOperand {
|
|
11
|
+
constructor(query) {
|
|
12
|
+
this.query = query;
|
|
13
|
+
_NotOperand_query.set(this, '');
|
|
14
|
+
__classPrivateFieldSet(this, _NotOperand_query, this.query, "f");
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This method appends to the query a term that should be included in the search.
|
|
18
|
+
*
|
|
19
|
+
* Ex: myValue or "My value"
|
|
20
|
+
*
|
|
21
|
+
* @param {string} term - The term that should be included in the search.
|
|
22
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
23
|
+
* @memberof NotOperand
|
|
24
|
+
*/
|
|
25
|
+
equals(term) {
|
|
26
|
+
return buildEquals(__classPrivateFieldGet(this, _NotOperand_query, "f"), term);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
_NotOperand_query = new WeakMap();
|
|
30
|
+
//# sourceMappingURL=NotOperand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotOperand.js","sourceRoot":"","sources":["../../../../../../../../../libs/sdk/client/src/lib/query-builder/utils/lucene-syntax/NotOperand.ts"],"names":[],"mappings":";;AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IAGnB,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFjC,4BAAS,EAAE,EAAC;QAGR,uBAAA,IAAI,qBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACf,OAAO,WAAW,CAAC,uBAAA,IAAI,yBAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Equals } from './Equals';
|
|
2
|
+
import { Field } from './Field';
|
|
3
|
+
/**
|
|
4
|
+
* 'Operand' Is a Typescript class that provides the ability to use operands in the lucene query string.}
|
|
5
|
+
* An operand is a logical operator used to join two or more conditions in a query.
|
|
6
|
+
*
|
|
7
|
+
* @export
|
|
8
|
+
* @class Operand
|
|
9
|
+
*/
|
|
10
|
+
export declare class Operand {
|
|
11
|
+
#private;
|
|
12
|
+
private query;
|
|
13
|
+
constructor(query: string);
|
|
14
|
+
/**
|
|
15
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
16
|
+
*
|
|
17
|
+
* Ex: "-myValue"
|
|
18
|
+
*
|
|
19
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
20
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
21
|
+
* @memberof Operand
|
|
22
|
+
*/
|
|
23
|
+
excludeField(field: string): Field;
|
|
24
|
+
/**
|
|
25
|
+
* This method appends to the query a field that should be included in the search.
|
|
26
|
+
*
|
|
27
|
+
* Ex: "+myField:"
|
|
28
|
+
*
|
|
29
|
+
* @param {string} field - The field that should be included in the search.
|
|
30
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
31
|
+
* @memberof Operand
|
|
32
|
+
*/
|
|
33
|
+
field(field: string): Field;
|
|
34
|
+
/**
|
|
35
|
+
* This method appends to the query a term that should be included in the search.
|
|
36
|
+
*
|
|
37
|
+
* Ex: myValue or "My value"
|
|
38
|
+
*
|
|
39
|
+
* @param {string} term - The term that should be included in the search.
|
|
40
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
41
|
+
* @memberof Operand
|
|
42
|
+
*/
|
|
43
|
+
equals(term: string): Equals;
|
|
44
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var _Operand_query;
|
|
2
|
+
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
+
import { buildExcludeField, buildField, buildEquals } from '..';
|
|
4
|
+
/**
|
|
5
|
+
* 'Operand' Is a Typescript class that provides the ability to use operands in the lucene query string.}
|
|
6
|
+
* An operand is a logical operator used to join two or more conditions in a query.
|
|
7
|
+
*
|
|
8
|
+
* @export
|
|
9
|
+
* @class Operand
|
|
10
|
+
*/
|
|
11
|
+
export class Operand {
|
|
12
|
+
constructor(query) {
|
|
13
|
+
this.query = query;
|
|
14
|
+
_Operand_query.set(this, '');
|
|
15
|
+
__classPrivateFieldSet(this, _Operand_query, this.query, "f");
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* This method appends to the query a term that should be excluded in the search.
|
|
19
|
+
*
|
|
20
|
+
* Ex: "-myValue"
|
|
21
|
+
*
|
|
22
|
+
* @param {string} field - The field that should be excluded in the search.
|
|
23
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
24
|
+
* @memberof Operand
|
|
25
|
+
*/
|
|
26
|
+
excludeField(field) {
|
|
27
|
+
return buildExcludeField(__classPrivateFieldGet(this, _Operand_query, "f"), field);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* This method appends to the query a field that should be included in the search.
|
|
31
|
+
*
|
|
32
|
+
* Ex: "+myField:"
|
|
33
|
+
*
|
|
34
|
+
* @param {string} field - The field that should be included in the search.
|
|
35
|
+
* @return {*} {Field} - An instance of a Lucene Field. A field is a key used to search for a specific value in a document.
|
|
36
|
+
* @memberof Operand
|
|
37
|
+
*/
|
|
38
|
+
field(field) {
|
|
39
|
+
return buildField(__classPrivateFieldGet(this, _Operand_query, "f"), field);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* This method appends to the query a term that should be included in the search.
|
|
43
|
+
*
|
|
44
|
+
* Ex: myValue or "My value"
|
|
45
|
+
*
|
|
46
|
+
* @param {string} term - The term that should be included in the search.
|
|
47
|
+
* @return {*} {Equals} - An instance of Equals.
|
|
48
|
+
* @memberof Operand
|
|
49
|
+
*/
|
|
50
|
+
equals(term) {
|
|
51
|
+
return buildEquals(__classPrivateFieldGet(this, _Operand_query, "f"), term);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
_Operand_query = new WeakMap();
|
|
55
|
+
//# sourceMappingURL=Operand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Operand.js","sourceRoot":"","sources":["../../../../../../../../../libs/sdk/client/src/lib/query-builder/utils/lucene-syntax/Operand.ts"],"names":[],"mappings":";;AAGA,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,OAAO,OAAO;IAGhB,YAAoB,KAAa;QAAb,UAAK,GAAL,KAAK,CAAQ;QAFjC,yBAAS,EAAE,EAAC;QAGR,uBAAA,IAAI,kBAAU,IAAI,CAAC,KAAK,MAAA,CAAC;IAC7B,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAC,KAAa;QACtB,OAAO,iBAAiB,CAAC,uBAAA,IAAI,sBAAO,EAAE,KAAK,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,KAAa;QACf,OAAO,UAAU,CAAC,uBAAA,IAAI,sBAAO,EAAE,KAAK,CAAC,CAAC;IAC1C,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,IAAY;QACf,OAAO,WAAW,CAAC,uBAAA,IAAI,sBAAO,EAAE,IAAI,CAAC,CAAC;IAC1C,CAAC;CACJ"}
|