hy-dispatch-ui-v3 0.1.4 → 0.1.6

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 (49) hide show
  1. package/dist/tailwind.css +59 -0
  2. package/es/components/appConfigProvider/appConfigProvider.vue.mjs +3 -3
  3. package/es/components/appConfirmDialog/appConfirmDialog.vue.mjs +3 -3
  4. package/es/components/appConfirmDialog/appConfirmMethod.mjs +13 -13
  5. package/es/components/appCutter/appCutter.vue.mjs +285 -0
  6. package/es/components/appCutter/index.mjs +6 -0
  7. package/es/components/appCutter/style/appCutter.scss +51 -0
  8. package/es/components/appDialog/appDialog.vue.mjs +205 -0
  9. package/es/components/appDialog/index.mjs +6 -0
  10. package/es/components/appDialog/style/appDialog.scss +0 -0
  11. package/es/components/appSearch/appSearch.vue.mjs +4 -8
  12. package/es/components/appTable/appTable.vue.mjs +4 -4
  13. package/es/components/appTable/js/useAppTable.mjs +4 -3
  14. package/es/components/index.mjs +2 -0
  15. package/es/hooks/useApi.mjs +6 -2
  16. package/es/hooks/useGlobalConfig.mjs +2 -2
  17. package/es/hooks/useLocale.mjs +14 -4
  18. package/es/hooks/useUserAvatarMap.mjs +6 -2
  19. package/es/index.mjs +4 -1
  20. package/es/locale/en.mjs +6 -1
  21. package/es/locale/zh_CN.mjs +8 -3
  22. package/es/utils/file.mjs +68 -0
  23. package/es/utils/index.mjs +2 -1
  24. package/es/utils/is.mjs +4 -1
  25. package/es/version.mjs +1 -1
  26. package/lib/components/appConfigProvider/appConfigProvider.vue.js +1 -1
  27. package/lib/components/appConfirmDialog/appConfirmDialog.vue.js +3 -3
  28. package/lib/components/appConfirmDialog/appConfirmMethod.js +13 -13
  29. package/lib/components/appCutter/appCutter.vue.js +289 -0
  30. package/lib/components/appCutter/index.js +11 -0
  31. package/lib/components/appCutter/style/appCutter.scss +51 -0
  32. package/lib/components/appDialog/appDialog.vue.js +209 -0
  33. package/lib/components/appDialog/index.js +11 -0
  34. package/lib/components/appDialog/style/appDialog.scss +0 -0
  35. package/lib/components/appSearch/appSearch.vue.js +4 -8
  36. package/lib/components/appTable/appTable.vue.js +26 -26
  37. package/lib/components/appTable/js/useAppTable.js +4 -3
  38. package/lib/components/index.js +26 -22
  39. package/lib/hooks/useApi.js +6 -2
  40. package/lib/hooks/useLocale.js +13 -3
  41. package/lib/hooks/useUserAvatarMap.js +6 -2
  42. package/lib/index.js +35 -22
  43. package/lib/locale/en.js +6 -1
  44. package/lib/locale/zh_CN.js +8 -3
  45. package/lib/utils/file.js +76 -0
  46. package/lib/utils/index.js +9 -0
  47. package/lib/utils/is.js +4 -0
  48. package/lib/version.js +1 -1
  49. package/package.json +2 -3
