@wfrog/vc-ui 1.14.0 → 1.14.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.
@@ -3,9 +3,43 @@ import { ElPagination } from 'element-plus/es';
3
3
  import 'element-plus/es/components/base/style/css';
4
4
  import 'element-plus/es/components/pagination/style/css';
5
5
  import { defineComponent, useCssVars, unref, computed, createElementBlock, openBlock, normalizeClass, createCommentVNode, createBlock, renderSlot, mergeProps } from 'vue';
6
- import { i as isNumber } from '../../chunk/nq3VKXVp.mjs';
6
+ import { i as isObjectLike, b as baseGetTag } from '../../chunk/Fo0dZYnz.mjs';
7
7
  import { _ as _export_sfc } from '../../chunk/pcqpp-6-.mjs';
8
8
 
9
+ /** `Object#toString` result references. */
10
+ var numberTag = '[object Number]';
11
+
12
+ /**
13
+ * Checks if `value` is classified as a `Number` primitive or object.
14
+ *
15
+ * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
16
+ * classified as numbers, use the `_.isFinite` method.
17
+ *
18
+ * @static
19
+ * @memberOf _
20
+ * @since 0.1.0
21
+ * @category Lang
22
+ * @param {*} value The value to check.
23
+ * @returns {boolean} Returns `true` if `value` is a number, else `false`.
24
+ * @example
25
+ *
26
+ * _.isNumber(3);
27
+ * // => true
28
+ *
29
+ * _.isNumber(Number.MIN_VALUE);
30
+ * // => true
31
+ *
32
+ * _.isNumber(Infinity);
33
+ * // => true
34
+ *
35
+ * _.isNumber('3');
36
+ * // => false
37
+ */
38
+ function isNumber(value) {
39
+ return typeof value == 'number' ||
40
+ (isObjectLike(value) && baseGetTag(value) == numberTag);
41
+ }
42
+
9
43
  const _hoisted_1 = { key: 0 };
10
44
  const _hoisted_2 = { key: 2 };
11
45
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -1,6 +1,6 @@
1
1
  import { w as withInstall } from '../../chunk/DZ5W9TaA.mjs';
2
- import { C as Component } from './thousand-separator.mjs';
2
+ import { _ as _sfc_main } from './thousand-separator.mjs';
3
3
 
4
- const VcThousandSeparator = withInstall(Component);
4
+ const VcThousandSeparator = withInstall(_sfc_main);
5
5
 
6
6
  export { VcThousandSeparator, VcThousandSeparator as default };
@@ -1,75 +1,73 @@
1
- import './index.css'
2
- import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, toDisplayString, unref } from 'vue';
3
- import { i as isNumber } from '../../chunk/nq3VKXVp.mjs';
4
- import { r as root } from '../../chunk/Fo0dZYnz.mjs';
5
- import { _ as _export_sfc } from '../../chunk/pcqpp-6-.mjs';
1
+ import { defineComponent, computed, createElementBlock, openBlock, toDisplayString, unref } from 'vue';
2
+ import '../../chunk/D9iEroQw.mjs';
6
3
 
