@rainte/ant 0.0.64 → 0.0.70

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.js CHANGED
@@ -1,105 +1,129 @@
1
- import { useEffect as e, useRef as t } from "react";
2
- import n from "quill";
1
+ import { lazy as e, useContext as t, useEffect as n, useRef as r } from "react";
2
+ import i from "quill";
3
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";
4
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
+ import { BetaSchemaForm as s, PageContainer as c, ProCard as l, ProForm as u, ProLayout as d, ProProvider as f, ProTable as p } from "@ant-design/pro-components";
6
+ import { App as m, Button as h, Space as g, Upload as _ } from "antd";
7
+ import { AiOutlineUpload as v } from "react-icons/ai";
8
+ import { Link as y, Navigate as b, Outlet as x, createHashRouter as S, useLocation as C } from "react-router";
12
9
  // \0rolldown/runtime.js
13
- var b = Object.defineProperty, x = Object.getOwnPropertyDescriptor, S = Object.getOwnPropertyNames, C = Object.prototype.hasOwnProperty, w = (e, t) => {
10
+ var w = Object.defineProperty, T = (e, t) => {
14
11
  let n = {};
15
- for (var r in e) b(n, r, {
12
+ for (var r in e) w(n, r, {
16
13
  get: e[r],
17
14
  enumerable: !0
18
15
  });
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"));
16
+ return t || w(n, Symbol.toStringTag, { value: "Module" }), n;
17
+ };
27
18
  // 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(() => {
19
+ function E(e) {
20
+ let { value: t, style: o, ...s } = e, c = r(null), l = r(null);
21
+ return n(() => {
31
22
  let e = c.current, t = document.createElement("div");
32
23
  Object.assign(t.style, o ?? {});
33
- let r = new n(e.appendChild(t), {
24
+ let n = new i(e.appendChild(t), {
34
25
  theme: "snow",
35
26
  ...s
36
27
  });
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 = "";
28
+ l.current = n;
29
+ let r = () => s.onChange?.(n.root.innerHTML || "");
30
+ return n.on("text-change", r), () => {
31
+ n.off("text-change", r), l.current = null, e.innerHTML = "";
41
32
  };
42
- }, []), e(() => {
33
+ }, []), n(() => {
43
34
  let e = l.current;
44
35
  if (!e) return;
45
- let t = a || "";
46
- e.root.innerHTML !== t && e.clipboard.dangerouslyPasteHTML(t);
47
- }, [a]), /* @__PURE__ */ r("div", {
36
+ let n = t || "";
37
+ e.root.innerHTML !== n && e.clipboard.dangerouslyPasteHTML(n);
38
+ }, [t]), /* @__PURE__ */ a("div", {
48
39
  ref: c,
49
40
  style: { height: "100%" }
50
41
  });
51
42
  }
52
43
  // 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
44
+ var D = (e) => {
45
+ if (Array.isArray(e)) return e;
46
+ if (e && typeof e == "object" && "fileList" in e) return e.fileList;
47
+ };
48
+ function O(e) {
49
+ let { value: t, onChange: n, maxCount: r = 1, multiple: i, listType: o, ...s } = e, c = D(t) ?? [], l = c.length >= r, u = o?.startsWith("picture-") ? /* @__PURE__ */ a(v, {}) : /* @__PURE__ */ a(h, {
50
+ icon: /* @__PURE__ */ a(v, {}),
51
+ children: "上传"
52
+ });
53
+ return /* @__PURE__ */ a(_, {
54
+ ...s,
55
+ maxCount: r,
56
+ multiple: i ?? r > 1,
57
+ listType: o,
58
+ showUploadList: s.showUploadList ?? !0,
59
+ fileList: c,
60
+ onChange: (e) => n?.(e.fileList),
61
+ children: l ? null : u
67
62
  });
68
63
  }
69
64
  // 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 }) }
65
+ var k = {
66
+ upload: { formItemRender: (e, t) => /* @__PURE__ */ a(O, { ...t.fieldProps }) },
67
+ editor: { formItemRender: (e, t) => /* @__PURE__ */ a(E, { ...t.fieldProps }) }
73
68
  };
74
- function j({ children: e }) {
75
- return /* @__PURE__ */ r(o, {
76
- valueTypeMap: A,
69
+ function A({ children: e }) {
70
+ let n = t(f);
71
+ return /* @__PURE__ */ a(f.Provider, {
72
+ value: {
73
+ ...n,
74
+ valueTypeMap: {
75
+ ...n.valueTypeMap,
76
+ ...k
77
+ }
78
+ },
77
79
  children: e
78
80
  });
79
81
  }
80
82
  // src/components/Form/index.tsx
81
- var M = () => s.useForm()[0], N = (e) => /* @__PURE__ */ r(j, { children: /* @__PURE__ */ r(a, {
83
+ var j = () => u.useForm()[0], M = (e) => /* @__PURE__ */ a(A, { children: /* @__PURE__ */ a(s, {
82
84
  layout: "horizontal",
83
85
  colon: !1,
84
- labelCol: { span: 3 },
85
- wrapperCol: { span: 6 },
86
86
  scrollToFirstError: !0,
87
- submitter: { render: (e, t) => /* @__PURE__ */ r(s.Item, {
87
+ submitter: { render: (e, t) => /* @__PURE__ */ a(u.Item, {
88
88
  wrapperCol: {
89
89
  offset: 4,
90
90
  span: 8
91
91
  },
92
- children: /* @__PURE__ */ r(d, { children: t })
92
+ children: /* @__PURE__ */ a(g, { children: t })
93
93
  }) },
94
94
  ...e
95
95
  }) });
96
- N.useForm = M;
96
+ M.useForm = j;
97
+ // src/components/Layout/index.tsx
98
+ var N = (e, t) => /* @__PURE__ */ a(y, {
99
+ to: e.path || "/",
100
+ children: t
101
+ });
102
+ function P({ routes: e, ...t }) {
103
+ let n = C();
104
+ return /* @__PURE__ */ a(d, {
105
+ title: "Rainte",
106
+ token: { bgLayout: "#fff" },
107
+ menuItemRender: N,
108
+ ...t,
109
+ route: {
110
+ path: "/",
111
+ ...t.route,
112
+ ...e === void 0 ? {} : { routes: e }
113
+ },
114
+ location: t.location ?? { pathname: n.pathname },
115
+ children: /* @__PURE__ */ a(c, {
116
+ title: !1,
117
+ children: /* @__PURE__ */ a(l, { children: /* @__PURE__ */ a(x, {}) })
118
+ })
119
+ });
120
+ }
97
121
  // src/components/Table/index.tsx
98
- function P(e) {
99
- return /* @__PURE__ */ r(j, { children: /* @__PURE__ */ r(c, {
122
+ function F(e) {
123
+ return /* @__PURE__ */ a(A, { children: /* @__PURE__ */ a(p, {
100
124
  rowKey: "id",
101
125
  pagination: { pageSize: 10 },
102
- tableAlertRender: ({ selectedRowKeys: e }) => /* @__PURE__ */ i(d, { children: [
126
+ tableAlertRender: ({ selectedRowKeys: e }) => /* @__PURE__ */ o(g, { children: [
103
127
  "已选 ",
104
128
  e.length,
105
129
  " 项"
@@ -107,50 +131,50 @@ function P(e) {
107
131
  ...e
108
132
  }) });
109
133
  }
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({
134
+ // src/utils/antd.ts
135
+ var I = /* @__PURE__ */ T({
136
+ AntdAppHolder: () => B,
137
+ message: () => H,
138
+ modal: () => V,
139
+ notification: () => z
140
+ }), L, R, z, B = () => {
141
+ let e = m.useApp();
142
+ return L = e.message, R = e.modal, z = e.notification, null;
143
+ }, V = new Proxy({}, { get(e, t) {
144
+ return t === "confirm" ? (e) => R.confirm({
123
145
  title: "提示",
124
146
  content: "确认操作?",
125
147
  ...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
- });
148
+ }) : R[t];
149
+ } }), H = new Proxy({}, { get(e, t) {
150
+ return t === "success" ? (e = "操作成功", t, n) => L.success(e, t, n) : L[t];
151
+ } }), U = /* @__PURE__ */ T({ onUpload: () => W }), W = async (e) => {
152
+ let { file: t, onProgress: n, onSuccess: r, onError: i } = e, a = URL.createObjectURL(t);
153
+ try {
154
+ await new Promise((e) => {
155
+ let t = 0, r = setInterval(() => {
156
+ t = Math.min(t + Math.floor(Math.random() * 10) + 1, 99), n?.({ percent: t }), t >= 99 && (clearInterval(r), e());
157
+ }, 100);
158
+ }), n?.({ percent: 100 }), t.url = a, r?.({ url: a });
159
+ } catch (e) {
160
+ URL.revokeObjectURL(a), i?.(e);
136
161
  }
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 };
162
+ }, G = /* @__PURE__ */ T({ createRouter: () => K });
163
+ function K(t, n, r) {
164
+ let i = t.map((t) => ({
165
+ path: t.url,
166
+ Component: e(t.component)
167
+ })), o = /* @__PURE__ */ a(b, { to: n });
168
+ return S([{
169
+ path: "/",
170
+ Component: e(r),
171
+ children: [{
172
+ index: !0,
173
+ element: o
174
+ }, ...i]
175
+ }, {
176
+ path: "*",
177
+ element: o
178
+ }]);
179
+ }
180
+ export { E as Editor, M as Form, P as Layout, A as Provider, F as Table, O as Upload, I as antd, U as misc, G as router };
@@ -1 +1 @@
1
- (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("quill"),require("quill/dist/quill.snow.css"),require("react/jsx-runtime"),require("@ant-design/pro-components"),require("antd"),require("react-icons/ai"),require("@rainte/js"),require("i18next"),require("i18next-http-backend"),require("i18next-browser-languagedetector")):typeof define==`function`&&define.amd?define([`exports`,`react`,`quill`,`quill/dist/quill.snow.css`,`react/jsx-runtime`,`@ant-design/pro-components`,`antd`,`react-icons/ai`,`@rainte/js`,`i18next`,`i18next-http-backend`,`i18next-browser-languagedetector`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@rainte/ant`]={},e.React,e.Quill,e.QuillSnowCSS,e.ReactJSXRuntime,e.ProComponents,e.antd,e.ReactIconsAI,e.RainteJS,e.i18next,e.i18nextHttpBackend,e.i18nextBrowserLanguageDetector))})(this,function(e,t,n,r,i,a,o,s,c,l,u,d){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var f=Object.create,p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyNames,g=Object.getPrototypeOf,_=Object.prototype.hasOwnProperty,v=(e,t)=>{let n={};for(var r in e)p(n,r,{get:e[r],enumerable:!0});return t||p(n,Symbol.toStringTag,{value:`Module`}),n},y=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=h(t),a=0,o=i.length,s;a<o;a++)s=i[a],!_.call(e,s)&&s!==n&&p(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=m(t,s))||r.enumerable});return e},b=(e,t,n)=>(y(e,t,`default`),n&&y(n,t,`default`)),x=(e,t,n)=>(n=e==null?{}:f(g(e)),y(t||!e||!e.__esModule||!_.call(e,`default`)?p(n,`default`,{value:e,enumerable:!0}):n,e));n=x(n,1),l=x(l,1),u=x(u,1),d=x(d,1);function S(e){let{value:r,style:a,...o}=e,s=(0,t.useRef)(null),c=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let e=s.current,t=document.createElement(`div`);Object.assign(t.style,a??{});let r=new n.default(e.appendChild(t),{theme:`snow`,...o});c.current=r;let i=()=>o.onChange?.(r.root.innerHTML||``);return r.on(`text-change`,i),()=>{r.off(`text-change`,i),c.current=null,e.innerHTML=``}},[]),(0,t.useEffect)(()=>{let e=c.current;if(!e)return;let t=r||``;e.root.innerHTML!==t&&e.clipboard.dangerouslyPasteHTML(t)},[r]),(0,i.jsx)(`div`,{ref:s,style:{height:`100%`}})}var C=e=>Array.isArray(e)?e:e&&e.fileList;function w(e){let{value:t,...n}=e,r=C(t),a=Array.isArray(r)?r.length:0,c=n.maxCount??1,l;return a<c&&(l=n.listType?.startsWith(`picture-`)?(0,i.jsx)(s.AiOutlineUpload,{}):(0,i.jsx)(o.Button,{icon:(0,i.jsx)(s.AiOutlineUpload,{}),children:` 上传`})),(0,i.jsx)(o.Upload,{maxCount:1,multiple:!0,showUploadList:!0,...n,fileList:r,onChange:e=>n.onChange?.(e.fileList),children:a<c&&l})}var T={upload:{formItemRender:(e,t)=>(0,i.jsx)(w,{...t.fieldProps})},editor:{formItemRender:(e,t)=>(0,i.jsx)(S,{...t.fieldProps})}};function E({children:e}){return(0,i.jsx)(a.ProConfigProvider,{valueTypeMap:T,children:e})}var D=()=>a.ProForm.useForm()[0],O=e=>(0,i.jsx)(E,{children:(0,i.jsx)(a.BetaSchemaForm,{layout:`horizontal`,colon:!1,labelCol:{span:3},wrapperCol:{span:6},scrollToFirstError:!0,submitter:{render:(e,t)=>(0,i.jsx)(a.ProForm.Item,{wrapperCol:{offset:4,span:8},children:(0,i.jsx)(o.Space,{children:t})})},...e})});O.useForm=D;function k(e){return(0,i.jsx)(E,{children:(0,i.jsx)(a.ProTable,{rowKey:`id`,pagination:{pageSize:10},tableAlertRender:({selectedRowKeys:e})=>(0,i.jsxs)(o.Space,{children:[`已选 `,e.length,` 项`]}),...e})})}var A=v({default:()=>P,message:()=>j,modal:()=>N,notification:()=>M,popup:()=>F,useDialog:()=>P}),j,M,N,P=()=>{let e=o.App.useApp();return j=e.message,N=e.modal,M=e.notification,null},F={confirm:e=>N.confirm({title:`提示`,content:`确认操作?`,...e}),success:(e,t)=>(e||=`操作成功`,j.success(e,t)),error:(e,t)=>{e||=`操作失败`,j.error(e,t),c.system.fail(e)},ask:function(e,t){return this.confirm({onOk:e,...t})}},I=v({KEY:()=>L,LNG_ZH:()=>`zh`});b(I,require("i18next"));var L=`i18nextLng`;l.default.use(u.default).use(d.default).init({lng:c.storage.local.getRaw(L,`zh`),fallbackLng:`zh`,backend:{loadPath:`/locales/{{lng}}/{{ns}}.json`},interpolation:{escapeValue:!1}});var R=v({onUpload:()=>z}),z=async e=>{let{file:t,onProgress:n,onSuccess:r}=e,i=0,a=setInterval(()=>{i+=Math.floor(Math.random()*10),i>=100&&(i=99),n({percent:i})},100);t.url=URL.createObjectURL(t),r?.({url:t.url}),clearInterval(a)};e.Editor=S,e.Form=O,e.Provider=E,e.Table=k,e.Upload=w,Object.defineProperty(e,"dialog",{enumerable:!0,get:function(){return A}}),Object.defineProperty(e,"i18n",{enumerable:!0,get:function(){return I}}),Object.defineProperty(e,"misc",{enumerable:!0,get:function(){return R}})});
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require("react"),require("quill"),require("quill/dist/quill.snow.css"),require("react/jsx-runtime"),require("@ant-design/pro-components"),require("antd"),require("react-icons/ai"),require("react-router")):typeof define==`function`&&define.amd?define([`exports`,`react`,`quill`,`quill/dist/quill.snow.css`,`react/jsx-runtime`,`@ant-design/pro-components`,`antd`,`react-icons/ai`,`react-router`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e[`@rainte/ant`]={},e.React,e.Quill,e.QuillSnowCSS,e.ReactJSXRuntime,e.ProComponents,e.antd,e.ReactIconsAI,e.ReactRouter))})(this,function(e,t,n,r,i,a,o,s,c){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var l=Object.create,u=Object.defineProperty,d=Object.getOwnPropertyDescriptor,f=Object.getOwnPropertyNames,p=Object.getPrototypeOf,m=Object.prototype.hasOwnProperty,h=(e,t)=>{let n={};for(var r in e)u(n,r,{get:e[r],enumerable:!0});return t||u(n,Symbol.toStringTag,{value:`Module`}),n},g=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=f(t),a=0,o=i.length,s;a<o;a++)s=i[a],!m.call(e,s)&&s!==n&&u(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=d(t,s))||r.enumerable});return e};n=((e,t,n)=>(n=e==null?{}:l(p(e)),g(u(n,`default`,{value:e,enumerable:!0}),e)))(n,1);function _(e){let{value:r,style:a,...o}=e,s=(0,t.useRef)(null),c=(0,t.useRef)(null);return(0,t.useEffect)(()=>{let e=s.current,t=document.createElement(`div`);Object.assign(t.style,a??{});let r=new n.default(e.appendChild(t),{theme:`snow`,...o});c.current=r;let i=()=>o.onChange?.(r.root.innerHTML||``);return r.on(`text-change`,i),()=>{r.off(`text-change`,i),c.current=null,e.innerHTML=``}},[]),(0,t.useEffect)(()=>{let e=c.current;if(!e)return;let t=r||``;e.root.innerHTML!==t&&e.clipboard.dangerouslyPasteHTML(t)},[r]),(0,i.jsx)(`div`,{ref:s,style:{height:`100%`}})}var v=e=>{if(Array.isArray(e))return e;if(e&&typeof e==`object`&&`fileList`in e)return e.fileList};function y(e){let{value:t,onChange:n,maxCount:r=1,multiple:a,listType:c,...l}=e,u=v(t)??[],d=u.length>=r,f=c?.startsWith(`picture-`)?(0,i.jsx)(s.AiOutlineUpload,{}):(0,i.jsx)(o.Button,{icon:(0,i.jsx)(s.AiOutlineUpload,{}),children:`上传`});return(0,i.jsx)(o.Upload,{...l,maxCount:r,multiple:a??r>1,listType:c,showUploadList:l.showUploadList??!0,fileList:u,onChange:e=>n?.(e.fileList),children:d?null:f})}var b={upload:{formItemRender:(e,t)=>(0,i.jsx)(y,{...t.fieldProps})},editor:{formItemRender:(e,t)=>(0,i.jsx)(_,{...t.fieldProps})}};function x({children:e}){let n=(0,t.useContext)(a.ProProvider);return(0,i.jsx)(a.ProProvider.Provider,{value:{...n,valueTypeMap:{...n.valueTypeMap,...b}},children:e})}var S=()=>a.ProForm.useForm()[0],C=e=>(0,i.jsx)(x,{children:(0,i.jsx)(a.BetaSchemaForm,{layout:`horizontal`,colon:!1,scrollToFirstError:!0,submitter:{render:(e,t)=>(0,i.jsx)(a.ProForm.Item,{wrapperCol:{offset:4,span:8},children:(0,i.jsx)(o.Space,{children:t})})},...e})});C.useForm=S;var w=(e,t)=>(0,i.jsx)(c.Link,{to:e.path||`/`,children:t});function T({routes:e,...t}){let n=(0,c.useLocation)();return(0,i.jsx)(a.ProLayout,{title:`Rainte`,token:{bgLayout:`#fff`},menuItemRender:w,...t,route:{path:`/`,...t.route,...e===void 0?{}:{routes:e}},location:t.location??{pathname:n.pathname},children:(0,i.jsx)(a.PageContainer,{title:!1,children:(0,i.jsx)(a.ProCard,{children:(0,i.jsx)(c.Outlet,{})})})})}function E(e){return(0,i.jsx)(x,{children:(0,i.jsx)(a.ProTable,{rowKey:`id`,pagination:{pageSize:10},tableAlertRender:({selectedRowKeys:e})=>(0,i.jsxs)(o.Space,{children:[`已选 `,e.length,` 项`]}),...e})})}var D=h({AntdAppHolder:()=>j,message:()=>N,modal:()=>M,notification:()=>A}),O,k,A,j=()=>{let e=o.App.useApp();return O=e.message,k=e.modal,A=e.notification,null},M=new Proxy({},{get(e,t){return t===`confirm`?e=>k.confirm({title:`提示`,content:`确认操作?`,...e}):k[t]}}),N=new Proxy({},{get(e,t){return t===`success`?(e=`操作成功`,t,n)=>O.success(e,t,n):O[t]}}),P=h({onUpload:()=>F}),F=async e=>{let{file:t,onProgress:n,onSuccess:r,onError:i}=e,a=URL.createObjectURL(t);try{await new Promise(e=>{let t=0,r=setInterval(()=>{t=Math.min(t+Math.floor(Math.random()*10)+1,99),n?.({percent:t}),t>=99&&(clearInterval(r),e())},100)}),n?.({percent:100}),t.url=a,r?.({url:a})}catch(e){URL.revokeObjectURL(a),i?.(e)}},I=h({createRouter:()=>L});function L(e,n,r){let a=e.map(e=>({path:e.url,Component:(0,t.lazy)(e.component)})),o=(0,i.jsx)(c.Navigate,{to:n});return(0,c.createHashRouter)([{path:`/`,Component:(0,t.lazy)(r),children:[{index:!0,element:o},...a]},{path:`*`,element:o}])}e.Editor=_,e.Form=C,e.Layout=T,e.Provider=x,e.Table=E,e.Upload=y,Object.defineProperty(e,"antd",{enumerable:!0,get:function(){return D}}),Object.defineProperty(e,"misc",{enumerable:!0,get:function(){return P}}),Object.defineProperty(e,"router",{enumerable:!0,get:function(){return I}})});
@@ -3,7 +3,7 @@ import { type QuillOptions } from 'quill';
3
3
  import 'quill/dist/quill.snow.css';
4
4
  export type EditorProps = QuillOptions & {
5
5
  value?: any;
6
- onChange?: FunctionProps;
6
+ onChange?: (...args: any[]) => void;
7
7
  style?: CSSProperties;
8
8
  };
9
9
  export default function Editor(props: EditorProps): import("react").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import { type ComponentProps } from 'react';
2
- import { type ValueTypeProps } from '@/components/Provider';
3
2
  import { BetaSchemaForm, type ProFormInstance } from '@ant-design/pro-components';
4
- export type FormProps<T = any, ValueType = ValueTypeProps> = ComponentProps<typeof BetaSchemaForm<T, ValueType>> & {
3
+ export type FormProps<T = any, ValueType = string> = ComponentProps<typeof BetaSchemaForm<T, ValueType>> & {
5
4
  form?: ProFormInstance;
6
5
  };
7
6
  export declare const useForm: () => import("antd").FormInstance<any>;
@@ -0,0 +1,5 @@
1
+ import { type ProLayoutProps } from '@ant-design/pro-components';
2
+ export type LayoutProps = ProLayoutProps & {
3
+ routes?: NonNullable<ProLayoutProps['route']>['routes'];
4
+ };
5
+ export default function Layout({ routes, ...props }: LayoutProps): import("react").JSX.Element;
@@ -1,2 +1,4 @@
1
- export type ValueTypeProps = 'text' | 'upload' | 'editor';
2
- export default function Provider({ children }: ProviderProps): import("react").JSX.Element;
1
+ import { type ReactNode } from 'react';
2
+ export default function Provider({ children }: {
3
+ children: ReactNode;
4
+ }): import("react").JSX.Element;
@@ -1,4 +1,3 @@
1
- import { type ValueTypeProps } from '@/components/Provider';
2
1
  import { type ProTableProps } from '@ant-design/pro-components';
3
- export type TableProps<T = any, U = ObjectProps, ValueType = ValueTypeProps> = ProTableProps<T, U, ValueType>;
2
+ export type TableProps<T = any, U = Record<string, any>, ValueType = string> = ProTableProps<T, U, ValueType>;
4
3
  export default function Table(props: TableProps): import("react").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { type UploadProps as AntUploadProps } from 'antd';
2
- export type UploadProps = AntUploadProps & {
3
- value?: any;
4
- onChange?: FunctionProps;
2
+ export type UploadProps = Omit<AntUploadProps, 'onChange' | 'fileList'> & {
3
+ value?: AntUploadProps['fileList'];
4
+ onChange?: (fileList: NonNullable<AntUploadProps['fileList']>) => void;
5
5
  };
6
- export declare const files: (e: any) => any;
6
+ export declare const files: (value: unknown) => AntUploadProps['fileList'];
7
7
  export default function Upload(props: UploadProps): import("react").JSX.Element;
@@ -2,11 +2,13 @@ export { default as Editor } from './components/Editor';
2
2
  export type { EditorProps } from './components/Editor';
3
3
  export { default as Form } from './components/Form';
4
4
  export type { FormProps } from './components/Form';
5
+ export { default as Layout } from './components/Layout';
6
+ export type { LayoutProps } from './components/Layout';
5
7
  export { default as Provider } from './components/Provider';
6
8
  export { default as Table } from './components/Table';
7
9
  export type { TableProps } from './components/Table';
8
10
  export { default as Upload } from './components/Upload';
9
11
  export type { UploadProps } from './components/Upload';
10
- export * as dialog from './utils/dialog';
11
- export * as i18n from './utils/i18n';
12
+ export * as antd from './utils/antd';
12
13
  export * as misc from './utils/misc';
14
+ export * as router from './utils/router';
@@ -0,0 +1,8 @@
1
+ import type { MessageInstance } from 'antd/es/message/interface';
2
+ import type { ModalStaticFunctions } from 'antd/es/modal/confirm';
3
+ import type { NotificationInstance } from 'antd/es/notification/interface';
4
+ declare let notification: NotificationInstance;
5
+ export declare const AntdAppHolder: () => null;
6
+ export declare const modal: Omit<ModalStaticFunctions, "warn">;
7
+ export declare const message: MessageInstance;
8
+ export { notification };
@@ -0,0 +1,9 @@
1
+ export type ComponentType = () => Promise<{
2
+ default: React.ComponentType<any>;
3
+ }>;
4
+ export type MenuItem = {
5
+ url: string;
6
+ label: string;
7
+ component: ComponentType;
8
+ };
9
+ export declare function createRouter(menus: MenuItem[], homePath: string, layoutPath: ComponentType): import("react-router").DataRouter;
@@ -1 +1,2 @@
1
- export default function App(): import("react").JSX.Element;
1
+ export default _default;
2
+ declare function _default(): import("react").JSX.Element;
@@ -0,0 +1,9 @@
1
+ export declare const home = "/form";
2
+ export declare const layout: () => Promise<typeof import("@/views/layout")>;
3
+ export declare const menus: {
4
+ url: string;
5
+ label: string;
6
+ component: () => Promise<typeof import("@/views/form")>;
7
+ }[];
8
+ export default _default;
9
+ declare function _default(): import("react").JSX.Element;
@@ -1 +1,2 @@
1
- export default function App(): import("react").JSX.Element;
1
+ export default _default;
2
+ declare function _default(): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainte/ant",
3
- "version": "0.0.64",
3
+ "version": "0.0.70",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -32,15 +32,10 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@ant-design/pro-components": "^3.1.15-9",
35
- "@rainte/js": "^0.0.51",
36
35
  "antd": "^6.7.0",
37
- "i18next": "^26.7.2",
38
- "i18next-browser-languagedetector": "^8.3.0",
39
- "i18next-http-backend": "^4.0.10",
40
36
  "quill": "^2.0.3",
41
37
  "react": "^19.3.1",
42
38
  "react-dom": "^19.3.1",
43
- "react-i18next": "^17.1.13",
44
39
  "react-icons": "^5.7.0",
45
40
  "react-router": "^8.5.1"
46
41
  },
@@ -50,13 +45,12 @@
50
45
  "@types/react-dom": "^19.3.0",
51
46
  "@vitejs/plugin-react": "^6.2.1",
52
47
  "happy-dom": "^21.0.4",
53
- "oxlint": "^1.91.0",
48
+ "oxlint": "^1.92.0",
54
49
  "typescript": "^7.0.2",
55
50
  "vite": "^8.3.6"
56
51
  },
57
52
  "peerDependencies": {
58
53
  "@ant-design/pro-components": "*",
59
- "@rainte/js": "*",
60
54
  "antd": "*",
61
55
  "react": "*",
62
56
  "react-dom": "*",
@@ -1,7 +0,0 @@
1
- export declare const menus: {
2
- url: string;
3
- label: string;
4
- component: Promise<typeof import("@/views/form")>;
5
- }[];
6
- declare const router: import("react-router").DataRouter;
7
- export default router;
@@ -1,22 +0,0 @@
1
- import type { MessageInstance, JointContent } from 'antd/es/message/interface';
2
- import type { ModalStaticFunctions } from 'antd/es/modal/confirm';
3
- import type { NotificationInstance } from 'antd/es/notification/interface';
4
- import type { ModalFuncProps } from 'antd/es/modal/interface';
5
- declare let message: MessageInstance;
6
- declare let notification: NotificationInstance;
7
- declare let modal: Omit<ModalStaticFunctions, 'warn'>;
8
- declare const useDialog: () => null;
9
- export default useDialog;
10
- declare const popup: {
11
- confirm: (props: ModalFuncProps) => {
12
- destroy: () => void;
13
- update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
14
- };
15
- success: (content?: JointContent, duration?: number | VoidFunction) => import("antd/es/message/interface").MessageType;
16
- error: (content?: string, duration?: number | VoidFunction) => never;
17
- ask: (onOk: (...args: any[]) => any, props?: ModalFuncProps) => {
18
- destroy: () => void;
19
- update: (configUpdate: import("antd/es/modal/confirm").ConfigUpdate) => void;
20
- };
21
- };
22
- export { message, notification, modal, popup, useDialog };
@@ -1,3 +0,0 @@
1
- export * from 'i18next';
2
- export declare const KEY = "i18nextLng";
3
- export declare const LNG_ZH = "zh";
@@ -1 +0,0 @@
1
- export default function App(): import("react").JSX.Element;
@@ -1,2 +0,0 @@
1
- export default _default;
2
- declare function _default(): import("react").JSX.Element;