@@ -0,0 +1,205 @@
1
+ import { useModel, ref, openBlock, createBlock, unref, mergeProps, withCtx, createElementVNode, renderSlot, createTextVNode, toDisplayString, createCommentVNode, normalizeClass, createElementBlock, createVNode, mergeModels, defineComponent } from 'vue';
2
+ import { ElDialog, ElIcon } from 'element-plus';
3
+ import { CircleClose } from '@element-plus/icons-vue';
4
+ import { useLocale } from '../../hooks/useLocale.mjs';
5
+ import { AppButton } from '../appButton/index.mjs';
6
+
7
+ import "./style/appDialog.scss";
8
+
9
+ const __default__ = defineComponent({
10
+ name: "AppDialog"
11
+ });
12
+ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
13
+ props: /* @__PURE__ */ mergeModels({
14
+ title: { type: String, default: "\u6807\u9898" },
15
+ titleAlign: { type: String, default: "default" },
16
+ // default、center
17
+ showClose: { type: Boolean, default: true },
18
+ showCancel: {
19
+ type: Boolean,
20
+ default: true
21
+ },
22
+ cancelType: {
23
+ type: String,
24
+ default: "default"
25
+ },
26
+ cancelText: {
27
+ type: String
28
+ },
29
+ showSubmit: {
30
+ type: Boolean,
31
+ default: true
32
+ },
33
+ submitType: {
34
+ type: String,
35
+ default: "primary"
36
+ },
37
+ submitText: {
38
+ type: String
39
+ },
40
+ onClose: Function,
41
+ onCancel: Function,
42
+ onSubmit: Function
43
+ }, {
44
+ "modelValue": { type: Boolean, default: false },
45
+ "modelModifiers": {}
46
+ }),
47
+ emits: /* @__PURE__ */ mergeModels(["hide"], ["update:modelValue"]),
48
+ setup(__props, { expose: __expose, emit: __emit }) {
49
+ const props = __props;
50
+ const emits = __emit;
51
+ const { t } = useLocale();
52
+ const visible = useModel(__props, "modelValue");
53
+ const loading = ref(false);
54
+ async function onSubmitHandler() {
55
+ if (loading.value) return;
56
+ loading.value = true;
57
+ if (props.onSubmit) {
58
+ try {
59
+ await props.onSubmit();
60
+ } catch (err) {
61
+ console.error(err);
62
+ loading.value = false;
63
+ return;
64
+ }
65
+ }
66
+ visible.value = false;
67
+ loading.value = false;
68
+ emits("hide");
69
+ }
70
+ async function onCancelHandler() {
71
+ if (loading.value) return;
72
+ loading.value = true;
73
+ if (props.onCancel) {
74
+ try {
75
+ await props.onCancel();
76
+ } catch (err) {
77
+ console.error(err);
78
+ loading.value = false;
79
+ return;
80
+ }
81
+ }
82
+ visible.value = false;
83
+ loading.value = false;
84
+ emits("hide");
85
+ }
86
+ async function onCloseHandler() {
87
+ if (loading.value) return;
88
+ loading.value = true;
89
+ if (props.onClose) {
90
+ try {
91
+ await props.onClose();
92
+ } catch (err) {
93
+ console.error(err);
94
+ loading.value = false;
95
+ return;
96
+ }
97
+ }
98
+ visible.value = false;
99
+ loading.value = false;
100
+ emits("hide");
101
+ }
102
+ __expose({});
103
+ return (_ctx, _cache) => {
104
+ return openBlock(), createBlock(unref(ElDialog), mergeProps({
105
+ modelValue: visible.value,
106
+ "onUpdate:modelValue": ($event) => visible.value = $event,
107
+ "append-to-body": true,
108
+ "close-on-click-modal": false,
109
+ "close-on-press-escape": false,
110
+ "show-close": false,
111
+ width: "37.5rem"
112
+ }, _ctx.$attrs), {
113
+ header: withCtx(() => [
114
+ createElementVNode(
115
+ "div",
116
+ {
117
+ class: normalizeClass(["box-border w-full border-0 border-b border-solid border-background-3 px-4 py-[10px] text-main text-sm font-bold flex justify-between items-center relative", { "!justify-center": __props.titleAlign === "center" }])
118
+ },
119
+ [
120
+ createElementVNode(
121
+ "span",
122
+ null,
123
+ toDisplayString(__props.title),
124
+ 1
125
+ /* TEXT */
126
+ ),
127
+ __props.showClose ? (openBlock(), createElementBlock(
128
+ "div",
129
+ {
130
+ key: 0,
131
+ class: normalizeClass(["text-lg absolute right-4 cursor-pointer text-danger-2", { "cursor-not-allowed": loading.value }]),
132
+ onClick: onCloseHandler
133
+ },
134
+ [
135
+ createCommentVNode(' <AppIcon svg-name="close" class="!w-[20px] !h-[20px]" /> '),
136
+ createVNode(unref(ElIcon), {
137
+ size: "18",
138
+ color: "rgb(var(--hy-danger-2))"
139
+ }, {
140
+ default: withCtx(() => [
141
+ createVNode(unref(CircleClose))
142
+ ]),
143
+ _: 1
144
+ /* STABLE */
145
+ })
146
+ ],
147
+ 2
148
+ /* CLASS */
149
+ )) : createCommentVNode("v-if", true)
150
+ ],
151
+ 2
152
+ /* CLASS */
153
+ )
154
+ ]),
155
+ default: withCtx(() => [
156
+ createElementVNode("div", { class: "text-main" }, [
157
+ createElementVNode("div", { class: "p-6 box-border" }, [
158
+ renderSlot(_ctx.$slots, "default"),
159
+ createElementVNode("div", { class: "flex items-center justify-between pt-5" }, [
160
+ __props.showCancel ? (openBlock(), createBlock(unref(AppButton), {
161
+ key: 0,
162
+ type: __props.cancelType,
163
+ disabled: loading.value,
164
+ class: "!min-w-[120px]",
165
+ onClick: onCancelHandler
166
+ }, {
167
+ default: withCtx(() => [
168
+ createTextVNode(
169
+ toDisplayString(unref(t)("dialog.cancel")),
170
+ 1
171
+ /* TEXT */
172
+ )
173
+ ]),
174
+ _: 1
175
+ /* STABLE */
176
+ }, 8, ["type", "disabled"])) : createCommentVNode("v-if", true),
177
+ __props.showSubmit ? (openBlock(), createBlock(unref(AppButton), {
178
+ key: 1,
179
+ type: __props.submitType,
180
+ disabled: loading.value,
181
+ class: "!min-w-[120px]",
182
+ onClick: onSubmitHandler
183
+ }, {
184
+ default: withCtx(() => [
185
+ createTextVNode(
186
+ toDisplayString(unref(t)("dialog.confirm")),
187
+ 1
188
+ /* TEXT */
189
+ )
190
+ ]),
191
+ _: 1
192
+ /* STABLE */
193
+ }, 8, ["type", "disabled"])) : createCommentVNode("v-if", true)
194
+ ])
195
+ ])
196
+ ])
197
+ ]),
198
+ _: 3
199
+ /* FORWARDED */
200
+ }, 16, ["modelValue", "onUpdate:modelValue"]);
201
+ };
202
+ }
203
+ });
204
+
205
+ export { _sfc_main as default };
@@ -0,0 +1,6 @@
1
+ import _sfc_main from './appDialog.vue.mjs';
2
+ import { withInstall } from '../../utils/handler.mjs';
3
+
4
+ const AppDialog = withInstall(_sfc_main);
5
+
6
+ export { AppDialog, AppDialog as default };
File without changes
@@ -90,10 +90,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
90
90
  shrinkDestroy();