7
- /* Built-in method references for those with the same name as other `lodash` methods. */
8
- var nativeIsFinite = root.isFinite;
9
-
10
- /**
11
- * Checks if `value` is a finite primitive number.
12
- *
13
- * **Note:** This method is based on
14
- * [`Number.isFinite`](https://mdn.io/Number/isFinite).
15
- *
16
- * @static
17
- * @memberOf _
18
- * @since 0.1.0
19
- * @category Lang
20
- * @param {*} value The value to check.
21
- * @returns {boolean} Returns `true` if `value` is a finite number, else `false`.
22
- * @example
23
- *
24
- * _.isFinite(3);
25
- * // => true
26
- *
27
- * _.isFinite(Number.MIN_VALUE);
28
- * // => true
29
- *
30
- * _.isFinite(Infinity);
31
- * // => false
32
- *
33
- * _.isFinite('3');
34
- * // => false
35
- */
36
- function isFinite(value) {
37
- return typeof value == 'number' && nativeIsFinite(value);
4
+ function thousandSeparator(value, options = {}) {
5
+ if (value === null || value === void 0 || value === "") {
6
+ return "";
7
+ }
8
+ const separator = options.separator ?? ",";
9
+ const decimalPlaces = options.decimalPlaces ?? 0;
10
+ if (typeof value === "string") {
11
+ const cleanStr = value.split(separator).join("").trim();
12
+ if (/^[+-]?(?:\d+(?:\.\d*)?|\.\d+)$/.test(cleanStr)) {
13
+ return formatNumericString(cleanStr, separator, decimalPlaces);
14
+ }
15
+ const num = Number.parseFloat(cleanStr);
16
+ if (Number.isNaN(num)) {
17
+ return value;
18
+ }
19
+ return formatNumber(num, separator, decimalPlaces);
20
+ }
21
+ return formatNumber(value, separator, decimalPlaces);
38
22
  }
39
-
40
- /**
41
- * Checks if `value` is `NaN`.
42
- *
43
- * **Note:** This method is based on
44
- * [`Number.isNaN`](https://mdn.io/Number/isNaN) and is not the same as
45
- * global [`isNaN`](https://mdn.io/isNaN) which returns `true` for
46
- * `undefined` and other non-number values.
47
- *
48
- * @static
49
- * @memberOf _
50
- * @since 0.1.0
51
- * @category Lang
52
- * @param {*} value The value to check.
53
- * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`.
54
- * @example
55
- *
56
- * _.isNaN(NaN);
57
- * // => true
58
- *
59
- * _.isNaN(new Number(NaN));
60
- * // => true
61
- *
62
- * isNaN(undefined);
63
- * // => true
64
- *
65
- * _.isNaN(undefined);
66
- * // => false
67
- */
68
- function isNaN(value) {
69
- // An `NaN` primitive is the only value that is not equal to itself.
70
- // Perform the `toStringTag` check first to avoid errors with some
71
- // ActiveX objects in IE.
72
- return isNumber(value) && value != +value;
23
+ function formatNumber(num, separator, decimalPlaces) {
24
+ if (!Number.isFinite(num))
25
+ return String(num);
26
+ const safeNum = Object.is(num, -0) ? 0 : num;
27
+ const formatter = new Intl.NumberFormat("en-US", buildOptions(safeNum, decimalPlaces));
28
+ return formatter.formatToParts(safeNum).map((part) => part.type === "group" ? separator : part.value).join("");
29
+ }
30
+ function buildOptions(num, decimalPlaces) {
31
+ if (decimalPlaces < 0) {
32
+ const decimalLength = (String(Math.abs(num)).split(".")[1] ?? "").length;
33
+ return {
34
+ useGrouping: true,
35
+ minimumFractionDigits: 0,
36
+ maximumFractionDigits: decimalLength
37
+ };
38
+ }
39
+ return {
40
+ useGrouping: true,
41
+ minimumFractionDigits: decimalPlaces,
42
+ maximumFractionDigits: decimalPlaces
43
+ };
44
+ }
45
+ function formatNumericString(cleanStr, separator, decimalPlaces) {
46
+ const negative = cleanStr.startsWith("-");
47
+ const s = negative || cleanStr.startsWith("+") ? cleanStr.slice(1) : cleanStr;
48
+ let [intPart = "0", decPart = ""] = s.split(".");
49
+ intPart = intPart.replace(/^0+(?=\d)/, "") || "0";
50
+ if (decimalPlaces >= 0) {
51
+ const keep = decimalPlaces;
52
+ const nextDigit = decPart[keep];
53
+ let kept = decPart.slice(0, keep);
54
+ if (nextDigit && nextDigit >= "5") {
55
+ const combined = BigInt(intPart + kept.padEnd(keep, "0")) + BigInt(1);
56
+ const str = combined.toString().padStart(intPart.length + keep, "0");
57
+ if (keep === 0) {
58
+ intPart = str;
59
+ kept = "";
60
+ } else {
61
+ intPart = str.slice(0, -keep);
62
+ kept = str.slice(-keep);
63
+ }
64
+ }
65
+ decPart = kept.padEnd(keep, "0");
66
+ }
67
+ const groupedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
68
+ const dec = decPart ? `.${decPart}` : "";
69
+ const isZero = intPart === "0" && !/[1-9]/.test(decPart);
70
+ return (negative && !isZero ? "-" : "") + groupedInt + dec;
73
71
  }
74
72
 
75
73
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -82,61 +80,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
82
80
  },
83
81
  setup(__props) {
84
82
  const props = __props;
85
- function formatNumber(num) {
86
- if (!isFinite(num))
87
- return String(num);
88
- const parts = num.toString().split(".");
89
- let integerPart = parts[0];
90
- const decimalPart = parts.length > 1 ? `.${parts[1]}` : "";
91
- const isNegative = integerPart.startsWith("-");
92
- if (isNegative) {
93
- integerPart = integerPart.slice(1);
94
- }
95
- const formattedInteger = integerPart.replace(/\B(?=(\d{3})+(?!\d))/g, props.separator);
96
- let finalDecimal = decimalPart;
97
- if (props.decimalPlaces === 0) {
98
- finalDecimal = "";
99
- } else if (props.decimalPlaces > 0) {
100
- finalDecimal = `.${num.toFixed(props.decimalPlaces).split(".")[1]}`;
101
- }
102
- return (isNegative ? "-" : "") + formattedInteger + finalDecimal;
103
- }
104
83
  const formattedValue = computed(() => {
105
84
  if (props.value === null || props.value === void 0 || props.value === "") {
106
85
  return props.placeholder;
107
86
  }
108
- let num;
109
- if (typeof props.value === "string") {
110
- const cleanStr = props.value.replace(new RegExp(`\\${props.separator}`, "g"), "");
111
- num = Number.parseFloat(cleanStr);
112
- } else {
113
- num = props.value;
114
- }
115
- if (isNaN(num)) {
116
- return String(props.value);
117
- }
118
- return formatNumber(num);
87
+ return thousandSeparator(props.value, {
88
+ separator: props.separator,
89
+ decimalPlaces: props.decimalPlaces
90
+ });
119
91
  });
120
92
  return (_ctx, _cache) => {
121
- return openBlock(), createElementBlock("span", {
122
- class: normalizeClass(_ctx.$style["thousand-separator"])
123
- }, toDisplayString(unref(formattedValue)), 3);
93
+ return openBlock(), createElementBlock("span", null, toDisplayString(unref(formattedValue)), 1);
124
94
  };
125
95
  }
126
96
  });
