@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260728103223 → 0.8.1-dev.20260731062325
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/{InputControlClient-IKTP3566.mjs → InputControlClient-XR37ZIQ2.mjs} +13 -5
- package/dist/{Pagination-Y7PNQUJ2.mjs → Pagination-YKNCYVXV.mjs} +2 -2
- package/dist/{chunk-6GS7N4EV.mjs → chunk-65QPOTZ4.mjs} +66 -32
- package/dist/{chunk-6MHIZOLR.mjs → chunk-KL2YKXXS.mjs} +1 -1
- package/dist/{chunk-GFVCUX6O.mjs → chunk-YDPISYMP.mjs} +2 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +485 -434
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
|
@@ -21,12 +21,12 @@ import {
|
|
|
21
21
|
Select_default,
|
|
22
22
|
Switcher_default,
|
|
23
23
|
TimeInput_default
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-65QPOTZ4.mjs";
|
|
25
25
|
import {
|
|
26
26
|
Hyperlink,
|
|
27
27
|
Icon_default,
|
|
28
28
|
InputControlType_default
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-YDPISYMP.mjs";
|
|
30
30
|
import {
|
|
31
31
|
Button_default,
|
|
32
32
|
ClientButton_default
|
|
@@ -557,8 +557,15 @@ var SwitchInput = (props) => {
|
|
|
557
557
|
};
|
|
558
558
|
var SwitchInput_default = SwitchInput;
|
|
559
559
|
|
|
560
|
-
// src/components/controls/edit/
|
|
560
|
+
// src/components/controls/edit/ReferenceInput.tsx
|
|
561
561
|
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
562
|
+
var ReferenceInput = (props) => {
|
|
563
|
+
return /* @__PURE__ */ jsx4(SelectWithSearchInput_default, { ...props });
|
|
564
|
+
};
|
|
565
|
+
var ReferenceInput_default = ReferenceInput;
|
|
566
|
+
|
|
567
|
+
// src/components/controls/edit/InputControlClient.tsx
|
|
568
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
562
569
|
var InputControl = React4.forwardRef(
|
|
563
570
|
(props, ref) => {
|
|
564
571
|
const ControlComponents = {
|
|
@@ -583,10 +590,11 @@ var InputControl = React4.forwardRef(
|
|
|
583
590
|
[InputControlType_default.switchInput]: SwitchInput_default,
|
|
584
591
|
[InputControlType_default.dateInput]: DateInput_default,
|
|
585
592
|
[InputControlType_default.radioInput]: RadioInput_default,
|
|
586
|
-
[InputControlType_default.switcher]: Switcher_default
|
|
593
|
+
[InputControlType_default.switcher]: Switcher_default,
|
|
594
|
+
[InputControlType_default.referenceInput]: ReferenceInput_default
|
|
587
595
|
};
|
|
588
596
|
const SelectedControlComponent = ControlComponents[props.controlType];
|
|
589
|
-
return /* @__PURE__ */
|
|
597
|
+
return /* @__PURE__ */ jsx5(React4.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found:" + props.controlType });
|
|
590
598
|
}
|
|
591
599
|
);
|
|
592
600
|
InputControl.displayName = "InputControl";
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
import {
|
|
5
5
|
OdataBuilder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KL2YKXXS.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Constants,
|
|
9
9
|
Hyperlink,
|
|
10
10
|
Icon_default
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-YDPISYMP.mjs";
|
|
12
12
|
import "./chunk-IMNQO57B.mjs";
|
|
13
13
|
|
|
14
14
|
// src/components/Pagination.tsx
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
Icon_default
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-YDPISYMP.mjs";
|
|
6
6
|
|
|
7
7
|
// src/components/controls/edit/MultilineTextInput.tsx
|
|
8
8
|
import React from "react";
|
|
@@ -662,50 +662,73 @@ var ColorInput = (props) => {
|
|
|
662
662
|
var ColorInput_default = ColorInput;
|
|
663
663
|
|
|
664
664
|
// src/components/controls/edit/SelectWithSearchInput.tsx
|
|
665
|
-
import { useEffect as useEffect3, useRef, useState as useState2 } from "react";
|
|
665
|
+
import React12, { useEffect as useEffect3, useRef, useState as useState2 } from "react";
|
|
666
666
|
import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
667
667
|
var SelectWithSearchInput = (props) => {
|
|
668
668
|
const [isOpen, setIsOpen] = useState2(false);
|
|
669
669
|
const [searchTerm, setSearchTerm] = useState2("");
|
|
670
670
|
const [highlightedIndex, setHighlightedIndex] = useState2(-1);
|
|
671
|
-
const [selectedItem, setSelectedItem] = useState2(
|
|
671
|
+
const [selectedItem, setSelectedItem] = useState2(
|
|
672
|
+
null
|
|
673
|
+
);
|
|
672
674
|
const [list, setList] = useState2([]);
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
675
|
+
const loadData = React12.useCallback(async () => {
|
|
676
|
+
if (props.dataset) {
|
|
677
|
+
setList(props.dataset);
|
|
678
|
+
return;
|
|
679
|
+
}
|
|
680
|
+
if (props.dataSource && props.serviceClient) {
|
|
681
|
+
let url = props.dataSource;
|
|
682
|
+
if (props.dataSourceDependsOn && props.dependentValue) {
|
|
683
|
+
url = url.replace(
|
|
684
|
+
`{${props.dataSourceDependsOn}}`,
|
|
685
|
+
props.dependentValue
|
|
686
|
+
);
|
|
687
|
+
}
|
|
688
|
+
const response = await props.serviceClient.get(url);
|
|
689
|
+
if (response?.result) {
|
|
690
|
+
setList(response.result);
|
|
687
691
|
}
|
|
688
692
|
}
|
|
689
|
-
fetchData();
|
|
690
693
|
}, [
|
|
691
|
-
props.dataSource,
|
|
692
|
-
props.dependentValue,
|
|
693
694
|
props.dataset,
|
|
694
|
-
props.
|
|
695
|
+
props.dataSource,
|
|
696
|
+
props.serviceClient,
|
|
697
|
+
props.dataSourceDependsOn,
|
|
698
|
+
props.dependentValue
|
|
695
699
|
]);
|
|
696
|
-
|
|
697
|
-
(
|
|
698
|
-
);
|
|
700
|
+
useEffect3(() => {
|
|
701
|
+
loadData();
|
|
702
|
+
}, [loadData]);
|
|
703
|
+
useEffect3(() => {
|
|
704
|
+
if (props.value && list.length && props.dataKeyFieldName && props.dataTextFieldName) {
|
|
705
|
+
const selected = list.find(
|
|
706
|
+
(x) => x[props.dataKeyFieldName] == props.value
|
|
707
|
+
);
|
|
708
|
+
if (selected) {
|
|
709
|
+
setSearchTerm(selected[props.dataTextFieldName]);
|
|
710
|
+
setSelectedItem(selected);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}, [props.value, list]);
|
|
714
|
+
const filteredItems = list.filter((item) => {
|
|
715
|
+
const text = item[props.dataTextFieldName] ?? "";
|
|
716
|
+
return text.toString().toLowerCase().includes(searchTerm.toLowerCase());
|
|
717
|
+
});
|
|
699
718
|
const handleSelect = (event, item) => {
|
|
700
719
|
event.preventDefault();
|
|
701
720
|
setSearchTerm(item[props.dataTextFieldName]);
|
|
702
721
|
setSelectedItem(item);
|
|
703
722
|
setIsOpen(false);
|
|
704
723
|
setHighlightedIndex(-1);
|
|
724
|
+
const selectedValue = item[props.dataKeyFieldName];
|
|
725
|
+
if (props.onChange) {
|
|
726
|
+
props.onChange(selectedValue);
|
|
727
|
+
}
|
|
705
728
|
if (props.callback) {
|
|
706
729
|
props.callback({
|
|
707
730
|
name: props.name,
|
|
708
|
-
value:
|
|
731
|
+
value: selectedValue,
|
|
709
732
|
index: props.index,
|
|
710
733
|
groupKey: props.groupKey
|
|
711
734
|
});
|
|
@@ -734,11 +757,11 @@ var SelectWithSearchInput = (props) => {
|
|
|
734
757
|
});
|
|
735
758
|
}
|
|
736
759
|
}, [highlightedIndex]);
|
|
760
|
+
const isReadOnly = props.attributes?.readOnly || props.disable || props.attributes?.disable;
|
|
737
761
|
return /* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
738
|
-
/* @__PURE__ */ jsxs12("label", { children: [
|
|
762
|
+
/* @__PURE__ */ jsxs12("label", { className: "pb-1", children: [
|
|
739
763
|
props.attributes?.label,
|
|
740
764
|
" ",
|
|
741
|
-
" ",
|
|
742
765
|
props?.attributes?.required && /* @__PURE__ */ jsx12("span", { className: "bg-error-weak", children: "*" })
|
|
743
766
|
] }),
|
|
744
767
|
/* @__PURE__ */ jsxs12("div", { className: "relative", children: [
|
|
@@ -754,15 +777,26 @@ var SelectWithSearchInput = (props) => {
|
|
|
754
777
|
},
|
|
755
778
|
onFocus: () => setIsOpen(true),
|
|
756
779
|
onKeyDown: handleKeyDown,
|
|
757
|
-
placeholder:
|
|
758
|
-
|
|
780
|
+
placeholder: props.attributes?.placeholder ?? "Search...",
|
|
781
|
+
readOnly: isReadOnly,
|
|
782
|
+
disabled: props.disable || props.attributes?.disable,
|
|
783
|
+
className: `peer mt-2 py-1.5 select block w-full text-black rounded border-gray-300 shadow-sm
|
|
784
|
+
focus:border-indigo-300 focus:ring focus:ring-indigo-200 focus:ring-opacity-50
|
|
785
|
+
disabled:bg-slate-50 disabled:text-slate-500 disabled:border-slate-200 disabled:shadow-none
|
|
786
|
+
${isReadOnly ? "bg-neutral-soft opacity-50 cursor-not-allowed" : "bg-default"}
|
|
787
|
+
`
|
|
759
788
|
}
|
|
760
789
|
),
|
|
761
790
|
/* @__PURE__ */ jsx12(
|
|
762
791
|
"button",
|
|
763
792
|
{
|
|
764
793
|
type: "button",
|
|
765
|
-
|
|
794
|
+
disabled: isReadOnly,
|
|
795
|
+
onClick: () => {
|
|
796
|
+
if (!isReadOnly) {
|
|
797
|
+
setIsOpen(!isOpen);
|
|
798
|
+
}
|
|
799
|
+
},
|
|
766
800
|
className: "absolute right-2 top-3 h-5 w-5 text-gray-500 focus:outline-none",
|
|
767
801
|
children: /* @__PURE__ */ jsx12(
|
|
768
802
|
"svg",
|
|
@@ -786,11 +820,11 @@ var SelectWithSearchInput = (props) => {
|
|
|
786
820
|
}
|
|
787
821
|
)
|
|
788
822
|
] }),
|
|
789
|
-
isOpen && /* @__PURE__ */ jsx12(
|
|
823
|
+
!isReadOnly && isOpen && /* @__PURE__ */ jsx12(
|
|
790
824
|
"div",
|
|
791
825
|
{
|
|
792
826
|
ref: dropdownRef,
|
|
793
|
-
className: "absolute z-10
|
|
827
|
+
className: "absolute z-10 w-full bg-default border border-gray-200 shadow-lg max-h-48 overflow-y-auto",
|
|
794
828
|
children: filteredItems.length > 0 ? filteredItems.map((item, index) => /* @__PURE__ */ jsx12(
|
|
795
829
|
"button",
|
|
796
830
|
{
|
|
@@ -31,7 +31,8 @@ var InputControlType = {
|
|
|
31
31
|
dateInput: "dateInput",
|
|
32
32
|
radioInput: "radioInput",
|
|
33
33
|
switcher: "switcher",
|
|
34
|
-
videoInput: "videoInput"
|
|
34
|
+
videoInput: "videoInput",
|
|
35
|
+
referenceInput: "referenceInput"
|
|
35
36
|
};
|
|
36
37
|
var InputControlType_default = InputControlType;
|
|
37
38
|
|
package/dist/index.d.mts
CHANGED
|
@@ -68,6 +68,7 @@ declare const InputControlType: {
|
|
|
68
68
|
radioInput: string;
|
|
69
69
|
switcher: string;
|
|
70
70
|
videoInput: string;
|
|
71
|
+
referenceInput: string;
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
interface InputCallbackValues<T> {
|
|
@@ -144,6 +145,8 @@ interface InputControlProps {
|
|
|
144
145
|
isTenantColor?: boolean;
|
|
145
146
|
onChange?: (value: string | number | boolean | null) => void;
|
|
146
147
|
onBlur?: () => void;
|
|
148
|
+
referenceWorkflowId?: number;
|
|
149
|
+
loadSelectedItem?: (id: string | number) => Promise<any>;
|
|
147
150
|
attributes?: {
|
|
148
151
|
pattern?: string;
|
|
149
152
|
maxLength?: number;
|
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,7 @@ declare const InputControlType: {
|
|
|
68
68
|
radioInput: string;
|
|
69
69
|
switcher: string;
|
|
70
70
|
videoInput: string;
|
|
71
|
+
referenceInput: string;
|
|
71
72
|
};
|
|
72
73
|
|
|
73
74
|
interface InputCallbackValues<T> {
|
|
@@ -144,6 +145,8 @@ interface InputControlProps {
|
|
|
144
145
|
isTenantColor?: boolean;
|
|
145
146
|
onChange?: (value: string | number | boolean | null) => void;
|
|
146
147
|
onBlur?: () => void;
|
|
148
|
+
referenceWorkflowId?: number;
|
|
149
|
+
loadSelectedItem?: (id: string | number) => Promise<any>;
|
|
147
150
|
attributes?: {
|
|
148
151
|
pattern?: string;
|
|
149
152
|
maxLength?: number;
|