@manohub/ui 1.2.4 → 1.2.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.
@@ -95,7 +95,7 @@ export declare const Select: import("vue").DefineComponent<import("vue").Extract
95
95
  type: BooleanConstructor;
96
96
  default: boolean;
97
97
  };
98
- /** 自定义过滤(缺省按 `label.includes(keyword)`) */
98
+ /** 自定义过滤(缺省按 `label` **忽略大小写**地包含关键词) */
99
99
  filterOption: {
100
100
  type: PropType<(option: SelectOption, keyword: string) => boolean>;
101
101
  default: undefined;
@@ -201,7 +201,7 @@ export declare const Select: import("vue").DefineComponent<import("vue").Extract
201
201
  type: BooleanConstructor;
202
202
  default: boolean;
203
203
  };
204
- /** 自定义过滤(缺省按 `label.includes(keyword)`) */
204
+ /** 自定义过滤(缺省按 `label` **忽略大小写**地包含关键词) */
205
205
  filterOption: {
206
206
  type: PropType<(option: SelectOption, keyword: string) => boolean>;
207
207
  default: undefined;
@@ -46,7 +46,7 @@ const Select = /* @__PURE__ */ defineComponent({
46
46
  type: Boolean,
47
47
  default: false
48
48
  },
49
- /** 自定义过滤(缺省按 `label.includes(keyword)`) */
49
+ /** 自定义过滤(缺省按 `label` **忽略大小写**地包含关键词) */
50
50
  filterOption: {
51
51
  type: Function,
52
52
  default: void 0
@@ -139,7 +139,7 @@ const Select = /* @__PURE__ */ defineComponent({
139
139
  return list;
140
140
  });
141
141
  const selectedOptions = computed(() => flatOptions.value.filter((option) => selectedValues.value.includes(option.value)));
142
- const matched = (option, kw) => props.filterOption ? props.filterOption(option, kw) : option.label.includes(kw);
142
+ const matched = (option, kw) => props.filterOption ? props.filterOption(option, kw) : option.label.toLowerCase().includes(kw.toLowerCase());
143
143
  const visibleOptions = computed(() => {
144
144
  const kw = keyword.value;
145
145
  if (!kw) return props.options;
@@ -29,7 +29,7 @@ export declare function findTreeNode(nodes: ListNode[], key: string, accessors:
29
29
  export interface TreeFilterOptions extends TreeAccessors {
30
30
  /** 关键词(调用方保证非空;空串走「不过滤」那条路,不进本函数) */
31
31
  keyword: string;
32
- /** 自定义命中判定(缺省:标签**区分大小写**地包含关键词 —— 与 `Select` 的缺省过滤同口径) */
32
+ /** 自定义命中判定(缺省:标签**忽略大小写**地包含关键词 —— 与 `Select` 的缺省过滤同口径) */
33
33
  match?: (node: ListNode, keyword: string) => boolean;
34
34
  }
35
35
  export interface TreeFilterResult {
@@ -56,6 +56,8 @@ export interface HitSegment {
56
56
  /**
57
57
  * 把标签文本按关键词切成「命中 / 未命中」交替的片段(**全部**出现位置都切,不只第一处)。
58
58
  *
59
+ * 命中判定与 `filterTreeNodes` 的缺省口径一致:**忽略大小写**(搜 `http` 要能高亮 `HTTP`)。
60
+ *
59
61
  * 关键词为空、或压根没命中时返回**一整段未命中**(消费方据此仍能渲染出原文,不必分情况)。
60
62
  */
61
63
  export declare function splitHighlight(text: string, keyword: string): HitSegment[];
@@ -13,7 +13,8 @@ function findTreeNode(nodes, key, accessors) {
13
13
  return void 0;
14
14
  }
15
15
  function filterTreeNodes(nodes, options) {
16
- const hit = (node) => options.match ? options.match(node, options.keyword) : treeLabel(node, options.labelKey).includes(options.keyword);
16
+ const keyword = options.keyword.toLowerCase();
17
+ const hit = (node) => options.match ? options.match(node, options.keyword) : treeLabel(node, options.labelKey).toLowerCase().includes(keyword);
17
18
  const keys = [];
18
19
  const collectKeys = (node) => {
19
20
  keys.push(treeNodeKey(node, options.rowKey));
@@ -41,14 +42,16 @@ function filterTreeNodes(nodes, options) {
41
42
  }
42
43
  function splitHighlight(text, keyword) {
43
44
  if (!keyword) return [{ text, hit: false }];
45
+ const haystack = text.toLowerCase();
46
+ const needle = keyword.toLowerCase();
44
47
  const segments = [];
45
48
  let cursor = 0;
46
49
  for (; ; ) {
47
- const at = text.indexOf(keyword, cursor);
50
+ const at = haystack.indexOf(needle, cursor);
48
51
  if (at < 0) break;
49
52
  if (at > cursor) segments.push({ text: text.slice(cursor, at), hit: false });
50
- segments.push({ text: text.slice(at, at + keyword.length), hit: true });
51
- cursor = at + keyword.length;
53
+ segments.push({ text: text.slice(at, at + needle.length), hit: true });
54
+ cursor = at + needle.length;
52
55
  }
53
56
  if (cursor < text.length) segments.push({ text: text.slice(cursor), hit: false });
54
57
  return segments.length ? segments : [{ text, hit: false }];
@@ -78,7 +78,7 @@ export declare const SelectTree: import("vue").DefineComponent<import("vue").Ext
78
78
  type: BooleanConstructor;
79
79
  default: boolean;
80
80
  };
81
- /** 自定义命中判定(缺省:标签区分大小写地包含关键词) */
81
+ /** 自定义命中判定(缺省:标签忽略大小写地包含关键词) */
82
82
  filterNode: {
83
83
  type: PropType<(node: ListNode, keyword: string) => boolean>;
84
84
  default: undefined;
@@ -217,7 +217,7 @@ export declare const SelectTree: import("vue").DefineComponent<import("vue").Ext
217
217
  type: BooleanConstructor;
218
218
  default: boolean;
219
219
  };
220
- /** 自定义命中判定(缺省:标签区分大小写地包含关键词) */
220
+ /** 自定义命中判定(缺省:标签忽略大小写地包含关键词) */
221
221
  filterNode: {
222
222
  type: PropType<(node: ListNode, keyword: string) => boolean>;
223
223
  default: undefined;
@@ -57,7 +57,7 @@ const SelectTree = /* @__PURE__ */ defineComponent({
57
57
  type: Boolean,
58
58
  default: false
59
59
  },
60
- /** 自定义命中判定(缺省:标签区分大小写地包含关键词) */
60
+ /** 自定义命中判定(缺省:标签忽略大小写地包含关键词) */
61
61
  filterNode: {
62
62
  type: Function,
63
63
  default: void 0
@@ -43,8 +43,8 @@ export interface TableColumn {
43
43
  sortable?: boolean;
44
44
  }
45
45
  export type TableSortOrder = 'asc' | 'desc' | null;
46
- /** 满高档取值:不传 / `false` = 高度由内容撑起;`true` / `'parent'` = 占满父级;`number` = 表体滚动上限(px) */
47
- export type TableFill = boolean | 'parent' | number;
46
+ /** 满高档取值:不传 / `false` = 高度由内容撑起;`true` = 占满父级;`number` = 表体滚动上限(px) */
47
+ export type TableFill = boolean | number;
48
48
  /** 行数据:至少能用 `rowKey` 取到稳定标识 */
49
49
  export type TableRow = Record<string, unknown>;
50
50
  /** 行级事件(`onRow` 的返回):给整行挂点击与类,省掉「每列都写一次 onClick」 */
@@ -169,7 +169,7 @@ export declare const Table: import("vue").DefineComponent<import("vue").ExtractP
169
169
  * 满高档(高度与滚动归属;详见 `docs/components/table.md` 的「满高与滚动」):
170
170
  *
171
171
  * - 不传 / `false` —— 高度由内容撑起(单表结构,与不带本 prop 时完全一致);
172
- * - `true` / `'parent'` —— 占满父级高度(`height: 100%`),**表体滚、表头固定在表体上方**,
172
+ * - `true` —— 占满父级高度(`height: 100%`),**表体滚、表头固定在表体上方**,
173
173
  * 外框与圆角归包裹层;父级需可确定高度(`auto` 父级下 `100%` 解析不出来);
174
174
  * - `number` —— 表体滚动上限 = 该像素值,**父级高度不确定时的显式兜底档**
175
175
  * (CSS 无法探测父级是否定高,故兜底只能由调用方声明)。
@@ -336,7 +336,7 @@ export declare const Table: import("vue").DefineComponent<import("vue").ExtractP
336
336
  * 满高档(高度与滚动归属;详见 `docs/components/table.md` 的「满高与滚动」):
337
337
  *
338
338
  * - 不传 / `false` —— 高度由内容撑起(单表结构,与不带本 prop 时完全一致);
339
- * - `true` / `'parent'` —— 占满父级高度(`height: 100%`),**表体滚、表头固定在表体上方**,
339
+ * - `true` —— 占满父级高度(`height: 100%`),**表体滚、表头固定在表体上方**,
340
340
  * 外框与圆角归包裹层;父级需可确定高度(`auto` 父级下 `100%` 解析不出来);
341
341
  * - `number` —— 表体滚动上限 = 该像素值,**父级高度不确定时的显式兜底档**
342
342
  * (CSS 无法探测父级是否定高,故兜底只能由调用方声明)。
@@ -80,7 +80,7 @@ const Table = /* @__PURE__ */ defineComponent({
80
80
  * 满高档(高度与滚动归属;详见 `docs/components/table.md` 的「满高与滚动」):
81
81
  *
82
82
  * - 不传 / `false` —— 高度由内容撑起(单表结构,与不带本 prop 时完全一致);
83
- * - `true` / `'parent'` —— 占满父级高度(`height: 100%`),**表体滚、表头固定在表体上方**,
83
+ * - `true` —— 占满父级高度(`height: 100%`),**表体滚、表头固定在表体上方**,
84
84
  * 外框与圆角归包裹层;父级需可确定高度(`auto` 父级下 `100%` 解析不出来);
85
85
  * - `number` —— 表体滚动上限 = 该像素值,**父级高度不确定时的显式兜底档**
86
86
  * (CSS 无法探测父级是否定高,故兜底只能由调用方声明)。
@@ -88,7 +88,7 @@ const Table = /* @__PURE__ */ defineComponent({
88
88
  * 满高档一律按 `table-layout: fixed` 渲染(表头与表体是两个表格盒,`auto` 各自算宽必然错列)。
89
89
  */
90
90
  fill: {
91
- type: [Boolean, String, Number],
91
+ type: [Boolean, Number],
92
92
  default: false
93
93
  },
94
94
  /**
@@ -382,7 +382,7 @@ const Table = /* @__PURE__ */ defineComponent({
382
382
  "style": cellTokens
383
383
  }, [colElements(), props.showHeader ? renderHead() : null, renderBody()])]), scrollbar.render()]), summaryBar, loadingOverlay]);
384
384
  }
385
- const wrapperStyle = props.fill === true || props.fill === "parent" ? [{
385
+ const wrapperStyle = props.fill === true ? [{
386
386
  height: "100%"
387
387
  }, attrs.style] : attrs.style;
388
388
  const scrollStyle = typeof props.fill === "number" ? {
@@ -12,6 +12,8 @@ export type TextSize = 'caption' | 'body' | 'heading' | 'title';
12
12
  export type TextTone = 'default' | 'muted' | 'subtle' | 'primary' | 'success' | 'warning' | 'error';
13
13
  /** 字重档(缺省**不设**,即继承上下文 —— 这样「在已加粗的区域里放一段普通文字」不必显式写 regular) */
14
14
  export type TextWeight = 'regular' | 'medium' | 'semibold';
15
+ /** 换行策略:`break` = 无空格长串也强制断行(`word-break: break-all`) */
16
+ export type TextWrap = 'normal' | 'break';
15
17
  /** 承载标签(只开放语义明确的这几个;`as` 决定语义,`size` 决定视觉,两者**有意解耦**) */
16
18
  export type TextTag = 'span' | 'p' | 'div' | 'label' | 'small' | 'strong' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
17
19
  export interface TextProps {
@@ -25,6 +27,13 @@ export interface TextProps {
25
27
  mono?: boolean;
26
28
  /** 截断:`true` 单行省略 / 数字 = 最多 N 行省略 */
27
29
  truncate?: boolean | number;
30
+ /**
31
+ * 换行策略。`'break'` = `word-break: break-all`(无空格的长串也强制断行)。
32
+ *
33
+ * 为什么需要它:编码 / 路径 / 哈希这类**没有空格**的串,缺省换行策略会把整行撑宽、
34
+ * 把容器顶出去;应用侧只能自己写 `word-break`(撞 L1-4)。
35
+ */
36
+ wrap?: TextWrap;
28
37
  /** 承载标签(缺省 `span`;语义标签如 `h2` / `p` / `label` 用它,视觉仍由 `size` 定) */
29
38
  as?: TextTag;
30
39
  }
@@ -72,6 +81,10 @@ export declare const Text: import("vue").DefineComponent<import("vue").ExtractPr
72
81
  type: PropType<boolean | number>;
73
82
  default: boolean;
74
83
  };
84
+ wrap: {
85
+ type: PropType<TextWrap>;
86
+ default: undefined;
87
+ };
75
88
  as: {
76
89
  type: PropType<TextTag>;
77
90
  default: string;
@@ -99,12 +112,17 @@ export declare const Text: import("vue").DefineComponent<import("vue").ExtractPr
99
112
  type: PropType<boolean | number>;
100
113
  default: boolean;
101
114
  };
115
+ wrap: {
116
+ type: PropType<TextWrap>;
117
+ default: undefined;
118
+ };
102
119
  as: {
103
120
  type: PropType<TextTag>;
104
121
  default: string;
105
122
  };
106
123
  }>> & Readonly<{}>, {
107
124
  size: TextSize;
125
+ wrap: TextWrap;
108
126
  weight: TextWeight;
109
127
  tone: TextTone;
110
128
  as: TextTag;
@@ -1,4 +1,5 @@
1
1
  import { defineComponent, h } from "vue";
2
+ const BLOCK_TAGS = /* @__PURE__ */ new Set(["p", "div", "h1", "h2", "h3", "h4", "h5", "h6"]);
2
3
  const Text = /* @__PURE__ */ defineComponent({
3
4
  name: "Text",
4
5
  inheritAttrs: false,
@@ -23,6 +24,10 @@ const Text = /* @__PURE__ */ defineComponent({
23
24
  type: [Boolean, Number],
24
25
  default: false
25
26
  },
27
+ wrap: {
28
+ type: String,
29
+ default: void 0
30
+ },
26
31
  as: {
27
32
  type: String,
28
33
  default: "span"
@@ -35,7 +40,7 @@ const Text = /* @__PURE__ */ defineComponent({
35
40
  }) {
36
41
  return () => {
37
42
  const lines = props.truncate === true ? 1 : typeof props.truncate === "number" && props.truncate >= 1 ? Math.floor(props.truncate) : 0;
38
- const classes = ["mh-text", `mh-text--${props.size}`, `mh-text--${props.tone}`, props.weight ? `mh-text--${props.weight}` : "", props.mono ? "mh-text--mono" : "", lines === 1 ? "mh-text--truncate" : "", lines > 1 ? "mh-text--clamp" : "", attrs.class].filter(Boolean).join(" ");
43
+ const classes = ["mh-text", `mh-text--${props.size}`, `mh-text--${props.tone}`, props.weight ? `mh-text--${props.weight}` : "", props.mono ? "mh-text--mono" : "", props.wrap ? `mh-text--wrap-${props.wrap}` : "", lines === 1 ? BLOCK_TAGS.has(props.as) ? "mh-text--truncate" : "mh-text--truncate-inline" : "", lines > 1 ? "mh-text--clamp" : "", attrs.class].filter(Boolean).join(" ");
39
44
  const style = {
40
45
  ...lines > 1 ? {
41
46
  "--mh-text-lines": String(lines)