@rainte/ant 0.0.56 → 0.0.58

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.
Files changed (30) hide show
  1. package/dist/index.js +155 -11
  2. package/dist/index.umd.cjs +1 -80
  3. package/dist/types/{src/components → components}/Editor/index.d.ts +3 -3
  4. package/dist/types/components/Form/index.d.ts +11 -0
  5. package/dist/types/{src/components → components}/Provider/index.d.ts +1 -1
  6. package/dist/types/components/Table/index.d.ts +4 -0
  7. package/dist/types/{src/components → components}/Upload/index.d.ts +2 -2
  8. package/dist/types/lib.d.ts +12 -0
  9. package/dist/types/views/form/index.d.ts +1 -0
  10. package/dist/types/views/layout/blank/index.d.ts +1 -0
  11. package/dist/types/views/layout/menu/index.d.ts +2 -0
  12. package/dist/types/views/table/index.d.ts +1 -0
  13. package/package.json +27 -34
  14. package/dist/browser-ponyfill-B_NmYAlA.js +0 -366
  15. package/dist/index-Bpi8Scy9.js +0 -10591
  16. package/dist/index.css +0 -7
  17. package/dist/types/lib/index.d.ts +0 -14
  18. package/dist/types/src/components/Form/index.d.ts +0 -11
  19. package/dist/types/src/components/Menu/index.d.ts +0 -3
  20. package/dist/types/src/components/Table/index.d.ts +0 -4
  21. package/dist/types/src/views/form/index.d.ts +0 -1
  22. package/dist/types/src/views/layout/blank/index.d.ts +0 -1
  23. package/dist/types/src/views/layout/menu/index.d.ts +0 -1
  24. package/dist/types/src/views/table/index.d.ts +0 -1
  25. package/dist/types/vite.config.d.ts +0 -2
  26. /package/dist/types/{src/main.d.ts → main.d.ts} +0 -0
  27. /package/dist/types/{src/router → router}/index.d.ts +0 -0
  28. /package/dist/types/{src/utils → utils}/dialog.d.ts +0 -0
  29. /package/dist/types/{src/utils → utils}/i18n.d.ts +0 -0
  30. /package/dist/types/{src/utils → utils}/misc.d.ts +0 -0
