@lunejs/admin-ui 0.2.0 → 0.2.1
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/lib/api/codegen/graphql.d.ts +1 -0
- package/dist/lib/api/codegen/graphql.js +8 -8
- package/dist/lib/custom-fields/components/details/is-list/custom-field-is-list.js +6 -4
- package/dist/lib/custom-fields/components/details/use-form/form-schema.d.ts +1 -0
- package/dist/lib/custom-fields/components/details/use-form/form-schema.js +4 -3
- package/dist/lib/custom-fields/components/fields/custom-field.js +44 -36
- package/dist/lib/custom-fields/components/fields/rich-text.d.ts +8 -0
- package/dist/lib/custom-fields/components/fields/rich-text.js +17 -0
- package/dist/lib/custom-fields/components/fields/shared/primitive.d.ts +2 -1
- package/dist/lib/custom-fields/components/fields/shared/primitive.js +67 -61
- package/dist/lib/custom-fields/utils/custom-field.utils.js +63 -51
- package/dist/lib/translate/components/form/translate-form-row-data.d.ts +2 -1
- package/dist/lib/translate/components/form/translate-form-row-data.js +51 -19
- package/dist/lib/translate/components/form/translate-rich-text.d.ts +8 -0
- package/dist/lib/translate/components/form/translate-rich-text.js +65 -0
- package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js +95 -63
- package/dist/lib/translate/components/product-form/translate-product-form.js +19 -18
- package/dist/node_modules/@tiptap/core/dist/index.js +876 -872
- package/dist/node_modules/@tiptap/extensions/dist/index.js +288 -0
- package/dist/node_modules/@tiptap/react/dist/index.js +35 -34
- package/dist/node_modules/es-toolkit/dist/compat/object/cloneDeep.js +1 -1
- package/dist/node_modules/es-toolkit/dist/object/cloneDeep.js +1 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/layout-list.js +13 -0
- package/dist/node_modules/prosemirror-dropcursor/dist/index.js +86 -0
- package/dist/node_modules/prosemirror-gapcursor/dist/index.js +204 -0
- package/dist/node_modules/prosemirror-history/dist/index.js +248 -0
- package/dist/node_modules/rope-sequence/dist/index.js +100 -0
- package/dist/shared/components/rich-editor/rich-editor.d.ts +3 -1
- package/dist/shared/components/rich-editor/rich-editor.js +40 -36
- package/dist/shared/components/rich-editor/toolbar/bold/rich-editor-toolbar-bold.js +10 -9
- package/dist/shared/components/rich-editor/toolbar/color/rich-editor-toolbar-color.js +1 -0
- package/dist/shared/components/rich-editor/toolbar/heading/rich-editor-toolbar-heading.js +1 -0
- package/dist/shared/components/rich-editor/toolbar/italic/rich-editor-toolbar-italic.js +5 -4
- package/dist/shared/components/rich-editor/toolbar/link/rich-editor-toolbar-link.js +8 -7
- package/dist/shared/components/rich-editor/toolbar/ol-list/rich-editor-toolbar-ul-list.js +1 -0
- package/dist/shared/components/rich-editor/toolbar/table/rich-editor-toolbar-table.js +9 -8
- package/dist/shared/components/rich-editor/toolbar/ul-list/rich-editor-toolbar-ul-list.js +7 -6
- package/dist/shared/components/rich-editor/toolbar/underline/rich-editor-toolbar-underline.js +3 -2
- package/package.json +1 -1
|
@@ -4,64 +4,76 @@ import u from "../../../node_modules/lucide-react/dist/esm/icons/boxes.js";
|
|
|
4
4
|
import s from "../../../node_modules/lucide-react/dist/esm/icons/package.js";
|
|
5
5
|
import p from "../../../node_modules/lucide-react/dist/esm/icons/pipette.js";
|
|
6
6
|
import f from "../../../node_modules/lucide-react/dist/esm/icons/calendar.js";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
7
|
+
import b from "../../../node_modules/lucide-react/dist/esm/icons/toggle-left.js";
|
|
8
|
+
import C from "../../../node_modules/lucide-react/dist/esm/icons/image.js";
|
|
9
9
|
import g from "../../../node_modules/lucide-react/dist/esm/icons/dollar-sign.js";
|
|
10
|
-
import
|
|
10
|
+
import c from "../../../node_modules/lucide-react/dist/esm/icons/hash.js";
|
|
11
|
+
import T from "../../../node_modules/lucide-react/dist/esm/icons/layout-list.js";
|
|
11
12
|
import d from "../../../node_modules/lucide-react/dist/esm/icons/earth.js";
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
class
|
|
17
|
-
constructor(
|
|
18
|
-
this.title =
|
|
13
|
+
import x from "../../../node_modules/lucide-react/dist/esm/icons/text.js";
|
|
14
|
+
import R from "../../../node_modules/lucide-react/dist/esm/icons/type.js";
|
|
15
|
+
import v from "../../../node_modules/lucide-react/dist/esm/icons/shopping-cart.js";
|
|
16
|
+
import w from "../../../node_modules/lucide-react/dist/esm/icons/user.js";
|
|
17
|
+
class t {
|
|
18
|
+
constructor(i, n) {
|
|
19
|
+
this.title = i, this.icon = n;
|
|
19
20
|
}
|
|
20
21
|
}
|
|
21
|
-
const
|
|
22
|
+
const D = {
|
|
22
23
|
// Text
|
|
23
|
-
[e.SingleLineText]: new
|
|
24
|
-
[e.MultiLineText]: new
|
|
25
|
-
[e.Url]: new
|
|
24
|
+
[e.SingleLineText]: new t("Single line text", R),
|
|
25
|
+
[e.MultiLineText]: new t("Multi line text", x),
|
|
26
|
+
[e.Url]: new t("URL", d),
|
|
27
|
+
[e.RichText]: new t("Rich text", T),
|
|
26
28
|
// Number
|
|
27
|
-
[e.Integer]: new
|
|
28
|
-
[e.Decimal]: new
|
|
29
|
-
[e.Money]: new
|
|
29
|
+
[e.Integer]: new t("Integer", c),
|
|
30
|
+
[e.Decimal]: new t("Decimal", c),
|
|
31
|
+
[e.Money]: new t("Money", g),
|
|
30
32
|
// Media
|
|
31
|
-
[e.Image]: new
|
|
33
|
+
[e.Image]: new t("Image", C),
|
|
32
34
|
// Other
|
|
33
|
-
[e.Boolean]: new
|
|
34
|
-
[e.Date]: new
|
|
35
|
-
[e.Color]: new
|
|
35
|
+
[e.Boolean]: new t("Boolean", b),
|
|
36
|
+
[e.Date]: new t("Date", f),
|
|
37
|
+
[e.Color]: new t("Color", p),
|
|
36
38
|
// Reference
|
|
37
|
-
[e.ProductReference]: new
|
|
38
|
-
[e.CollectionReference]: new
|
|
39
|
-
[e.CustomObjectReference]: new
|
|
40
|
-
customer: new
|
|
41
|
-
order: new
|
|
42
|
-
},
|
|
39
|
+
[e.ProductReference]: new t("Product", s),
|
|
40
|
+
[e.CollectionReference]: new t("Collection", u),
|
|
41
|
+
[e.CustomObjectReference]: new t("Custom object", m),
|
|
42
|
+
customer: new t("Customer", w),
|
|
43
|
+
order: new t("Order", v)
|
|
44
|
+
}, _ = (l) => ({
|
|
43
45
|
[r.Product]: "Product",
|
|
44
46
|
[r.Collection]: "Collection",
|
|
45
47
|
[r.CustomObject]: "Custom object",
|
|
46
48
|
[r.OptionValue]: "Option value"
|
|
47
|
-
})[
|
|
49
|
+
})[l], o = (l) => D[l], G = (l) => [
|
|
50
|
+
e.SingleLineText,
|
|
51
|
+
e.MultiLineText,
|
|
52
|
+
e.RichText,
|
|
53
|
+
e.Url
|
|
54
|
+
].includes(l), $ = [
|
|
48
55
|
{
|
|
49
56
|
label: "Text",
|
|
50
57
|
items: [
|
|
51
58
|
{
|
|
52
59
|
label: "Single line text",
|
|
53
60
|
value: e.SingleLineText,
|
|
54
|
-
icon:
|
|
61
|
+
icon: o(e.SingleLineText).icon
|
|
55
62
|
},
|
|
56
63
|
{
|
|
57
64
|
label: "Multi line text",
|
|
58
65
|
value: e.MultiLineText,
|
|
59
|
-
icon:
|
|
66
|
+
icon: o(e.MultiLineText).icon
|
|
60
67
|
},
|
|
61
68
|
{
|
|
62
|
-
label:
|
|
69
|
+
label: o(e.RichText).title,
|
|
70
|
+
value: e.RichText,
|
|
71
|
+
icon: o(e.RichText).icon
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: o(e.Url).title,
|
|
63
75
|
value: e.Url,
|
|
64
|
-
icon:
|
|
76
|
+
icon: o(e.Url).icon
|
|
65
77
|
}
|
|
66
78
|
]
|
|
67
79
|
},
|
|
@@ -71,17 +83,17 @@ const w = {
|
|
|
71
83
|
{
|
|
72
84
|
label: "Integer",
|
|
73
85
|
value: e.Integer,
|
|
74
|
-
icon:
|
|
86
|
+
icon: o(e.Integer).icon
|
|
75
87
|
},
|
|
76
88
|
{
|
|
77
89
|
label: "Decimal",
|
|
78
90
|
value: e.Decimal,
|
|
79
|
-
icon:
|
|
91
|
+
icon: o(e.Decimal).icon
|
|
80
92
|
},
|
|
81
93
|
{
|
|
82
94
|
label: "Money",
|
|
83
95
|
value: e.Money,
|
|
84
|
-
icon:
|
|
96
|
+
icon: o(e.Money).icon
|
|
85
97
|
}
|
|
86
98
|
]
|
|
87
99
|
},
|
|
@@ -91,7 +103,7 @@ const w = {
|
|
|
91
103
|
{
|
|
92
104
|
label: "Image",
|
|
93
105
|
value: e.Image,
|
|
94
|
-
icon:
|
|
106
|
+
icon: o(e.Image).icon
|
|
95
107
|
}
|
|
96
108
|
]
|
|
97
109
|
},
|
|
@@ -101,17 +113,17 @@ const w = {
|
|
|
101
113
|
{
|
|
102
114
|
label: "Product",
|
|
103
115
|
value: e.ProductReference,
|
|
104
|
-
icon:
|
|
116
|
+
icon: o(e.ProductReference).icon
|
|
105
117
|
},
|
|
106
118
|
{
|
|
107
119
|
label: "Collection",
|
|
108
120
|
value: e.CollectionReference,
|
|
109
|
-
icon:
|
|
121
|
+
icon: o(e.CollectionReference).icon
|
|
110
122
|
},
|
|
111
123
|
{
|
|
112
124
|
label: "Custom object",
|
|
113
125
|
value: e.CustomObjectReference,
|
|
114
|
-
icon:
|
|
126
|
+
icon: o(e.CustomObjectReference).icon
|
|
115
127
|
}
|
|
116
128
|
]
|
|
117
129
|
},
|
|
@@ -121,28 +133,28 @@ const w = {
|
|
|
121
133
|
{
|
|
122
134
|
label: "Boolean",
|
|
123
135
|
value: e.Boolean,
|
|
124
|
-
icon:
|
|
136
|
+
icon: o(e.Boolean).icon
|
|
125
137
|
},
|
|
126
138
|
{
|
|
127
139
|
label: "Date",
|
|
128
140
|
value: e.Date,
|
|
129
|
-
icon:
|
|
141
|
+
icon: o(e.Date).icon
|
|
130
142
|
},
|
|
131
143
|
{
|
|
132
|
-
label:
|
|
144
|
+
label: o(e.Color).title,
|
|
133
145
|
value: e.Color,
|
|
134
|
-
icon:
|
|
146
|
+
icon: o(e.Color).icon
|
|
135
147
|
}
|
|
136
148
|
]
|
|
137
149
|
}
|
|
138
|
-
],
|
|
139
|
-
const
|
|
140
|
-
return
|
|
150
|
+
], k = (l, i) => {
|
|
151
|
+
const n = l.values.find((a) => a.field.id === i.displayField?.id);
|
|
152
|
+
return n ? n.value : `${i.name}#${l.slug.toUpperCase()}`;
|
|
141
153
|
};
|
|
142
154
|
export {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
155
|
+
$ as CUSTOM_FIELD_TYPE_GROUPS,
|
|
156
|
+
o as getCustomFieldTypeData,
|
|
157
|
+
k as getDisplayFieldValue,
|
|
158
|
+
_ as getEntityName,
|
|
159
|
+
G as isTranslatable
|
|
148
160
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PropsWithChildren } from 'react';
|
|
2
|
-
export declare const TranslateFormRowData: ({ children, field, reference, className }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const TranslateFormRowData: ({ children, field, reference, richText, className }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
type Props = PropsWithChildren & {
|
|
4
4
|
className?: string | {
|
|
5
5
|
row?: string;
|
|
@@ -8,5 +8,6 @@ type Props = PropsWithChildren & {
|
|
|
8
8
|
};
|
|
9
9
|
field: string | null | undefined;
|
|
10
10
|
reference: string | null | undefined;
|
|
11
|
+
richText?: boolean;
|
|
11
12
|
};
|
|
12
13
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsxs as
|
|
1
|
+
import { jsxs as a, Fragment as s, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import "react";
|
|
3
3
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-accordion/dist/index.js";
|
|
4
|
-
import { cn as
|
|
4
|
+
import { cn as p } from "../../../../packages/lune-ui/dist/lib/utils.js";
|
|
5
5
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js";
|
|
6
6
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-avatar/dist/index.js";
|
|
7
7
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-separator/dist/index.js";
|
|
@@ -24,7 +24,7 @@ import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-radio-gro
|
|
|
24
24
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-select/dist/index.js";
|
|
25
25
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dialog/dist/index.js";
|
|
26
26
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-switch/dist/index.js";
|
|
27
|
-
import { TableRow as
|
|
27
|
+
import { TableRow as u } from "../../../../packages/lune-ui/dist/components/table.js";
|
|
28
28
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tabs/dist/index.js";
|
|
29
29
|
import "../../../../packages/lune-ui/dist/components/theme-provider.js";
|
|
30
30
|
import "../../../../packages/lune-ui/dist/node_modules/sonner/dist/index.js";
|
|
@@ -32,37 +32,69 @@ import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle/di
|
|
|
32
32
|
import "../../../../packages/lune-ui/dist/components/toggle-group.js";
|
|
33
33
|
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
|
|
34
34
|
import "../../../../packages/lune-ui/dist/form/form.js";
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
import { RichEditor as l } from "../../../../shared/components/rich-editor/rich-editor.js";
|
|
36
|
+
import { TranslateFormCell as i } from "./translate-form-cell.js";
|
|
37
|
+
import { TranslateFormRow as e } from "./translate-form-row.js";
|
|
38
|
+
const X = ({
|
|
39
|
+
children: n,
|
|
40
|
+
field: m,
|
|
41
|
+
reference: o,
|
|
42
|
+
richText: d,
|
|
43
|
+
className: t
|
|
44
|
+
}) => /* @__PURE__ */ a(s, { children: [
|
|
45
|
+
/* @__PURE__ */ a(
|
|
46
|
+
u,
|
|
40
47
|
{
|
|
41
|
-
className:
|
|
48
|
+
className: p(
|
|
42
49
|
"bg-transparent! hidden lg:table-row",
|
|
43
50
|
typeof t == "string" ? t : t?.row
|
|
44
51
|
),
|
|
45
52
|
children: [
|
|
46
|
-
/* @__PURE__ */ r(
|
|
47
|
-
/* @__PURE__ */ r(
|
|
48
|
-
|
|
53
|
+
/* @__PURE__ */ r(i, { children: m }),
|
|
54
|
+
d ? /* @__PURE__ */ r(
|
|
55
|
+
i,
|
|
49
56
|
{
|
|
50
|
-
|
|
57
|
+
isDisabled: !0,
|
|
58
|
+
className: p(
|
|
59
|
+
typeof t == "string" ? void 0 : t?.referenceCell,
|
|
60
|
+
"text-muted-foreground p-0"
|
|
61
|
+
),
|
|
62
|
+
children: /* @__PURE__ */ r(
|
|
63
|
+
l,
|
|
64
|
+
{
|
|
65
|
+
disabled: !0,
|
|
66
|
+
className: "rounded-none [&_.tiptap]:max-h-48 ring-0! border-none! [&_.rich-editor-content]:text-muted-foreground!",
|
|
67
|
+
defaultValue: o ?? ""
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
) : /* @__PURE__ */ r(
|
|
72
|
+
i,
|
|
73
|
+
{
|
|
74
|
+
className: p(
|
|
51
75
|
typeof t == "string" ? void 0 : t?.referenceCell,
|
|
52
76
|
"text-muted-foreground"
|
|
53
77
|
),
|
|
54
78
|
isDisabled: !0,
|
|
55
|
-
children:
|
|
79
|
+
children: o
|
|
56
80
|
}
|
|
57
81
|
),
|
|
58
|
-
|
|
82
|
+
n
|
|
59
83
|
]
|
|
60
84
|
}
|
|
61
85
|
),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/* @__PURE__ */ r(
|
|
86
|
+
m && /* @__PURE__ */ r(e, { className: "lg:hidden", children: /* @__PURE__ */ r(i, { children: m }) }),
|
|
87
|
+
o && !d && /* @__PURE__ */ r(e, { className: "lg:hidden", children: /* @__PURE__ */ r(i, { isDisabled: !0, className: "text-muted-foreground", children: o }) }),
|
|
88
|
+
o && d && /* @__PURE__ */ r(e, { className: "lg:hidden", children: /* @__PURE__ */ r(i, { isDisabled: !0, className: "text-muted-foreground p-0", children: /* @__PURE__ */ r(
|
|
89
|
+
l,
|
|
90
|
+
{
|
|
91
|
+
disabled: !0,
|
|
92
|
+
className: "rounded-none [&_.tiptap]:max-h-48 ring-0! border-none! [&_.rich-editor-content]:text-muted-foreground!",
|
|
93
|
+
defaultValue: o ?? ""
|
|
94
|
+
}
|
|
95
|
+
) }) }),
|
|
96
|
+
/* @__PURE__ */ r(e, { className: "lg:hidden", children: n })
|
|
65
97
|
] });
|
|
66
98
|
export {
|
|
67
|
-
|
|
99
|
+
X as TranslateFormRowData
|
|
68
100
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TranslateRichText: ({ onChange, defaultValue, label, className }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
type Props = {
|
|
3
|
+
className?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
defaultValue?: string;
|
|
6
|
+
onChange: (html: string) => void;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useId as l } from "react";
|
|
3
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-accordion/dist/index.js";
|
|
4
|
+
import { cn as s } from "../../../../packages/lune-ui/dist/lib/utils.js";
|
|
5
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js";
|
|
6
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-avatar/dist/index.js";
|
|
7
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-separator/dist/index.js";
|
|
8
|
+
import "../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/UI.js";
|
|
9
|
+
import "../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/classes/DateLib.js";
|
|
10
|
+
import "../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/useDayPicker.js";
|
|
11
|
+
import "../../../../packages/lune-ui/dist/node_modules/@date-fns/tz/date/mini.js";
|
|
12
|
+
import "../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/helpers/calculateFocusTarget.js";
|
|
13
|
+
import "../../../../packages/lune-ui/dist/node_modules/react-day-picker/dist/esm/locale/en-US.js";
|
|
14
|
+
import "../../../../packages/lune-ui/dist/components/chart.js";
|
|
15
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-checkbox/dist/index.js";
|
|
16
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-collapsible/dist/index.js";
|
|
17
|
+
import "../../../../packages/lune-ui/dist/node_modules/cmdk/dist/index.js";
|
|
18
|
+
import "../../../../packages/lune-ui/dist/components/dialog.js";
|
|
19
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js";
|
|
20
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-label/dist/index.js";
|
|
21
|
+
import "../../../../packages/lune-ui/dist/components/phone-input.js";
|
|
22
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-popover/dist/index.js";
|
|
23
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-radio-group/dist/index.js";
|
|
24
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-select/dist/index.js";
|
|
25
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-dialog/dist/index.js";
|
|
26
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-switch/dist/index.js";
|
|
27
|
+
import { TableCell as a } from "../../../../packages/lune-ui/dist/components/table.js";
|
|
28
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tabs/dist/index.js";
|
|
29
|
+
import "../../../../packages/lune-ui/dist/components/theme-provider.js";
|
|
30
|
+
import "../../../../packages/lune-ui/dist/node_modules/sonner/dist/index.js";
|
|
31
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle/dist/index.js";
|
|
32
|
+
import "../../../../packages/lune-ui/dist/components/toggle-group.js";
|
|
33
|
+
import "../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
|
|
34
|
+
import "../../../../packages/lune-ui/dist/form/form.js";
|
|
35
|
+
import { RichEditor as n } from "../../../../shared/components/rich-editor/rich-editor.js";
|
|
36
|
+
const S = ({ onChange: i, defaultValue: m, label: r, className: p }) => {
|
|
37
|
+
const t = l();
|
|
38
|
+
return /* @__PURE__ */ e(
|
|
39
|
+
a,
|
|
40
|
+
{
|
|
41
|
+
onClick: () => {
|
|
42
|
+
document.getElementById(t)?.focus();
|
|
43
|
+
},
|
|
44
|
+
className: s(
|
|
45
|
+
"cursor-text align-top h-full p-0 [&:has(textarea:focus-visible)]:ring-primary/50 [&:has(textarea:focus-visible)]:ring-[1px]",
|
|
46
|
+
r && "flex flex-col gap-1 w-full lg:table-cell",
|
|
47
|
+
p
|
|
48
|
+
),
|
|
49
|
+
children: [
|
|
50
|
+
r && /* @__PURE__ */ o("label", { className: "pl-4 pt-4 text-muted-foreground lg:hidden", htmlFor: t, children: r }),
|
|
51
|
+
/* @__PURE__ */ o(
|
|
52
|
+
n,
|
|
53
|
+
{
|
|
54
|
+
className: "rounded-none [&_.tiptap]:max-h-48 ring-0! border-none!",
|
|
55
|
+
defaultValue: m,
|
|
56
|
+
onChange: i
|
|
57
|
+
}
|
|
58
|
+
)
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
export {
|
|
64
|
+
S as TranslateRichText
|
|
65
|
+
};
|
package/dist/lib/translate/components/product-form/custom-fields/translate-product-custom-fields.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { isLast as
|
|
1
|
+
import { jsx as s, Fragment as V, jsxs as b } from "react/jsx-runtime";
|
|
2
|
+
import { isLast as r, isFirst as T } from "../../../../../packages/lune-common/dist/index.js";
|
|
3
3
|
import "react";
|
|
4
4
|
import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-accordion/dist/index.js";
|
|
5
|
-
import { cn as
|
|
5
|
+
import { cn as l } from "../../../../../packages/lune-ui/dist/lib/utils.js";
|
|
6
6
|
import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js";
|
|
7
7
|
import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-avatar/dist/index.js";
|
|
8
8
|
import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-separator/dist/index.js";
|
|
@@ -32,88 +32,120 @@ import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-toggle
|
|
|
32
32
|
import "../../../../../packages/lune-ui/dist/components/toggle-group.js";
|
|
33
33
|
import "../../../../../packages/lune-ui/dist/node_modules/@radix-ui/react-tooltip/dist/index.js";
|
|
34
34
|
import "../../../../../packages/lune-ui/dist/form/form.js";
|
|
35
|
-
import { useWatch as
|
|
36
|
-
import { CustomFieldType as
|
|
37
|
-
import { isTranslatable as
|
|
38
|
-
import { TranslateFormRowData as
|
|
39
|
-
import { TranslateInput as
|
|
40
|
-
import {
|
|
41
|
-
import {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
import { useWatch as f } from "../../../../../node_modules/react-hook-form/dist/index.esm.js";
|
|
36
|
+
import { CustomFieldType as m } from "../../../../api/codegen/graphql.js";
|
|
37
|
+
import { isTranslatable as v } from "../../../../custom-fields/utils/custom-field.utils.js";
|
|
38
|
+
import { TranslateFormRowData as d } from "../../form/translate-form-row-data.js";
|
|
39
|
+
import { TranslateInput as p } from "../../form/translate-input.js";
|
|
40
|
+
import { TranslateRichText as y } from "../../form/translate-rich-text.js";
|
|
41
|
+
import { TranslateTextarea as C } from "../../form/translate-textarea.js";
|
|
42
|
+
import { useTranslateProductFormContext as E } from "../use-form/use-translate-product-form.js";
|
|
43
|
+
const dt = ({ product: g }) => {
|
|
44
|
+
const i = E(), a = f({ defaultValue: i.formState.defaultValues }), n = g.customFieldEntries.filter(
|
|
45
|
+
(t) => v(t.definition.type)
|
|
45
46
|
);
|
|
46
|
-
return /* @__PURE__ */
|
|
47
|
-
(t,
|
|
48
|
-
|
|
47
|
+
return /* @__PURE__ */ s(V, { children: n.map(
|
|
48
|
+
(t, u) => t.definition.isList ? t.value.map((o, e) => /* @__PURE__ */ s(
|
|
49
|
+
d,
|
|
49
50
|
{
|
|
50
|
-
field:
|
|
51
|
-
reference:
|
|
51
|
+
field: T(e) ? t.definition.name : "",
|
|
52
|
+
reference: o,
|
|
52
53
|
className: {
|
|
53
|
-
row:
|
|
54
|
-
!e
|
|
55
|
-
e
|
|
54
|
+
row: l(
|
|
55
|
+
!r(e, t.value) && "border-0!",
|
|
56
|
+
r(e, t.value) && r(u, n) && "border-0!"
|
|
56
57
|
),
|
|
57
|
-
referenceCell:
|
|
58
|
+
referenceCell: l(!r(e, t.value) && "border-b")
|
|
58
59
|
},
|
|
59
|
-
children: /* @__PURE__ */
|
|
60
|
-
|
|
60
|
+
children: /* @__PURE__ */ s(
|
|
61
|
+
p,
|
|
61
62
|
{
|
|
62
|
-
defaultValue:
|
|
63
|
-
className:
|
|
64
|
-
!e
|
|
65
|
-
e
|
|
63
|
+
defaultValue: a.customFields?.[t.id][e],
|
|
64
|
+
className: l(
|
|
65
|
+
!r(e, t.value) && "border-b",
|
|
66
|
+
r(e, t.value) && r(u, n) && "ring-0! lg:[&:has(input:focus-visible)]:ring-primary/50! lg:[&:has(input:focus-visible)]:ring-[1px]!"
|
|
66
67
|
),
|
|
67
68
|
label: "English",
|
|
68
|
-
onChange: (
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
...
|
|
72
|
-
[t.id]:
|
|
69
|
+
onChange: (F) => {
|
|
70
|
+
const h = F.target.value, c = i.getValues("customFields")[t.id];
|
|
71
|
+
c[e] = h, i.setValue("customFields", {
|
|
72
|
+
...i.getValues("customFields"),
|
|
73
|
+
[t.id]: c
|
|
73
74
|
});
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
77
|
)
|
|
77
78
|
},
|
|
78
|
-
t.definition.id +
|
|
79
|
-
)) : /* @__PURE__ */
|
|
80
|
-
|
|
79
|
+
t.definition.id + e
|
|
80
|
+
)) : /* @__PURE__ */ b(
|
|
81
|
+
d,
|
|
81
82
|
{
|
|
83
|
+
richText: t.definition.type === m.RichText,
|
|
82
84
|
field: t.definition.name,
|
|
83
85
|
reference: t.value,
|
|
84
|
-
className:
|
|
85
|
-
children:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
86
|
+
className: l(r(u, n) && "border-b-0"),
|
|
87
|
+
children: [
|
|
88
|
+
t.definition.type === m.SingleLineText && /* @__PURE__ */ s(
|
|
89
|
+
p,
|
|
90
|
+
{
|
|
91
|
+
defaultValue: a.customFields?.[t.id],
|
|
92
|
+
label: "English",
|
|
93
|
+
onChange: (o) => {
|
|
94
|
+
const e = o.target.value;
|
|
95
|
+
i.setValue("customFields", {
|
|
96
|
+
...i.getValues("customFields"),
|
|
97
|
+
[t.id]: e
|
|
98
|
+
});
|
|
99
|
+
}
|
|
96
100
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
101
|
+
),
|
|
102
|
+
t.definition.type === m.MultiLineText && /* @__PURE__ */ s(
|
|
103
|
+
C,
|
|
104
|
+
{
|
|
105
|
+
defaultValue: a.customFields?.[t.id],
|
|
106
|
+
label: "English",
|
|
107
|
+
onChange: (o) => {
|
|
108
|
+
const e = o.target.value;
|
|
109
|
+
i.setValue("customFields", {
|
|
110
|
+
...i.getValues("customFields"),
|
|
111
|
+
[t.id]: e
|
|
112
|
+
});
|
|
113
|
+
}
|
|
109
114
|
}
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
),
|
|
116
|
+
t.definition.type === m.RichText && /* @__PURE__ */ s(
|
|
117
|
+
y,
|
|
118
|
+
{
|
|
119
|
+
defaultValue: a.customFields?.[t.id],
|
|
120
|
+
label: "English",
|
|
121
|
+
onChange: (o) => {
|
|
122
|
+
i.setValue("customFields", {
|
|
123
|
+
...i.getValues("customFields"),
|
|
124
|
+
[t.id]: o
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
),
|
|
129
|
+
t.definition.type === m.Url && /* @__PURE__ */ s(
|
|
130
|
+
p,
|
|
131
|
+
{
|
|
132
|
+
defaultValue: a.customFields?.[t.id],
|
|
133
|
+
label: "English",
|
|
134
|
+
onChange: (o) => {
|
|
135
|
+
const e = o.target.value;
|
|
136
|
+
i.setValue("customFields", {
|
|
137
|
+
...i.getValues("customFields"),
|
|
138
|
+
[t.id]: e
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
]
|
|
112
144
|
},
|
|
113
145
|
t.definition.id
|
|
114
146
|
)
|
|
115
147
|
) });
|
|
116
148
|
};
|
|
117
149
|
export {
|
|
118
|
-
|
|
150
|
+
dt as TranslateProductCustomField
|
|
119
151
|
};
|