@object-ui/plugin-detail 3.1.5 → 3.3.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/CHANGELOG.md +31 -0
- package/README.md +21 -1
- package/dist/AddressField-LgHnO2Lk.js +98 -0
- package/dist/AutoNumberField-xZCrU0eW.js +14 -0
- package/dist/{AvatarField-YGj51ozd.js → AvatarField-Dy2XGlPz.js} +16 -15
- package/dist/{BooleanField-CaA898Tk.js → BooleanField-C0Clfka5.js} +11 -10
- package/dist/CodeField-CHUa07B6.js +23 -0
- package/dist/ColorField-vxHqEhcS.js +38 -0
- package/dist/CurrencyField-DiWjYWDo.js +49 -0
- package/dist/DateField-DGaRPM4P.js +22 -0
- package/dist/DateTimeField-8QnpsI_h.js +30 -0
- package/dist/EmailField-CkVgMbpI.js +26 -0
- package/dist/FileField-5UPV7uek.js +149 -0
- package/dist/FormulaField-BUgt6-Pi.js +17 -0
- package/dist/GeolocationField-D9T_jgG6.js +118 -0
- package/dist/GridField-DE_HwiIN.js +49 -0
- package/dist/ImageField-Dswnqtzf.js +73 -0
- package/dist/LocationField-gjqbE6na.js +36 -0
- package/dist/LookupField-BcS3LRKc.js +901 -0
- package/dist/{MasterDetailField-I1A9oEGC.js → MasterDetailField-BF6_-X3A.js} +20 -19
- package/dist/NumberField-Dj2rYmrS.js +27 -0
- package/dist/ObjectField-BymIojwd.js +50 -0
- package/dist/{PasswordField-DBtluGJ1.js → PasswordField-ED_Xgqz-.js} +8 -7
- package/dist/PercentField-D-JKOxKC.js +61 -0
- package/dist/PhoneField-DSCaGYq7.js +26 -0
- package/dist/QRCodeField-CtcOUapi.js +73 -0
- package/dist/{RatingField-B_Mnr63i.js → RatingField-BDnyQFWy.js} +10 -9
- package/dist/RichTextField-CH6LVZQA.js +33 -0
- package/dist/SelectField-DE4dpkMV.js +36 -0
- package/dist/{SignatureField-CddhEK9u.js → SignatureField-B1wh3f5A.js} +18 -17
- package/dist/{SliderField-Df5hMzNc.js → SliderField-zoTCKh9n.js} +2 -1
- package/dist/SummaryField-BeBVT6VN.js +22 -0
- package/dist/TextAreaField-rfUGrRxh.js +37 -0
- package/dist/TextField-C_yM7ATQ.js +30 -0
- package/dist/TimeField-BcQmBZi9.js +22 -0
- package/dist/UrlField-BakaF6NI.js +31 -0
- package/dist/UserField-zS7y3eKb.js +76 -0
- package/dist/VectorField-CTZ4myDM.js +34 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1741 -1504
- package/dist/index.umd.cjs +43 -51
- package/dist/packages/plugin-detail/src/ActivityTimeline.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/CommentAttachment.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/CommentInput.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/DetailSection.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/DetailTabs.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/DetailView.d.ts +47 -0
- package/dist/packages/plugin-detail/src/DetailView.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/DetailView.stories.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/DiffView.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/FieldChangeItem.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/HeaderHighlight.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/InlineCreateRelated.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/MentionAutocomplete.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/PointInTimeRestore.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/ReactionPicker.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RecordActivityTimeline.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RecordChatterPanel.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RecordComments.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RecordNavigationEnhanced.d.ts.map +1 -0
- package/dist/{src → packages/plugin-detail/src}/RelatedList.d.ts +8 -0
- package/dist/packages/plugin-detail/src/RelatedList.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RelationshipGraph.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/RichTextCommentInput.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/SectionGroup.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/SubscriptionToggle.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/ThreadedReplies.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/autoLayout.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/index.d.ts.map +1 -0
- package/dist/packages/plugin-detail/src/useDetailTranslation.d.ts.map +1 -0
- package/dist/plugin-detail.css +1 -2
- package/dist/rolldown-runtime-DnwLefa7.js +23 -0
- package/dist/{src-CXr1-vVl.js → src-DyUKLvMN.js} +29788 -37711
- package/dist/useFieldTranslation-BRgjC1oq.js +9 -0
- package/package.json +34 -12
- package/.turbo/turbo-build.log +0 -61
- package/dist/AddressField-DBkEyMcG.js +0 -93
- package/dist/AutoNumberField-Baa191z-.js +0 -14
- package/dist/CodeField-BU51nl1L.js +0 -22
- package/dist/ColorField-Cnf6ZM7c.js +0 -37
- package/dist/CurrencyField-Wg-XOId2.js +0 -51
- package/dist/DateField-Cth1ky_m.js +0 -21
- package/dist/DateTimeField-B0m6FhHL.js +0 -32
- package/dist/EmailField-Do7qT_L_.js +0 -28
- package/dist/FileField-aRJAdbQb.js +0 -151
- package/dist/FormulaField-DTMkagFx.js +0 -14
- package/dist/GeolocationField-RqpHWTEv.js +0 -113
- package/dist/GridField-D4IH0cpo.js +0 -51
- package/dist/ImageField-BYCFajjr.js +0 -75
- package/dist/LocationField-Bi_ew9sd.js +0 -35
- package/dist/LookupField-BjwlDPtt.js +0 -902
- package/dist/NumberField-D_NucQlp.js +0 -26
- package/dist/ObjectField-CG-LaM65.js +0 -52
- package/dist/PercentField-B6sO_J3i.js +0 -63
- package/dist/PhoneField-CcQAWwR6.js +0 -28
- package/dist/QRCodeField-CEjWs-J5.js +0 -72
- package/dist/RichTextField-qOEJl5Ai.js +0 -32
- package/dist/SelectField-C8hWu3gm.js +0 -30
- package/dist/SummaryField-DgiFm-Cr.js +0 -19
- package/dist/TextAreaField-DuriTqsD.js +0 -36
- package/dist/TextField-CGNSl7RU.js +0 -29
- package/dist/TimeField-YO58ctFg.js +0 -21
- package/dist/UrlField-1-BMM1jn.js +0 -33
- package/dist/UserField-B6GqxP_S.js +0 -78
- package/dist/VectorField-BkEjbSt0.js +0 -36
- package/dist/src/ActivityTimeline.d.ts.map +0 -1
- package/dist/src/CommentAttachment.d.ts.map +0 -1
- package/dist/src/CommentInput.d.ts.map +0 -1
- package/dist/src/DetailSection.d.ts.map +0 -1
- package/dist/src/DetailTabs.d.ts.map +0 -1
- package/dist/src/DetailView.d.ts +0 -23
- package/dist/src/DetailView.d.ts.map +0 -1
- package/dist/src/DetailView.stories.d.ts.map +0 -1
- package/dist/src/DiffView.d.ts.map +0 -1
- package/dist/src/FieldChangeItem.d.ts.map +0 -1
- package/dist/src/HeaderHighlight.d.ts.map +0 -1
- package/dist/src/InlineCreateRelated.d.ts.map +0 -1
- package/dist/src/MentionAutocomplete.d.ts.map +0 -1
- package/dist/src/PointInTimeRestore.d.ts.map +0 -1
- package/dist/src/ReactionPicker.d.ts.map +0 -1
- package/dist/src/RecordActivityTimeline.d.ts.map +0 -1
- package/dist/src/RecordChatterPanel.d.ts.map +0 -1
- package/dist/src/RecordComments.d.ts.map +0 -1
- package/dist/src/RecordNavigationEnhanced.d.ts.map +0 -1
- package/dist/src/RelatedList.d.ts.map +0 -1
- package/dist/src/RelationshipGraph.d.ts.map +0 -1
- package/dist/src/RichTextCommentInput.d.ts.map +0 -1
- package/dist/src/SectionGroup.d.ts.map +0 -1
- package/dist/src/SubscriptionToggle.d.ts.map +0 -1
- package/dist/src/ThreadedReplies.d.ts.map +0 -1
- package/dist/src/autoLayout.d.ts.map +0 -1
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/useDetailTranslation.d.ts.map +0 -1
- package/src/ActivityTimeline.tsx +0 -184
- package/src/CommentAttachment.tsx +0 -192
- package/src/CommentInput.tsx +0 -81
- package/src/DetailSection.tsx +0 -340
- package/src/DetailTabs.tsx +0 -73
- package/src/DetailView.stories.tsx +0 -334
- package/src/DetailView.tsx +0 -823
- package/src/DiffView.tsx +0 -231
- package/src/FieldChangeItem.tsx +0 -46
- package/src/HeaderHighlight.tsx +0 -88
- package/src/InlineCreateRelated.tsx +0 -291
- package/src/MentionAutocomplete.tsx +0 -123
- package/src/PointInTimeRestore.tsx +0 -261
- package/src/ReactionPicker.tsx +0 -106
- package/src/RecordActivityTimeline.tsx +0 -429
- package/src/RecordChatterPanel.tsx +0 -207
- package/src/RecordComments.tsx +0 -215
- package/src/RecordNavigationEnhanced.tsx +0 -211
- package/src/RelatedList.tsx +0 -413
- package/src/RelationshipGraph.tsx +0 -286
- package/src/RichTextCommentInput.tsx +0 -348
- package/src/SectionGroup.tsx +0 -101
- package/src/SubscriptionToggle.tsx +0 -60
- package/src/ThreadedReplies.tsx +0 -161
- package/src/__tests__/ActivityTimeline.test.tsx +0 -119
- package/src/__tests__/ActivityTimelineFiltering.test.tsx +0 -143
- package/src/__tests__/CommentInput.test.tsx +0 -57
- package/src/__tests__/DetailSection.test.tsx +0 -490
- package/src/__tests__/DetailView.test.tsx +0 -694
- package/src/__tests__/FieldChangeItem.test.tsx +0 -119
- package/src/__tests__/HeaderHighlight.test.tsx +0 -213
- package/src/__tests__/MentionAutocomplete.test.tsx +0 -97
- package/src/__tests__/ReactionPicker.test.tsx +0 -113
- package/src/__tests__/RecordActivityTimeline.test.tsx +0 -395
- package/src/__tests__/RecordChatterPanel.test.tsx +0 -265
- package/src/__tests__/RecordComments.test.tsx +0 -96
- package/src/__tests__/RecordCommentsPinSearch.test.tsx +0 -133
- package/src/__tests__/RelatedList.test.tsx +0 -160
- package/src/__tests__/SectionGroup.test.tsx +0 -101
- package/src/__tests__/SubscriptionToggle.test.tsx +0 -84
- package/src/__tests__/ThreadedReplies.test.tsx +0 -212
- package/src/__tests__/autoLayout.test.ts +0 -228
- package/src/__tests__/phase12-features.test.tsx +0 -583
- package/src/__tests__/roadmap-features.test.tsx +0 -478
- package/src/autoLayout.ts +0 -128
- package/src/index.tsx +0 -149
- package/src/useDetailTranslation.ts +0 -114
- package/tsconfig.json +0 -18
- package/vite.config.ts +0 -56
- package/vitest.config.ts +0 -13
- package/vitest.setup.ts +0 -1
- /package/dist/{src → packages/plugin-detail/src}/ActivityTimeline.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/CommentAttachment.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/CommentInput.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/DetailSection.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/DetailTabs.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/DetailView.stories.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/DiffView.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/FieldChangeItem.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/HeaderHighlight.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/InlineCreateRelated.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/MentionAutocomplete.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/PointInTimeRestore.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/ReactionPicker.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/RecordActivityTimeline.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/RecordChatterPanel.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/RecordComments.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/RecordNavigationEnhanced.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/RelationshipGraph.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/RichTextCommentInput.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/SectionGroup.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/SubscriptionToggle.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/ThreadedReplies.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/autoLayout.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/index.d.ts +0 -0
- /package/dist/{src → packages/plugin-detail/src}/useDetailTranslation.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @object-ui/plugin-detail
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [b429568]
|
|
8
|
+
- @object-ui/components@3.3.1
|
|
9
|
+
- @object-ui/fields@3.3.1
|
|
10
|
+
- @object-ui/types@3.3.1
|
|
11
|
+
- @object-ui/core@3.3.1
|
|
12
|
+
- @object-ui/react@3.3.1
|
|
13
|
+
|
|
14
|
+
## 3.3.0
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- @object-ui/types@3.3.0
|
|
19
|
+
- @object-ui/core@3.3.0
|
|
20
|
+
- @object-ui/react@3.3.0
|
|
21
|
+
- @object-ui/components@3.3.0
|
|
22
|
+
- @object-ui/fields@3.3.0
|
|
23
|
+
|
|
24
|
+
## 3.2.0
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- @object-ui/types@3.2.0
|
|
29
|
+
- @object-ui/core@3.2.0
|
|
30
|
+
- @object-ui/react@3.2.0
|
|
31
|
+
- @object-ui/components@3.2.0
|
|
32
|
+
- @object-ui/fields@3.2.0
|
|
33
|
+
|
|
3
34
|
## 3.1.5
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -192,6 +192,26 @@ Tab navigation for organizing content into different views.
|
|
|
192
192
|
|
|
193
193
|
Displays related records in list, grid, or table format.
|
|
194
194
|
|
|
195
|
+
<!-- release-metadata:v3.3.0 -->
|
|
196
|
+
|
|
197
|
+
## Compatibility
|
|
198
|
+
|
|
199
|
+
- **React:** 18.x or 19.x
|
|
200
|
+
- **Node.js:** ≥ 18
|
|
201
|
+
- **TypeScript:** ≥ 5.0 (strict mode)
|
|
202
|
+
- **`@objectstack/spec`:** ^3.3.0
|
|
203
|
+
- **`@objectstack/client`:** ^3.3.0
|
|
204
|
+
- **Tailwind CSS:** ≥ 3.4 (for packages with UI)
|
|
205
|
+
|
|
206
|
+
## Links
|
|
207
|
+
|
|
208
|
+
- 📚 [Documentation](https://www.objectui.org/docs/plugins/plugin-detail)
|
|
209
|
+
- 📦 [npm package](https://www.npmjs.com/package/@object-ui/plugin-detail)
|
|
210
|
+
- 📝 [Changelog](./CHANGELOG.md)
|
|
211
|
+
- 🐛 [Report an issue](https://github.com/objectstack-ai/objectui/issues)
|
|
212
|
+
- 🤝 [Contributing Guide](https://github.com/objectstack-ai/objectui/blob/main/CONTRIBUTING.md)
|
|
213
|
+
- 🗺️ [Roadmap](https://github.com/objectstack-ai/objectui/blob/main/ROADMAP.md)
|
|
214
|
+
|
|
195
215
|
## License
|
|
196
216
|
|
|
197
|
-
MIT
|
|
217
|
+
MIT — see [LICENSE](./LICENSE).
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { O as t, k as n, t as r } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/AddressField.tsx
|
|
6
|
+
var o = /* @__PURE__ */ e({ AddressField: () => s });
|
|
7
|
+
function s({ value: e, onChange: o, field: s, readonly: c, ...l }) {
|
|
8
|
+
let u = e || {}, d = (e, t) => {
|
|
9
|
+
o({
|
|
10
|
+
...u,
|
|
11
|
+
[e]: t
|
|
12
|
+
});
|
|
13
|
+
}, f = (e) => [
|
|
14
|
+
e.street,
|
|
15
|
+
e.city,
|
|
16
|
+
[e.state, e.zipCode].filter(Boolean).join(" "),
|
|
17
|
+
e.country
|
|
18
|
+
].filter(Boolean).join(", ");
|
|
19
|
+
if (c) {
|
|
20
|
+
let e = f(u);
|
|
21
|
+
return e ? /* @__PURE__ */ i("span", {
|
|
22
|
+
className: "text-sm",
|
|
23
|
+
children: e
|
|
24
|
+
}) : /* @__PURE__ */ i(r, {});
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ a("div", {
|
|
27
|
+
className: "space-y-3",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(n, {
|
|
30
|
+
htmlFor: "street",
|
|
31
|
+
className: "text-xs",
|
|
32
|
+
children: "Street Address"
|
|
33
|
+
}), /* @__PURE__ */ i(t, {
|
|
34
|
+
id: "street",
|
|
35
|
+
type: "text",
|
|
36
|
+
value: u.street || "",
|
|
37
|
+
onChange: (e) => d("street", e.target.value),
|
|
38
|
+
placeholder: "123 Main St",
|
|
39
|
+
disabled: c || l.disabled,
|
|
40
|
+
className: l.className
|
|
41
|
+
})] }),
|
|
42
|
+
/* @__PURE__ */ a("div", {
|
|
43
|
+
className: "grid grid-cols-2 gap-3",
|
|
44
|
+
children: [/* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(n, {
|
|
45
|
+
htmlFor: "city",
|
|
46
|
+
className: "text-xs",
|
|
47
|
+
children: "City"
|
|
48
|
+
}), /* @__PURE__ */ i(t, {
|
|
49
|
+
id: "city",
|
|
50
|
+
type: "text",
|
|
51
|
+
value: u.city || "",
|
|
52
|
+
onChange: (e) => d("city", e.target.value),
|
|
53
|
+
placeholder: "San Francisco",
|
|
54
|
+
disabled: c || l.disabled
|
|
55
|
+
})] }), /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(n, {
|
|
56
|
+
htmlFor: "state",
|
|
57
|
+
className: "text-xs",
|
|
58
|
+
children: "State / Province"
|
|
59
|
+
}), /* @__PURE__ */ i(t, {
|
|
60
|
+
id: "state",
|
|
61
|
+
type: "text",
|
|
62
|
+
value: u.state || "",
|
|
63
|
+
onChange: (e) => d("state", e.target.value),
|
|
64
|
+
placeholder: "CA",
|
|
65
|
+
disabled: c || l.disabled
|
|
66
|
+
})] })]
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ a("div", {
|
|
69
|
+
className: "grid grid-cols-2 gap-3",
|
|
70
|
+
children: [/* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(n, {
|
|
71
|
+
htmlFor: "zipCode",
|
|
72
|
+
className: "text-xs",
|
|
73
|
+
children: "ZIP / Postal Code"
|
|
74
|
+
}), /* @__PURE__ */ i(t, {
|
|
75
|
+
id: "zipCode",
|
|
76
|
+
type: "text",
|
|
77
|
+
value: u.zipCode || "",
|
|
78
|
+
onChange: (e) => d("zipCode", e.target.value),
|
|
79
|
+
placeholder: "94102",
|
|
80
|
+
disabled: c || l.disabled
|
|
81
|
+
})] }), /* @__PURE__ */ a("div", { children: [/* @__PURE__ */ i(n, {
|
|
82
|
+
htmlFor: "country",
|
|
83
|
+
className: "text-xs",
|
|
84
|
+
children: "Country"
|
|
85
|
+
}), /* @__PURE__ */ i(t, {
|
|
86
|
+
id: "country",
|
|
87
|
+
type: "text",
|
|
88
|
+
value: u.country || "",
|
|
89
|
+
onChange: (e) => d("country", e.target.value),
|
|
90
|
+
placeholder: "United States",
|
|
91
|
+
disabled: c || l.disabled
|
|
92
|
+
})] })]
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
98
|
+
export { o as t };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { t } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/AutoNumberField.tsx
|
|
6
|
+
var r = /* @__PURE__ */ e({ AutoNumberField: () => i });
|
|
7
|
+
function i({ value: e, field: r, ...i }) {
|
|
8
|
+
return e == null ? /* @__PURE__ */ n(t, { className: i.className }) : /* @__PURE__ */ n("span", {
|
|
9
|
+
className: `text-sm font-mono text-gray-700 ${i.className || ""}`,
|
|
10
|
+
children: String(e)
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { r as t };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { G as t, K as n, W as r, X as i, Z as a, q as o } from "./src-DyUKLvMN.js";
|
|
2
3
|
import s from "react";
|
|
3
4
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
4
5
|
//#region ../fields/src/widgets/AvatarField.tsx
|
|
5
|
-
var u = /* @__PURE__ */
|
|
6
|
-
function d({ value:
|
|
6
|
+
var u = /* @__PURE__ */ e({ AvatarField: () => d });
|
|
7
|
+
function d({ value: e, onChange: u, field: d, readonly: f, ...p }) {
|
|
7
8
|
let [m, h] = s.useState(!1), g = s.useRef(null), _ = d || p.schema, v = (e) => {
|
|
8
9
|
let t = e.target.files?.[0];
|
|
9
10
|
if (!t) return;
|
|
@@ -22,29 +23,29 @@ function d({ value: o, onChange: u, field: d, readonly: f, ...p }) {
|
|
|
22
23
|
}, y = () => {
|
|
23
24
|
u("");
|
|
24
25
|
}, b = () => (_?.defaultName || _?.label || "User").split(" ").map((e) => e[0]).join("").toUpperCase().slice(0, 2);
|
|
25
|
-
return f ? /* @__PURE__ */ l(
|
|
26
|
+
return f ? /* @__PURE__ */ l(r, {
|
|
26
27
|
className: "w-16 h-16",
|
|
27
|
-
children: [
|
|
28
|
-
src:
|
|
28
|
+
children: [e && /* @__PURE__ */ c(n, {
|
|
29
|
+
src: e,
|
|
29
30
|
alt: _?.label
|
|
30
|
-
}), /* @__PURE__ */ c(
|
|
31
|
+
}), /* @__PURE__ */ c(t, { children: b() })]
|
|
31
32
|
}) : /* @__PURE__ */ l("div", {
|
|
32
33
|
className: "flex items-center gap-4",
|
|
33
34
|
children: [/* @__PURE__ */ l("div", {
|
|
34
35
|
className: "relative",
|
|
35
36
|
onMouseEnter: () => h(!0),
|
|
36
37
|
onMouseLeave: () => h(!1),
|
|
37
|
-
children: [/* @__PURE__ */ l(
|
|
38
|
+
children: [/* @__PURE__ */ l(r, {
|
|
38
39
|
className: "w-16 h-16",
|
|
39
|
-
children: [
|
|
40
|
-
src:
|
|
40
|
+
children: [e && /* @__PURE__ */ c(n, {
|
|
41
|
+
src: e,
|
|
41
42
|
alt: _?.label
|
|
42
|
-
}), /* @__PURE__ */ c(
|
|
43
|
-
}), !f && m &&
|
|
43
|
+
}), /* @__PURE__ */ c(t, { children: b() })]
|
|
44
|
+
}), !f && m && e && /* @__PURE__ */ c("button", {
|
|
44
45
|
type: "button",
|
|
45
46
|
onClick: y,
|
|
46
47
|
className: "absolute -top-1 -right-1 bg-destructive text-destructive-foreground rounded-full p-1 hover:bg-destructive/90",
|
|
47
|
-
children: /* @__PURE__ */ c(
|
|
48
|
+
children: /* @__PURE__ */ c(i, { className: "w-3 h-3" })
|
|
48
49
|
})]
|
|
49
50
|
}), /* @__PURE__ */ l("div", {
|
|
50
51
|
className: "flex flex-col gap-2",
|
|
@@ -56,7 +57,7 @@ function d({ value: o, onChange: u, field: d, readonly: f, ...p }) {
|
|
|
56
57
|
onChange: v,
|
|
57
58
|
className: "hidden"
|
|
58
59
|
}),
|
|
59
|
-
/* @__PURE__ */ l(
|
|
60
|
+
/* @__PURE__ */ l(o, {
|
|
60
61
|
type: "button",
|
|
61
62
|
variant: "outline",
|
|
62
63
|
size: "sm",
|
|
@@ -64,7 +65,7 @@ function d({ value: o, onChange: u, field: d, readonly: f, ...p }) {
|
|
|
64
65
|
disabled: f || p.disabled,
|
|
65
66
|
children: [
|
|
66
67
|
/* @__PURE__ */ c(a, { className: "w-4 h-4 mr-2" }),
|
|
67
|
-
|
|
68
|
+
e ? "Change" : "Upload",
|
|
68
69
|
" Avatar"
|
|
69
70
|
]
|
|
70
71
|
}),
|
|
@@ -1,36 +1,37 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { R as t, k as n, p as r } from "./src-DyUKLvMN.js";
|
|
2
3
|
import { useId as i } from "react";
|
|
3
4
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
4
5
|
//#region ../fields/src/widgets/BooleanField.tsx
|
|
5
|
-
var s = /* @__PURE__ */
|
|
6
|
-
function c({ value:
|
|
6
|
+
var s = /* @__PURE__ */ e({ BooleanField: () => c });
|
|
7
|
+
function c({ value: e, onChange: s, field: c, readonly: l, ...u }) {
|
|
7
8
|
let d = c || u.schema, f = d?.widget, p = i(), m = d?.name || p, h = d?.label || "Checkbox";
|
|
8
9
|
if (l) return /* @__PURE__ */ a("span", {
|
|
9
10
|
className: "text-sm",
|
|
10
|
-
children:
|
|
11
|
+
children: e ? "Yes" : "No"
|
|
11
12
|
});
|
|
12
13
|
let { inputType: g, ..._ } = u;
|
|
13
14
|
return f === "checkbox" ? /* @__PURE__ */ o("div", {
|
|
14
15
|
className: "flex items-center space-x-2",
|
|
15
|
-
children: [/* @__PURE__ */ a(
|
|
16
|
+
children: [/* @__PURE__ */ a(t, {
|
|
16
17
|
..._,
|
|
17
18
|
id: m,
|
|
18
|
-
checked: !!
|
|
19
|
+
checked: !!e,
|
|
19
20
|
onCheckedChange: (e) => s(!!e),
|
|
20
21
|
disabled: l || _.disabled
|
|
21
|
-
}), /* @__PURE__ */ a(
|
|
22
|
+
}), /* @__PURE__ */ a(n, {
|
|
22
23
|
htmlFor: m,
|
|
23
24
|
children: h
|
|
24
25
|
})]
|
|
25
26
|
}) : /* @__PURE__ */ o("div", {
|
|
26
27
|
className: "flex items-center space-x-2",
|
|
27
|
-
children: [/* @__PURE__ */ a(
|
|
28
|
+
children: [/* @__PURE__ */ a(r, {
|
|
28
29
|
..._,
|
|
29
30
|
id: m,
|
|
30
|
-
checked: !!
|
|
31
|
+
checked: !!e,
|
|
31
32
|
onCheckedChange: s,
|
|
32
33
|
disabled: l || _.disabled
|
|
33
|
-
}), /* @__PURE__ */ a(
|
|
34
|
+
}), /* @__PURE__ */ a(n, {
|
|
34
35
|
htmlFor: m,
|
|
35
36
|
children: h
|
|
36
37
|
})]
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { an as t, n, t as r } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/CodeField.tsx
|
|
6
|
+
var a = /* @__PURE__ */ e({ CodeField: () => o });
|
|
7
|
+
function o({ value: e, onChange: a, field: o, readonly: s, ...c }) {
|
|
8
|
+
let l = o || c.schema, u = l?.language ?? "javascript";
|
|
9
|
+
return s ? /* @__PURE__ */ i("pre", {
|
|
10
|
+
className: t("text-sm bg-muted p-2 rounded overflow-x-auto border", c.className),
|
|
11
|
+
children: /* @__PURE__ */ i("code", { children: e || /* @__PURE__ */ i(r, {}) })
|
|
12
|
+
}) : /* @__PURE__ */ i(n, {
|
|
13
|
+
value: e || "",
|
|
14
|
+
onChange: (e) => a(e.target.value),
|
|
15
|
+
placeholder: l?.placeholder || `// Write ${u} code here...`,
|
|
16
|
+
disabled: s || c.disabled,
|
|
17
|
+
className: t("font-mono text-sm", c.className),
|
|
18
|
+
rows: 12,
|
|
19
|
+
spellCheck: !1
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as t };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { O as t, t as n } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/ColorField.tsx
|
|
6
|
+
var a = /* @__PURE__ */ e({ ColorField: () => o });
|
|
7
|
+
function o({ value: e, onChange: a, field: o, readonly: s, ...c }) {
|
|
8
|
+
let l = o || c.schema;
|
|
9
|
+
return s ? /* @__PURE__ */ i("div", {
|
|
10
|
+
className: "flex items-center gap-2",
|
|
11
|
+
children: [/* @__PURE__ */ r("div", {
|
|
12
|
+
className: "w-6 h-6 rounded border border-input",
|
|
13
|
+
style: { backgroundColor: e || "#000000" }
|
|
14
|
+
}), /* @__PURE__ */ r("span", {
|
|
15
|
+
className: "text-sm",
|
|
16
|
+
children: e || /* @__PURE__ */ r(n, {})
|
|
17
|
+
})]
|
|
18
|
+
}) : /* @__PURE__ */ i("div", {
|
|
19
|
+
className: "flex items-center gap-2",
|
|
20
|
+
children: [/* @__PURE__ */ r("input", {
|
|
21
|
+
type: "color",
|
|
22
|
+
value: e || "#000000",
|
|
23
|
+
onChange: (e) => a(e.target.value),
|
|
24
|
+
disabled: s || c.disabled,
|
|
25
|
+
className: "w-10 h-10 rounded border border-input cursor-pointer"
|
|
26
|
+
}), /* @__PURE__ */ r(t, {
|
|
27
|
+
type: "text",
|
|
28
|
+
value: e || "",
|
|
29
|
+
onChange: (e) => a(e.target.value),
|
|
30
|
+
placeholder: l?.placeholder || "#000000",
|
|
31
|
+
disabled: s || c.disabled,
|
|
32
|
+
className: c.className,
|
|
33
|
+
pattern: "^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$"
|
|
34
|
+
})]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { a as t };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { O as t, t as n } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/CurrencyField.tsx
|
|
6
|
+
var a = /* @__PURE__ */ e({ CurrencyField: () => s });
|
|
7
|
+
function o(e, t = "USD") {
|
|
8
|
+
try {
|
|
9
|
+
return new Intl.NumberFormat("en-US", {
|
|
10
|
+
style: "currency",
|
|
11
|
+
currency: t
|
|
12
|
+
}).format(e);
|
|
13
|
+
} catch {
|
|
14
|
+
return `${t} ${e.toFixed(2)}`;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function s({ value: e, onChange: a, field: s, readonly: c, errorMessage: l, className: u, ...d }) {
|
|
18
|
+
let f = s || d.schema, p = f?.currency || "USD", m = f?.precision ?? 2;
|
|
19
|
+
if (c) return e == null ? /* @__PURE__ */ r(n, {}) : /* @__PURE__ */ r("span", {
|
|
20
|
+
className: "text-sm font-medium tabular-nums",
|
|
21
|
+
children: o(Number(e), p)
|
|
22
|
+
});
|
|
23
|
+
let h = (e) => {
|
|
24
|
+
let t = parseFloat(e.target.value);
|
|
25
|
+
isNaN(t) || a(parseFloat(t.toFixed(m)));
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ i("div", {
|
|
28
|
+
className: "relative",
|
|
29
|
+
children: [/* @__PURE__ */ r("span", {
|
|
30
|
+
className: "absolute left-3 top-1/2 -translate-y-1/2 text-sm text-gray-500",
|
|
31
|
+
children: p === "USD" ? "$" : p
|
|
32
|
+
}), /* @__PURE__ */ r(t, {
|
|
33
|
+
...d,
|
|
34
|
+
type: "number",
|
|
35
|
+
value: e ?? "",
|
|
36
|
+
onChange: (e) => {
|
|
37
|
+
a(e.target.value === "" ? null : parseFloat(e.target.value));
|
|
38
|
+
},
|
|
39
|
+
onBlur: h,
|
|
40
|
+
placeholder: f?.placeholder || "0.00",
|
|
41
|
+
disabled: c || d.disabled,
|
|
42
|
+
className: `pl-8 ${u || ""}`,
|
|
43
|
+
step: (10 ** -m).toFixed(m),
|
|
44
|
+
"aria-invalid": !!l
|
|
45
|
+
})]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { a as t };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { O as t, t as n } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/DateField.tsx
|
|
6
|
+
var i = /* @__PURE__ */ e({ DateField: () => a });
|
|
7
|
+
function a({ value: e, onChange: i, field: a, readonly: o, ...s }) {
|
|
8
|
+
if (o) return e ? /* @__PURE__ */ r("span", {
|
|
9
|
+
className: "text-sm",
|
|
10
|
+
children: new Date(e).toLocaleDateString()
|
|
11
|
+
}) : /* @__PURE__ */ r(n, {});
|
|
12
|
+
let { inputType: c, ...l } = s;
|
|
13
|
+
return /* @__PURE__ */ r(t, {
|
|
14
|
+
...l,
|
|
15
|
+
type: "date",
|
|
16
|
+
value: e || "",
|
|
17
|
+
onChange: (e) => i(e.target.value),
|
|
18
|
+
disabled: o || l.disabled
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { i as t };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { O as t, t as n } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/DateTimeField.tsx
|
|
6
|
+
var a = /* @__PURE__ */ e({ DateTimeField: () => o });
|
|
7
|
+
function o({ value: e, onChange: a, field: o, readonly: s, ...c }) {
|
|
8
|
+
if (s) {
|
|
9
|
+
if (!e) return /* @__PURE__ */ r(n, {});
|
|
10
|
+
let t = new Date(e);
|
|
11
|
+
return /* @__PURE__ */ i("span", {
|
|
12
|
+
className: "text-sm",
|
|
13
|
+
children: [
|
|
14
|
+
t.toLocaleDateString(),
|
|
15
|
+
" ",
|
|
16
|
+
t.toLocaleTimeString()
|
|
17
|
+
]
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
let { inputType: l, ...u } = c;
|
|
21
|
+
return /* @__PURE__ */ r(t, {
|
|
22
|
+
...u,
|
|
23
|
+
type: "datetime-local",
|
|
24
|
+
value: e || "",
|
|
25
|
+
onChange: (e) => a(e.target.value),
|
|
26
|
+
disabled: s || u.disabled
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
export { a as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { O as t, t as n } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/EmailField.tsx
|
|
6
|
+
var i = /* @__PURE__ */ e({ EmailField: () => a });
|
|
7
|
+
function a({ value: e, onChange: i, field: a, readonly: o, errorMessage: s, ...c }) {
|
|
8
|
+
let l = a || c.schema;
|
|
9
|
+
if (o) return e ? /* @__PURE__ */ r("a", {
|
|
10
|
+
href: `mailto:${e}`,
|
|
11
|
+
className: "text-sm text-blue-600 hover:text-blue-800 hover:underline",
|
|
12
|
+
children: e
|
|
13
|
+
}) : /* @__PURE__ */ r(n, {});
|
|
14
|
+
let { inputType: u, ...d } = c;
|
|
15
|
+
return /* @__PURE__ */ r(t, {
|
|
16
|
+
...d,
|
|
17
|
+
type: "email",
|
|
18
|
+
value: e || "",
|
|
19
|
+
onChange: (e) => i(e.target.value),
|
|
20
|
+
placeholder: l?.placeholder || "email@example.com",
|
|
21
|
+
disabled: o || d.disabled,
|
|
22
|
+
"aria-invalid": !!s
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//#endregion
|
|
26
|
+
export { i as t };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { Et as t, Ot as n, X as r, Z as i, q as a, t as o } from "./src-DyUKLvMN.js";
|
|
3
|
+
import { useCallback as s, useRef as c, useState as l } from "react";
|
|
4
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/FileField.tsx
|
|
6
|
+
var f = /* @__PURE__ */ e({ FileField: () => p });
|
|
7
|
+
function p({ value: e, onChange: f, field: p, readonly: m, ...h }) {
|
|
8
|
+
let g = c(null), _ = p || h.schema, v = _?.multiple || !1, y = _?.accept ? _.accept.join(",") : void 0, b = _?.maxSize, [x, S] = l(!1), [C, w] = l([]), T = e ? Array.isArray(e) ? e : [e] : [], E = s((e) => {
|
|
9
|
+
if (e.length === 0) return;
|
|
10
|
+
let t = [], n = e.filter((e) => {
|
|
11
|
+
if (b && e.size > b) {
|
|
12
|
+
let n = (b / (1024 * 1024)).toFixed(1);
|
|
13
|
+
return t.push(`"${e.name}" exceeds max size (${n} MB)`), !1;
|
|
14
|
+
}
|
|
15
|
+
return !0;
|
|
16
|
+
});
|
|
17
|
+
if (w(t), n.length === 0) return;
|
|
18
|
+
let r = n.map((e) => ({
|
|
19
|
+
name: e.name,
|
|
20
|
+
original_name: e.name,
|
|
21
|
+
size: e.size,
|
|
22
|
+
mime_type: e.type,
|
|
23
|
+
url: URL.createObjectURL(e)
|
|
24
|
+
}));
|
|
25
|
+
f(v ? [...T, ...r] : r[0]);
|
|
26
|
+
}, [
|
|
27
|
+
T,
|
|
28
|
+
v,
|
|
29
|
+
f,
|
|
30
|
+
b
|
|
31
|
+
]), D = s((e) => {
|
|
32
|
+
e.preventDefault(), e.stopPropagation(), S(!0);
|
|
33
|
+
}, []), O = s((e) => {
|
|
34
|
+
e.preventDefault(), e.stopPropagation(), S(!1);
|
|
35
|
+
}, []), k = s((e) => {
|
|
36
|
+
e.preventDefault(), e.stopPropagation(), S(!1);
|
|
37
|
+
let t = Array.from(e.dataTransfer.files);
|
|
38
|
+
if (y) {
|
|
39
|
+
let e = y.split(",").map((e) => e.trim().toLowerCase());
|
|
40
|
+
E(t.filter((t) => {
|
|
41
|
+
let n = t.name.split("."), r = n.length > 1 ? "." + n.pop()?.toLowerCase() : "";
|
|
42
|
+
return e.some((e) => e === t.type || r && e === r || e.endsWith("/*") && t.type.startsWith(e.replace("/*", "/")));
|
|
43
|
+
}));
|
|
44
|
+
} else E(t);
|
|
45
|
+
}, [y, E]);
|
|
46
|
+
if (m) return e ? /* @__PURE__ */ u("div", {
|
|
47
|
+
className: "flex flex-wrap gap-2",
|
|
48
|
+
children: (Array.isArray(e) ? e : [e]).map((e, t) => /* @__PURE__ */ u("span", {
|
|
49
|
+
className: "text-sm truncate max-w-xs",
|
|
50
|
+
children: e.name || e.original_name || "File"
|
|
51
|
+
}, t))
|
|
52
|
+
}) : /* @__PURE__ */ u(o, {});
|
|
53
|
+
let A = (e) => {
|
|
54
|
+
E(Array.from(e.target.files || []));
|
|
55
|
+
}, j = (e) => {
|
|
56
|
+
if (v) {
|
|
57
|
+
let t = T.filter((t, n) => n !== e);
|
|
58
|
+
f(t.length > 0 ? t : null);
|
|
59
|
+
} else f(null);
|
|
60
|
+
}, M = (e) => (e.mime_type || "").startsWith("image/");
|
|
61
|
+
return /* @__PURE__ */ d("div", {
|
|
62
|
+
className: h.className,
|
|
63
|
+
children: [/* @__PURE__ */ u("input", {
|
|
64
|
+
ref: g,
|
|
65
|
+
type: "file",
|
|
66
|
+
multiple: v,
|
|
67
|
+
accept: y,
|
|
68
|
+
onChange: A,
|
|
69
|
+
className: "hidden"
|
|
70
|
+
}), /* @__PURE__ */ d("div", {
|
|
71
|
+
className: "space-y-2",
|
|
72
|
+
children: [
|
|
73
|
+
/* @__PURE__ */ d("div", {
|
|
74
|
+
onDragOver: D,
|
|
75
|
+
onDragLeave: O,
|
|
76
|
+
onDrop: k,
|
|
77
|
+
onClick: () => g.current?.click(),
|
|
78
|
+
className: `
|
|
79
|
+
flex flex-col items-center justify-center gap-2 p-6
|
|
80
|
+
border-2 border-dashed rounded-lg cursor-pointer
|
|
81
|
+
transition-colors duration-200
|
|
82
|
+
${x ? "border-primary bg-primary/5 text-primary" : "border-muted-foreground/25 hover:border-primary/50 text-muted-foreground hover:text-foreground"}
|
|
83
|
+
`,
|
|
84
|
+
role: "button",
|
|
85
|
+
tabIndex: 0,
|
|
86
|
+
onKeyDown: (e) => {
|
|
87
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), g.current?.click());
|
|
88
|
+
},
|
|
89
|
+
children: [/* @__PURE__ */ u(i, { className: `size-8 ${x ? "text-primary" : "text-muted-foreground"}` }), /* @__PURE__ */ d("div", {
|
|
90
|
+
className: "text-center",
|
|
91
|
+
children: [/* @__PURE__ */ u("p", {
|
|
92
|
+
className: "text-sm font-medium",
|
|
93
|
+
children: x ? "Drop files here" : "Drag & drop files here"
|
|
94
|
+
}), /* @__PURE__ */ u("p", {
|
|
95
|
+
className: "text-xs text-muted-foreground mt-1",
|
|
96
|
+
children: "or click to browse"
|
|
97
|
+
})]
|
|
98
|
+
})]
|
|
99
|
+
}),
|
|
100
|
+
C.length > 0 && /* @__PURE__ */ u("div", {
|
|
101
|
+
className: "space-y-0.5",
|
|
102
|
+
children: C.map((e, t) => /* @__PURE__ */ u("p", {
|
|
103
|
+
className: "text-xs text-destructive",
|
|
104
|
+
children: e
|
|
105
|
+
}, t))
|
|
106
|
+
}),
|
|
107
|
+
T.length > 0 && /* @__PURE__ */ u("div", {
|
|
108
|
+
className: "space-y-1",
|
|
109
|
+
children: T.map((e, i) => /* @__PURE__ */ d("div", {
|
|
110
|
+
className: "flex items-center justify-between gap-2 p-2 bg-muted/50 rounded-md border",
|
|
111
|
+
children: [/* @__PURE__ */ d("div", {
|
|
112
|
+
className: "flex items-center gap-2 flex-1 min-w-0",
|
|
113
|
+
children: [
|
|
114
|
+
M(e) && e.url ? /* @__PURE__ */ u("img", {
|
|
115
|
+
src: e.url,
|
|
116
|
+
alt: e.name,
|
|
117
|
+
className: "size-8 object-cover rounded flex-shrink-0"
|
|
118
|
+
}) : M(e) ? /* @__PURE__ */ u(t, { className: "size-4 text-muted-foreground flex-shrink-0" }) : /* @__PURE__ */ u(n, { className: "size-4 text-muted-foreground flex-shrink-0" }),
|
|
119
|
+
/* @__PURE__ */ u("span", {
|
|
120
|
+
className: "text-sm truncate",
|
|
121
|
+
children: e.name || e.original_name || "File"
|
|
122
|
+
}),
|
|
123
|
+
e.size && /* @__PURE__ */ d("span", {
|
|
124
|
+
className: "text-xs text-muted-foreground",
|
|
125
|
+
children: [
|
|
126
|
+
"(",
|
|
127
|
+
(e.size / 1024).toFixed(1),
|
|
128
|
+
" KB)"
|
|
129
|
+
]
|
|
130
|
+
})
|
|
131
|
+
]
|
|
132
|
+
}), /* @__PURE__ */ u(a, {
|
|
133
|
+
type: "button",
|
|
134
|
+
variant: "ghost",
|
|
135
|
+
size: "sm",
|
|
136
|
+
onClick: (e) => {
|
|
137
|
+
e.stopPropagation(), j(i);
|
|
138
|
+
},
|
|
139
|
+
className: "h-6 w-6 p-0",
|
|
140
|
+
children: /* @__PURE__ */ u(r, { className: "size-3" })
|
|
141
|
+
})]
|
|
142
|
+
}, i))
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})]
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
//#endregion
|
|
149
|
+
export { f as t };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { n as e } from "./rolldown-runtime-DnwLefa7.js";
|
|
2
|
+
import { t } from "./src-DyUKLvMN.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
//#region ../fields/src/widgets/FormulaField.tsx
|
|
6
|
+
var r = /* @__PURE__ */ e({ FormulaField: () => i });
|
|
7
|
+
function i({ value: e, field: r, ...i }) {
|
|
8
|
+
let a = (r || i.schema)?.return_type || "text";
|
|
9
|
+
if (e == null) return /* @__PURE__ */ n(t, { className: i.className });
|
|
10
|
+
let o;
|
|
11
|
+
return o = a === "number" || a === "currency" ? typeof e == "number" ? e.toFixed(2) : String(e) : a === "boolean" ? e ? "Yes" : "No" : a === "date" ? new Date(e).toLocaleDateString() : String(e), /* @__PURE__ */ n("span", {
|
|
12
|
+
className: `text-sm font-mono text-gray-700 ${i.className || ""}`,
|
|
13
|
+
children: o
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { r as t };
|