@spacego/fe-components 0.1.1 → 0.2.0

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 (205) hide show
  1. package/README.md +37 -37
  2. package/lib/_virtual/Resizable.js +4 -0
  3. package/lib/_virtual/ResizableBox.js +4 -0
  4. package/lib/_virtual/index.js +5 -0
  5. package/lib/_virtual/index2.js +4 -0
  6. package/lib/_virtual/index3.js +4 -0
  7. package/lib/_virtual/index4.js +4 -0
  8. package/lib/_virtual/propTypes.js +4 -0
  9. package/lib/_virtual/react-is.development.js +4 -0
  10. package/lib/_virtual/react-is.production.min.js +4 -0
  11. package/lib/_virtual/utils.js +4 -0
  12. package/lib/fe-auto-complete/index.js +6 -0
  13. package/lib/fe-button/index.js +27 -0
  14. package/lib/fe-cascader/index.js +19 -0
  15. package/lib/fe-checkbox/index.js +6 -0
  16. package/lib/fe-checkbox-group/index.js +6 -0
  17. package/lib/fe-date-picker/index.js +19 -0
  18. package/lib/fe-description-render/index.js +43 -0
  19. package/lib/fe-descriptions/index.js +6 -0
  20. package/lib/fe-empty/index.js +6 -0
  21. package/lib/fe-error-block/index.js +6 -0
  22. package/lib/fe-form/fe-form/index.js +133 -0
  23. package/lib/fe-form/fe-form-auto-complete/index.js +57 -0
  24. package/lib/fe-form/fe-form-btn-group/index.js +29 -0
  25. package/lib/fe-form/fe-form-cascader/index.js +25 -0
  26. package/lib/fe-form/fe-form-checkbox-group/index.js +21 -0
  27. package/lib/fe-form/fe-form-date-picker/index.js +75 -0
  28. package/lib/fe-form/fe-form-date-range-picker/index.js +99 -0
  29. package/lib/fe-form/fe-form-input/index.js +53 -0
  30. package/lib/fe-form/fe-form-input-input/index.js +63 -0
  31. package/lib/fe-form/fe-form-input-number/index.js +43 -0
  32. package/lib/fe-form/fe-form-item/index.js +46 -0
  33. package/lib/fe-form/fe-form-label/index.js +20 -0
  34. package/lib/fe-form/fe-form-radio/index.js +21 -0
  35. package/lib/fe-form/fe-form-render/index.js +33 -0
  36. package/lib/fe-form/fe-form-rich-text/index.js +25 -0
  37. package/lib/fe-form/fe-form-select/index.js +93 -0
  38. package/lib/fe-form/fe-form-switch/index.js +21 -0
  39. package/lib/fe-form/fe-form-text/index.js +20 -0
  40. package/lib/fe-form/fe-form-text-area/index.js +24 -0
  41. package/lib/fe-form/fe-form-time-picker/index.js +21 -0
  42. package/lib/fe-form/fe-form-upload/index.js +63 -0
  43. package/lib/fe-form/utils/index.js +28 -0
  44. package/lib/fe-input/index.js +32 -0
  45. package/lib/fe-input-number/index.js +19 -0
  46. package/lib/fe-layouts/auth-layout/index.js +35 -17
  47. package/lib/fe-layouts/basics-layout/index.js +2 -2
  48. package/lib/fe-layouts/layout.js +34 -16
  49. package/lib/fe-link/index.js +23 -0
  50. package/lib/fe-map/index.js +263 -0
  51. package/lib/fe-modal/index.js +85 -0
  52. package/lib/fe-pagination/index.js +6 -0
  53. package/lib/fe-panel/fe-panel-toolbar.js +40 -0
  54. package/lib/fe-panel/index.js +49 -0
  55. package/lib/fe-panel/use-panel-context.js +9 -0
  56. package/lib/fe-permission/index.js +12 -0
  57. package/lib/fe-permission-provider/index.js +29 -0
  58. package/lib/fe-radio/index.js +11 -0
  59. package/lib/fe-radio-group/index.js +6 -0
  60. package/lib/fe-rich-text/index.js +293 -0
  61. package/lib/fe-select/index.js +24 -0
  62. package/lib/fe-switch/index.js +6 -0
  63. package/lib/fe-table/fe-edit-table/index.js +39 -0
  64. package/lib/fe-table/fe-edit-table-cell/index.js +63 -0
  65. package/lib/fe-table/fe-head-title/index.js +9 -0
  66. package/lib/fe-table/fe-normal-table/index.js +192 -0
  67. package/lib/fe-table/fe-sub-table/index.js +74 -0
  68. package/lib/fe-table/fe-table/index.js +7 -0
  69. package/lib/fe-table/fe-table-alert/index.js +42 -0
  70. package/lib/fe-table/fe-table-link/index.js +87 -0
  71. package/lib/fe-table/fe-table-render/index.js +56 -0
  72. package/lib/fe-table/fe-table-setting/index.js +165 -0
  73. package/lib/fe-table/fe-table-toolbar/index.js +63 -0
  74. package/lib/fe-table/fe-table-utils/index.js +157 -0
  75. package/lib/fe-table/type/table.d.js +4 -0
  76. package/lib/fe-table/use-edit-table/index.js +151 -0
  77. package/lib/fe-table/use-pagination/index.js +59 -0
  78. package/lib/fe-table/use-sub-table/index.js +23 -0
  79. package/lib/fe-table/use-table/index.js +177 -0
  80. package/lib/fe-table/use-table-columns/index.js +53 -0
  81. package/lib/fe-table/use-table-form-context/index.js +14 -0
  82. package/lib/fe-table/use-table-selection/index.js +53 -0
  83. package/lib/fe-text-area/index.js +21 -0
  84. package/lib/fe-time-picker/index.js +19 -0
  85. package/lib/fe-upload/index.js +182 -0
  86. package/lib/fe-upload/upload.constant.js +91 -0
  87. package/lib/fe-upload-atomic/index.js +6 -0
  88. package/lib/fe-upload-crop/index.js +207 -0
  89. package/lib/hooks/{use-auth.hook.js → use-auth.hook/index.js} +3 -3
  90. package/lib/hooks/use-form/index.js +38 -0
  91. package/lib/hooks/use-permission.hook/index.js +9 -0
  92. package/lib/index.css +7 -1
  93. package/lib/index.js +161 -42
  94. package/lib/node_modules/.pnpm/@dnd-kit_accessibility@3.1.1_react@18.3.1/node_modules/@dnd-kit/accessibility/dist/accessibility.esm.js +56 -0
  95. package/lib/node_modules/.pnpm/@dnd-kit_core@6.3.1_nnrd3gsncyragczmpvfhocinkq/node_modules/@dnd-kit/core/dist/core.esm.js +2344 -0
  96. package/lib/node_modules/.pnpm/@dnd-kit_modifiers@9.0.0_55ztycxty3xzw7t4rzpvix55vq/node_modules/@dnd-kit/modifiers/dist/modifiers.esm.js +13 -0
  97. package/lib/node_modules/.pnpm/@dnd-kit_sortable@10.0.0_55ztycxty3xzw7t4rzpvix55vq/node_modules/@dnd-kit/sortable/dist/sortable.esm.js +439 -0
  98. package/lib/node_modules/.pnpm/@dnd-kit_utilities@3.2.2_react@18.3.1/node_modules/@dnd-kit/utilities/dist/utilities.esm.js +235 -0
  99. package/lib/node_modules/.pnpm/object-assign@4.1.1/node_modules/object-assign/index.js +54 -0
  100. package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/checkPropTypes.js +54 -0
  101. package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithThrowingShims.js +52 -0
  102. package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/factoryWithTypeCheckers.js +329 -0
  103. package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.js +17 -0
  104. package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/ReactPropTypesSecret.js +10 -0
  105. package/lib/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/lib/has.js +7 -0
  106. package/lib/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.development.js +95 -0
  107. package/lib/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/cjs/react-is.production.min.js +78 -0
  108. package/lib/node_modules/.pnpm/react-is@16.13.1/node_modules/react-is/index.js +10 -0
  109. package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/Resizable.js +233 -0
  110. package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/ResizableBox.js +164 -0
  111. package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/propTypes.js +113 -0
  112. package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/build/utils.js +56 -0
  113. package/lib/node_modules/.pnpm/react-resizable@3.1.3_nnrd3gsncyragczmpvfhocinkq/node_modules/react-resizable/index.js +12 -0
  114. package/lib/store/modules/layout-config.store.js +83 -65
  115. package/lib/store/modules/theme.store.js +36 -18
  116. package/lib/types/fe-auto-complete/index.d.ts +2 -0
  117. package/lib/types/fe-button/index.d.ts +16 -0
  118. package/lib/types/fe-cascader/index.d.ts +7 -0
  119. package/lib/types/fe-checkbox/index.d.ts +6 -0
  120. package/lib/types/fe-checkbox-group/index.d.ts +7 -0
  121. package/lib/types/fe-date-picker/index.d.ts +3 -0
  122. package/lib/types/fe-description-render/index.d.ts +31 -0
  123. package/lib/types/fe-descriptions/index.d.ts +2 -0
  124. package/lib/types/fe-empty/index.d.ts +2 -0
  125. package/lib/types/fe-error-block/index.d.ts +6 -0
  126. package/lib/types/fe-form/fe-form/index.d.ts +356 -0
  127. package/lib/types/fe-form/fe-form-auto-complete/index.d.ts +3 -0
  128. package/lib/types/fe-form/fe-form-btn-group/index.d.ts +3 -0
  129. package/lib/types/fe-form/fe-form-cascader/index.d.ts +3 -0
  130. package/lib/types/fe-form/fe-form-checkbox-group/index.d.ts +3 -0
  131. package/lib/types/fe-form/fe-form-date-picker/index.d.ts +3 -0
  132. package/lib/types/fe-form/fe-form-date-range-picker/index.d.ts +3 -0
  133. package/lib/types/fe-form/fe-form-input/index.d.ts +3 -0
  134. package/lib/types/fe-form/fe-form-input-input/index.d.ts +3 -0
  135. package/lib/types/fe-form/fe-form-input-number/index.d.ts +3 -0
  136. package/lib/types/fe-form/fe-form-item/index.d.ts +70 -0
  137. package/lib/types/fe-form/fe-form-label/index.d.ts +45 -0
  138. package/lib/types/fe-form/fe-form-radio/index.d.ts +3 -0
  139. package/lib/types/fe-form/fe-form-render/index.d.ts +3 -0
  140. package/lib/types/fe-form/fe-form-rich-text/index.d.ts +3 -0
  141. package/lib/types/fe-form/fe-form-select/index.d.ts +3 -0
  142. package/lib/types/fe-form/fe-form-switch/index.d.ts +3 -0
  143. package/lib/types/fe-form/fe-form-text/index.d.ts +3 -0
  144. package/lib/types/fe-form/fe-form-text-area/index.d.ts +3 -0
  145. package/lib/types/fe-form/fe-form-time-picker/index.d.ts +3 -0
  146. package/lib/types/fe-form/fe-form-upload/index.d.ts +3 -0
  147. package/lib/types/fe-form/index.d.ts +26 -0
  148. package/lib/types/fe-form/utils/index.d.ts +24 -0
  149. package/lib/types/fe-input/index.d.ts +12 -0
  150. package/lib/types/fe-input-number/index.d.ts +2 -0
  151. package/lib/types/fe-layouts/context/global-context.d.ts +240 -238
  152. package/lib/types/fe-link/index.d.ts +6 -0
  153. package/lib/types/fe-map/index.d.ts +73 -0
  154. package/lib/types/fe-modal/index.d.ts +20 -0
  155. package/lib/types/fe-pagination/index.d.ts +2 -0
  156. package/lib/types/fe-panel/fe-panel-toolbar.d.ts +3 -0
  157. package/lib/types/fe-panel/index.d.ts +61 -0
  158. package/lib/types/fe-panel/panel-toolbar.d.ts +4 -0
  159. package/lib/types/fe-panel/use-panel-context.d.ts +6 -0
  160. package/lib/types/fe-permission/index.d.ts +10 -0
  161. package/lib/types/fe-permission-provider/index.d.ts +8 -0
  162. package/lib/types/fe-radio/index.d.ts +2 -0
  163. package/lib/types/fe-radio-group/index.d.ts +2 -0
  164. package/lib/types/fe-rich-text/index.d.ts +167 -0
  165. package/lib/types/fe-select/index.d.ts +8 -0
  166. package/lib/types/fe-switch/index.d.ts +2 -0
  167. package/lib/types/fe-table/fe-edit-table/index.d.ts +3 -0
  168. package/lib/types/fe-table/fe-edit-table-cell/index.d.ts +16 -0
  169. package/lib/types/fe-table/fe-head-title/index.d.ts +6 -0
  170. package/lib/types/fe-table/fe-normal-table/index.d.ts +3 -0
  171. package/lib/types/fe-table/fe-sub-table/index.d.ts +3 -0
  172. package/lib/types/fe-table/fe-table/index.d.ts +3 -0
  173. package/lib/types/fe-table/fe-table-alert/index.d.ts +13 -0
  174. package/lib/types/fe-table/fe-table-link/index.d.ts +12 -0
  175. package/lib/types/fe-table/fe-table-render/index.d.ts +13 -0
  176. package/lib/types/fe-table/fe-table-setting/index.d.ts +22 -0
  177. package/lib/types/fe-table/fe-table-toolbar/index.d.ts +18 -0
  178. package/lib/types/fe-table/fe-table-utils/index.d.ts +193 -0
  179. package/lib/types/fe-table/index.d.ts +6 -0
  180. package/lib/types/fe-table/type/table-context.d.ts +60 -0
  181. package/lib/types/fe-table/type/table.d.ts +797 -0
  182. package/lib/types/fe-table/use-edit-table/index.d.ts +6 -0
  183. package/lib/types/fe-table/use-pagination/index.d.ts +3 -0
  184. package/lib/types/fe-table/use-sub-table/index.d.ts +8 -0
  185. package/lib/types/fe-table/use-table/index.d.ts +3 -0
  186. package/lib/types/fe-table/use-table-columns/index.d.ts +47 -0
  187. package/lib/types/fe-table/use-table-form-context/index.d.ts +10 -0
  188. package/lib/types/fe-table/use-table-selection/index.d.ts +46 -0
  189. package/lib/types/fe-text-area/index.d.ts +4 -0
  190. package/lib/types/fe-time-picker/index.d.ts +3 -0
  191. package/lib/types/fe-upload/index.d.ts +85 -0
  192. package/lib/types/fe-upload/upload.constant.d.ts +39 -0
  193. package/lib/types/fe-upload-atomic/index.d.ts +2 -0
  194. package/lib/types/fe-upload-crop/index.d.ts +10 -0
  195. package/lib/types/hooks/index.d.ts +1 -0
  196. package/lib/types/hooks/use-descriptions/index.d.ts +3 -0
  197. package/lib/types/hooks/use-form/index.d.ts +16 -0
  198. package/lib/types/hooks/use-permission.hook/index.d.ts +10 -0
  199. package/lib/types/index.d.ts +32 -0
  200. package/lib/types/typings/index.d.ts +98 -59
  201. package/lib/types/typings/shims-axios.d.ts +38 -38
  202. package/package.json +79 -69
  203. /package/lib/hooks/{use-nprogress.hook.js → use-nprogress.hook/index.js} +0 -0
  204. /package/lib/types/hooks/{use-auth.hook.d.ts → use-auth.hook/index.d.ts} +0 -0
  205. /package/lib/types/hooks/{use-nprogress.hook.d.ts → use-nprogress.hook/index.d.ts} +0 -0
