@tecof/theme-editor 0.0.27 → 0.0.29
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.d.mts +119 -2
- package/dist/index.d.ts +119 -2
- package/dist/index.js +745 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +741 -45
- package/dist/index.mjs.map +1 -1
- package/dist/styles.css +609 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -16,7 +16,7 @@ import Blockquote from '@tiptap/extension-blockquote';
|
|
|
16
16
|
import HardBreak from '@tiptap/extension-hard-break';
|
|
17
17
|
import HorizontalRule from '@tiptap/extension-horizontal-rule';
|
|
18
18
|
import TextAlign from '@tiptap/extension-text-align';
|
|
19
|
-
import
|
|
19
|
+
import Link3 from '@tiptap/extension-link';
|
|
20
20
|
import Code2 from '@tiptap/extension-code';
|
|
21
21
|
import CodeBlock from '@tiptap/extension-code-block';
|
|
22
22
|
import * as ReactDOM from 'react-dom';
|
|
@@ -221,6 +221,49 @@ var TecofApiClient = class {
|
|
|
221
221
|
return null;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
+
/**
|
|
225
|
+
* Fetch CMS collections list (for CmsCollectionField)
|
|
226
|
+
* Returns: [{ _id, name, slug, fields, ... }]
|
|
227
|
+
*/
|
|
228
|
+
async getCmsCollections() {
|
|
229
|
+
try {
|
|
230
|
+
const res2 = await fetch(`${this.apiUrl}/api/store/cms/collections`, {
|
|
231
|
+
method: "POST",
|
|
232
|
+
headers: this.headers,
|
|
233
|
+
body: JSON.stringify({})
|
|
234
|
+
});
|
|
235
|
+
return await res2.json();
|
|
236
|
+
} catch (error2) {
|
|
237
|
+
return {
|
|
238
|
+
success: false,
|
|
239
|
+
message: error2 instanceof Error ? error2.message : "Failed to fetch collections"
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Fetch items from a CMS collection by slug
|
|
245
|
+
* Returns: { items: [...], totalData: N }
|
|
246
|
+
*/
|
|
247
|
+
async getCmsCollectionItems(collectionSlug, options) {
|
|
248
|
+
try {
|
|
249
|
+
const res2 = await fetch(`${this.apiUrl}/api/store/cms/collections/${encodeURIComponent(collectionSlug)}/items`, {
|
|
250
|
+
method: "POST",
|
|
251
|
+
headers: this.headers,
|
|
252
|
+
body: JSON.stringify({
|
|
253
|
+
page: options?.page || 1,
|
|
254
|
+
limit: options?.limit || 50,
|
|
255
|
+
sort: options?.sort || "newest",
|
|
256
|
+
locale: options?.locale
|
|
257
|
+
})
|
|
258
|
+
});
|
|
259
|
+
return await res2.json();
|
|
260
|
+
} catch (error2) {
|
|
261
|
+
return {
|
|
262
|
+
success: false,
|
|
263
|
+
message: error2 instanceof Error ? error2.message : "Failed to fetch collection items"
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
224
267
|
/** CDN base URL (defaults to apiUrl if not set) */
|
|
225
268
|
get cdnUrl() {
|
|
226
269
|
return this.customCdnUrl || this.apiUrl;
|
|
@@ -459,9 +502,16 @@ var TecofEditor = ({
|
|
|
459
502
|
saving && /* @__PURE__ */ jsx("div", { className: "tecof-editor-save-indicator", children: saveStatus === "error" ? "Save failed" : "Saving..." })
|
|
460
503
|
] });
|
|
461
504
|
};
|
|
462
|
-
var TecofRender = ({ data: data3, config: config3, className }) => {
|
|
505
|
+
var TecofRender = ({ data: data3, config: config3, className, cmsData }) => {
|
|
463
506
|
if (!data3) return null;
|
|
464
|
-
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
507
|
+
return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
|
|
508
|
+
Render,
|
|
509
|
+
{
|
|
510
|
+
config: config3,
|
|
511
|
+
data: data3,
|
|
512
|
+
metadata: { cmsData: cmsData || null }
|
|
513
|
+
}
|
|
514
|
+
) });
|
|
465
515
|
};
|
|
466
516
|
var IMAGE_EXTENSIONS = ["png", "jpg", "jpeg", "webp", "gif", "svg", "avif", "bmp", "tiff", "heic"];
|
|
467
517
|
var VIDEO_EXTENSIONS = ["mp4", "webm", "ogg", "avi", "mov", "quicktime"];
|
|
@@ -727,34 +777,46 @@ var createLucideIcon = (iconName, iconNode) => {
|
|
|
727
777
|
var __iconNode = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
|
|
728
778
|
var Check = createLucideIcon("check", __iconNode);
|
|
729
779
|
|
|
780
|
+
// node_modules/lucide-react/dist/esm/icons/chevron-down.js
|
|
781
|
+
var __iconNode2 = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
|
|
782
|
+
var ChevronDown = createLucideIcon("chevron-down", __iconNode2);
|
|
783
|
+
|
|
730
784
|
// node_modules/lucide-react/dist/esm/icons/chevron-right.js
|
|
731
|
-
var
|
|
732
|
-
var ChevronRight = createLucideIcon("chevron-right",
|
|
785
|
+
var __iconNode3 = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
|
|
786
|
+
var ChevronRight = createLucideIcon("chevron-right", __iconNode3);
|
|
733
787
|
|
|
734
788
|
// node_modules/lucide-react/dist/esm/icons/code.js
|
|
735
|
-
var
|
|
789
|
+
var __iconNode4 = [
|
|
736
790
|
["path", { d: "m16 18 6-6-6-6", key: "eg8j8" }],
|
|
737
791
|
["path", { d: "m8 6-6 6 6 6", key: "ppft3o" }]
|
|
738
792
|
];
|
|
739
|
-
var Code = createLucideIcon("code",
|
|
793
|
+
var Code = createLucideIcon("code", __iconNode4);
|
|
740
794
|
|
|
741
795
|
// node_modules/lucide-react/dist/esm/icons/copy.js
|
|
742
|
-
var
|
|
796
|
+
var __iconNode5 = [
|
|
743
797
|
["rect", { width: "14", height: "14", x: "8", y: "8", rx: "2", ry: "2", key: "17jyea" }],
|
|
744
798
|
["path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2", key: "zix9uf" }]
|
|
745
799
|
];
|
|
746
|
-
var Copy = createLucideIcon("copy",
|
|
800
|
+
var Copy = createLucideIcon("copy", __iconNode5);
|
|
801
|
+
|
|
802
|
+
// node_modules/lucide-react/dist/esm/icons/database.js
|
|
803
|
+
var __iconNode6 = [
|
|
804
|
+
["ellipse", { cx: "12", cy: "5", rx: "9", ry: "3", key: "msslwz" }],
|
|
805
|
+
["path", { d: "M3 5V19A9 3 0 0 0 21 19V5", key: "1wlel7" }],
|
|
806
|
+
["path", { d: "M3 12A9 3 0 0 0 21 12", key: "mv7ke4" }]
|
|
807
|
+
];
|
|
808
|
+
var Database = createLucideIcon("database", __iconNode6);
|
|
747
809
|
|
|
748
810
|
// node_modules/lucide-react/dist/esm/icons/external-link.js
|
|
749
|
-
var
|
|
811
|
+
var __iconNode7 = [
|
|
750
812
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
751
813
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
752
814
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
753
815
|
];
|
|
754
|
-
var ExternalLink = createLucideIcon("external-link",
|
|
816
|
+
var ExternalLink = createLucideIcon("external-link", __iconNode7);
|
|
755
817
|
|
|
756
818
|
// node_modules/lucide-react/dist/esm/icons/file-text.js
|
|
757
|
-
var
|
|
819
|
+
var __iconNode8 = [
|
|
758
820
|
[
|
|
759
821
|
"path",
|
|
760
822
|
{
|
|
@@ -767,10 +829,10 @@ var __iconNode6 = [
|
|
|
767
829
|
["path", { d: "M16 13H8", key: "t4e002" }],
|
|
768
830
|
["path", { d: "M16 17H8", key: "z1uh3a" }]
|
|
769
831
|
];
|
|
770
|
-
var FileText = createLucideIcon("file-text",
|
|
832
|
+
var FileText = createLucideIcon("file-text", __iconNode8);
|
|
771
833
|
|
|
772
834
|
// node_modules/lucide-react/dist/esm/icons/file.js
|
|
773
|
-
var
|
|
835
|
+
var __iconNode9 = [
|
|
774
836
|
[
|
|
775
837
|
"path",
|
|
776
838
|
{
|
|
@@ -780,10 +842,10 @@ var __iconNode7 = [
|
|
|
780
842
|
],
|
|
781
843
|
["path", { d: "M14 2v5a1 1 0 0 0 1 1h5", key: "wfsgrz" }]
|
|
782
844
|
];
|
|
783
|
-
var File2 = createLucideIcon("file",
|
|
845
|
+
var File2 = createLucideIcon("file", __iconNode9);
|
|
784
846
|
|
|
785
847
|
// node_modules/lucide-react/dist/esm/icons/folder-open.js
|
|
786
|
-
var
|
|
848
|
+
var __iconNode10 = [
|
|
787
849
|
[
|
|
788
850
|
"path",
|
|
789
851
|
{
|
|
@@ -792,36 +854,47 @@ var __iconNode8 = [
|
|
|
792
854
|
}
|
|
793
855
|
]
|
|
794
856
|
];
|
|
795
|
-
var FolderOpen = createLucideIcon("folder-open",
|
|
857
|
+
var FolderOpen = createLucideIcon("folder-open", __iconNode10);
|
|
796
858
|
|
|
797
859
|
// node_modules/lucide-react/dist/esm/icons/globe.js
|
|
798
|
-
var
|
|
860
|
+
var __iconNode11 = [
|
|
799
861
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
800
862
|
["path", { d: "M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20", key: "13o1zl" }],
|
|
801
863
|
["path", { d: "M2 12h20", key: "9i4pu4" }]
|
|
802
864
|
];
|
|
803
|
-
var Globe = createLucideIcon("globe",
|
|
865
|
+
var Globe = createLucideIcon("globe", __iconNode11);
|
|
866
|
+
|
|
867
|
+
// node_modules/lucide-react/dist/esm/icons/grip-vertical.js
|
|
868
|
+
var __iconNode12 = [
|
|
869
|
+
["circle", { cx: "9", cy: "12", r: "1", key: "1vctgf" }],
|
|
870
|
+
["circle", { cx: "9", cy: "5", r: "1", key: "hp0tcf" }],
|
|
871
|
+
["circle", { cx: "9", cy: "19", r: "1", key: "fkjjf6" }],
|
|
872
|
+
["circle", { cx: "15", cy: "12", r: "1", key: "1tmaij" }],
|
|
873
|
+
["circle", { cx: "15", cy: "5", r: "1", key: "19l28e" }],
|
|
874
|
+
["circle", { cx: "15", cy: "19", r: "1", key: "f4zoj3" }]
|
|
875
|
+
];
|
|
876
|
+
var GripVertical = createLucideIcon("grip-vertical", __iconNode12);
|
|
804
877
|
|
|
805
878
|
// node_modules/lucide-react/dist/esm/icons/image-plus.js
|
|
806
|
-
var
|
|
879
|
+
var __iconNode13 = [
|
|
807
880
|
["path", { d: "M16 5h6", key: "1vod17" }],
|
|
808
881
|
["path", { d: "M19 2v6", key: "4bpg5p" }],
|
|
809
882
|
["path", { d: "M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5", key: "1ue2ih" }],
|
|
810
883
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }],
|
|
811
884
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }]
|
|
812
885
|
];
|
|
813
|
-
var ImagePlus = createLucideIcon("image-plus",
|
|
886
|
+
var ImagePlus = createLucideIcon("image-plus", __iconNode13);
|
|
814
887
|
|
|
815
888
|
// node_modules/lucide-react/dist/esm/icons/image.js
|
|
816
|
-
var
|
|
889
|
+
var __iconNode14 = [
|
|
817
890
|
["rect", { width: "18", height: "18", x: "3", y: "3", rx: "2", ry: "2", key: "1m3agn" }],
|
|
818
891
|
["circle", { cx: "9", cy: "9", r: "2", key: "af1f0g" }],
|
|
819
892
|
["path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21", key: "1xmnt7" }]
|
|
820
893
|
];
|
|
821
|
-
var Image2 = createLucideIcon("image",
|
|
894
|
+
var Image2 = createLucideIcon("image", __iconNode14);
|
|
822
895
|
|
|
823
896
|
// node_modules/lucide-react/dist/esm/icons/languages.js
|
|
824
|
-
var
|
|
897
|
+
var __iconNode15 = [
|
|
825
898
|
["path", { d: "m5 8 6 6", key: "1wu5hv" }],
|
|
826
899
|
["path", { d: "m4 14 6-6 2-3", key: "1k1g8d" }],
|
|
827
900
|
["path", { d: "M2 5h12", key: "or177f" }],
|
|
@@ -829,21 +902,29 @@ var __iconNode12 = [
|
|
|
829
902
|
["path", { d: "m22 22-5-10-5 10", key: "don7ne" }],
|
|
830
903
|
["path", { d: "M14 18h6", key: "1m8k6r" }]
|
|
831
904
|
];
|
|
832
|
-
var Languages = createLucideIcon("languages",
|
|
905
|
+
var Languages = createLucideIcon("languages", __iconNode15);
|
|
906
|
+
|
|
907
|
+
// node_modules/lucide-react/dist/esm/icons/link-2.js
|
|
908
|
+
var __iconNode16 = [
|
|
909
|
+
["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
|
|
910
|
+
["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
|
|
911
|
+
["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
|
|
912
|
+
];
|
|
913
|
+
var Link2 = createLucideIcon("link-2", __iconNode16);
|
|
833
914
|
|
|
834
915
|
// node_modules/lucide-react/dist/esm/icons/link.js
|
|
835
|
-
var
|
|
916
|
+
var __iconNode17 = [
|
|
836
917
|
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
837
918
|
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
838
919
|
];
|
|
839
|
-
var Link = createLucideIcon("link",
|
|
920
|
+
var Link = createLucideIcon("link", __iconNode17);
|
|
840
921
|
|
|
841
922
|
// node_modules/lucide-react/dist/esm/icons/loader-circle.js
|
|
842
|
-
var
|
|
843
|
-
var LoaderCircle = createLucideIcon("loader-circle",
|
|
923
|
+
var __iconNode18 = [["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]];
|
|
924
|
+
var LoaderCircle = createLucideIcon("loader-circle", __iconNode18);
|
|
844
925
|
|
|
845
926
|
// node_modules/lucide-react/dist/esm/icons/pencil.js
|
|
846
|
-
var
|
|
927
|
+
var __iconNode19 = [
|
|
847
928
|
[
|
|
848
929
|
"path",
|
|
849
930
|
{
|
|
@@ -853,55 +934,71 @@ var __iconNode15 = [
|
|
|
853
934
|
],
|
|
854
935
|
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
855
936
|
];
|
|
856
|
-
var Pencil = createLucideIcon("pencil",
|
|
937
|
+
var Pencil = createLucideIcon("pencil", __iconNode19);
|
|
938
|
+
|
|
939
|
+
// node_modules/lucide-react/dist/esm/icons/plus.js
|
|
940
|
+
var __iconNode20 = [
|
|
941
|
+
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
942
|
+
["path", { d: "M12 5v14", key: "s699le" }]
|
|
943
|
+
];
|
|
944
|
+
var Plus = createLucideIcon("plus", __iconNode20);
|
|
857
945
|
|
|
858
946
|
// node_modules/lucide-react/dist/esm/icons/refresh-ccw.js
|
|
859
|
-
var
|
|
947
|
+
var __iconNode21 = [
|
|
860
948
|
["path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "14sxne" }],
|
|
861
949
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }],
|
|
862
950
|
["path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16", key: "1hlbsb" }],
|
|
863
951
|
["path", { d: "M16 16h5v5", key: "ccwih5" }]
|
|
864
952
|
];
|
|
865
|
-
var RefreshCcw = createLucideIcon("refresh-ccw",
|
|
953
|
+
var RefreshCcw = createLucideIcon("refresh-ccw", __iconNode21);
|
|
954
|
+
|
|
955
|
+
// node_modules/lucide-react/dist/esm/icons/refresh-cw.js
|
|
956
|
+
var __iconNode22 = [
|
|
957
|
+
["path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8", key: "v9h5vc" }],
|
|
958
|
+
["path", { d: "M21 3v5h-5", key: "1q7to0" }],
|
|
959
|
+
["path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16", key: "3uifl3" }],
|
|
960
|
+
["path", { d: "M8 16H3v5", key: "1cv678" }]
|
|
961
|
+
];
|
|
962
|
+
var RefreshCw = createLucideIcon("refresh-cw", __iconNode22);
|
|
866
963
|
|
|
867
964
|
// node_modules/lucide-react/dist/esm/icons/rotate-ccw.js
|
|
868
|
-
var
|
|
965
|
+
var __iconNode23 = [
|
|
869
966
|
["path", { d: "M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8", key: "1357e3" }],
|
|
870
967
|
["path", { d: "M3 3v5h5", key: "1xhq8a" }]
|
|
871
968
|
];
|
|
872
|
-
var RotateCcw = createLucideIcon("rotate-ccw",
|
|
969
|
+
var RotateCcw = createLucideIcon("rotate-ccw", __iconNode23);
|
|
873
970
|
|
|
874
971
|
// node_modules/lucide-react/dist/esm/icons/search.js
|
|
875
|
-
var
|
|
972
|
+
var __iconNode24 = [
|
|
876
973
|
["path", { d: "m21 21-4.34-4.34", key: "14j7rj" }],
|
|
877
974
|
["circle", { cx: "11", cy: "11", r: "8", key: "4ej97u" }]
|
|
878
975
|
];
|
|
879
|
-
var Search = createLucideIcon("search",
|
|
976
|
+
var Search = createLucideIcon("search", __iconNode24);
|
|
880
977
|
|
|
881
978
|
// node_modules/lucide-react/dist/esm/icons/trash-2.js
|
|
882
|
-
var
|
|
979
|
+
var __iconNode25 = [
|
|
883
980
|
["path", { d: "M10 11v6", key: "nco0om" }],
|
|
884
981
|
["path", { d: "M14 11v6", key: "outv1u" }],
|
|
885
982
|
["path", { d: "M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6", key: "miytrc" }],
|
|
886
983
|
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
887
984
|
["path", { d: "M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2", key: "e791ji" }]
|
|
888
985
|
];
|
|
889
|
-
var Trash2 = createLucideIcon("trash-2",
|
|
986
|
+
var Trash2 = createLucideIcon("trash-2", __iconNode25);
|
|
890
987
|
|
|
891
988
|
// node_modules/lucide-react/dist/esm/icons/upload.js
|
|
892
|
-
var
|
|
989
|
+
var __iconNode26 = [
|
|
893
990
|
["path", { d: "M12 3v12", key: "1x0j5s" }],
|
|
894
991
|
["path", { d: "m17 8-5-5-5 5", key: "7q97r8" }],
|
|
895
992
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }]
|
|
896
993
|
];
|
|
897
|
-
var Upload = createLucideIcon("upload",
|
|
994
|
+
var Upload = createLucideIcon("upload", __iconNode26);
|
|
898
995
|
|
|
899
996
|
// node_modules/lucide-react/dist/esm/icons/x.js
|
|
900
|
-
var
|
|
997
|
+
var __iconNode27 = [
|
|
901
998
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
902
999
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
903
1000
|
];
|
|
904
|
-
var X = createLucideIcon("x",
|
|
1001
|
+
var X = createLucideIcon("x", __iconNode27);
|
|
905
1002
|
var FieldErrorBoundary = class extends Component {
|
|
906
1003
|
constructor(props) {
|
|
907
1004
|
super(props);
|
|
@@ -1236,7 +1333,7 @@ var createExtensions = () => [
|
|
|
1236
1333
|
Code2,
|
|
1237
1334
|
CodeBlock,
|
|
1238
1335
|
TextAlign.configure({ types: ["heading", "paragraph"] }),
|
|
1239
|
-
|
|
1336
|
+
Link3.configure({ openOnClick: false, HTMLAttributes: { target: "_blank" } })
|
|
1240
1337
|
];
|
|
1241
1338
|
var ToolbarBtn = ({
|
|
1242
1339
|
onClick,
|
|
@@ -24177,6 +24274,599 @@ var createColorField = (options = {}) => {
|
|
|
24177
24274
|
) }) })
|
|
24178
24275
|
};
|
|
24179
24276
|
};
|
|
24277
|
+
var RepeaterRow = ({
|
|
24278
|
+
row,
|
|
24279
|
+
rowIndex,
|
|
24280
|
+
subFields,
|
|
24281
|
+
isExpanded,
|
|
24282
|
+
onToggle,
|
|
24283
|
+
onRemove,
|
|
24284
|
+
onDuplicate,
|
|
24285
|
+
onMoveUp,
|
|
24286
|
+
onMoveDown,
|
|
24287
|
+
onChange,
|
|
24288
|
+
canRemove,
|
|
24289
|
+
canMoveUp,
|
|
24290
|
+
canMoveDown,
|
|
24291
|
+
readOnly
|
|
24292
|
+
}) => {
|
|
24293
|
+
const previewLabel = useMemo(() => {
|
|
24294
|
+
const keys = Object.keys(subFields);
|
|
24295
|
+
if (keys.length === 0) return `Sat\u0131r ${rowIndex + 1}`;
|
|
24296
|
+
const firstKey = keys[0];
|
|
24297
|
+
const val = row[firstKey];
|
|
24298
|
+
if (!val) return `Sat\u0131r ${rowIndex + 1}`;
|
|
24299
|
+
if (Array.isArray(val) && val.length > 0 && typeof val[0] === "object" && "value" in val[0]) {
|
|
24300
|
+
const text2 = val[0]?.value;
|
|
24301
|
+
if (typeof text2 === "string" && text2.trim()) {
|
|
24302
|
+
return text2.length > 40 ? text2.substring(0, 40) + "\u2026" : text2;
|
|
24303
|
+
}
|
|
24304
|
+
}
|
|
24305
|
+
if (typeof val === "string" && val.trim()) {
|
|
24306
|
+
return val.length > 40 ? val.substring(0, 40) + "\u2026" : val;
|
|
24307
|
+
}
|
|
24308
|
+
return `Sat\u0131r ${rowIndex + 1}`;
|
|
24309
|
+
}, [row, subFields, rowIndex]);
|
|
24310
|
+
return /* @__PURE__ */ jsxs("div", { className: `tecof-repeater-row ${isExpanded ? "expanded" : ""}`, children: [
|
|
24311
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-repeater-row-header", onClick: onToggle, children: [
|
|
24312
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-repeater-row-left", children: [
|
|
24313
|
+
/* @__PURE__ */ jsx(GripVertical, { size: 14, className: "tecof-repeater-grip" }),
|
|
24314
|
+
/* @__PURE__ */ jsx("span", { className: "tecof-repeater-row-index", children: rowIndex + 1 }),
|
|
24315
|
+
/* @__PURE__ */ jsx("span", { className: "tecof-repeater-row-preview", children: previewLabel })
|
|
24316
|
+
] }),
|
|
24317
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-repeater-row-actions", children: [
|
|
24318
|
+
!readOnly && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24319
|
+
canMoveUp && /* @__PURE__ */ jsx(
|
|
24320
|
+
"button",
|
|
24321
|
+
{
|
|
24322
|
+
type: "button",
|
|
24323
|
+
className: "tecof-repeater-action-btn",
|
|
24324
|
+
onClick: (e3) => {
|
|
24325
|
+
e3.stopPropagation();
|
|
24326
|
+
onMoveUp();
|
|
24327
|
+
},
|
|
24328
|
+
title: "Yukar\u0131 Ta\u015F\u0131",
|
|
24329
|
+
children: "\u25B2"
|
|
24330
|
+
}
|
|
24331
|
+
),
|
|
24332
|
+
canMoveDown && /* @__PURE__ */ jsx(
|
|
24333
|
+
"button",
|
|
24334
|
+
{
|
|
24335
|
+
type: "button",
|
|
24336
|
+
className: "tecof-repeater-action-btn",
|
|
24337
|
+
onClick: (e3) => {
|
|
24338
|
+
e3.stopPropagation();
|
|
24339
|
+
onMoveDown();
|
|
24340
|
+
},
|
|
24341
|
+
title: "A\u015Fa\u011F\u0131 Ta\u015F\u0131",
|
|
24342
|
+
children: "\u25BC"
|
|
24343
|
+
}
|
|
24344
|
+
),
|
|
24345
|
+
/* @__PURE__ */ jsx(
|
|
24346
|
+
"button",
|
|
24347
|
+
{
|
|
24348
|
+
type: "button",
|
|
24349
|
+
className: "tecof-repeater-action-btn",
|
|
24350
|
+
onClick: (e3) => {
|
|
24351
|
+
e3.stopPropagation();
|
|
24352
|
+
onDuplicate();
|
|
24353
|
+
},
|
|
24354
|
+
title: "Kopyala",
|
|
24355
|
+
children: /* @__PURE__ */ jsx(Copy, { size: 13 })
|
|
24356
|
+
}
|
|
24357
|
+
),
|
|
24358
|
+
canRemove && /* @__PURE__ */ jsx(
|
|
24359
|
+
"button",
|
|
24360
|
+
{
|
|
24361
|
+
type: "button",
|
|
24362
|
+
className: "tecof-repeater-action-btn tecof-repeater-action-btn-danger",
|
|
24363
|
+
onClick: (e3) => {
|
|
24364
|
+
e3.stopPropagation();
|
|
24365
|
+
onRemove();
|
|
24366
|
+
},
|
|
24367
|
+
title: "Sil",
|
|
24368
|
+
children: /* @__PURE__ */ jsx(Trash2, { size: 13 })
|
|
24369
|
+
}
|
|
24370
|
+
)
|
|
24371
|
+
] }),
|
|
24372
|
+
/* @__PURE__ */ jsx(
|
|
24373
|
+
ChevronDown,
|
|
24374
|
+
{
|
|
24375
|
+
size: 16,
|
|
24376
|
+
className: `tecof-repeater-chevron ${isExpanded ? "rotated" : ""}`
|
|
24377
|
+
}
|
|
24378
|
+
)
|
|
24379
|
+
] })
|
|
24380
|
+
] }),
|
|
24381
|
+
isExpanded && /* @__PURE__ */ jsx("div", { className: "tecof-repeater-row-content", children: Object.entries(subFields).map(([key, fieldDef]) => {
|
|
24382
|
+
const fieldValue = row[key];
|
|
24383
|
+
const renderFn = fieldDef?.render;
|
|
24384
|
+
if (typeof renderFn !== "function") return null;
|
|
24385
|
+
return /* @__PURE__ */ jsx("div", { className: "tecof-repeater-subfield", children: renderFn({
|
|
24386
|
+
field: fieldDef,
|
|
24387
|
+
name: `${key}_${rowIndex}`,
|
|
24388
|
+
id: `repeater-${rowIndex}-${key}`,
|
|
24389
|
+
value: fieldValue,
|
|
24390
|
+
onChange: (val) => onChange(key, val),
|
|
24391
|
+
readOnly
|
|
24392
|
+
}) }, key);
|
|
24393
|
+
}) })
|
|
24394
|
+
] });
|
|
24395
|
+
};
|
|
24396
|
+
var RepeaterField = ({
|
|
24397
|
+
value: rawValue,
|
|
24398
|
+
onChange,
|
|
24399
|
+
readOnly,
|
|
24400
|
+
subFields = {},
|
|
24401
|
+
minItems = 0,
|
|
24402
|
+
maxItems,
|
|
24403
|
+
defaultRow
|
|
24404
|
+
}) => {
|
|
24405
|
+
const items = useMemo(() => Array.isArray(rawValue) ? rawValue : [], [rawValue]);
|
|
24406
|
+
const [expandedRows, setExpandedRows] = useState(() => new Set(items.length > 0 ? [0] : []));
|
|
24407
|
+
const onChangeRef = useRef(onChange);
|
|
24408
|
+
onChangeRef.current = onChange;
|
|
24409
|
+
const canAdd = maxItems == null || items.length < maxItems;
|
|
24410
|
+
const canRemove = items.length > minItems;
|
|
24411
|
+
const buildDefaultRow = useCallback(() => {
|
|
24412
|
+
if (defaultRow) return { ...defaultRow };
|
|
24413
|
+
const row = {};
|
|
24414
|
+
for (const [key, fieldDef] of Object.entries(subFields)) {
|
|
24415
|
+
const ft = fieldDef?._fieldType;
|
|
24416
|
+
if (ft === "language" || ft === "editor") {
|
|
24417
|
+
row[key] = [];
|
|
24418
|
+
} else if (ft === "upload") {
|
|
24419
|
+
row[key] = [];
|
|
24420
|
+
} else if (ft === "link") {
|
|
24421
|
+
row[key] = [];
|
|
24422
|
+
} else if (ft === "color") {
|
|
24423
|
+
row[key] = "#000000";
|
|
24424
|
+
} else {
|
|
24425
|
+
row[key] = "";
|
|
24426
|
+
}
|
|
24427
|
+
}
|
|
24428
|
+
return row;
|
|
24429
|
+
}, [subFields, defaultRow]);
|
|
24430
|
+
const handleAdd = useCallback(() => {
|
|
24431
|
+
if (!canAdd) return;
|
|
24432
|
+
const newRow = buildDefaultRow();
|
|
24433
|
+
const newItems = [...items, newRow];
|
|
24434
|
+
onChangeRef.current(newItems);
|
|
24435
|
+
setExpandedRows((prev) => {
|
|
24436
|
+
const next = new Set(prev);
|
|
24437
|
+
next.add(newItems.length - 1);
|
|
24438
|
+
return next;
|
|
24439
|
+
});
|
|
24440
|
+
}, [canAdd, buildDefaultRow, items]);
|
|
24441
|
+
const handleRemove = useCallback((index2) => {
|
|
24442
|
+
if (!canRemove) return;
|
|
24443
|
+
const newItems = items.filter((_2, i2) => i2 !== index2);
|
|
24444
|
+
onChangeRef.current(newItems);
|
|
24445
|
+
setExpandedRows((prev) => {
|
|
24446
|
+
const next = /* @__PURE__ */ new Set();
|
|
24447
|
+
prev.forEach((idx) => {
|
|
24448
|
+
if (idx < index2) next.add(idx);
|
|
24449
|
+
else if (idx > index2) next.add(idx - 1);
|
|
24450
|
+
});
|
|
24451
|
+
return next;
|
|
24452
|
+
});
|
|
24453
|
+
}, [canRemove, items]);
|
|
24454
|
+
const handleDuplicate = useCallback((index2) => {
|
|
24455
|
+
if (!canAdd) return;
|
|
24456
|
+
const newItems = [...items];
|
|
24457
|
+
const cloned = JSON.parse(JSON.stringify(items[index2]));
|
|
24458
|
+
newItems.splice(index2 + 1, 0, cloned);
|
|
24459
|
+
onChangeRef.current(newItems);
|
|
24460
|
+
setExpandedRows((prev) => {
|
|
24461
|
+
const next = /* @__PURE__ */ new Set();
|
|
24462
|
+
prev.forEach((idx) => {
|
|
24463
|
+
if (idx <= index2) next.add(idx);
|
|
24464
|
+
else next.add(idx + 1);
|
|
24465
|
+
});
|
|
24466
|
+
next.add(index2 + 1);
|
|
24467
|
+
return next;
|
|
24468
|
+
});
|
|
24469
|
+
}, [canAdd, items]);
|
|
24470
|
+
const handleMove = useCallback((index2, direction) => {
|
|
24471
|
+
const target = direction === "up" ? index2 - 1 : index2 + 1;
|
|
24472
|
+
if (target < 0 || target >= items.length) return;
|
|
24473
|
+
const newItems = [...items];
|
|
24474
|
+
[newItems[index2], newItems[target]] = [newItems[target], newItems[index2]];
|
|
24475
|
+
onChangeRef.current(newItems);
|
|
24476
|
+
setExpandedRows((prev) => {
|
|
24477
|
+
const next = /* @__PURE__ */ new Set();
|
|
24478
|
+
prev.forEach((idx) => {
|
|
24479
|
+
if (idx === index2) next.add(target);
|
|
24480
|
+
else if (idx === target) next.add(index2);
|
|
24481
|
+
else next.add(idx);
|
|
24482
|
+
});
|
|
24483
|
+
return next;
|
|
24484
|
+
});
|
|
24485
|
+
}, [items]);
|
|
24486
|
+
const handleSubFieldChange = useCallback((rowIndex, key, val) => {
|
|
24487
|
+
const newItems = items.map((row, i2) => {
|
|
24488
|
+
if (i2 !== rowIndex) return row;
|
|
24489
|
+
return { ...row, [key]: val };
|
|
24490
|
+
});
|
|
24491
|
+
onChangeRef.current(newItems);
|
|
24492
|
+
}, [items]);
|
|
24493
|
+
const toggleRow = useCallback((index2) => {
|
|
24494
|
+
setExpandedRows((prev) => {
|
|
24495
|
+
const next = new Set(prev);
|
|
24496
|
+
if (next.has(index2)) next.delete(index2);
|
|
24497
|
+
else next.add(index2);
|
|
24498
|
+
return next;
|
|
24499
|
+
});
|
|
24500
|
+
}, []);
|
|
24501
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-container", children: [
|
|
24502
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-repeater-header", children: /* @__PURE__ */ jsxs("span", { className: "tecof-repeater-count", children: [
|
|
24503
|
+
items.length,
|
|
24504
|
+
" sat\u0131r",
|
|
24505
|
+
maxItems != null && ` / ${maxItems}`
|
|
24506
|
+
] }) }),
|
|
24507
|
+
items.length === 0 && !readOnly && /* @__PURE__ */ jsxs("div", { className: "tecof-repeater-empty", children: [
|
|
24508
|
+
/* @__PURE__ */ jsx("p", { className: "tecof-repeater-empty-text", children: "Hen\xFCz sat\u0131r eklenmemi\u015F" }),
|
|
24509
|
+
/* @__PURE__ */ jsxs(
|
|
24510
|
+
"button",
|
|
24511
|
+
{
|
|
24512
|
+
type: "button",
|
|
24513
|
+
className: "tecof-repeater-add-btn",
|
|
24514
|
+
onClick: handleAdd,
|
|
24515
|
+
children: [
|
|
24516
|
+
/* @__PURE__ */ jsx(Plus, { size: 14 }),
|
|
24517
|
+
" \u0130lk Sat\u0131r\u0131 Ekle"
|
|
24518
|
+
]
|
|
24519
|
+
}
|
|
24520
|
+
)
|
|
24521
|
+
] }),
|
|
24522
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-repeater-rows", children: items.map((row, idx) => /* @__PURE__ */ jsx(
|
|
24523
|
+
RepeaterRow,
|
|
24524
|
+
{
|
|
24525
|
+
row,
|
|
24526
|
+
rowIndex: idx,
|
|
24527
|
+
subFields,
|
|
24528
|
+
isExpanded: expandedRows.has(idx),
|
|
24529
|
+
onToggle: () => toggleRow(idx),
|
|
24530
|
+
onRemove: () => handleRemove(idx),
|
|
24531
|
+
onDuplicate: () => handleDuplicate(idx),
|
|
24532
|
+
onMoveUp: () => handleMove(idx, "up"),
|
|
24533
|
+
onMoveDown: () => handleMove(idx, "down"),
|
|
24534
|
+
onChange: (key, val) => handleSubFieldChange(idx, key, val),
|
|
24535
|
+
canRemove,
|
|
24536
|
+
canMoveUp: idx > 0,
|
|
24537
|
+
canMoveDown: idx < items.length - 1,
|
|
24538
|
+
readOnly
|
|
24539
|
+
},
|
|
24540
|
+
idx
|
|
24541
|
+
)) }),
|
|
24542
|
+
items.length > 0 && !readOnly && canAdd && /* @__PURE__ */ jsxs(
|
|
24543
|
+
"button",
|
|
24544
|
+
{
|
|
24545
|
+
type: "button",
|
|
24546
|
+
className: "tecof-repeater-add-btn-bottom",
|
|
24547
|
+
onClick: handleAdd,
|
|
24548
|
+
children: [
|
|
24549
|
+
/* @__PURE__ */ jsx(Plus, { size: 14 }),
|
|
24550
|
+
" Sat\u0131r Ekle"
|
|
24551
|
+
]
|
|
24552
|
+
}
|
|
24553
|
+
)
|
|
24554
|
+
] });
|
|
24555
|
+
};
|
|
24556
|
+
RepeaterField.displayName = "RepeaterField";
|
|
24557
|
+
var createRepeaterField = (options) => {
|
|
24558
|
+
const { label, labelIcon, visible, ...fieldOptions } = options;
|
|
24559
|
+
return {
|
|
24560
|
+
type: "custom",
|
|
24561
|
+
_fieldType: "repeater",
|
|
24562
|
+
label,
|
|
24563
|
+
labelIcon,
|
|
24564
|
+
visible,
|
|
24565
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsx(
|
|
24566
|
+
RepeaterField,
|
|
24567
|
+
{
|
|
24568
|
+
field,
|
|
24569
|
+
name: name3,
|
|
24570
|
+
id,
|
|
24571
|
+
value: value || [],
|
|
24572
|
+
onChange,
|
|
24573
|
+
readOnly,
|
|
24574
|
+
...fieldOptions
|
|
24575
|
+
}
|
|
24576
|
+
) }) })
|
|
24577
|
+
};
|
|
24578
|
+
};
|
|
24579
|
+
var CmsCollectionField = ({
|
|
24580
|
+
value,
|
|
24581
|
+
onChange,
|
|
24582
|
+
readOnly,
|
|
24583
|
+
defaultLimit = 10,
|
|
24584
|
+
showLimit = true,
|
|
24585
|
+
showSort = true,
|
|
24586
|
+
slots
|
|
24587
|
+
}) => {
|
|
24588
|
+
const { apiClient } = useTecof();
|
|
24589
|
+
const [collections, setCollections] = useState([]);
|
|
24590
|
+
const [loading, setLoading] = useState(true);
|
|
24591
|
+
const [error2, setError] = useState(null);
|
|
24592
|
+
const [dropdownOpen, setDropdownOpen] = useState(false);
|
|
24593
|
+
const [searchQuery, setSearchQuery] = useState("");
|
|
24594
|
+
const dropdownRef = useRef(null);
|
|
24595
|
+
const onChangeRef = useRef(onChange);
|
|
24596
|
+
onChangeRef.current = onChange;
|
|
24597
|
+
const fetchCollections = useCallback(async () => {
|
|
24598
|
+
setLoading(true);
|
|
24599
|
+
setError(null);
|
|
24600
|
+
try {
|
|
24601
|
+
const res2 = await apiClient.getCmsCollections();
|
|
24602
|
+
if (res2.success && Array.isArray(res2.data)) {
|
|
24603
|
+
setCollections(res2.data);
|
|
24604
|
+
} else {
|
|
24605
|
+
setError(res2.message || "Koleksiyonlar y\xFCklenemedi");
|
|
24606
|
+
}
|
|
24607
|
+
} catch (err) {
|
|
24608
|
+
setError(err.message || "Ba\u011Flant\u0131 hatas\u0131");
|
|
24609
|
+
} finally {
|
|
24610
|
+
setLoading(false);
|
|
24611
|
+
}
|
|
24612
|
+
}, [apiClient]);
|
|
24613
|
+
useEffect(() => {
|
|
24614
|
+
fetchCollections();
|
|
24615
|
+
}, [fetchCollections]);
|
|
24616
|
+
useEffect(() => {
|
|
24617
|
+
if (!dropdownOpen) return;
|
|
24618
|
+
const handleClick = (e3) => {
|
|
24619
|
+
if (dropdownRef.current && !dropdownRef.current.contains(e3.target)) {
|
|
24620
|
+
setDropdownOpen(false);
|
|
24621
|
+
}
|
|
24622
|
+
};
|
|
24623
|
+
document.addEventListener("mousedown", handleClick);
|
|
24624
|
+
return () => document.removeEventListener("mousedown", handleClick);
|
|
24625
|
+
}, [dropdownOpen]);
|
|
24626
|
+
const selectedCollection = useMemo(() => {
|
|
24627
|
+
if (!value?.collectionSlug) return null;
|
|
24628
|
+
return collections.find((c2) => c2.slug === value.collectionSlug) || null;
|
|
24629
|
+
}, [value?.collectionSlug, collections]);
|
|
24630
|
+
const collectionFields = useMemo(() => {
|
|
24631
|
+
return selectedCollection?.fields || [];
|
|
24632
|
+
}, [selectedCollection]);
|
|
24633
|
+
const handleSelect = useCallback((col) => {
|
|
24634
|
+
onChangeRef.current({
|
|
24635
|
+
collectionSlug: col.slug,
|
|
24636
|
+
collectionName: col.name,
|
|
24637
|
+
limit: value?.limit || defaultLimit,
|
|
24638
|
+
sort: value?.sort || "newest",
|
|
24639
|
+
fieldMap: value?.fieldMap || {}
|
|
24640
|
+
});
|
|
24641
|
+
setDropdownOpen(false);
|
|
24642
|
+
setSearchQuery("");
|
|
24643
|
+
}, [value, defaultLimit]);
|
|
24644
|
+
const handleClear = useCallback(() => {
|
|
24645
|
+
onChangeRef.current(null);
|
|
24646
|
+
}, []);
|
|
24647
|
+
const handleLimitChange = useCallback((e3) => {
|
|
24648
|
+
const num = parseInt(e3.target.value, 10);
|
|
24649
|
+
if (!value) return;
|
|
24650
|
+
onChangeRef.current({
|
|
24651
|
+
...value,
|
|
24652
|
+
limit: isNaN(num) ? defaultLimit : Math.max(1, Math.min(100, num))
|
|
24653
|
+
});
|
|
24654
|
+
}, [value, defaultLimit]);
|
|
24655
|
+
const handleSortChange = useCallback((sort) => {
|
|
24656
|
+
if (!value) return;
|
|
24657
|
+
onChangeRef.current({ ...value, sort });
|
|
24658
|
+
}, [value]);
|
|
24659
|
+
const handleFieldMapChange = useCallback((slotKey, fieldShortcode) => {
|
|
24660
|
+
if (!value) return;
|
|
24661
|
+
onChangeRef.current({
|
|
24662
|
+
...value,
|
|
24663
|
+
fieldMap: {
|
|
24664
|
+
...value.fieldMap,
|
|
24665
|
+
[slotKey]: fieldShortcode
|
|
24666
|
+
}
|
|
24667
|
+
});
|
|
24668
|
+
}, [value]);
|
|
24669
|
+
const filteredCollections = useMemo(() => {
|
|
24670
|
+
if (!searchQuery.trim()) return collections;
|
|
24671
|
+
const q = searchQuery.toLowerCase();
|
|
24672
|
+
return collections.filter(
|
|
24673
|
+
(c2) => c2.name.toLowerCase().includes(q) || c2.slug.toLowerCase().includes(q)
|
|
24674
|
+
);
|
|
24675
|
+
}, [collections, searchQuery]);
|
|
24676
|
+
if (loading) {
|
|
24677
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-loading", children: [
|
|
24678
|
+
/* @__PURE__ */ jsx(LoaderCircle, { size: 16, className: "tecof-spin" }),
|
|
24679
|
+
/* @__PURE__ */ jsx("span", { children: "Koleksiyonlar y\xFCkleniyor\u2026" })
|
|
24680
|
+
] });
|
|
24681
|
+
}
|
|
24682
|
+
if (error2) {
|
|
24683
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-error", children: [
|
|
24684
|
+
/* @__PURE__ */ jsx("span", { children: error2 }),
|
|
24685
|
+
/* @__PURE__ */ jsxs("button", { type: "button", className: "tecof-cms-col-retry", onClick: fetchCollections, children: [
|
|
24686
|
+
/* @__PURE__ */ jsx(RefreshCw, { size: 12 }),
|
|
24687
|
+
" Tekrar Dene"
|
|
24688
|
+
] })
|
|
24689
|
+
] });
|
|
24690
|
+
}
|
|
24691
|
+
const hasSlots = slots && Object.keys(slots).length > 0;
|
|
24692
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-container", children: [
|
|
24693
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-selector", ref: dropdownRef, children: [
|
|
24694
|
+
/* @__PURE__ */ jsxs(
|
|
24695
|
+
"button",
|
|
24696
|
+
{
|
|
24697
|
+
type: "button",
|
|
24698
|
+
className: `tecof-cms-col-trigger ${dropdownOpen ? "open" : ""}`,
|
|
24699
|
+
onClick: () => !readOnly && setDropdownOpen(!dropdownOpen),
|
|
24700
|
+
disabled: readOnly,
|
|
24701
|
+
children: [
|
|
24702
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-trigger-left", children: [
|
|
24703
|
+
/* @__PURE__ */ jsx(Database, { size: 14 }),
|
|
24704
|
+
/* @__PURE__ */ jsx("span", { children: value?.collectionName || value?.collectionSlug || "Koleksiyon Se\xE7in" })
|
|
24705
|
+
] }),
|
|
24706
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-trigger-right", children: [
|
|
24707
|
+
value && !readOnly && /* @__PURE__ */ jsx(
|
|
24708
|
+
"button",
|
|
24709
|
+
{
|
|
24710
|
+
type: "button",
|
|
24711
|
+
className: "tecof-cms-col-clear",
|
|
24712
|
+
onClick: (e3) => {
|
|
24713
|
+
e3.stopPropagation();
|
|
24714
|
+
handleClear();
|
|
24715
|
+
},
|
|
24716
|
+
title: "Temizle",
|
|
24717
|
+
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
24718
|
+
}
|
|
24719
|
+
),
|
|
24720
|
+
/* @__PURE__ */ jsx(
|
|
24721
|
+
ChevronDown,
|
|
24722
|
+
{
|
|
24723
|
+
size: 14,
|
|
24724
|
+
className: `tecof-cms-col-chevron ${dropdownOpen ? "rotated" : ""}`
|
|
24725
|
+
}
|
|
24726
|
+
)
|
|
24727
|
+
] })
|
|
24728
|
+
]
|
|
24729
|
+
}
|
|
24730
|
+
),
|
|
24731
|
+
dropdownOpen && /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-dropdown", children: [
|
|
24732
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-search", children: [
|
|
24733
|
+
/* @__PURE__ */ jsx(Search, { size: 13 }),
|
|
24734
|
+
/* @__PURE__ */ jsx(
|
|
24735
|
+
"input",
|
|
24736
|
+
{
|
|
24737
|
+
type: "text",
|
|
24738
|
+
value: searchQuery,
|
|
24739
|
+
onChange: (e3) => setSearchQuery(e3.target.value),
|
|
24740
|
+
placeholder: "Koleksiyon ara\u2026",
|
|
24741
|
+
className: "tecof-cms-col-search-input",
|
|
24742
|
+
autoFocus: true
|
|
24743
|
+
}
|
|
24744
|
+
)
|
|
24745
|
+
] }),
|
|
24746
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-cms-col-options", children: filteredCollections.length === 0 ? /* @__PURE__ */ jsx("div", { className: "tecof-cms-col-empty", children: "Koleksiyon bulunamad\u0131" }) : filteredCollections.map((col) => /* @__PURE__ */ jsxs(
|
|
24747
|
+
"button",
|
|
24748
|
+
{
|
|
24749
|
+
type: "button",
|
|
24750
|
+
className: `tecof-cms-col-option ${value?.collectionSlug === col.slug ? "selected" : ""}`,
|
|
24751
|
+
onClick: () => handleSelect(col),
|
|
24752
|
+
children: [
|
|
24753
|
+
/* @__PURE__ */ jsx(Database, { size: 13 }),
|
|
24754
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-option-info", children: [
|
|
24755
|
+
/* @__PURE__ */ jsx("span", { className: "tecof-cms-col-option-name", children: col.name }),
|
|
24756
|
+
/* @__PURE__ */ jsx("span", { className: "tecof-cms-col-option-slug", children: col.slug })
|
|
24757
|
+
] })
|
|
24758
|
+
]
|
|
24759
|
+
},
|
|
24760
|
+
col._id
|
|
24761
|
+
)) })
|
|
24762
|
+
] })
|
|
24763
|
+
] }),
|
|
24764
|
+
value?.collectionSlug && /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-settings", children: [
|
|
24765
|
+
showLimit && /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-setting", children: [
|
|
24766
|
+
/* @__PURE__ */ jsx("label", { className: "tecof-cms-col-setting-label", children: "Limit" }),
|
|
24767
|
+
/* @__PURE__ */ jsx(
|
|
24768
|
+
"input",
|
|
24769
|
+
{
|
|
24770
|
+
type: "number",
|
|
24771
|
+
min: 1,
|
|
24772
|
+
max: 100,
|
|
24773
|
+
value: value.limit || defaultLimit,
|
|
24774
|
+
onChange: handleLimitChange,
|
|
24775
|
+
className: "tecof-cms-col-setting-input",
|
|
24776
|
+
disabled: readOnly
|
|
24777
|
+
}
|
|
24778
|
+
)
|
|
24779
|
+
] }),
|
|
24780
|
+
showSort && /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-setting", children: [
|
|
24781
|
+
/* @__PURE__ */ jsx("label", { className: "tecof-cms-col-setting-label", children: "S\u0131ralama" }),
|
|
24782
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-sort-btns", children: [
|
|
24783
|
+
/* @__PURE__ */ jsx(
|
|
24784
|
+
"button",
|
|
24785
|
+
{
|
|
24786
|
+
type: "button",
|
|
24787
|
+
className: `tecof-cms-col-sort-btn ${(value.sort || "newest") === "newest" ? "active" : ""}`,
|
|
24788
|
+
onClick: () => handleSortChange("newest"),
|
|
24789
|
+
disabled: readOnly,
|
|
24790
|
+
children: "Yeni\u2192Eski"
|
|
24791
|
+
}
|
|
24792
|
+
),
|
|
24793
|
+
/* @__PURE__ */ jsx(
|
|
24794
|
+
"button",
|
|
24795
|
+
{
|
|
24796
|
+
type: "button",
|
|
24797
|
+
className: `tecof-cms-col-sort-btn ${value.sort === "oldest" ? "active" : ""}`,
|
|
24798
|
+
onClick: () => handleSortChange("oldest"),
|
|
24799
|
+
disabled: readOnly,
|
|
24800
|
+
children: "Eski\u2192Yeni"
|
|
24801
|
+
}
|
|
24802
|
+
)
|
|
24803
|
+
] })
|
|
24804
|
+
] })
|
|
24805
|
+
] }),
|
|
24806
|
+
value?.collectionSlug && hasSlots && /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-mapping", children: [
|
|
24807
|
+
/* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-mapping-header", children: [
|
|
24808
|
+
/* @__PURE__ */ jsx(Link2, { size: 12 }),
|
|
24809
|
+
/* @__PURE__ */ jsx("span", { children: "Alan E\u015Fle\u015Ftirme" })
|
|
24810
|
+
] }),
|
|
24811
|
+
/* @__PURE__ */ jsx("div", { className: "tecof-cms-col-mapping-rows", children: Object.entries(slots).map(([slotKey, slotDef]) => {
|
|
24812
|
+
const currentMapping = value.fieldMap?.[slotKey] || "";
|
|
24813
|
+
const availableFields = slotDef.fieldTypes ? collectionFields.filter((f2) => slotDef.fieldTypes.includes(f2.type)) : collectionFields;
|
|
24814
|
+
return /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-mapping-row", children: [
|
|
24815
|
+
/* @__PURE__ */ jsx("label", { className: "tecof-cms-col-mapping-label", children: slotDef.label }),
|
|
24816
|
+
/* @__PURE__ */ jsxs(
|
|
24817
|
+
"select",
|
|
24818
|
+
{
|
|
24819
|
+
className: "tecof-cms-col-mapping-select",
|
|
24820
|
+
value: currentMapping,
|
|
24821
|
+
onChange: (e3) => handleFieldMapChange(slotKey, e3.target.value),
|
|
24822
|
+
disabled: readOnly,
|
|
24823
|
+
children: [
|
|
24824
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "\u2014 Se\xE7in \u2014" }),
|
|
24825
|
+
availableFields.map((f2) => /* @__PURE__ */ jsxs("option", { value: f2.shortcode, children: [
|
|
24826
|
+
f2.name,
|
|
24827
|
+
" (",
|
|
24828
|
+
f2.shortcode,
|
|
24829
|
+
")"
|
|
24830
|
+
] }, f2.shortcode))
|
|
24831
|
+
]
|
|
24832
|
+
}
|
|
24833
|
+
)
|
|
24834
|
+
] }, slotKey);
|
|
24835
|
+
}) })
|
|
24836
|
+
] }),
|
|
24837
|
+
selectedCollection && /* @__PURE__ */ jsxs("div", { className: "tecof-cms-col-badge", children: [
|
|
24838
|
+
/* @__PURE__ */ jsx(Database, { size: 11 }),
|
|
24839
|
+
/* @__PURE__ */ jsx("span", { children: selectedCollection.name }),
|
|
24840
|
+
selectedCollection.fields && /* @__PURE__ */ jsxs("span", { className: "tecof-cms-col-badge-count", children: [
|
|
24841
|
+
selectedCollection.fields.length,
|
|
24842
|
+
" alan"
|
|
24843
|
+
] })
|
|
24844
|
+
] })
|
|
24845
|
+
] });
|
|
24846
|
+
};
|
|
24847
|
+
CmsCollectionField.displayName = "CmsCollectionField";
|
|
24848
|
+
var createCmsCollectionField = (options = {}) => {
|
|
24849
|
+
const { label, labelIcon, visible, ...fieldOptions } = options;
|
|
24850
|
+
return {
|
|
24851
|
+
type: "custom",
|
|
24852
|
+
_fieldType: "cmsCollection",
|
|
24853
|
+
label,
|
|
24854
|
+
labelIcon,
|
|
24855
|
+
visible,
|
|
24856
|
+
render: ({ value, onChange, readOnly, field, name: name3, id }) => /* @__PURE__ */ jsx(FieldLabel, { label: label || "", icon: labelIcon, readOnly, children: /* @__PURE__ */ jsx(FieldErrorBoundary, { fieldName: name3, children: /* @__PURE__ */ jsx(
|
|
24857
|
+
CmsCollectionField,
|
|
24858
|
+
{
|
|
24859
|
+
field,
|
|
24860
|
+
name: name3,
|
|
24861
|
+
id,
|
|
24862
|
+
value: value || null,
|
|
24863
|
+
onChange,
|
|
24864
|
+
readOnly,
|
|
24865
|
+
...fieldOptions
|
|
24866
|
+
}
|
|
24867
|
+
) }) })
|
|
24868
|
+
};
|
|
24869
|
+
};
|
|
24180
24870
|
|
|
24181
24871
|
// src/utils/index.ts
|
|
24182
24872
|
function hexToHsl(hex) {
|
|
@@ -24336,21 +25026,27 @@ lucide-react/dist/esm/context.js:
|
|
|
24336
25026
|
lucide-react/dist/esm/Icon.js:
|
|
24337
25027
|
lucide-react/dist/esm/createLucideIcon.js:
|
|
24338
25028
|
lucide-react/dist/esm/icons/check.js:
|
|
25029
|
+
lucide-react/dist/esm/icons/chevron-down.js:
|
|
24339
25030
|
lucide-react/dist/esm/icons/chevron-right.js:
|
|
24340
25031
|
lucide-react/dist/esm/icons/code.js:
|
|
24341
25032
|
lucide-react/dist/esm/icons/copy.js:
|
|
25033
|
+
lucide-react/dist/esm/icons/database.js:
|
|
24342
25034
|
lucide-react/dist/esm/icons/external-link.js:
|
|
24343
25035
|
lucide-react/dist/esm/icons/file-text.js:
|
|
24344
25036
|
lucide-react/dist/esm/icons/file.js:
|
|
24345
25037
|
lucide-react/dist/esm/icons/folder-open.js:
|
|
24346
25038
|
lucide-react/dist/esm/icons/globe.js:
|
|
25039
|
+
lucide-react/dist/esm/icons/grip-vertical.js:
|
|
24347
25040
|
lucide-react/dist/esm/icons/image-plus.js:
|
|
24348
25041
|
lucide-react/dist/esm/icons/image.js:
|
|
24349
25042
|
lucide-react/dist/esm/icons/languages.js:
|
|
25043
|
+
lucide-react/dist/esm/icons/link-2.js:
|
|
24350
25044
|
lucide-react/dist/esm/icons/link.js:
|
|
24351
25045
|
lucide-react/dist/esm/icons/loader-circle.js:
|
|
24352
25046
|
lucide-react/dist/esm/icons/pencil.js:
|
|
25047
|
+
lucide-react/dist/esm/icons/plus.js:
|
|
24353
25048
|
lucide-react/dist/esm/icons/refresh-ccw.js:
|
|
25049
|
+
lucide-react/dist/esm/icons/refresh-cw.js:
|
|
24354
25050
|
lucide-react/dist/esm/icons/rotate-ccw.js:
|
|
24355
25051
|
lucide-react/dist/esm/icons/search.js:
|
|
24356
25052
|
lucide-react/dist/esm/icons/trash-2.js:
|
|
@@ -24439,6 +25135,6 @@ filepond-plugin-image-edit/dist/filepond-plugin-image-edit.esm.js:
|
|
|
24439
25135
|
*)
|
|
24440
25136
|
*/
|
|
24441
25137
|
|
|
24442
|
-
export { CodeEditorField, ColorField, EditorField, FieldErrorBoundary, LanguageField, LinkField, TecofApiClient, TecofEditor, TecofPicture, TecofProvider, TecofRender, UploadField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
25138
|
+
export { CmsCollectionField, CodeEditorField, ColorField, EditorField, FieldErrorBoundary, LanguageField, LinkField, RepeaterField, TecofApiClient, TecofEditor, TecofPicture, TecofProvider, TecofRender, UploadField, createCmsCollectionField, createCodeEditorField, createColorField, createEditorField, createLanguageField, createLinkField, createRepeaterField, createUploadField, darken, generateCSSVariables, getDefaultTheme, hexToHsl, hslToHex, lighten, mergeTheme, useTecof };
|
|
24443
25139
|
//# sourceMappingURL=index.mjs.map
|
|
24444
25140
|
//# sourceMappingURL=index.mjs.map
|