@pepperi-addons/ngx-lib-react 0.5.11 → 0.5.12
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/elements/3rdpartylicenses.txt +28 -0
- package/elements/main.js +1 -1
- package/elements/register.auto.js +1 -0
- package/elements/register.js +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +1 -1
- package/pep-query-builder.d.ts +20 -0
- package/pep-query-builder.js +34 -0
package/index.d.ts
CHANGED
|
@@ -29,5 +29,6 @@ export { PepAddress } from './pep-address.js';
|
|
|
29
29
|
export { PepTopBar } from './pep-top-bar.js';
|
|
30
30
|
export { PepListChooser } from './pep-list-chooser.js';
|
|
31
31
|
export * from './pep-color-picker.js';
|
|
32
|
+
export * from './pep-query-builder.js';
|
|
32
33
|
export { PepRichHtmlTextarea } from './pep-rich-html-textarea.js';
|
|
33
34
|
export * from './services.js';
|
package/index.js
CHANGED
|
@@ -29,6 +29,7 @@ export { PepAddress } from './pep-address.js';
|
|
|
29
29
|
export { PepTopBar } from './pep-top-bar.js';
|
|
30
30
|
export { PepListChooser } from './pep-list-chooser.js';
|
|
31
31
|
export * from './pep-color-picker.js';
|
|
32
|
+
export * from './pep-query-builder.js';
|
|
32
33
|
export { PepRichHtmlTextarea } from './pep-rich-html-textarea.js';
|
|
33
34
|
// Export all service helpers (bridge-based access to Angular services)
|
|
34
35
|
export * from './services.js';
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface PepQueryBuilderField {
|
|
3
|
+
FieldID: string;
|
|
4
|
+
FieldType: string;
|
|
5
|
+
Title: string;
|
|
6
|
+
OptionalValues?: Array<{
|
|
7
|
+
Key: string;
|
|
8
|
+
Value: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export interface PepQueryBuilderProps extends React.HTMLAttributes<HTMLElement> {
|
|
12
|
+
keyProp?: string;
|
|
13
|
+
query?: any;
|
|
14
|
+
fields?: PepQueryBuilderField[];
|
|
15
|
+
variableFields?: PepQueryBuilderField[];
|
|
16
|
+
maxDepth?: number;
|
|
17
|
+
onQueryChange?: (query: any) => void;
|
|
18
|
+
onFormValidationChange?: (isValid: boolean) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare const PepQueryBuilder: React.FC<PepQueryBuilderProps>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
export const PepQueryBuilder = ({ keyProp, query, fields, variableFields, maxDepth, onQueryChange, onFormValidationChange, ...rest }) => {
|
|
4
|
+
const ref = useRef(null);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const el = ref.current;
|
|
7
|
+
if (!el)
|
|
8
|
+
return;
|
|
9
|
+
if (typeof query !== 'undefined')
|
|
10
|
+
el.query = query;
|
|
11
|
+
if (typeof fields !== 'undefined')
|
|
12
|
+
el.fields = fields;
|
|
13
|
+
if (typeof variableFields !== 'undefined')
|
|
14
|
+
el.variableFields = variableFields;
|
|
15
|
+
if (typeof maxDepth !== 'undefined')
|
|
16
|
+
el.maxDepth = maxDepth;
|
|
17
|
+
}, [query, fields, variableFields, maxDepth]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const el = ref.current;
|
|
20
|
+
if (!el)
|
|
21
|
+
return;
|
|
22
|
+
const handlers = [];
|
|
23
|
+
if (onQueryChange) {
|
|
24
|
+
handlers.push(['queryChange', (e) => { var _a; return onQueryChange((_a = e.detail) !== null && _a !== void 0 ? _a : e); }]);
|
|
25
|
+
}
|
|
26
|
+
if (onFormValidationChange) {
|
|
27
|
+
handlers.push(['formValidationChange', (e) => { var _a; return onFormValidationChange(!!((_a = e.detail) !== null && _a !== void 0 ? _a : e)); }]);
|
|
28
|
+
}
|
|
29
|
+
handlers.forEach(([n, h]) => el.addEventListener(n, h));
|
|
30
|
+
return () => handlers.forEach(([n, h]) => el.removeEventListener(n, h));
|
|
31
|
+
}, [onQueryChange, onFormValidationChange]);
|
|
32
|
+
return _jsx("pep-query-builder-element", { ref: ref, ...rest }, keyProp);
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=pep-query-builder.js.map
|