91
91
  });
92
92
  function onChangeHandler(value, column) {
93
- var _a;
94
- if ((_a = column.attrs) == null ? void 0 : _a.onChange) {
95
- column.attrs.onChange(value);
96
- }
97
93
  emits("search");
98
94
  }
99
95
  function onKeydownEnterHander(e) {
@@ -281,7 +277,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
281
277
  }, { ref_for: true }, column.attrs, {
282
278
  disabled: unref(isDisabled)(props, column),
283
279
  onKeydown: withKeys(($event) => onKeydownEnterHander(), ["enter"]),
284
- onChange: ($event) => onChangeHandler($event, column)
280
+ onChange: ($event) => onChangeHandler()
285
281
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "onKeydown", "onChange"])
286
282
  ],
287
283
  2112
@@ -296,7 +292,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
296
292
  "onUpdate:modelValue": ($event) => __props.model[column.field] = $event
297
293
  }, { ref_for: true }, column.attrs, {
298
294
  disabled: unref(isDisabled)(props, column),
299
- onChange: ($event) => onChangeHandler($event, column)
295
+ onChange: ($event) => onChangeHandler()
300
296
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "onChange"])
301
297
  ],
302
298
  2112
@@ -322,7 +318,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
322
318
  }, { ref_for: true }, column.attrs, {
323
319
  disabled: unref(isDisabled)(props, column),
324
320
  timeRangeFill: column.timeRangeFill,
325
- onChange: ($event) => onChangeHandler($event, column)
321
+ onChange: ($event) => onChangeHandler()
326
322
  }), null, 16, ["start", "onUpdate:start", "end", "onUpdate:end", "disabled", "timeRangeFill", "onChange"])) : (openBlock(), createBlock(unref(AppDatePicker), mergeProps({
327
323
  key: 1,
328
324
  modelValue: __props.model[column.field],
@@ -332,7 +328,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
332
328
  }, { ref_for: true }, column.attrs, {
333
329
  disabled: unref(isDisabled)(props, column),
334
330
  timeRangeFill: column.timeRangeFill,
335
- onChange: ($event) => onChangeHandler($event, column)
331
+ onChange: ($event) => onChangeHandler()
336
332
  }), null, 16, ["modelValue", "onUpdate:modelValue", "disabled", "timeRangeFill", "onChange"]))
