wlwy-package 3.2.2 → 3.2.3
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/editor/index.es.js +1 -1
- package/dist/{editor-core-D9MSA0yc.js → editor-core-DizrH1p6.js} +2 -2
- package/dist/{index-DbAXWdHe.js → index-DVGXAKlY.js} +1 -1
- package/dist/{index-D4mQXwMj.js → index-KquGST1J.js} +22 -5
- package/dist/types/packages/components/form/default/type.d.ts +1 -1
- package/dist/types/packages/components/table/warnDeprecated.d.ts +2 -0
- package/dist/types/packages/hooks/private/src/useRenderCell.d.ts +6 -4
- package/dist/types/packages/utils/formatCellValue.d.ts +5 -1
- package/dist/wlwy-package.es.js +51 -21
- package/package.json +1 -1
package/dist/editor/index.es.js
CHANGED
|
@@ -2,8 +2,8 @@ import { defineComponent, createElementBlock, openBlock, ref, shallowRef, onMoun
|
|
|
2
2
|
import "xe-utils";
|
|
3
3
|
import { theme, message } from "ant-design-vue";
|
|
4
4
|
import "vue-router";
|
|
5
|
-
import { u as useI18n, b as useLocale, A as API } from "./index-
|
|
6
|
-
import { _ as _export_sfc$1 } from "./index-
|
|
5
|
+
import { u as useI18n, b as useLocale, A as API } from "./index-KquGST1J.js";
|
|
6
|
+
import { _ as _export_sfc$1 } from "./index-DVGXAKlY.js";
|
|
7
7
|
var e = "undefined" != typeof globalThis ? globalThis : "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {};
|
|
8
8
|
function t(e10) {
|
|
9
9
|
return e10 && e10.__esModule && Object.prototype.hasOwnProperty.call(e10, "default") ? e10.default : e10;
|
|
@@ -22,7 +22,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
22
22
|
}),
|
|
23
23
|
emits: /* @__PURE__ */ mergeModels(["change", "focus", "blur"], ["update:html", "update:text"]),
|
|
24
24
|
setup(__props, { expose: __expose, emit: __emit }) {
|
|
25
|
-
const EditorCore = defineAsyncComponent(() => import("./editor-core-
|
|
25
|
+
const EditorCore = defineAsyncComponent(() => import("./editor-core-DizrH1p6.js"));
|
|
26
26
|
const html = useModel(__props, "html");
|
|
27
27
|
const text = useModel(__props, "text");
|
|
28
28
|
const props = __props;
|
|
@@ -8472,14 +8472,23 @@ const DEFAULT_TEMPORAL_PATTERNS = {
|
|
|
8472
8472
|
datetime: DEFAULT_DATETIME_FORMAT
|
|
8473
8473
|
};
|
|
8474
8474
|
const INTL_MAX_FRACTION_DIGITS = 20;
|
|
8475
|
-
function resolvePlaceholder() {
|
|
8476
|
-
return DEFAULT_PLACEHOLDER;
|
|
8475
|
+
function resolvePlaceholder(emptyPlaceholder) {
|
|
8476
|
+
return emptyPlaceholder ?? DEFAULT_PLACEHOLDER;
|
|
8477
8477
|
}
|
|
8478
8478
|
function isEmptyCellValue(value) {
|
|
8479
8479
|
if (value === null || value === void 0) return true;
|
|
8480
8480
|
if (value === "") return true;
|
|
8481
8481
|
return false;
|
|
8482
8482
|
}
|
|
8483
|
+
function isEmptyTemporalValue(value) {
|
|
8484
|
+
if (isEmptyCellValue(value)) return true;
|
|
8485
|
+
if (value === 0 || value === "0") return true;
|
|
8486
|
+
if (typeof value === "string" && value.trim() === "") return true;
|
|
8487
|
+
return false;
|
|
8488
|
+
}
|
|
8489
|
+
function isTemporalFormatType(type) {
|
|
8490
|
+
return type === "date" || type === "time" || type === "datetime";
|
|
8491
|
+
}
|
|
8483
8492
|
function preserveRawCellValue(value) {
|
|
8484
8493
|
if (value === null || value === void 0) return "";
|
|
8485
8494
|
return String(value);
|
|
@@ -8549,6 +8558,7 @@ function resolveNumberPrecision(precision) {
|
|
|
8549
8558
|
};
|
|
8550
8559
|
}
|
|
8551
8560
|
function formatTemporalValue(value, temporalType, options) {
|
|
8561
|
+
if (isEmptyTemporalValue(value)) return "";
|
|
8552
8562
|
const d = coerceToValidDate(value, DEFAULT_DATE_MIN_YEAR, DEFAULT_DATE_MAX_YEAR);
|
|
8553
8563
|
if (!d) return preserveRawCellValue(value);
|
|
8554
8564
|
try {
|
|
@@ -8608,7 +8618,10 @@ function formatCellValueCore(value, options) {
|
|
|
8608
8618
|
const n = coerceFiniteNumber(value);
|
|
8609
8619
|
if (n === null) return preserveRawCellValue(value);
|
|
8610
8620
|
try {
|
|
8611
|
-
return new Intl.NumberFormat(void 0,
|
|
8621
|
+
return new Intl.NumberFormat(void 0, {
|
|
8622
|
+
...resolveNumberPrecision(options.precision),
|
|
8623
|
+
...options.useGrouping !== void 0 ? { useGrouping: options.useGrouping } : {}
|
|
8624
|
+
}).format(n);
|
|
8612
8625
|
} catch {
|
|
8613
8626
|
return preserveRawCellValue(value);
|
|
8614
8627
|
}
|
|
@@ -8655,9 +8668,13 @@ function formatCellValueCore(value, options) {
|
|
|
8655
8668
|
return preserveRawCellValue(value);
|
|
8656
8669
|
}
|
|
8657
8670
|
}
|
|
8658
|
-
function formatCellValue(value, options) {
|
|
8671
|
+
function formatCellValue(value, options, emptyPlaceholder = DEFAULT_PLACEHOLDER) {
|
|
8672
|
+
const placeholder = resolvePlaceholder(emptyPlaceholder);
|
|
8659
8673
|
if (isEmptyCellValue(value)) {
|
|
8660
|
-
return
|
|
8674
|
+
return placeholder;
|
|
8675
|
+
}
|
|
8676
|
+
if (isTemporalFormatType(options.type) && isEmptyTemporalValue(value)) {
|
|
8677
|
+
return placeholder;
|
|
8661
8678
|
}
|
|
8662
8679
|
return formatCellValueCore(value, options);
|
|
8663
8680
|
}
|
|
@@ -42,7 +42,7 @@ export type FormItemLabelTooltipProps = {
|
|
|
42
42
|
/**
|
|
43
43
|
* w-form-item 组件属性
|
|
44
44
|
*/
|
|
45
|
-
export interface WFormItemProps extends WFormColProps, Pick<FormItemProps, 'name' | 'labelCol' | 'wrapperCol'>, FormItemLabelTooltipProps {
|
|
45
|
+
export interface WFormItemProps extends WFormColProps, Pick<FormItemProps, 'name' | 'labelCol' | 'wrapperCol' | 'colon'>, FormItemLabelTooltipProps {
|
|
46
46
|
/**
|
|
47
47
|
* item Lable名称
|
|
48
48
|
*/
|
|
@@ -4,3 +4,5 @@ export declare function warnPropConflict(key: string, namespace: 'toolbar' | 'pa
|
|
|
4
4
|
export declare function warnShowToolbarConflict(): void;
|
|
5
5
|
/** toolbar slot 与显式关闭工具栏冲突时,以 slot 为准 */
|
|
6
6
|
export declare function warnToolbarSlotConflict(source: 'showToolbar' | 'toolbar.hideToolbar'): void;
|
|
7
|
+
/** 默认单元格渲染依赖 field 取值,缺失时仅开发环境报错,不阻塞运行 */
|
|
8
|
+
export declare function warnMissingFieldForDefaultCell(title?: string): void;
|
|
@@ -14,7 +14,7 @@ export type RenderCellFormatByType = {
|
|
|
14
14
|
type: 'datetime';
|
|
15
15
|
} & TemporalExtra) | ({
|
|
16
16
|
type: 'number';
|
|
17
|
-
} & Pick<FormatCellNumberOptions, 'precision'>) | ({
|
|
17
|
+
} & Pick<FormatCellNumberOptions, 'precision' | 'useGrouping'>) | ({
|
|
18
18
|
type: 'percent';
|
|
19
19
|
} & Pick<FormatCellPercentOptions, 'valueScale'>) | ({
|
|
20
20
|
type: 'boolean';
|
|
@@ -26,10 +26,10 @@ export type RenderCellFormatByType = {
|
|
|
26
26
|
}) | ({
|
|
27
27
|
type: 'i18n';
|
|
28
28
|
} & Pick<FormatCellI18nOptions, 'values'>)
|
|
29
|
-
/**
|
|
30
|
-
| {
|
|
29
|
+
/** 金额:等价于 `number` + 默认 `precision: 2` + 千分位;有 `precision` 时以传入为准 */
|
|
30
|
+
| ({
|
|
31
31
|
type: 'amount';
|
|
32
|
-
};
|
|
32
|
+
} & Pick<FormatCellNumberOptions, 'precision'>);
|
|
33
33
|
/** @deprecated 旧版平铺 props,由 {@link toFormatCellOptions} 自动映射 */
|
|
34
34
|
export type RenderCellLegacyProps = {
|
|
35
35
|
/** @deprecated 请改用 `format` */
|
|
@@ -51,6 +51,8 @@ export type RenderCellLegacyProps = {
|
|
|
51
51
|
export type RenderCellFormatType = NonNullable<RenderCellFormatByType['type']>;
|
|
52
52
|
export type RenderCellProps = {
|
|
53
53
|
field?: FieldPath;
|
|
54
|
+
/** 空值占位符,默认由 {@link formatCellValue} 处理为 `-` */
|
|
55
|
+
emptyPlaceholder?: string;
|
|
54
56
|
} & RenderCellFormatByType & Partial<RenderCellLegacyProps>;
|
|
55
57
|
export declare function resolveLegacyEnumMap(props: RenderCellProps, context: {
|
|
56
58
|
translate: (key: string) => string;
|
|
@@ -20,6 +20,8 @@ export interface FormatCellNumberOptions {
|
|
|
20
20
|
type: 'number';
|
|
21
21
|
/** 小数位数:0 为整数,1 为一位小数,以此类推 */
|
|
22
22
|
precision?: number;
|
|
23
|
+
/** 是否使用千分位分组;未传则跟随 `Intl.NumberFormat` 默认(通常为 true) */
|
|
24
|
+
useGrouping?: boolean;
|
|
23
25
|
}
|
|
24
26
|
export interface FormatCellPercentOptions {
|
|
25
27
|
type: 'percent';
|
|
@@ -78,5 +80,7 @@ export declare function formatCellValueCore(value: unknown, options: FormatCellO
|
|
|
78
80
|
/**
|
|
79
81
|
* 表格/描述列表等场景的单元格格式化:按 `options.type` 输出字符串;
|
|
80
82
|
* 无法识别为日期/数字等时 **原样字符串化**,不使用 `Invalid Date`。
|
|
83
|
+
*
|
|
84
|
+
* @param emptyPlaceholder 空值占位符,默认 `-`;日期/时间类型额外将 `0` / `'0'` 视为空
|
|
81
85
|
*/
|
|
82
|
-
export declare function formatCellValue(value: unknown, options: FormatCellOptions): string;
|
|
86
|
+
export declare function formatCellValue(value: unknown, options: FormatCellOptions, emptyPlaceholder?: string): string;
|
package/dist/wlwy-package.es.js
CHANGED
|
@@ -2,12 +2,12 @@ import { h, reactive, toRefs, markRaw, ref, computed, unref, nextTick, watch, on
|
|
|
2
2
|
import { App, message, theme, Tooltip, Switch, ConfigProvider, Spin, Button, Card, Row, DatePicker, Descriptions, Modal, Select, Statistic, Form, UploadDragger, Upload, Space, Col, FormItem, Input, InputPassword, InputNumber, Textarea, CheckboxGroup, Checkbox, RadioGroup, RangePicker, TimePicker, InputGroup, Image as Image$1, Dropdown, Menu, Progress, PageHeader, MenuItem, Tabs, TabPane, SubMenu, LayoutSider, LayoutFooter, Badge, Drawer, Alert, List, ListItem, LayoutHeader, Avatar, MenuDivider, Skeleton, Layout, LayoutContent } from "ant-design-vue";
|
|
3
3
|
import zhCn from "ant-design-vue/es/locale/zh_CN.js";
|
|
4
4
|
import enUs from "ant-design-vue/es/locale/en_US.js";
|
|
5
|
-
import { u as useI18n, a as useCommonStore, A as API, c as config, b as useLocale, d as useTabsNavStoreWithOut, e as useUserPermissionStoreWithOut, f as useDictStoreWithOut, _ as _sfc_main$19, g as useCommonStoreWithOut, h as useFormStorage, i as formatCellValue, k as kebabToCamel, j as useFormItemProps, p as pickMultiple, l as isExternalLink, n as newWin, m as useLanguageStoreWithOut, o as _sfc_main$1a, s as setConfig } from "./index-
|
|
6
|
-
import { D, E, r, t, C, z, x, y, B, q, v, w } from "./index-
|
|
5
|
+
import { u as useI18n, a as useCommonStore, A as API, c as config, b as useLocale, d as useTabsNavStoreWithOut, e as useUserPermissionStoreWithOut, f as useDictStoreWithOut, _ as _sfc_main$19, g as useCommonStoreWithOut, h as useFormStorage, i as formatCellValue, k as kebabToCamel, j as useFormItemProps, p as pickMultiple, l as isExternalLink, n as newWin, m as useLanguageStoreWithOut, o as _sfc_main$1a, s as setConfig } from "./index-KquGST1J.js";
|
|
6
|
+
import { D, E, r, t, C, z, x, y, B, q, v, w } from "./index-KquGST1J.js";
|
|
7
7
|
import { clone, debounce, omit, get, pick, merge, isEmpty, set } from "xe-utils";
|
|
8
8
|
import { RouterLink, useRouter } from "vue-router";
|
|
9
|
-
import { _ as _export_sfc } from "./index-
|
|
10
|
-
import { E as E2 } from "./index-
|
|
9
|
+
import { _ as _export_sfc } from "./index-DVGXAKlY.js";
|
|
10
|
+
import { E as E2 } from "./index-DVGXAKlY.js";
|
|
11
11
|
import { DownOutlined, UpOutlined } from "@ant-design/icons-vue";
|
|
12
12
|
import * as VxeUITable from "vxe-table";
|
|
13
13
|
import { VxeColumn, VxeUI, VxeToolbar, VxeTable } from "vxe-table";
|
|
@@ -2367,7 +2367,12 @@ function toFormatCellOptions(props, context) {
|
|
|
2367
2367
|
const legacy = props;
|
|
2368
2368
|
const temporalFormat = resolveTemporalFormat(props);
|
|
2369
2369
|
if (renderType === "amount") {
|
|
2370
|
-
|
|
2370
|
+
const p = props;
|
|
2371
|
+
return {
|
|
2372
|
+
type: "number",
|
|
2373
|
+
precision: p.precision ?? legacy.precision ?? 2,
|
|
2374
|
+
useGrouping: true
|
|
2375
|
+
};
|
|
2371
2376
|
}
|
|
2372
2377
|
if (renderType) {
|
|
2373
2378
|
switch (renderType) {
|
|
@@ -2387,7 +2392,11 @@ function toFormatCellOptions(props, context) {
|
|
|
2387
2392
|
}
|
|
2388
2393
|
case "number": {
|
|
2389
2394
|
const p = props;
|
|
2390
|
-
return {
|
|
2395
|
+
return {
|
|
2396
|
+
type: "number",
|
|
2397
|
+
precision: p.precision ?? legacy.precision,
|
|
2398
|
+
useGrouping: p.useGrouping
|
|
2399
|
+
};
|
|
2391
2400
|
}
|
|
2392
2401
|
case "percent": {
|
|
2393
2402
|
const p = props;
|
|
@@ -2464,7 +2473,7 @@ function useRenderCell(props) {
|
|
|
2464
2473
|
if (value === "" || value === null || value === void 0) return void 0;
|
|
2465
2474
|
return String(value);
|
|
2466
2475
|
}
|
|
2467
|
-
return formatCellValue(value, options);
|
|
2476
|
+
return formatCellValue(value, options, props.emptyPlaceholder);
|
|
2468
2477
|
}
|
|
2469
2478
|
return {
|
|
2470
2479
|
getRenderValue
|
|
@@ -2482,10 +2491,12 @@ const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
|
2482
2491
|
__name: "descriptions-item",
|
|
2483
2492
|
props: {
|
|
2484
2493
|
field: {},
|
|
2494
|
+
emptyPlaceholder: {},
|
|
2485
2495
|
type: {},
|
|
2486
2496
|
format: {},
|
|
2487
2497
|
timeZone: {},
|
|
2488
2498
|
precision: {},
|
|
2499
|
+
useGrouping: { type: Boolean },
|
|
2489
2500
|
valueScale: {},
|
|
2490
2501
|
trueText: {},
|
|
2491
2502
|
falseText: {},
|
|
@@ -3357,6 +3368,9 @@ const WTABLE_VXE_DEFAULT_CONFIG = {
|
|
|
3357
3368
|
pageSizes: [10, 20, 50, 100, 200, 500]
|
|
3358
3369
|
}
|
|
3359
3370
|
};
|
|
3371
|
+
function warnMissingFieldForDefaultCell(title) {
|
|
3372
|
+
return;
|
|
3373
|
+
}
|
|
3360
3374
|
function camelToKebab(key) {
|
|
3361
3375
|
return key.replace(/([A-Z])/g, "-$1").toLowerCase();
|
|
3362
3376
|
}
|
|
@@ -3981,9 +3995,11 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
3981
3995
|
},
|
|
3982
3996
|
__name: "column",
|
|
3983
3997
|
props: {
|
|
3998
|
+
emptyPlaceholder: {},
|
|
3984
3999
|
format: {},
|
|
3985
4000
|
timeZone: {},
|
|
3986
4001
|
precision: {},
|
|
4002
|
+
useGrouping: { type: Boolean },
|
|
3987
4003
|
valueScale: {},
|
|
3988
4004
|
trueText: {},
|
|
3989
4005
|
falseText: {},
|
|
@@ -4020,6 +4036,32 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
4020
4036
|
const props = __props;
|
|
4021
4037
|
const attrs = useAttrs();
|
|
4022
4038
|
const slots = useSlots();
|
|
4039
|
+
const DEFAULT_CELL_EDIT_RENDER_NAMES = [
|
|
4040
|
+
"input",
|
|
4041
|
+
"$input",
|
|
4042
|
+
"VxeInput",
|
|
4043
|
+
"textarea",
|
|
4044
|
+
"$textarea",
|
|
4045
|
+
"VxeTextarea"
|
|
4046
|
+
];
|
|
4047
|
+
function shouldUseDefaultCellRender(editRender) {
|
|
4048
|
+
if (!editRender) return true;
|
|
4049
|
+
const name = editRender.name;
|
|
4050
|
+
return !!name && DEFAULT_CELL_EDIT_RENDER_NAMES.includes(name);
|
|
4051
|
+
}
|
|
4052
|
+
const usesDefaultCellRender = computed(() => {
|
|
4053
|
+
return !slots.default && !["seq", "checkbox", "radio", "expand", "html"].includes(props.type ?? "") && !props.formatter && shouldUseDefaultCellRender(props.editRender);
|
|
4054
|
+
});
|
|
4055
|
+
watch(
|
|
4056
|
+
() => [usesDefaultCellRender.value, props.field],
|
|
4057
|
+
([need, field]) => {
|
|
4058
|
+
if (!need) return;
|
|
4059
|
+
if (field === void 0 || field === null || field === "") {
|
|
4060
|
+
warnMissingFieldForDefaultCell(props.title);
|
|
4061
|
+
}
|
|
4062
|
+
},
|
|
4063
|
+
{ immediate: true }
|
|
4064
|
+
);
|
|
4023
4065
|
const extraSlotNames = computed(() => Object.keys(slots).filter((name) => name !== "default"));
|
|
4024
4066
|
const columnShowOverflow = computed(() => {
|
|
4025
4067
|
const explicit = attrs.showOverflow ?? attrs["show-overflow"];
|
|
@@ -4111,19 +4153,6 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
4111
4153
|
}
|
|
4112
4154
|
return isNaN(width2) ? 100 : width2;
|
|
4113
4155
|
}
|
|
4114
|
-
const DEFAULT_CELL_EDIT_RENDER_NAMES = [
|
|
4115
|
-
"input",
|
|
4116
|
-
"$input",
|
|
4117
|
-
"VxeInput",
|
|
4118
|
-
"textarea",
|
|
4119
|
-
"$textarea",
|
|
4120
|
-
"VxeTextarea"
|
|
4121
|
-
];
|
|
4122
|
-
function shouldUseDefaultCellRender(editRender) {
|
|
4123
|
-
if (!editRender) return true;
|
|
4124
|
-
const name = editRender.name;
|
|
4125
|
-
return !!name && DEFAULT_CELL_EDIT_RENDER_NAMES.includes(name);
|
|
4126
|
-
}
|
|
4127
4156
|
const editRanderTypeExtend = ["VxeTextarea"];
|
|
4128
4157
|
const headerClassName = (params) => {
|
|
4129
4158
|
if (typeof props.headerClassName === "string") {
|
|
@@ -4195,7 +4224,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
4195
4224
|
}, 1536)) : renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({ key: 1 }, { ...data })))
|
|
4196
4225
|
]),
|
|
4197
4226
|
key: "1"
|
|
4198
|
-
} :
|
|
4227
|
+
} : usesDefaultCellRender.value ? {
|
|
4199
4228
|
name: "default",
|
|
4200
4229
|
fn: withCtx((data) => [
|
|
4201
4230
|
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({ ...data })), () => [
|
|
@@ -4416,6 +4445,7 @@ const _sfc_main$Q = /* @__PURE__ */ defineComponent({
|
|
|
4416
4445
|
name: {},
|
|
4417
4446
|
labelCol: {},
|
|
4418
4447
|
wrapperCol: {},
|
|
4448
|
+
colon: { type: Boolean },
|
|
4419
4449
|
labelTooltip: {},
|
|
4420
4450
|
labelTooltipIcon: { default: "QuestionCircleOutlined" }
|
|
4421
4451
|
},
|