Skip to content

Commit 1f20b55

Browse files
📦 El Package
1 parent cbfddd1 commit 1f20b55

File tree

2 files changed

+288
-0
lines changed

2 files changed

+288
-0
lines changed

dist/vue-intl-numberformat.esm.js

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
//
2+
//
3+
//
4+
5+
var script = {
6+
name: 'VueIntlNumberformat',
7+
props: {
8+
locale: {
9+
type: String,
10+
default: 'en-US',
11+
required: false
12+
},
13+
formatStyle: {
14+
type: String,
15+
default: 'decimal',
16+
required: false
17+
},
18+
currency: {
19+
type: String,
20+
required: false
21+
},
22+
maxDigits: {
23+
type: Number,
24+
required: false
25+
},
26+
number: {
27+
type: Number,
28+
required: true
29+
}
30+
},
31+
computed: {
32+
localeString() {
33+
const t = this;
34+
return new Intl.NumberFormat(`${t.locale}`, {
35+
style: `${t.formatStyle}`,
36+
currency: `${t.currency}`,
37+
maximumSignificantDigits: t.maxDigits
38+
}).format(t.number);
39+
}
40+
}
41+
};
42+
43+
const __vue_script__ = script;
44+
45+
/* template */
46+
var __vue_render__ = function () {
47+
var _vm = this;
48+
var _h = _vm.$createElement;
49+
var _c = _vm._self._c || _h;
50+
return _c("span", [_vm._v(_vm._s(_vm.localeString))]);
51+
};
52+
var __vue_staticRenderFns__ = [];
53+
__vue_render__._withStripped = true;
54+
55+
const __vue_template__ = typeof __vue_render__ !== 'undefined' ? { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ } : {};
56+
/* style */
57+
const __vue_inject_styles__ = undefined;
58+
/* scoped */
59+
const __vue_scope_id__ = undefined;
60+
/* module identifier */
61+
const __vue_module_identifier__ = undefined;
62+
/* functional template */
63+
const __vue_is_functional_template__ = false;
64+
/* component normalizer */
65+
function __vue_normalize__(template, style, script$$1, scope, functional, moduleIdentifier, createInjector, createInjectorSSR) {
66+
const component = (typeof script$$1 === 'function' ? script$$1.options : script$$1) || {};
67+
68+
{
69+
component.__file = "/Users/vinayak/Development/Personal/vue-intl-numberformat/src/VueIntlNumberformat.vue";
70+
}
71+
72+
if (!component.render) {
73+
component.render = template.render;
74+
component.staticRenderFns = template.staticRenderFns;
75+
component._compiled = true;
76+
77+
if (functional) component.functional = true;
78+
}
79+
80+
component._scopeId = scope;
81+
82+
return component;
83+
}
84+
/* style inject */
85+
function __vue_create_injector__() {
86+
const head = document.head || document.getElementsByTagName('head')[0];
87+
const styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {});
88+
const isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
89+
90+
return function addStyle(id, css) {
91+
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) return; // SSR styles are present.
92+
93+
const group = isOldIE ? css.media || 'default' : id;
94+
const style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined });
95+
96+
if (!style.ids.includes(id)) {
97+
let code = css.source;
98+
let index = style.ids.length;
99+
100+
style.ids.push(id);
101+
102+
if (isOldIE) {
103+
style.element = style.element || document.querySelector('style[data-group=' + group + ']');
104+
}
105+
106+
if (!style.element) {
107+
const el = style.element = document.createElement('style');
108+
el.type = 'text/css';
109+
110+
if (css.media) el.setAttribute('media', css.media);
111+
if (isOldIE) {
112+
el.setAttribute('data-group', group);
113+
el.setAttribute('data-next-index', '0');
114+
}
115+
116+
head.appendChild(el);
117+
}
118+
119+
if (isOldIE) {
120+
index = parseInt(style.element.getAttribute('data-next-index'));
121+
style.element.setAttribute('data-next-index', index + 1);
122+
}
123+
124+
if (style.element.styleSheet) {
125+
style.parts.push(code);
126+
style.element.styleSheet.cssText = style.parts.filter(Boolean).join('\n');
127+
} else {
128+
const textNode = document.createTextNode(code);
129+
const nodes = style.element.childNodes;
130+
if (nodes[index]) style.element.removeChild(nodes[index]);
131+
if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
132+
}
133+
}
134+
};
135+
}
136+
/* style inject SSR */
137+
138+
var VueIntlNumberformat = __vue_normalize__(__vue_template__, __vue_inject_styles__, typeof __vue_script__ === 'undefined' ? {} : __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, typeof __vue_create_injector__ !== 'undefined' ? __vue_create_injector__ : function () {}, typeof __vue_create_injector_ssr__ !== 'undefined' ? __vue_create_injector_ssr__ : function () {});
139+
140+
export default VueIntlNumberformat;