337
333
  ],
338
334
  64
@@ -1,4 +1,4 @@
1
- import { defineComponent, useTemplateRef, resolveComponent, openBlock, createElementBlock, createCommentVNode, createElementVNode, createBlock, unref, createVNode, withCtx, toDisplayString, withKeys, renderSlot, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, mergeProps, Fragment, withModifiers } from 'vue';
1
+ import { defineComponent, useTemplateRef, openBlock, createElementBlock, createCommentVNode, createElementVNode, createBlock, unref, createVNode, withCtx, toDisplayString, withKeys, renderSlot, normalizeClass, createSlots, renderList, normalizeProps, guardReactiveProps, mergeProps, Fragment, withModifiers } from 'vue';
2
2
  import { ElIcon, ElInput, ElButton, ElTable, ElTableColumn, ElDropdown, ElDropdownMenu, ElDropdownItem, ElPagination } from 'element-plus';
3
3
  import { Filter, Search } from '@element-plus/icons-vue';
4
4
  import { AppTooltip } from '../appTooltip/index.mjs';
@@ -7,6 +7,7 @@ import { useAppTableSearch } from './js/search.mjs';
7
7
  import _sfc_main$1 from './cpns/columnSelect.vue.mjs';
8
8
  import { useMixins } from '../../hooks/useMixins.mjs';
9
9
  import { AppButton } from '../appButton/index.mjs';
10
+ import { AppIcon } from '../appIcon/index.mjs';
10
11
  import { AppSearch } from '../appSearch/index.mjs';
11
12
  import { parseRem } from '../../utils/adaptive.mjs';
12
13
  import { AppIconBox } from '../appIconBox/index.mjs';
@@ -219,7 +220,6 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
219
220
  clearSelectedList
220
221
  });