127
97
 
128
- /* unplugin-vue-components disabled */const style0 = {
129
- "thousand-separator": "_thousand-separator_1s3bf_2"
130
- };
131
-
132
- const cssModules = {
133
- "$style": style0
134
- };
135
- const Component = /* @__PURE__ */ _export_sfc(_sfc_main, [["__cssModules", cssModules]]);
136
-
137
- const __vite_glob_0_57 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
138
- __proto__: null,
139
- default: Component
140
- }, Symbol.toStringTag, { value: 'Module' }));
141
-
142
- export { Component as C, __vite_glob_0_57 as _ };
98
+ export { _sfc_main as _ };
package/dist/es/index.mjs CHANGED
@@ -103,8 +103,7 @@ import { _ as __vite_glob_0_55 } from './components/text-ellipsis/text-ellipsis.
103
103
  export { C as VcTextEllipsis } from './components/text-ellipsis/text-ellipsis.mjs';
104
104
  import { _ as __vite_glob_0_56 } from './components/thousand-input/thousand-input.mjs';
105
105
  export { C as VcThousandInput } from './components/thousand-input/thousand-input.mjs';
106
- import { _ as __vite_glob_0_57 } from './components/thousand-separator/thousand-separator.mjs';
107
- export { C as VcThousandSeparator } from './components/thousand-separator/thousand-separator.mjs';
106
+ import { _ as _sfc_main$9 } from './components/thousand-separator/thousand-separator.mjs';
108
107
  import { _ as __vite_glob_0_58 } from './components/tinymce/tinymce.mjs';
109
108
  export { C as VcTinymce } from './components/tinymce/tinymce.mjs';
110
109
  import { _ as __vite_glob_0_59 } from './components/transfer-panel/transfer-panel.mjs';
@@ -166,7 +165,12 @@ const __vite_glob_0_50 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePr
166
165
  default: _sfc_main$8
167
166
  }, Symbol.toStringTag, { value: 'Module' }));
168
167
 