dist/vue-intl-numberformat.js

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
(function (global, factory) {
2+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
3+
typeof define === 'function' && define.amd ? define(factory) :
4+
(global.VueIntlNumberformat = factory());
5+
}(this, (function () { 'use strict';
6+
7+
//
8+
//
9+
//
10+
11+
var script = {
12+
name: 'VueIntlNumberformat',
13+
props: {
14+
locale: {
15+
type: String,
16+
default: 'en-US',
17+
required: false
18+
},
19+
formatStyle: {
20+
type: String,
21+
default: 'decimal',
22+
required: false
23+
},
24+
currency: {
25+
type: String,
26+
required: false
27+
},
28+
maxDigits: {
29+
type: Number,
30+
required: false
31+
},
32+
number: {
33+
type: Number,
34+
required: true
35+
}
36+
},
37+
computed: {
38+
localeString() {
39+
const t = this;
40+
return new Intl.NumberFormat(`${t.locale}`, {
41+
style: `${t.formatStyle}`,
42+
currency: `${t.currency}`,
43+
maximumSignificantDigits: t.maxDigits
44+
}).format(t.number);
45+
}
46+
}
47+
};
48+
49+
const __vue_script__ = script;
50+
51+
/* template */
52+
var __vue_render__ = function () {
53+
var _vm = this;
54+
var _h = _vm.$createElement;
55+
var _c = _vm._self._c || _h;
56+
return _c("span", [_vm._v(_vm._s(_vm.localeString))]);
57+
};
58+
var __vue_staticRenderFns__ = [];
59+
__vue_render__._withStripped = true;
60+
61+
const __vue_template__ = typeof __vue_render__ !== 'undefined' ? { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ } : {};
62+
/* style */
63+
const __vue_inject_styles__ = undefined;
64+
/* scoped */
65+
const __vue_scope_id__ = undefined;
66+
/* module identifier */
67+
const __vue_module_identifier__ = undefined;
68+
/* functional template */
69+
const __vue_is_functional_template__ = false;
70+
/* component normalizer */
71+
function __vue_normalize__(template, style, script$$1, scope, functional, moduleIdentifier, createInjector, createInjectorSSR) {
72+
const component = (typeof script$$1 === 'function' ? script$$1.options : script$$1) || {};
73+
74+
{
75+
component.__file = "/Users/vinayak/Development/Personal/vue-intl-numberformat/src/VueIntlNumberformat.vue";
76+
}
77+
78+
if (!component.render) {
79+
component.render = template.render;
80+
component.staticRenderFns = template.staticRenderFns;
81+
component._compiled = true;
82+
83+
if (functional) component.functional = true;
84+
}
85+
86+
component._scopeId = scope;
87+
88+
return component;
89+
}
90+
/* style inject */
91+
function __vue_create_injector__() {
92+
const head = document.head || document.getElementsByTagName('head')[0];
93+
const styles = __vue_create_injector__.styles || (__vue_create_injector__.styles = {});
94+
const isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\\b/.test(navigator.userAgent.toLowerCase());
95+
96+
return function addStyle(id, css) {
97+
if (document.querySelector('style[data-vue-ssr-id~="' + id + '"]')) return; // SSR styles are present.
98+
99+
const group = isOldIE ? css.media || 'default' : id;
100+
const style = styles[group] || (styles[group] = { ids: [], parts: [], element: undefined });
101+
102+
if (!style.ids.includes(id)) {
103+
let code = css.source;
104+
let index = style.ids.length;
105+
106+
style.ids.push(id);
107+
108+
if (isOldIE) {
109+
style.element = style.element || document.querySelector('style[data-group=' + group + ']');
110+
}
111+
112+
if (!style.element) {
113+
const el = style.element = document.createElement('style');
114+
el.type = 'text/css';
115+
116+
if (css.media) el.setAttribute('media', css.media);
117+
if (isOldIE) {
118+
el.setAttribute('data-group', group);
119+
el.setAttribute('data-next-index', '0');
120+
}
121+
122+
head.appendChild(el);
123+
}
124+
125+
if (isOldIE) {
126+
index = parseInt(style.element.getAttribute('data-next-index'));
127+
style.element.setAttribute('data-next-index', index + 1);
128+
}
129+
130+
if (style.element.styleSheet) {
131+
style.parts.push(code);
132+
style.element.styleSheet.cssText = style.parts.filter(Boolean).join('\n');
133+
} else {
134+
const textNode = document.createTextNode(code);
135+
const nodes = style.element.childNodes;
136+
if (nodes[index]) style.element.removeChild(nodes[index]);
137+
if (nodes.length) style.element.insertBefore(textNode, nodes[index]);else style.element.appendChild(textNode);
138+
}
139+
}
140+
};
141+
}
142+
/* style inject SSR */
143+
144+
var VueIntlNumberformat = __vue_normalize__(__vue_template__, __vue_inject_styles__, typeof __vue_script__ === 'undefined' ? {} : __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, typeof __vue_create_injector__ !== 'undefined' ? __vue_create_injector__ : function () {}, typeof __vue_create_injector_ssr__ !== 'undefined' ? __vue_create_injector_ssr__ : function () {});
145+
146+
return VueIntlNumberformat;
147+
148+
})));

0 commit comments

Comments
 (0)