@cck-ui/core 0.37.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/indicator/indicator.cjs +1 -1
- package/cjs/components/indicator/indicator.cjs.map +1 -1
- package/cjs/components/kbd/index.cjs +14 -0
- package/cjs/components/kbd/index.cjs.map +1 -0
- package/cjs/components/kbd/kbd.cjs +396 -0
- package/cjs/components/kbd/kbd.cjs.map +1 -0
- package/cjs/components/kbd/kbd.module.cjs +7 -0
- package/cjs/components/kbd/kbd.module.cjs.map +1 -0
- package/cjs/components/kbd/kbd.utils.cjs +8 -0
- package/cjs/components/kbd/kbd.utils.cjs.map +1 -0
- 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 +35 -29
- package/cjs/index.cjs.map +1 -1
- package/esm/components/indicator/indicator.mjs +1 -1
- package/esm/components/indicator/indicator.mjs.map +1 -1
- package/esm/components/kbd/index.mjs +11 -0
- package/esm/components/kbd/index.mjs.map +1 -0
- package/esm/components/kbd/kbd.mjs +396 -0
- package/esm/components/kbd/kbd.mjs.map +1 -0
- package/esm/components/kbd/kbd.module.mjs +7 -0
- package/esm/components/kbd/kbd.module.mjs.map +1 -0
- package/esm/components/kbd/kbd.utils.mjs +9 -0
- package/esm/components/kbd/kbd.utils.mjs.map +1 -0
- 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 +5 -1
- package/esm/index.mjs.map +1 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/kbd/index.d.ts +6 -0
- package/lib/components/kbd/kbd.types.d.ts +18 -0
- package/lib/components/kbd/kbd.utils.d.ts +6 -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
- package/styles/kbd.css +31 -0
- package/styles/kbd.layer.css +32 -0
- package/styles.css +32 -0
- package/styles.layer.css +32 -0
|
@@ -434,7 +434,7 @@ const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
|
434
434
|
const indicatorAttrs = (0, vue.computed)(() => getStyles("indicator"));
|
|
435
435
|
const mergedIndicatorAttrs = (0, vue.computed)(() => ({
|
|
436
436
|
mod: [
|
|
437
|
-
{ "with-label": !!props.value.label },
|
|
437
|
+
{ "with-label": !!props.value.label || !!slots.label },
|
|
438
438
|
{ "with-border": props.value.withBorder },
|
|
439
439
|
{ processing: props.value.processing }
|
|
440
440
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"indicator.cjs","names":[],"sources":["../../../src/components/indicator/indicator.vue"],"sourcesContent":["<template>\n <c-box ref=\"_root\" v-bind=\"mergedRootAttrs\">\n <c-box ref=\"_indicator\" v-bind=\"mergedIndicatorAttrs\" v-if=\"!props.disabled && !shouldHideZero\">\n <slot name=\"label\">\n <span v-html=\"formattedLabel\" v-if=\"formattedLabel != null\"></span>\n </slot>\n </c-box>\n <slot />\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useSlots } from 'vue'\nimport { CBox, CStyleProp, isNumber, useComponentProps, useStyles } from '../../core'\nimport { IndicatorFactory, IndicatorProps } from './indicator.types'\nimport classes from './indicator.module.css'\nimport { varsResolver } from './indicator.utils'\n\ndefineOptions({\n name: 'CIndicator',\n})\n\nconst _root = ref<InstanceType<typeof CBox> | null>(null)\nconst _indicator = ref<InstanceType<typeof CBox> | null>(null)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\n\nconst rawProps = defineProps<IndicatorProps>()\n\nconst defaultProps = {\n position: 'top-end',\n offset: 0,\n showZero: true,\n} satisfies Partial<IndicatorProps>\n\nconst props = useComponentProps({\n component: 'CIndicator',\n defaultProps,\n props: rawProps,\n})\n\nconst styleProps = computed(() => ({\n ...props.value,\n ...attrs,\n style: (attrs.style ?? props.value.style) as CStyleProp,\n}))\n\nconst knownProps = [\n 'style',\n 'className',\n 'styles',\n 'classNames',\n 'unstyled',\n 'vars',\n 'position',\n 'offset',\n 'inline',\n 'label',\n 'radius',\n 'color',\n 'withBorder',\n 'disabled',\n 'processing',\n 'zIndex',\n 'autoContrast',\n 'maxValue',\n 'showZero',\n 'mod',\n 'attributes',\n]\n\nconst getStyles = useStyles<IndicatorFactory>({\n name: 'Indicator',\n classes,\n props: styleProps,\n className: () => props.value.className,\n style: () => props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n unstyled: props.value.unstyled,\n attributes: props.value.attributes,\n vars: props.value.vars,\n varsResolver,\n})\n\nconst modList = computed(() => [{ inline: props.value.inline }])\n\nconst rootAttrs = computed(() => getStyles('root'))\nconst mergedRootAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n for (const key in propsValue) {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n }\n const userMod = props.value.mod\n const mergedMod = [...(Array.isArray(userMod) ? userMod : [userMod]), ...modList.value]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\nconst shouldHideZero = computed(() => !props.value.showZero && Number(props.value.label) === 0)\n\nconst formattedLabel = computed(() =>\n props.value.maxValue !== undefined &&\n isNumber(props.value.label) &&\n Number(props.value.label) > props.value.maxValue\n ? `${props.value.maxValue}+`\n : props.value.label\n)\n\nconst indicatorAttrs = computed(() => getStyles('indicator'))\nconst mergedIndicatorAttrs = computed(() => ({\n mod: [\n { 'with-label': !!props.value.label },\n { 'with-border': props.value.withBorder },\n { processing: props.value.processing },\n ],\n ...indicatorAttrs.value,\n}))\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n indicator: computed(() => _indicator.value?.root ?? null),\n})\n</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GACtB,YAAY,MAAM,MAAM;GACxB,MAAM,MAAM,MAAM;GAClB,cAAA,wBAAA;EACF,CAAC;EAED,MAAM,WAAA,GAAA,IAAA,SAAA,OAAyB,CAAC,EAAE,QAAQ,MAAM,MAAM,OAAO,CAAC,CAAC;EAE/D,MAAM,aAAA,GAAA,IAAA,SAAA,OAA2B,UAAU,MAAM,CAAC;EAClD,MAAM,mBAAA,GAAA,IAAA,SAAA,OAAiC;GACrC,MAAM,SAA8B,CAAC;GACrC,MAAM,aAAa,MAAM;GACzB,KAAK,MAAM,OAAO,YAChB,IAAI,CAAC,WAAW,SAAS,GAAG,GAC1B,OAAO,OAAO,WAAW;GAG7B,MAAM,UAAU,MAAM,MAAM;GAC5B,MAAM,YAAY,CAAC,GAAI,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO,GAAI,GAAG,QAAQ,KAAK;GACtF,OAAO;IAAE,GAAG;IAAQ,KAAK;IAAW,GAAG,UAAU;GAAM;EACzD,CAAC;EAED,MAAM,kBAAA,GAAA,IAAA,SAAA,OAAgC,CAAC,MAAM,MAAM,YAAY,OAAO,MAAM,MAAM,KAAK,MAAM,CAAC;EAE9F,MAAM,kBAAA,GAAA,IAAA,SAAA,OACJ,MAAM,MAAM,aAAa,KAAA,KACzB,cAAA,SAAS,MAAM,MAAM,KAAK,KAC1B,OAAO,MAAM,MAAM,KAAK,IAAI,MAAM,MAAM,WACpC,GAAG,MAAM,MAAM,SAAS,KACxB,MAAM,MAAM,KAClB;EAEA,MAAM,kBAAA,GAAA,IAAA,SAAA,OAAgC,UAAU,WAAW,CAAC;EAC5D,MAAM,wBAAA,GAAA,IAAA,SAAA,QAAuC;GAC3C,KAAK;IACH,EAAE,cAAc,CAAC,CAAC,MAAM,MAAM,MAAM;
|
|
1
|
+
{"version":3,"file":"indicator.cjs","names":[],"sources":["../../../src/components/indicator/indicator.vue"],"sourcesContent":["<template>\n <c-box ref=\"_root\" v-bind=\"mergedRootAttrs\">\n <c-box ref=\"_indicator\" v-bind=\"mergedIndicatorAttrs\" v-if=\"!props.disabled && !shouldHideZero\">\n <slot name=\"label\">\n <span v-html=\"formattedLabel\" v-if=\"formattedLabel != null\"></span>\n </slot>\n </c-box>\n <slot />\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs, useSlots } from 'vue'\nimport { CBox, CStyleProp, isNumber, useComponentProps, useStyles } from '../../core'\nimport { IndicatorFactory, IndicatorProps } from './indicator.types'\nimport classes from './indicator.module.css'\nimport { varsResolver } from './indicator.utils'\n\ndefineOptions({\n name: 'CIndicator',\n})\n\nconst _root = ref<InstanceType<typeof CBox> | null>(null)\nconst _indicator = ref<InstanceType<typeof CBox> | null>(null)\n\nconst attrs = useAttrs()\nconst slots = useSlots()\n\nconst rawProps = defineProps<IndicatorProps>()\n\nconst defaultProps = {\n position: 'top-end',\n offset: 0,\n showZero: true,\n} satisfies Partial<IndicatorProps>\n\nconst props = useComponentProps({\n component: 'CIndicator',\n defaultProps,\n props: rawProps,\n})\n\nconst styleProps = computed(() => ({\n ...props.value,\n ...attrs,\n style: (attrs.style ?? props.value.style) as CStyleProp,\n}))\n\nconst knownProps = [\n 'style',\n 'className',\n 'styles',\n 'classNames',\n 'unstyled',\n 'vars',\n 'position',\n 'offset',\n 'inline',\n 'label',\n 'radius',\n 'color',\n 'withBorder',\n 'disabled',\n 'processing',\n 'zIndex',\n 'autoContrast',\n 'maxValue',\n 'showZero',\n 'mod',\n 'attributes',\n]\n\nconst getStyles = useStyles<IndicatorFactory>({\n name: 'Indicator',\n classes,\n props: styleProps,\n className: () => props.value.className,\n style: () => props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n unstyled: props.value.unstyled,\n attributes: props.value.attributes,\n vars: props.value.vars,\n varsResolver,\n})\n\nconst modList = computed(() => [{ inline: props.value.inline }])\n\nconst rootAttrs = computed(() => getStyles('root'))\nconst mergedRootAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n for (const key in propsValue) {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n }\n const userMod = props.value.mod\n const mergedMod = [...(Array.isArray(userMod) ? userMod : [userMod]), ...modList.value]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\nconst shouldHideZero = computed(() => !props.value.showZero && Number(props.value.label) === 0)\n\nconst formattedLabel = computed(() =>\n props.value.maxValue !== undefined &&\n isNumber(props.value.label) &&\n Number(props.value.label) > props.value.maxValue\n ? `${props.value.maxValue}+`\n : props.value.label\n)\n\nconst indicatorAttrs = computed(() => getStyles('indicator'))\nconst mergedIndicatorAttrs = computed(() => ({\n mod: [\n { 'with-label': !!props.value.label || !!slots.label },\n { 'with-border': props.value.withBorder },\n { processing: props.value.processing },\n ],\n ...indicatorAttrs.value,\n}))\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n indicator: computed(() => _indicator.value?.root ?? null),\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBA,MAAM,SAAA,GAAA,IAAA,IAAA,CAA8C,IAAI;EACxD,MAAM,cAAA,GAAA,IAAA,IAAA,CAAmD,IAAI;EAE7D,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EACvB,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EAEvB,MAAM,WAAW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A,QAAA,SAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
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_kbd_module = require("./kbd.module.cjs");
|
|
5
|
+
const require_kbd_utils = require("./kbd.utils.cjs");
|
|
6
|
+
const require_kbd = require("./kbd.cjs");
|
|
7
|
+
//#region packages/@cck-ui/core/src/components/kbd/index.ts
|
|
8
|
+
const KbdWithStatic = require_statics.withPropsFactory(require_statics.withExtend(require_statics.withVarsResolver(require_statics.withClasses(require_kbd.default, require_kbd_module.default), require_kbd_utils.varsResolver)));
|
|
9
|
+
const CKbd = require_install.withInstall(KbdWithStatic);
|
|
10
|
+
//#endregion
|
|
11
|
+
exports.CKbd = CKbd;
|
|
12
|
+
exports.default = CKbd;
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["withPropsFactory","withExtend","withVarsResolver","withClasses","Kbd","classes","varsResolver","withInstall"],"sources":["../../../src/components/kbd/index.ts"],"sourcesContent":["import {\n SFCWithInstallAndClasses,\n withClasses,\n withExtend,\n withInstall,\n withPropsFactory,\n withVarsResolver,\n} from '../../core'\nimport classes from './kbd.module.css'\nimport { varsResolver } from './kbd.utils'\nimport Kbd from './kbd.vue'\n\nconst KbdWithStatic = withPropsFactory(\n withExtend(withVarsResolver(withClasses(Kbd, classes), varsResolver))\n)\n\nexport const CKbd: SFCWithInstallAndClasses<typeof Kbd, typeof classes> = withInstall(KbdWithStatic)\n\nexport default CKbd\n\nexport * from './kbd.types'\n"],"mappings":";;;;;;;AAYA,MAAM,gBAAgBA,gBAAAA,iBACpBC,gBAAAA,WAAWC,gBAAAA,iBAAiBC,gBAAAA,YAAYC,YAAAA,SAAKC,mBAAAA,OAAO,GAAGC,kBAAAA,YAAY,CAAC,CACtE;AAEA,MAAa,OAA6DC,gBAAAA,YAAY,aAAa"}
|
|
@@ -0,0 +1,396 @@
|
|
|
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
|
+
const require_index = require("../../core/box/index.cjs");
|
|
5
|
+
const require_use_styles = require("../../core/styles-api/use-styles/use-styles.cjs");
|
|
6
|
+
const require_kbd_module = require("./kbd.module.cjs");
|
|
7
|
+
const require_kbd_utils = require("./kbd.utils.cjs");
|
|
8
|
+
let vue = require("vue");
|
|
9
|
+
//#region packages/@cck-ui/core/src/components/kbd/kbd.vue
|
|
10
|
+
const _sfc_main = /*@__PURE__*/ (0, vue.defineComponent)({
|
|
11
|
+
name: "CKbd",
|
|
12
|
+
__name: "kbd",
|
|
13
|
+
props: {
|
|
14
|
+
size: {
|
|
15
|
+
type: [
|
|
16
|
+
String,
|
|
17
|
+
Number,
|
|
18
|
+
Object
|
|
19
|
+
],
|
|
20
|
+
required: false
|
|
21
|
+
},
|
|
22
|
+
className: {
|
|
23
|
+
type: String,
|
|
24
|
+
required: false
|
|
25
|
+
},
|
|
26
|
+
style: {
|
|
27
|
+
type: [
|
|
28
|
+
Object,
|
|
29
|
+
Function,
|
|
30
|
+
Array
|
|
31
|
+
],
|
|
32
|
+
required: false,
|
|
33
|
+
skipCheck: true
|
|
34
|
+
},
|
|
35
|
+
__vars: {
|
|
36
|
+
type: null,
|
|
37
|
+
required: false
|
|
38
|
+
},
|
|
39
|
+
__size: {
|
|
40
|
+
type: String,
|
|
41
|
+
required: false
|
|
42
|
+
},
|
|
43
|
+
hiddenFrom: {
|
|
44
|
+
type: null,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
visibleFrom: {
|
|
48
|
+
type: null,
|
|
49
|
+
required: false
|
|
50
|
+
},
|
|
51
|
+
lightHidden: {
|
|
52
|
+
type: Boolean,
|
|
53
|
+
required: false
|
|
54
|
+
},
|
|
55
|
+
darkHidden: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
required: false
|
|
58
|
+
},
|
|
59
|
+
mod: {
|
|
60
|
+
type: [
|
|
61
|
+
Object,
|
|
62
|
+
String,
|
|
63
|
+
Array
|
|
64
|
+
],
|
|
65
|
+
required: false
|
|
66
|
+
},
|
|
67
|
+
m: {
|
|
68
|
+
type: null,
|
|
69
|
+
required: false
|
|
70
|
+
},
|
|
71
|
+
my: {
|
|
72
|
+
type: null,
|
|
73
|
+
required: false
|
|
74
|
+
},
|
|
75
|
+
mx: {
|
|
76
|
+
type: null,
|
|
77
|
+
required: false
|
|
78
|
+
},
|
|
79
|
+
mt: {
|
|
80
|
+
type: null,
|
|
81
|
+
required: false
|
|
82
|
+
},
|
|
83
|
+
mb: {
|
|
84
|
+
type: null,
|
|
85
|
+
required: false
|
|
86
|
+
},
|
|
87
|
+
ms: {
|
|
88
|
+
type: null,
|
|
89
|
+
required: false
|
|
90
|
+
},
|
|
91
|
+
me: {
|
|
92
|
+
type: null,
|
|
93
|
+
required: false
|
|
94
|
+
},
|
|
95
|
+
mis: {
|
|
96
|
+
type: null,
|
|
97
|
+
required: false
|
|
98
|
+
},
|
|
99
|
+
mie: {
|
|
100
|
+
type: null,
|
|
101
|
+
required: false
|
|
102
|
+
},
|
|
103
|
+
ml: {
|
|
104
|
+
type: null,
|
|
105
|
+
required: false
|
|
106
|
+
},
|
|
107
|
+
mr: {
|
|
108
|
+
type: null,
|
|
109
|
+
required: false
|
|
110
|
+
},
|
|
111
|
+
p: {
|
|
112
|
+
type: null,
|
|
113
|
+
required: false
|
|
114
|
+
},
|
|
115
|
+
py: {
|
|
116
|
+
type: null,
|
|
117
|
+
required: false
|
|
118
|
+
},
|
|
119
|
+
px: {
|
|
120
|
+
type: null,
|
|
121
|
+
required: false
|
|
122
|
+
},
|
|
123
|
+
pt: {
|
|
124
|
+
type: null,
|
|
125
|
+
required: false
|
|
126
|
+
},
|
|
127
|
+
pb: {
|
|
128
|
+
type: null,
|
|
129
|
+
required: false
|
|
130
|
+
},
|
|
131
|
+
ps: {
|
|
132
|
+
type: null,
|
|
133
|
+
required: false
|
|
134
|
+
},
|
|
135
|
+
pe: {
|
|
136
|
+
type: null,
|
|
137
|
+
required: false
|
|
138
|
+
},
|
|
139
|
+
pis: {
|
|
140
|
+
type: null,
|
|
141
|
+
required: false
|
|
142
|
+
},
|
|
143
|
+
pie: {
|
|
144
|
+
type: null,
|
|
145
|
+
required: false
|
|
146
|
+
},
|
|
147
|
+
pl: {
|
|
148
|
+
type: null,
|
|
149
|
+
required: false
|
|
150
|
+
},
|
|
151
|
+
pr: {
|
|
152
|
+
type: null,
|
|
153
|
+
required: false
|
|
154
|
+
},
|
|
155
|
+
bd: {
|
|
156
|
+
type: null,
|
|
157
|
+
required: false
|
|
158
|
+
},
|
|
159
|
+
bdrs: {
|
|
160
|
+
type: null,
|
|
161
|
+
required: false
|
|
162
|
+
},
|
|
163
|
+
bg: {
|
|
164
|
+
type: null,
|
|
165
|
+
required: false
|
|
166
|
+
},
|
|
167
|
+
c: {
|
|
168
|
+
type: null,
|
|
169
|
+
required: false
|
|
170
|
+
},
|
|
171
|
+
opacity: {
|
|
172
|
+
type: [
|
|
173
|
+
String,
|
|
174
|
+
Object,
|
|
175
|
+
Number
|
|
176
|
+
],
|
|
177
|
+
required: false
|
|
178
|
+
},
|
|
179
|
+
ff: {
|
|
180
|
+
type: [String, Object],
|
|
181
|
+
required: false
|
|
182
|
+
},
|
|
183
|
+
fz: {
|
|
184
|
+
type: null,
|
|
185
|
+
required: false
|
|
186
|
+
},
|
|
187
|
+
fw: {
|
|
188
|
+
type: null,
|
|
189
|
+
required: false
|
|
190
|
+
},
|
|
191
|
+
lts: {
|
|
192
|
+
type: null,
|
|
193
|
+
required: false
|
|
194
|
+
},
|
|
195
|
+
ta: {
|
|
196
|
+
type: [String, Object],
|
|
197
|
+
required: false
|
|
198
|
+
},
|
|
199
|
+
lh: {
|
|
200
|
+
type: null,
|
|
201
|
+
required: false
|
|
202
|
+
},
|
|
203
|
+
fs: {
|
|
204
|
+
type: null,
|
|
205
|
+
required: false
|
|
206
|
+
},
|
|
207
|
+
tt: {
|
|
208
|
+
type: [String, Object],
|
|
209
|
+
required: false
|
|
210
|
+
},
|
|
211
|
+
td: {
|
|
212
|
+
type: null,
|
|
213
|
+
required: false
|
|
214
|
+
},
|
|
215
|
+
w: {
|
|
216
|
+
type: null,
|
|
217
|
+
required: false
|
|
218
|
+
},
|
|
219
|
+
miw: {
|
|
220
|
+
type: null,
|
|
221
|
+
required: false
|
|
222
|
+
},
|
|
223
|
+
maw: {
|
|
224
|
+
type: null,
|
|
225
|
+
required: false
|
|
226
|
+
},
|
|
227
|
+
h: {
|
|
228
|
+
type: null,
|
|
229
|
+
required: false
|
|
230
|
+
},
|
|
231
|
+
mih: {
|
|
232
|
+
type: null,
|
|
233
|
+
required: false
|
|
234
|
+
},
|
|
235
|
+
mah: {
|
|
236
|
+
type: null,
|
|
237
|
+
required: false
|
|
238
|
+
},
|
|
239
|
+
bgsz: {
|
|
240
|
+
type: null,
|
|
241
|
+
required: false
|
|
242
|
+
},
|
|
243
|
+
bgp: {
|
|
244
|
+
type: null,
|
|
245
|
+
required: false
|
|
246
|
+
},
|
|
247
|
+
bgr: {
|
|
248
|
+
type: null,
|
|
249
|
+
required: false
|
|
250
|
+
},
|
|
251
|
+
bga: {
|
|
252
|
+
type: null,
|
|
253
|
+
required: false
|
|
254
|
+
},
|
|
255
|
+
pos: {
|
|
256
|
+
type: [String, Object],
|
|
257
|
+
required: false
|
|
258
|
+
},
|
|
259
|
+
top: {
|
|
260
|
+
type: null,
|
|
261
|
+
required: false
|
|
262
|
+
},
|
|
263
|
+
left: {
|
|
264
|
+
type: null,
|
|
265
|
+
required: false
|
|
266
|
+
},
|
|
267
|
+
bottom: {
|
|
268
|
+
type: null,
|
|
269
|
+
required: false
|
|
270
|
+
},
|
|
271
|
+
right: {
|
|
272
|
+
type: null,
|
|
273
|
+
required: false
|
|
274
|
+
},
|
|
275
|
+
inset: {
|
|
276
|
+
type: null,
|
|
277
|
+
required: false
|
|
278
|
+
},
|
|
279
|
+
display: {
|
|
280
|
+
type: null,
|
|
281
|
+
required: false
|
|
282
|
+
},
|
|
283
|
+
flex: {
|
|
284
|
+
type: null,
|
|
285
|
+
required: false
|
|
286
|
+
},
|
|
287
|
+
unstyled: {
|
|
288
|
+
type: Boolean,
|
|
289
|
+
required: false
|
|
290
|
+
},
|
|
291
|
+
variant: {
|
|
292
|
+
type: null,
|
|
293
|
+
required: false
|
|
294
|
+
},
|
|
295
|
+
classNames: {
|
|
296
|
+
type: null,
|
|
297
|
+
required: false
|
|
298
|
+
},
|
|
299
|
+
styles: {
|
|
300
|
+
type: null,
|
|
301
|
+
required: false
|
|
302
|
+
},
|
|
303
|
+
vars: {
|
|
304
|
+
type: Function,
|
|
305
|
+
required: false
|
|
306
|
+
},
|
|
307
|
+
attributes: {
|
|
308
|
+
type: null,
|
|
309
|
+
required: false
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
setup(__props, { expose: __expose }) {
|
|
313
|
+
const _root = (0, vue.ref)(null);
|
|
314
|
+
const attrs = (0, vue.useAttrs)();
|
|
315
|
+
const rawProps = __props;
|
|
316
|
+
const props = require_use_component_props.useComponentProps({
|
|
317
|
+
component: "CKbd",
|
|
318
|
+
defaultProps: {},
|
|
319
|
+
props: rawProps
|
|
320
|
+
});
|
|
321
|
+
const knownProps = [
|
|
322
|
+
"classNames",
|
|
323
|
+
"className",
|
|
324
|
+
"style",
|
|
325
|
+
"styles",
|
|
326
|
+
"unstyled",
|
|
327
|
+
"vars",
|
|
328
|
+
"attributes"
|
|
329
|
+
];
|
|
330
|
+
const styleProps = (0, vue.computed)(() => ({
|
|
331
|
+
...props.value,
|
|
332
|
+
...attrs,
|
|
333
|
+
style: attrs.style ?? props.value.style
|
|
334
|
+
}));
|
|
335
|
+
const getStyles = require_use_styles.useStyles({
|
|
336
|
+
name: "Kbd",
|
|
337
|
+
props: styleProps,
|
|
338
|
+
classes: require_kbd_module.default,
|
|
339
|
+
className: () => props.value.className,
|
|
340
|
+
style: () => props.value.style,
|
|
341
|
+
classNames: props.value.classNames,
|
|
342
|
+
styles: props.value.styles,
|
|
343
|
+
unstyled: props.value.unstyled,
|
|
344
|
+
attributes: props.value.attributes,
|
|
345
|
+
vars: props.value.vars,
|
|
346
|
+
varsResolver: require_kbd_utils.varsResolver
|
|
347
|
+
});
|
|
348
|
+
const rootAttrs = (0, vue.computed)(() => getStyles("root"));
|
|
349
|
+
const mergedAttrs = (0, vue.computed)(() => {
|
|
350
|
+
const others = {};
|
|
351
|
+
const propsValue = props.value;
|
|
352
|
+
for (const key in propsValue) if (!knownProps.includes(key)) others[key] = propsValue[key];
|
|
353
|
+
const userMod = props.value.mod;
|
|
354
|
+
const mergedMod = [...Array.isArray(userMod) ? userMod : [userMod]];
|
|
355
|
+
return {
|
|
356
|
+
...others,
|
|
357
|
+
mod: mergedMod,
|
|
358
|
+
...rootAttrs.value
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
__expose({ root: (0, vue.computed)(() => _root.value?.root ?? null) });
|
|
362
|
+
const __returned__ = {
|
|
363
|
+
_root,
|
|
364
|
+
attrs,
|
|
365
|
+
rawProps,
|
|
366
|
+
props,
|
|
367
|
+
knownProps,
|
|
368
|
+
styleProps,
|
|
369
|
+
getStyles,
|
|
370
|
+
rootAttrs,
|
|
371
|
+
mergedAttrs,
|
|
372
|
+
get CBox() {
|
|
373
|
+
return require_index.CBox;
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
377
|
+
enumerable: false,
|
|
378
|
+
value: true
|
|
379
|
+
});
|
|
380
|
+
return __returned__;
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
384
|
+
return (0, vue.openBlock)(), (0, vue.createBlock)($setup["CBox"], (0, vue.mergeProps)({
|
|
385
|
+
ref: "_root",
|
|
386
|
+
tag: "kbd"
|
|
387
|
+
}, $setup.mergedAttrs), {
|
|
388
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
389
|
+
_: 3
|
|
390
|
+
}, 16);
|
|
391
|
+
}
|
|
392
|
+
var kbd_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/kbd/kbd.vue"]]);
|
|
393
|
+
//#endregion
|
|
394
|
+
exports.default = kbd_default;
|
|
395
|
+
|
|
396
|
+
//# sourceMappingURL=kbd.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd.cjs","names":[],"sources":["../../../src/components/kbd/kbd.vue"],"sourcesContent":["<template>\n <c-box ref=\"_root\" tag=\"kbd\" v-bind=\"mergedAttrs\">\n <slot />\n </c-box>\n</template>\n\n<script setup lang=\"ts\">\nimport { computed, ref, useAttrs } from 'vue'\nimport { CBox, CStyleProp, useComponentProps, useStyles } from '../../core'\nimport classes from './kbd.module.css'\nimport { KbdFactory, KbdProps } from './kbd.types'\nimport { varsResolver } from './kbd.utils'\n\ndefineOptions({\n name: 'CKbd',\n})\n\nconst _root = ref<InstanceType<typeof CBox> | null>(null)\n\nconst attrs = useAttrs()\n\nconst rawProps = defineProps<KbdProps>()\n\nconst props = useComponentProps({\n component: 'CKbd',\n defaultProps: {},\n props: rawProps,\n})\n\nconst knownProps = ['classNames', 'className', 'style', 'styles', 'unstyled', 'vars', 'attributes']\n\nconst styleProps = computed(() => ({\n ...props.value,\n ...attrs,\n style: (attrs.style ?? props.value.style) as CStyleProp,\n}))\n\nconst getStyles = useStyles<KbdFactory>({\n name: 'Kbd',\n props: styleProps,\n classes,\n className: () => props.value.className,\n style: () => props.value.style,\n classNames: props.value.classNames,\n styles: props.value.styles,\n unstyled: props.value.unstyled,\n attributes: props.value.attributes,\n vars: props.value.vars,\n varsResolver,\n})\n\nconst rootAttrs = computed(() => getStyles('root'))\n\nconst mergedAttrs = computed(() => {\n const others: Record<string, any> = {}\n const propsValue = props.value\n for (const key in propsValue) {\n if (!knownProps.includes(key)) {\n others[key] = propsValue[key as keyof typeof propsValue]\n }\n }\n const userMod = props.value.mod\n const mergedMod = [...(Array.isArray(userMod) ? userMod : [userMod])]\n return { ...others, mod: mergedMod, ...rootAttrs.value }\n})\n\ndefineExpose({\n root: computed(() => _root.value?.root ?? null),\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiBA,MAAM,SAAA,GAAA,IAAA,IAAA,CAA8C,IAAI;EAExD,MAAM,SAAA,GAAA,IAAA,SAAA,CAAiB;EAEvB,MAAM,WAAW;EAEjB,MAAM,QAAQ,4BAAA,kBAAkB;GAC9B,WAAW;GACX,cAAc,CAAC;GACf,OAAO;EACT,CAAC;EAED,MAAM,aAAa;GAAC;GAAc;GAAa;GAAS;GAAU;GAAY;GAAQ;EAAY;EAElG,MAAM,cAAA,GAAA,IAAA,SAAA,QAA6B;GACjC,GAAG,MAAM;GACT,GAAG;GACH,OAAQ,MAAM,SAAS,MAAM,MAAM;EACrC,EAAE;EAEF,MAAM,YAAY,mBAAA,UAAsB;GACtC,MAAM;GACN,OAAO;GACP,SAAA,mBAAA;GACA,iBAAiB,MAAM,MAAM;GAC7B,aAAa,MAAM,MAAM;GACzB,YAAY,MAAM,MAAM;GACxB,QAAQ,MAAM,MAAM;GACpB,UAAU,MAAM,MAAM;GACtB,YAAY,MAAM,MAAM;GACxB,MAAM,MAAM,MAAM;GAClB,cAAA,kBAAA;EACF,CAAC;EAED,MAAM,aAAA,GAAA,IAAA,SAAA,OAA2B,UAAU,MAAM,CAAC;EAElD,MAAM,eAAA,GAAA,IAAA,SAAA,OAA6B;GACjC,MAAM,SAA8B,CAAC;GACrC,MAAM,aAAa,MAAM;GACzB,KAAK,MAAM,OAAO,YAChB,IAAI,CAAC,WAAW,SAAS,GAAG,GAC1B,OAAO,OAAO,WAAW;GAG7B,MAAM,UAAU,MAAM,MAAM;GAC5B,MAAM,YAAY,CAAC,GAAI,MAAM,QAAQ,OAAO,IAAI,UAAU,CAAC,OAAO,CAAE;GACpE,OAAO;IAAE,GAAG;IAAQ,KAAK;IAAW,GAAG,UAAU;GAAM;EACzD,CAAC;EAED,SAAa,EACX,OAAA,GAAA,IAAA,SAAA,OAAqB,MAAM,OAAO,QAAQ,IAAI,EAChD,CAAC;;;;;;;;;;;;;;;;;;;;;;;mDAjES,OAAA,UAAA,GAAA,IAAA,WAAA,CAAA;EAFD,KAAI;EAAQ,KAAI;IAAc,OAAA,WAAW,GAAA;kCACtC,EAAA,GAAA,IAAA,WAAA,CAAA,KAAA,QAAA,SAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd.module.cjs","names":[],"sources":["../../../src/components/kbd/kbd.module.css"],"sourcesContent":[".root {\n --kbd-fz-xs: 10px;\n --kbd-fz-sm: 12px;\n --kbd-fz-md: 14px;\n --kbd-fz-lg: 16px;\n --kbd-fz-xl: 20px;\n --kbd-fz: var(--kbd-fz-sm);\n\n font-family: var(--c-font-family-monospace);\n line-height: var(--c-line-height);\n font-weight: var(--c-font-weight-bold);\n font-size: var(--kbd-fz);\n border-radius: var(--c-radius-sm);\n border: 1px solid;\n border-bottom-width: 3px;\n unicode-bidi: embed;\n text-align: center;\n padding: 0.12em 0.45em;\n\n @mixin where-light {\n border-color: var(--c-color-gray-3);\n color: var(--c-color-gray-7);\n background-color: var(--c-color-gray-0);\n }\n\n @mixin where-dark {\n border-color: var(--c-color-dark-4);\n color: var(--c-color-dark-0);\n background-color: var(--c-color-dark-6);\n }\n}\n"],"mappings":";;AAAA,IAAA,qBAAe,EAAC,QAAO,aAAY"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
const require_get_size = require("../../core/utils/get-size/get-size.cjs");
|
|
3
|
+
//#region packages/@cck-ui/core/src/components/kbd/kbd.utils.ts
|
|
4
|
+
const varsResolver = require("../../core/styles-api/create-vars-resolver/create-vars-resolver.cjs").createVarsResolver((_, { size }) => ({ root: { "--kbd-fz": require_get_size.getSize(size, "kbd-fz") } }));
|
|
5
|
+
//#endregion
|
|
6
|
+
exports.varsResolver = varsResolver;
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=kbd.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kbd.utils.cjs","names":["createVarsResolver","getSize"],"sources":["../../../src/components/kbd/kbd.utils.ts"],"sourcesContent":["import { createVarsResolver, getSize } from '../../core'\nimport { KbdFactory } from './kbd.types'\n\nexport const varsResolver = createVarsResolver<KbdFactory>((_, { size }) => ({\n root: {\n '--kbd-fz': getSize(size, 'kbd-fz'),\n },\n}))\n"],"mappings":";;;AAGA,MAAa,4FAAeA,CAAAA,CAAAA,oBAAgC,GAAG,EAAE,YAAY,EAC3E,MAAM,EACJ,YAAYC,iBAAAA,QAAQ,MAAM,QAAQ,EACpC,EACF,EAAE"}
|
|
@@ -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":";;;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