221
222
  return (_ctx, _cache) => {
222
- const _component_AppIcon = resolveComponent("AppIcon");
223
223
  return openBlock(), createElementBlock(
224
224
  "div",
225
225
  {
@@ -280,7 +280,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
280
280
  onClick: ($event) => unref(getData)()
281
281
  }, {
282
282
  default: withCtx(() => [
283
- createVNode(_component_AppIcon, {
283
+ createVNode(unref(AppIcon), {
284
284
  class: "w-[12px] h-[12px]",
285
285
  "svg-name": "refres"
286
286
  })
@@ -536,7 +536,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
536
536
  createElementVNode(
537
537
  "div",
538
538
  { class: "absolute left-4 top-1/2 transform -translate-y-1/2 text-sm" },
539
- toDisplayString(unref(t)("table.aTotalOfPiecesOfData", [100])),
539
+ toDisplayString(unref(t)("table.aTotalOfPiecesOfData", [unref(totalElements)])),
540
540
  1
541
541
  /* TEXT */
542
542
  ),
@@ -54,7 +54,7 @@ function getColumnsEditable(column, index) {
54
54
  };
55
55
  }
56
56
  const useAppTable = (config = {}) => {
57
- const { columns, filterColumns } = config || {};
57
+ const { columns, filterModel, filterColumns } = config || {};
58
58
  const tableColumns = [];
59
59
  try {
60
60
  for (let i = 0; i < (columns == null ? void 0 : columns.length); i++) {
@@ -75,12 +75,13 @@ const useAppTable = (config = {}) => {
75
75
  console.error(err);
76
76
  }
77
77
  const appSearchForm = useAppSearch(filterColumns, {
78
+ query: null,
78
79
  page: 1,
79
80
  // 当前分页数
80
- size: 15
81
+ size: 15,
81
82
  // 每页数量
83
+ ...filterModel
82
84
  });
83
- console.log("appSearchFormappSearchFormappSearchForm", appSearchForm);
84
85
  return {
85
86
  tableColumns: toRef(tableColumns),
86
87
  filterModel: appSearchForm.formModel,
@@ -12,6 +12,8 @@ export { AppButton } from './appButton/index.mjs';
12
12
  export { AppUserAvatar } from './appUserAvatar/index.mjs';
13
13
  export { AppNoPermissions } from './appNoPermissions/index.mjs';
14
14
  export { AppNoPermissionsMap } from './appNoPermissionsMap/index.mjs';
15
+ export { AppCutter } from './appCutter/index.mjs';
16
+ export { AppDialog } from './appDialog/index.mjs';
15
17
  export { useAppForm } from './appForm/js/useAppForm.mjs';
16
18
  export { useAppSearch } from './appSearch/js/useAppSearch.mjs';
17
19
  export { useAppTable } from './appTable/js/useAppTable.mjs';
@@ -1,9 +1,11 @@
1
1
  import axios from 'axios';
2
2
  import { ref, inject, unref } from 'vue';
3
+ import { useGlobalConfig } from './useGlobalConfig.mjs';
3
4
 
4
5
  const localApiKey = /* @__PURE__ */ Symbol("localApiKey");
5
6
  const defaultAxios = ref(
6
7
  axios.create({
8
+ baseURL: "/api/admin",
7
9
  withCredentials: false,
8
10
  timeout: 6e4
9
11
  })
@@ -18,8 +20,10 @@ defaultAxios.value.interceptors.response.use(
18
20
  }
19
21
  );
20
22
  const useApi = () => {
21
- const api = inject(localApiKey, defaultAxios);
22
- return { api: unref(api) ? api : defaultAxios };
23
+ var _a;
24
+ const api = inject(localApiKey, ref());
25
+ const globalConfig = useGlobalConfig();
26
+ return { api: unref(api) ? api : ((_a = unref(globalConfig)) == null ? void 0 : _a.api) || defaultAxios };
23
27
  };
24
28
 
25
29
  export { defaultAxios, localApiKey, useApi };
@@ -3,7 +3,7 @@ import * as index from '../locale/index.mjs';
3
3
  import { localeContextKey } from './useLocale.mjs';
4
4
  import { localApiKey } from './useApi.mjs';
5
5
  import { localUserAvatarMapKey } from './useUserAvatarMap.mjs';
6
- import Chinese from '../locale/zh_CN.mjs';
6
+ import zh_CN from '../locale/zh_CN.mjs';
7
7
 
8
8
  const globalConfig = ref();
9
9
  const mergeConfig = (a, b) => {
@@ -46,7 +46,7 @@ const provideGlobalConfig = (config, app, global = false) => {
46
46
  provideFn(configProviderContextKey, context);
47
47
  provideFn(
48
48
  localeContextKey,
49
- computed(() => index[context.value.locale] || Chinese)
49
+ computed(() => index[context.value.locale] || zh_CN)
50
50
  );
51
51
  provideFn(
52
52
  localApiKey,
@@ -1,6 +1,8 @@
1
1
  import { inject, ref, computed, unref, isRef } from 'vue';
2
2
  import { get } from 'lodash-unified';
3
- import Chinese from '../locale/zh_CN.mjs';
3
+ import { useGlobalConfig } from './useGlobalConfig.mjs';
4
+ import * as index from '../locale/index.mjs';
5
+ import zh_CN from '../locale/zh_CN.mjs';
4
6
 
5
7
  const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
6
8
  const translate = (path, option, locale) => get(locale, path, path).replace(
@@ -21,13 +23,21 @@ const buildLocaleContext = (locale, conifg) => {
21
23
  };
22
24
  const localeContextKey = /* @__PURE__ */ Symbol("localeContextKey");
23
25
  const getLanguage = (localeOverrides) => {
24
- var _a, _b;
26
+ var _a;
25
27
  const locale = localeOverrides || inject(localeContextKey, ref());
26
- return ((_a = unref(locale)) == null ? void 0 : _a.name) || ((_b = Chinese) == null ? void 0 : _b.name);
28
+ return ((_a = unref(locale)) == null ? void 0 : _a.name) || (Chinese == null ? void 0 : Chinese.name);
27
29
  };
28
30
  const useLocale = (localeOverrides) => {
29
31
  const locale = localeOverrides || inject(localeContextKey, ref());
30
- return buildLocaleContext(computed(() => unref(locale) || Chinese));
32
+ const globalConfig = useGlobalConfig();
33
+ return buildLocaleContext(
34
+ computed(
35
+ () => {
36
+ var _a;
37
+ return unref(locale) || index[(_a = unref(globalConfig)) == null ? void 0 : _a.locale] || zh_CN;
38
+ }
39
+ )
40
+ );
31
41
  };
32
42
 
33
43
  export { buildLocaleContext, buildTranslator, getLanguage, localeContextKey, translate, useLocale };
@@ -1,9 +1,13 @@
1
1
  import { inject, ref } from 'vue';
2
+ import { useGlobalConfig } from './useGlobalConfig.mjs';
2
3
 
3
4
  const localUserAvatarMapKey = /* @__PURE__ */ Symbol("userAvatarMap");
4
5
  const useUserAvatarMap = () => {
5
- const userAvatarMap = inject(localUserAvatarMapKey, ref(/* @__PURE__ */ new Map()));
6
- return { userAvatarMap };
6
+ const userAvatarMap = inject(localUserAvatarMapKey, ref());
7
+ const globalConfig = useGlobalConfig();
8
+ return {
9
+ userAvatarMap: unref(userAvatarMap) ? userAvatarMap : unref(globalConfig).userAvatarMap || ref(/* @__PURE__ */ new Map())
10
+ };
7
11
  };
8
12
 
9
13
  export { localUserAvatarMapKey, useUserAvatarMap };
package/es/index.mjs CHANGED
@@ -2,7 +2,9 @@ import installer from './make-installer.mjs';
2
2
  export { AppButton } from './components/appButton/index.mjs';
3
3
  export { AppConfigProvider } from './components/appConfigProvider/index.mjs';
4
4
  export { AppConfirmDialog } from './components/appConfirmDialog/index.mjs';
5
+ export { AppCutter } from './components/appCutter/index.mjs';
5
6
  export { AppDatePicker } from './components/appDatePicker/index.mjs';
7
+ export { AppDialog } from './components/appDialog/index.mjs';
6
8
  export { AppForm } from './components/appForm/index.mjs';
7
9
  export { AppIcon } from './components/appIcon/index.mjs';
8
10
  export { AppIconBox } from './components/appIconBox/index.mjs';
@@ -14,13 +16,14 @@ export { AppTable } from './components/appTable/index.mjs';
14
16
  export { AppTooltip } from './components/appTooltip/index.mjs';
15
17
  export { AppUserAvatar } from './components/appUserAvatar/index.mjs';
16
18
  export { base64Decrypt, encryptToBase64, generateRandomCode } from './utils/crypto.mjs';
19
+ export { blobToDataURL, directTransmission, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './utils/file.mjs';
17
20
  export { buildLocaleContext, buildTranslator, getLanguage, localeContextKey, translate, useLocale } from './hooks/useLocale.mjs';
18
21
  export { bus } from './utils/bus.mjs';
19
22
  export { cloneDeep, createUniqueId, funRunHandler, mergeDeep, withInstall } from './utils/handler.mjs';
20
23
  export { configProviderContextKey, provideGlobalConfig, useGlobalConfig } from './hooks/useGlobalConfig.mjs';
21
24
  export { defaultAxios, localApiKey, useApi } from './hooks/useApi.mjs';
22
25
  export { getDefaultValueFormatByType } from './utils/date.mjs';
23
- export { isArray, isBoolean, isEmpty, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isSymbol, isUndefined, isVueProxy } from './utils/is.mjs';
26
+ export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isSymbol, isUndefined, isVueProxy } from './utils/is.mjs';
24
27
  export { localUserAvatarMapKey, useUserAvatarMap } from './hooks/useUserAvatarMap.mjs';
25
28
  export { parseRem, pxTorem, remToPx, vwToPx } from './utils/adaptive.mjs';
26
29
  export { useAppForm } from './components/appForm/js/useAppForm.mjs';
package/es/locale/en.mjs CHANGED
@@ -51,7 +51,7 @@ var en = {
51
51
  searchFor: "Search For {0}",
52
52
  example: "Example"
53
53
  },
54
- confirmDialog: {
54
+ dialog: {
55
55
  content: "Secondary Confirmation Operation",
56
56
  close: "Close",
57
57
  cancel: "Cancel",
@@ -73,6 +73,11 @@ var en = {
73
73
  pleaseContactTheAdministrator: "Please Contact The Administrator",
74
74
  youDoNotHaveAMapConfigurationForThisModule: "You Do Not Have A Map Configuration For This Module",
75
75
  pleaseContactTheAdministratorToGoToTheSettingsCenterForConfiguration: "Please Contact The Administrator To Go To The Settings Center For Configuration"
76
+ },
77
+ cutter: {
78
+ uploadPictures: "Upload Picture",
79
+ uploadPictureLimit: "The Image Upload Failed. The File Size Cannot Exceed {0}",
80
+ imageSegmentation: "Image Segmentation"
76
81
  }
77
82
  };
78
83
 
@@ -1,4 +1,4 @@
1
- var Chinese = {
1
+ var zh_CN = {
2
2
  name: "zh_CN",
3
3
  hy: {
4
4
  language: "\u8BED\u8A00",
@@ -52,7 +52,7 @@ var Chinese = {
52
52
  maxColumnLimitTip: "\u5DF2\u8FBE\u5230\u5B57\u6BB5\u6570\u91CF\u4E0A\u9650(\u6700\u591A15\u4E2A)\uFF0C\u8BF7\u53D6\u6D88\u90E8\u5206\u5B57\u6BB5\u540E\u518D\u786E\u8BA4",
53
53
  example: "\u793A\u4F8B"
54
54
  },
55
- confirmDialog: {
55
+ dialog: {
56
56
  content: "\u4E8C\u6B21\u786E\u8BA4\u64CD\u4F5C",
57
57
  close: "\u5173\u95ED",
58
58
  cancel: "\u53D6\u6D88",
@@ -73,7 +73,12 @@ var Chinese = {
73
73
  pleaseContactTheAdministrator: "\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458",
74
74
  youDoNotHaveAMapConfigurationForThisModule: "\u60A8\u6CA1\u6709\u8BE5\u6A21\u5757\u7684\u5730\u56FE\u914D\u7F6E",
75
75
  pleaseContactTheAdministratorToGoToTheSettingsCenterForConfiguration: "\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u524D\u5F80\u8BBE\u7F6E\u4E2D\u5FC3\u8FDB\u884C\u914D\u7F6E"
76
+ },
77
+ cutter: {
78
+ uploadPicture: "\u4E0A\u4F20\u56FE\u7247",
79
+ uploadPictureLimit: "\u56FE\u7247\u4E0A\u4F20\u5931\u8D25\uFF0C\u6587\u4EF6\u4E0D\u80FD\u5927\u4E8E{0}",
80
+ imageSegmentation: "\u56FE\u50CF\u5207\u5272"
76
81
  }
77
82
  };
78
83
 
79
- export { Chinese as default };
84
+ export { zh_CN as default };
@@ -0,0 +1,68 @@
1
+ import { unref } from 'vue';
2
+ import { createUniqueId } from './handler.mjs';
3
+ import { useApi } from '../hooks/useApi.mjs';
4
+
5
+ function blobToDataURL(bolb) {
6
+ return new Promise((resolve) => {
7
+ const a = new FileReader();
8
+ a.onload = function(e) {
9
+ resolve(e.target.result);
10
+ };
11
+ a.readAsDataURL(bolb);
12
+ });
13
+ }
14
+ async function presignedUrl(file) {
15
+ const { api } = useApi();
16
+ const fileList = file.name.split(".");
17
+ const res = await unref(api).post("file/presignedUrl", {
18
+ fileName: `${createUniqueId(1)}.${fileList[fileList.length - 1]}`
19
+ });
20
+ if (res.code === 200) {
21
+ return res;
22
+ } else {
23
+ return Promise.reject(res);
24
+ }
25
+ }
26
+ async function fileJsonUplaod(file) {
27
+ const { api } = useApi();
28
+ const result = await presignedUrl(file);
29
+ await unref(api).put(result.data.url, file, {
30
+ otherUrl: true,
31
+ xAmzAcl: true
32
+ });
33
+ return result;
34
+ }
35
+ async function fileFormUpload(file) {
36
+ const { api } = useApi();
37
+ try {
38
+ const formData = new FormData();
39
+ formData.append("file", file);
40
+ const res = await unref(api).post("/file/upload", formData, {
41
+ otherUrl: true,
42
+ xAmzAcl: false
43
+ });
44
+ return res;
45
+ } catch (err) {
46
+ return Promise.reject(err);
47
+ }
48
+ }
49
+ let directTransmission = true;
50
+ async function fileUpload(file) {
51
+ {
52
+ return await fileJsonUplaod(file);
53
+ }
54
+ }
55
+ async function sizeToTextHandler(size) {
56
+ if (size < Math.pow(1024, 1)) {
57
+ return `${Math.floor(size / Math.pow(1024, 1) / 100) * 100}KB`;
58
+ }
59
+ if (size < Math.pow(1024, 2)) {
60
+ return `${Math.floor(size / Math.pow(1024, 2) / 100) * 100}MB`;
61
+ }
62
+ if (size < Math.pow(1024, 3)) {
63
+ return `${Math.floor(size / Math.pow(1024, 3) / 100) * 100}GB`;
64
+ }
65
+ return `${Math.floor(size / Math.pow(1024, 4) / 100) * 100}TB`;
66
+ }
67
+
68
+ export { blobToDataURL, directTransmission, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler };
@@ -1,6 +1,7 @@
1
1
  export { parseRem, pxTorem, remToPx, vwToPx } from './adaptive.mjs';
2
2
  export { bus } from './bus.mjs';
3
3
  export { base64Decrypt, encryptToBase64, generateRandomCode } from './crypto.mjs';
4
- export { isArray, isBoolean, isEmpty, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isSymbol, isUndefined, isVueProxy } from './is.mjs';
4
+ export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isSymbol, isUndefined, isVueProxy } from './is.mjs';
5
5
  export { cloneDeep, createUniqueId, funRunHandler, mergeDeep, withInstall } from './handler.mjs';
6
6
  export { getDefaultValueFormatByType } from './date.mjs';
7
+ export { blobToDataURL, directTransmission, fileFormUpload, fileJsonUplaod, fileUpload, presignedUrl, sizeToTextHandler } from './file.mjs';
package/es/utils/is.mjs CHANGED
@@ -14,5 +14,8 @@ const isOverflowing = (e) => e.clientWidth < e.scrollWidth || e.clientHeight < e
14
14
  const isVueProxy = (e) => {
15
15
  return isRef(e) || isReactive(e) || isReadonly(e) || isProxy(e);
16
16
  };
17
+ const isFile = (e) => {
18
+ return e instanceof File;
19
+ };
17
20
 
18
- export { isArray, isBoolean, isEmpty, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isSymbol, isUndefined, isVueProxy };
21
+ export { isArray, isBoolean, isEmpty, isFile, isFunction, isNull, isNumber, isObject, isOverflowing, isString, isSymbol, isUndefined, isVueProxy };
package/es/version.mjs CHANGED
@@ -1,3 +1,3 @@
1
- const version = "0.1.4";
1
+ const version = "0.1.6";
2
2
 
3
3
  export { version };
@@ -85,7 +85,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
85
85
  },
86
86
  setup(__props) {
87
87
  const props = __props;
88
- const globalConfig = useGlobalConfig.provideGlobalConfig(props);
88
+ const globalConfig = useGlobalConfig.provideGlobalConfig(props, null, !vue.unref(useGlobalConfig.useGlobalConfig()));
89
89
  const config = vue.computed(() => {
90
90
  const { locale, api, userAvatarMap, ...config2 } = globalConfig.value;
91
91
  return {
@@ -149,7 +149,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
149
149
  vue.createElementVNode(
150
150
  "span",
151
151
  { class: "text-sm text-main font-bold" },
152
- vue.toDisplayString(__props.dialogTitle || vue.unref(t)("confirmDialog.prompt")),
152
+ vue.toDisplayString(__props.dialogTitle || vue.unref(t)("dialog.prompt")),
153
153
  1
154
154
  /* TEXT */
155
155
  ),
@@ -216,7 +216,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
216
216
  }, {
217
217
  default: vue.withCtx(() => [
218
218
  vue.createTextVNode(
219
- vue.toDisplayString(__props.cancelText || vue.unref(t)("confirmDialog.cancel")),
219
+ vue.toDisplayString(__props.cancelText || vue.unref(t)("dialog.cancel")),
220
220
  1
221
221
  /* TEXT */
222
222
  )
@@ -232,7 +232,7 @@ const _sfc_main = /* @__PURE__ */ Object.assign(__default__, {
232
232
  }, {
233
233
  default: vue.withCtx(() => [
234
234
  vue.createTextVNode(
235
- vue.toDisplayString(__props.submitText || vue.unref(t)("confirmDialog.confirm")),
235
+ vue.toDisplayString(__props.submitText || vue.unref(t)("dialog.confirm")),
236
236
  1
237
237
  /* TEXT */
238
238
  )