erp-plus 1.0.132 → 1.0.134

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.
@@ -781,8 +781,8 @@ declare const __VLS_component: DefineComponent<globalThis.ExtractPropTypes<{
781
781
  showFooter: boolean;
782
782
  name: string;
783
783
  placeholder: string;
784
- teleported: boolean;
785
784
  id: string;
785
+ teleported: boolean;
786
786
  popperClass: string;
787
787
  placement: placementType;
788
788
  popperOptions: Record<string, any>;
@@ -396,16 +396,17 @@ declare const _default: DefineComponent<globalThis.ExtractPropTypes<{
396
396
  modelValue: string | number;
397
397
  name: string;
398
398
  placeholder: string;
399
+ id: string;
399
400
  teleported: boolean;
400
401
  filterMethod: (query: string) => void;
401
402
  showArrow: boolean;
402
- id: string;
403
403
  ariaLabel: string;
404
404
  persistent: boolean;
405
405
  effect: effectType;
406
406
  popperClass: string;
407
407
  offset: number;
408
408
  placement: placementType;
409
+ valueKey: string;
409
410
  validateEvent: boolean;
410
411
  suffixIcon: string | Record<string, any>;
411
412
  autocomplete: string;
@@ -422,7 +423,6 @@ declare const _default: DefineComponent<globalThis.ExtractPropTypes<{
422
423
  multipleLimit: number;
423
424
  defaultFirstOption: boolean;
424
425
  reserveKeyword: boolean;
425
- valueKey: string;
426
426
  collapseTags: boolean;
427
427
  collapseTagsTooltip: boolean;
428
428
  maxCollapseTags: number;
@@ -19,6 +19,14 @@ interface TableColumn extends Record<string, any> {
19
19
  isEdit?: boolean;
20
20
  showOverflowTooltip?: boolean;
21
21
  children?: TableColumn[];
22
+ /** 单元格值为数组时的连接符,默认 ',' */
23
+ arraySeparator?: string;
24
+ /** 对象数组取哪个字段作为显示文本 */
25
+ arrayValueKey?: string;
26
+ /** arrayValueKey 的别名,便于非数组场景复用 */
27
+ valueKey?: string;
28
+ /** 完全自定义数组显示:(原始值, 行数据, 列配置) => 显示文本 */
29
+ arrayFormatter?: (value: any, row: any, column: TableColumn) => string;
22
30
  }
23
31
  interface TableProps {
24
32
  loading?: boolean;
@@ -117,6 +125,8 @@ interface TableProps {
117
125
  emptyState?: boolean;
118
126
  teleported?: boolean;
119
127
  isSelection?: boolean;
128
+ /** 表格级默认数组连接符(列上的 arraySeparator 优先),不传则用 ',' */
129
+ arraySeparator?: string;
120
130
  }
121
131
  declare function __VLS_template(): {
122
132
  attrs: Partial<{}>;
@@ -4,7 +4,11 @@ type __VLS_Props = {
4
4
  emptyState: boolean;
5
5
  teleported: boolean;
6
6
  isSelection: boolean;
7
+ /** 表格级开关。实际生效值已经由 Table 解析到 column.showOverflowTooltip(列级优先),
8
+ * 模板统一读列上的值,这里保留只是为了向后兼容调用方传参。 */
7
9
  showOverflowTooltip: boolean;
10
+ /** 表格级默认数组连接符(列上的 arraySeparator 优先) */
11
+ arraySeparator?: string;
8
12
  getErrorMsg: (index: number, prop: string) => string | undefined;
9
13
  checkedState: (row: any) => string;
10
14
  checkedStateSingle: (row: any) => string;
@@ -0,0 +1,45 @@
1
+ /**
2
+ * yw-table 单元格取值 / 显示格式化。
3
+ *
4
+ * 背景:表格列配置里 prop 指向的字段,后端有时直接给数组(多选值、标签、部门列表…)。
5
+ * 改造前 TableColumn 直接把数组丢给 Vue 插值,靠 Array.prototype.toString 隐式逗号相连,
6
+ * 于是:对象元素渲染成 [object Object]、空数组渲染成空串(不走 '-' 兜底)、
7
+ * 含空元素时出现 'a,,b'。这里把「取值 → 格式化」收敛成纯函数,组件只负责调用。
8
+ */
9
+ /** 数组元素默认连接符 */
10
+ export declare const DEFAULT_ARRAY_SEPARATOR = ",";
11
+ /** 对象数组未指定 arrayValueKey 时,按顺序自动探测的显示字段 */
12
+ export declare const ARRAY_ITEM_KEY_CANDIDATES: string[];
13
+ export declare const isPlainObject: (val: unknown) => boolean;
14
+ /**
15
+ * 判空。放在这里是为了让「判空」和「显示」用同一套口径,
16
+ * 否则会出现「显示为空、却没走 emptyState 的 '-' 兜底」的错位。
17
+ */
18
+ export declare const isValueEmpty: (val: unknown) => boolean;
19
+ /**
20
+ * 取原始值。先用 hasOwnProperty 命中字面键名(兼容 'a.b' 这种本身就带点的字段名),
21
+ * 未命中再按 '.' 逐层下钻,保持原有层级取值行为不变。
22
+ */
23
+ export declare const getRawValue: (row: any, prop: string | undefined) => any;
24
+ /**
25
+ * 值 → 显示文本(数组递归展开后用 separator 连接)。
26
+ * - null / undefined → ''(过滤掉,避免 'a,,b' 这种空洞)
27
+ * - 嵌套数组 → 一维展开:[[1,2],[3]] → '1,2,3'
28
+ * - 对象元素 → 按 column.arrayValueKey(或 valueKey)取值;未配置则探测常见字段名;
29
+ * 都探测不到就退回 String(value)(与 Vue 原生插值一致),不静默丢数据
30
+ */
31
+ export declare const stringifyValue: (value: any, column: any, separator: string) => string;
32
+ /**
33
+ * 单元格最终显示值。
34
+ *
35
+ * 列级可配置项(都写在 columns 的元素上,全部可选):
36
+ * - arraySeparator:连接符,默认 ','
37
+ * - arrayValueKey:对象数组取哪个字段做显示文本
38
+ * - arrayFormatter:(rawValue, row, column) => string,完全自定义,返回什么就显示什么
39
+ *
40
+ * @param raw 已取到的原始值(用 getRawValue 取)
41
+ * @param column 列配置
42
+ * @param row 行数据(传给 arrayFormatter 用)
43
+ * @param fallbackSeparator 表格级默认连接符(列上的 arraySeparator 优先)
44
+ */
45
+ export declare const formatCellValue: (raw: any, column: any, row?: any, fallbackSeparator?: string) => any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "erp-plus",
3
- "version": "1.0.132",
3
+ "version": "1.0.134",
4
4
  "author": "zhangxl",
5
5
  "main": "dist/erp-plus.umd.js",
6
6
  "module": "dist/erp-plus.es.js",