@dazhicheng/ui 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/tt-api-component/index.js +4 -3
- package/dist/components/tt-api-component/index.vue2.js +4 -3
- package/dist/components/tt-area/TtArea.vue3.js +8 -7
- package/dist/components/tt-button/index.js +5 -4
- package/dist/components/tt-button/index.vue2.js +4 -3
- package/dist/components/tt-checkbox/index.js +4 -3
- package/dist/components/tt-checkbox/index.vue.js +4 -3
- package/dist/components/tt-drawer/index.js +4 -3
- package/dist/components/tt-drawer/src/RenderDrawer.vue.js +4 -3
- package/dist/components/tt-drawer/src/components/DrawerFooter.vue.js +8 -7
- package/dist/components/tt-drawer/src/components/DrawerHeader.vue2.js +3 -2
- package/dist/components/tt-drawer/src/props.js +3 -2
- package/dist/components/tt-drawer/src/utils/drawer-api.js +4 -2
- package/dist/components/tt-empty/index.js +9 -8
- package/dist/components/tt-form/index.js +10 -9
- package/dist/components/tt-form/src/components/ExpandableArrow.vue2.js +3 -2
- package/dist/components/tt-form/src/components/FormActions.vue2.js +4 -2
- package/dist/components/tt-form/src/form/FormDescription.vue.js +3 -2
- package/dist/components/tt-form/src/form/FormItem.vue.js +6 -5
- package/dist/components/tt-form/src/form/FormLabel.vue.js +8 -7
- package/dist/components/tt-form/src/form/RenderContent.vue.js +4 -3
- package/dist/components/tt-form/src/form-render/FormField.vue2.js +30 -28
- package/dist/components/tt-form/src/form-render/FormLabel.vue2.js +4 -2
- package/dist/components/tt-form/src/form-render/array-register/FormArrayRegister.js +1 -0
- package/dist/components/tt-form/src/form-render/array-register/utils.js +6 -4
- package/dist/components/tt-form/src/form-render/dependencies.js +19 -18
- package/dist/components/tt-form/src/form-render/form.vue2.js +4 -2
- package/dist/components/tt-form/src/form-render/helper.js +15 -14
- package/dist/components/tt-form/src/form-render/rootWrapperClass.js +3 -2
- package/dist/components/tt-form/src/formApi.js +3 -2
- package/dist/components/tt-form/src/group-form/GroupForm.vue2.js +4 -3
- package/dist/components/tt-form/src/group-form/GroupSection.vue2.js +2 -0
- package/dist/components/tt-form/src/group-form/LazyFormField.vue.js +4 -2
- package/dist/components/tt-form/src/group-form/groupFormApi.js +4 -3
- package/dist/components/tt-form/src/hooks/useForwardPriorityValues.js +3 -2
- package/dist/components/tt-form/src/hooks/useSelectCollapse.js +28 -27
- package/dist/components/tt-form/src/index.vue2.js +3 -2
- package/dist/components/tt-form/src/useFormContext.js +11 -10
- package/dist/components/tt-form-item-error-tooltip/index.js +5 -4
- package/dist/components/tt-form-item-error-tooltip/index.vue.js +4 -3
- package/dist/components/tt-icon/index.js +6 -5
- package/dist/components/tt-image/index.js +6 -5
- package/dist/components/tt-image/src/components/ImageViewer.js +7 -6
- package/dist/components/tt-loading/index.js +4 -3
- package/dist/components/tt-loading/src/directive.js +24 -23
- package/dist/components/tt-log/index.js +4 -3
- package/dist/components/tt-log/index.vue.js +3 -2
- package/dist/components/tt-modal/index.js +3 -2
- package/dist/components/tt-modal/src/RenderModal.vue.js +3 -2
- package/dist/components/tt-modal/src/components/ModalFooter.vue2.js +3 -2
- package/dist/components/tt-modal/src/components/ModalHeader.vue2.js +3 -2
- package/dist/components/tt-modal/src/components/ModalWrapper.vue.js +15 -14
- package/dist/components/tt-modal/src/props.js +3 -2
- package/dist/components/tt-modal/src/utils/modal-api.js +4 -2
- package/dist/components/tt-modal-form/index.vue.js +4 -3
- package/dist/components/tt-nav-anchor/index.js +4 -3
- package/dist/components/tt-nav-anchor/src/TtNavAnchor.vue.js +15 -14
- package/dist/components/tt-panel-select/index.js +4 -3
- package/dist/components/tt-panel-select/src/hooks/usePanelData.js +4 -3
- package/dist/components/tt-panel-select/src/index.vue.js +3 -2
- package/dist/components/tt-radio-group/index.js +4 -3
- package/dist/components/tt-radio-group/index.vue.js +7 -6
- package/dist/components/tt-select/index.js +4 -3
- package/dist/components/tt-select/src/Select.vue.d.ts +8 -8
- package/dist/components/tt-select/src/Select.vue.js +4 -3
- package/dist/components/tt-select/src/components/SelectTable.vue.d.ts +116 -7
- package/dist/components/tt-select/src/components/SelectTable.vue.js +3 -2
- package/dist/components/tt-select/src/components/Table.vue.d.ts +4 -4
- package/dist/components/tt-select/src/components/Table.vue.js +3 -2
- package/dist/components/tt-select/src/hooks/useDataSource.js +4 -3
- package/dist/components/tt-select/src/hooks/useKeyboard.d.ts +7 -1
- package/dist/components/tt-select/src/hooks/useSelect.js +3 -2
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.d.ts +1 -1
- package/dist/components/tt-select/src/hooks/useSelectTableEvent.js +28 -27
- package/dist/components/tt-select/src/props.d.ts +2 -2
- package/dist/components/tt-table/index.d.ts +6 -6
- package/dist/components/tt-table/index.js +1 -1
- package/dist/components/tt-table/src/Table.vue.d.ts +4 -4
- package/dist/components/tt-table/src/Table.vue.js +3 -2
- package/dist/components/tt-table/src/TableForm.vue.d.ts +6 -6
- package/dist/components/tt-table/src/TableForm.vue.js +2 -2
- package/dist/components/tt-table/src/components/TableAction.vue.js +19 -17
- package/dist/components/tt-table/src/components/TableButtons.js +10 -9
- package/dist/components/tt-table/src/components/TableColumnModal.vue2.js +4 -3
- package/dist/components/tt-table/src/components/TableToolbarTools.vue.js +18 -17
- package/dist/components/tt-table/src/emits.d.ts +10 -1
- package/dist/components/tt-table/src/hooks/useColumnPersistence.js +17 -16
- package/dist/components/tt-table/src/hooks/useColumns.js +4 -3
- package/dist/components/tt-table/src/hooks/useKeyboardNav.js +34 -33
- package/dist/components/tt-table/src/hooks/usePagination.js +12 -11
- package/dist/components/tt-table/src/hooks/useQuery.js +6 -5
- package/dist/components/tt-table/src/hooks/useRowIdentity.js +4 -3
- package/dist/components/tt-table/src/hooks/useRowSelection.d.ts +2 -6
- package/dist/components/tt-table/src/hooks/useRowSelection.js +28 -27
- package/dist/components/tt-table/src/hooks/useSideSlot.js +4 -3
- package/dist/components/tt-table/src/hooks/useSyncProps.js +4 -3
- package/dist/components/tt-table/src/hooks/useTableData.js +6 -5
- package/dist/components/tt-table/src/hooks/useTableFooter.js +9 -8
- package/dist/components/tt-table/src/hooks/useTableForm.js +4 -3
- package/dist/components/tt-table/src/hooks/useTableRender.d.ts +37 -4
- package/dist/components/tt-table/src/props.d.ts +12 -6
- package/dist/components/tt-table/src/props.js +14 -7
- package/dist/components/tt-table/src/table-mutation-events.js +10 -9
- package/dist/components/tt-table/src/types/table.d.ts +16 -0
- package/dist/components/tt-table/src/utils/action-tab-index.js +15 -14
- package/dist/components/tt-table/src/utils/context.js +5 -4
- package/dist/components/tt-table/src/utils/table-api.js +4 -2
- package/dist/components/tt-table/src/utils/table-form-api.js +22 -20
- package/dist/components/tt-text/index.js +4 -3
- package/dist/components/tt-upload/index.js +6 -5
- package/dist/components/tt-upload/src/TtUpload.vue.js +4 -3
- package/dist/directives/disabled-tip/index.js +9 -8
- package/dist/hooks/useFormSchemasLink.js +4 -3
- package/dist/hooks/useFormat.d.ts +35 -71
- package/dist/hooks/useFormat.js +28 -39
- package/dist/hooks/usePanelSelectSchemas.js +4 -3
- package/dist/hooks/useScreenshotOss.js +16 -15
- package/dist/packages/hooks/src/useDebounce.js +5 -4
- package/dist/packages/hooks/src/useElementScreenshot.js +4 -3
- package/dist/packages/hooks/src/usePriorityValue.js +5 -4
- package/dist/packages/utils/src/format.js +48 -0
- package/dist/plugins/default/renderCellContent.js +4 -3
- package/dist/plugins/vxeTable/switchStatus.js +14 -13
- package/package.json +3 -3
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var b = (
|
|
3
|
-
var
|
|
1
|
+
var h = Object.defineProperty;
|
|
2
|
+
var b = (r, t, e) => t in r ? h(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
|
|
3
|
+
var s = (r, t, e) => b(r, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import "axios";
|
|
5
5
|
import "element-plus";
|
|
6
6
|
import { isFunction as c } from "../../../../packages/utils/src/is.js";
|
|
7
7
|
import { reactive as i, computed as u, toValue as f } from "vue";
|
|
8
|
+
import "dayjs";
|
|
9
|
+
import "numeral";
|
|
8
10
|
import { bindMethods as d } from "../../../../packages/utils/src/tool.js";
|
|
9
11
|
import { mergeWithArrayOverride as a } from "../../../../packages/utils/src/merge.js";
|
|
10
12
|
import "../../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -16,37 +18,37 @@ import "../../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pa
|
|
|
16
18
|
import "lodash-es";
|
|
17
19
|
import { Store as A, useStore as S } from "@tanstack/vue-store";
|
|
18
20
|
import { getDefaultState as y, TableApi as j } from "./table-api.js";
|
|
19
|
-
function g(
|
|
20
|
-
if (!
|
|
21
|
+
function g(r) {
|
|
22
|
+
if (!r) return;
|
|
21
23
|
const t = {};
|
|
22
|
-
return Object.keys(
|
|
23
|
-
e !== "data" && Object.assign(t, { [e]:
|
|
24
|
+
return Object.keys(r).forEach((e) => {
|
|
25
|
+
e !== "data" && Object.assign(t, { [e]: r[e] });
|
|
24
26
|
}), t;
|
|
25
27
|
}
|
|
26
|
-
class
|
|
28
|
+
class q {
|
|
27
29
|
/**
|
|
28
30
|
* 构造函数,初始化 store、tableApi、状态等
|
|
29
31
|
* @param options 表单+表格配置项
|
|
30
32
|
*/
|
|
31
33
|
constructor(t = {}) {
|
|
32
34
|
/** form 表单实例(FormApi) */
|
|
33
|
-
|
|
35
|
+
s(this, "formApi", i({}));
|
|
34
36
|
/** 表格 API 实例(TableApi) */
|
|
35
|
-
|
|
37
|
+
s(this, "tableApi", i({}));
|
|
36
38
|
/** vxe-grid 表格实例 */
|
|
37
|
-
|
|
39
|
+
s(this, "grid", i({}));
|
|
38
40
|
/** 当前表单+表格的 props 状态 */
|
|
39
|
-
|
|
41
|
+
s(this, "state", null);
|
|
40
42
|
/** 表单操作方法集合(TableFormActionType) */
|
|
41
|
-
|
|
43
|
+
s(this, "tableForm", i({}));
|
|
42
44
|
/** 响应式 store,存储表单+表格的状态 */
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
s(this, "store");
|
|
46
|
+
s(this, "isMounted", !1);
|
|
47
|
+
s(this, "stateHandler");
|
|
46
48
|
/**
|
|
47
49
|
* 当前选中的行 key 数组(响应式)
|
|
48
50
|
*/
|
|
49
|
-
|
|
51
|
+
s(this, "selectedKeys", u(() => f(this.tableApi.selectedKeys) ?? []));
|
|
50
52
|
const e = { ...t }, o = g(t.table);
|
|
51
53
|
o && (e.table = o);
|
|
52
54
|
const p = y();
|
|
@@ -65,8 +67,8 @@ class V {
|
|
|
65
67
|
const n = new j({
|
|
66
68
|
...this.state.table,
|
|
67
69
|
useSearchForm: this.state.useSearchForm || !1
|
|
68
|
-
}),
|
|
69
|
-
|
|
70
|
+
}), m = n;
|
|
71
|
+
m.useStore = (l) => S(n.store, l), Object.setPrototypeOf(this.tableApi, m), d(this);
|
|
70
72
|
}
|
|
71
73
|
/**
|
|
72
74
|
* 组件挂载时调用,注入表单和表格实例
|
|
@@ -139,5 +141,5 @@ class V {
|
|
|
139
141
|
}
|
|
140
142
|
}
|
|
141
143
|
export {
|
|
142
|
-
|
|
144
|
+
q as TableFormApi
|
|
143
145
|
};
|
|
@@ -3,6 +3,7 @@ import "element-plus";
|
|
|
3
3
|
import "dayjs";
|
|
4
4
|
import "vue";
|
|
5
5
|
import { withInstall as t } from "../../packages/utils/src/install.js";
|
|
6
|
+
import "numeral";
|
|
6
7
|
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
@@ -13,8 +14,8 @@ import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb
|
|
|
13
14
|
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
15
|
import "lodash-es";
|
|
15
16
|
import o from "./index.vue.js";
|
|
16
|
-
const
|
|
17
|
+
const w = t(o);
|
|
17
18
|
export {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
w as TtText,
|
|
20
|
+
w as default
|
|
20
21
|
};
|
|
@@ -3,6 +3,7 @@ import "element-plus";
|
|
|
3
3
|
import "dayjs";
|
|
4
4
|
import "vue";
|
|
5
5
|
import { withInstall as o } from "../../packages/utils/src/install.js";
|
|
6
|
+
import "numeral";
|
|
6
7
|
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
@@ -13,10 +14,10 @@ import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb
|
|
|
13
14
|
import "../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
15
|
import "lodash-es";
|
|
15
16
|
import t from "./src/TtUpload.vue.js";
|
|
16
|
-
import { ttUploadProps as
|
|
17
|
-
const
|
|
17
|
+
import { ttUploadProps as P } from "./src/typing.js";
|
|
18
|
+
const u = o(t);
|
|
18
19
|
export {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
u as TtUpload,
|
|
21
|
+
u as default,
|
|
22
|
+
P as ttUploadProps
|
|
22
23
|
};
|
|
@@ -9,8 +9,9 @@ import { useDesign as ge } from "../../../packages/hooks/src/useDesign.js";
|
|
|
9
9
|
import "axios";
|
|
10
10
|
import { ElMessage as p, ElImageViewer as _e, ElUpload as he } from "element-plus";
|
|
11
11
|
import { isString as ye, isNumber as Ue } from "../../../packages/utils/src/is.js";
|
|
12
|
-
import "xe-utils";
|
|
13
12
|
import "dayjs";
|
|
13
|
+
import "numeral";
|
|
14
|
+
import "xe-utils";
|
|
14
15
|
import "dayjs/plugin/utc";
|
|
15
16
|
import "dayjs/plugin/timezone";
|
|
16
17
|
import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -25,7 +26,7 @@ import { TtText as V } from "../../tt-text/index.js";
|
|
|
25
26
|
import { ttUploadProps as $e } from "./typing.js";
|
|
26
27
|
import { GlobalConfig as F } from "../../../hooks/useSetup.js";
|
|
27
28
|
import { useModalRender as Se } from "../../tt-modal/src/hooks/useModalRender.js";
|
|
28
|
-
const
|
|
29
|
+
const Ze = /* @__PURE__ */ de({
|
|
29
30
|
name: "TtUpload",
|
|
30
31
|
__name: "TtUpload",
|
|
31
32
|
props: /* @__PURE__ */ z($e, {
|
|
@@ -314,5 +315,5 @@ const Qe = /* @__PURE__ */ de({
|
|
|
314
315
|
}
|
|
315
316
|
});
|
|
316
317
|
export {
|
|
317
|
-
|
|
318
|
+
Ze as default
|
|
318
319
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import "axios";
|
|
2
2
|
import { ElTooltip as b } from "element-plus";
|
|
3
3
|
import { isArray as l, isObject as m } from "../../packages/utils/src/is.js";
|
|
4
|
-
import { shallowRef as v, toValue as
|
|
5
|
-
import "xe-utils";
|
|
4
|
+
import { shallowRef as v, toValue as p, h as s, createVNode as g, render as h } from "vue";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -16,10 +17,10 @@ let n;
|
|
|
16
17
|
const d = v();
|
|
17
18
|
function V(e) {
|
|
18
19
|
if (l(e) && e.length > 0)
|
|
19
|
-
return e.filter((t) =>
|
|
20
|
+
return e.filter((t) => p(t.condition) ?? !0).map((t) => t.message);
|
|
20
21
|
if (m(e)) {
|
|
21
22
|
const t = e;
|
|
22
|
-
return !!
|
|
23
|
+
return !!p(t.condition) ? t.message : null;
|
|
23
24
|
}
|
|
24
25
|
return typeof e == "string" ? e : null;
|
|
25
26
|
}
|
|
@@ -27,7 +28,7 @@ function x(e) {
|
|
|
27
28
|
return l(e) && e.length > 0 ? e[0].placement || "bottom" : m(e) && e.placement || "bottom";
|
|
28
29
|
}
|
|
29
30
|
function y(e, t, o = "bottom") {
|
|
30
|
-
if (d.value = Array.isArray(t) ? t.map((r) =>
|
|
31
|
+
if (d.value = Array.isArray(t) ? t.map((r) => s("div", {}, r)) : t, n)
|
|
31
32
|
n.props.trigger = "hover", n.props.virtualRef = e, n.props.placement = o, n.exposed.updatePopper(), n.exposed.onOpen();
|
|
32
33
|
else {
|
|
33
34
|
const r = g(
|
|
@@ -44,7 +45,7 @@ function y(e, t, o = "bottom") {
|
|
|
44
45
|
popperClass: "!z-[9999]"
|
|
45
46
|
},
|
|
46
47
|
{
|
|
47
|
-
content: () =>
|
|
48
|
+
content: () => s(
|
|
48
49
|
"div",
|
|
49
50
|
{
|
|
50
51
|
style: {
|
|
@@ -75,7 +76,7 @@ async function a(e, t) {
|
|
|
75
76
|
const o = t.value, r = V(o), i = x(o);
|
|
76
77
|
e.boundingValue = e.boundingValue || { listened: !1, messages: r, placement: i }, e.boundingValue.messages = r, e.boundingValue.placement = i, !((u = e.boundingValue) != null && u.listened) && (r != null && r.length) && (e.addEventListener("mouseenter", c), e.addEventListener("mouseleave", f), e.boundingValue.listened = !0);
|
|
77
78
|
}
|
|
78
|
-
const
|
|
79
|
+
const q = {
|
|
79
80
|
created: a,
|
|
80
81
|
beforeMount: a,
|
|
81
82
|
updated: a,
|
|
@@ -85,5 +86,5 @@ const N = {
|
|
|
85
86
|
}
|
|
86
87
|
};
|
|
87
88
|
export {
|
|
88
|
-
|
|
89
|
+
q as default
|
|
89
90
|
};
|
|
@@ -3,8 +3,9 @@ import "axios";
|
|
|
3
3
|
import { ElSelectV2 as Z } from "element-plus";
|
|
4
4
|
import { isFunction as q } from "../packages/utils/src/is.js";
|
|
5
5
|
import "vue";
|
|
6
|
-
import "xe-utils";
|
|
7
6
|
import "dayjs";
|
|
7
|
+
import "numeral";
|
|
8
|
+
import "xe-utils";
|
|
8
9
|
import "dayjs/plugin/utc";
|
|
9
10
|
import "dayjs/plugin/timezone";
|
|
10
11
|
import "../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -286,7 +287,7 @@ function no(r = {}, u = z) {
|
|
|
286
287
|
dataSource: I
|
|
287
288
|
};
|
|
288
289
|
}
|
|
289
|
-
function
|
|
290
|
+
function So() {
|
|
290
291
|
const r = {
|
|
291
292
|
options: {},
|
|
292
293
|
codes: [...z]
|
|
@@ -337,5 +338,5 @@ function Po() {
|
|
|
337
338
|
return u;
|
|
338
339
|
}
|
|
339
340
|
export {
|
|
340
|
-
|
|
341
|
+
So as useFormSchemasLink
|
|
341
342
|
};
|
|
@@ -1,73 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
formatToDate:
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
formatAmount: (val: number | string, format?: string) => string;
|
|
37
|
-
/**
|
|
38
|
-
* 格式化金额为千分位并保留两位小数
|
|
39
|
-
* @param val - 要格式化的数值
|
|
40
|
-
* @param format - 格式化模板,默认为'0,0.00'
|
|
41
|
-
* @returns 格式化后的金额字符串
|
|
42
|
-
*/
|
|
43
|
-
formatAmountOfPlace: (val: number, format?: string) => string;
|
|
44
|
-
/**
|
|
45
|
-
* 将千分位格式的金额字符串转换为数值
|
|
46
|
-
* @param val - 要转换的金额字符串或数值
|
|
47
|
-
* @returns 转换后的数值
|
|
48
|
-
*/
|
|
49
|
-
formatPlaceOfAmount: (val: string | number) => number;
|
|
50
|
-
/**
|
|
51
|
-
* 格式化金额但不四舍五入
|
|
52
|
-
* @param str - 要格式化的金额字符串或数字
|
|
53
|
-
* @param index - 要保留的小数位数
|
|
54
|
-
* @returns 格式化后的金额字符串
|
|
55
|
-
*/
|
|
56
|
-
formatDecimal: (str: string | number, index: number) => string;
|
|
57
|
-
/**
|
|
58
|
-
* 格式化文件大小
|
|
59
|
-
* @param bytes - 文件大小(字节)
|
|
60
|
-
* @param decimalPoint - 保留的小数位数,默认为2
|
|
61
|
-
* @returns 格式化后的文件大小字符串(带单位)
|
|
62
|
-
*/
|
|
63
|
-
formatFileSize: (bytes: number, decimalPoint?: number) => string;
|
|
64
|
-
/**
|
|
65
|
-
* 格式化期间(年月)
|
|
66
|
-
* @param val - 要格式化的期间值,可以是数字或字符串
|
|
67
|
-
* @param formatType - 格式化类型,'period'表示期间,'month'表示月份
|
|
68
|
-
* @returns 格式化后的期间字符串
|
|
69
|
-
*/
|
|
70
|
-
formatPeriod: (val: number | string, formatType?: ILabelFormatType) => string;
|
|
1
|
+
import { formatAmount, formatAmountOfPlace, formatDecimal, formatFileSize, formatPeriod, formatPlaceOfAmount, formatToDate, formatToDateTime } from '../../../utils/src';
|
|
2
|
+
/**
|
|
3
|
+
* 生成表单验证规则
|
|
4
|
+
*
|
|
5
|
+
* 留在 ui 包:它产出的是 element-plus 表单的校验规则,不属于数据格式化。
|
|
6
|
+
* @param message 验证失败时的提示信息
|
|
7
|
+
* @param trigger 触发验证的时机,默认 `change`
|
|
8
|
+
* @returns 校验规则数组
|
|
9
|
+
*/
|
|
10
|
+
declare function formatFormRole(message: string, trigger?: string): {
|
|
11
|
+
required: boolean;
|
|
12
|
+
message: string;
|
|
13
|
+
trigger: string;
|
|
14
|
+
}[];
|
|
15
|
+
/**
|
|
16
|
+
* 格式化方法集合。
|
|
17
|
+
*
|
|
18
|
+
* 除 `formatFormRole` 外的实现都在 `@dazhicheng/utils` 的 `format` 模块,这里只做转发,
|
|
19
|
+
* 保证 hook 与直接 `import { formatAmount } from "@dazhicheng/utils"` 拿到的是同一份实现。
|
|
20
|
+
* 返回类型交给推断,避免 hook 侧与 utils 侧维护两套签名。
|
|
21
|
+
* @returns 格式化方法集合
|
|
22
|
+
* @example
|
|
23
|
+
* const { formatAmount, formatToDate } = useFormat();
|
|
24
|
+
* formatAmount(1234.5); // "1,234.50"
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFormat(): {
|
|
27
|
+
formatFormRole: typeof formatFormRole;
|
|
28
|
+
formatToDateTime: typeof formatToDateTime;
|
|
29
|
+
formatToDate: typeof formatToDate;
|
|
30
|
+
formatAmount: typeof formatAmount;
|
|
31
|
+
formatAmountOfPlace: typeof formatAmountOfPlace;
|
|
32
|
+
formatPlaceOfAmount: typeof formatPlaceOfAmount;
|
|
33
|
+
formatDecimal: typeof formatDecimal;
|
|
34
|
+
formatFileSize: typeof formatFileSize;
|
|
35
|
+
formatPeriod: typeof formatPeriod;
|
|
71
36
|
};
|
|
72
|
-
export declare function useFormat(): FormatReturnType;
|
|
73
37
|
export {};
|
package/dist/hooks/useFormat.js
CHANGED
|
@@ -1,44 +1,33 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import "axios";
|
|
2
|
+
import "element-plus";
|
|
3
|
+
import "dayjs";
|
|
4
|
+
import "vue";
|
|
5
|
+
import { formatPeriod as t, formatFileSize as m, formatDecimal as i, formatPlaceOfAmount as e, formatAmountOfPlace as a, formatAmount as p, formatToDate as f, formatToDateTime as n } from "../packages/utils/src/format.js";
|
|
6
|
+
import "xe-utils";
|
|
7
|
+
import "dayjs/plugin/utc";
|
|
8
|
+
import "dayjs/plugin/timezone";
|
|
9
|
+
import "../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
10
|
+
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
11
|
+
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
12
|
+
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
13
|
+
import "../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
14
|
+
import "lodash-es";
|
|
15
|
+
function u(o, r = "change") {
|
|
16
|
+
return [{ required: !0, message: o, trigger: r }];
|
|
17
|
+
}
|
|
18
|
+
function z() {
|
|
5
19
|
return {
|
|
6
|
-
formatFormRole:
|
|
7
|
-
formatToDateTime:
|
|
8
|
-
formatToDate:
|
|
9
|
-
formatAmount:
|
|
10
|
-
formatAmountOfPlace:
|
|
11
|
-
formatPlaceOfAmount:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
return 0;
|
|
17
|
-
},
|
|
18
|
-
formatDecimal: (t, r) => {
|
|
19
|
-
let o = Number.parseFloat(t.toString());
|
|
20
|
-
if (Number.isNaN(o)) return "";
|
|
21
|
-
o = Math.round(o * 10 ** r) / 10 ** r;
|
|
22
|
-
let e = o.toString(), n = e.indexOf(".");
|
|
23
|
-
for (n < 0 && (n = e.length, e += "."); e.length <= n + r; ) e += "0";
|
|
24
|
-
return e;
|
|
25
|
-
},
|
|
26
|
-
formatFileSize: (t, r = 2) => {
|
|
27
|
-
if (t === 0) return "0 Bytes";
|
|
28
|
-
const o = 1e3, e = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], n = Math.floor(Math.log(t) / Math.log(o));
|
|
29
|
-
return `${Number.parseFloat((t / o ** n).toFixed(r))} ${e[n]}`;
|
|
30
|
-
},
|
|
31
|
-
formatPeriod: (t, r = "period") => {
|
|
32
|
-
if (!t) return "";
|
|
33
|
-
typeof t == "number" && (t = t.toString()), typeof t == "string" && (t = t.replace(/[-.]/g, ""));
|
|
34
|
-
const o = t.slice(0, 4), e = t.slice(4, 6), n = {
|
|
35
|
-
period: "期",
|
|
36
|
-
month: "月"
|
|
37
|
-
};
|
|
38
|
-
return r === "period" ? `${o}年${e}${n[r]}` : ` ${e}/${o}`;
|
|
39
|
-
}
|
|
20
|
+
formatFormRole: u,
|
|
21
|
+
formatToDateTime: n,
|
|
22
|
+
formatToDate: f,
|
|
23
|
+
formatAmount: p,
|
|
24
|
+
formatAmountOfPlace: a,
|
|
25
|
+
formatPlaceOfAmount: e,
|
|
26
|
+
formatDecimal: i,
|
|
27
|
+
formatFileSize: m,
|
|
28
|
+
formatPeriod: t
|
|
40
29
|
};
|
|
41
30
|
}
|
|
42
31
|
export {
|
|
43
|
-
|
|
32
|
+
z as useFormat
|
|
44
33
|
};
|
|
@@ -2,8 +2,9 @@ import "axios";
|
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import { isFunction as f } from "../packages/utils/src/is.js";
|
|
4
4
|
import "vue";
|
|
5
|
-
import "xe-utils";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -70,7 +71,7 @@ function v(t, n) {
|
|
|
70
71
|
const r = (s = t.value) == null ? void 0 : s[n];
|
|
71
72
|
return Array.isArray(r) ? r : [];
|
|
72
73
|
}
|
|
73
|
-
function
|
|
74
|
+
function De(t, n = {}) {
|
|
74
75
|
const r = [...new Set(t.map((e) => e.code))], s = t.reduce(
|
|
75
76
|
(e, c) => (e[c.code] = (e[c.code] || 0) + 1, e),
|
|
76
77
|
{}
|
|
@@ -216,5 +217,5 @@ function Be(t, n = {}) {
|
|
|
216
217
|
};
|
|
217
218
|
}
|
|
218
219
|
export {
|
|
219
|
-
|
|
220
|
+
De as usePanelSelectSchemas
|
|
220
221
|
};
|
|
@@ -3,6 +3,7 @@ import "axios";
|
|
|
3
3
|
import "element-plus";
|
|
4
4
|
import "dayjs";
|
|
5
5
|
import "vue";
|
|
6
|
+
import "numeral";
|
|
6
7
|
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
@@ -24,17 +25,17 @@ function h(r, e) {
|
|
|
24
25
|
}
|
|
25
26
|
function d(r) {
|
|
26
27
|
return new Promise((e, s) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
28
|
+
const o = new FileReader();
|
|
29
|
+
o.onload = () => e(o.result), o.onerror = () => s(o.error ?? new Error("Blob 转 DataURL 失败")), o.readAsDataURL(r);
|
|
29
30
|
});
|
|
30
31
|
}
|
|
31
32
|
async function x(r, e, s) {
|
|
32
|
-
const
|
|
33
|
-
t.append("key",
|
|
33
|
+
const n = `${s || e.dir || "notice"}/${Date.now()}_${r.name}`, t = new FormData();
|
|
34
|
+
t.append("key", n), t.append("policy", e.policy), t.append("x-oss-signature-version", e.version), t.append("x-oss-signature", e.signature), t.append("x-oss-credential", e.x_oss_credential), t.append("x-oss-date", e.x_oss_date), t.append("x-oss-security-token", e.security_token), e.callback && t.append("callback", e.callback), t.append("success_action_status", "200"), t.append("file", r);
|
|
34
35
|
const a = await fetch(e.host, { method: "POST", body: t });
|
|
35
36
|
if (!a.ok && a.status !== 203)
|
|
36
37
|
throw new Error(`OSS 上传失败: ${a.status}`);
|
|
37
|
-
return
|
|
38
|
+
return n;
|
|
38
39
|
}
|
|
39
40
|
function k(r) {
|
|
40
41
|
const e = r ?? g.uploadOssApi;
|
|
@@ -43,21 +44,21 @@ function k(r) {
|
|
|
43
44
|
return e;
|
|
44
45
|
}
|
|
45
46
|
async function p(r, e) {
|
|
46
|
-
const s = k(e == null ? void 0 : e.uploadOssApi),
|
|
47
|
+
const s = k(e == null ? void 0 : e.uploadOssApi), o = (e == null ? void 0 : e.format) ?? "png", n = (e == null ? void 0 : e.fileName) ?? O(o), t = h(r, n), a = await s(t), c = await x(t, a, e == null ? void 0 : e.ossDir);
|
|
47
48
|
return { blob: r, file: t, ossKey: c };
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function G() {
|
|
50
51
|
const r = y();
|
|
51
|
-
async function e(
|
|
52
|
-
const a = await r.captureToBlob(
|
|
52
|
+
async function e(n, t) {
|
|
53
|
+
const a = await r.captureToBlob(n, t);
|
|
53
54
|
return p(a, t);
|
|
54
55
|
}
|
|
55
|
-
async function s(
|
|
56
|
-
const a = await r.captureToBlob(
|
|
56
|
+
async function s(n, t) {
|
|
57
|
+
const a = await r.captureToBlob(n, t), [c, i] = await Promise.all([d(a), p(a, t)]);
|
|
57
58
|
return { ...i, dataUrl: c };
|
|
58
59
|
}
|
|
59
|
-
async function n
|
|
60
|
-
const { ossDir: a, fileName: c, uploadOssApi: i, output: m, ...f } = t, u = await r.captureComponent(
|
|
60
|
+
async function o(n, t) {
|
|
61
|
+
const { ossDir: a, fileName: c, uploadOssApi: i, output: m, ...f } = t, u = await r.captureComponent(n, {
|
|
61
62
|
...f,
|
|
62
63
|
output: "blob"
|
|
63
64
|
}), b = {
|
|
@@ -75,10 +76,10 @@ function L() {
|
|
|
75
76
|
return {
|
|
76
77
|
captureToBlob: e,
|
|
77
78
|
captureToDataUrl: s,
|
|
78
|
-
captureComponent:
|
|
79
|
+
captureComponent: o,
|
|
79
80
|
isCapturing: r.isCapturing
|
|
80
81
|
};
|
|
81
82
|
}
|
|
82
83
|
export {
|
|
83
|
-
|
|
84
|
+
G as useScreenshotOss
|
|
84
85
|
};
|
|
@@ -2,15 +2,16 @@ import "axios";
|
|
|
2
2
|
import "element-plus";
|
|
3
3
|
import "dayjs";
|
|
4
4
|
import { getCurrentScope as p, onScopeDispose as i } from "vue";
|
|
5
|
-
import
|
|
5
|
+
import "numeral";
|
|
6
|
+
import { debounce as m } from "../../utils/src/tool.js";
|
|
6
7
|
import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
7
8
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
8
9
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf8.js";
|
|
9
10
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.js";
|
|
10
11
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-pkcs7.js";
|
|
11
12
|
import "lodash-es";
|
|
12
|
-
function
|
|
13
|
-
const o =
|
|
13
|
+
function g(r, t, e) {
|
|
14
|
+
const o = m(r, t ?? 200, e);
|
|
14
15
|
return p() && i(o.cancel), {
|
|
15
16
|
/**
|
|
16
17
|
* 防抖函数,保持原函数的返回类型
|
|
@@ -28,5 +29,5 @@ function S(r, e, t) {
|
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
export {
|
|
31
|
-
|
|
32
|
+
g as useDebounceFn
|
|
32
33
|
};
|
|
@@ -2,8 +2,9 @@ import { ref as E, getCurrentInstance as O, render as w, nextTick as h, toValue
|
|
|
2
2
|
import "axios";
|
|
3
3
|
import "element-plus";
|
|
4
4
|
import { isNumber as P } from "../../utils/src/is.js";
|
|
5
|
-
import "xe-utils";
|
|
6
5
|
import "dayjs";
|
|
6
|
+
import "numeral";
|
|
7
|
+
import "xe-utils";
|
|
7
8
|
import "dayjs/plugin/utc";
|
|
8
9
|
import "dayjs/plugin/timezone";
|
|
9
10
|
import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
@@ -47,7 +48,7 @@ function _(e) {
|
|
|
47
48
|
function $(e, t) {
|
|
48
49
|
e.style.cssText = (t == null ? void 0 : t.containerStyle) ?? W, (!(t != null && t.containerStyle) || !/width\s*:/i.test(t.containerStyle)) && (e.style.width = _(t));
|
|
49
50
|
}
|
|
50
|
-
function
|
|
51
|
+
function ee() {
|
|
51
52
|
var y;
|
|
52
53
|
const e = E(!1), t = E(null), f = ((y = O()) == null ? void 0 : y.appContext) ?? null;
|
|
53
54
|
async function d(u, r) {
|
|
@@ -132,5 +133,5 @@ function p() {
|
|
|
132
133
|
};
|
|
133
134
|
}
|
|
134
135
|
export {
|
|
135
|
-
|
|
136
|
+
ee as useElementScreenshot
|
|
136
137
|
};
|
|
@@ -3,6 +3,7 @@ import "axios";
|
|
|
3
3
|
import "element-plus";
|
|
4
4
|
import "dayjs";
|
|
5
5
|
import { toValue as v, getCurrentInstance as d, useSlots as b, useAttrs as O, computed as P } from "vue";
|
|
6
|
+
import "numeral";
|
|
6
7
|
import { getFirstNonNullOrUndefined as V } from "../../utils/src/tool.js";
|
|
7
8
|
import "../../../node_modules/.pnpm/decimal.js@10.6.0/node_modules/decimal.js/decimal.js";
|
|
8
9
|
import "../../../node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.js";
|
|
@@ -26,20 +27,20 @@ function g(o, e, r) {
|
|
|
26
27
|
);
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
|
-
function
|
|
30
|
+
function q(o, e) {
|
|
30
31
|
const r = {};
|
|
31
32
|
return Object.keys(o).forEach((t) => {
|
|
32
33
|
r[t] = g(t, o, e);
|
|
33
34
|
}), r;
|
|
34
35
|
}
|
|
35
|
-
function
|
|
36
|
+
function w(o) {
|
|
36
37
|
const e = {};
|
|
37
38
|
for (const [r, t] of Object.entries(o))
|
|
38
39
|
e[r] = v(t);
|
|
39
40
|
return e;
|
|
40
41
|
}
|
|
41
42
|
export {
|
|
42
|
-
|
|
43
|
+
w as getPriorityValues,
|
|
43
44
|
g as usePriorityValue,
|
|
44
|
-
|
|
45
|
+
q as usePriorityValues
|
|
45
46
|
};
|