169
- const version = "1.14.0";
168
+ const __vite_glob_0_57 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
169
+ __proto__: null,
170
+ default: _sfc_main$9
171
+ }, Symbol.toStringTag, { value: 'Module' }));
172
+
173
+ const version = "1.14.1";
170
174
 
171
175
  const modules = /* #__PURE__ */ Object.assign({"./components/awesome-icon/awesome-icon.vue": __vite_glob_0_0,"./components/backbottom/backbottom.vue": __vite_glob_0_1,"./components/button/button.vue": __vite_glob_0_2,"./components/chat-container/chat-container.vue": __vite_glob_0_3,"./components/choice-boolean/choice-boolean.vue": __vite_glob_0_4,"./components/choice/choice.vue": __vite_glob_0_5,"./components/color-switch/color-switch.vue": __vite_glob_0_6,"./components/config-provider/config-provider.vue": __vite_glob_0_7,"./components/cropper/cropper.vue": __vite_glob_0_8,"./components/currency/currency.vue": __vite_glob_0_9,"./components/dark-switch/dark-switch.vue": __vite_glob_0_10,"./components/daterange-picker/daterange-picker.vue": __vite_glob_0_11,"./components/dialog-camera-upload/dialog-camera-upload.vue": __vite_glob_0_12,"./components/dialog-map-point/dialog-map-point.vue": __vite_glob_0_13,"./components/dialog-upload-images/dialog-upload-images.vue": __vite_glob_0_14,"./components/dialog/dialog.vue": __vite_glob_0_15,"./components/drag-verify/drag-verify.vue": __vite_glob_0_16,"./components/drawer/drawer.vue": __vite_glob_0_17,"./components/easy-pagination/easy-pagination.vue": __vite_glob_0_18,"./components/el-icon/el-icon.vue": __vite_glob_0_19,"./components/explorer-column-table/explorer-column-table.vue": __vite_glob_0_20,"./components/explorer-container/explorer-container.vue": __vite_glob_0_21,"./components/explorer-filter/explorer-filter.vue": __vite_glob_0_22,"./components/explorer-footer/explorer-footer.vue": __vite_glob_0_23,"./components/explorer-form/explorer-form.vue": __vite_glob_0_24,"./components/explorer-list/explorer-list.vue": __vite_glob_0_25,"./components/explorer-modal-form/explorer-modal-form.vue": __vite_glob_0_26,"./components/explorer-panel/explorer-panel.vue": __vite_glob_0_27,"./components/explorer-query/explorer-query.vue": __vite_glob_0_28,"./components/explorer-table/explorer-table.vue": __vite_glob_0_29,"./components/explorer-tools/explorer-tools.vue": __vite_glob_0_30,"./components/explorer-tree/explorer-tree.vue": __vite_glob_0_31,"./components/explorer/explorer.vue": __vite_glob_0_32,"./components/flag/flag.vue": __vite_glob_0_33,"./components/form-item/form-item.vue": __vite_glob_0_34,"./components/gen-input/gen-input.vue": __vite_glob_0_35,"./components/icon-picker/icon-picker.vue": __vite_glob_0_36,"./components/icon/icon.vue": __vite_glob_0_37,"./components/iconify-icon/iconify-icon.vue": __vite_glob_0_38,"./components/image/image.vue": __vite_glob_0_39,"./components/info-tooltip/info-tooltip.vue": __vite_glob_0_40,"./components/input-number/input-number.vue": __vite_glob_0_41,"./components/input/input.vue": __vite_glob_0_42,"./components/pca-picker/pca-picker.vue": __vite_glob_0_43,"./components/qr-code/qr-code.vue": __vite_glob_0_44,"./components/screenfull/screenfull.vue": __vite_glob_0_45,"./components/scrollbar/scrollbar.vue": __vite_glob_0_46,"./components/select/select.vue": __vite_glob_0_47,"./components/single-player/single-player.vue": __vite_glob_0_48,"./components/splitter-panel/splitter-panel.vue": __vite_glob_0_49,"./components/splitter/splitter.vue": __vite_glob_0_50,"./components/svg-icon/svg-icon.vue": __vite_glob_0_51,"./components/switch/switch.vue": __vite_glob_0_52,"./components/sync-scroll-container/sync-scroll-container.vue": __vite_glob_0_53,"./components/tags/tags.vue": __vite_glob_0_54,"./components/text-ellipsis/text-ellipsis.vue": __vite_glob_0_55,"./components/thousand-input/thousand-input.vue": __vite_glob_0_56,"./components/thousand-separator/thousand-separator.vue": __vite_glob_0_57,"./components/tinymce/tinymce.vue": __vite_glob_0_58,"./components/transfer-panel/transfer-panel.vue": __vite_glob_0_59,"./components/transfer/transfer.vue": __vite_glob_0_60,"./components/tree-picker/tree-picker.vue": __vite_glob_0_61,"./components/tree-select/tree-select.vue": __vite_glob_0_62,"./components/upload-file/upload-file.vue": __vite_glob_0_63});
