@opentinyvue/vue-currency 2.21.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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ import Currency from './src/index';
2
+ export default Currency;
package/lib/index.js ADDED
@@ -0,0 +1,102 @@
1
+ function _extends() {
2
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
3
+ for (var e = 1; e < arguments.length; e++) {
4
+ var t = arguments[e];
5
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
+ }
7
+ return n;
8
+ }, _extends.apply(null, arguments);
9
+ }
10
+ import { defineComponent, $prefix, $props, $setup } from "@opentinyvue/vue-common";
11
+ import PcTemplate from "./pc.js";
12
+ import MobileFirstTemplate from "./mobile-first.js";
13
+ import "@opentinyvue/vue-theme/currency/index.css";
14
+ var template = function template2(mode) {
15
+ var _process$env;
16
+ var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
17
+ if ("pc" === (tinyMode || mode)) {
18
+ return PcTemplate;
19
+ }
20
+ if ("mobile-first" === (tinyMode || mode)) {
21
+ return MobileFirstTemplate;
22
+ }
23
+ return PcTemplate;
24
+ };
25
+ var Currency = defineComponent({
26
+ name: $prefix + "Currency",
27
+ props: _extends({}, $props, {
28
+ clearable: {
29
+ type: Boolean,
30
+ default: true
31
+ },
32
+ currency: {
33
+ type: String,
34
+ default: "CNY"
35
+ },
36
+ disabled: {
37
+ type: Boolean,
38
+ default: false
39
+ },
40
+ fetchCurrency: Function,
41
+ fields: Object,
42
+ modelValue: {},
43
+ placeholder: {
44
+ type: String,
45
+ default: ""
46
+ },
47
+ popperAppendToBody: {
48
+ type: Boolean,
49
+ default: true
50
+ },
51
+ popperClass: String,
52
+ size: String,
53
+ setDefault: {
54
+ type: Boolean,
55
+ default: false
56
+ },
57
+ fetchDefaultCurrency: Function,
58
+ setDefaultCurrency: Function,
59
+ visible: {
60
+ type: Boolean,
61
+ default: false
62
+ },
63
+ title: String,
64
+ mode: String,
65
+ multiple: {
66
+ type: Boolean,
67
+ default: false
68
+ },
69
+ searchConfig: Object,
70
+ dropStyle: {
71
+ type: Object,
72
+ default: function _default() {
73
+ return {};
74
+ }
75
+ },
76
+ label: {
77
+ type: String,
78
+ default: ""
79
+ },
80
+ tip: String,
81
+ shape: String
82
+ }),
83
+ setup: function setup(props, context) {
84
+ return $setup({
85
+ props,
86
+ context,
87
+ template
88
+ });
89
+ }
90
+ });
91
+ var version = "2.21.0";
92
+ Currency.model = {
93
+ prop: "modelValue",
94
+ event: "update:modelValue"
95
+ };
96
+ Currency.install = function(Vue) {
97
+ Vue.component(Currency.name, Currency);
98
+ };
99
+ Currency.version = version;
100
+ export {
101
+ Currency as default
102
+ };
@@ -0,0 +1,89 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/currency/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import SelectMobile from '@opentinyvue/vue-select-mobile';
4
+
5
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
6
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
7
+ if (render) {
8
+ options.render = render;
9
+ options.staticRenderFns = staticRenderFns;
10
+ options._compiled = true;
11
+ }
12
+ var hook;
13
+ if (injectStyles) {
14
+ hook = injectStyles;
15
+ }
16
+ if (hook) {
17
+ if (options.functional) {
18
+ options._injectStyles = hook;
19
+ var originalRender = options.render;
20
+ options.render = function renderWithStyleInjection(h, context) {
21
+ hook.call(context);
22
+ return originalRender(h, context);
23
+ };
24
+ } else {
25
+ var existing = options.beforeCreate;
26
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
27
+ }
28
+ }
29
+ return {
30
+ exports: scriptExports,
31
+ options
32
+ };
33
+ }
34
+
35
+ var render = function render2() {
36
+ var _vm = this;
37
+ var _h = _vm.$createElement;
38
+ var _c = _vm._self._c || _h;
39
+ return _c("tiny-select-mobile", _vm._b({
40
+ attrs: {
41
+ "data-tag": "tiny-currency",
42
+ "mode": _vm.mode,
43
+ "model-value": _vm.state.selectedValue,
44
+ "menus": _vm.state.options,
45
+ "value-field": "value",
46
+ "text-field": "label",
47
+ "title": _vm.title || _vm.t("ui.currency.chooseCurrency"),
48
+ "placeholder": _vm.placeholder,
49
+ "multiple": _vm.multiple,
50
+ "visible": _vm.visible,
51
+ "search-config": _vm.state.searchConfig
52
+ },
53
+ on: {
54
+ "update:modelValue": function updateModelValue($event) {
55
+ return _vm.$emit("update:modelValue", $event);
56
+ },
57
+ "update:visible": _vm.visibleChange
58
+ }
59
+ }, "tiny-select-mobile", _vm.a(_vm.$attrs, ["^on[A-Z]"]), false));
60
+ };
61
+ var staticRenderFns = [];
62
+ var __vue2_script = defineComponent({
63
+ inheritAttrs: false,
64
+ components: {
65
+ TinySelectMobile: SelectMobile
66
+ },
67
+ emits: ["update:modelValue", "change", "clear", "visible-change", "update:visible"],
68
+ props: [].concat(props, ["visible", "modelValue", "title", "mode", "multiple", "searchConfig", "fetchCurrency", "fields", "placeholder", "currency"]),
69
+ setup: function setup$1(props2, context) {
70
+ return setup({
71
+ props: props2,
72
+ context,
73
+ renderless,
74
+ api
75
+ });
76
+ }
77
+ });
78
+ var __cssModules = {};
79
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
80
+ function __vue2_injectStyles(context) {
81
+ for (var o in __cssModules) {
82
+ this[o] = __cssModules[o];
83
+ }
84
+ }
85
+ var mobileFirst = /* @__PURE__ */ function() {
86
+ return __component__.exports;
87
+ }();
88
+
89
+ export { mobileFirst as default };
package/lib/pc.js ADDED
@@ -0,0 +1,131 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/currency/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import Select from '@opentinyvue/vue-select';
4
+ import Option from '@opentinyvue/vue-option';
5
+ import { IconStarActive, IconStarDisable } from '@opentinyvue/vue-icon';
6
+
7
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
8
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
9
+ if (render) {
10
+ options.render = render;
11
+ options.staticRenderFns = staticRenderFns;
12
+ options._compiled = true;
13
+ }
14
+ var hook;
15
+ if (injectStyles) {
16
+ hook = injectStyles;
17
+ }
18
+ if (hook) {
19
+ if (options.functional) {
20
+ options._injectStyles = hook;
21
+ var originalRender = options.render;
22
+ options.render = function renderWithStyleInjection(h, context) {
23
+ hook.call(context);
24
+ return originalRender(h, context);
25
+ };
26
+ } else {
27
+ var existing = options.beforeCreate;
28
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
29
+ }
30
+ }
31
+ return {
32
+ exports: scriptExports,
33
+ options
34
+ };
35
+ }
36
+
37
+ var __vue2_script = defineComponent({
38
+ inheritAttrs: false,
39
+ components: {
40
+ TinySelect: Select,
41
+ TinyOption: Option,
42
+ IconStarActive: IconStarActive(),
43
+ IconStarDisable: IconStarDisable()
44
+ },
45
+ emits: ["update:modelValue", "change", "clear", "visible-change"],
46
+ props: [].concat(props, ["modelValue", "placeholder", "fetchCurrency", "fields", "size", "clearable", "disabled", "popperClass", "popperAppendToBody", "currency", "setDefault", "fetchDefaultCurrency", "setDefaultCurrency", "label", "dropStyle", "shape", "tip"]),
47
+ setup: function setup$1(props2, context) {
48
+ return setup({
49
+ props: props2,
50
+ context,
51
+ renderless,
52
+ api
53
+ });
54
+ }
55
+ });
56
+ var render = function render2() {
57
+ var _vm = this;
58
+ var _h = _vm.$createElement;
59
+ var _c = _vm._self._c || _h;
60
+ return _c("tiny-select", _vm._b({
61
+ staticClass: "tiny-currency",
62
+ attrs: {
63
+ "filterable": !_vm.shape,
64
+ "size": _vm.size,
65
+ "clearable": _vm.clearable,
66
+ "label": _vm.label,
67
+ "tip": _vm.tip,
68
+ "shape": _vm.shape,
69
+ "disabled": _vm.disabled,
70
+ "placeholder": _vm.placeholder,
71
+ "drop-style": _vm.dropStyle
72
+ },
73
+ on: {
74
+ "change": _vm.change,
75
+ "clear": function clear($event) {
76
+ return _vm.$emit("clear");
77
+ },
78
+ "visible-change": function visibleChange($event) {
79
+ return _vm.$emit("visible-change", $event);
80
+ }
81
+ },
82
+ model: {
83
+ value: _vm.state.selectedValue,
84
+ callback: function callback($$v) {
85
+ _vm.$set(_vm.state, "selectedValue", $$v);
86
+ },
87
+ expression: "state.selectedValue"
88
+ }
89
+ }, "tiny-select", _vm.a(_vm.$attrs, ["^on[A-Z]"]), false), _vm._l(_vm.state.options, function(item) {
90
+ return _c("tiny-option", {
91
+ key: item.value,
92
+ staticClass: "tiny-currency-option",
93
+ class: {
94
+ "set-default": _vm.setDefault,
95
+ "is-active": item.value === _vm.state.defaultCurrency
96
+ },
97
+ attrs: {
98
+ "label": item.label,
99
+ "value": item.value
100
+ }
101
+ }, [_c("span", {
102
+ staticStyle: {
103
+ "display": "flex"
104
+ }
105
+ }, [_c("span", {
106
+ staticClass: "tiny-currency-option-label"
107
+ }, [_vm._v(_vm._s(item.label))]), _vm.setDefault ? _c("span", {
108
+ staticClass: "tiny-currency-option-set",
109
+ on: {
110
+ "click": function click($event) {
111
+ return _vm.toogleDefaultCurrency(item.value, item.value === _vm.state.defaultCurrency);
112
+ }
113
+ }
114
+ }, [_c(item.value === _vm.state.defaultCurrency ? "icon-star-active" : "icon-star-disable", {
115
+ tag: "component"
116
+ }), _c("span", [_vm._v(" " + _vm._s(item.value === _vm.state.defaultCurrency ? _vm.t("ui.currency.defaultCurrency") : _vm.t("ui.currency.setDefault")) + " ")])], 1) : _vm._e()])]);
117
+ }), 1);
118
+ };
119
+ var staticRenderFns = [];
120
+ var __cssModules = {};
121
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
122
+ function __vue2_injectStyles(context) {
123
+ for (var o in __cssModules) {
124
+ this[o] = __cssModules[o];
125
+ }
126
+ }
127
+ var pc = /* @__PURE__ */ function() {
128
+ return __component__.exports;
129
+ }();
130
+
131
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "@opentinyvue/vue-currency",
3
+ "version": "2.21.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "dependencies": {
10
+ "@opentinyvue/vue-common": "~2.21.0",
11
+ "@opentinyvue/vue-renderless": "~3.21.0",
12
+ "@opentinyvue/vue-select": "~2.21.0",
13
+ "@opentinyvue/vue-option": "~2.21.0",
14
+ "@opentinyvue/vue-theme": "~3.21.0",
15
+ "@opentinyvue/vue-select-mobile": "~2.21.0",
16
+ "@opentinyvue/vue-icon": "~2.21.0"
17
+ },
18
+ "license": "MIT",
19
+ "types": "index.d.ts",
20
+ "scripts": {
21
+ "build": "pnpm -w build:ui $npm_package_name",
22
+ "//postversion": "pnpm build"
23
+ }
24
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;