@cck-ui/core 0.38.0 → 0.39.0
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/cjs/components/number-formatter/index.cjs +12 -0
- package/cjs/components/number-formatter/index.cjs.map +1 -0
- package/cjs/components/number-formatter/number-formatter.cjs +120 -0
- package/cjs/components/number-formatter/number-formatter.cjs.map +1 -0
- package/cjs/index.cjs +32 -29
- package/cjs/index.cjs.map +1 -1
- package/esm/components/number-formatter/index.mjs +9 -0
- package/esm/components/number-formatter/index.mjs.map +1 -0
- package/esm/components/number-formatter/number-formatter.mjs +120 -0
- package/esm/components/number-formatter/number-formatter.mjs.map +1 -0
- package/esm/index.mjs +3 -1
- package/esm/index.mjs.map +1 -1
- package/lib/components/index.d.ts +1 -0
- package/lib/components/number-formatter/index.d.ts +5 -0
- package/lib/components/number-formatter/number-formatter.types.d.ts +36 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_install = require("../../core/utils/vue/install.cjs");
|
|
3
|
+
const require_statics = require("../../core/utils/vue/statics.cjs");
|
|
4
|
+
const require_number_formatter = require("./number-formatter.cjs");
|
|
5
|
+
//#region packages/@cck-ui/core/src/components/number-formatter/index.ts
|
|
6
|
+
const NumberFormatterWithStatic = require_statics.withPropsFactory(require_statics.withExtend(require_number_formatter.default));
|
|
7
|
+
const CNumberFormatter = require_install.withInstall(NumberFormatterWithStatic);
|
|
8
|
+
//#endregion
|
|
9
|
+
exports.CNumberFormatter = CNumberFormatter;
|
|
10
|
+
exports.default = CNumberFormatter;
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["withPropsFactory","withExtend","NumberFormatter","withInstall"],"sources":["../../../src/components/number-formatter/index.ts"],"sourcesContent":["import { SFCWithInstall, withExtend, withInstall, withPropsFactory } from '../../core'\nimport NumberFormatter from './number-formatter.vue'\n\nconst NumberFormatterWithStatic = withPropsFactory(withExtend(NumberFormatter))\n\nexport const CNumberFormatter: SFCWithInstall<typeof NumberFormatter> =\n withInstall(NumberFormatterWithStatic)\n\nexport default CNumberFormatter\n\nexport * from './number-formatter.types'\n"],"mappings":";;;;;AAGA,MAAM,4BAA4BA,gBAAAA,iBAAiBC,gBAAAA,WAAWC,yBAAAA,OAAe,CAAC;AAE9E,MAAa,mBACXC,gBAAAA,YAAY,yBAAyB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_export_helper = require("../../_virtual/_/plugin-vue/export-helper.cjs");
|
|
3
|
+
const require_use_component_props = require("../../core/config-provider/use-component-props/use-component-props.cjs");
|
|
4
|
+
let vue = require("vue");
|
|
5
|
+
//#region packages/@cck-ui/core/src/components/number-formatter/number-formatter.vue
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
7
|
+
name: "CNumberFormatter",
|
|
8
|
+
__name: "number-formatter",
|
|
9
|
+
props: {
|
|
10
|
+
value: {
|
|
11
|
+
type: [Number, String],
|
|
12
|
+
required: false
|
|
13
|
+
},
|
|
14
|
+
allowNegative: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
required: false
|
|
17
|
+
},
|
|
18
|
+
decimalScale: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
22
|
+
decimalSeparator: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
fixedDecimalScale: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
required: false
|
|
29
|
+
},
|
|
30
|
+
prefix: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
suffix: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
thousandsGroupStyle: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
thousandSeparator: {
|
|
43
|
+
type: [String, Boolean],
|
|
44
|
+
required: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
setup(__props, { expose: __expose }) {
|
|
48
|
+
__expose();
|
|
49
|
+
const rawProps = __props;
|
|
50
|
+
const defaultProps = {
|
|
51
|
+
allowNegative: true,
|
|
52
|
+
decimalScale: Infinity,
|
|
53
|
+
decimalSeparator: ".",
|
|
54
|
+
fixedDecimalScale: false,
|
|
55
|
+
thousandSeparator: ",",
|
|
56
|
+
thousandsGroupStyle: "thousand",
|
|
57
|
+
prefix: "",
|
|
58
|
+
suffix: ""
|
|
59
|
+
};
|
|
60
|
+
const props = require_use_component_props.useComponentProps({
|
|
61
|
+
component: "CNumberFormatter",
|
|
62
|
+
defaultProps,
|
|
63
|
+
props: rawProps
|
|
64
|
+
});
|
|
65
|
+
const __returned__ = {
|
|
66
|
+
rawProps,
|
|
67
|
+
defaultProps,
|
|
68
|
+
props,
|
|
69
|
+
formatted: (0, vue.computed)(() => {
|
|
70
|
+
const { value, allowNegative, decimalScale, decimalSeparator, fixedDecimalScale, prefix, suffix, thousandSeparator, thousandsGroupStyle } = props.value;
|
|
71
|
+
if (value === void 0 || value === null) return null;
|
|
72
|
+
let num = typeof value === "string" ? parseFloat(value) : value;
|
|
73
|
+
if (isNaN(num)) return String(value);
|
|
74
|
+
if (!allowNegative && num < 0) num = Math.abs(num);
|
|
75
|
+
let [intPart, decPart] = num.toString().split(".");
|
|
76
|
+
if (decPart === void 0) decPart = "";
|
|
77
|
+
if (decimalScale !== void 0 && Number.isFinite(decimalScale)) {
|
|
78
|
+
const factor = 10 ** decimalScale;
|
|
79
|
+
num = Math.round(num * factor) / factor;
|
|
80
|
+
const parts = num.toString().split(".");
|
|
81
|
+
intPart = parts[0];
|
|
82
|
+
decPart = parts[1] || "";
|
|
83
|
+
if (fixedDecimalScale) decPart = decPart.padEnd(decimalScale, "0");
|
|
84
|
+
else if (decimalScale === 0) decPart = "";
|
|
85
|
+
}
|
|
86
|
+
let sep = defaultProps.thousandSeparator;
|
|
87
|
+
if (typeof thousandSeparator === "string") sep = thousandSeparator === "" ? defaultProps.thousandSeparator : thousandSeparator;
|
|
88
|
+
else if (typeof thousandSeparator === "boolean") sep = thousandSeparator ? defaultProps.thousandSeparator : "";
|
|
89
|
+
let formattedInt = intPart;
|
|
90
|
+
if (sep && thousandsGroupStyle !== "none") if (thousandsGroupStyle === "thousand") formattedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, sep);
|
|
91
|
+
else if (thousandsGroupStyle === "wan") formattedInt = intPart.replace(/\B(?=(\d{4})+(?!\d))/g, sep);
|
|
92
|
+
else if (thousandsGroupStyle === "lakh") {
|
|
93
|
+
const len = intPart.length;
|
|
94
|
+
if (len <= 3) formattedInt = intPart;
|
|
95
|
+
else {
|
|
96
|
+
const firstGroup = len % 2 === 0 ? 2 : 1;
|
|
97
|
+
formattedInt = [intPart.slice(0, firstGroup), ...intPart.slice(firstGroup).match(/.{1,2}/g) || []].join(sep);
|
|
98
|
+
}
|
|
99
|
+
} else formattedInt = intPart;
|
|
100
|
+
let result = formattedInt;
|
|
101
|
+
if (decPart) result += decimalSeparator + decPart;
|
|
102
|
+
return prefix + result + suffix;
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
106
|
+
enumerable: false,
|
|
107
|
+
value: true
|
|
108
|
+
});
|
|
109
|
+
return __returned__;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const _hoisted_1 = { key: 0 };
|
|
113
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
114
|
+
return $setup.formatted !== null ? ((0, vue.openBlock)(), (0, vue.createElementBlock)("span", _hoisted_1, (0, vue.toDisplayString)($setup.formatted), 1)) : (0, vue.createCommentVNode)("v-if", true);
|
|
115
|
+
}
|
|
116
|
+
var number_formatter_default = /*#__PURE__*/ require_export_helper.default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/number-formatter/number-formatter.vue"]]);
|
|
117
|
+
//#endregion
|
|
118
|
+
exports.default = number_formatter_default;
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=number-formatter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-formatter.cjs","names":[],"sources":["../../../src/components/number-formatter/number-formatter.vue"],"sourcesContent":["<template>\n <span v-if=\"formatted !== null\">{{ formatted }}</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { useComponentProps } from '../../core'\nimport { NumberFormatterProps } from './number-formatter.types'\n\ndefineOptions({\n name: 'CNumberFormatter',\n})\n\nconst rawProps = defineProps<NumberFormatterProps>()\n\nconst defaultProps: Partial<NumberFormatterProps> = {\n allowNegative: true,\n decimalScale: Infinity,\n decimalSeparator: '.',\n fixedDecimalScale: false,\n thousandSeparator: ',',\n thousandsGroupStyle: 'thousand',\n prefix: '',\n suffix: '',\n}\n\nconst props = useComponentProps({\n component: 'CNumberFormatter',\n defaultProps,\n props: rawProps,\n})\n\nconst formatted = computed(() => {\n const {\n value,\n allowNegative,\n decimalScale,\n decimalSeparator,\n fixedDecimalScale,\n prefix,\n suffix,\n thousandSeparator,\n thousandsGroupStyle,\n } = props.value\n\n if (value === undefined || value === null) {\n return null\n }\n\n let num = typeof value === 'string' ? parseFloat(value) : value\n if (isNaN(num)) {\n return String(value)\n }\n\n if (!allowNegative && num < 0) {\n num = Math.abs(num)\n }\n\n let [intPart, decPart] = num.toString().split('.')\n if (decPart === undefined) {\n decPart = ''\n }\n\n if (decimalScale !== undefined && Number.isFinite(decimalScale)) {\n const factor = 10 ** decimalScale\n num = Math.round(num * factor) / factor\n const parts = num.toString().split('.')\n intPart = parts[0]\n decPart = parts[1] || ''\n if (fixedDecimalScale) {\n decPart = decPart.padEnd(decimalScale, '0')\n } else if (decimalScale === 0) {\n decPart = ''\n }\n }\n\n let sep: string = defaultProps.thousandSeparator as string\n if (typeof thousandSeparator === 'string') {\n sep = thousandSeparator === '' ? (defaultProps.thousandSeparator as string) : thousandSeparator\n } else if (typeof thousandSeparator === 'boolean') {\n sep = thousandSeparator ? (defaultProps.thousandSeparator as string) : ''\n }\n\n let formattedInt = intPart\n if (sep && thousandsGroupStyle !== 'none') {\n if (thousandsGroupStyle === 'thousand') {\n formattedInt = intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, sep)\n } else if (thousandsGroupStyle === 'wan') {\n formattedInt = intPart.replace(/\\B(?=(\\d{4})+(?!\\d))/g, sep)\n } else if (thousandsGroupStyle === 'lakh') {\n const len = intPart.length\n if (len <= 3) {\n formattedInt = intPart\n } else {\n const firstGroup = len % 2 === 0 ? 2 : 1\n const parts = [\n intPart.slice(0, firstGroup),\n ...(intPart.slice(firstGroup).match(/.{1,2}/g) || []),\n ]\n formattedInt = parts.join(sep)\n }\n } else {\n formattedInt = intPart\n }\n }\n\n let result = formattedInt\n if (decPart) {\n result += decimalSeparator + decPart\n }\n return prefix + result + suffix\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,WAAW;EAEjB,MAAM,eAA8C;GAClD,eAAe;GACf,cAAc;GACd,kBAAkB;GAClB,mBAAmB;GACnB,mBAAmB;GACnB,qBAAqB;GACrB,QAAQ;GACR,QAAQ;EACV;EAEA,MAAM,QAAQ,4BAAA,kBAAkB;GAC9B,WAAW;GACX;GACA,OAAO;EACT,CAAC;;;;;sCAEgC;IAC/B,MAAM,EACJ,OACA,eACA,cACA,kBACA,mBACA,QACA,QACA,mBACA,wBACE,MAAM;IAEV,IAAI,UAAU,KAAA,KAAa,UAAU,MACnC,OAAO;IAGT,IAAI,MAAM,OAAO,UAAU,WAAW,WAAW,KAAK,IAAI;IAC1D,IAAI,MAAM,GAAG,GACX,OAAO,OAAO,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AA,IAAA,UAAA,CAAA,IAAA,GAAA,IAAA,mBAAA,CAAiC,QAAA,aAAA,GAAA,IAAA,gBAAA,CAAnB,OAAA,SAAS,GAAA,CAAA,MAAA,GAAA,IAAA,mBAAA,CAAA,QAAA,IAAA"}
|
package/cjs/index.cjs
CHANGED
|
@@ -91,15 +91,16 @@ const require_index$32 = require("./components/group/index.cjs");
|
|
|
91
91
|
const require_index$33 = require("./components/image/index.cjs");
|
|
92
92
|
const require_index$34 = require("./components/indicator/index.cjs");
|
|
93
93
|
const require_index$35 = require("./components/kbd/index.cjs");
|
|
94
|
-
const require_index$36 = require("./components/
|
|
95
|
-
const require_index$37 = require("./components/
|
|
96
|
-
const require_index$38 = require("./components/
|
|
97
|
-
const require_index$39 = require("./components/
|
|
98
|
-
const require_index$40 = require("./components/
|
|
99
|
-
const require_index$41 = require("./components/
|
|
100
|
-
const require_index$42 = require("./components/
|
|
101
|
-
const require_index$43 = require("./components/
|
|
102
|
-
const require_index$44 = require("./components/
|
|
94
|
+
const require_index$36 = require("./components/number-formatter/index.cjs");
|
|
95
|
+
const require_index$37 = require("./components/paper/index.cjs");
|
|
96
|
+
const require_index$38 = require("./components/semi-circle-progress/index.cjs");
|
|
97
|
+
const require_index$39 = require("./components/simple-grid/index.cjs");
|
|
98
|
+
const require_index$40 = require("./components/skeleton/index.cjs");
|
|
99
|
+
const require_index$41 = require("./components/space/index.cjs");
|
|
100
|
+
const require_index$42 = require("./components/splitter/index.cjs");
|
|
101
|
+
const require_index$43 = require("./components/stack/index.cjs");
|
|
102
|
+
const require_index$44 = require("./components/typography/index.cjs");
|
|
103
|
+
const require_index$45 = require("./components/visually-hidden/index.cjs");
|
|
103
104
|
let _vue_shared = require("@vue/shared");
|
|
104
105
|
//#region packages/@cck-ui/core/src/index.ts
|
|
105
106
|
const INSTALLED_KEY = Symbol("INSTALLED_KEY");
|
|
@@ -149,19 +150,20 @@ const components = [
|
|
|
149
150
|
require_index$34.CIndicator,
|
|
150
151
|
require_index$35.CKbd,
|
|
151
152
|
require_index$4.CLoader,
|
|
152
|
-
require_index$36.
|
|
153
|
+
require_index$36.CNumberFormatter,
|
|
154
|
+
require_index$37.CPaper,
|
|
153
155
|
require_index$7.CPortal,
|
|
154
|
-
require_index$
|
|
155
|
-
require_index$
|
|
156
|
-
require_index$
|
|
157
|
-
require_index$
|
|
158
|
-
require_index$
|
|
159
|
-
require_index$
|
|
160
|
-
require_index$
|
|
156
|
+
require_index$38.CSemiCircleProgress,
|
|
157
|
+
require_index$39.CSimpleGrid,
|
|
158
|
+
require_index$40.CSkeleton,
|
|
159
|
+
require_index$41.CSpace,
|
|
160
|
+
require_index$42.CSplitter,
|
|
161
|
+
require_index$42.CSplitterPane,
|
|
162
|
+
require_index$43.CStack,
|
|
161
163
|
require_index$11.CText,
|
|
162
164
|
require_index$5.CTransition,
|
|
163
|
-
require_index$
|
|
164
|
-
require_index$
|
|
165
|
+
require_index$44.CTypography,
|
|
166
|
+
require_index$45.CVisuallyHidden,
|
|
165
167
|
require_index$3.UnstyledButton
|
|
166
168
|
];
|
|
167
169
|
const CckUI = { install(app) {
|
|
@@ -218,20 +220,21 @@ exports.CImage = require_index$33.CImage;
|
|
|
218
220
|
exports.CIndicator = require_index$34.CIndicator;
|
|
219
221
|
exports.CKbd = require_index$35.CKbd;
|
|
220
222
|
exports.CLoader = require_index$4.CLoader;
|
|
223
|
+
exports.CNumberFormatter = require_index$36.CNumberFormatter;
|
|
221
224
|
exports.CONFIG_KEY = require_config_provider_types.CONFIG_KEY;
|
|
222
|
-
exports.CPaper = require_index$
|
|
225
|
+
exports.CPaper = require_index$37.CPaper;
|
|
223
226
|
exports.CPortal = require_index$7.CPortal;
|
|
224
|
-
exports.CSemiCircleProgress = require_index$
|
|
225
|
-
exports.CSimpleGrid = require_index$
|
|
226
|
-
exports.CSkeleton = require_index$
|
|
227
|
-
exports.CSpace = require_index$
|
|
228
|
-
exports.CSplitter = require_index$
|
|
229
|
-
exports.CSplitterPane = require_index$
|
|
230
|
-
exports.CStack = require_index$
|
|
227
|
+
exports.CSemiCircleProgress = require_index$38.CSemiCircleProgress;
|
|
228
|
+
exports.CSimpleGrid = require_index$39.CSimpleGrid;
|
|
229
|
+
exports.CSkeleton = require_index$40.CSkeleton;
|
|
230
|
+
exports.CSpace = require_index$41.CSpace;
|
|
231
|
+
exports.CSplitter = require_index$42.CSplitter;
|
|
232
|
+
exports.CSplitterPane = require_index$42.CSplitterPane;
|
|
233
|
+
exports.CStack = require_index$43.CStack;
|
|
231
234
|
exports.CText = require_index$11.CText;
|
|
232
235
|
exports.CTransition = require_index$5.CTransition;
|
|
233
|
-
exports.CTypography = require_index$
|
|
234
|
-
exports.CVisuallyHidden = require_index$
|
|
236
|
+
exports.CTypography = require_index$44.CTypography;
|
|
237
|
+
exports.CVisuallyHidden = require_index$45.CVisuallyHidden;
|
|
235
238
|
exports.CckConfigProvider = require_index$1.CckConfigProvider;
|
|
236
239
|
exports.CckUI = CckUI;
|
|
237
240
|
exports.default = CckUI;
|
package/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["CckConfigProvider","CBox","CActionIcon","CActionIconGroup","CActionIconGroupSection","CAffix","CAlert","CAnchor","CAspectRatio","CAvatar","CAvatarGroup","CBackgroundImage","CBadge","CBreadcrumbs","CBurger","CButton","CButtonGroup","CButtonGroupSection","CCard","CCardSection","CCenter","CCloseButton","CCol","CColorSwatch","CContainer","CCopyButton","CDataList","CDataListItem","CDataListItemLabel","CDataListItemValue","CDivider","CEmptyState","CEmptyStateActions","CEmptyStateDescription","CEmptyStateIndicator","CEmptyStateTitle","CFileButton","CFlex","CFocusTrap","CGrid","CGroup","CImage","CIndicator","CKbd","CLoader","CPaper","CPortal","CSemiCircleProgress","CSimpleGrid","CSkeleton","CSpace","CSplitter","CSplitterPane","CStack","CText","CTransition","CTypography","CVisuallyHidden","UnstyledButton"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["CckConfigProvider","CBox","CActionIcon","CActionIconGroup","CActionIconGroupSection","CAffix","CAlert","CAnchor","CAspectRatio","CAvatar","CAvatarGroup","CBackgroundImage","CBadge","CBreadcrumbs","CBurger","CButton","CButtonGroup","CButtonGroupSection","CCard","CCardSection","CCenter","CCloseButton","CCol","CColorSwatch","CContainer","CCopyButton","CDataList","CDataListItem","CDataListItemLabel","CDataListItemValue","CDivider","CEmptyState","CEmptyStateActions","CEmptyStateDescription","CEmptyStateIndicator","CEmptyStateTitle","CFileButton","CFlex","CFocusTrap","CGrid","CGroup","CImage","CIndicator","CKbd","CLoader","CNumberFormatter","CPaper","CPortal","CSemiCircleProgress","CSimpleGrid","CSkeleton","CSpace","CSplitter","CSplitterPane","CStack","CText","CTransition","CTypography","CVisuallyHidden","UnstyledButton"],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CNumberFormatter,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CNumberFormatter,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;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
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { withInstall } from "../../core/utils/vue/install.mjs";
|
|
3
|
+
import { withExtend, withPropsFactory } from "../../core/utils/vue/statics.mjs";
|
|
4
|
+
import number_formatter_default from "./number-formatter.mjs";
|
|
5
|
+
const CNumberFormatter = withInstall(withPropsFactory(withExtend(number_formatter_default)));
|
|
6
|
+
//#endregion
|
|
7
|
+
export { CNumberFormatter, CNumberFormatter as default };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["NumberFormatter"],"sources":["../../../src/components/number-formatter/index.ts"],"sourcesContent":["import { SFCWithInstall, withExtend, withInstall, withPropsFactory } from '../../core'\nimport NumberFormatter from './number-formatter.vue'\n\nconst NumberFormatterWithStatic = withPropsFactory(withExtend(NumberFormatter))\n\nexport const CNumberFormatter: SFCWithInstall<typeof NumberFormatter> =\n withInstall(NumberFormatterWithStatic)\n\nexport default CNumberFormatter\n\nexport * from './number-formatter.types'\n"],"mappings":";;;;AAKA,MAAa,mBACX,YAHgC,iBAAiB,WAAWA,wBAAe,CAG/D,CAAyB"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import export_helper_default from "../../_virtual/_/plugin-vue/export-helper.mjs";
|
|
3
|
+
import { useComponentProps } from "../../core/config-provider/use-component-props/use-component-props.mjs";
|
|
4
|
+
import { computed, createCommentVNode, createElementBlock, defineComponent, openBlock, toDisplayString } from "vue";
|
|
5
|
+
//#region packages/@cck-ui/core/src/components/number-formatter/number-formatter.vue
|
|
6
|
+
const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
7
|
+
name: "CNumberFormatter",
|
|
8
|
+
__name: "number-formatter",
|
|
9
|
+
props: {
|
|
10
|
+
value: {
|
|
11
|
+
type: [Number, String],
|
|
12
|
+
required: false
|
|
13
|
+
},
|
|
14
|
+
allowNegative: {
|
|
15
|
+
type: Boolean,
|
|
16
|
+
required: false
|
|
17
|
+
},
|
|
18
|
+
decimalScale: {
|
|
19
|
+
type: Number,
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
22
|
+
decimalSeparator: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
fixedDecimalScale: {
|
|
27
|
+
type: Boolean,
|
|
28
|
+
required: false
|
|
29
|
+
},
|
|
30
|
+
prefix: {
|
|
31
|
+
type: String,
|
|
32
|
+
required: false
|
|
33
|
+
},
|
|
34
|
+
suffix: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: false
|
|
37
|
+
},
|
|
38
|
+
thousandsGroupStyle: {
|
|
39
|
+
type: String,
|
|
40
|
+
required: false
|
|
41
|
+
},
|
|
42
|
+
thousandSeparator: {
|
|
43
|
+
type: [String, Boolean],
|
|
44
|
+
required: false
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
setup(__props, { expose: __expose }) {
|
|
48
|
+
__expose();
|
|
49
|
+
const rawProps = __props;
|
|
50
|
+
const defaultProps = {
|
|
51
|
+
allowNegative: true,
|
|
52
|
+
decimalScale: Infinity,
|
|
53
|
+
decimalSeparator: ".",
|
|
54
|
+
fixedDecimalScale: false,
|
|
55
|
+
thousandSeparator: ",",
|
|
56
|
+
thousandsGroupStyle: "thousand",
|
|
57
|
+
prefix: "",
|
|
58
|
+
suffix: ""
|
|
59
|
+
};
|
|
60
|
+
const props = useComponentProps({
|
|
61
|
+
component: "CNumberFormatter",
|
|
62
|
+
defaultProps,
|
|
63
|
+
props: rawProps
|
|
64
|
+
});
|
|
65
|
+
const __returned__ = {
|
|
66
|
+
rawProps,
|
|
67
|
+
defaultProps,
|
|
68
|
+
props,
|
|
69
|
+
formatted: computed(() => {
|
|
70
|
+
const { value, allowNegative, decimalScale, decimalSeparator, fixedDecimalScale, prefix, suffix, thousandSeparator, thousandsGroupStyle } = props.value;
|
|
71
|
+
if (value === void 0 || value === null) return null;
|
|
72
|
+
let num = typeof value === "string" ? parseFloat(value) : value;
|
|
73
|
+
if (isNaN(num)) return String(value);
|
|
74
|
+
if (!allowNegative && num < 0) num = Math.abs(num);
|
|
75
|
+
let [intPart, decPart] = num.toString().split(".");
|
|
76
|
+
if (decPart === void 0) decPart = "";
|
|
77
|
+
if (decimalScale !== void 0 && Number.isFinite(decimalScale)) {
|
|
78
|
+
const factor = 10 ** decimalScale;
|
|
79
|
+
num = Math.round(num * factor) / factor;
|
|
80
|
+
const parts = num.toString().split(".");
|
|
81
|
+
intPart = parts[0];
|
|
82
|
+
decPart = parts[1] || "";
|
|
83
|
+
if (fixedDecimalScale) decPart = decPart.padEnd(decimalScale, "0");
|
|
84
|
+
else if (decimalScale === 0) decPart = "";
|
|
85
|
+
}
|
|
86
|
+
let sep = defaultProps.thousandSeparator;
|
|
87
|
+
if (typeof thousandSeparator === "string") sep = thousandSeparator === "" ? defaultProps.thousandSeparator : thousandSeparator;
|
|
88
|
+
else if (typeof thousandSeparator === "boolean") sep = thousandSeparator ? defaultProps.thousandSeparator : "";
|
|
89
|
+
let formattedInt = intPart;
|
|
90
|
+
if (sep && thousandsGroupStyle !== "none") if (thousandsGroupStyle === "thousand") formattedInt = intPart.replace(/\B(?=(\d{3})+(?!\d))/g, sep);
|
|
91
|
+
else if (thousandsGroupStyle === "wan") formattedInt = intPart.replace(/\B(?=(\d{4})+(?!\d))/g, sep);
|
|
92
|
+
else if (thousandsGroupStyle === "lakh") {
|
|
93
|
+
const len = intPart.length;
|
|
94
|
+
if (len <= 3) formattedInt = intPart;
|
|
95
|
+
else {
|
|
96
|
+
const firstGroup = len % 2 === 0 ? 2 : 1;
|
|
97
|
+
formattedInt = [intPart.slice(0, firstGroup), ...intPart.slice(firstGroup).match(/.{1,2}/g) || []].join(sep);
|
|
98
|
+
}
|
|
99
|
+
} else formattedInt = intPart;
|
|
100
|
+
let result = formattedInt;
|
|
101
|
+
if (decPart) result += decimalSeparator + decPart;
|
|
102
|
+
return prefix + result + suffix;
|
|
103
|
+
})
|
|
104
|
+
};
|
|
105
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
106
|
+
enumerable: false,
|
|
107
|
+
value: true
|
|
108
|
+
});
|
|
109
|
+
return __returned__;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const _hoisted_1 = { key: 0 };
|
|
113
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
114
|
+
return $setup.formatted !== null ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString($setup.formatted), 1)) : createCommentVNode("v-if", true);
|
|
115
|
+
}
|
|
116
|
+
var number_formatter_default = /*#__PURE__*/ export_helper_default(_sfc_main, [["render", _sfc_render], ["__file", "/home/runner/work/cck-ui/cck-ui/packages/@cck-ui/core/src/components/number-formatter/number-formatter.vue"]]);
|
|
117
|
+
//#endregion
|
|
118
|
+
export { number_formatter_default as default };
|
|
119
|
+
|
|
120
|
+
//# sourceMappingURL=number-formatter.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number-formatter.mjs","names":[],"sources":["../../../src/components/number-formatter/number-formatter.vue"],"sourcesContent":["<template>\n <span v-if=\"formatted !== null\">{{ formatted }}</span>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { useComponentProps } from '../../core'\nimport { NumberFormatterProps } from './number-formatter.types'\n\ndefineOptions({\n name: 'CNumberFormatter',\n})\n\nconst rawProps = defineProps<NumberFormatterProps>()\n\nconst defaultProps: Partial<NumberFormatterProps> = {\n allowNegative: true,\n decimalScale: Infinity,\n decimalSeparator: '.',\n fixedDecimalScale: false,\n thousandSeparator: ',',\n thousandsGroupStyle: 'thousand',\n prefix: '',\n suffix: '',\n}\n\nconst props = useComponentProps({\n component: 'CNumberFormatter',\n defaultProps,\n props: rawProps,\n})\n\nconst formatted = computed(() => {\n const {\n value,\n allowNegative,\n decimalScale,\n decimalSeparator,\n fixedDecimalScale,\n prefix,\n suffix,\n thousandSeparator,\n thousandsGroupStyle,\n } = props.value\n\n if (value === undefined || value === null) {\n return null\n }\n\n let num = typeof value === 'string' ? parseFloat(value) : value\n if (isNaN(num)) {\n return String(value)\n }\n\n if (!allowNegative && num < 0) {\n num = Math.abs(num)\n }\n\n let [intPart, decPart] = num.toString().split('.')\n if (decPart === undefined) {\n decPart = ''\n }\n\n if (decimalScale !== undefined && Number.isFinite(decimalScale)) {\n const factor = 10 ** decimalScale\n num = Math.round(num * factor) / factor\n const parts = num.toString().split('.')\n intPart = parts[0]\n decPart = parts[1] || ''\n if (fixedDecimalScale) {\n decPart = decPart.padEnd(decimalScale, '0')\n } else if (decimalScale === 0) {\n decPart = ''\n }\n }\n\n let sep: string = defaultProps.thousandSeparator as string\n if (typeof thousandSeparator === 'string') {\n sep = thousandSeparator === '' ? (defaultProps.thousandSeparator as string) : thousandSeparator\n } else if (typeof thousandSeparator === 'boolean') {\n sep = thousandSeparator ? (defaultProps.thousandSeparator as string) : ''\n }\n\n let formattedInt = intPart\n if (sep && thousandsGroupStyle !== 'none') {\n if (thousandsGroupStyle === 'thousand') {\n formattedInt = intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g, sep)\n } else if (thousandsGroupStyle === 'wan') {\n formattedInt = intPart.replace(/\\B(?=(\\d{4})+(?!\\d))/g, sep)\n } else if (thousandsGroupStyle === 'lakh') {\n const len = intPart.length\n if (len <= 3) {\n formattedInt = intPart\n } else {\n const firstGroup = len % 2 === 0 ? 2 : 1\n const parts = [\n intPart.slice(0, firstGroup),\n ...(intPart.slice(firstGroup).match(/.{1,2}/g) || []),\n ]\n formattedInt = parts.join(sep)\n }\n } else {\n formattedInt = intPart\n }\n }\n\n let result = formattedInt\n if (decPart) {\n result += decimalSeparator + decPart\n }\n return prefix + result + suffix\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,WAAW;EAEjB,MAAM,eAA8C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AI,wBAAwB,QAAQ;KACzC,MAAM,MAAM,QAAQ;KACpB,IAAI,OAAO,GACT,eAAe;UACV;MACL,MAAM,aAAa,MAAM,MAAM,IAAI,IAAI;MAKvC,eAAe,CAHb,QAAQ,MAAM,GAAG,UAAU,GAC3B,GAAI,QAAQ,MAAM,UAAU,CAAC,CAAC,MAAM,SAAS,KAAK,CAAC,CAEtC,CAAA,CAAM,KAAK,GAAG;KAC/B;IACF,OACE,eAAe;IAInB,IAAI,SAAS;IACb,IAAI,SACF,UAAU,mBAAmB;IAE/B,OAAO,SAAS,SAAS;GAC3B,CAAA;;;;;;;;;;;QA9Gc,OAAA,cAAS,QAAA,UAAA,GAArB,mBAAsD,QAAA,YAAA,gBAAnB,OAAA,SAAS,GAAA,CAAA,KAAA,mBAAA,QAAA,IAAA"}
|
package/esm/index.mjs
CHANGED
|
@@ -87,6 +87,7 @@ import { CGroup } from "./components/group/index.mjs";
|
|
|
87
87
|
import { CImage } from "./components/image/index.mjs";
|
|
88
88
|
import { CIndicator } from "./components/indicator/index.mjs";
|
|
89
89
|
import { CKbd } from "./components/kbd/index.mjs";
|
|
90
|
+
import { CNumberFormatter } from "./components/number-formatter/index.mjs";
|
|
90
91
|
import { CPaper } from "./components/paper/index.mjs";
|
|
91
92
|
import { CSemiCircleProgress } from "./components/semi-circle-progress/index.mjs";
|
|
92
93
|
import { CSimpleGrid } from "./components/simple-grid/index.mjs";
|
|
@@ -144,6 +145,7 @@ const components = [
|
|
|
144
145
|
CIndicator,
|
|
145
146
|
CKbd,
|
|
146
147
|
CLoader,
|
|
148
|
+
CNumberFormatter,
|
|
147
149
|
CPaper,
|
|
148
150
|
CPortal,
|
|
149
151
|
CSemiCircleProgress,
|
|
@@ -167,6 +169,6 @@ const CckUI = { install(app) {
|
|
|
167
169
|
});
|
|
168
170
|
} };
|
|
169
171
|
//#endregion
|
|
170
|
-
export { CActionIcon, CActionIconGroup, CActionIconGroupSection, CAffix, CAlert, CAnchor, CAspectRatio, CAvatar, CAvatarGroup, CBackgroundImage, CBadge, CBox, CBreadcrumbs, CBurger, CButton, CButtonGroup, CButtonGroupSection, transitions as CCK_TRANSITIONS, CCard, CCardSection, CCenter, CCloseButton, CCol, CColorSwatch, CContainer, CCopyButton, CDataList, CDataListItem, CDataListItemLabel, CDataListItemValue, CDefaultLoaders, CDivider, CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle, CFileButton, CFlex, CFocusTrap, CGrid, CGroup, CImage, CIndicator, CKbd, CLoader, CONFIG_KEY, CPaper, CPortal, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CTypography, CVisuallyHidden, CckConfigProvider, CckUI, CckUI as default, DEFAULT_THEME, FOCUS_CLASS_NAMES, STYLE_PROPS_DATA, THEME_KEY, UnstyledButton, alpha, camelToKebabCase, colorsTuple, createTheme, createVarsResolver, darken, deepMerge, defaultCssVariablesResolver, defaultVariantColorsResolver, em, extractStyleProps, filterFalsyChildren, filterProps, getBaseValue, getBreakpointValue, getCSSColorVariables, getComponentName, getDefaultZIndex, getFontSize, getGradient, getLineHeight, getPrimaryShade, getRadius, getShadow, getSize, getSortedBreakpoints, getSpacing, getThemeColor, getTransitionProps, hashStyleProps, isLightColor, isNumber, isNumberLike, isString, isStringNumber, isUndefined, isVirtualColor, keys, luminance, mergeThemeOverrides, normalizeNumberLikeStringProp, numberLikeStringToNumber, parseStyleProps, parseThemeColor, px, rem, resolveClassNames, resolveStyles, responsiveStyleManager, rgb, rgba, stylesToString, toRgba, useCckClassNamesPrefix, useCckColorScheme, useCckCssVariablesResolver, useCckEnv, useCckIsHeadless, useCckStyleNonce, useCckStylesTransform, useCckSxTransform, useCckTheme, useCckWithStaticClasses, useComponentProps, useConfigContext, useProviderColorScheme, useRandomClassName, useStyles, virtualColor, withClasses, withExtend, withInstall, withPropsDefaultSetter, withPropsFactory, withVarsResolver };
|
|
172
|
+
export { CActionIcon, CActionIconGroup, CActionIconGroupSection, CAffix, CAlert, CAnchor, CAspectRatio, CAvatar, CAvatarGroup, CBackgroundImage, CBadge, CBox, CBreadcrumbs, CBurger, CButton, CButtonGroup, CButtonGroupSection, transitions as CCK_TRANSITIONS, CCard, CCardSection, CCenter, CCloseButton, CCol, CColorSwatch, CContainer, CCopyButton, CDataList, CDataListItem, CDataListItemLabel, CDataListItemValue, CDefaultLoaders, CDivider, CEmptyState, CEmptyStateActions, CEmptyStateDescription, CEmptyStateIndicator, CEmptyStateTitle, CFileButton, CFlex, CFocusTrap, CGrid, CGroup, CImage, CIndicator, CKbd, CLoader, CNumberFormatter, CONFIG_KEY, CPaper, CPortal, CSemiCircleProgress, CSimpleGrid, CSkeleton, CSpace, CSplitter, CSplitterPane, CStack, CText, CTransition, CTypography, CVisuallyHidden, CckConfigProvider, CckUI, CckUI as default, DEFAULT_THEME, FOCUS_CLASS_NAMES, STYLE_PROPS_DATA, THEME_KEY, UnstyledButton, alpha, camelToKebabCase, colorsTuple, createTheme, createVarsResolver, darken, deepMerge, defaultCssVariablesResolver, defaultVariantColorsResolver, em, extractStyleProps, filterFalsyChildren, filterProps, getBaseValue, getBreakpointValue, getCSSColorVariables, getComponentName, getDefaultZIndex, getFontSize, getGradient, getLineHeight, getPrimaryShade, getRadius, getShadow, getSize, getSortedBreakpoints, getSpacing, getThemeColor, getTransitionProps, hashStyleProps, isLightColor, isNumber, isNumberLike, isString, isStringNumber, isUndefined, isVirtualColor, keys, luminance, mergeThemeOverrides, normalizeNumberLikeStringProp, numberLikeStringToNumber, parseStyleProps, parseThemeColor, px, rem, resolveClassNames, resolveStyles, responsiveStyleManager, rgb, rgba, stylesToString, toRgba, useCckClassNamesPrefix, useCckColorScheme, useCckCssVariablesResolver, useCckEnv, useCckIsHeadless, useCckStyleNonce, useCckStylesTransform, useCckSxTransform, useCckTheme, useCckWithStaticClasses, useComponentProps, useConfigContext, useProviderColorScheme, useRandomClassName, useStyles, virtualColor, withClasses, withExtend, withInstall, withPropsDefaultSetter, withPropsFactory, withVarsResolver };
|
|
171
173
|
|
|
172
174
|
//# sourceMappingURL=index.mjs.map
|
package/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import type { App, Plugin } from 'vue'\nimport {\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CNumberFormatter,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n} from './components'\nimport { CckConfigProvider, CBox } from './core'\n\nconst INSTALLED_KEY = Symbol('INSTALLED_KEY')\n\nconst components = [\n CckConfigProvider,\n CBox,\n CActionIcon,\n CActionIconGroup,\n CActionIconGroupSection,\n CAffix,\n CAlert,\n CAnchor,\n CAspectRatio,\n CAvatar,\n CAvatarGroup,\n CBackgroundImage,\n CBadge,\n CBreadcrumbs,\n CBurger,\n CButton,\n CButtonGroup,\n CButtonGroupSection,\n CCard,\n CCardSection,\n CCenter,\n CCloseButton,\n CCol,\n CColorSwatch,\n CContainer,\n CCopyButton,\n CDataList,\n CDataListItem,\n CDataListItemLabel,\n CDataListItemValue,\n CDivider,\n CEmptyState,\n CEmptyStateActions,\n CEmptyStateDescription,\n CEmptyStateIndicator,\n CEmptyStateTitle,\n CFileButton,\n CFlex,\n CFocusTrap,\n CGrid,\n CGroup,\n CImage,\n CIndicator,\n CKbd,\n CLoader,\n CNumberFormatter,\n CPaper,\n CPortal,\n CSemiCircleProgress,\n CSimpleGrid,\n CSkeleton,\n CSpace,\n CSplitter,\n CSplitterPane,\n CStack,\n CText,\n CTransition,\n CTypography,\n CVisuallyHidden,\n UnstyledButton,\n]\n\nconst CckUI: Plugin = {\n install(app: App) {\n if ((app as any)[INSTALLED_KEY]) {\n return\n }\n ;(app as any)[INSTALLED_KEY] = true\n components.forEach((c) => {\n if (c.name) {\n app.component(c.name, c)\n }\n })\n },\n}\n\nexport default CckUI\nexport { CckUI }\n\nexport * from './components'\nexport * from './core'\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAM,gBAAgB,OAAO,eAAe;AAE5C,MAAM,aAAa;CACjB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,QAAgB,EACpB,QAAQ,KAAU;CAChB,IAAK,IAAY,gBACf;CAED,IAAa,iBAAiB;CAC/B,WAAW,SAAS,MAAM;EACxB,IAAI,EAAE,MACJ,IAAI,UAAU,EAAE,MAAM,CAAC;CAE3B,CAAC;AACH,EACF"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ElementProps, Factory } from '../../core';
|
|
2
|
+
export interface NumberFormatterProps extends /* @vue-ignore */ ElementProps<'div'> {
|
|
3
|
+
/** Value to format */
|
|
4
|
+
value?: number | string;
|
|
5
|
+
/**
|
|
6
|
+
* If set, negative values are allowed
|
|
7
|
+
* @default true
|
|
8
|
+
*/
|
|
9
|
+
allowNegative?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Limits the number of digits that are displayed after the decimal point
|
|
12
|
+
* @default Infinity
|
|
13
|
+
*/
|
|
14
|
+
decimalScale?: number;
|
|
15
|
+
/** Character used as a decimal separator, `'.'` by default */
|
|
16
|
+
decimalSeparator?: string;
|
|
17
|
+
/**
|
|
18
|
+
* If set, zeros are added after `decimalSeparator` to match given `decimalScale`.
|
|
19
|
+
* @default false
|
|
20
|
+
*/
|
|
21
|
+
fixedDecimalScale?: boolean;
|
|
22
|
+
/** Prefix added before the value */
|
|
23
|
+
prefix?: string;
|
|
24
|
+
/** Suffix added after the value */
|
|
25
|
+
suffix?: string;
|
|
26
|
+
/** Defines the thousand grouping style */
|
|
27
|
+
thousandsGroupStyle?: 'thousand' | 'lakh' | 'wan' | 'none';
|
|
28
|
+
/** A character used to separate thousands
|
|
29
|
+
* @default ','
|
|
30
|
+
*/
|
|
31
|
+
thousandSeparator?: string | boolean;
|
|
32
|
+
}
|
|
33
|
+
export type NumberFormatterFactory = Factory<{
|
|
34
|
+
props: NumberFormatterProps;
|
|
35
|
+
ref: HTMLDivElement;
|
|
36
|
+
}>;
|
package/package.json
CHANGED