@yh-ui/components 1.0.24 → 1.0.26

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.
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { ref, computed, watch, onMounted } from "vue";
3
3
  import dayjs from "../../dayjs";
4
- import isoWeekPluginModule from "dayjs/plugin/isoWeek.js";
4
+ import { isoWeekPlugin } from "../../dayjs-plugins";
5
5
  import { useNamespace, useLocale } from "@yh-ui/hooks";
6
6
  import { useComponentTheme } from "@yh-ui/theme";
7
7
  import {
@@ -10,7 +10,7 @@ import {
10
10
  DEFAULT_CHINA_HOLIDAYS_2026
11
11
  } from "./calendar";
12
12
  import { YhButton } from "../../button";
13
- dayjs.extend(isoWeekPluginModule);
13
+ dayjs.extend(isoWeekPlugin);
14
14
  defineOptions({
15
15
  name: "YhCalendar"
16
16
  });
@@ -5,19 +5,14 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.parseDate = exports.generateCalendar = exports.formatDate = exports.DEFAULT_FORMATS = void 0;
7
7
  var _dayjs = _interopRequireDefault(require("../../dayjs.cjs"));
8
- var _isBetween = _interopRequireDefault(require("dayjs/plugin/isBetween.js"));
9
- var _weekOfYear = _interopRequireDefault(require("dayjs/plugin/weekOfYear.js"));
10
- var _isoWeek = _interopRequireDefault(require("dayjs/plugin/isoWeek.js"));
11
- var _quarterOfYear = _interopRequireDefault(require("dayjs/plugin/quarterOfYear.js"));
12
- var _advancedFormat = _interopRequireDefault(require("dayjs/plugin/advancedFormat.js"));
13
- var _customParseFormat = _interopRequireDefault(require("dayjs/plugin/customParseFormat.js"));
8
+ var _dayjsPlugins = require("../../dayjs-plugins.cjs");
14
9
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
- _dayjs.default.extend(_isBetween.default);
16
- _dayjs.default.extend(_weekOfYear.default);
17
- _dayjs.default.extend(_isoWeek.default);
18
- _dayjs.default.extend(_quarterOfYear.default);
19
- _dayjs.default.extend(_advancedFormat.default);
20
- _dayjs.default.extend(_customParseFormat.default);
10
+ _dayjs.default.extend(_dayjsPlugins.isBetweenPlugin);
11
+ _dayjs.default.extend(_dayjsPlugins.weekOfYearPlugin);
12
+ _dayjs.default.extend(_dayjsPlugins.isoWeekPlugin);
13
+ _dayjs.default.extend(_dayjsPlugins.quarterOfYearPlugin);
14
+ _dayjs.default.extend(_dayjsPlugins.advancedFormatPlugin);
15
+ _dayjs.default.extend(_dayjsPlugins.customParseFormatPlugin);
21
16
  const DEFAULT_FORMATS = exports.DEFAULT_FORMATS = {
22
17
  date: "YYYY-MM-DD",
23
18
  datetime: "YYYY-MM-DD HH:mm:ss",
@@ -1,16 +1,18 @@
1
1
  import dayjs from "../../dayjs.mjs";
2
- import isBetweenPluginModule from "dayjs/plugin/isBetween.js";
3
- import weekOfYearPluginModule from "dayjs/plugin/weekOfYear.js";
4
- import isoWeekPluginModule from "dayjs/plugin/isoWeek.js";
5
- import quarterOfYearPluginModule from "dayjs/plugin/quarterOfYear.js";
6
- import advancedFormatPluginModule from "dayjs/plugin/advancedFormat.js";
7
- import customParseFormatPluginModule from "dayjs/plugin/customParseFormat.js";
8
- dayjs.extend(isBetweenPluginModule);
9
- dayjs.extend(weekOfYearPluginModule);
10
- dayjs.extend(isoWeekPluginModule);
11
- dayjs.extend(quarterOfYearPluginModule);
12
- dayjs.extend(advancedFormatPluginModule);
13
- dayjs.extend(customParseFormatPluginModule);
2
+ import {
3
+ advancedFormatPlugin,
4
+ customParseFormatPlugin,
5
+ isBetweenPlugin,
6
+ isoWeekPlugin,
7
+ quarterOfYearPlugin,
8
+ weekOfYearPlugin
9
+ } from "../../dayjs-plugins.mjs";
10
+ dayjs.extend(isBetweenPlugin);
11
+ dayjs.extend(weekOfYearPlugin);
12
+ dayjs.extend(isoWeekPlugin);
13
+ dayjs.extend(quarterOfYearPlugin);
14
+ dayjs.extend(advancedFormatPlugin);
15
+ dayjs.extend(customParseFormatPlugin);
14
16
  export const DEFAULT_FORMATS = {
15
17
  date: "YYYY-MM-DD",
16
18
  datetime: "YYYY-MM-DD HH:mm:ss",
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.weekOfYearPlugin = exports.quarterOfYearPlugin = exports.isoWeekPlugin = exports.isBetweenPlugin = exports.customParseFormatPlugin = exports.advancedFormatPlugin = void 0;
7
+ var advancedFormatModule = _interopRequireWildcard(require("dayjs/plugin/advancedFormat.js"));
8
+ var customParseFormatModule = _interopRequireWildcard(require("dayjs/plugin/customParseFormat.js"));
9
+ var isBetweenModule = _interopRequireWildcard(require("dayjs/plugin/isBetween.js"));
10
+ var isoWeekModule = _interopRequireWildcard(require("dayjs/plugin/isoWeek.js"));
11
+ var quarterOfYearModule = _interopRequireWildcard(require("dayjs/plugin/quarterOfYear.js"));
12
+ var weekOfYearModule = _interopRequireWildcard(require("dayjs/plugin/weekOfYear.js"));
13
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
14
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15
+ function unwrapPlugin(module) {
16
+ return typeof module === "function" ? module : module.default;
17
+ }
18
+ const advancedFormatPlugin = exports.advancedFormatPlugin = unwrapPlugin(advancedFormatModule);
19
+ const customParseFormatPlugin = exports.customParseFormatPlugin = unwrapPlugin(customParseFormatModule);
20
+ const isBetweenPlugin = exports.isBetweenPlugin = unwrapPlugin(isBetweenModule);
21
+ const isoWeekPlugin = exports.isoWeekPlugin = unwrapPlugin(isoWeekModule);
22
+ const quarterOfYearPlugin = exports.quarterOfYearPlugin = unwrapPlugin(quarterOfYearModule);
23
+ const weekOfYearPlugin = exports.weekOfYearPlugin = unwrapPlugin(weekOfYearModule);
@@ -0,0 +1,7 @@
1
+ import type { PluginFunc } from 'dayjs';
2
+ export declare const advancedFormatPlugin: PluginFunc;
3
+ export declare const customParseFormatPlugin: PluginFunc;
4
+ export declare const isBetweenPlugin: PluginFunc;
5
+ export declare const isoWeekPlugin: PluginFunc;
6
+ export declare const quarterOfYearPlugin: PluginFunc;
7
+ export declare const weekOfYearPlugin: PluginFunc;
@@ -0,0 +1,15 @@
1
+ import * as advancedFormatModule from "dayjs/plugin/advancedFormat.js";
2
+ import * as customParseFormatModule from "dayjs/plugin/customParseFormat.js";
3
+ import * as isBetweenModule from "dayjs/plugin/isBetween.js";
4
+ import * as isoWeekModule from "dayjs/plugin/isoWeek.js";
5
+ import * as quarterOfYearModule from "dayjs/plugin/quarterOfYear.js";
6
+ import * as weekOfYearModule from "dayjs/plugin/weekOfYear.js";
7
+ function unwrapPlugin(module) {
8
+ return typeof module === "function" ? module : module.default;
9
+ }
10
+ export const advancedFormatPlugin = unwrapPlugin(advancedFormatModule);
11
+ export const customParseFormatPlugin = unwrapPlugin(customParseFormatModule);
12
+ export const isBetweenPlugin = unwrapPlugin(isBetweenModule);
13
+ export const isoWeekPlugin = unwrapPlugin(isoWeekModule);
14
+ export const quarterOfYearPlugin = unwrapPlugin(quarterOfYearModule);
15
+ export const weekOfYearPlugin = unwrapPlugin(weekOfYearModule);
package/dist/dayjs.cjs CHANGED
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
 
7
- var _dayjs = _interopRequireDefault(require("dayjs"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- module.exports = _dayjs.default;
7
+ var dayjsModule = _interopRequireWildcard(require("dayjs"));
8
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
9
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
10
+ const dayjs = "default" in dayjsModule ? dayjsModule.default : dayjsModule;
11
+ module.exports = dayjs;
package/dist/dayjs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import type dayjsType from 'dayjs';
2
- declare const _default: typeof dayjsType;
3
- export default _default;
2
+ declare const dayjs: typeof dayjsType;
3
+ export default dayjs;
4
4
  export type { Dayjs, PluginFunc } from 'dayjs';
package/dist/dayjs.mjs CHANGED
@@ -1,2 +1,3 @@
1
- import dayjs from "dayjs";
1
+ import * as dayjsModule from "dayjs";
2
+ const dayjs = "default" in dayjsModule ? dayjsModule.default : dayjsModule;
2
3
  export default dayjs;
@@ -529,7 +529,8 @@ html.dark {
529
529
  font-size: var(--yh-descriptions-item-font-size);
530
530
  padding: var(--yh-descriptions-padding);
531
531
  vertical-align: middle;
532
- word-break: break-all;
532
+ word-break: normal;
533
+ overflow-wrap: anywhere;
533
534
  border-radius: 0;
534
535
  }
535
536
 
@@ -516,7 +516,8 @@ html.dark {
516
516
  font-size: var(--yh-descriptions-item-font-size);
517
517
  padding: var(--yh-descriptions-padding);
518
518
  vertical-align: middle;
519
- word-break: break-all;
519
+ word-break: normal;
520
+ overflow-wrap: anywhere;
520
521
  border-radius: 0;
521
522
  }
522
523
 
@@ -666,7 +666,8 @@ html.dark {
666
666
  font-size: var(--yh-descriptions-item-font-size);
667
667
  padding: var(--yh-descriptions-padding);
668
668
  vertical-align: middle;
669
- word-break: break-all;
669
+ word-break: normal;
670
+ overflow-wrap: anywhere;
670
671
  border-radius: 0;
671
672
  }
672
673
 
@@ -1,17 +1,15 @@
1
1
  <script setup>
2
2
  import { ref, computed, watch } from "vue";
3
3
  import dayjs from "../../dayjs";
4
- import isBetweenPluginModule from "dayjs/plugin/isBetween.js";
5
- import isoWeekPluginModule from "dayjs/plugin/isoWeek.js";
6
- import quarterOfYearPluginModule from "dayjs/plugin/quarterOfYear.js";
4
+ import { isBetweenPlugin, isoWeekPlugin, quarterOfYearPlugin } from "../../dayjs-plugins";
7
5
  import { useNamespace, useLocale } from "@yh-ui/hooks";
8
6
  import { useComponentTheme } from "@yh-ui/theme";
9
7
  import { YhTooltip } from "../../tooltip";
10
8
  import { YhInput } from "../../input";
11
9
  import { YhRadioGroup, YhRadioButton } from "../../radio";
12
- dayjs.extend(isBetweenPluginModule);
13
- dayjs.extend(isoWeekPluginModule);
14
- dayjs.extend(quarterOfYearPluginModule);
10
+ dayjs.extend(isBetweenPlugin);
11
+ dayjs.extend(isoWeekPlugin);
12
+ dayjs.extend(quarterOfYearPlugin);
15
13
  defineOptions({ name: "YhGanttChart" });
16
14
  const props = defineProps({
17
15
  data: { type: Array, required: true, default: () => [] },
@@ -656,7 +656,8 @@ html.dark {
656
656
  display: flex;
657
657
  align-items: center;
658
658
  box-sizing: border-box;
659
- word-break: break-all;
659
+ word-break: normal;
660
+ overflow-wrap: anywhere;
660
661
  line-height: var(--yh-line-height-normal);
661
662
  }
662
663
  .yh-table__cell-content.is-ellipsis {
@@ -584,7 +584,8 @@ html.dark {
584
584
  display: flex;
585
585
  align-items: center;
586
586
  box-sizing: border-box;
587
- word-break: break-all;
587
+ word-break: normal;
588
+ overflow-wrap: anywhere;
588
589
  line-height: var(--yh-line-height-normal);
589
590
  }
590
591
  .yh-table__cell-content.is-ellipsis {
@@ -308,6 +308,32 @@ const tableStyle = computed(() => {
308
308
  }
309
309
  return style;
310
310
  });
311
+ const getFixedColumnWidth = (value) => {
312
+ if (value === void 0 || value === null || value === "") return 0;
313
+ if (typeof value === "number") return value;
314
+ const trimmed = value.trim();
315
+ if (!trimmed || trimmed.endsWith("%")) return 0;
316
+ const numeric = Number.parseFloat(trimmed);
317
+ return Number.isFinite(numeric) ? numeric : 0;
318
+ };
319
+ const getColumnMinWidth = (column) => {
320
+ const width = getFixedColumnWidth(column.width);
321
+ if (width > 0) return width;
322
+ const minWidth = getFixedColumnWidth(column.minWidth);
323
+ if (minWidth > 0) return minWidth;
324
+ return 80;
325
+ };
326
+ const tableContentMinWidth = computed(() => {
327
+ const specialColumnWidth = (selectionConfig.value ? getFixedColumnWidth(selectionConfig.value.columnWidth || 50) : 0) + (props.expandConfig ? getFixedColumnWidth(props.expandConfig.columnWidth || 50) : 0) + (props.showIndex ? getFixedColumnWidth(props.indexConfig?.width || 50) : 0);
328
+ const dataColumnWidth = visibleColumns.value.reduce((total, column) => {
329
+ return total + getColumnMinWidth(column);
330
+ }, 0);
331
+ return specialColumnWidth + dataColumnWidth;
332
+ });
333
+ const tableContentStyle = computed(() => ({
334
+ tableLayout: props.tableLayout,
335
+ minWidth: formatSize(tableContentMinWidth.value)
336
+ }));
311
337
  const bodyStyle = computed(() => {
312
338
  const style = {};
313
339
  if (props.height || props.maxHeight) {
@@ -317,6 +343,15 @@ const bodyStyle = computed(() => {
317
343
  }
318
344
  return style;
319
345
  });
346
+ const getColumnColStyle = (column) => {
347
+ const style = {};
348
+ if (column.width) {
349
+ style.width = formatSize(column.width);
350
+ } else if (column.minWidth) {
351
+ style.width = formatSize(column.minWidth);
352
+ }
353
+ return style;
354
+ };
320
355
  const summaryValues = computed(() => {
321
356
  if (!props.summaryConfig?.method) return [];
322
357
  return props.summaryConfig.method({
@@ -786,9 +821,7 @@ watch(selectedRowKeys, () => {
786
821
 
787
822
  <!-- 表头 -->
788
823
  <div v-if="showHeader" ref="headerRef" :class="ns.e('header-wrapper')">
789
- <table :class="ns.e('header')" :style="{
790
- tableLayout
791
- }">
824
+ <table :class="ns.e('header')" :style="tableContentStyle">
792
825
  <colgroup>
793
826
  <col
794
827
  v-if="selectionConfig"
@@ -808,9 +841,7 @@ watch(selectedRowKeys, () => {
808
841
  <col
809
842
  v-for="column in visibleColumns"
810
843
  :key="column.prop || column.key"
811
- :style="{
812
- width: formatSize(column.width)
813
- }"
844
+ :style="getColumnColStyle(column)"
814
845
  />
815
846
  </colgroup>
816
847
  <thead>
@@ -1113,7 +1144,7 @@ watch(selectedRowKeys, () => {
1113
1144
  v-else
1114
1145
  :class="[ns.e('body'), isVirtual ? ns.em('body', 'virtual') : '']"
1115
1146
  :style="{
1116
- tableLayout,
1147
+ ...tableContentStyle,
1117
1148
  ...(isVirtual ? {
1118
1149
  transform: `translate3d(0, ${offsetTop}px, 0)`
1119
1150
  } : {})
@@ -1138,9 +1169,7 @@ watch(selectedRowKeys, () => {
1138
1169
  <col
1139
1170
  v-for="column in visibleColumns"
1140
1171
  :key="column.prop || column.key"
1141
- :style="{
1142
- width: formatSize(column.width)
1143
- }"
1172
+ :style="getColumnColStyle(column)"
1144
1173
  />
1145
1174
  </colgroup>
1146
1175
  <tbody>
@@ -1301,9 +1330,7 @@ watch(selectedRowKeys, () => {
1301
1330
  <!-- 汇总行 -->
1302
1331
  <div v-if="summaryConfig" ref="footerRef" :class="ns.e('footer-wrapper')">
1303
1332
  <slot name="summary">
1304
- <table :class="ns.e('footer')" :style="{
1305
- tableLayout
1306
- }">
1333
+ <table :class="ns.e('footer')" :style="tableContentStyle">
1307
1334
  <colgroup>
1308
1335
  <col
1309
1336
  v-if="selectionConfig"
@@ -1323,9 +1350,7 @@ watch(selectedRowKeys, () => {
1323
1350
  <col
1324
1351
  v-for="column in visibleColumns"
1325
1352
  :key="column.prop || column.key"
1326
- :style="{
1327
- width: formatSize(column.width)
1328
- }"
1353
+ :style="getColumnColStyle(column)"
1329
1354
  />
1330
1355
  </colgroup>
1331
1356
  <tbody>
@@ -2022,7 +2047,8 @@ html.dark {
2022
2047
  display: flex;
2023
2048
  align-items: center;
2024
2049
  box-sizing: border-box;
2025
- word-break: break-all;
2050
+ word-break: normal;
2051
+ overflow-wrap: anywhere;
2026
2052
  line-height: var(--yh-line-height-normal);
2027
2053
  }
2028
2054
  .yh-table__cell-content.is-ellipsis {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yh-ui/components",
3
- "version": "1.0.24",
3
+ "version": "1.0.26",
4
4
  "description": "YH-UI Vue 3 Components",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -34,13 +34,22 @@
34
34
  "files": [
35
35
  "dist"
36
36
  ],
37
+ "scripts": {
38
+ "build": "unbuild && node ../../scripts/post-build-styles.mjs components && pnpm run build:dts && node ../../scripts/post-build-styles.mjs components",
39
+ "build:dts": "vue-tsc --emitDeclarationOnly --outDir dist --project tsconfig.json --rootDir ../../ && node ../../scripts/post-build-dts.mjs",
40
+ "dev": "unbuild --stub",
41
+ "prepack": "node ../../scripts/prepare-package-manifest.mjs prepare",
42
+ "postpack": "node ../../scripts/prepare-package-manifest.mjs restore",
43
+ "typecheck": "vue-tsc --noEmit",
44
+ "lint": "eslint ."
45
+ },
37
46
  "dependencies": {
38
47
  "@webcontainer/api": "^1.6.1",
39
48
  "@floating-ui/dom": "^1.7.4",
40
- "@yh-ui/hooks": "^1.0.24",
41
- "@yh-ui/locale": "^1.0.24",
42
- "@yh-ui/theme": "^1.0.24",
43
- "@yh-ui/utils": "^1.0.24",
49
+ "@yh-ui/hooks": "^1.0.26",
50
+ "@yh-ui/locale": "^1.0.26",
51
+ "@yh-ui/theme": "^1.0.26",
52
+ "@yh-ui/utils": "^1.0.26",
44
53
  "async-validator": "^4.2.5",
45
54
  "dayjs": "^1.11.19",
46
55
  "dompurify": "^3.3.3",
@@ -89,12 +98,5 @@
89
98
  "engines": {
90
99
  "node": ">=18.0.0",
91
100
  "pnpm": ">=9.0.0"
92
- },
93
- "scripts": {
94
- "build": "unbuild && node ../../scripts/post-build-styles.mjs components && pnpm run build:dts && node ../../scripts/post-build-styles.mjs components",
95
- "build:dts": "vue-tsc --emitDeclarationOnly --outDir dist --project tsconfig.json --rootDir ../../ && node ../../scripts/post-build-dts.mjs",
96
- "dev": "unbuild --stub",
97
- "typecheck": "vue-tsc --noEmit",
98
- "lint": "eslint ."
99
101
  }
100
- }
102
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 YH-UI Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.