@@ -0,0 +1,21 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Input as l } from "antd";
3
+ const u = l.TextArea, s = (t) => {
4
+ const e = { ...t }, a = (n) => {
5
+ e.onChange && e.onChange(n.target.value);
6
+ }, r = (n) => {
7
+ n.target.value = String(n.target.value).trim(), e.onChange && e.onChange(n.target.value), e.onBlur && e.onBlur(n);
8
+ };
9
+ return /* @__PURE__ */ o(
10
+ u,
11
+ {
12
+ ...t,
13
+ value: e.value,
14
+ onChange: a,
15
+ onBlur: r
16
+ }
17
+ );
18
+ };
19
+ export {
20
+ s as default
21
+ };
@@ -0,0 +1,19 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import { TimePicker as m } from "antd";
3
+ const r = (e) => {
4
+ const t = (n, a) => {
5
+ e.onChange && e.onChange(n, a);
6
+ };
7
+ return /* @__PURE__ */ i(
8
+ m,
9
+ {
10
+ ...e,
11
+ value: e.value,
12
+ onChange: t,
13
+ style: { width: "100%", ...e.style || {} }
14
+ }
15
+ );
16
+ };
17
+ export {
18
+ r as default
19
+ };
@@ -0,0 +1,182 @@
1
+ import { jsx as c, jsxs as b } from "react/jsx-runtime";
2
+ import { PlusOutlined as V, UploadOutlined as k, InboxOutlined as W } from "@ant-design/icons";
3
+ import { classnames as C, isString as K } from "@spacego/turbo-utils";
4
+ import { Image as R, Modal as H, Button as J, message as A, Upload as I } from "antd";
5
+ import { useMemo as E, useState as g, useEffect as M } from "react";
6
+ import Q from "../fe-error-block/index.js";
7
+ import X from "../fe-upload-atomic/index.js";
8
+ import Y from "../fe-upload-crop/index.js";
9
+ import { getAccept as Z, validateFileByCustomAccept as p, validateFileByAccept as ee, getAcceptLabel as te } from "./upload.constant.js";
10
+ /* empty css */
11
+ const ae = (e) => {
12
+ if (!e) return e;
13
+ const m = ["", "K", "M", "G", "T", "P"];
14
+ let f = 0;
15
+ for (; e >= 1024 && f < m.length; )
16
+ e = e / 1024, f++;
17
+ return `${Number(e.toFixed(2))}${m[f]}B`;
18
+ }, z = (e) => {
19
+ if (!e) return !1;
20
+ if (e.startsWith("data:image")) return !0;
21
+ const m = e.split(/[?#]/)[0];
22
+ return /\.(jpg|jpeg|png|gif|bmp|webp)$/i.test(m);
23
+ }, U = (e) => e.startsWith("image/"), w = (e) => {
24
+ var T;
25
+ e = { ...e }, e.fileSize = e.fileSize ?? 1024 * 1024 * 20, e.isCropImage = e.isCropImage ?? !1, e.cropCofig = e.cropCofig ?? void 0;
26
+ const [m, f] = g(), [d, o] = g([]), [L, _] = g(""), [P, x] = g(!1), [$, N] = g(!1), [u, F] = g(null), v = E(() => ((d == null ? void 0 : d.map((t) => {
27
+ var a;
28
+ return t.url ?? ((a = t.response) == null ? void 0 : a.url) ?? t.thumbUrl ?? t.preview;
29
+ })) || []).filter(z), [d]), q = async (t, a) => {
30
+ let i = !0, l = !0;
31
+ if (e.fileSize && (l = (t.size || 0) < e.fileSize, !l))
32
+ return A.error(`文件"${t.name}"大小不能超过${ae(e.fileSize)}`), I.LIST_IGNORE;
33
+ if ((e.accept || e.customAccept) && !e.isManualValieType && (i = e.customAccept ? p(t.type, e.customAccept) : ee(t.type, e.accept), !i))
34
+ return A.error(`文件"${t.name}"类型只能为${e.acceptDesc || te(e.accept) || e.customAccept}格式`), I.LIST_IGNORE;
35
+ if (e.beforeUpload) {
36
+ const n = await e.beforeUpload(t, a);
37
+ if (n === !1 || n === I.LIST_IGNORE)
38
+ return n;
39
+ i = n;
40
+ }
41
+ return i && l;
42
+ }, S = (t) => {
43
+ const { file: a, fileList: i } = t;
44
+ if (a.status) {
45
+ if (o(i), ["done", "removed"].includes(a.status)) {
46
+ if (a.status === "done") {
47
+ const l = [...i];
48
+ l.forEach((n) => {
49
+ var s;
50
+ n.uid === a.uid && (n.url = a.url || ((s = a.response) == null ? void 0 : s.url));
51
+ }), o(l);
52
+ }
53
+ e.onChange && e.onChange(i, t);
54
+ }
55
+ if (a.status === "error" && e.isRemoveOnError) {
56
+ const l = i.filter((n) => n.uid !== a.uid);
57
+ o(l), e.onChange && e.onChange(l, t);
58
+ }
59
+ if (e.isCropImage && a.type && U(a.type) && ["uploading"].includes(a.status)) {
60
+ const l = [...i].filter((n) => (n == null ? void 0 : n.uid) !== t.file.uid);
61
+ o(l);
62
+ }
63
+ }
64
+ }, B = async (t) => {
65
+ var n, s, r, y;
66
+ const a = new File([t], (n = u == null ? void 0 : u.file) == null ? void 0 : n.name, { type: (s = u == null ? void 0 : u.file) == null ? void 0 : s.type }), i = await ((r = e.customRequest) == null ? void 0 : r.call(e, a)), l = {
67
+ ...a,
68
+ uid: (y = u == null ? void 0 : u.file) == null ? void 0 : y.uid,
69
+ size: a.size,
70
+ type: a.type,
71
+ name: a.name,
72
+ lastModified: a.lastModified,
73
+ lastModifiedDate: a.lastModifiedDate,
74
+ status: "done",
75
+ originFileObj: a,
76
+ response: i,
77
+ url: i == null ? void 0 : i.url
78
+ };
79
+ S({ file: l, fileList: [...d, l] }), N(!1);
80
+ }, O = async (t, a) => {
81
+ var i;
82
+ try {
83
+ const l = await ((i = e.customRequest) == null ? void 0 : i.call(e, t));
84
+ a.onSuccess(l);
85
+ } catch (l) {
86
+ a.onError(l);
87
+ } finally {
88
+ F(null);
89
+ }
90
+ }, j = async (t) => {
91
+ e.isCropImage && (t != null && t.file) && t.file.type && U(t.file.type) ? (N(!0), F(t)) : O(t.file, t);
92
+ }, D = (t) => {
93
+ if (!t) return;
94
+ if (!t.length) {
95
+ o([]);
96
+ return;
97
+ }
98
+ let a = [];
99
+ const i = [...d];
100
+ let l = !1;
101
+ K(t) && (t = t.split(",").map((n) => ({ url: n }))), a = t, a.forEach((n) => {
102
+ const s = d.find((r) => {
103
+ var y;
104
+ return r.url === n.url || r.uid === n.uid || ((y = r == null ? void 0 : r.response) == null ? void 0 : y.url) === n.url;
105
+ });
106
+ s ? s.status || (s.status = "done", l = !0) : (i.push(n), l = !0);
107
+ }), l && o(i);
108
+ }, G = async (t) => {
109
+ var i, l;
110
+ if ((i = e.onPreview) == null || i.call(e, t), e.isManualPreview) return;
111
+ const a = t.url || t.thumbUrl || t.preview || ((l = t.response) == null ? void 0 : l.url);
112
+ a && (t.type && !U(t.type) || !t.type && !z(a) || (_(a), x(!0)));
113
+ };
114
+ M(() => {
115
+ e.value && D(e.value);
116
+ }, [e.value]), M(() => {
117
+ e.maxCount && d.length > e.maxCount ? f(`最多上传${e.maxCount}个文件`) : f(void 0);
118
+ }, [d, e.maxCount, e.value]);
119
+ const h = {
120
+ ...e,
121
+ className: C("fe-upload", e.className),
122
+ fileList: d,
123
+ beforeUpload: q,
124
+ onChange: S,
125
+ onPreview: G,
126
+ customRequest: void 0,
127
+ accept: void 0
128
+ };
129
+ return e.customRequest && (h.customRequest = j), (e.accept || e.customAccept) && (h.accept = e.customAccept ?? Z(e.accept)), /* @__PURE__ */ b(Q, { message: m, children: [
130
+ /* @__PURE__ */ c(X, { ...h, children: h.maxCount && d.length >= h.maxCount ? null : h.children }),
131
+ !!e.tips && /* @__PURE__ */ c("div", { className: "fe-upload-tips", children: e.tips }),
132
+ L && /* @__PURE__ */ c(
133
+ R.PreviewGroup,
134
+ {
135
+ items: v,
136
+ preview: {
137
+ visible: P,
138
+ current: v.findIndex((t) => t === L),
139
+ onChange: (t) => _(v[t]),
140
+ onVisibleChange: (t) => x(t),
141
+ afterOpenChange: (t) => !t && _("")
142
+ },
143
+ children: v.map((t) => /* @__PURE__ */ c(R, { wrapperStyle: { display: "none" }, src: t }, t))
144
+ }
145
+ ),
146
+ e.isCropImage && ((T = u == null ? void 0 : u.file) == null ? void 0 : T.type) && U(u.file.type) && /* @__PURE__ */ c(
147
+ H,
148
+ {
149
+ destroyOnClose: !0,
150
+ maskClosable: !1,
151
+ closable: !0,
152
+ onCancel: () => N(!1),
153
+ centered: !0,
154
+ width: 600,
155
+ open: $,
156
+ title: "图片裁剪",
157
+ footer: null,
158
+ children: /* @__PURE__ */ c(Y, { cropConfig: e == null ? void 0 : e.cropCofig, file: u == null ? void 0 : u.file, onCrop: B })
159
+ }
160
+ )
161
+ ] });
162
+ }, le = (e) => (e = { ...e }, e.title = e.title ?? "上传文件", e.showUploadList = e.showUploadList ?? !0, e.listType = e.listType ?? "picture-card", /* @__PURE__ */ c(w, { ...e, className: C("fe-upload__default", e.className), children: /* @__PURE__ */ b("button", { type: "button", className: "fe-upload__default-content", children: [
163
+ /* @__PURE__ */ c(V, {}),
164
+ e.title && /* @__PURE__ */ c("div", { className: "fe-upload__default-title", children: e.title })
165
+ ] }) })), ie = (e) => (e = { ...e }, e.maxCount = e.maxCount ?? 1, e.showUploadList = e.showUploadList ?? !0, e.listType = e.listType ?? "picture-card", /* @__PURE__ */ c(w, { ...e, className: C("fe-upload__card", e.className), type: "drag", children: /* @__PURE__ */ c("div", { className: "fe-upload__card-content", children: e.title }) })), ne = (e) => (e = { ...e }, e.title = e.title ?? "上传文件", e.showUploadList = e.showUploadList ?? !0, /* @__PURE__ */ c(w, { ...e, className: C("fe-upload__btn", e.className), children: /* @__PURE__ */ c(J, { className: "fe-upload__btn-content", icon: /* @__PURE__ */ c(k, {}), children: e.title }) })), ce = (e) => (e = { ...e }, e.type = e.type ?? "drag", e.title = e.title ?? "点击或将文件拖拽到这里上传", /* @__PURE__ */ c(w, { ...e, tips: void 0, className: C("fe-upload__drag", e.className), children: /* @__PURE__ */ b("div", { className: "fe-upload__drag-content", children: [
166
+ /* @__PURE__ */ c("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ c(W, {}) }),
167
+ /* @__PURE__ */ c("p", { className: "ant-upload-text", children: e.title }),
168
+ !!e.tips && /* @__PURE__ */ c("p", { className: "ant-upload-hint", children: e.tips })
169
+ ] }) })), ue = /* @__PURE__ */ new Map([
170
+ ["render", w],
171
+ ["default", le],
172
+ ["card", ie],
173
+ ["btn", ne],
174
+ ["drag", ce]
175
+ ]), we = (e) => {
176
+ e = { ...e }, e.customType = e.customType ?? "default";
177
+ const m = E(() => ue.get(e.customType), [e.customType]);
178
+ return /* @__PURE__ */ c(m, { ...e });
179
+ };
180
+ export {
181
+ we as default
182
+ };
@@ -0,0 +1,91 @@
1
+ const n = {
2
+ IMAGE: {
3
+ label: "图片",
4
+ accept: "image/*",
5
+ mimeSet: /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/gif", "image/bmp", "image/webp", "image/svg+xml"])
6
+ },
7
+ PDF: {
8
+ label: "PDF",
9
+ accept: ".pdf",
10
+ mimeSet: /* @__PURE__ */ new Set(["application/pdf"])
11
+ },
12
+ WORD: {
13
+ label: "WORD",
14
+ accept: ".doc,.docx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document",
15
+ mimeSet: /* @__PURE__ */ new Set(["application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"])
16
+ },
17
+ EXCEL: {
18
+ label: "EXCEL",
19
+ accept: ".xls,.xlsx,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
20
+ mimeSet: /* @__PURE__ */ new Set(["application/vnd.ms-excel", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"])
21
+ },
22
+ PPT: {
23
+ label: "PPT",
24
+ accept: ".ppt,.pptx,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation",
25
+ mimeSet: /* @__PURE__ */ new Set([
26
+ "application/vnd.ms-powerpoint",
27
+ "application/vnd.openxmlformats-officedocument.presentationml.presentation"
28
+ ])
29
+ },
30
+ TXT: {
31
+ label: "TXT",
32
+ accept: ".txt,text/plain",
33
+ mimeSet: /* @__PURE__ */ new Set(["text/plain"])
34
+ },
35
+ ZIP: {
36
+ label: "压缩包",
37
+ accept: ".zip,.rar,.7z,application/zip,application/x-rar-compressed,application/x-7z-compressed",
38
+ mimeSet: /* @__PURE__ */ new Set(["application/zip", "application/x-rar-compressed", "application/x-7z-compressed"])
39
+ },
40
+ VIDEO: {
41
+ label: "视频",
42
+ accept: "video/*",
43
+ mimeSet: /* @__PURE__ */ new Set([
44
+ "video/mp4",
45
+ "video/quicktime",
46
+ "video/x-msvideo",
47
+ // "video/x-matroska",
48
+ "video/webm",
49
+ "video/wmv",
50
+ "video/flv",
51
+ "video/mpeg"
52
+ ])
53
+ },
54
+ AUDIO: {
55
+ label: "音频",
56
+ accept: "audio/*",
57
+ mimeSet: /* @__PURE__ */ new Set(["audio/mpeg", "audio/wav", "audio/ogg", "audio/mp3", "audio/aac", "audio/flac"])
58
+ }
59
+ };
60
+ function p(e, t) {
61
+ return t ? (Array.isArray(t) ? t : [t]).some((i) => {
62
+ const a = n[i];
63
+ return a == null ? void 0 : a.mimeSet.has(e);
64
+ }) : !0;
65
+ }
66
+ function r(e, t) {
67
+ return t ? t.split(",").some((i) => i === e) : !0;
68
+ }
69
+ function m(e) {
70
+ if (!e) return "";
71
+ const o = (Array.isArray(e) ? e : [e]).map((i) => {
72
+ var a;
73
+ return (a = n[i]) == null ? void 0 : a.accept;
74
+ }).filter(Boolean).flatMap((i) => i.split(","));
75
+ return Array.from(new Set(o)).join(",");
76
+ }
77
+ function c(e) {
78
+ if (!e) return "";
79
+ const o = (Array.isArray(e) ? e : [e]).map((i) => {
80
+ var a;
81
+ return (a = n[i]) == null ? void 0 : a.label;
82
+ }).filter(Boolean);
83
+ return Array.from(new Set(o)).join("、");
84
+ }
85
+ export {
86
+ n as ACCEPT_TYPE_MAP,
87
+ m as getAccept,
88
+ c as getAcceptLabel,
89
+ p as validateFileByAccept,
90
+ r as validateFileByCustomAccept
91
+ };
@@ -0,0 +1,6 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ import { Upload as t } from "antd";
3
+ const a = (o) => /* @__PURE__ */ r(t, { ...o });
4
+ export {
5
+ a as default
6
+ };
@@ -0,0 +1,207 @@
1
+ import { jsxs as B, jsx as z } from "react/jsx-runtime";
2
+ import { Slider as ct } from "antd";
3
+ import { useRef as G, useState as M, useEffect as J } from "react";
4
+ /* empty css */
5
+ let r = null;
6
+ const gt = (W) => {
7
+ const { file: R, onCrop: I, cropConfig: i } = W, y = G(null), E = G(null), [_, k] = M(!1), [N, j] = M(!1), [K, U] = M(""), [L, T] = M({ x: 0, y: 0 }), [t, b] = M({
8
+ x: 100,
9
+ y: 100,
10
+ width: 100,
11
+ height: 100
12
+ }), [V, P] = M("default"), [s, Q] = M({
13
+ width: 0,
14
+ height: 0,
15
+ scale: 1,
16
+ naturalWidth: 0,
17
+ naturalHeight: 0,
18
+ displayX: 0,
19
+ displayY: 0
20
+ });
21
+ J(() => {
22
+ i != null && i.width && (i != null && i.height) && b((e) => ({ ...e, width: i == null ? void 0 : i.width, height: i == null ? void 0 : i.height }));
23
+ }, [i == null ? void 0 : i.width, i == null ? void 0 : i.height]);
24
+ const X = /* @__PURE__ */ new Set(["image/jpeg", "image/png", "image/gif", "image/bmp", "image/webp", "image/svg+xml"]), Z = (e, h) => {
25
+ if (!e) return;
26
+ const n = e.getContext("2d");
27
+ if (!n) return;
28
+ E.current = n;
29
+ const a = new FileReader();
30
+ a.onload = function(c) {
31
+ var d;
32
+ r = new Image(), r.src = (d = c == null ? void 0 : c.target) == null ? void 0 : d.result, r.onload = function() {
33
+ const g = e, o = window.devicePixelRatio || 1, x = 500, u = 300;
34
+ g.width = x * o, g.height = u * o, g.style.width = `${x}px`, g.style.height = `${u}px`, n.scale(o, o);
35
+ const S = r.naturalWidth / r.naturalHeight, w = x / u;
36
+ let l, m;
37
+ S > w ? (l = x, m = x / S) : (m = u, l = u * S);
38
+ const f = (x - l) / 2, p = (u - m) / 2;
39
+ Q({
40
+ width: l,
41
+ height: m,
42
+ scale: 1,
43
+ naturalWidth: r.naturalWidth,
44
+ naturalHeight: r.naturalHeight,
45
+ displayX: f,
46
+ displayY: p
47
+ }), n.imageSmoothingEnabled = !0, n.imageSmoothingQuality = "high", n.drawImage(r, f, p, l, m);
48
+ const F = {
49
+ x: f + (l - ((i == null ? void 0 : i.width) ?? 100)) / 2,
50
+ y: p + (m - ((i == null ? void 0 : i.height) ?? 100)) / 2,
51
+ width: (i == null ? void 0 : i.width) ?? 100,
52
+ height: (i == null ? void 0 : i.height) ?? 100
53
+ };
54
+ b(F), Y();
55
+ };
56
+ }, a.readAsDataURL(h);
57
+ }, Y = () => {
58
+ const e = E.current;
59
+ if (!e || !y.current || !r) return;
60
+ const h = y.current, n = window.devicePixelRatio || 1;
61
+ e.clearRect(0, 0, h.width, h.height);
62
+ const a = s.width * s.scale, c = s.height * s.scale, d = s.displayX + (s.width - a) / 2, g = s.displayY + (s.height - c) / 2;
63
+ s.scale >= 1 ? (e.imageSmoothingEnabled = !0, e.imageSmoothingQuality = "high") : e.imageSmoothingEnabled = !1, e.drawImage(r, d, g, a, c), e.fillStyle = "rgba(0, 0, 0, 0.5)", e.fillRect(0, 0, h.width / n, h.height / n), e.clearRect(t.x, t.y, t.width, t.height), e.save(), e.beginPath(), e.rect(t.x, t.y, t.width, t.height), e.clip(), s.scale >= 1 ? (e.imageSmoothingEnabled = !0, e.imageSmoothingQuality = "high") : e.imageSmoothingEnabled = !1, e.drawImage(r, d, g, a, c), e.restore(), e.strokeStyle = "#ffffff", e.lineWidth = 2, e.strokeRect(t.x, t.y, t.width, t.height);
64
+ const o = 10;
65
+ e.fillStyle = "#ffffff", [
66
+ { x: t.x - o / 2, y: t.y - o / 2, cursor: "nw-resize" },
67
+ // top-left
68
+ { x: t.x + t.width - o / 2, y: t.y - o / 2, cursor: "ne-resize" },
69
+ // top-right
70
+ { x: t.x - o / 2, y: t.y + t.height - o / 2, cursor: "sw-resize" },
71
+ // bottom-left
72
+ {
73
+ x: t.x + t.width - o / 2,
74
+ y: t.y + t.height - o / 2,
75
+ cursor: "se-resize"
76
+ }
77
+ // bottom-right
78
+ ].forEach((u) => {
79
+ e.fillRect(u.x, u.y, o, o);
80
+ });
81
+ }, q = (e, h) => {
82
+ const { x: a, y: c, width: d, height: g } = t;
83
+ return Math.abs(e - a) <= 10 && Math.abs(h - c) <= 10 ? { direction: "nw", cursor: "nw-resize" } : Math.abs(e - (a + d)) <= 10 && Math.abs(h - c) <= 10 ? { direction: "ne", cursor: "ne-resize" } : Math.abs(e - a) <= 10 && Math.abs(h - (c + g)) <= 10 ? { direction: "sw", cursor: "sw-resize" } : Math.abs(e - (a + d)) <= 10 && Math.abs(h - (c + g)) <= 10 ? { direction: "se", cursor: "se-resize" } : { direction: "", cursor: "default" };
84
+ }, C = (e) => {
85
+ if (!y.current) return;
86
+ const h = y.current.getBoundingClientRect(), n = e.clientX - h.left, a = e.clientY - h.top;
87
+ if (!_ && !N) {
88
+ const { cursor: S } = q(n, a);
89
+ P(S);
90
+ }
91
+ const c = s.width * s.scale, d = s.height * s.scale, g = s.displayX + (s.width - c) / 2, o = s.displayY + (s.height - d) / 2, x = g + c, u = o + d;
92
+ if (_) {
93
+ const S = Math.min(Math.max(n - L.x, 0), y.current.offsetWidth - t.width), w = Math.min(Math.max(a - L.y, 0), y.current.offsetHeight - t.height);
94
+ b((l) => ({
95
+ ...l,
96
+ x: S,
97
+ y: w
98
+ }));
99
+ } else if (N) {
100
+ let w = t.width, l = t.height, m = t.x, f = t.y;
101
+ switch (K) {
102
+ case "nw":
103
+ w = Math.max(50, t.x + t.width - n), l = Math.max(50, t.y + t.height - a), m = Math.max(g, n), f = Math.max(o, a), w = t.x + t.width - m, l = t.y + t.height - f;
104
+ break;
105
+ case "ne":
106
+ w = Math.max(50, Math.min(n - t.x, x - t.x)), l = Math.max(50, t.y + t.height - a), f = Math.max(o, a), l = t.y + t.height - f;
107
+ break;
108
+ case "sw":
109
+ w = Math.max(50, t.x + t.width - n), l = Math.max(50, Math.min(a - t.y, u - t.y)), m = Math.max(g, n), w = t.x + t.width - m;
110
+ break;
111
+ case "se":
112
+ w = Math.max(50, Math.min(n - t.x, x - t.x)), l = Math.max(50, Math.min(a - t.y, u - t.y));
113
+ break;
114
+ }
115
+ b((p) => ({
116
+ ...p,
117
+ x: m,
118
+ y: f,
119
+ width: w,
120
+ height: l
121
+ }));
122
+ }
123
+ Y();
124
+ }, tt = (e) => {
125
+ var d;
126
+ const h = (d = y.current) == null ? void 0 : d.getBoundingClientRect();
127
+ if (!h) return;
128
+ const n = e.clientX - h.left, a = e.clientY - h.top, { direction: c } = q(n, a);
129
+ c && !(i != null && i.width) && !(i != null && i.height) ? (j(!0), U(c)) : n >= t.x && n <= t.x + t.width && a >= t.y && a <= t.y + t.height && (k(!0), T({ x: n - t.x, y: a - t.y }));
130
+ }, A = () => {
131
+ k(!1), j(!1), U(""), P("default");
132
+ }, et = () => {
133
+ var O, $;
134
+ if (!y.current || !r) return;
135
+ const e = document.createElement("canvas"), h = e.getContext("2d");
136
+ if (!h) return;
137
+ h.imageSmoothingEnabled = !1;
138
+ const n = s.scale, a = s.width * n, c = s.height * n, d = s.displayX + (s.width - a) / 2, g = s.displayY + (s.height - c) / 2, o = t.x - d, x = t.y - g, u = o / a, S = x / c, w = t.width / a, l = t.height / c, m = u * r.naturalWidth, f = S * r.naturalHeight, p = w * r.naturalWidth, F = l * r.naturalHeight, at = m, st = f, v = Math.round(p), H = Math.round(F);
139
+ e.width = v, e.height = H, h.fillStyle = "#FFFFFF", h.fillRect(0, 0, v, H), h.drawImage(
140
+ r,
141
+ at,
142
+ // 从原图的这个X坐标开始
143
+ st,
144
+ // 从原图的这个Y坐标开始
145
+ v,
146
+ // 提取这么宽的区域
147
+ H,
148
+ // 提取这么高的区域
149
+ 0,
150
+ // 绘制到输出canvas的(0, 0)位置
151
+ 0,
152
+ v,
153
+ // 输出尺寸与源尺寸相同,1:1复制
154
+ H
155
+ );
156
+ const nt = ((O = W.file) == null ? void 0 : O.type) === "image/jpeg" ? 0.95 : 1;
157
+ e.toBlob(
158
+ (D) => {
159
+ if (D && I) {
160
+ const ht = new Image();
161
+ ht.src = URL.createObjectURL(D), I(D);
162
+ }
163
+ },
164
+ (($ = W.file) == null ? void 0 : $.type) || "image/png",
165
+ nt
166
+ );
167
+ }, it = (e) => {
168
+ Q((h) => ({ ...h, scale: e })), requestAnimationFrame(() => {
169
+ Y();
170
+ });
171
+ };
172
+ return J(() => {
173
+ R && (X != null && X.has(R.type)) && y.current && Z(y.current, R);
174
+ }, [R]), /* @__PURE__ */ B("div", { className: "uploadFile-crop", children: [
175
+ /* @__PURE__ */ z("div", { className: "uploadFile-crop__content", children: /* @__PURE__ */ z(
176
+ "canvas",
177
+ {
178
+ ref: y,
179
+ onMouseDown: tt,
180
+ onMouseMove: C,
181
+ onMouseUp: A,
182
+ onMouseLeave: A,
183
+ style: { cursor: V }
184
+ }
185
+ ) }),
186
+ /* @__PURE__ */ B("div", { className: "uploadFile-crop__toolBar", children: [
187
+ /* @__PURE__ */ B("div", { className: "uploadFile-crop__toolBar_scale", children: [
188
+ /* @__PURE__ */ z("span", { className: "toolbarTitle", children: "缩放" }),
189
+ /* @__PURE__ */ z("div", { style: { flex: 1 }, children: /* @__PURE__ */ z(
190
+ ct,
191
+ {
192
+ step: 0.01,
193
+ tooltip: { open: !1 },
194
+ value: s == null ? void 0 : s.scale,
195
+ max: 3,
196
+ min: 0.5,
197
+ onChange: it
198
+ }
199
+ ) })
200
+ ] }),
201
+ /* @__PURE__ */ z("button", { onClick: et, className: "crop-button", children: "裁剪" })
202
+ ] })
203
+ ] });
204
+ };
205
+ export {
206
+ gt as default
207
+ };
@@ -1,7 +1,7 @@
1
1
  import { useSubmit as i, useFetcher as c, useSearchParams as n } from "react-router-dom";
2
- import { useLayoutConfigStore as a } from "../store/modules/layout-config.store.js";
3
- import "../store/modules/theme.store.js";
4
- import { useGlobal as l } from "../fe-layouts/context/context.js";
2
+ import { useLayoutConfigStore as a } from "../../store/modules/layout-config.store.js";
3
+ import "../../store/modules/theme.store.js";
4
+ import { useGlobal as l } from "../../fe-layouts/context/context.js";
5
5
  import "react/jsx-runtime";
6
6
  import "react";
7
7
  function E() {
@@ -0,0 +1,38 @@
1
+ import { useRef as n, useState as i, useEffect as c } from "react";
2
+ const s = (e) => {
3
+ var f;
4
+ const l = n(), o = n(), [m, r] = i({
5
+ formRef: o,
6
+ formItems: e.formItems,
7
+ formData: e.formData,
8
+ formColSpan: e.formColSpan,
9
+ type: e.type,
10
+ labelWidth: e.labelWidth ?? "100px",
11
+ formReactive: e.formReactive ?? !0,
12
+ onValueChange: e.setFormData,
13
+ onSearch: e.onSearch,
14
+ onReload: e.onReload
15
+ }), u = (t) => {
16
+ r((d) => ({ ...d, formData: t }));
17
+ };
18
+ return c(() => {
19
+ u(e.formData);
20
+ }, [e.formData]), c(() => {
21
+ l.current = e.key, r((t) => ({
22
+ ...t,
23
+ formItems: e.formItems,
24
+ onReload: e.onReload,
25
+ onSearch: e.onSearch
26
+ }));
27
+ }, [e.key]), {
28
+ formRef: o,
29
+ formProps: {
30
+ ...m,
31
+ baseFormAttributes: e.baseFormAttributes
32
+ },
33
+ validate: (f = o.current) == null ? void 0 : f.validate
34
+ };
35
+ };
36
+ export {
37
+ s as default
38
+ };
@@ -0,0 +1,9 @@
1
+ import { createContext as e, useContext as s } from "react";
2
+ const t = e({
3
+ btnPermissionList: [],
4
+ hasPermission: () => !0
5
+ }), i = () => s(t);
6
+ export {
7
+ t as default,
8
+ i as usePermission
9
+ };