172
176
  const upper = (_, letter) => letter.toUpperCase();
@@ -186,4 +190,4 @@ const index = {
186
190
  install
187
191
  };
188
192
 
189
- export { _sfc_main as VcAwesomeIcon, _sfc_main$1 as VcBackbottom, _sfc_main$3 as VcChoiceBoolean, _sfc_main$4 as VcConfigProvider, _sfc_main$6 as VcDaterangePicker, _sfc_main$5 as VcFlag, _sfc_main$2 as VcIcon, _sfc_main$7 as VcQrCode, _sfc_main$8 as VcSplitter, index as default };
193
+ export { _sfc_main as VcAwesomeIcon, _sfc_main$1 as VcBackbottom, _sfc_main$3 as VcChoiceBoolean, _sfc_main$4 as VcConfigProvider, _sfc_main$6 as VcDaterangePicker, _sfc_main$5 as VcFlag, _sfc_main$2 as VcIcon, _sfc_main$7 as VcQrCode, _sfc_main$8 as VcSplitter, _sfc_main$9 as VcThousandSeparator, index as default };
package/dist/index.css CHANGED
@@ -1626,12 +1626,6 @@ span._draggable_1tp7v_5 > * {
1626
1626
  ._main_m3b07_1 .el-input__wrapper input {
1627
1627
  text-align: right;
1628
1628
  }
1629
- /* source: src/components/thousand-separator/thousand-separator.vue */
1630
- @charset "UTF-8";
1631
- ._thousand-separator_1s3bf_2 {
1632
- font-variant-numeric: tabular-nums;
1633
- /* 可选:继承父元素样式,无需额外样式 */
1634
- }
1635
1629
  /* source: src/components/tinymce/tinymce.vue */
1636
1630
  ._tinymce_aa7a3_1 {
1637
1631
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wfrog/vc-ui",
3
- "version": "1.14.0",
3
+ "version": "1.14.1",
4
4
  "packageManager": "pnpm@10.20.0",
5
5
  "description": "vue3 组件库 vc-ui",
6
6
  "author": "wellfrog",
@@ -1,37 +0,0 @@
1
- import { i as isObjectLike, b as baseGetTag } from './Fo0dZYnz.mjs';
2
-
3
- /** `Object#toString` result references. */
4
- var numberTag = '[object Number]';
5
-
6
- /**
7
- * Checks if `value` is classified as a `Number` primitive or object.
8
- *
9
- * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are
10
- * classified as numbers, use the `_.isFinite` method.
11
- *
12
- * @static
13
- * @memberOf _
14
- * @since 0.1.0
15
- * @category Lang
16
- * @param {*} value The value to check.
17
- * @returns {boolean} Returns `true` if `value` is a number, else `false`.
18
- * @example
19
- *
20
- * _.isNumber(3);
21
- * // => true
22
- *
23
- * _.isNumber(Number.MIN_VALUE);
24
- * // => true
25
- *
26
- * _.isNumber(Infinity);
27
- * // => true
28
- *
29
- * _.isNumber('3');
30
- * // => false
31
- */
32
- function isNumber(value) {
33
- return typeof value == 'number' ||
34
- (isObjectLike(value) && baseGetTag(value) == numberTag);
35
- }
36
-
37
- export { isNumber as i };
@@ -1,6 +0,0 @@
1
- /* source: src/components/thousand-separator/thousand-separator.vue */
2
- @charset "UTF-8";
3
- ._thousand-separator_1s3bf_2 {
4
- font-variant-numeric: tabular-nums;
5
- /* 可选:继承父元素样式,无需额外样式 */
6
- }