package/dist/index.js CHANGED
@@ -1,12 +1,156 @@
1
- import { E as o, F as i, M as r, P as d, T as e, U as m, d as l, i as n, m as p } from "./index-Bpi8Scy9.js";
2
- export {
3
- o as Editor,
4
- i as Form,
5
- r as Menu,
6
- d as Provider,
7
- e as Table,
8
- m as Upload,
9
- l as dialog,
10
- n as i18n,
11
- p as misc
1
+ import { useEffect as e, useRef as t } from "react";
2
+ import n from "quill";
3
+ import "quill/dist/quill.snow.css";
4
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
+ import { BetaSchemaForm as a, ProConfigProvider as o, ProForm as s, ProTable as c } from "@ant-design/pro-components";
6
+ import { App as l, Button as u, Space as d, Upload as f } from "antd";
7
+ import { AiOutlineUpload as p } from "react-icons/ai";
8
+ import { storage as m, system as h } from "@rainte/js";
9
+ import g, * as _ from "i18next";
10
+ import v from "i18next-http-backend";
11
+ import y from "i18next-browser-languagedetector";
12
+ // \0rolldown/runtime.js
13
+ var b = Object.defineProperty, x = Object.getOwnPropertyDescriptor, S = Object.getOwnPropertyNames, C = Object.prototype.hasOwnProperty, w = (e, t) => {
14
+ let n = {};
15
+ for (var r in e) b(n, r, {
16
+ get: e[r],
17
+ enumerable: !0
18
+ });
19
+ return t || b(n, Symbol.toStringTag, { value: "Module" }), n;
20
+ }, T = (e, t, n, r) => {
21
+ if (t && typeof t == "object" || typeof t == "function") for (var i = S(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !C.call(e, s) && s !== n && b(e, s, {
22
+ get: ((e) => t[e]).bind(null, s),
23
+ enumerable: !(r = x(t, s)) || r.enumerable
24
+ });
25
+ return e;
26
+ }, E = (e, t, n) => (T(e, t, "default"), n && T(n, t, "default"));
27
+ // src/components/Editor/index.tsx
28
+ function D(i) {
29
+ let { value: a, style: o, ...s } = i, c = t(null), l = t(null);
30
+ return e(() => {
31
+ let e = c.current, t = document.createElement("div");
32
+ Object.assign(t.style, o ?? {});
33
+ let r = new n(e.appendChild(t), {
34
+ theme: "snow",
35
+ ...s
36
+ });
37
+ l.current = r;
38
+ let i = () => s.onChange?.(r.root.innerHTML || "");
39
+ return r.on("text-change", i), () => {
40
+ r.off("text-change", i), l.current = null, e.innerHTML = "";
41
+ };
42
+ }, []), e(() => {
43
+ let e = l.current;
44
+ if (!e) return;
45
+ let t = a || "";
46
+ e.root.innerHTML !== t && e.clipboard.dangerouslyPasteHTML(t);
47
+ }, [a]), /* @__PURE__ */ r("div", {
48
+ ref: c,
49
+ style: { height: "100%" }
50
+ });
51
+ }
52
+ // src/components/Upload/index.tsx
53
+ var O = (e) => Array.isArray(e) ? e : e && e.fileList;
54
+ function k(e) {
55
+ let { value: t, ...n } = e, i = O(t), a = Array.isArray(i) ? i.length : 0, o = n.maxCount ?? 1, s;
56
+ return a < o && (s = n.listType?.startsWith("picture-") ? /* @__PURE__ */ r(p, {}) : /* @__PURE__ */ r(u, {
57
+ icon: /* @__PURE__ */ r(p, {}),
58
+ children: " 上传"
59
+ })), /* @__PURE__ */ r(f, {
60
+ maxCount: 1,
61
+ multiple: !0,
62
+ showUploadList: !0,
63
+ ...n,
64
+ fileList: i,
65
+ onChange: (e) => n.onChange?.(e.fileList),
66
+ children: a < o && s
67
+ });
68
+ }
69
+ // src/components/Provider/index.tsx
70
+ var A = {
71
+ upload: { formItemRender: (e, t) => /* @__PURE__ */ r(k, { ...t.fieldProps }) },
72
+ editor: { formItemRender: (e, t) => /* @__PURE__ */ r(D, { ...t.fieldProps }) }
12
73
  };
74
+ function j({ children: e }) {
75
+ return /* @__PURE__ */ r(o, {
76
+ valueTypeMap: A,
77
+ children: e
78
+ });
79
+ }
80
+ // src/components/Form/index.tsx
81
+ var M = () => s.useForm()[0], N = (e) => /* @__PURE__ */ r(j, { children: /* @__PURE__ */ r(a, {
82
+ layout: "horizontal",
83
+ colon: !1,
84
+ labelCol: { span: 3 },
85
+ wrapperCol: { span: 6 },
86
+ scrollToFirstError: !0,
87
+ submitter: { render: (e, t) => /* @__PURE__ */ r(s.Item, {
88
+ wrapperCol: {
89
+ offset: 4,
90
+ span: 8
91
+ },
92
+ children: /* @__PURE__ */ r(d, { children: t })
93
+ }) },
94
+ ...e
95
+ }) });
96
+ N.useForm = M;
97
+ // src/components/Table/index.tsx
98
+ function P(e) {
99
+ return /* @__PURE__ */ r(j, { children: /* @__PURE__ */ r(c, {
100
+ rowKey: "id",
101
+ pagination: { pageSize: 10 },
102
+ tableAlertRender: ({ selectedRowKeys: e }) => /* @__PURE__ */ i(d, { children: [
103
+ "已选 ",
104
+ e.length,
105
+ " 项"
106
+ ] }),
107
+ ...e
108
+ }) });
109
+ }
110
+ // src/utils/dialog.ts
111
+ var F = /* @__PURE__ */ w({
112
+ default: () => z,
113
+ message: () => I,
114
+ modal: () => R,
115
+ notification: () => L,
116
+ popup: () => B,
117
+ useDialog: () => z
118
+ }), I, L, R, z = () => {
119
+ let e = l.useApp();
120
+ return I = e.message, R = e.modal, L = e.notification, null;
121
+ }, B = {
122
+ confirm: (e) => R.confirm({
123
+ title: "提示",
124
+ content: "确认操作?",
125
+ ...e
126
+ }),
127
+ success: (e, t) => (e ||= "操作成功", I.success(e, t)),
128
+ error: (e, t) => {
129
+ e ||= "操作失败", I.error(e, t), h.fail(e);
130
+ },
131
+ ask: function(e, t) {
132
+ return this.confirm({
133
+ onOk: e,
134
+ ...t
135
+ });
136
+ }
137
+ }, V = /* @__PURE__ */ w({
138
+ KEY: () => H,
139
+ LNG_ZH: () => "zh"
140
+ });
141
+ E(V, _);
142
+ var H = "i18nextLng";
143
+ g.use(v).use(y).init({
144
+ lng: m.local.getRaw(H, "zh"),
145
+ fallbackLng: "zh",
146
+ backend: { loadPath: "/locales/{{lng}}/{{ns}}.json" },
147
+ interpolation: { escapeValue: !1 }
148
+ });
149
+ // src/utils/misc.ts
150
+ var U = /* @__PURE__ */ w({ onUpload: () => W }), W = async (e) => {
151
+ let { file: t, onProgress: n, onSuccess: r } = e, i = 0, a = setInterval(() => {
152
+ i += Math.floor(Math.random() * 10), i >= 100 && (i = 99), n({ percent: i });
153
+ }, 100);
154
+ t.url = URL.createObjectURL(t), r?.({ url: t.url }), clearInterval(a);
155
+ };
156
+ export { D as Editor, N as Form, j as Provider, P as Table, k as Upload, F as dialog, V as i18n, U as misc };